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
682197ffc07aedf13597eb1b77aac0a081385562
fa60010333d5cbb9c54e3c795884de8928d3f98f
/sxp-android-framework/src/main/java/sxp/android/framework/ui/BaseActivity.java
59519c35e2c7c2840112735a33b72865e2032504
[]
no_license
sayi21cn/app-framework
9e3b2d79b3b5a3b8c61777edaaeaeb5b38f7d231
b85d6f3b184f24a6f1a2ace402971d452c8aecdb
refs/heads/master
2020-12-11T07:25:36.544139
2015-10-19T07:47:13
2015-10-19T07:47:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,626
java
package sxp.android.framework.ui; import java.lang.reflect.Field; import java.util.HashMap; import sxp.android.framework.annotation.ID; import sxp.android.framework.annotation.LAYOUT; import sxp.android.framework.annotation.RESOURE; import sxp.android.framework.interfaces.LastActivityListener; import sxp.android.framework.manager.ActivityManager; import sxp.android.framework.util.StringUtil; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.view.KeyEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.view.WindowManager; import android.widget.Toast; /** * ui基类 * * @author xiaoping.shan * */ public class BaseActivity extends FragmentActivity implements OnClickListener,LastActivityListener { //tag private static final String TAG = "BaseActivity"; //上下文 存储上下文数据 private HashMap<String,Object> context; //将要传递的上下文 private HashMap<String,Object> nextContext; protected void onCreate(Bundle savedInstanceState){ // TODO Auto-generated method stub super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); //上下文数据传递 LastActivityListener lastListener = ActivityManager.getInstance().peekDoesntMatterFinish(); ActivityManager.getInstance().push(this); if(null!=lastListener){ lastListener.intoNextActivity(); } // 注入布局 layoutContentView(); // 初始化空间,注解方式 initComponent(); // 对ui进行模板布局,以及一些ui的界面初始化化,不包含数据 layout(); // 没有保存数据和重建的情况下 if (savedInstanceState == null) { dataInit(); } else { // 数据恢复 dataRestore(savedInstanceState); } eventDispose(); } /** * 数据恢复 */ protected void dataRestore(Bundle savedInstanceState){} /** * 数据初始化 */ protected void dataInit(){}; /** * 注入布局 */ private void layoutContentView() { LAYOUT layoutAnnatation = this.getClass().getAnnotation(LAYOUT.class); if (layoutAnnatation != null) { int layoutValue = layoutAnnatation.value(); if (layoutValue != -1) { setContentView(layoutValue); } } } /** * 对ui进行模板布局,以及一些ui的界面初始化化,不包含数据 */ protected void layout() {} /** * 事件执行 */ protected void eventDispose() {} /** * 界面刷新 * * @param param */ protected void refesh(Object... param) {} /******************************** 【跳转到其他界面】 *******************************************/ public void openActivity(Class<?> pClass) { openActivity(pClass,null,null,false); } public void openActivity(Class<?> pClass,boolean isFinish) { openActivity(pClass,null,null,isFinish); } public void openActivity(Class<?> pClass, Bundle pBundle) { openActivity(pClass,pBundle,null,false); } public void openActivity(Class<?> pClass, Bundle pBundle,boolean isFinish) { openActivity(pClass,pBundle,null,isFinish); } public void openActivity(Class<?> pClass,HashMap<String,Object> context){ openActivity(pClass,null,context,false); } public void openActivity(Class<?> pClass,HashMap<String,Object> context,boolean isFinish){ openActivity(pClass,null,context,isFinish); } public void openActivity(Class<?> pClass,Bundle pBundle,HashMap<String,Object> context){ openActivity(pClass,pBundle,context,false); } public void openActivity(Class<?> pClass, Bundle pBundle,HashMap<String,Object> context,boolean isFinish) { Intent intent = new Intent(this, pClass); if (pBundle != null) { intent.putExtras(pBundle); } if(context != null){ setNextContext(context); } startActivity(intent); if(isFinish){ finishBase(); } } public void openActivity(String pAction) { openActivity(pAction, null); } public void openActivity(String pAction, Bundle pBundle) { Intent intent = new Intent(pAction); if (pBundle != null) { intent.putExtras(pBundle); } startActivity(intent); } /******************************** 【跳转到子界面】 *******************************************/ public void openActivityResult(Class<?> pClass, int requestCode) { openActivityResult(pClass, null, requestCode); } public void openActivityResult(Class<?> pClass) { openActivityResult(pClass, null); } public void openActivityResult(Class<?> pClass, Bundle pBundle) { openActivityResult(pClass, pBundle, 0); } public void openActivityResult(Class<?> pClass, Bundle pBundle, int requestCode) { Intent intent = new Intent(this, pClass); if (pBundle != null) { intent.putExtras(pBundle); } startActivityForResult(intent, requestCode); } /******************************** 【依赖注入view】 **************************************/ protected void initComponent() { Class<? extends BaseActivity> clazz = this.getClass(); Field[] fields = clazz.getDeclaredFields(); for (Field field : fields) { field.setAccessible(true); Class<?> type = field.getType(); if (View.class.isAssignableFrom(type)) { // String idName = field.getName(); // 如果字段上有注解则采用注解的id ID idAnnotation = field.getAnnotation(ID.class); if (idAnnotation != null) { int idValue = idAnnotation.value(); if (idValue != -1) { View view = findViewById(idValue); if (view != null) { try { field.set(this, view); if (idAnnotation.isBindListener()) { view.setOnClickListener(this); } } catch (Exception e) { e.printStackTrace(); } } } } } RESOURE resouceAnnotation = field.getAnnotation(RESOURE.class); if (resouceAnnotation != null) { String resouceValue = resouceAnnotation.value(); if (!StringUtil.isEmpty(resouceValue)) { Object valueOb = getIntent().getExtras().get(resouceValue); if (valueOb != null) { try { field.set(this,valueOb); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } } } /******************************** 【界面提示】 *******************************************/ public void showShortToast(int pResId) { showShortToast(getString(pResId)); } public void showLongToast(String pMsg) { Toast.makeText(this, pMsg, Toast.LENGTH_LONG).show(); } public void showShortToast(String pMsg) { Toast.makeText(this, pMsg, Toast.LENGTH_SHORT).show(); } /* 自定义清除 */ public void finishBase() { clearContext(); ActivityManager.getInstance().pop(this.getClass().getName()); } /*************************************************【界面监听】************************************************/ @Override public boolean onKeyDown(int keyCode, KeyEvent event) { // TODO Auto-generated method stub if (keyCode == KeyEvent.KEYCODE_BACK) { finishBase(); return true; } return super.onKeyDown(keyCode, event); } @Override public void onClick(View v) {} /****************************************************【参数】****************************************************/ public HashMap<String, Object> getContext() { return context; } public void setContext(HashMap<String, Object> context) { this.context = context; } public HashMap<String, Object> getNextContext() { return nextContext; } public void setNextContext(HashMap<String, Object> nextContext) { this.nextContext = nextContext; } public void putContext(String key,Object object){ if(null == context){ context = new HashMap<String, Object>(); } context.put(key,object); } public Object getContext(String key){ if(null==context){ return null; } return context.get(key); } public void putContext(Object object){ if(null!=object){ String key = object.getClass().getName(); putContext(key, object); } } @SuppressWarnings("unchecked") public <T> T getContext(Class<T> classObj){ String key = classObj.getName(); return (T)getContext(key); } public void putNextContext(String key,Object object){ if(null == nextContext){ nextContext = new HashMap<String, Object>(); } nextContext.put(key,object); } public void putNextContext(Object object){ putNextContext(object.getClass().getName(),object); } /** * 清理上下文 */ private void clearContext(){ if(null!=context){ context.clear(); context = null; } } private void clearNextContext(){ if(null!=nextContext){ nextContext.clear(); nextContext = null; } } public static String getTag() { return TAG; } @SuppressWarnings("unchecked") @Override public void intoNextActivity() { // TODO Auto-generated method stub if(null!=getNextContext()){ BaseActivity nextActivity = ActivityManager.getInstance().peek(); if(null!=nextActivity){ nextActivity.setContext((HashMap<String,Object>)getNextContext().clone()); clearNextContext(); } } } }
f2f6c58d27fb009f8d4867f11d6aa70f7554fcdc
3d01245280db291ff21f08e82018025b981b379d
/gia-kordzaiaN4/src/demo1/Main.java
abdbde720a9219feae8f2cb682a6f58245ec291b
[]
no_license
Gia-kordzaia/Gia-Kordzaia
b50eb9e4f7f086f1a66cc8e80e1d8f2578bff6fb
2186d1e74d2024af96568521bc8876dd8854e72a
refs/heads/main
2023-02-20T16:42:16.419971
2021-01-27T16:53:36
2021-01-27T16:53:36
311,997,043
0
0
null
null
null
null
UTF-8
Java
false
false
223
java
package demo1; public class Main { public static void main(String[] args) { names<String> nms = new names<>(); nms.add("one"); nms.add("two"); System.out.println(nms); } }
0ed35450725d5993d1126b3f1d74d42f21c9360e
2c7bbc8139c4695180852ed29b229bb5a0f038d7
/com/facebook/react/uimanager/UIViewOperationQueue$FindTargetForTouchOperation.java
be4c4a1a61e77e94196592aeabaf5936054ec35d
[]
no_license
suliyu/evolucionNetflix
6126cae17d1f7ea0bc769ee4669e64f3792cdd2f
ac767b81e72ca5ad636ec0d471595bca7331384a
refs/heads/master
2020-04-27T05:55:47.314928
2017-05-08T17:08:22
2017-05-08T17:08:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,006
java
// // Decompiled by Procyon v0.5.30 // package com.facebook.react.uimanager; import android.view.Choreographer$FrameCallback; import com.facebook.react.animation.Animation; import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; import com.facebook.react.bridge.SoftAssertions; import java.util.concurrent.TimeUnit; import java.util.concurrent.Semaphore; import com.facebook.react.bridge.UiThreadUtil; import com.facebook.react.bridge.ReactContext; import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugListener; import com.facebook.react.bridge.ReactApplicationContext; import java.util.ArrayDeque; import java.util.ArrayList; import com.facebook.react.animation.AnimationRegistry; import com.facebook.react.bridge.Callback; final class UIViewOperationQueue$FindTargetForTouchOperation implements UIViewOperationQueue$UIOperation { private final Callback mCallback; private final int mReactTag; private final float mTargetX; private final float mTargetY; final /* synthetic */ UIViewOperationQueue this$0; private UIViewOperationQueue$FindTargetForTouchOperation(final UIViewOperationQueue this$0, final int mReactTag, final float mTargetX, final float mTargetY, final Callback mCallback) { this.this$0 = this$0; this.mReactTag = mReactTag; this.mTargetX = mTargetX; this.mTargetY = mTargetY; this.mCallback = mCallback; } @Override public void execute() { float n; float n2; int targetTagForTouch; try { this.this$0.mNativeViewHierarchyManager.measure(this.mReactTag, this.this$0.mMeasureBuffer); n = this.this$0.mMeasureBuffer[0]; n2 = this.this$0.mMeasureBuffer[1]; targetTagForTouch = this.this$0.mNativeViewHierarchyManager.findTargetTagForTouch(this.mReactTag, this.mTargetX, this.mTargetY); final UIViewOperationQueue$FindTargetForTouchOperation uiViewOperationQueue$FindTargetForTouchOperation = this; final UIViewOperationQueue uiViewOperationQueue = uiViewOperationQueue$FindTargetForTouchOperation.this$0; final NativeViewHierarchyManager nativeViewHierarchyManager = uiViewOperationQueue.mNativeViewHierarchyManager; final int n3 = targetTagForTouch; final UIViewOperationQueue$FindTargetForTouchOperation uiViewOperationQueue$FindTargetForTouchOperation2 = this; final UIViewOperationQueue uiViewOperationQueue2 = uiViewOperationQueue$FindTargetForTouchOperation2.this$0; final int[] array = uiViewOperationQueue2.mMeasureBuffer; nativeViewHierarchyManager.measure(n3, array); final UIViewOperationQueue$FindTargetForTouchOperation uiViewOperationQueue$FindTargetForTouchOperation3 = this; final UIViewOperationQueue uiViewOperationQueue3 = uiViewOperationQueue$FindTargetForTouchOperation3.this$0; final int[] array2 = uiViewOperationQueue3.mMeasureBuffer; final int n4 = 0; final int n5 = array2[n4]; final float n6 = n5; final float n7 = n; final float n8 = n6 - n7; final float n9 = PixelUtil.toDIPFromPixel(n8); final UIViewOperationQueue$FindTargetForTouchOperation uiViewOperationQueue$FindTargetForTouchOperation4 = this; final UIViewOperationQueue uiViewOperationQueue4 = uiViewOperationQueue$FindTargetForTouchOperation4.this$0; final int[] array3 = uiViewOperationQueue4.mMeasureBuffer; final int n10 = 1; final int n11 = array3[n10]; final float n12 = n11; final float n13 = n2; final float n14 = n12 - n13; final float n15 = PixelUtil.toDIPFromPixel(n14); final UIViewOperationQueue$FindTargetForTouchOperation uiViewOperationQueue$FindTargetForTouchOperation5 = this; final UIViewOperationQueue uiViewOperationQueue5 = uiViewOperationQueue$FindTargetForTouchOperation5.this$0; final int[] array4 = uiViewOperationQueue5.mMeasureBuffer; final int n16 = 2; final int n17 = array4[n16]; final float n18 = n17; final float n19 = PixelUtil.toDIPFromPixel(n18); final UIViewOperationQueue$FindTargetForTouchOperation uiViewOperationQueue$FindTargetForTouchOperation6 = this; final UIViewOperationQueue uiViewOperationQueue6 = uiViewOperationQueue$FindTargetForTouchOperation6.this$0; final int[] array5 = uiViewOperationQueue6.mMeasureBuffer; final int n20 = 3; final int n21 = array5[n20]; final float n22 = n21; final float n23 = PixelUtil.toDIPFromPixel(n22); final UIViewOperationQueue$FindTargetForTouchOperation uiViewOperationQueue$FindTargetForTouchOperation7 = this; final Callback callback = uiViewOperationQueue$FindTargetForTouchOperation7.mCallback; final int n24 = 5; final Object[] array6 = new Object[n24]; final int n25 = 0; final int n26 = targetTagForTouch; final Integer n27 = n26; array6[n25] = n27; final int n28 = 1; final float n29 = n9; final Float n30 = n29; array6[n28] = n30; final int n31 = 2; final float n32 = n15; final Float n33 = n32; array6[n31] = n33; final int n34 = 3; final float n35 = n19; final Float n36 = n35; array6[n34] = n36; final int n37 = 4; final float n38 = n23; final Float n39 = n38; array6[n37] = n39; callback.invoke(array6); return; } catch (IllegalViewOperationException ex) { this.mCallback.invoke(new Object[0]); return; } try { final UIViewOperationQueue$FindTargetForTouchOperation uiViewOperationQueue$FindTargetForTouchOperation = this; final UIViewOperationQueue uiViewOperationQueue = uiViewOperationQueue$FindTargetForTouchOperation.this$0; final NativeViewHierarchyManager nativeViewHierarchyManager = uiViewOperationQueue.mNativeViewHierarchyManager; final int n3 = targetTagForTouch; final UIViewOperationQueue$FindTargetForTouchOperation uiViewOperationQueue$FindTargetForTouchOperation2 = this; final UIViewOperationQueue uiViewOperationQueue2 = uiViewOperationQueue$FindTargetForTouchOperation2.this$0; final int[] array = uiViewOperationQueue2.mMeasureBuffer; nativeViewHierarchyManager.measure(n3, array); final UIViewOperationQueue$FindTargetForTouchOperation uiViewOperationQueue$FindTargetForTouchOperation3 = this; final UIViewOperationQueue uiViewOperationQueue3 = uiViewOperationQueue$FindTargetForTouchOperation3.this$0; final int[] array2 = uiViewOperationQueue3.mMeasureBuffer; final int n4 = 0; final int n5 = array2[n4]; final float n6 = n5; final float n7 = n; final float n8 = n6 - n7; final float n9 = PixelUtil.toDIPFromPixel(n8); final UIViewOperationQueue$FindTargetForTouchOperation uiViewOperationQueue$FindTargetForTouchOperation4 = this; final UIViewOperationQueue uiViewOperationQueue4 = uiViewOperationQueue$FindTargetForTouchOperation4.this$0; final int[] array3 = uiViewOperationQueue4.mMeasureBuffer; final int n10 = 1; final int n11 = array3[n10]; final float n12 = n11; final float n13 = n2; final float n14 = n12 - n13; final float n15 = PixelUtil.toDIPFromPixel(n14); final UIViewOperationQueue$FindTargetForTouchOperation uiViewOperationQueue$FindTargetForTouchOperation5 = this; final UIViewOperationQueue uiViewOperationQueue5 = uiViewOperationQueue$FindTargetForTouchOperation5.this$0; final int[] array4 = uiViewOperationQueue5.mMeasureBuffer; final int n16 = 2; final int n17 = array4[n16]; final float n18 = n17; final float n19 = PixelUtil.toDIPFromPixel(n18); final UIViewOperationQueue$FindTargetForTouchOperation uiViewOperationQueue$FindTargetForTouchOperation6 = this; final UIViewOperationQueue uiViewOperationQueue6 = uiViewOperationQueue$FindTargetForTouchOperation6.this$0; final int[] array5 = uiViewOperationQueue6.mMeasureBuffer; final int n20 = 3; final int n21 = array5[n20]; final float n22 = n21; final float n23 = PixelUtil.toDIPFromPixel(n22); final UIViewOperationQueue$FindTargetForTouchOperation uiViewOperationQueue$FindTargetForTouchOperation7 = this; final Callback callback = uiViewOperationQueue$FindTargetForTouchOperation7.mCallback; final int n24 = 5; final Object[] array6 = new Object[n24]; final int n25 = 0; final int n26 = targetTagForTouch; final Integer n27 = n26; array6[n25] = n27; final int n28 = 1; final float n29 = n9; final Float n30 = n29; array6[n28] = n30; final int n31 = 2; final float n32 = n15; final Float n33 = n32; array6[n31] = n33; final int n34 = 3; final float n35 = n19; final Float n36 = n35; array6[n34] = n36; final int n37 = 4; final float n38 = n23; final Float n39 = n38; array6[n37] = n39; callback.invoke(array6); } catch (IllegalViewOperationException ex2) { this.mCallback.invoke(new Object[0]); } } }
e0bce5f19517dce3a856cd4cc2cc2dc7def0d141
b345f82f22f6607a6dcff8ef86c44dce80e8f378
/subprojects/griffon-core-java8/src/main/java/griffon/core/editors/LocalDateTimePropertyEditor.java
d7e0e09582f49304e39d18742cb8c6e289318dda
[ "Apache-2.0" ]
permissive
eunsebi/griffon
2296201165b0e4842e84d8764a7bde6f1f9ca56a
52a2c4bb33953438d62fffd0e4b7d7740930bb0d
refs/heads/master
2021-01-01T20:36:01.491286
2017-06-22T08:45:33
2017-06-22T08:45:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,239
java
/* * Copyright 2008-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package griffon.core.editors; import griffon.core.formatters.Formatter; import griffon.core.formatters.LocalDateTimeFormatter; import griffon.metadata.PropertyEditorFor; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.format.DateTimeParseException; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; import static griffon.util.GriffonNameUtils.isBlank; /** * @author Andres Almiray * @since 2.4.0 */ @PropertyEditorFor(LocalDateTime.class) public class LocalDateTimePropertyEditor extends AbstractPropertyEditor { protected void setValueInternal(Object value) { if (null == value) { super.setValueInternal(null); } else if (value instanceof CharSequence) { handleAsString(String.valueOf(value)); } else if (value instanceof LocalDateTime) { super.setValueInternal(value); } else if (value instanceof LocalDate) { super.setValueInternal(LocalDateTime.of((LocalDate) value, LocalTime.of(0, 0, 0, 0))); } else if (value instanceof Date) { handleAsDate((Date) value); } else if (value instanceof Calendar) { handleAsCalendar((Calendar) value); } else if (value instanceof Number) { handleAsDate(new Date(((Number) value).longValue())); } else if (value instanceof List) { handleAsList((List) value); } else { throw illegalValue(value, LocalDateTime.class); } } protected void handleAsDate(Date date) { Calendar c = Calendar.getInstance(); c.setTime(date); handleAsCalendar(c); } protected void handleAsCalendar(Calendar value) { int h = value.get(Calendar.HOUR); int i = value.get(Calendar.MINUTE); int s = value.get(Calendar.SECOND); int n = value.get(Calendar.MILLISECOND) * 1000; super.setValueInternal(LocalDateTime.of(LocalDate.ofEpochDay(value.getTime().getTime()), LocalTime.of(h, i, s, n))); } protected void handleAsString(String str) { if (isBlank(str)) { super.setValueInternal(null); return; } try { super.setValueInternal(LocalDateTime.parse(str)); } catch (DateTimeParseException dtpe) { throw illegalValue(str, LocalDateTime.class, dtpe); } } protected Formatter<LocalDateTime> resolveFormatter() { return isBlank(getFormat()) ? null : new LocalDateTimeFormatter(getFormat()); } protected void handleAsList(List<?> list) { if (list.isEmpty()) { super.setValueInternal(null); return; } List<Object> values = new ArrayList<>(); values.addAll(list); switch (list.size()) { case 7: // ok break; case 6: values.add(0d); break; case 5: values.add(0d); values.add(0d); break; case 4: values.add(0d); values.add(0d); values.add(0d); break; case 3: values.add(0d); values.add(0d); values.add(0d); values.add(0d); break; default: throw illegalValue(list, LocalDateTime.class); } for (int i = 0, valuesSize = values.size(); i < valuesSize; i++) { Object val = values.get(i); if (val instanceof Number) { values.set(i, parse((Number) val)); } else if (val instanceof CharSequence) { values.set(i, parse(String.valueOf(val))); } else { throw illegalValue(list, LocalDateTime.class); } } super.setValueInternal( LocalDateTime.of( (Integer) values.get(0), (Integer) values.get(1), (Integer) values.get(2), (Integer) values.get(3), (Integer) values.get(4), (Integer) values.get(5), (Integer) values.get(6) ) ); } protected int parse(String val) { try { return Integer.parseInt(val.trim()); } catch (NumberFormatException e) { throw illegalValue(val, LocalDateTime.class, e); } } protected int parse(Number val) { return val.intValue(); } }
4e27a88d8be4746c770e56db977ebaaeb8179d6a
efa10ceb11948186693d08d1ead2c8787136f697
/lib_mvvmutil/src/main/java/com/bhj/lib_mvvmutil/ui/PagerState.java
362323f100ff01e56dc10e0129458fb1db804d74
[]
no_license
weiwangshuai/mvvmUtil
4ea97344a7a74f7227d5779e40089c3dd0130c11
da0bffa6e9558977a4bf21e3b3206342252c6bc8
refs/heads/master
2020-09-12T08:50:27.292563
2019-11-18T05:56:22
2019-11-18T05:56:22
222,373,903
1
0
null
null
null
null
UTF-8
Java
false
false
148
java
package com.bhj.lib_mvvmutil.ui; /** * 页面的各种状态 */ public enum PagerState { UNKNOWN, LOADING, ERROR, SUCCEED ,EMPTY ,TIME_OUT }
3df2d5428de988d4677e2270bc968a58f78af461
d4dbb0571226af5809cc953e73924d505094e211
/Hibernate/09.Workshop/AirConditionerTestingSystem/src/main/java/app/repositories/ReportRepository.java
e54dfb50ac01e8ee10c188dc476ca24eb16c563c
[]
no_license
vasilgramov/database-fundamentals
45e258e965e85514e60b849d9049737ae25e81c0
0ebe74ab4bffef0d29d6ee2e200f07bdc24fe6bf
refs/heads/master
2021-06-18T17:54:36.238976
2017-07-10T14:49:44
2017-07-10T14:49:44
89,739,950
0
1
null
null
null
null
UTF-8
Java
false
false
326
java
package app.repositories; import app.domains.entities.reports.Report; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import javax.transaction.Transactional; @Repository @Transactional public interface ReportRepository extends JpaRepository<Report, Long> { }
d869a1c21161b592df7a696a3b931fb292cb8ff1
db3fa6b08e629ef268d501a511492162bcec9448
/src/main/java/io/github/pcrnkovic/jspfop/tag/BidiOverride.java
e20e8bcbec9acb40b411cf1a720bea7e8ea6973a
[]
no_license
pcrnkovic/jsp-fop
6d2eb4dcfb72886dd03a8bcbd7837a4094d9ff95
7b9c6aede127e926d1748a96c000e1c2161ab3ba
refs/heads/master
2021-04-03T08:29:26.631084
2020-09-16T14:56:04
2020-09-16T14:56:04
124,656,861
1
0
null
null
null
null
UTF-8
Java
false
false
1,479
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 io.github.pcrnkovic.jspfop.tag; import io.github.pcrnkovic.jspfop.attr.CommonRelativePositionProperties; import io.github.pcrnkovic.jspfop.attr.LineHeight; import io.github.pcrnkovic.jspfop.attr.LetterSpacing; import io.github.pcrnkovic.jspfop.attr.Direction; import io.github.pcrnkovic.jspfop.attr.IndexClass; import io.github.pcrnkovic.jspfop.attr.CommonFontProperties; import io.github.pcrnkovic.jspfop.attr.IndexKey; import io.github.pcrnkovic.jspfop.attr.WordSpacing; import io.github.pcrnkovic.jspfop.attr.Rendered; import io.github.pcrnkovic.jspfop.attr.ScoreSpaces; import io.github.pcrnkovic.jspfop.attr.Id; import io.github.pcrnkovic.jspfop.attr.CommonAuralProperties; import io.github.pcrnkovic.jspfop.attr.UnicodeBidi; import io.github.pcrnkovic.jspfop.attr.Color; import io.github.pcrnkovic.jspfop.tag.base.AbstractFopTag; /** * * @author Pavle Crnković */ public class BidiOverride extends AbstractFopTag implements io.github.pcrnkovic.jspfop.tag.group.Inline, Rendered, CommonAuralProperties, CommonFontProperties, CommonRelativePositionProperties, Color, Direction, Id, IndexClass, IndexKey, LetterSpacing, LineHeight, ScoreSpaces, UnicodeBidi, WordSpacing { public BidiOverride() { super("bidi-override", false); } }
fb7cfb8aa970b08f687b258947c6af6e5a31adbc
d44ca237ce9c8e6d3115956ed3eda0e6f3c66fe0
/jscenegraph/src/jscenegraph/database/inventor/shapenodes/soshape_trianglesort.java
1f5df0f5faa82e9d7de861f8725af30e7de2bb01
[ "BSD-3-Clause" ]
permissive
YvesBoyadjian/Koin3D
bf0128a91ee90b1eaf2127aa8f4903b23680c2db
5b89e63fc460882f1acb642ff6323f6acdfd6160
refs/heads/master
2023-06-22T18:18:47.413274
2023-06-16T10:34:47
2023-06-16T10:34:47
139,198,732
16
5
null
null
null
null
UTF-8
Java
false
false
139
java
/** * */ package jscenegraph.database.inventor.shapenodes; /** * @author Yves Boyadjian * */ public class soshape_trianglesort { }
b2761a51c40a576aaf0feb2c3a726d73a772997e
1d928c3f90d4a0a9a3919a804597aa0a4aab19a3
/java/dbeaver/2016/8/OracleSQLDialect.java
01bc05fa2a3e42558eb89737bd1cfac4b8f897da
[]
no_license
rosoareslv/SED99
d8b2ff5811e7f0ffc59be066a5a0349a92cbb845
a062c118f12b93172e31e8ca115ce3f871b64461
refs/heads/main
2023-02-22T21:59:02.703005
2021-01-28T19:40:51
2021-01-28T19:40:51
306,497,459
1
1
null
2020-11-24T20:56:18
2020-10-23T01:18:07
null
UTF-8
Java
false
false
8,395
java
/* * DBeaver - Universal Database Manager * Copyright (C) 2010-2016 Serge Rieder ([email protected]) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License (version 2) * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jkiss.dbeaver.ext.oracle.model; import org.jkiss.code.NotNull; import org.jkiss.dbeaver.model.exec.jdbc.JDBCDatabaseMetaData; import org.jkiss.dbeaver.model.impl.jdbc.JDBCSQLDialect; import java.util.Arrays; import java.util.Collection; import java.util.Collections; /** * Oracle SQL dialect */ class OracleSQLDialect extends JDBCSQLDialect { public OracleSQLDialect(JDBCDatabaseMetaData metaData) { super("Oracle", metaData); addSQLKeyword("ANALYZE"); addSQLKeyword("VALIDATE"); addSQLKeyword("STRUCTURE"); addSQLKeyword("COMPUTE"); addSQLKeyword("STATISTICS"); addFunctions( Arrays.asList( "SUBSTR", "APPROX_COUNT_DISTINCT", "REGEXP_SUBSTR", "REGEXP_INSTR", "REGEXP_REPLACE", "REGEXP_LIKE", // Additions from #323 //Number Functions: "BITAND", "COSH", "NANVL", "REMAINDER", "SINH", "TANH", "TRUNC", //Character Functions Returning Character Values: "CHR", "INITCAP", "LPAD", "NLS_INITCAP", "NLS_LOWER", "NLSSORT", "NLS_UPPER", "RPAD", // NLS Character Functions: "NLS_CHARSET_DECL_LEN", "NLS_CHARSET_ID", "NLS_CHARSET_NAME", //Character Functions Returning Number VALUES: "INSTR", //Datetime Functions: "ADD_MONTHS", "DBTIMEZONE", "FROM_TZ", "LAST_DAY", "MONTHS_BETWEEN", "NEW_TIME", "NEXT_DAY", "NUMTODSINTERVAL", "NUMTOYMINTERVAL", "SESSIONTIMEZONE", "SYS_EXTRACT_UTC", "SYSDATE", "SYSTIMESTAMP", "TO_CHAR", "TO_TIMESTAMP", "TO_TIMESTAMP_TZ", "TO_DSINTERVAL", "TO_YMINTERVAL", "TRUNC", "TZ_OFFSET", //General Comparison Functions: "GREATEST", "LEAST", //Conversion Functions: "ASCIISTR", "BIN_TO_NUM", "CHARTOROWID", "COMPOSE", "DECOMPOSE", "HEXTORAW", "NUMTODSINTERVAL", "NUMTOYMINTERVAL", "RAWTOHEX", "RAWTONHEX", "ROWIDTOCHAR", "ROWIDTONCHAR", "SCN_TO_TIMESTAMP", "TIMESTAMP_TO_SCN", "TO_BINARY_DOUBLE", "TO_BINARY_FLOAT", "TO_CHAR", "TO_CLOB", "TO_DATE", "TO_DSINTERVAL", "TO_LOB", "TO_MULTI_BYTE", "TO_NCHAR", "TO_NCLOB", "TO_NUMBER", "TO_DSINTERVAL", "TO_SINGLE_BYTE", "TO_TIMESTAMP", "TO_TIMESTAMP_TZ", "TO_YMINTERVAL", "TO_YMINTERVAL", "UNISTR", //Large Object Functions: "BFILENAME", "EMPTY_BLOB", "EMPTY_CLOB", //Collection Functions: "POWERMULTISET", "POWERMULTISET_BY_CARDINALITY", //Hierarchical FUNCTION: "SYS_CONNECT_BY_PATH", //Data Mining Functions: "CLUSTER_ID", "CLUSTER_PROBABILITY", "CLUSTER_SET", "FEATURE_ID", "FEATURE_SET", "FEATURE_VALUE", "PREDICTION", "PREDICTION_COST", "PREDICTION_DETAILS", "PREDICTION_PROBABILITY", "PREDICTION_SET", //XML Functions: "APPENDCHILDXML", "DELETEXML", "DEPTH", "EXISTSNODE", "EXTRACTVALUE", "INSERTCHILDXML", "INSERTXMLBEFORE", "PATH", "SYS_DBURIGEN", "SYS_XMLAGG", "SYS_XMLGEN", "UPDATEXML", "XMLAGG", "XMLCDATA", "XMLCOLATTVAL", "XMLCOMMENT", "XMLCONCAT", "XMLFOREST", "XMLPARSE", "XMLPI", "XMLQUERY", "XMLROOT", "XMLSEQUENCE", "XMLSERIALIZE", "XMLTABLE", "XMLTRANSFORM", //Encoding and Decoding Functions: "DECODE", "DUMP", "ORA_HASH", "VSIZE", //NULL-Related Functions: "LNNVL", "NVL", "NVL2", //Environment and Identifier Functions: "SYS_CONTEXT", "SYS_GUID", "SYS_TYPEID", "UID", "USERENV", //Aggregate Functions: "CORR_S", "CORR_K", "FIRST", "GROUP_ID", "GROUPING_ID", "LAST", "MEDIAN", "STATS_BINOMIAL_TEST", "STATS_CROSSTAB", "STATS_F_TEST", "STATS_KS_TEST", "STATS_MODE", "STATS_MW_TEST", "STATS_ONE_WAY_ANOVA", "STATS_T_TEST_ONE", "STATS_T_TEST_PAIRED", "STATS_T_TEST_INDEP", "STATS_T_TEST_INDEPU", "STATS_WSR_TEST", "STDDEV", "VARIANCE", //Analytic Functions: "FIRST", "FIRST_VALUE", "LAG", "LAST", "LAST_VALUE", "LEAD", "NTILE", "RATIO_TO_REPORT", "STDDEV", "VARIANCE", //Object Reference Functions: "MAKE_REF", "REFTOHEX", //Model Functions: "CV", "ITERATION_NUMBER", "PRESENTNNV", "PRESENTV", "PREVIOUS" )); } @Override public String getBlockHeaderString() { return "DECLARE"; } @NotNull @Override public Collection<String> getExecuteKeywords() { return Collections.singleton("call"); } @NotNull @Override public MultiValueInsertMode getMultiValueInsertMode() { return MultiValueInsertMode.GROUP_ROWS; } @Override public boolean supportsAliasInSelect() { return true; } @Override public boolean supportsAliasInUpdate() { return true; } @Override public boolean isDelimiterAfterBlock() { return true; } }
6968d0e2b3aea280c1f5c5439166a2afe3902896
6be25c9104b85cbebd23ee22e83500b37bbb15ec
/src/services/IGestionProf.java
afd6f829cf600ace303c88b0c34c58c9b0b0569d
[]
no_license
SpirituelNsoley/JAVA
53542f861e15896c8876849afa529bc8cbfa542d
bbfa3f5009594b8205ac9943017a4be4e661c012
refs/heads/master
2022-04-18T23:29:12.988137
2020-04-18T23:41:58
2020-04-18T23:41:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
461
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 services; import java.util.ArrayList; import modeles.Classe; import modeles.Professeur; /** * * @author hp */ public interface IGestionProf { public Professeur rechercherProf(String numero); public void addClasse(Professeur p,Classe c,int annee); }
a3a912188dc1af79090ae8da4fa386a2bd2a30a0
9aab415288caa826040ef6375225310d41a4bc91
/app/src/main/java/bss/bbs/com/teslaclone/Adapter/TableLayoutAdapter.java
a4692f118744f0b4bee9c80a92b62ebf69a6fae7
[]
no_license
muthukrishnan1990/NewRep
4e2c83a5824a43596a418e75c5768aed1956788d
caf9d20586e73733c52d9cdf245c6764c959fbb4
refs/heads/master
2020-03-29T19:13:01.620033
2018-09-25T11:30:32
2018-09-25T11:30:32
150,253,100
0
0
null
null
null
null
UTF-8
Java
false
false
7,706
java
package bss.bbs.com.teslaclone.Adapter; import android.content.Context; import android.graphics.Color; import android.graphics.Typeface; import android.support.v7.widget.RecyclerView; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TableLayout; import android.widget.TableRow; import android.widget.TextView; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.Iterator; import bss.bbs.com.teslaclone.R; /** * Created by sairaj on 15/09/17. */ public class TableLayoutAdapter extends RecyclerView.Adapter<TableLayoutAdapter.ViewHolder> { Context context; ArrayList<String> RetriveList1 = new ArrayList<>(); JSONObject jsonoject =null; String identify; public TableLayoutAdapter(Context context, JSONObject object,String string) { super(); this.context = context; // this.RetriveList1 = tableData; this.jsonoject = object; this.identify = string; } @Override public TableLayoutAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View v = LayoutInflater.from(viewGroup.getContext()) .inflate(R.layout.table_layout, viewGroup, false); TableLayoutAdapter.ViewHolder viewHolder = new TableLayoutAdapter.ViewHolder(v); return viewHolder; } @Override public void onBindViewHolder(TableLayoutAdapter.ViewHolder viewHolder, int i) { if(jsonoject != null) { try { Iterator iterator = jsonoject.keys(); while (iterator.hasNext()) { String key = (String) iterator.next(); RetriveList1.add(key); } for (int index = 0; index < RetriveList1.size(); index++) { TableRow.LayoutParams Headerowparams = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT); TableRow headerRow = new TableRow(context); headerRow.setBackgroundColor(Color.DKGRAY); headerRow.setLayoutParams(Headerowparams); TextView textview = new TextView(context); textview.setLayoutParams(Headerowparams); textview.setText(RetriveList1.get(index).replace("_", " ")); textview.setTextColor(Color.WHITE); textview.setTextSize(20); textview.setTypeface(null, Typeface.BOLD); headerRow.addView(textview); viewHolder.mainTable.addView(headerRow); JSONObject issue = jsonoject.getJSONObject(RetriveList1.get(index)); Iterator seconditer = issue.keys(); while (seconditer.hasNext()) { String newkey = (String) seconditer.next(); String data = issue.getString(newkey); String finalkey; if(identify.equals("CarDetail")){ String removeline = newkey.replace("_", " "); finalkey = removeline.substring(0, 1).toUpperCase() + removeline.substring(1).toLowerCase(); }else { finalkey = newkey; } TableRow innerrow = new TableRow(context); TableLayout.LayoutParams layoutRow = new TableLayout.LayoutParams(RecyclerView.LayoutParams.WRAP_CONTENT, RecyclerView.LayoutParams.WRAP_CONTENT); layoutRow.setMargins(0, 5, 0, 5); innerrow.setLayoutParams(layoutRow); innerrow.setGravity(Gravity.CENTER); innerrow.setWeightSum(1f); TextView innertext = new TextView(context); //TableRow.LayoutParams layoutHistory = new TableRow.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT, RecyclerView.LayoutParams.MATCH_PARENT); TableRow.LayoutParams frontHistory = new TableRow.LayoutParams(0, RecyclerView.LayoutParams.WRAP_CONTENT, 0.4f); innertext.setLayoutParams(frontHistory); innertext.setText(finalkey); innertext.setTextSize(15); innertext.setGravity(Gravity.CENTER); TextView dotted = new TextView(context); TableRow.LayoutParams centerHistory = new TableRow.LayoutParams(0, RecyclerView.LayoutParams.WRAP_CONTENT, 0.2f); dotted.setLayoutParams(centerHistory); dotted.setText(":"); dotted.setTextSize(15); dotted.setGravity(Gravity.CENTER); TextView value = new TextView(context); TableRow.LayoutParams lastHistory = new TableRow.LayoutParams(0, RecyclerView.LayoutParams.WRAP_CONTENT, 0.4f); value.setLayoutParams(lastHistory); value.setText(data); value.setTextSize(15); value.setGravity(Gravity.CENTER); innerrow.addView(innertext); innerrow.addView(dotted); innerrow.addView(value); viewHolder.mainTable.addView(innerrow); } } } catch (JSONException e) { e.printStackTrace(); } }else{ TableRow innerrow = new TableRow(context); TableLayout.LayoutParams layoutRow = new TableLayout.LayoutParams(RecyclerView.LayoutParams.WRAP_CONTENT, RecyclerView.LayoutParams.WRAP_CONTENT); layoutRow.setMargins(0, 5, 0, 5); innerrow.setLayoutParams(layoutRow); innerrow.setGravity(Gravity.CENTER); innerrow.setWeightSum(1f); TextView innertext = new TextView(context); TableRow.LayoutParams frontHistory = new TableRow.LayoutParams(0, RecyclerView.LayoutParams.WRAP_CONTENT, 0.4f); innertext.setLayoutParams(frontHistory); innertext.setText("Not Available"); innertext.setTextSize(15); innertext.setGravity(Gravity.CENTER); TextView dotted = new TextView(context); TableRow.LayoutParams centerHistory = new TableRow.LayoutParams(0, RecyclerView.LayoutParams.WRAP_CONTENT, 0.2f); dotted.setLayoutParams(centerHistory); dotted.setText(":"); dotted.setTextSize(15); dotted.setGravity(Gravity.CENTER); TextView value = new TextView(context); TableRow.LayoutParams lastHistory = new TableRow.LayoutParams(0, RecyclerView.LayoutParams.WRAP_CONTENT, 0.4f); value.setLayoutParams(lastHistory); value.setText("Not Available"); value.setTextSize(15); value.setGravity(Gravity.CENTER); innerrow.addView(innertext); innerrow.addView(dotted); innerrow.addView(value); viewHolder.mainTable.addView(innerrow); } } @Override public int getItemCount() { return 1; } public static class ViewHolder extends RecyclerView.ViewHolder{ public TableLayout mainTable; public ViewHolder(View itemView) { super(itemView); mainTable = (TableLayout) itemView.findViewById(R.id.main_table); } } }
76ad8c97ff09a91e15f9b3b707cd4767b7ee9194
5b82e2f7c720c49dff236970aacd610e7c41a077
/QueryReformulation-master 2/data/ExampleSourceCodeFiles/TaskInfo.java
17ea6e0fbcfb0894333f6a4c1410d1b40bfdb8a0
[]
no_license
shy942/EGITrepoOnlineVersion
4b157da0f76dc5bbf179437242d2224d782dd267
f88fb20497dcc30ff1add5fe359cbca772142b09
refs/heads/master
2021-01-20T16:04:23.509863
2016-07-21T20:43:22
2016-07-21T20:43:22
63,737,385
0
0
null
null
null
null
UTF-8
Java
false
false
2,349
java
/Users/user/eclipse.platform.ui/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/TaskInfo.java org eclipse internal progress org eclipse core runtime progress monitor org eclipse osgi util task info info task job assumed task running time previous tasks job deleted task info sub task info pre work total work create instance receiver supplied total work task param parent job info param info name param total task info job info parent job info string info name total parent job info info name total work total add work increment total param work increment add work work increment don bother indeterminate total work progress monitor pre work work increment add amount work recevier update parent monitor increment scaled amount ticks represents param work increment amount work receiver param parent monitor progress monitor listening param parent ticks number ticks monitor represents add work work increment progress monitor parent monitor parent ticks don bother indeterminate total work progress monitor add work work increment parent monitor internal worked work increment parent ticks total work override string display string progress total work progress monitor unknown progress task name null display string without task progress progress string message values string message values string percent done message values job info job name message values task name bind progress messages job info done message message values string message values string message values job info job name message values task name bind progress messages job info done progress message message values get display string task param progress whether showing progress string string display string without task progress progress total work progress monitor job info job name bind progress messages job info task name done message job info job name string percent done return integer representing amount work completed progress indeterminate progress monitor progress monitor percent done total work progress monitor progress monitor math min pre work total work return progress monitor total work code progress monitor code string string unknown progress task name null job info job name string message values string message values job info job name message values task name bind progress messages job info unknown progress message values
7f9c02ee9a27a94dfdfc200f0a85372174bece06
9987110960a600d05c335de20a118da712b29191
/android/jdonkey/src/main/java/org/dkf/jmule/views/AbstractAdapter.java
c30f386e923ef97cdbd56aaf74775cc15a4057a8
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
a-pavlov/jed2k
57a9a23a018cf52f7aaa54bc977cc9be02b6c8e8
c27cc2b28c01789e09511f8446934e6555863858
refs/heads/master
2023-08-31T20:22:28.949276
2023-08-22T16:58:22
2023-08-22T16:58:22
35,595,139
123
55
NOASSERTION
2023-08-21T19:15:39
2015-05-14T06:32:38
Java
UTF-8
Java
false
false
3,176
java
/* * Created by Angel Leon (@gubatron), Alden Torres (aldenml) * Copyright (c) 2011-2014, FrostWire(R). All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.dkf.jmule.views; import android.content.Context; import android.util.SparseArray; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; /** * * @author gubatron * @author aldenml * */ public abstract class AbstractAdapter<T> extends ArrayAdapter<T> { private final int layoutResId; public AbstractAdapter(Context context, int layoutResId) { super(context, 0); this.layoutResId = layoutResId; } @Override public final View getView(int position, View convertView, ViewGroup parent) { T item = getItem(position); if (convertView == null) { convertView = View.inflate(getContext(), layoutResId, null); } setupView(convertView, parent, item); return convertView; } @SuppressWarnings("unchecked") protected final <V extends View> V findView(View view, int id) { return (V) getView(view, getHolder(view), id); } protected abstract void setupView(View view, ViewGroup parent, T item); private SparseArray<View> getHolder(View view) { @SuppressWarnings("unchecked") SparseArray<View> h = (SparseArray<View>) view.getTag(); if (h == null) { h = new SparseArray<View>(); view.setTag(h); } return h; } private View getView(View view, SparseArray<View> h, int id) { View v = null; int index = h.indexOfKey(id); if (index < 0) { v = view.findViewById(id); h.put(id, v); } else { v = h.valueAt(index); } return v; } public static abstract class OnItemClickAdapter<T> implements OnItemClickListener { @Override public final void onItemClick(AdapterView<?> parent, View view, int position, long id) { try { @SuppressWarnings("unchecked") AbstractAdapter<T> adapter = (AbstractAdapter<T>) parent.getAdapter(); onItemClick(parent, view, adapter, position, id); } catch (ClassCastException e) { // ignore } } public abstract void onItemClick(AdapterView<?> parent, View view, AbstractAdapter<T> adapter, int position, long id); } }
409e69cf5a127dd3b41dab7a09eca484c870c445
1a3b65eaa15f9f038ed189a99bfbb7992b397a78
/app/src/main/java/com/fos/fragment/guide_fragment/VideoLauncherFragment.java
a0309b63d981801775d4271a3287e68cd3ee0246
[]
no_license
MayDaycwxiong/fos
1f1572bdb80e9127cd18294f072067a0fc108fdd
bffb75fdedf2e9e14648092af1df6ec8db73f507
refs/heads/master
2020-04-11T20:25:06.301650
2018-07-07T08:10:30
2018-07-07T08:10:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,072
java
package com.fos.fragment.guide_fragment; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.view.animation.TranslateAnimation; import android.widget.ImageView; import com.fos.R; /** * @author: cwxiong * @e-mail: [email protected] * @Company: CSUFT * @Description: 对应MainActivity中的第一个Fragment * @date 2018/5/2 21:23 */ public class VideoLauncherFragment extends LauncherBaseFragment { private ImageView ivReward; private ImageView ivGold; private Bitmap goldBitmap; private boolean started;//是否开启动画(ViewPage滑动时候给这个变量赋值) @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rooView=inflater.inflate(R.layout.fragment_video_launcher, null); ivGold=(ImageView) rooView.findViewById(R.id.iv_gold); ivReward=(ImageView) rooView.findViewById(R.id.iv_reward); //获取硬币的高度 goldBitmap= BitmapFactory.decodeResource(getActivity().getResources(),R.drawable.icon_gold); startAnimation(); return rooView; } public void startAnimation(){ started=true; //向下移动动画 硬币的高度*2+80 TranslateAnimation translateAnimation=new TranslateAnimation(0,0,0,goldBitmap.getHeight()*2+80); translateAnimation.setDuration(500); translateAnimation.setFillAfter(true); ivGold.startAnimation(translateAnimation); translateAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) {} @Override public void onAnimationEnd(Animation animation){ if(started){ ivReward.setVisibility(View.VISIBLE); //硬币移动动画结束开启缩放动画 Animation anim= AnimationUtils.loadAnimation(getActivity(),R.anim.reward_launcher); ivReward.startAnimation(anim); anim.setAnimationListener(new Animation.AnimationListener(){ @Override public void onAnimationStart(Animation animation) {} @Override public void onAnimationRepeat(Animation animation) {} @Override public void onAnimationEnd(Animation animation) { //缩放动画结束 开启改变透明度动画 AlphaAnimation alphaAnimation=new AlphaAnimation(1,0); alphaAnimation.setDuration(1000); ivReward.startAnimation(alphaAnimation); alphaAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) {} @Override public void onAnimationRepeat(Animation animation) {} @Override public void onAnimationEnd(Animation animation) { //透明度动画结束隐藏图片 ivReward.setVisibility(View.GONE); } }); } }); } } @Override public void onAnimationRepeat(Animation animation) {} }); } @Override public void stopAnimation(){ started=false;//结束动画时标示符设置为false ivGold.clearAnimation();//清空view上的动画 } }
e529864c269de071e8ae9995739c600e3e1b4c1b
e947cf88ce73c8d0db01d170539e989f631728f3
/.svn/pristine/e5/e529864c269de071e8ae9995739c600e3e1b4c1b.svn-base
064f927e2a9afb11956694c7b87ad8ab3dd3ef61
[]
no_license
codeclimate-testing/java-plazma
8537f572229253c6a28f0bc58b32d8ad619b9929
d2f343564cd59882e43b1a1efede7a3b403e2bdb
refs/heads/master
2021-01-21T05:36:14.105653
2017-09-05T21:38:32
2017-09-05T21:38:32
101,927,837
0
1
null
2017-10-19T13:15:00
2017-08-30T20:53:58
Java
UTF-8
Java
false
false
1,897
/* * Copyright (C) 2005-2010 Oleh Hapon [email protected] * * 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. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * * Oleh Hapon * Kyiv, UKRAINE * [email protected] */ /* * Created on 09.07.2007 * */ package org.plazmaforge.bsolution.finance.client.swt.forms.common; import org.eclipse.swt.widgets.Composite; import org.plazmaforge.bsolution.finance.common.beans.OperationRegister; import org.plazmaforge.framework.client.swt.controls.XCombo; /** * @author Oleh Hapon * $Id: XOperationTypeCombo.java,v 1.2 2010/04/28 06:31:07 ohapon Exp $ */ public class XOperationTypeCombo extends XCombo { public XOperationTypeCombo(Composite parent, int style) { super(parent, style); } public XOperationTypeCombo(Composite parent, int style, int toolStyle) { super(parent, style, toolStyle); } public void init() { super.init(); addValue(OperationRegister.DEBIT, Messages.getString("XOperationTypeCombo.operation.type.debit")); //$NON-NLS-1$ addValue(OperationRegister.CREDIT, Messages.getString("XOperationTypeCombo.operation.type.credit")); //$NON-NLS-1$ } }
77f0cd77415f7d9458d6c2a53e73160236a07255
c6b7550e602998a4114804eecd9c6d3c92c69b08
/src/main/java/cn/itbaizhan/action/CommodityAction.java
f44a0b76b8e34f59041b66b2c3a6beaa8733b5b9
[]
no_license
Aruke05/E-commerce-Management-System
d34447b2fae24cf4c90a53681bacf11d61f4b77a
38c9d29f08f8c55335753903869bd902b1c51f3f
refs/heads/master
2023-03-22T15:18:44.793735
2021-03-22T13:34:25
2021-03-22T13:34:25
349,409,108
0
0
null
null
null
null
UTF-8
Java
false
false
6,687
java
package cn.itbaizhan.action; import java.util.List; import java.util.Map; import java.io.File; import javax.servlet.ServletContext; import cn.itbaizhan.po.Commodity; import org.apache.commons.io.FileUtils; import javax.annotation.Resource; import org.apache.struts2.ServletActionContext; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import cn.itbaizhan.po.CommodityClass; import cn.itbaizhan.service.CommodityClassService; import cn.itbaizhan.service.CommodityService; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; @SuppressWarnings("serial") @Component("commodityAction") @Scope("prototype")//多例,每个请求生成一个新的action public class CommodityAction extends ActionSupport { private int commodityClassId; private Commodity commodity; private File image; //上传图片文件 private String imageContentType; //上传图片文件类型 private String imageFileName; //上传图片文件名 //要调用CommodityService的方法,所以要声明,让spring把其实现类注入 @Resource(name="commodityServiceImpl") CommodityService service; private CommodityClass commodityclass; @Resource(name="commodityClassServiceImpl") CommodityClassService commodityClassService; public int getCommodityClassId() { return commodityClassId; } public void setCommodityClassId(int commodityClassId) { this.commodityClassId = commodityClassId; } public void setService(CommodityService service) { this.service = service; } public CommodityService getService() { return service; } public void setCommodity(Commodity commodity) { this.commodity = commodity; } public Commodity getCommodity() { return commodity; } public void setCommodityClassService(CommodityClassService commodityClassService) { this.commodityClassService = commodityClassService; } public CommodityClassService getCommodityClassService() { return commodityClassService; } public void setCommodityclass(CommodityClass commodityclass) { this.commodityclass = commodityclass; } public CommodityClass getCommodityclass() { return commodityclass; } public File getImage() { return image; } public void setImage(File image) { this.image = image; } public String getImageContentType() { return imageContentType; } public void setImageContentType(String imageContentType) { this.imageContentType = imageContentType; } public String getImageFileName() { return imageFileName; } public void setImageFileName(String imageFileName) { this.imageFileName = imageFileName; } //所有商品列表 @SuppressWarnings("unchecked") public String listCommodity(){ Map request = (Map) ActionContext.getContext().get("request"); request.put("listCommoditys", service.findAllCommoditys()); System.out.println("listCommoditys"); return "listCommodity"; } //删除商品 public String deleteCommodity(){ System.out.println(commodity.getCommodityName()); this.service.delete(commodity); return "deleteCommodity"; } //按id查找商品 public String findCommodityById(){ int commId= commodity.getCommodityId(); System.out.println(commId); Commodity commodity = this.service.findCommodityById(commId); ActionContext.getContext().getSession().put("commodityById", commodity); return "findCommodityById"; } //按名称查找商品 @SuppressWarnings("unchecked") public String findCommodityByName(){ String commodityName= commodity.getCommodityName(); Map request = (Map) ActionContext.getContext().get("request"); request.put("commoditybyName",this.service.findCommodityByName(commodityName)); ActionContext.getContext().getSession().put("searchnameMessage", commodityName); return "findCommodityByName"; } //按分类查找商品 @SuppressWarnings("unchecked") public String findCommodityByClass(){ List<CommodityClass> commodityClasses;// 商品种类列表 System.out.println("commodityClassId:"+commodityClassId); CommodityClass commodityclasses=commodityClassService.findCommodityClassById(commodityClassId); Map request = (Map) ActionContext.getContext().get("request"); request.put("commodityByClass", service.findCommodityByClass(commodityclasses)); System.out.println("分类:"+service.findCommodityByClass(commodityclasses)); commodityClasses = commodityClassService.findAllCommodityClasses();// 查询所有的商品种类 request.put("listCommodityClasses", commodityClasses); ActionContext.getContext().getSession().put("searchClassMessage", commodityclasses.getCommodityClassName()); return "findCommodityByClass"; } public String updateCommodity(){ this.service.update(commodity); return "updateCommodity"; } @SuppressWarnings("unchecked") public String adCommodity(){ List<CommodityClass> commodityClasses;// 商品种类列表 Map request = (Map) ActionContext.getContext().get("request"); commodityClasses = commodityClassService.findAllCommodityClasses();// 查询所有的商品种类 request.put("commodityClasses", commodityClasses); System.out.println(commodityClasses.size()); return "addComm"; } //添加商品 @SuppressWarnings("unchecked") public String addCommodity(){ List<CommodityClass> commodityClasses;// 商品种类列表 Map request = (Map) ActionContext.getContext().get("request"); commodityClasses = commodityClassService.findAllCommodityClasses();// 查询所有的商品种类 request.put("commodityClasses", commodityClasses); //图片处理 try{ String RealPath=ServletActionContext.getServletContext().getRealPath("/product"); String fileName=imageFileName; File file=new File(RealPath,fileName); FileUtils.copyFile(image,file); }catch(Exception e){ ActionContext.getContext().put("addComessage", "图片上传失败!"); return "addCommodityError"; } commodity.setImage(imageFileName); CommodityClass com=commodityClassService.findCommodityClassById(commodity.getCommodityClass().getCommodityClassId()); System.out.println(com); commodity.setCommodityClass(com); List<Commodity> commodityFindname=this.service.findCommodityBName (commodity.getCommodityName());//查询该商品是否存在 if(commodityFindname.size()==0){ this.service.save(this.commodity); System.out.println("commodity:"+commodity.getCommodityName()); ActionContext.getContext().put("addComessage", commodity.getCommodityName()+"添加成功"); } else { ActionContext.getContext().put("addComessage", commodity.getCommodityName()+"已经存在,请重新填写商品信息!"); } return "addCommoditySuccess"; } }
[ "enu990424" ]
enu990424
64afbe2d26e5a009d666465c44960ab3baf1d225
ed406aaeefbb6d91e5d3bf97c99cb8795991efbe
/src/main/java/com/tavares/cursomc/services/CategoriaService.java
9d4554a46b01435d8eef0325293743a9055b067a
[]
no_license
lucastavar3s/CursoMC
e16f9dbae2ba3b244676009b45ce8cf78ed2d370
f013385ead80a8af6ab747735c34a70079d4be22
refs/heads/master
2023-03-07T21:51:59.752118
2021-02-24T23:43:01
2021-02-24T23:43:01
341,732,681
0
0
null
null
null
null
UTF-8
Java
false
false
495
java
package com.tavares.cursomc.services; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.tavares.cursomc.domain.Categoria; import com.tavares.cursomc.repositories.CategoriaRepository; @Service public class CategoriaService { @Autowired private CategoriaRepository repo; public Categoria buscar(Integer id) { Optional<Categoria> obj = repo.findById(id); return obj.orElse(null); } }
02ba9827461a6d8f81ab07205ea8fa75bcc97aed
7fa17fdef7db6173005b78d76d3a2877831552c1
/project-model-maven-tests/src/test/java/org/jboss/seam/forge/maven/dependencies/RepositoryLookupTest.java
281196086ab36f0441d68cd2e98fa2a1da69291d
[]
no_license
paulbakker/forge
1893517c84c22540eb0f74708bc1f80c486f1f99
93fc30c6417d6fe95d03d670d699a3de8822f14d
refs/heads/master
2021-01-15T22:02:34.301934
2011-04-24T22:18:36
2011-04-24T22:18:36
1,573,810
0
0
null
null
null
null
UTF-8
Java
false
false
5,810
java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.seam.forge.maven.dependencies; import static org.junit.Assert.assertTrue; import java.util.Arrays; import java.util.List; import javax.inject.Inject; import javax.inject.Singleton; import org.jboss.arquillian.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.seam.forge.maven.util.ProjectModelTest; import org.jboss.seam.forge.project.dependencies.Dependency; import org.jboss.seam.forge.project.dependencies.DependencyBuilder; import org.jboss.seam.forge.project.dependencies.DependencyMetadata; import org.jboss.seam.forge.project.dependencies.DependencyRepository; import org.jboss.seam.forge.project.dependencies.DependencyRepositoryImpl; import org.jboss.seam.forge.project.dependencies.DependencyResolver; import org.jboss.seam.forge.project.facets.DependencyFacet.KnownRepository; import org.jboss.seam.forge.resources.DependencyResource; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * @author <a href="mailto:[email protected]">Lincoln Baxter, III</a> */ @Singleton @RunWith(Arquillian.class) public class RepositoryLookupTest extends ProjectModelTest { @Deployment public static JavaArchive getTestArchive() { return createTestArchive() .addManifestResource( "META-INF/services/org.jboss.seam.forge.project.dependencies.DependencyResolverProvider"); } @Inject private DependencyResolver resolver; @Test public void testResolveVersions() throws Exception { Dependency dep = DependencyBuilder.create("com.ocpsoft:prettyfaces-jsf2"); DependencyRepository repo = new DependencyRepositoryImpl(KnownRepository.CENTRAL); List<Dependency> versions = resolver.resolveVersions(dep, Arrays.asList(repo)); assertTrue(versions.size() > 4); } @Test public void testResolveVersionsStaticVersion() throws Exception { Dependency dep = DependencyBuilder.create("com.ocpsoft:prettyfaces-jsf2:3.2.0"); DependencyRepository repo = new DependencyRepositoryImpl(KnownRepository.CENTRAL); List<Dependency> versions = resolver.resolveVersions(dep, Arrays.asList(repo)); assertTrue(versions.size() >= 1); } @Test public void testResolveVersionsStaticVersionSnapshot() throws Exception { Dependency dep = DependencyBuilder.create("org.jboss.errai.forge:forge-errai:1.0-SNAPSHOT"); DependencyRepository repo = new DependencyRepositoryImpl(KnownRepository.JBOSS_NEXUS); List<Dependency> versions = resolver.resolveVersions(dep, repo); assertTrue(versions.size() >= 1); } @Test public void testResolveArtifacts() throws Exception { Dependency dep = DependencyBuilder.create("org.jboss.errai.forge:forge-errai"); DependencyRepository repo = new DependencyRepositoryImpl(KnownRepository.JBOSS_NEXUS); List<DependencyResource> artifacts = resolver.resolveArtifacts(dep, Arrays.asList(repo)); assertTrue(artifacts.size() >= 1); } @Test public void testResolveArtifactsSnapshotStaticVersion() throws Exception { Dependency dep = DependencyBuilder.create("org.jboss.errai.forge:forge-errai:[1.0-SNAPSHOT]"); DependencyRepository repo = new DependencyRepositoryImpl(KnownRepository.JBOSS_NEXUS); List<DependencyResource> artifacts = resolver.resolveArtifacts(dep, Arrays.asList(repo)); assertTrue(artifacts.size() >= 1); } @Test public void testResolveArtifactsStaticVersion() throws Exception { Dependency dep = DependencyBuilder.create("com.ocpsoft:prettyfaces-jsf2:[3.2.0]"); DependencyRepository repo = new DependencyRepositoryImpl(KnownRepository.CENTRAL); List<DependencyResource> artifacts = resolver.resolveArtifacts(dep, Arrays.asList(repo)); assertTrue(artifacts.size() >= 1); } @Test public void testResolveDependenciesStaticVersion() throws Exception { Dependency dep = DependencyBuilder.create("org.jboss.seam.international:seam-international:[3.0.0,)"); DependencyRepository repo = new DependencyRepositoryImpl(KnownRepository.JBOSS_NEXUS); List<DependencyResource> artifacts = resolver.resolveDependencies(dep, Arrays.asList(repo)); assertTrue(artifacts.size() >= 1); } @Test public void testResolveDependencyMetadata() throws Exception { Dependency dep = DependencyBuilder.create("org.jboss.seam.international:seam-international:3.0.0.Final"); DependencyRepository repo = new DependencyRepositoryImpl(KnownRepository.JBOSS_NEXUS); DependencyMetadata meta = resolver.resolveDependencyMetadata(dep, Arrays.asList(repo)); assertTrue(meta.getDependencies().size() >= 1); assertTrue(meta.getManagedDependencies().size() >= 1); } }
9ba49b866d27b849e52bb3662685ded48508aaa3
00a3116eba9702179fcaa77d8af07b07d262e06a
/src/04_FactoryMethod/ex/idcard/IDCardFactory.java
7ace2b72d4877fea22ec33e079addfde2663c9df
[]
no_license
yakisuzu/DesignPatternJava
634ba24a297eb251c54f10fbd66496d2f9152107
2f80420a7eb93ccad2fdc4dc9d03a3920ca206fe
refs/heads/master
2020-06-06T21:43:41.708399
2015-08-28T15:36:31
2015-08-28T15:36:31
31,315,106
0
0
null
null
null
null
UTF-8
Java
false
false
712
java
package ex.idcard; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import ex.framework.AFactory; public class IDCardFactory extends AFactory<IDCard> { private Map<Integer, String> owners = new HashMap<>(); @Override protected IDCard createProduct(String owner) { int newId = owners.keySet().stream().max(Comparator.naturalOrder()).orElse(0).intValue() + 1; return new IDCard(newId, owner); } @Override protected void registerProduct(IDCard product) { owners.put(product.getId(), product.getOwner()); } public List<String> getOwners() { return owners.values().stream().collect(Collectors.toList()); } }
8c0fe0d80d52f59266f58ade44577cca3ac801f3
2385e5249ef0f420e3ce31ff60c27e6ec4b363d6
/src/Mediator/Colleague.java
92d916abf2e952584fe8e4ffc145dd32c7f43f03
[]
no_license
youngmin-chung/Java_DesginPattern
bedef9d86d0b2f5476c9cd8972e7e1c558d4bbd6
9570286a008ad8eac467eefaf91fc97c5a38ae2b
refs/heads/main
2023-09-01T12:55:58.883448
2021-10-25T03:07:34
2021-10-25T03:07:34
367,079,645
1
0
null
null
null
null
UTF-8
Java
false
false
585
java
package Mediator; // The Abstract Colleague class public abstract class Colleague { private Mediator mediator; private int colleagueCode; public Colleague(Mediator newMediator){ mediator = newMediator; mediator.addColleague(this); } public void saleOffer(String stock, int shares){ mediator.saleOffer(stock, shares, this.colleagueCode); } public void buyOffer(String stock, int shares){ mediator.buyOffer(stock, shares, this.colleagueCode); } public void setCollCode(int collCode){ colleagueCode = collCode; } }
ee808e9f932ecab4fdcd4ec435c8a27c452f449d
262acdf6cbf3aae770ff50474af76f13ddf3279c
/src/org/nsdev/glitchskills/ContentHelper.java
38c7e7aa108f71af3d8028d4c93b14cfd86ee255
[]
no_license
thorinside/GlitchSkills
bdb8a94aa5f55cb23c4ec8148447645ee6ba1bab
a79b79fd2d65ceaeb3e356291b9cb3c2962c118b
refs/heads/master
2021-03-12T23:13:28.166718
2012-09-27T16:15:01
2012-09-27T16:15:01
2,596,886
1
0
null
null
null
null
UTF-8
Java
false
false
1,024
java
package org.nsdev.glitchskills; import org.json.JSONException; import org.json.JSONObject; import org.json.JSONTokener; import android.content.Context; import android.database.Cursor; import android.net.Uri; public class ContentHelper { public static JSONObject getContent(Context context, String method) { Uri uri = Uri.parse("content://" + Constants.AUTHORITY + "/" + method); Cursor c = context.getContentResolver().query(uri, null, null, null, null); if (c != null) { c.moveToFirst(); String res = c.getString(c.getColumnIndex("response")); c.close(); try { JSONObject response = (JSONObject)new JSONTokener(res).nextValue(); return response; } catch (JSONException e) { if (Constants.DEBUG) e.printStackTrace(); } } return null; } }
043cca49f4b7180ccfbb836f5fed27c0eb1bb726
405d9b0030b118247d87674d934b99de0e4d7a60
/src/com/autoinc/supplier/supplyservice/UpdateTransportationStatusFault.java
e4c754b2076155302490dbe570bae85adf697406
[]
no_license
nivemaham/SupplyService
024382d1f409026617f8b88a096bd8a9d0f8f669
21c4bc17127b88a87469957ddecac1395f79d3a2
refs/heads/master
2021-01-01T18:06:39.450243
2015-06-22T14:47:43
2015-06-22T14:47:43
37,859,862
0
0
null
null
null
null
UTF-8
Java
false
false
20,816
java
/** * UpdateTransportationStatusFault.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: 1.6.2 Built on : Apr 17, 2012 (05:34:40 IST) */ package com.autoinc.supplier.supplyservice; /** * UpdateTransportationStatusFault bean class */ @SuppressWarnings({"unchecked","unused"}) public class UpdateTransportationStatusFault implements org.apache.axis2.databinding.ADBBean{ public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName( "http://supplier.autoinc.com/SupplyService/", "updateTransportationStatusFault", "ns1"); /** * field for UpdateTransportationStatusFault */ protected java.lang.String localUpdateTransportationStatusFault ; /** * Auto generated getter method * @return java.lang.String */ public java.lang.String getUpdateTransportationStatusFault(){ return localUpdateTransportationStatusFault; } /** * Auto generated setter method * @param param UpdateTransportationStatusFault */ public void setUpdateTransportationStatusFault(java.lang.String param){ this.localUpdateTransportationStatusFault=param; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME); return factory.createOMElement(dataSource,MY_QNAME); } public void serialize(final javax.xml.namespace.QName parentQName, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); writeStartElement(prefix, namespace, parentQName.getLocalPart(), xmlWriter); if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://supplier.autoinc.com/SupplyService/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":updateTransportationStatusFault", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "updateTransportationStatusFault", xmlWriter); } } namespace = ""; writeStartElement(null, namespace, "updateTransportationStatusFault", xmlWriter); if (localUpdateTransportationStatusFault==null){ // write the nil attribute throw new org.apache.axis2.databinding.ADBException("updateTransportationStatusFault cannot be null!!"); }else{ xmlWriter.writeCharacters(localUpdateTransportationStatusFault); } xmlWriter.writeEndElement(); xmlWriter.writeEndElement(); } private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://supplier.autoinc.com/SupplyService/")){ return "ns1"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * Utility method to write an element start tag. */ private void writeStartElement(java.lang.String prefix, java.lang.String namespace, java.lang.String localPart, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, localPart); } else { if (namespace.length() == 0) { prefix = ""; } else if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, localPart, namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext(); while (true) { java.lang.String uri = nsContext.getNamespaceURI(prefix); if (uri == null || uri.length() == 0) { break; } prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); elementList.add(new javax.xml.namespace.QName("", "updateTransportationStatusFault")); if (localUpdateTransportationStatusFault != null){ elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localUpdateTransportationStatusFault)); } else { throw new org.apache.axis2.databinding.ADBException("updateTransportationStatusFault cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory{ /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static UpdateTransportationStatusFault parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ UpdateTransportationStatusFault object = new UpdateTransportationStatusFault(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){ java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName!=null){ java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1){ nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix = nsPrefix==null?"":nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1); if (!"updateTransportationStatusFault".equals(type)){ //find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (UpdateTransportationStatusFault)com.autoinc.supplier.supplyservice.ExtensionMapper.getTypeObject( nsUri,type,reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); reader.next(); while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement() && new javax.xml.namespace.QName("","updateTransportationStatusFault").equals(reader.getName())){ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ throw new org.apache.axis2.databinding.ADBException("The element: "+"updateTransportationStatusFault" +" cannot be null"); } java.lang.String content = reader.getElementText(); object.setUpdateTransportationStatusFault( org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content)); reader.next(); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName()); } while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement()) // A start element we are not expecting indicates a trailing invalid property throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName()); } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class }
b3677dc24c1646c5c037b920072a3236f0829237
22afbcd47ef5da9aeae12dc35526986d0a8e93ec
/softwareupdatetips/src/main/java/com/mingrisoft/softwareupdatetips/MainActivity.java
01ab35dddc2a1dc75018a93106c24c582a3db91a
[]
no_license
sky1225/HelloWorld
a38f94b7a07a0599db902b94a9b1ffc5a6590dba
ca41144b301194a5e615bbf74cc7adf8447ba7d1
refs/heads/master
2020-04-09T10:46:35.228163
2018-12-04T02:25:36
2018-12-04T02:25:36
160,282,359
0
0
null
null
null
null
UTF-8
Java
false
false
347
java
package com.mingrisoft.softwareupdatetips; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
a2f7ee24557822fde625355f40b153f305a1153b
c6245a6dcffc6a2257aaff06fd9e6e953db55651
/octopus-server/src/main/java/cn/throwx/octopus/server/cache/AccessDomainCacheManager.java
c25666981001045664c4e80e8378ab52121e0e5b
[]
no_license
zjcscut/octopus
f5bd96145950cce427fdc6ddfbcfef90e5b0f9ab
783761c6917454684aa1a6f8876dcd60ba2affd1
refs/heads/main
2023-02-07T07:56:15.317221
2020-12-27T12:33:21
2020-12-27T12:33:21
324,755,928
314
98
null
null
null
null
UTF-8
Java
false
false
2,034
java
package cn.throwx.octopus.server.cache; import cn.throwx.octopus.server.infra.common.CacheKey; import cn.throwx.octopus.server.infra.common.DomainStatus; import cn.throwx.octopus.server.model.entity.DomainConf; import cn.throwx.octopus.server.repository.DomainConfDao; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.CommandLineRunner; import org.springframework.data.redis.core.SetOperations; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Component; import java.util.Objects; /** * @author throwable * @version v1 * @description * @since 2020/12/26 23:08 */ @Slf4j @Component @RequiredArgsConstructor public class AccessDomainCacheManager implements CommandLineRunner { private final StringRedisTemplate stringRedisTemplate; private final DomainConfDao domainConfDao; public boolean checkDomainValid(String domain) { SetOperations<String, String> opsForSet = stringRedisTemplate.opsForSet(); return Boolean.TRUE.equals(opsForSet.isMember(CacheKey.ACCESS_DOMAIN_SET.getKey(), domain)); } @Override public void run(String... args) throws Exception { log.info("开始加载短链域名白名单到缓存......"); refreshAllAccessDomainCache(); log.info("加载短链域名白名单到缓存完毕......"); } void refreshAllAccessDomainCache() { SetOperations<String, String> opsForSet = stringRedisTemplate.opsForSet(); String[] values = domainConfDao.selectAll() .stream() .filter(x -> Objects.equals(DomainStatus.AVAILABLE.getValue(), x.getDomainStatus())) .map(DomainConf::getDomainValue) // 这里如果存在端口,只取点分多段的IP .map(value -> value.split(":")[0]) .toArray(String[]::new); if (values.length > 0) { opsForSet.add(CacheKey.ACCESS_DOMAIN_SET.getKey(), values); } } }
e3dec2c9e062783d8e43738ddd5e204d827265f3
e1278d867ea9a444171c851a0e5cfcef42eba29e
/obvious-test/src/main/java/test/obvious/data/ForestTest.java
995aeba632744ebcf22acd452a41090f58e11667
[ "BSD-3-Clause" ]
permissive
jdfekete/obvious
774859d180134793f82bdbe77f1b2ee388e92b67
70be7f0fdbf1b9bd8d949a7eb177c9cb942e0119
refs/heads/master
2020-05-28T13:55:42.614467
2012-12-06T17:54:35
2012-12-06T17:54:35
33,189,843
1
0
null
null
null
null
UTF-8
Java
false
false
5,311
java
/* * Copyright (c) 2011, INRIA * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of INRIA nor the names of its contributors may * be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package test.obvious.data; import static org.junit.Assert.*; import java.util.HashMap; import java.util.Map; import org.junit.After; import org.junit.Before; import org.junit.Test; import obvious.data.Edge; import obvious.data.Forest; import obvious.data.Node; import obvious.data.Schema; import obvious.data.Graph.EdgeType; import obvious.impl.EdgeImpl; import obvious.impl.NodeImpl; import obvious.impl.SchemaImpl; /** * Class ForestTest. * Override test methods that have specific needs in your implementation. * @author Hemery * @version $Revision$ */ public abstract class ForestTest { /** * Forest instance used for tests. */ protected Forest<Node, Edge> forest; /** * Gets the Forest test instance. * @return the Forest test instance */ public Forest<Node, Edge> getForest() { return this.forest; } /** * Creates a suitable instance of network. * @param nSchema schema for the nodes the network * @param eSchema schema for the edges of the network * @return suitable network implementation instance */ public abstract Forest<Node, Edge> newInstance(Schema nSchema, Schema eSchema); /** * @see junit.framework.TestCase#setUp() */ @Before public void setUp() { // Creating the starting schema for node and edges Schema nodeSchema = new SchemaImpl(); nodeSchema.addColumn("nodeName", String.class, "node_default"); nodeSchema.addColumn("nodeId", int.class, -1); Schema edgeSchema = new SchemaImpl(); edgeSchema.addColumn("edgeName", String.class, "edge_default"); edgeSchema.addColumn("source", int.class, -1); edgeSchema.addColumn("target", int.class, -1); // Requesting a forest instance corresponding to these schemas. forest = newInstance(nodeSchema, edgeSchema); Map<String, Node> nodeMap = new HashMap<String, Node>(); // Adding nodes for (int i = 0; i < 10; i++) { Node node = new NodeImpl(nodeSchema, new Object[] {"A" + i, i}); nodeMap.put("A" + i, node); forest.addNode(node); } // Adding edges forest.addEdge(new EdgeImpl(edgeSchema, new Object[] {"A0-A1", 0, 1}), nodeMap.get("A0"), nodeMap.get("A1"), EdgeType.DIRECTED); forest.addEdge(new EdgeImpl(edgeSchema, new Object[] {"A0-A2", 0, 2}), nodeMap.get("A0"), nodeMap.get("A2"), EdgeType.DIRECTED); forest.addEdge(new EdgeImpl(edgeSchema, new Object[] {"A1-A3", 1, 3}), nodeMap.get("A1"), nodeMap.get("A3"), EdgeType.DIRECTED); forest.addEdge(new EdgeImpl(edgeSchema, new Object[] {"A2-A4", 2, 4}), nodeMap.get("A2"), nodeMap.get("A4"), EdgeType.DIRECTED); forest.addEdge(new EdgeImpl(edgeSchema, new Object[] {"A2-A5", 2, 5}), nodeMap.get("A2"), nodeMap.get("A5"), EdgeType.DIRECTED); forest.addEdge(new EdgeImpl(edgeSchema, new Object[] {"A6-A7", 6, 7}), nodeMap.get("A6"), nodeMap.get("A7"), EdgeType.DIRECTED); forest.addEdge(new EdgeImpl(edgeSchema, new Object[] {"A6-A8", 6, 8}), nodeMap.get("A6"), nodeMap.get("A8"), EdgeType.DIRECTED); forest.addEdge(new EdgeImpl(edgeSchema, new Object[] {"A8-A9", 8, 9}), nodeMap.get("A8"), nodeMap.get("A9"), EdgeType.DIRECTED); } /** * @see junit.framework.TestCase#tearDown() */ @After public void tearDown() { this.forest = null; } /** * Test method for obvious.data.Forest.getTrees() method. */ @Test public void testGetTrees() { assertEquals(2, forest.getTrees().size()); assertEquals(6, forest.getTrees().iterator().next().getNodes().size()); assertEquals(5, forest.getTrees().iterator().next().getEdges().size()); } }
[ "[email protected]@35a52bc0-c39b-11dd-bf30-1748d1f6ef2f" ]
[email protected]@35a52bc0-c39b-11dd-bf30-1748d1f6ef2f
3fcb0d74a552d895347f33c601da58876a78750f
17e81bf53886e9cedd92c412fa1d27c915703f45
/FragmentEvaluacion_Anibal_Bastias/app/src/main/java/com/nextu/anibalbastias/fragments/detail/InstrumentDetailFragment.java
9c8d556a9142567284476584a73aeea34aaa4412
[]
no_license
anibalbastiass/android.nextu.certification
a66c021a0f679a0448a27e33664d00b3c925cd22
8e62d23c6a6c49cfbc15db6caf9c8b668074ab7b
refs/heads/master
2022-06-17T07:51:35.110544
2020-05-05T15:12:00
2020-05-05T15:12:00
261,505,420
0
0
null
null
null
null
UTF-8
Java
false
false
3,465
java
package com.nextu.anibalbastias.fragments.detail; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; import androidx.fragment.app.Fragment; import com.nextu.anibalbastias.fragments.R; import com.nextu.anibalbastias.fragments.list.model.InstrumentItem; import com.nextu.anibalbastias.fragments.util.MainUtils; public class InstrumentDetailFragment extends Fragment implements View.OnClickListener { public static final String ARG_INSTRUMENT_ITEM = "INSTRUMENT_ITEM"; private InstrumentItem instrumentItem; private TextView description; private ImageView mainImage; private ImageView secondaryImage; private ImageButton primaryStarButton; private ImageButton primaryPlayButton; private ImageButton secondaryStarButton; private ImageButton secondaryPlayButton; public InstrumentDetailFragment() { } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { instrumentItem = (InstrumentItem) getArguments().getSerializable(ARG_INSTRUMENT_ITEM); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_instrument_detail, container, false); setView(view); if (instrumentItem != null) { updateFragment(instrumentItem); } return view; } private void setView(View view) { // getActivity().setTitle(); description = view.findViewById(R.id.tv_detail_instrument_title); mainImage = view.findViewById(R.id.iv_instrument_detail_first_image); secondaryImage = view.findViewById(R.id.iv_instrument_detail_second_image); primaryStarButton = view.findViewById(R.id.ib_instrument_detail_first_star_button); primaryPlayButton = view.findViewById(R.id.ib_instrument_detail_first_play_button); secondaryStarButton = view.findViewById(R.id.ib_instrument_detail_second_star_button); secondaryPlayButton = view.findViewById(R.id.ib_instrument_detail_second_play_button); setClickListeners(); } private void setClickListeners() { primaryStarButton.setOnClickListener(this); primaryPlayButton.setOnClickListener(this); secondaryStarButton.setOnClickListener(this); secondaryPlayButton.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.ib_instrument_detail_first_star_button: case R.id.ib_instrument_detail_second_star_button: MainUtils.showToast(getContext(), getString(R.string.toast_favorite)); break; case R.id.ib_instrument_detail_first_play_button: case R.id.ib_instrument_detail_second_play_button: MainUtils.showToast(getContext(), getString(R.string.toast_play)); break; } } public void updateFragment(InstrumentItem item) { description.setText(item.getDescription()); mainImage.setImageResource(item.getMainInstrumentImage()); secondaryImage.setImageResource(item.getSecondaryInstrumentImage()); } }
ae8754370606a4d5b66059b7a7b48d1c16d286f2
9b10416993841c93a5d643e5b52b454ca62aa1c8
/src/main/java/io/github/foundationgames/sculkconcept/SculkConceptClient.java
b9f825141741e1d46112fc7bfa4f1a8bbafa23d3
[]
no_license
FoundationGames/SculkConcept
6e5a1bf9fb2b305b4e0132525e27391bcbaf990e
bc36e15a3c0647876a7e3a7869355db94aa3a1fb
refs/heads/master
2023-01-13T15:35:14.410729
2020-11-14T08:47:43
2020-11-14T08:47:43
304,817,539
2
0
null
null
null
null
UTF-8
Java
false
false
3,680
java
package io.github.foundationgames.sculkconcept; import com.google.common.collect.Maps; import com.swordglowsblue.artifice.api.Artifice; import io.github.foundationgames.sculkconcept.block.entity.render.SculkSensorBlockEntityRenderer; import io.github.foundationgames.sculkconcept.particle.VibrationParticle; import io.github.foundationgames.sculkconcept.particle.VibrationParticleEffect; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry; import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry; import net.fabricmc.fabric.api.particle.v1.FabricParticleTypes; import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher; import net.minecraft.particle.ParticleType; import net.minecraft.util.DyeColor; import net.minecraft.util.Util; import net.minecraft.util.registry.Registry; import java.util.HashMap; import java.util.List; import java.util.Map; public class SculkConceptClient implements ClientModInitializer { public static final ParticleType<VibrationParticleEffect> VIBRATION_PARTICLE = FabricParticleTypes.complex(VibrationParticleEffect.FACTORY); @Override public void onInitializeClient() { BlockEntityRendererRegistry.INSTANCE.register(SculkConcept.SCULK_SENSOR_ENTITY, SculkSensorBlockEntityRenderer::new); BlockRenderLayerMap.INSTANCE.putBlock(SculkConcept.SCULK_GROWTH, RenderLayer.getCutout()); Registry.register(Registry.PARTICLE_TYPE, SculkConcept.id("vibration"), VIBRATION_PARTICLE); ParticleFactoryRegistry.getInstance().register(VIBRATION_PARTICLE, VibrationParticle.Factory::new); registerAssets(); } private static void registerAssets() { Artifice.registerAssets(SculkConcept.id("sculk_concept_assets"), pack -> { for(DyeColor color : DyeColor.values()) { String cs = color.getName(); System.out.println(cs); pack.addBlockModel(SculkConcept.id(cs+"_candles_single"), builder -> builder.parent(SculkConcept.id("block/candles_single_base")).texture("candle", SculkConcept.id("block/"+cs+"_candle"))); pack.addBlockModel(SculkConcept.id(cs+"_candles_double"), builder -> builder.parent(SculkConcept.id("block/candles_double_base")).texture("candle", SculkConcept.id("block/"+cs+"_candle"))); pack.addBlockModel(SculkConcept.id(cs+"_candles_triple"), builder -> builder.parent(SculkConcept.id("block/candles_triple_base")).texture("candle", SculkConcept.id("block/"+cs+"_candle"))); pack.addBlockModel(SculkConcept.id(cs+"_candles_quadruple"), builder -> builder.parent(SculkConcept.id("block/candles_quadruple_base")).texture("candle", SculkConcept.id("block/"+cs+"_candle"))); pack.addBlockState(SculkConcept.id(cs+"_candle"), builder -> { builder.variant("count=1", variant -> variant.model(SculkConcept.id("block/"+cs+"_candles_single"))); builder.variant("count=2", variant -> variant.model(SculkConcept.id("block/"+cs+"_candles_double"))); builder.variant("count=3", variant -> variant.model(SculkConcept.id("block/"+cs+"_candles_triple"))); builder.variant("count=4", variant -> variant.model(SculkConcept.id("block/"+cs+"_candles_quadruple"))); }); pack.addItemModel(SculkConcept.id(cs+"_candle"), builder -> builder.parent(SculkConcept.id("block/"+cs+"_candles_single"))); } }); } }
a7da2c0794077388e4e1866fbd8ad85ea0f0ab4d
eec5131ba75aabb91381a083dc3cc522794e2a11
/src/com/scsb/dao/DatabaseDAO.java
4356c6ed44b15cd57df635dff9b536c02d04d82e
[]
no_license
rangerkao/scsbsmpp
ea015675bd56e8516bef4926910ac359e76f87e6
e72dc7b47ffb6267fa8a49246dedb433770a31ca
refs/heads/master
2021-01-10T05:38:58.095618
2016-01-25T03:48:56
2016-01-25T03:48:56
49,861,624
0
0
null
null
null
null
UTF-8
Java
false
false
1,557
java
package com.scsb.dao; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; public class DatabaseDAO { private static Connection con; private static final String DRIVER ="com.mysql.jdbc.Driver"; private static final String URL ="jdbc:mysql://192.168.10.252:3306/scsbsmpp?characterEncoding=utf8"; private static final String NAME="scsbsmppAdmin"; private static final String PASSWORD="adm"; static{ try{ Class.forName(DRIVER); }catch(ClassNotFoundException e){ System.out.println(e.getLocalizedMessage()); } } public static Connection getConnection(){ try{ con = DriverManager.getConnection(URL,NAME,PASSWORD); //con = DriverManager.Connection(URL,NAME,PASSWORD); }catch(SQLException e){ //e.printStackTrace(); System.out.println(e.getLocalizedMessage()); } return con; } public static void closeCon(Connection con){ try{ if(con!=null)con.close(); }catch(SQLException e){ //e.printStackTrace(); System.out.println(e.getLocalizedMessage()); } } public static void closePt(PreparedStatement pt){ try{ if(pt!=null)pt.close(); }catch(SQLException e){ //e.printStackTrace(); System.out.println(e.getLocalizedMessage()); } } public static void closeRs(ResultSet rs){ try{ if(rs!=null)rs.close(); }catch(SQLException e){ //e.printStackTrace(); System.out.println(e.getLocalizedMessage()); } } }
9cebcc586f733f464f2cb45037c5874069700b9e
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/25/25_3fc0ffc7b28943ba65554081b45e492491e952ec/UserTests/25_3fc0ffc7b28943ba65554081b45e492491e952ec_UserTests_s.java
61d39e2f8656c6e3fd71776c619d9c5fd59ac9d7
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
1,187
java
package test; import static org.junit.Assert.*; import main.*; import org.junit.Before; import org.junit.Test; public class UserTests { AccessTracker tracker; @Before public void setup() { tracker = new AccessTracker(); } @Test public void checkoutAndReturnToolTest() { User testUser = new User("", "", 12345678); Tool testTool = new Tool("HITCOO", 15); testUser.checkoutTool(testTool); tracker.loadTools(); // Ensures that once a tool has been checked out by a user, the database // and the system recognize that it has actually been checked out. assertTrue(testTool.isCheckedOut()); // Ensures that the user actually has the tool assertTrue(testUser.getToolsCheckedOut().contains(testTool)); testUser.returnTool(testTool); tracker.loadTools(); // Ensures that once a tool has been returned, the database // and the system recognize that it has actually been returned. assertFalse(testTool.isCheckedOut()); // Ensures that the user no longer has the tool assertFalse(testUser.getToolsCheckedOut().contains(testTool)); } }
5fb324710b28c9075e7abee0f69f4539725ed183
dc7d9819709c288edf5c242049610f3a64805a69
/cs端的成品/Teacher/src/team/javaSpirit/teachingAssistantPlatform/mina/TCommunicaIoHandle.java
0157176df205207a1862d0cdffa01227a82af275
[]
no_license
zhangleiting/JavaSprits
c9ee84542a5395aae333a0af6250852bbad23daa
c3b5637b3f5c35f4e5f18ac92c25e6c0eaa51a4d
refs/heads/master
2022-01-20T10:33:14.592120
2019-07-23T02:33:37
2019-07-23T02:33:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,965
java
package team.javaSpirit.teachingAssistantPlatform.mina; import org.apache.mina.core.service.IoHandlerAdapter; import org.apache.mina.core.session.IdleStatus; import org.apache.mina.core.session.IoSession; /** * <p> * Title: SCommunicaIoHandle * </p> * <p> * Description: 老师服务端处理器。接收客户端传递的信息,对其进行相对应的处理。 判断session的不同状态,进行相对应的操作 * </p> * * @author Fang Yuzhen * @date 2018年11月28日 */ public class TCommunicaIoHandle extends IoHandlerAdapter { /* 连接数量 */ public static int num = 0; /** * 监听学生端写过来的信息,将其接收并对其内容进行相对应的回复。 */ @Override public void messageReceived(IoSession session, Object message) throws Exception { System.out.println("messageReceived"); } /** * 监听服务器 写客户端给的信息,在其进行相对应的处理 */ @Override public void messageSent(IoSession session, Object message) throws Exception { } public TCommunicaIoHandle() { } @Override public void exceptionCaught(IoSession session, Throwable cause) throws Exception { System.out.println("exceptionCaught"); if (session != null) { session.getCloseFuture(); } } @Override public void sessionClosed(IoSession session) throws Exception { System.out.println("sessionClosed"); num--; System.out.println(num); } @Override public void sessionCreated(IoSession session) throws Exception { System.out.println("sessionCreated"); } @Override public void sessionIdle(IoSession session, IdleStatus status) throws Exception { System.out.println("sessionIdle"); } @Override public void sessionOpened(IoSession session) throws Exception { System.out.println("sessionOpened"); num++; /* * if (this.setMessage == null) { System.out.println("xinjian"); this.setMessage * = new SetMessageThread(fileShare); this.setMessage.start(); } */ } }
d5ff55bb16befd09a8cf4b0a3aab91b6ddd9a793
b4c89acbd630437941bcf6c8005518d8390cb3c4
/src/test/java/tests/LoginTest.java
43df11d2f21e3844237b22bbfb049b21eb14ed24
[]
no_license
memocpr/proCrmX
a79c9a37a7d83986bb19f6c42e3abb53ee4f182b
38668d4cfecd37452005aaaa3c3087b3ccd94bdb
refs/heads/master
2023-05-11T06:13:53.048493
2020-05-27T20:32:43
2020-05-27T20:32:43
267,420,580
0
0
null
2023-05-09T18:47:59
2020-05-27T20:33:30
Java
UTF-8
Java
false
false
530
java
package tests; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.testng.annotations.Test; import pages.LoginPage; public class LoginTest extends TestBase{ @Test public void loginAsHelpdeskTest(){ driver.findElement(By.className("input[type='text']")).sendKeys("[email protected]"); driver.findElement(By.cssSelector("input[type='password']")).sendKeys("UserUser"); driver.findElement(By.cssSelector("input[type='submit']")).sendKeys(Keys.ENTER); } }
59a814d3558dbfa8a6979dd12d26a086a3e2bc23
a9d40e882bb8679fc4eecee6d117e33eec8a4f6a
/gmall-api/src/main/java/com/demo/gmall/bean/PmsBaseAttrInfo.java
56eb3e0a63d36ab43ef6e5c9edd6476115c560d4
[]
no_license
zsy2713/gmall
1ebc508fbd0f2a9907f5b869e5317cc79c128e02
a2c94ede45fc35f20cbd5719bcc6973f0814c056
refs/heads/master
2022-09-15T01:10:02.576742
2019-10-24T10:50:46
2019-10-24T10:50:46
216,556,048
0
0
null
2022-09-01T23:14:34
2019-10-21T11:54:14
Java
UTF-8
Java
false
false
1,653
java
package com.demo.gmall.bean; import javax.persistence.*; import java.io.Serializable; import java.util.List; /** * @param * @return */ public class PmsBaseAttrInfo implements Serializable { @GeneratedValue(strategy = GenerationType.IDENTITY) @Id @Column private String id; @Column private String attrName; @Column private String catalog3Id; @Column private String isEnabled; @Transient List<PmsBaseAttrValue> attrValueList; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getAttrName() { return attrName; } public void setAttrName(String attrName) { this.attrName = attrName; } public String getCatalog3Id() { return catalog3Id; } public void setCatalog3Id(String catalog3Id) { this.catalog3Id = catalog3Id; } public String getIsEnabled() { return isEnabled; } public void setIsEnabled(String isEnabled) { this.isEnabled = isEnabled; } public List<PmsBaseAttrValue> getAttrValueList() { return attrValueList; } public void setAttrValueList(List<PmsBaseAttrValue> attrValueList) { this.attrValueList = attrValueList; } @Override public String toString() { return "PmsBaseAttrInfo{" + "id='" + id + '\'' + ", attrName='" + attrName + '\'' + ", catalog3Id='" + catalog3Id + '\'' + ", isEnabled='" + isEnabled + '\'' + ", attrValueList=" + attrValueList + '}'; } }
[ "[email protected] config --global user.email [email protected]" ]
[email protected] config --global user.email [email protected]
4eb9db146e6f02fa8bd078d2570e9dc7cf0ad8b6
1a42d2286addef3fd78da9f2794b2b829f828057
/core/src/test/java/feign/retry/ConditionalRetryTest.java
b2a5d66e34492dd12e6b40a56b50e4f1870b4d1d
[ "Apache-2.0" ]
permissive
JokerSun/feignx
353266e1c3b969f6d6edf9d58510bf5777370406
fed3cd1844a30c7a3f2def113acf6f98d1bae7c7
refs/heads/master
2020-05-25T02:49:44.852609
2019-09-04T05:50:50
2019-09-04T05:50:50
187,587,968
0
0
Apache-2.0
2019-09-04T05:50:53
2019-05-20T07:17:04
Java
UTF-8
Java
false
false
7,028
java
/* * Copyright 2019 OpenFeign Contributors * * 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 feign.retry; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import feign.Client; import feign.ExceptionHandler; import feign.ExceptionHandler.RethrowExceptionHandler; import feign.Logger; import feign.Request; import feign.Response; import java.util.concurrent.TimeUnit; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; @ExtendWith(MockitoExtension.class) class ConditionalRetryTest { @Mock private Logger logger; @Mock private Request request; @Mock private Client client; @Mock private Response response; private ExceptionHandler exceptionHandler = new RethrowExceptionHandler(); private ConditionalRetry conditionalRetry; @Test void shouldStopRetry_andReturnLastResponse_whenConditionPass_andAttemptsExhausted() throws Throwable { RetryCondition condition = mock(RetryCondition.class); when(condition.test(any(RetryContext.class))).thenReturn(true); when(client.request(any(Request.class))).thenReturn(this.response); this.conditionalRetry = new ConditionalRetry(3, condition, retryContext -> 1L, logger, exceptionHandler); /* retry should run 3 times and then stop, returning the last result */ Response response = this.conditionalRetry.execute("test", this.request, client::request); verify(this.client, times(3)).request(any(Request.class)); verify(this.logger, times(2)).logRetry(anyString(), any(RetryContext.class)); assertThat(response).isNotNull(); } @Test void shouldStopRetry_andThrowLastException_whenConditionPass_andAttemptsExhausted() { RetryCondition condition = mock(RetryCondition.class); when(condition.test(any(RetryContext.class))).thenReturn(true); when(client.request(any(Request.class))).thenReturn(this.response, this.response) .thenThrow(new RuntimeException("failed")); this.conditionalRetry = new ConditionalRetry(3, condition, retryContext -> 1L, logger, exceptionHandler); /* retry should run 3 times and then stop, throwing the last exception */ assertThrows(RuntimeException.class, () -> this.conditionalRetry.execute("test", this.request, client::request)); verify(this.client, times(3)).request(any(Request.class)); verify(this.logger, times(2)).logRetry(anyString(), any(RetryContext.class)); } @Test void shouldNotRetry_whenConditionFails_onInitialAttempt() throws Throwable { RetryCondition condition = mock(RetryCondition.class); when(condition.test(any(RetryContext.class))).thenReturn(false); when(client.request(any(Request.class))).thenReturn(this.response); this.conditionalRetry = new ConditionalRetry(3, condition, retryContext -> 1L, logger, exceptionHandler); /* retry should not run at all */ Response response = this.conditionalRetry.execute("test", this.request, client::request); verify(this.client, times(1)).request(any(Request.class)); verifyZeroInteractions(this.logger); assertThat(response).isNotNull(); } @Test void shouldNotRetry_whenConditionFails_afterInitialAttempt() throws Throwable { RetryCondition condition = mock(RetryCondition.class); when(condition.test(any(RetryContext.class))).thenReturn(true, false); when(client.request(any(Request.class))).thenReturn(this.response); this.conditionalRetry = new ConditionalRetry(3, condition, retryContext -> 1L, logger, exceptionHandler); /* retry should run 2 times and then stop, returning the last result */ Response response = this.conditionalRetry.execute("test", this.request, client::request); verify(this.client, times(2)).request(any(Request.class)); verify(this.logger, times(1)).logRetry(anyString(), any(RetryContext.class)); assertThat(response).isNotNull(); } @Test void shouldDelay_betweenRetries() throws Throwable { RetryCondition condition = mock(RetryCondition.class); when(condition.test(any(RetryContext.class))).thenReturn(true, false); RetryInterval retryInterval = mock(RetryInterval.class); when(retryInterval.getInterval(any(RetryContext.class))).thenReturn(1000L); when(client.request(any(Request.class))).thenReturn(this.response); this.conditionalRetry = new ConditionalRetry(3, condition, retryInterval, logger, exceptionHandler); /* retry should run 2 times and then stop, returning the last result */ long start = System.nanoTime(); Response response = this.conditionalRetry.execute("test", this.request, client::request); long end = System.nanoTime(); /* verify we waited the appropriate time */ assertThat(TimeUnit.NANOSECONDS.toMillis(end - start)) .isGreaterThanOrEqualTo(1000); verify(this.client, times(2)).request(any(Request.class)); verify(this.logger, times(1)).logRetry(anyString(), any(RetryContext.class)); verify(retryInterval, times(1)).getInterval(any(RetryContext.class)); assertThat(response).isNotNull(); } @Test void shouldNotDelay_betweenRetries_withZeroDelay() throws Throwable { RetryCondition condition = mock(RetryCondition.class); when(condition.test(any(RetryContext.class))).thenReturn(true, false); RetryInterval retryInterval = mock(RetryInterval.class); when(retryInterval.getInterval(any(RetryContext.class))).thenReturn(0L); when(client.request(any(Request.class))).thenReturn(this.response); this.conditionalRetry = new ConditionalRetry(3, condition, retryInterval, logger, exceptionHandler); Response response = this.conditionalRetry.execute("test", this.request, client::request); /* verify we waited the appropriate time */ verify(this.client, times(2)).request(any(Request.class)); verify(this.logger, times(1)).logRetry(anyString(), any(RetryContext.class)); verify(retryInterval, times(1)).getInterval(any(RetryContext.class)); assertThat(response).isNotNull(); } }
33434e5d14c1851d6959a04ec673b68787349778
ff5f00be10ef21710493902d0ad334c556ac1221
/pkuhit.xap-api/src/main/java/pkuhit/xap/file/FileObject.java
8279bc452089998502fa6a64a7ac9a7cf7ac6614
[]
no_license
sun-wangbaiyu/emr-code
2ed323a682f42db1ce3c3c61c7680de2f80d6290
034f2a6a969b55ff97c8b8cdaff1e0c0615a0dc7
refs/heads/master
2020-05-16T09:14:30.758529
2017-11-19T03:31:40
2017-11-19T03:31:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
927
java
package pkuhit.xap.file; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class FileObject { String id; String name; Long size; ObjectData data; public FileObject(String id, Long size, InputStream in) throws IOException { this.id = id; this.size = size; this.data = new ObjectData(in); } public String getId() { return id; } public Long getSize() { return size; } public InputStream asInputStream() throws IOException { return data.asInputStream(); } public byte[] asByteArray() throws IOException { return this.data.asByteArray(); } public void writeTo(OutputStream out) throws IOException { data.writeTo(out); } public enum Type { BIZ, BASE } }
3abc87a752af2893734b500cc7720d44def60d41
3942fd595687f15841282beaf6fb72efa4cd0807
/app/src/main/java/com/expandablelistdemo/MainActivity.java
7567a6bd8183391736fcf91958dc12f772237e28
[]
no_license
turjoridoy/ExpandableListDemo
eff36ab47de19e18f9ef7619bc61b7d11d0ec0f0
363772a15ec746a9e77663b527a4f324f05f3bca
refs/heads/master
2020-05-19T13:13:28.731848
2019-05-05T13:20:26
2019-05-05T13:20:26
185,034,132
0
0
null
null
null
null
UTF-8
Java
false
false
5,191
java
package com.expandablelistdemo; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.widget.ExpandableListView; import com.expandablelistdemo.Model.DataItem; import com.expandablelistdemo.Model.SubCategoryItem; import java.util.ArrayList; import java.util.HashMap; public class MainActivity extends AppCompatActivity { private ExpandableListView lvCategory; private ArrayList<DataItem> arCategory; private ArrayList<SubCategoryItem> arSubCategory; private ArrayList<ArrayList<SubCategoryItem>> arSubCategoryFinal; private ArrayList<HashMap<String, String>> parentItems; private ArrayList<ArrayList<HashMap<String, String>>> childItems; private MyCategoriesExpandableListAdapter myCategoriesExpandableListAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setupReferences(); } private void setupReferences() { lvCategory = findViewById(R.id.lvCategory); arCategory = new ArrayList<>(); arSubCategory = new ArrayList<>(); parentItems = new ArrayList<>(); childItems = new ArrayList<>(); DataItem dataItem = new DataItem(); dataItem.setCategoryId("1"); dataItem.setCategoryName("Adventure"); arSubCategory = new ArrayList<>(); for(int i = 1; i < 6; i++) { SubCategoryItem subCategoryItem = new SubCategoryItem(); subCategoryItem.setCategoryId(String.valueOf(i)); subCategoryItem.setIsChecked(ConstantManager.CHECK_BOX_CHECKED_FALSE); subCategoryItem.setSubCategoryName("Adventure: "+i); arSubCategory.add(subCategoryItem); } dataItem.setSubCategory(arSubCategory); arCategory.add(dataItem); dataItem = new DataItem(); dataItem.setCategoryId("2"); dataItem.setCategoryName("Art"); arSubCategory = new ArrayList<>(); for(int j = 1; j < 6; j++) { SubCategoryItem subCategoryItem = new SubCategoryItem(); subCategoryItem.setCategoryId(String.valueOf(j)); subCategoryItem.setIsChecked(ConstantManager.CHECK_BOX_CHECKED_FALSE); subCategoryItem.setSubCategoryName("Art: "+j); arSubCategory.add(subCategoryItem); } dataItem.setSubCategory(arSubCategory); arCategory.add(dataItem); dataItem = new DataItem(); dataItem.setCategoryId("3"); dataItem.setCategoryName("Cooking"); arSubCategory = new ArrayList<>(); for(int k = 1; k < 6; k++) { SubCategoryItem subCategoryItem = new SubCategoryItem(); subCategoryItem.setCategoryId(String.valueOf(k)); subCategoryItem.setIsChecked(ConstantManager.CHECK_BOX_CHECKED_FALSE); subCategoryItem.setSubCategoryName("Cooking: "+k); arSubCategory.add(subCategoryItem); } dataItem.setSubCategory(arSubCategory); arCategory.add(dataItem); Log.d("TAG", "setupReferences: "+arCategory.size()); for(DataItem data : arCategory){ // Log.i("Item id",item.id); ArrayList<HashMap<String, String>> childArrayList =new ArrayList<HashMap<String, String>>(); HashMap<String, String> mapParent = new HashMap<String, String>(); mapParent.put(ConstantManager.Parameter.CATEGORY_ID,data.getCategoryId()); mapParent.put(ConstantManager.Parameter.CATEGORY_NAME,data.getCategoryName()); int countIsChecked = 0; for(SubCategoryItem subCategoryItem : data.getSubCategory()) { HashMap<String, String> mapChild = new HashMap<String, String>(); mapChild.put(ConstantManager.Parameter.SUB_ID,subCategoryItem.getSubId()); mapChild.put(ConstantManager.Parameter.SUB_CATEGORY_NAME,subCategoryItem.getSubCategoryName()); mapChild.put(ConstantManager.Parameter.CATEGORY_ID,subCategoryItem.getCategoryId()); mapChild.put(ConstantManager.Parameter.IS_CHECKED,subCategoryItem.getIsChecked()); if(subCategoryItem.getIsChecked().equalsIgnoreCase(ConstantManager.CHECK_BOX_CHECKED_TRUE)) { countIsChecked++; } childArrayList.add(mapChild); } if(countIsChecked == data.getSubCategory().size()) { data.setIsChecked(ConstantManager.CHECK_BOX_CHECKED_TRUE); }else { data.setIsChecked(ConstantManager.CHECK_BOX_CHECKED_FALSE); } mapParent.put(ConstantManager.Parameter.IS_CHECKED,data.getIsChecked()); childItems.add(childArrayList); parentItems.add(mapParent); } ConstantManager.parentItems = parentItems; ConstantManager.childItems = childItems; myCategoriesExpandableListAdapter = new MyCategoriesExpandableListAdapter(this,parentItems,childItems,false); lvCategory.setAdapter(myCategoriesExpandableListAdapter); } }
8e4033dafd0eaa193251b7e2ef4d1b88191af40d
6a03ea158aae68aed0d042e959dfaf8a9b9f1f80
/app/src/test/java/com/cotton/mahacott/ExampleUnitTest.java
6f8d7f079515f0564c1385f41b371fb5a37a4594
[]
no_license
ashwinbhite/mahacottapp
dfc595fb132f4164a57129d93e1af863d62cc0cc
efbad4156fb01e89b5396cb1e73bcd474d9a19eb
refs/heads/master
2022-11-11T14:44:28.820590
2020-06-30T05:35:01
2020-06-30T05:35:01
276,006,706
0
0
null
null
null
null
UTF-8
Java
false
false
380
java
package com.cotton.mahacott; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
87ac5d4f3c365ea5178f860e83bbbc788bbc23ff
00cbe217033afbd7a38012ca3e509ccb9c8ba440
/Mytest/src/listview/newitem/DepartInfoAdapter.java
b9c2b28f09992d8ea94f9a755ba1223ccd6517bc
[]
no_license
StevenWang1988/HelloWorld
fe369aff751537ecf4514c178ad974a8916e78fd
02d75144222fefc3830e7c8f52e1df4fa2419129
refs/heads/master
2020-05-30T11:03:29.701726
2014-04-01T04:35:21
2014-04-01T04:35:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,537
java
package listview.newitem; import steven.example.mytest.R; import android.app.Activity; import android.content.Context; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; public class DepartInfoAdapter extends ArrayAdapter<InfoItem>{ private static final String TAG = "DepartInfoAdapter"; private TextView info1; private TextView info2; private TextView info3; private InfoItem[] infoItem = null; Context context; int resourceId; public DepartInfoAdapter(Context context, int resource, InfoItem[] infoItem) { super(context, resource, infoItem); this.context = context; this.resourceId = resource; this.infoItem = infoItem; } @Override public View getView(int position, View convertView, ViewGroup parent){ Log.v(TAG, "getView position: " + position); if(convertView == null){ LayoutInflater inflater = ((Activity) context).getLayoutInflater(); convertView = inflater.inflate(resourceId, parent, false); } info1 = (TextView) convertView.findViewById(R.id.info1); info2 = (TextView) convertView.findViewById(R.id.info2); info3 = (TextView) convertView.findViewById(R.id.info3); info1.setText(infoItem[position].getInfo1()); info2.setText(infoItem[position].getInfo2()); info3.setText(infoItem[position].getInfo3()); Log.v(TAG, infoItem[position].getInfo1()); return convertView; } }
f84e16f9692b7ccc5bda10765251947d3274aac4
a42f9fb600dce680649b138473478cc9c7fed59b
/opensrp-jhpiego/src/main/java/org/smartgresiter/jhpiego/listener/FamilyMemberImmunizationListener.java
23ef18b1c31bc20499202239b6b0ba0c65961f51
[ "Apache-2.0" ]
permissive
issyzac/opensrp-client
535c5087a78a5abf91e1f0999e804eb5d2721018
f6fc5c4408567aad43fcee6b6255b5be46645b34
refs/heads/master
2020-06-17T00:43:55.926119
2019-07-08T06:14:07
2019-07-08T06:14:07
195,746,839
0
0
null
null
null
null
UTF-8
Java
false
false
360
java
package org.smartgresiter.jhpiego.listener; import org.smartgresiter.jhpiego.util.ImmunizationState; import java.util.Date; import java.util.Map; public interface FamilyMemberImmunizationListener { void onFamilyMemberState(ImmunizationState state); void onSelfStatus(Map<String, Date> vaccines, Map<String, Object> nv, ImmunizationState state); }
a61ee2a31ae925602b2d26c5303fe9d4bbf1aa72
b0cb58fc0d2a0e06c3f4426e6776a398ea348ec9
/src/test/java/com/ps/MongoTest.java
8f31fc50a46585887bcf1c70e5c52b83566268a3
[]
no_license
pashashiz/mongo-native
a5ea28b96937c0a7141458023081dce21ff4997b
a44361b73170e8e31a26c0018cc9cdf06ac8a696
refs/heads/master
2021-01-01T18:14:47.912984
2017-07-25T08:50:43
2017-07-25T08:50:43
98,285,328
0
0
null
null
null
null
UTF-8
Java
false
false
3,485
java
package com.ps; import com.mongodb.ConnectionString; import com.mongodb.async.client.MongoClient; import com.mongodb.async.client.MongoClients; import com.mongodb.async.client.MongoCollection; import com.mongodb.async.client.MongoDatabase; import com.mongodb.client.model.Indexes; import org.bson.Document; import org.bson.types.ObjectId; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.util.concurrent.CountDownLatch; import static com.mongodb.client.model.Filters.*; public class MongoTest { private MongoClient mongo; private MongoDatabase db; @Before public void setUp() throws InterruptedException { mongo = MongoClients.create(new ConnectionString("mongodb://localhost:27017")); db = mongo.getDatabase("test"); MongoCollection<Document> users = db.getCollection("users"); CountDownLatch done = new CountDownLatch(3); users.insertOne(new Document() .append("_id", new ObjectId()) .append("firstName", "pavlo") .append("lastName", "pohrebnyi") .append("age", 27) .append("address", new Document() .append("city", "Kiyv") .append("street", "xxx")), (r, t) -> { done.countDown(); }); users.insertOne(new Document() .append("_id", new ObjectId()) .append("firstName", "randy") .append("lastName", "baiad") .append("age", 45) .append("address", new Document() .append("city", "Rye") .append("street", "xxx")), (r, t) -> { done.countDown(); }); users.createIndex( Indexes.ascending("firstName", "lastName"), (result, t) -> done.countDown()); done.await(); } @After public void tearDown() { db.drop((r, t) -> mongo.close()); } @Test public void queryAll() throws InterruptedException { MongoCollection<Document> users = db.getCollection("users"); CountDownLatch done = new CountDownLatch(1); users.find().forEach( document -> System.out.println(document.toJson()), (result, t) -> done.countDown()); done.await(); } @Test public void queryWithFilter() throws InterruptedException { MongoCollection<Document> users = db.getCollection("users"); CountDownLatch done = new CountDownLatch(1); users.find(eq("firstName", "pavlo")).forEach( document -> System.out.println(document.toJson()), (result, t) -> done.countDown()); done.await(); } @Test public void update() throws InterruptedException { MongoCollection<Document> users = db.getCollection("users"); CountDownLatch done = new CountDownLatch(1); users.updateMany(eq("firstName", "pavlo"), new Document("$set", new Document("lastName", "Man")), (result, t) -> done.countDown()); done.await(); } @Test public void delete() throws InterruptedException { MongoCollection<Document> users = db.getCollection("users"); CountDownLatch done = new CountDownLatch(1); users.deleteMany(eq("firstName", "pavlo"), (result, t) -> done.countDown()); done.await(); } }
dcd5cef79e392f8fc540e86b2f8f2c6a0e05d96c
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/openzipkin--zipkin/2fe5142e08b4d74bd38da4ff5837e969777755da/before/IndexNameFormatter.java
8f21b8e59dc091446b1387d69970764ce9ed4939
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
5,094
java
/** * Copyright 2015-2017 The OpenZipkin Authors * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package zipkin.storage.elasticsearch.http; import com.google.auto.value.AutoValue; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; import java.util.Date; import java.util.GregorianCalendar; import java.util.List; import java.util.TimeZone; import javax.annotation.Nullable; import zipkin.internal.Util; @AutoValue abstract class IndexNameFormatter { static Builder builder() { return new AutoValue_IndexNameFormatter.Builder(); } abstract Builder toBuilder(); private static final String DAILY_INDEX_FORMAT = "yyyy-MM-dd"; private static final TimeZone UTC = TimeZone.getTimeZone("UTC"); abstract String index(); abstract char dateSeparator(); abstract ThreadLocal<SimpleDateFormat> dateFormat(); // SimpleDateFormat isn't thread-safe @AutoValue.Builder static abstract class Builder { abstract Builder index(String index); abstract Builder dateSeparator(char dateSeparator); abstract Builder dateFormat(ThreadLocal<SimpleDateFormat> dateFormat); abstract char dateSeparator(); final IndexNameFormatter build() { return dateFormat(new ThreadLocal<SimpleDateFormat>() { @Override protected SimpleDateFormat initialValue() { SimpleDateFormat result = new SimpleDateFormat(DAILY_INDEX_FORMAT.replace('-', dateSeparator())); result.setTimeZone(TimeZone.getTimeZone("UTC")); return result; } }).autoBuild(); } abstract IndexNameFormatter autoBuild(); } /** * Returns a set of index patterns that represent the range provided. Notably, this compresses * months or years using wildcards (in order to send smaller API calls). * * <p>For example, if {@code beginMillis} is 2016-11-30 and {@code endMillis} is 2017-01-02, the * result will be 2016-11-30, 2016-12-*, 2017-01-01 and 2017-01-02. */ List<String> formatTypeAndRange(@Nullable String type, long beginMillis, long endMillis) { GregorianCalendar current = midnightUTC(beginMillis); GregorianCalendar end = midnightUTC(endMillis); if (current.equals(end)) { return Collections.singletonList(formatTypeAndTimestamp(type, current.getTimeInMillis())); } String prefix = prefix(type); List<String> indices = new ArrayList<>(); while (current.compareTo(end) <= 0) { if (current.get(Calendar.MONTH) == 0 && current.get(Calendar.DATE) == 1) { // attempt to compress a year current.set(Calendar.DAY_OF_YEAR, current.getActualMaximum(Calendar.DAY_OF_YEAR)); if (current.compareTo(end) <= 0) { indices.add( String.format("%s-%s%c*", prefix, current.get(Calendar.YEAR), dateSeparator())); current.add(Calendar.DATE, 1); // rollover to next year continue; } else { current.set(Calendar.DAY_OF_YEAR, 1); // rollback to first of the year } } else if (current.get(Calendar.DATE) == 1) { // attempt to compress a month current.set(Calendar.DATE, current.getActualMaximum(Calendar.DATE)); if (current.compareTo(end) <= 0) { indices.add(String.format("%s-%s%c%02d%c*", prefix, current.get(Calendar.YEAR), dateSeparator(), current.get(Calendar.MONTH) + 1, dateSeparator() )); current.add(Calendar.DATE, 1); // rollover to next month continue; } else { current.set(Calendar.DATE, 1); // rollback to first of the month } } indices.add(formatTypeAndTimestamp(type, current.getTimeInMillis())); current.add(Calendar.DATE, 1); } return indices; } static GregorianCalendar midnightUTC(long epochMillis) { GregorianCalendar result = new GregorianCalendar(UTC); result.setTimeInMillis(Util.midnightUTC(epochMillis)); return result; } String formatTypeAndTimestamp(@Nullable String type, long timestampMillis) { return prefix(type) + "-" + dateFormat().get().format(new Date(timestampMillis)); } private String prefix(@Nullable String type) { return type != null ? index() + ":" + type : index(); } // for testing long parseDate(String timestamp) { try { return dateFormat().get().parse(timestamp).getTime(); } catch (ParseException e) { throw new AssertionError(e); } } String formatType(@Nullable String type) { return prefix(type) + "-*"; } }
ac948843a81016e1368005e470cd3601c48592ea
466011096bd1cb660b483350d51512abd9b5a2d8
/src/test/java/xdptdr/ulhiunteco/aw/TestAW.java
8ae851e0639398ba238ac7912a57b377256101d2
[]
no_license
xdptdr/UlHiUnTeCo
8a9a50e374d624be5293123c3ab08d0f10ea4d78
f6a551946af5013a9a3089a762db6ae3897d2a0e
refs/heads/master
2021-01-01T05:21:40.233214
2016-05-20T19:56:41
2016-05-20T19:56:41
58,808,647
2
0
null
null
null
null
UTF-8
Java
false
false
3,537
java
package xdptdr.ulhiunteco.aw; import org.hibernate.Session; import org.hibernate.Transaction; import org.junit.Assert; import org.junit.Test; import xdptdr.ulhiunteco.test.AbstractTest; /** * @author xdptdr */ public class TestAW extends AbstractTest { private static final String personName1 = "personName1"; private static final String personName2 = "personName2"; private static final String personName3 = "personName3"; private static final String personName4 = "personName4"; private static final String personName5 = "personName5"; private static final String personName6 = "personName6"; private static final String buildingName1 = "buildingName1"; private static final String buildingName2 = "buildingName2"; private static final String buildingName3 = "buildingName3"; private Long person1Id = null; private Long person2Id = null; private Long person3Id = null; private Long person4Id = null; private Long person5Id = null; private Long person6Id = null; private Long building1Id = null; private Long building2Id = null; private Long building3Id = null; public TestAW() { super(new Class<?>[] { PersonAW.class, BuildingAW.class }); } private void create() { PersonAW person1 = new PersonAW(personName1); PersonAW person2 = new PersonAW(personName2); PersonAW person3 = new PersonAW(personName3); PersonAW person4 = new PersonAW(personName4); PersonAW person5 = new PersonAW(personName5); PersonAW person6 = new PersonAW(personName6); BuildingAW building1 = new BuildingAW(buildingName1); BuildingAW building2 = new BuildingAW(buildingName2); BuildingAW building3 = new BuildingAW(buildingName3); AWUtils.bindUses(person1, building1); AWUtils.bindUses(person2, building1); AWUtils.bindUses(person2, building2); AWUtils.bindUses(person3, building1); AWUtils.bindUses(person3, building2); AWUtils.bindUses(person3, building3); AWUtils.bindUses(person4, building2); AWUtils.bindUses(person4, building3); AWUtils.bindUses(person5, building2); AWUtils.bindUses(person6, building3); AWUtils.bindOwns(person1, building1); AWUtils.bindOwns(person1, building2); // building3 is own by both person1 and person2 AWUtils.bindOwns(person1, building3); AWUtils.bindOwns(person2, building3); Session session = null; Transaction tx = null; try { session = getSessionFactory().openSession(); tx = session.beginTransaction(); session.save(person1); session.save(person2); session.save(person3); session.save(person4); session.save(person5); session.save(person6); session.save(building1); session.save(building2); session.save(building3); person1Id = person1.getId(); person2Id = person2.getId(); person3Id = person3.getId(); person4Id = person4.getId(); person5Id = person5.getId(); person6Id = person6.getId(); building1Id = building1.getId(); building2Id = building2.getId(); building3Id = building3.getId(); tx.commit(); } finally { if (session != null) { session.close(); } } Assert.assertNotNull(person1Id); Assert.assertNotNull(person2Id); Assert.assertNotNull(person3Id); Assert.assertNotNull(person4Id); Assert.assertNotNull(person5Id); Assert.assertNotNull(person6Id); Assert.assertNotNull(building1Id); Assert.assertNotNull(building2Id); Assert.assertNotNull(building3Id); } @Test public void testCreate() { create(); } }
700f6aa828ef63bd1cbb9bd43dd664fe34d7b664
3e8290da79315a5ca93bf6a98427a962dc9f45de
/src/main/java/com/ilyasov/dao/AdvertisementDAO.java
38c35478c54abd5042cd7545f1265f912ff5487e
[]
no_license
DamirIlyasov/AvitoChecker
428e9b43bf68bd3d2348837e08c70386a57c9033
3569427afbc40b21dac89046de15e6c13c14ab95
refs/heads/master
2021-01-22T23:43:34.196603
2017-03-21T05:51:06
2017-03-21T05:51:06
85,663,780
0
0
null
null
null
null
UTF-8
Java
false
false
1,887
java
package com.ilyasov.dao; import com.ilyasov.entity.Advertisement; import java.sql.*; import java.util.List; public class AdvertisementDAO { private Connection conn; private Statement statmt; private ResultSet resSet; public AdvertisementDAO() { try { Class.forName("org.sqlite.JDBC"); conn = DriverManager.getConnection("jdbc:sqlite:/home/damir/IdeaProjects/AvitoChecker/src/main/webapp/resources/database/avito "); statmt = conn.createStatement(); } catch (ClassNotFoundException | SQLException e) { e.printStackTrace(); } } public synchronized int countRows() { try { resSet = statmt.executeQuery("SELECT COUNT(*) AS rowcount FROM advertisements"); resSet.next(); int count = resSet.getInt("rowcount"); resSet.close(); return count; } catch (SQLException e) { e.printStackTrace(); } return 0; } public synchronized void putAllAdvertisements(List<Advertisement> advertisements) { for (Advertisement adv : advertisements) { try { String sqlInsert = ("INSERT OR REPLACE INTO advertisements (year, price,city,description,created_at) VALUES (?,?,?,?,?); "); PreparedStatement preparedStatement = conn.prepareStatement(sqlInsert); preparedStatement.setInt(1, adv.getYear()); preparedStatement.setInt(2, adv.getPrice()); preparedStatement.setString(3, adv.getCity()); preparedStatement.setString(4, adv.getDescription()); preparedStatement.setString(5, adv.getCreatedAtFormatted()); preparedStatement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } } } }
ff5fc426d278dc5ef55fd4e2fc82ed137e3bab0b
786623f1e23bfcf9af1bfb57c895a406856d8b16
/code/src/extonextgroup/extonext_v2/AfterDonationScreenCorp.java
cb698848166b30bdb4756954bb7810d96e51ddff
[]
no_license
larafenercioglu/ExToNext
3aa45586a078653fc7c9a9463ce6fb807e0620f5
3471bbad7f4459397262d4925cb3230296c56a10
refs/heads/main
2023-03-21T11:49:11.525539
2021-03-17T17:48:15
2021-03-17T17:48:15
346,345,763
0
1
null
null
null
null
UTF-8
Java
false
false
22,562
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 extonextgroup.extonext_v2; import static java.lang.Integer.parseInt; import java.util.ArrayList; import javax.swing.ImageIcon; import javax.swing.JOptionPane; /** * * @author DELL */ public class AfterDonationScreenCorp extends javax.swing.JFrame { DBConnector db = new DBConnector(); static ArrayList<String> info; public static String user; public static int page = 3; public static int previous; public static String id; /** * Creates new form AfterDonationScreenCorp */ public AfterDonationScreenCorp() { initComponents(); } public void paintPage() { try{ info = db.afterDonation(parseInt(id)); } catch (Exception e) { e.getMessage(); } try{ corppic.setIcon(new ImageIcon(info.get(0))); }catch(Exception e) { System.out.println("No picture available"); } address.setText(info.get(1)); infomessage.setText(info.get(2)); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPopupMenu1 = new javax.swing.JPopupMenu(); profilemenu = new javax.swing.JMenuItem(); logoutmenu = new javax.swing.JMenuItem(); afterdonationbackground1 = new netbeanscomponents.afterdonationbackground(); backbutton = new javax.swing.JButton(); logobutton = new javax.swing.JButton(); messagebutton = new javax.swing.JButton(); profilebutton = new javax.swing.JButton(); corppic = new javax.swing.JLabel(); address = new javax.swing.JTextField(); emailbutton = new javax.swing.JButton(); phonenumbutton = new javax.swing.JButton(); infomessage = new javax.swing.JTextField(); jPopupMenu1.setBackground(new java.awt.Color(204, 0, 255)); jPopupMenu1.setForeground(new java.awt.Color(255, 255, 255)); jPopupMenu1.setAlignmentX(10.0F); profilemenu.setBackground(new java.awt.Color(204, 0, 255)); profilemenu.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N profilemenu.setForeground(new java.awt.Color(255, 255, 255)); profilemenu.setText("Go Profile"); profilemenu.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { profilemenuMouseClicked(evt); } }); profilemenu.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { profilemenuActionPerformed(evt); } }); jPopupMenu1.add(profilemenu); logoutmenu.setBackground(new java.awt.Color(204, 0, 255)); logoutmenu.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N logoutmenu.setForeground(new java.awt.Color(255, 255, 255)); logoutmenu.setText("Logout"); logoutmenu.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { logoutmenuActionPerformed(evt); } }); jPopupMenu1.add(logoutmenu); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); backbutton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/extonextgroup/extonext_v2/images/backbutton.png"))); // NOI18N backbutton.setBorder(null); backbutton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { backbuttonActionPerformed(evt); } }); logobutton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/extonextgroup/extonext_v2/images/logo.png"))); // NOI18N logobutton.setBorder(null); logobutton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { logobuttonActionPerformed(evt); } }); messagebutton.setBackground(new java.awt.Color(255, 255, 255)); messagebutton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/extonextgroup/extonext_v2/images/55x37messagebutton.png"))); // NOI18N messagebutton.setBorder(null); messagebutton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { messagebuttonActionPerformed(evt); } }); profilebutton.setBackground(new java.awt.Color(255, 255, 255)); profilebutton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/extonextgroup/extonext_v2/images/37x37profilebutton.png"))); // NOI18N profilebutton.setBorder(null); profilebutton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { profilebuttonActionPerformed(evt); } }); address.setBackground(new java.awt.Color(255, 204, 255)); address.setText("babacım"); address.setBorder(null); address.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { addressActionPerformed(evt); } }); emailbutton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/extonextgroup/extonext_v2/images/31x25message.png"))); // NOI18N emailbutton.setBorder(null); emailbutton.setOpaque(false); emailbutton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { emailbuttonActionPerformed(evt); } }); phonenumbutton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/extonextgroup/extonext_v2/images/53x38phone.png"))); // NOI18N phonenumbutton.setBorder(null); phonenumbutton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { phonenumbuttonActionPerformed(evt); } }); infomessage.setBackground(new java.awt.Color(255, 204, 255)); infomessage.setText("sfdsfds"); infomessage.setBorder(null); javax.swing.GroupLayout afterdonationbackground1Layout = new javax.swing.GroupLayout(afterdonationbackground1); afterdonationbackground1.setLayout(afterdonationbackground1Layout); afterdonationbackground1Layout.setHorizontalGroup( afterdonationbackground1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(afterdonationbackground1Layout.createSequentialGroup() .addGap(43, 43, 43) .addComponent(backbutton, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(30, 30, 30) .addComponent(logobutton, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(messagebutton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(profilebutton, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(102, 102, 102)) .addGroup(afterdonationbackground1Layout.createSequentialGroup() .addGroup(afterdonationbackground1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(afterdonationbackground1Layout.createSequentialGroup() .addGap(279, 279, 279) .addComponent(corppic, javax.swing.GroupLayout.PREFERRED_SIZE, 187, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(afterdonationbackground1Layout.createSequentialGroup() .addGap(291, 291, 291) .addComponent(address, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(afterdonationbackground1Layout.createSequentialGroup() .addGap(313, 313, 313) .addComponent(emailbutton, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(phonenumbutton))) .addGap(153, 153, 153) .addComponent(infomessage, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(315, Short.MAX_VALUE)) ); afterdonationbackground1Layout.setVerticalGroup( afterdonationbackground1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(afterdonationbackground1Layout.createSequentialGroup() .addGap(23, 23, 23) .addGroup(afterdonationbackground1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(logobutton) .addGroup(afterdonationbackground1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(messagebutton, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(profilebutton, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(backbutton, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(241, 241, 241) .addGroup(afterdonationbackground1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(afterdonationbackground1Layout.createSequentialGroup() .addComponent(corppic, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(44, 44, 44) .addGroup(afterdonationbackground1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(emailbutton, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(phonenumbutton)) .addGap(27, 27, 27) .addComponent(address, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(infomessage)) .addContainerGap(159, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(afterdonationbackground1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(afterdonationbackground1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void profilemenuMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_profilemenuMouseClicked // TODO add your handling code here: }//GEN-LAST:event_profilemenuMouseClicked private void profilemenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_profilemenuActionPerformed // TODO add your handling code here: this.hide(); CorpProfilePage corpProfile = new CorpProfilePage(); corpProfile.setPage(page); corpProfile.setUser(user); corpProfile.paintPage(); corpProfile.setVisible(true); }//GEN-LAST:event_profilemenuActionPerformed private void logoutmenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logoutmenuActionPerformed // TODO add your handling code here: infoBox("Successfully logged out" , "logout" ); this.hide(); LoginScreen login = new LoginScreen(); login.setVisible(true); }//GEN-LAST:event_logoutmenuActionPerformed private void backbuttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backbuttonActionPerformed // TODO add your handling code here: this.hide(); openPage(previous); }//GEN-LAST:event_backbuttonActionPerformed private void logobuttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logobuttonActionPerformed // TODO add your handling code here: this.hide(); MainPageCorporation corporation = new MainPageCorporation(); corporation.setVisible(true); corporation.setPage(page); corporation.setUser(user); }//GEN-LAST:event_logobuttonActionPerformed private void profilebuttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_profilebuttonActionPerformed // TODO add your handling code here: jPopupMenu1.show(this,989,117); }//GEN-LAST:event_profilebuttonActionPerformed private void addressActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addressActionPerformed // TODO add your handling code here: }//GEN-LAST:event_addressActionPerformed private void messagebuttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_messagebuttonActionPerformed // TODO add your handling code here: this.hide(); MessagePage message = new MessagePage(); message.setVisible(true); message.setPage(page); message.setUser(user); }//GEN-LAST:event_messagebuttonActionPerformed private void emailbuttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_emailbuttonActionPerformed // TODO add your handling code here: String email = info.get(3); infoBox("email:"+ email , "email" ); }//GEN-LAST:event_emailbuttonActionPerformed private void phonenumbuttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_phonenumbuttonActionPerformed // TODO add your handling code here: String phone = info.get(4); infoBox("Phone Number: " + phone , "phone number" ); }//GEN-LAST:event_phonenumbuttonActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(AfterDonationScreenCorp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(AfterDonationScreenCorp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(AfterDonationScreenCorp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(AfterDonationScreenCorp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new AfterDonationScreenCorp().setVisible(true); } }); } public static void infoBox(String infoMessage, String titleBar) { JOptionPane.showMessageDialog(null, infoMessage, "" + titleBar, JOptionPane.INFORMATION_MESSAGE); } public static void setUser(String username){ user = username; } public static void setPage(int pagenum){ previous = pagenum; } public static void setId(String idperv) { id = idperv; } public void openPage(int pagenum){ if (previous == 1) { AddDonationListPage donaListPage = new AddDonationListPage(); donaListPage.setVisible(true); donaListPage.setUser(user); } if (previous == 2) { AfterDonationPage donaPage = new AfterDonationPage(); donaPage.setUser(user); donaPage.paintPage(); donaPage.setVisible(true); } if (previous == 3) { AfterDonationScreenCorp donaScreenCorp = new AfterDonationScreenCorp(); donaScreenCorp.setVisible(true); donaScreenCorp.paintPage(); donaScreenCorp.setUser(user); } if (previous == 4) { BuyScreen buyScreen = new BuyScreen(); buyScreen.setUser(user); buyScreen.setVisible(true); } if (previous == 5) { CorpDonateScreen corpScreen = new CorpDonateScreen(); corpScreen.setUser(user); corpScreen.setVisible(true); } if (previous == 6) { CorpProfilePage corpProfile = new CorpProfilePage(); corpProfile.setUser(user); corpProfile.paintPage(); corpProfile.setVisible(true); } if (previous == 7) { DonationFilteredsearchCorp fiteredCorp = new DonationFilteredsearchCorp(); fiteredCorp.setUser(user); fiteredCorp.paintPage(); fiteredCorp.setVisible(true); } if (previous == 8) { FilteredBuyScreen filteredBuy = new FilteredBuyScreen(); filteredBuy.setUser(user); filteredBuy.paintPage(); filteredBuy.setVisible(true); } if (previous == 9) { ItemDetailsPage itemDetails = new ItemDetailsPage(); itemDetails.setUser(user); itemDetails.paintPage(); itemDetails.setVisible(true); } if (previous == 10) { } if (previous == 11) { MainPageCorporation mainCorporation = new MainPageCorporation(); mainCorporation.setVisible(true); mainCorporation.setUser(user); } if (previous == 12) { MainPagePersonal mainPersonal = new MainPagePersonal(); mainPersonal.setVisible(true); mainPersonal.setUser(user); } if (previous == 13) { MessagePage messagePage = new MessagePage(); messagePage.setUser(user); messagePage.paintPage(); messagePage.setVisible(true); } if (previous == 14) { PersonalProfilePage personProfile = new PersonalProfilePage(); personProfile.setUser(user); personProfile.paintPage(); personProfile.setVisible(true); } if (previous == 15) { } if (previous == 16) { UploadScreen upload = new UploadScreen(); upload.setVisible(true); upload.setUser(user); } if (previous == 17) { WishListListPage wishListList = new WishListListPage(); wishListList.setVisible(true); wishListList.setUser(user); } if (previous == 18) { WishListPageCorp wishList = new WishListPageCorp(); wishList.setUser(user); wishList.paintPage(); wishList.setVisible(true); } if (previous == 19) { WishListPagePersonal wishListPersonal = new WishListPagePersonal(); wishListPersonal.setUser(user); wishListPersonal.paintPage(); wishListPersonal.setVisible(true); } if (previous == 20) { DonationPersonalPage donationPersonal = new DonationPersonalPage(); donationPersonal.setVisible(true); donationPersonal.setUser(user); } } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField address; private netbeanscomponents.afterdonationbackground afterdonationbackground1; private javax.swing.JButton backbutton; private javax.swing.JLabel corppic; private javax.swing.JButton emailbutton; private javax.swing.JTextField infomessage; private javax.swing.JPopupMenu jPopupMenu1; private javax.swing.JButton logobutton; private javax.swing.JMenuItem logoutmenu; private javax.swing.JButton messagebutton; private javax.swing.JButton phonenumbutton; private javax.swing.JButton profilebutton; private javax.swing.JMenuItem profilemenu; // End of variables declaration//GEN-END:variables }
eb9f372303807a84d9f39b18a899f89459f75601
3508bc01693817a717592fdfa2b0d964fd4c049c
/app/src/main/java/android/tp/unice/yoann/poncet/devapplication/RegisterActivity.java
3c38f2be85b11a717e85f42fb2edc1234ea3344d
[]
no_license
LotfiMBDS/DevApplication
028190ca3147fae4321d2b12ab0e3764c8c0aeb0
9e5bee70957f118e14caa912fe0710dc6eca2d2e
refs/heads/master
2016-08-12T18:07:42.402368
2015-10-27T08:44:00
2015-10-27T08:44:00
45,027,749
0
0
null
null
null
null
UTF-8
Java
false
false
1,769
java
package android.tp.unice.yoann.poncet.devapplication; import android.annotation.SuppressLint; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.RadioButton; import org.w3c.dom.Text; public class RegisterActivity extends AppCompatActivity implements View.OnClickListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); Button register = (Button)findViewById(R.id.button); register.setOnClickListener(this); } @SuppressLint("WrongViewCast") @Override public void onClick(View v) { Text nom; Text prenom; Text email; Text mdp; Text mpdConfirm; Text telephone; RadioButton masculin; RadioButton feminun; nom = (Text) findViewById(R.id.nom); prenom = (Text) findViewById(R.id.prenom); email = (Text) findViewById(R.id.email); mdp = (Text) findViewById(R.id.password); mpdConfirm = (Text) findViewById(R.id.confirmPassword); telephone = (Text) findViewById(R.id.telephone); masculin = (RadioButton) findViewById(R.id.radioButton); feminun = (RadioButton) findViewById(R.id.radioButton); // si invalide if((nom == null)||(mdp == null)||(prenom == null)||(telephone == null)||(email == null) ||((masculin == null) && (feminun ==null))|| (mdp != mpdConfirm)) { } else // si formulaire valide { startActivity(new Intent(RegisterActivity.this, Menu.class)); } } }
9e334c0cbb105416ef07afb17d8979ac40ba09c4
c885ef92397be9d54b87741f01557f61d3f794f3
/tests-without-trycatch/Math-6/org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer/BBC-F0-opt-10/12/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/CMAESOptimizer_ESTest.java
08bc891086feba07b2f456700b78b0c396afeacf
[ "CC-BY-4.0", "MIT" ]
permissive
pderakhshanfar/EMSE-BBC-experiment
f60ac5f7664dd9a85f755a00a57ec12c7551e8c6
fea1a92c2e7ba7080b8529e2052259c9b697bbda
refs/heads/main
2022-11-25T00:39:58.983828
2022-04-12T16:04:26
2022-04-12T16:04:26
309,335,889
0
1
null
2021-11-05T11:18:43
2020-11-02T10:30:38
null
UTF-8
Java
false
false
15,667
java
/* * This file was automatically generated by EvoSuite * Thu Oct 21 09:54:06 GMT 2021 */ package org.apache.commons.math3.optim.nonlinear.scalar.noderiv; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.runtime.EvoAssertions.*; import java.util.List; import org.apache.commons.math3.linear.RealMatrix; import org.apache.commons.math3.optim.ConvergenceChecker; import org.apache.commons.math3.optim.InitialGuess; import org.apache.commons.math3.optim.OptimizationData; import org.apache.commons.math3.optim.PointValuePair; import org.apache.commons.math3.optim.SimpleBounds; import org.apache.commons.math3.optim.SimplePointChecker; import org.apache.commons.math3.optim.SimpleValueChecker; import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer; import org.apache.commons.math3.random.Well19937a; import org.apache.commons.math3.random.Well19937c; import org.apache.commons.math3.random.Well44497a; import org.apache.commons.math3.random.Well44497b; import org.apache.commons.math3.random.Well512a; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) public class CMAESOptimizer_ESTest extends CMAESOptimizer_ESTest_scaffolding { @Test(timeout = 4000) public void test00() throws Throwable { Well44497b well44497b0 = new Well44497b(); SimpleValueChecker simpleValueChecker0 = new SimpleValueChecker(1912.0, Double.POSITIVE_INFINITY); CMAESOptimizer cMAESOptimizer0 = new CMAESOptimizer(2144737505, 112.2, false, 2144737505, 2144737505, well44497b0, false, simpleValueChecker0); double[] doubleArray0 = new double[5]; doubleArray0[0] = Double.POSITIVE_INFINITY; CMAESOptimizer.Sigma cMAESOptimizer_Sigma0 = new CMAESOptimizer.Sigma(doubleArray0); SimpleBounds simpleBounds0 = new SimpleBounds(doubleArray0, doubleArray0); InitialGuess initialGuess0 = new InitialGuess(doubleArray0); OptimizationData[] optimizationDataArray0 = new OptimizationData[8]; optimizationDataArray0[0] = (OptimizationData) simpleBounds0; optimizationDataArray0[2] = (OptimizationData) initialGuess0; optimizationDataArray0[6] = (OptimizationData) cMAESOptimizer_Sigma0; // Undeclared exception! // try { cMAESOptimizer0.optimize(optimizationDataArray0); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer", e); // } } @Test(timeout = 4000) public void test01() throws Throwable { double[] doubleArray0 = new double[0]; CMAESOptimizer.Sigma cMAESOptimizer_Sigma0 = new CMAESOptimizer.Sigma(doubleArray0); Well44497a well44497a0 = new Well44497a(4); SimpleValueChecker simpleValueChecker0 = new SimpleValueChecker((-1918.54304956), (-1918.54304956)); CMAESOptimizer cMAESOptimizer0 = new CMAESOptimizer(4, 4, false, 4, 4, well44497a0, false, simpleValueChecker0); double[] doubleArray1 = new double[6]; InitialGuess initialGuess0 = new InitialGuess(doubleArray1); OptimizationData[] optimizationDataArray0 = new OptimizationData[8]; optimizationDataArray0[1] = (OptimizationData) initialGuess0; optimizationDataArray0[2] = (OptimizationData) cMAESOptimizer_Sigma0; // Undeclared exception! // try { cMAESOptimizer0.parseOptimizationData(optimizationDataArray0); // fail("Expecting exception: IllegalArgumentException"); // } catch(IllegalArgumentException e) { // // // // 0 != 6 // // // verifyException("org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer", e); // } } @Test(timeout = 4000) public void test02() throws Throwable { CMAESOptimizer.PopulationSize cMAESOptimizer_PopulationSize0 = null; // try { cMAESOptimizer_PopulationSize0 = new CMAESOptimizer.PopulationSize(0); // fail("Expecting exception: IllegalArgumentException"); // } catch(IllegalArgumentException e) { // // // // 0 is smaller than, or equal to, the minimum (0) // // // verifyException("org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer$PopulationSize", e); // } } @Test(timeout = 4000) public void test03() throws Throwable { Well19937c well19937c0 = new Well19937c((int[]) null); SimpleValueChecker simpleValueChecker0 = new SimpleValueChecker(1.0, (-2265.662350678067), 508); CMAESOptimizer cMAESOptimizer0 = new CMAESOptimizer(857, 19937, false, 19937, (-2203), well19937c0, false, simpleValueChecker0); OptimizationData[] optimizationDataArray0 = new OptimizationData[8]; double[] doubleArray0 = new double[3]; CMAESOptimizer.Sigma cMAESOptimizer_Sigma0 = new CMAESOptimizer.Sigma(doubleArray0); optimizationDataArray0[5] = (OptimizationData) cMAESOptimizer_Sigma0; // Undeclared exception! // try { cMAESOptimizer0.parseOptimizationData(optimizationDataArray0); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer", e); // } } @Test(timeout = 4000) public void test04() throws Throwable { Well19937c well19937c0 = new Well19937c((long) 0); SimplePointChecker<PointValuePair> simplePointChecker0 = new SimplePointChecker<PointValuePair>(0.0, (-350)); CMAESOptimizer cMAESOptimizer0 = new CMAESOptimizer(481, 0.0, false, (-350), (-350), well19937c0, false, simplePointChecker0); OptimizationData[] optimizationDataArray0 = new OptimizationData[8]; double[] doubleArray0 = new double[8]; InitialGuess initialGuess0 = new InitialGuess(doubleArray0); optimizationDataArray0[0] = (OptimizationData) initialGuess0; SimpleBounds simpleBounds0 = SimpleBounds.unbounded(0); optimizationDataArray0[1] = (OptimizationData) simpleBounds0; // try { cMAESOptimizer0.optimize(optimizationDataArray0); // fail("Expecting exception: IllegalArgumentException"); // } catch(IllegalArgumentException e) { // // // // 0 != 8 // // // verifyException("org.apache.commons.math3.optim.BaseMultivariateOptimizer", e); // } } @Test(timeout = 4000) public void test05() throws Throwable { Well19937a well19937a0 = new Well19937a(0L); SimpleValueChecker simpleValueChecker0 = new SimpleValueChecker(0.0, 1300, 1300); CMAESOptimizer cMAESOptimizer0 = new CMAESOptimizer(8, 1110.94738549, false, (-1858), 2, well19937a0, true, simpleValueChecker0); // Undeclared exception! // try { cMAESOptimizer0.doOptimize(); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer", e); // } } @Test(timeout = 4000) public void test06() throws Throwable { double[] doubleArray0 = new double[3]; CMAESOptimizer.Sigma cMAESOptimizer_Sigma0 = new CMAESOptimizer.Sigma(doubleArray0); double[] doubleArray1 = cMAESOptimizer_Sigma0.getSigma(); assertEquals(3, doubleArray1.length); } @Test(timeout = 4000) public void test07() throws Throwable { Well44497b well44497b0 = new Well44497b(); SimpleValueChecker simpleValueChecker0 = new SimpleValueChecker(1912.0, Double.POSITIVE_INFINITY); CMAESOptimizer cMAESOptimizer0 = new CMAESOptimizer(2144737505, 112.2, false, 2144737505, 2144737505, well44497b0, false, simpleValueChecker0); double[] doubleArray0 = new double[5]; doubleArray0[1] = 738.75782754; CMAESOptimizer.Sigma cMAESOptimizer_Sigma0 = new CMAESOptimizer.Sigma(doubleArray0); SimpleBounds simpleBounds0 = new SimpleBounds(doubleArray0, doubleArray0); InitialGuess initialGuess0 = new InitialGuess(doubleArray0); OptimizationData[] optimizationDataArray0 = new OptimizationData[8]; optimizationDataArray0[0] = (OptimizationData) simpleBounds0; optimizationDataArray0[2] = (OptimizationData) initialGuess0; optimizationDataArray0[6] = (OptimizationData) cMAESOptimizer_Sigma0; // Undeclared exception! // try { cMAESOptimizer0.optimize(optimizationDataArray0); // fail("Expecting exception: IllegalArgumentException"); // } catch(IllegalArgumentException e) { // // // // 738.758 out of [0, 0] range // // // verifyException("org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer", e); // } } @Test(timeout = 4000) public void test08() throws Throwable { double[] doubleArray0 = new double[0]; CMAESOptimizer.Sigma cMAESOptimizer_Sigma0 = new CMAESOptimizer.Sigma(doubleArray0); Well44497a well44497a0 = new Well44497a(4); SimpleValueChecker simpleValueChecker0 = new SimpleValueChecker((-1918.54304956), (-1918.54304956)); CMAESOptimizer cMAESOptimizer0 = new CMAESOptimizer(4, 4, false, 4, 4, well44497a0, false, simpleValueChecker0); OptimizationData[] optimizationDataArray0 = new OptimizationData[3]; optimizationDataArray0[0] = (OptimizationData) cMAESOptimizer_Sigma0; InitialGuess initialGuess0 = new InitialGuess(doubleArray0); optimizationDataArray0[2] = (OptimizationData) initialGuess0; cMAESOptimizer0.parseOptimizationData(optimizationDataArray0); assertNull(cMAESOptimizer0.getGoalType()); } @Test(timeout = 4000) public void test09() throws Throwable { double[] doubleArray0 = new double[0]; Well44497a well44497a0 = new Well44497a(15); SimpleValueChecker simpleValueChecker0 = new SimpleValueChecker(464.01087054529, (-1243.4599840399), 1003); CMAESOptimizer cMAESOptimizer0 = new CMAESOptimizer(1003, 0.0, false, (-1336), 3093, well44497a0, true, simpleValueChecker0); double[] doubleArray1 = new double[5]; CMAESOptimizer.Sigma cMAESOptimizer_Sigma0 = new CMAESOptimizer.Sigma(doubleArray1); InitialGuess initialGuess0 = new InitialGuess(doubleArray0); OptimizationData[] optimizationDataArray0 = new OptimizationData[6]; optimizationDataArray0[0] = (OptimizationData) initialGuess0; optimizationDataArray0[1] = (OptimizationData) cMAESOptimizer_Sigma0; // Undeclared exception! // try { cMAESOptimizer0.parseOptimizationData(optimizationDataArray0); // fail("Expecting exception: IllegalArgumentException"); // } catch(IllegalArgumentException e) { // // // // 5 != 0 // // // verifyException("org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer", e); // } } @Test(timeout = 4000) public void test10() throws Throwable { Well19937c well19937c0 = new Well19937c(10); SimpleValueChecker simpleValueChecker0 = new SimpleValueChecker(1, 1); CMAESOptimizer cMAESOptimizer0 = new CMAESOptimizer(10, 10, true, 1, 10, well19937c0, true, simpleValueChecker0); CMAESOptimizer.PopulationSize cMAESOptimizer_PopulationSize0 = new CMAESOptimizer.PopulationSize(10); OptimizationData[] optimizationDataArray0 = new OptimizationData[8]; optimizationDataArray0[0] = (OptimizationData) cMAESOptimizer_PopulationSize0; // Undeclared exception! // try { cMAESOptimizer0.optimize(optimizationDataArray0); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer", e); // } } @Test(timeout = 4000) public void test11() throws Throwable { CMAESOptimizer.PopulationSize cMAESOptimizer_PopulationSize0 = null; // try { cMAESOptimizer_PopulationSize0 = new CMAESOptimizer.PopulationSize((-3149)); // fail("Expecting exception: IllegalArgumentException"); // } catch(IllegalArgumentException e) { // // // // -3,149 is smaller than, or equal to, the minimum (0) // // // verifyException("org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer$PopulationSize", e); // } } @Test(timeout = 4000) public void test12() throws Throwable { double[] doubleArray0 = new double[4]; doubleArray0[2] = (-1333.846334015338); CMAESOptimizer.Sigma cMAESOptimizer_Sigma0 = null; // try { cMAESOptimizer_Sigma0 = new CMAESOptimizer.Sigma(doubleArray0); // fail("Expecting exception: IllegalArgumentException"); // } catch(IllegalArgumentException e) { // // // // -1,333.846 is smaller than the minimum (0) // // // verifyException("org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer$Sigma", e); // } } @Test(timeout = 4000) public void test13() throws Throwable { Well44497a well44497a0 = new Well44497a(4); SimpleValueChecker simpleValueChecker0 = new SimpleValueChecker((-1918.54304956), (-1918.54304956)); CMAESOptimizer cMAESOptimizer0 = new CMAESOptimizer(4, 4, false, 4, 4, well44497a0, false, simpleValueChecker0); List<RealMatrix> list0 = cMAESOptimizer0.getStatisticsMeanHistory(); assertEquals(0, list0.size()); } @Test(timeout = 4000) public void test14() throws Throwable { Well19937c well19937c0 = new Well19937c(10); SimpleValueChecker simpleValueChecker0 = new SimpleValueChecker(1, 1); CMAESOptimizer cMAESOptimizer0 = new CMAESOptimizer(10, 10, true, 1, 10, well19937c0, true, simpleValueChecker0); List<Double> list0 = cMAESOptimizer0.getStatisticsFitnessHistory(); assertEquals(0, list0.size()); } @Test(timeout = 4000) public void test15() throws Throwable { Well512a well512a0 = new Well512a((-1727483681)); CMAESOptimizer cMAESOptimizer0 = new CMAESOptimizer((-1124), 1.0E14, false, (-1727483681), 0, well512a0, true, (ConvergenceChecker<PointValuePair>) null); List<RealMatrix> list0 = cMAESOptimizer0.getStatisticsDHistory(); assertEquals(0, list0.size()); } @Test(timeout = 4000) public void test16() throws Throwable { Well19937c well19937c0 = new Well19937c(10); SimpleValueChecker simpleValueChecker0 = new SimpleValueChecker(1, 1); CMAESOptimizer cMAESOptimizer0 = new CMAESOptimizer(10, 10, true, 1, 10, well19937c0, true, simpleValueChecker0); List<Double> list0 = cMAESOptimizer0.getStatisticsSigmaHistory(); assertEquals(0, list0.size()); } @Test(timeout = 4000) public void test17() throws Throwable { CMAESOptimizer.PopulationSize cMAESOptimizer_PopulationSize0 = new CMAESOptimizer.PopulationSize(10); int int0 = cMAESOptimizer_PopulationSize0.getPopulationSize(); assertEquals(10, int0); } }
72b8989ff50ea265f6c6f34d067e0b2deae86fce
238d89f2c469b32986be45db254493a53f0d3a1b
/spring-boot-self/src/main/java/com/spring/boot/order/handler/HandlerType.java
6ff4af0a596384f2ba9a3d0631a685e15f8efaee
[ "Apache-2.0" ]
permissive
dongzl/spring-book-code
f4f11747f6cf16d89102ea36b1482e0d78c27d19
9afbea0e5aad155fc23a631f2d989687c40b4247
refs/heads/master
2022-12-24T18:06:35.409066
2020-12-12T04:35:35
2020-12-12T04:35:35
176,476,679
0
1
Apache-2.0
2022-12-16T04:59:18
2019-03-19T09:37:14
Java
UTF-8
Java
false
false
496
java
package com.spring.boot.order.handler; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * @author dongzonglei * @description * @date 2019-09-14 17:52 */ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited public @interface HandlerType { String value(); }
7364bb13a89a9e3c515b88c1b64d5f106fa4d9bf
e7ee311e20b40c87bf6d23a53a1d7b11fd29d2c3
/src/chosun/ciis/mc/cost/ds/MC_COST_3009_DDataSet.java
d3ed41317c71d06ddc2756c7e268a133c29bc6a0
[]
no_license
nosmoon/misdevteam
4e3695ef7bbdcd231bb84d7d8d7df54a23ff0a60
1829d5bd489eb6dd307ca244f0e183a31a1de773
refs/heads/master
2020-04-15T15:57:05.480056
2019-01-10T01:12:01
2019-01-10T01:12:01
164,812,547
1
0
null
null
null
null
UHC
Java
false
false
2,687
java
/*************************************************************************************************** * 파일명 : .java * 기능 : 독자우대-구독신청 * 작성일자 : 2007-05-22 * 작성자 : 김대섭 ***************************************************************************************************/ /*************************************************************************************************** * 수정내역 : * 수정자 : * 수정일자 : * 백업 : ***************************************************************************************************/ package chosun.ciis.mc.cost.ds; import java.sql.*; import java.util.*; import somo.framework.db.*; import somo.framework.util.*; import chosun.ciis.mc.cost.dm.*; import chosun.ciis.mc.cost.rec.*; /** * */ public class MC_COST_3009_DDataSet extends somo.framework.db.BaseDataSet implements java.io.Serializable{ public String errcode; public String errmsg; public MC_COST_3009_DDataSet(){} public MC_COST_3009_DDataSet(String errcode, String errmsg){ this.errcode = errcode; this.errmsg = errmsg; } public void setErrcode(String errcode){ this.errcode = errcode; } public void setErrmsg(String errmsg){ this.errmsg = errmsg; } public String getErrcode(){ return this.errcode; } public String getErrmsg(){ return this.errmsg; } public void getValues(CallableStatement cstmt) throws SQLException{ this.errcode = Util.checkString(cstmt.getString(1)); this.errmsg = Util.checkString(cstmt.getString(2)); } }/*---------------------------------------------------------------------------------------------------- Web Tier에서 DataSet 객체 관련 코드 작성시 사용하십시오. <% MC_COST_3009_DDataSet ds = (MC_COST_3009_DDataSet)request.getAttribute("ds"); %> Web Tier에서 Record 객체 관련 코드 작성시 사용하십시오. ----------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------- Web Tier에서 DataSet 객체의 <%= %> 작성시 사용하십시오. <%= ds.getErrcode()%> <%= ds.getErrmsg()%> ----------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------- Web Tier에서 Record 객체의 <%= %> 작성시 사용하십시오. ----------------------------------------------------------------------------------------------------*/ /* 작성시간 : Fri May 08 15:44:43 KST 2009 */
fc373ca20840b1b637742dec8945c2dd6bcee507
68f5416f9430d9b78955c777fa6213e85432cb01
/javacourse181112/src/main/java/com/musala/javacourse181112/samples2/classes/methods/OtherClass.java
6f52d8b643dc927790017badb3556929dd268714
[]
no_license
dgluharov/LearnFromTheMasters-Java
2c4d2398d03063ea1dfddebb5310bff1f22d0f6d
7efa710afc2c4c70b1c366e19d1d17beecb9b31d
refs/heads/master
2021-07-07T02:57:47.113128
2019-07-18T16:21:01
2019-07-18T16:21:01
197,141,964
0
0
null
2020-10-13T14:37:06
2019-07-16T07:20:40
Java
UTF-8
Java
false
false
325
java
package com.musala.javacourse181112.samples2.classes.methods; class OtherClass { public static void main(String[] args) { Car myCar = new Car(); // Create a myCar object myCar.fullThrottle(); // Call the fullThrottle() method myCar.speed(200); // Call the speed() method } }
dca9a17c6ca3ce69df44d096ee50b417e7256c41
538eff5bdecd56f8452ab00f3db9a0041167ed37
/zadanie4/src/calculations/BinaryArg.java
a91124f827b05f0359ea6a2f18e76bd68a7ddb05
[]
no_license
anadabrowska/Java-course
e6ff0cab61499eb24e00c91701ab6f74eedb08c7
71d1239522c0f3078ea9b9e505b693a3791800e1
refs/heads/master
2020-04-13T19:31:20.086087
2018-12-28T12:07:29
2018-12-28T12:07:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
899
java
package calculations; import java.util.Objects; /** * klasa abstarakcyna dla wyrażeń dwuargumentowych */ public abstract class BinaryArg extends UnaryArg { protected final Expression right; /** * konstruktor klasy BianryArg * @param left lewe podwyrażenie * @param right prawe podwyrażenie */ protected BinaryArg(Expression left, Expression right){ super(left); this.right = right; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; BinaryArg binaryArg = (BinaryArg) o; return (Objects.equals(right, binaryArg.right) && Objects.equals(left,binaryArg.left)); } @Override public int hashCode() { return Objects.hash(super.hashCode(), right); } }
981b63bcf1aff58e634e16aedbc40122867d9ce1
ce475da64dae02b3aa228e81fcb7064880802553
/src/Inventory.java
1ea83ea15b9018ec568270f5d7d841b3534b7ab8
[]
no_license
BoraBener35/Bora-s-Game
8e89793642fd311643037065f0b682ca18cff32e
53b561b46609079b6d2c7e0d13b0e424b9614faf
refs/heads/main
2023-02-20T03:17:51.308677
2021-01-14T14:36:07
2021-01-14T14:36:07
326,696,774
0
0
null
null
null
null
UTF-8
Java
false
false
825
java
import java.util.ArrayList; public class Inventory { private ArrayList<Item> items; public Inventory(){ items = new ArrayList<Item>(); } public boolean addItem(Item item){ return items.add(item); } public Item removeItem(String name){ for (int i = 0; i<items.size(); i++){ if (name.equals(items.get(i).getName())){ return items.remove(i); } } return null; } public String toString(){ String msg = ""; for (Item i : items){ msg += i.getName() + "\n"; } return msg; } public Item contains(String itemName) { for(Item i : items){ if (i.getName().equalsIgnoreCase(itemName)){ return i; } } return null; } public int size() { return items.size(); } }
2bff81e773c6df44d7aebbbd9ff6cef2abc17152
1516f3d9b6d5b9f04800dfb2e74fbb82c593fcbc
/model/api/src/main/java/org/keycloak/migration/migrators/MigrateTo1_6_0.java
80105861975724e511f25d80be313b95d9f0fde1
[ "Apache-2.0" ]
permissive
eugene-chow/keycloak
6817603a2c5575cb4b0d1eee04e9b0ff952049d4
ec018d27399a292b352aed6e828b33029e65b417
refs/heads/master
2021-01-22T12:37:29.261882
2015-09-29T02:32:16
2015-09-29T02:32:16
43,339,974
0
0
null
2015-09-29T02:28:00
2015-09-29T02:27:57
null
UTF-8
Java
false
false
663
java
package org.keycloak.migration.migrators; import java.util.List; import org.keycloak.migration.ModelVersion; import org.keycloak.models.KeycloakSession; import org.keycloak.models.RealmModel; import org.keycloak.models.utils.KeycloakModelUtils; /** * @author <a href="mailto:[email protected]">Marek Posolda</a> */ public class MigrateTo1_6_0 { public static final ModelVersion VERSION = new ModelVersion("1.6.0"); public void migrate(KeycloakSession session) { List<RealmModel> realms = session.realms().getRealms(); for (RealmModel realm : realms) { KeycloakModelUtils.setupOfflineTokens(realm); } } }
ba67c38a634985f22e6d49d21555a7ae7a305468
30debfb588d3df553019a29d761f53698564e8c8
/modules/adwords_axis/src/main/java/com/google/api/ads/adwords/axis/v201609/cm/DisplayAttribute.java
ed32a3952be01d6d84305d91b20397304f67c3ba
[ "Apache-2.0" ]
permissive
jinhyeong/googleads-java-lib
8f7a5b9cad5189e45b5ddcdc215bbb4776b614f9
872c39ba20f30f7e52d3d4c789a1c5cbefaf80fc
refs/heads/master
2021-01-19T09:35:38.933267
2017-04-03T14:12:43
2017-04-03T14:12:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,532
java
// Copyright 2016 Google Inc. 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. // 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. /** * DisplayAttribute.java * * This file was auto-generated from WSDL * by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter. */ package com.google.api.ads.adwords.axis.v201609.cm; /** * Attributes for Text Labels. */ public class DisplayAttribute extends com.google.api.ads.adwords.axis.v201609.cm.LabelAttribute implements java.io.Serializable { /* Background color of the label in RGB format. * <span class="constraint MatchesRegex">A background * color string must begin with a '#' character followed by either 6 * or 3 hexadecimal characters (24 vs. 12 bits). This is checked by the * regular expression '^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$'.</span> */ private java.lang.String backgroundColor; /* A short description of the label. * <span class="constraint StringLength">The length * of this string should be between 0 and 200, inclusive.</span> */ private java.lang.String description; public DisplayAttribute() { } public DisplayAttribute( java.lang.String labelAttributeType, java.lang.String backgroundColor, java.lang.String description) { super( labelAttributeType); this.backgroundColor = backgroundColor; this.description = description; } /** * Gets the backgroundColor value for this DisplayAttribute. * * @return backgroundColor * Background color of the label in RGB format. * <span class="constraint MatchesRegex">A background * color string must begin with a '#' character followed by either 6 * or 3 hexadecimal characters (24 vs. 12 bits). This is checked by the * regular expression '^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$'.</span> */ public java.lang.String getBackgroundColor() { return backgroundColor; } /** * Sets the backgroundColor value for this DisplayAttribute. * * @param backgroundColor * Background color of the label in RGB format. * <span class="constraint MatchesRegex">A background * color string must begin with a '#' character followed by either 6 * or 3 hexadecimal characters (24 vs. 12 bits). This is checked by the * regular expression '^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$'.</span> */ public void setBackgroundColor(java.lang.String backgroundColor) { this.backgroundColor = backgroundColor; } /** * Gets the description value for this DisplayAttribute. * * @return description * A short description of the label. * <span class="constraint StringLength">The length * of this string should be between 0 and 200, inclusive.</span> */ public java.lang.String getDescription() { return description; } /** * Sets the description value for this DisplayAttribute. * * @param description * A short description of the label. * <span class="constraint StringLength">The length * of this string should be between 0 and 200, inclusive.</span> */ public void setDescription(java.lang.String description) { this.description = description; } private java.lang.Object __equalsCalc = null; public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof DisplayAttribute)) return false; DisplayAttribute other = (DisplayAttribute) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = super.equals(obj) && ((this.backgroundColor==null && other.getBackgroundColor()==null) || (this.backgroundColor!=null && this.backgroundColor.equals(other.getBackgroundColor()))) && ((this.description==null && other.getDescription()==null) || (this.description!=null && this.description.equals(other.getDescription()))); __equalsCalc = null; return _equals; } private boolean __hashCodeCalc = false; public synchronized int hashCode() { if (__hashCodeCalc) { return 0; } __hashCodeCalc = true; int _hashCode = super.hashCode(); if (getBackgroundColor() != null) { _hashCode += getBackgroundColor().hashCode(); } if (getDescription() != null) { _hashCode += getDescription().hashCode(); } __hashCodeCalc = false; return _hashCode; } // Type metadata private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(DisplayAttribute.class, true); static { typeDesc.setXmlType(new javax.xml.namespace.QName("https://adwords.google.com/api/adwords/cm/v201609", "DisplayAttribute")); org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("backgroundColor"); elemField.setXmlName(new javax.xml.namespace.QName("https://adwords.google.com/api/adwords/cm/v201609", "backgroundColor")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("description"); elemField.setXmlName(new javax.xml.namespace.QName("https://adwords.google.com/api/adwords/cm/v201609", "description")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); } /** * Return type metadata object */ public static org.apache.axis.description.TypeDesc getTypeDesc() { return typeDesc; } /** * Get Custom Serializer */ public static org.apache.axis.encoding.Serializer getSerializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanSerializer( _javaType, _xmlType, typeDesc); } /** * Get Custom Deserializer */ public static org.apache.axis.encoding.Deserializer getDeserializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanDeserializer( _javaType, _xmlType, typeDesc); } }
140b10448395d2106d9d99c0ad4d9962d285d892
732ead5d3f74bff55b9a2a9e124593bd3ede8031
/data structure (java)/searchTarget2/Search.java
0713ffa590bcae7fd477d0543dcde82a022dd093
[]
no_license
mekuanent24/course-works
2b91a872a4258ede1261a5c0370055bfc611aa75
cd4b8cdf3f0eace28297c55b111e0e32093ee170
refs/heads/master
2020-03-31T19:28:06.267691
2018-03-02T06:59:16
2018-03-02T06:59:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,954
java
/* * Search.java * reads in a file from the command line to search for 'target' words * entered in as ars[1]...args[n]. Uses mergeSort and binarySearch * */ import java.io.*; import java.util.Scanner; public class Search{ public static void main(String[] args) throws IOException{ Scanner fileInput = null; String line = null; String[] token = null; int numOfLines = 0; int[] lineNumber = null; if(args.length < 2){ System.err.println("Usage: Search infile target(1)...target(N)"); System.exit(1); } //while loop scans and counts the number of lines in the file fileInput = new Scanner(new File(args[0])); while( fileInput.hasNextLine() ){ numOfLines++; line = fileInput.nextLine(); System.out.println("line: "+ line ); } //intialize's the length of the String and int array token = new String[numOfLines]; lineNumber = new int[numOfLines]; fileInput = new Scanner(new File(args[0]));//re-scans the file //adds number to the array for(int i=1; i<=lineNumber.length; i++){ lineNumber[i-1] = i; } //Scans the file, putting the word in the String array for(int i =0; fileInput.hasNextLine(); i++){ line = fileInput.nextLine(); token[i] = line; } //puts the string Array in order (z->a) mergeSort(token,lineNumber, 0, token.length-1); //prints if the target is found and on what line for(int i=1; i<args.length; i++){ System.out.println( binarySearch(token, lineNumber, 0, token.length-1, args[i])); } fileInput.close(); } //mergeSort //Pre: takes two Arrays, along with two integers p and r. // p and r >= 0 && < the length of the Array static void mergeSort(String[] word, int[] lineNumber, int p, int r){ int q; if(p<r){ q = (p+r)/2; mergeSort(word, lineNumber, p, q); mergeSort(word, lineNumber, q+1, r); merge(word, lineNumber, p, q, r); } } //merge //Pre: takes two Arrays, along with two integers p and r. // that are given from mergeSort //Pos: changes the order of the Array putting them in lexical order static void merge(String[] word, int[] lineNumber, int p, int q, int r){ int n1 = q-p+1; int n2 = r-q; String[] left = new String[n1]; String[] right = new String[n2]; int[] leftNum = new int[n1]; int[] rightNum = new int[n2]; int i, j, k; for(i=0; i<n1; i++){ left[i] = word[p+i]; leftNum[i] = lineNumber[p+i]; } for(j=0; j<n2; j++){ right[j] = word[q+j+1]; rightNum[j] = lineNumber[q+j+1]; } i = 0; j = 0; for(k=p; k<=r; k++){ if( i<n1 && j<n2){ if( left[i].compareTo(right[j])>0 ){ word[k] = left[i]; lineNumber[k] = leftNum[i]; i++; } else{ word[k] = right[j]; lineNumber[k] = rightNum[j]; j++; } } else if( i<n1){ word[k] = left[i]; lineNumber[k] = leftNum[i]; i++; } else{ // j<n2 word[k] = right[j]; lineNumber[k] = rightNum[j]; j++; } } } //binarySearch //Pre: takes two Arrays, a target, along with two integers p and r. // p and r must be >= 0 && < the length of the Array //Pos: returns a string with the word and line it was found on public static String binarySearch(String[] word, int[] lineNumber, int p, int r, String target){ int q; if( p == r ){ return target + " not found"; } else{ q = (p+r)/2; if( word[q].compareTo(target) == 0){ return target + " found on line " + lineNumber[q]; } else if( word[q].compareTo(target)<0 ) { return binarySearch(word, lineNumber, p, q, target); } else{ return binarySearch(word, lineNumber, q+1, r, target); } } } }
f1b984cbf547099d3ae3d9b7d808239429df08b9
888843e3abb6d191096e0da393d603d413538d24
/src/main/java/com/jsptestwar/JspTestWar/service/NotificationServiceImpl.java
bfb5ffdf5c4a2d95d317724144c62b6d18ee6334
[]
no_license
cemtkklc/myblog
e8977002abf89b2744942a40771e63d639bdaddc
6218683a80a570100211509472b9455aa6c1af72
refs/heads/master
2020-03-25T18:17:28.010983
2019-06-23T10:41:45
2019-06-23T10:41:45
144,022,597
0
0
null
null
null
null
UTF-8
Java
false
false
1,654
java
package com.jsptestwar.JspTestWar.service; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class NotificationServiceImpl implements NotificationService { public static final String NOTIFY_MSG_SESSION_KEY ="notificationMessage"; @Autowired private HttpSession httpSession; @Override public void addInfoMessage(String msg) { addNotificationMessage(NotificationMessageType.INFO, msg); } @Override public void addErrorMessage(String msg) { addNotificationMessage(NotificationMessageType.ERROR, msg); } private void addNotificationMessage(NotificationMessageType type, String msg) { Object listMessage = httpSession.getAttribute(NOTIFY_MSG_SESSION_KEY); List<NotificationMessage> notifyList = (List<NotificationMessage>) listMessage; if(notifyList==null) { notifyList = new ArrayList<NotificationMessage>(); } notifyList.add(new NotificationMessage(type, msg)); httpSession.setAttribute(NOTIFY_MSG_SESSION_KEY, notifyList); } public enum NotificationMessageType{ INFO, ERROR } public class NotificationMessage{ NotificationMessageType type; String msg; public NotificationMessage(NotificationMessageType type, String msg) { this.type = type; this.msg =msg; } public NotificationMessageType getType() { return type; } public void setType(NotificationMessageType type) { this.type = type; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } } }
34f0be54b7eb4fbdb988bcbb0c734dab47202632
c45cabd20376cd8a29f3169bb6e98f101026828e
/SampleDemo/FallDetect/mobile/src/test/java/com/njupt/dezhou/falldetect/ExampleUnitTest.java
b63fb03a676f65d464fe32f8a56e30de0d3a2bcd
[]
no_license
2499603447/AndroidProjects
012d7db8751c84483ceb087dae3ef24404d2ccd1
10f9afe7b3ae7ad729a97ba29d7d2e8cbb25ac31
refs/heads/master
2020-03-21T11:55:59.148437
2018-06-25T02:58:24
2018-06-25T02:58:24
138,527,158
0
0
null
null
null
null
UTF-8
Java
false
false
388
java
package com.njupt.dezhou.falldetect; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
62f4897a1fc3a3038d1340d0b41c92b3b9233f52
ed3cb95dcc590e98d09117ea0b4768df18e8f99e
/project_1_2/src/c/c/c/Calc_1_2_2227.java
7591318757e596fb2af9d62f025de54af4b5f886
[]
no_license
chalstrick/bigRepo1
ac7fd5785d475b3c38f1328e370ba9a85a751cff
dad1852eef66fcec200df10083959c674fdcc55d
refs/heads/master
2016-08-11T17:59:16.079541
2015-12-18T14:26:49
2015-12-18T14:26:49
48,244,030
0
0
null
null
null
null
UTF-8
Java
false
false
131
java
package c.c.c; public class Calc_1_2_2227 { /** @return the sum of a and b */ public int add(int a, int b) { return a+b; } }
e55eee58e573beed8b23e3b30df3b712a643d4fa
900090e2b1511cc7b7a58ce146dc8a78f8c96cbf
/app/src/main/java/com/example/rifqi12rpl012018/modelAdmin.java
346d9cc0ecc4c83570013888a505505ec1b8e979
[]
no_license
rifqi10/Rifqi12RPL012018
580ed14532368ce388af39164da671e8627a492a
8e42456baa0f1e98e1c920c56881f1383f2802f9
refs/heads/master
2023-01-23T03:40:41.292344
2020-12-04T07:11:03
2020-12-04T07:11:03
281,985,455
0
0
null
null
null
null
UTF-8
Java
false
false
2,137
java
package com.example.rifqi12rpl012018; import android.os.Parcel; import android.os.Parcelable; public class modelAdmin implements Parcelable { private String id; private String nama; private String nohp; private String email; private String alamat; private String noktp; protected modelAdmin(Parcel in) { id = in.readString(); nama = in.readString(); nohp = in.readString(); email = in.readString(); noktp = in.readString(); alamat = in.readString(); } public static final Creator<modelAdmin> CREATOR = new Creator<modelAdmin>() { @Override public modelAdmin createFromParcel(Parcel in) { return new modelAdmin(in); } @Override public modelAdmin[] newArray(int size) { return new modelAdmin[size]; } }; public modelAdmin() { } public String getAlamat() { return alamat; } public void setAlamat(String alamat) { this.alamat = alamat; } public String getNoktp() { return noktp; } public void setNoktp(String noktp) { this.noktp = noktp; } public static Creator<modelAdmin> getCREATOR() { return CREATOR; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getNama() { return nama; } public void setNama(String nama) { this.nama = nama; } public String getNohp() { return nohp; } public void setNohp(String nohp) { this.nohp = nohp; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel parcel, int i) { parcel.writeString(id); parcel.writeString(nama); parcel.writeString(nohp); parcel.writeString(email); parcel.writeString(noktp); parcel.writeString(alamat); } }
f184ed5e404a6058215f51e20569f3518e236948
2b438c607ca0b2ee575eec4752cc7c5c7792f4cc
/opencart-rest/src/main/java/com/cherkashyn/vitalii/computer_shop/opencart/domain/CategoryToLayout.java
08dc30c652205b19a79945408d08f63d4dda01f9
[]
no_license
cherkavi/java-code-example
a94a4c5eebd6fb20274dc4852c13e7e8779a7570
9c640b7a64e64290df0b4a6820747a7c6b87ae6d
refs/heads/master
2023-02-08T09:03:37.056639
2023-02-06T15:18:21
2023-02-06T15:18:21
197,267,286
0
4
null
2022-12-15T23:57:37
2019-07-16T21:01:20
Java
UTF-8
Java
false
false
1,279
java
package com.cherkashyn.vitalii.computer_shop.opencart.domain; // Generated Sep 27, 2013 3:55:56 AM by Hibernate Tools 3.4.0.CR1 import javax.persistence.AttributeOverride; import javax.persistence.AttributeOverrides; import javax.persistence.Column; import javax.persistence.EmbeddedId; import javax.persistence.Entity; import javax.persistence.Table; /** * OcCategoryToLayout generated by hbm2java */ @Entity @Table(name = "oc_category_to_layout", catalog = "opencart") public class CategoryToLayout implements java.io.Serializable { private CategoryToLayoutId id; private int layoutId; public CategoryToLayout() { } public CategoryToLayout(CategoryToLayoutId id, int layoutId) { this.id = id; this.layoutId = layoutId; } @EmbeddedId @AttributeOverrides({ @AttributeOverride(name = "categoryId", column = @Column(name = "category_id", nullable = false)), @AttributeOverride(name = "storeId", column = @Column(name = "store_id", nullable = false)) }) public CategoryToLayoutId getId() { return this.id; } public void setId(CategoryToLayoutId id) { this.id = id; } @Column(name = "layout_id", nullable = false) public int getLayoutId() { return this.layoutId; } public void setLayoutId(int layoutId) { this.layoutId = layoutId; } }
280842e8a748f7d4893dc34e89a3d162949d0e15
c657f39cd95fbffb8dcf26bb6a4391d8d9efff89
/src/java/com/resources/facade/StudyPromotionFacade.java
01153757caea68d8c92a284b6b55d0d781f3510b
[]
no_license
kuhuycoi/thienloc
2f04364defa264804fdfd79e418b18de3790ece0
4aed76d062e3c7d5163a90c2f91785bc9ded573e
refs/heads/master
2021-01-10T07:57:20.270766
2016-03-16T02:12:33
2016-03-16T02:12:33
48,844,287
0
0
null
null
null
null
UTF-8
Java
false
false
6,286
java
package com.resources.facade; import com.resources.entity.Module; import com.resources.entity.StudyPromotion; import com.resources.pagination.admin.DefaultAdminPagination; import com.resources.pagination.admin.HistoryPagination; import com.resources.utils.StringUtils; import java.math.BigDecimal; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import org.hibernate.Criteria; import org.hibernate.Hibernate; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.criterion.Disjunction; import org.hibernate.criterion.Order; import org.hibernate.criterion.Projections; import org.hibernate.criterion.Restrictions; import org.hibernate.transform.Transformers; public class StudyPromotionFacade extends AbstractFacade { public StudyPromotionFacade() { super(StudyPromotion.class); } public void pageData(HistoryPagination historyPagination) { Session session = null; try { session = HibernateConfiguration.getInstance().openSession(); if (session != null) { Criteria cr = session.createCriteria(StudyPromotion.class, "s"); cr.createAlias("s.customerStart", "cStart"); cr.createAlias("s.customerEnd", "cEnd"); List<String> listKeywords = historyPagination.getKeywords(); Disjunction disj = Restrictions.disjunction(); for (String k : listKeywords) { if (StringUtils.isEmpty(historyPagination.getSearchString())) { break; } disj.add(Restrictions.sqlRestriction("CAST(" + k + " AS VARCHAR) like '%" + historyPagination.getSearchString() + "%'")); } cr.add(disj); cr.setProjection(Projections.rowCount()); historyPagination.setTotalResult(((Long) cr.uniqueResult()).intValue()); cr.setProjection(Projections.projectionList() .add(Projections.property("id"), "id") .add(Projections.property("name"), "name") .add(Projections.property("cStart.userName"), "customerStart") .add(Projections.property("cEnd.userName"), "customerEnd") .add(Projections.property("totalMember"), "totalMember") .add(Projections.property("moneyperone"), "moneyperone") .add(Projections.property("moneypercircle"), "moneypercircle") .add(Projections.property("isActive"), "isActive")) .setResultTransformer(Transformers.aliasToBean(com.resources.bean.StudyPromotion.class)); cr.setFirstResult(historyPagination.getFirstResult()); cr.setMaxResults(historyPagination.getDisplayPerPage()); cr.addOrder(historyPagination.isAsc() ? Order.asc(historyPagination.getOrderColmn()) : Order.desc(historyPagination.getOrderColmn())); historyPagination.setDisplayList(cr.list()); } } catch (Exception e) { Logger.getLogger(Module.class.getName()).log(Level.SEVERE, null, e); Logger.getLogger(Module.class.getName()).log(Level.SEVERE, null, e); } finally { HibernateConfiguration.getInstance().closeSession(session); } } public int insertMemberPromotion(int cusStart, int cusEnd, String name, BigDecimal moneypercircle, BigDecimal totalMoney) throws Exception { Session session = null; Transaction trans = null; int rs = 0; try { session = HibernateConfiguration.getInstance().openSession(); if (session != null) { trans = session.beginTransaction(); Query q = session.createSQLQuery("insertMemberPromotion :cusStart,:cusEnd,:name,:totalMoney,:moneypercircle"); q.setParameter("cusStart", cusStart); q.setParameter("cusEnd", cusEnd); q.setParameter("name", name); q.setParameter("moneypercircle", moneypercircle); q.setParameter("totalMoney", totalMoney); rs = (Integer) q.uniqueResult(); trans.commit(); } } catch (Exception e) { if (trans != null) { trans.rollback(); } throw e; } finally { HibernateConfiguration.getInstance().closeSession(session); } return rs; } public int activeStudyPromotion(Integer id) throws Exception { Session session = null; Transaction trans = null; int rs = 0; try { session = HibernateConfiguration.getInstance().openSession(); if (session != null) { trans = session.beginTransaction(); Query q = session.createSQLQuery("Update StudyPromotion set isActive=case id " + "when :id then 1 " + "else 0 " + "end"); q.setParameter("id", id); rs=q.executeUpdate(); trans.commit(); } } catch (Exception e) { if (trans != null) { trans.rollback(); } throw e; } finally { HibernateConfiguration.getInstance().closeSession(session); } return rs; } @Override public StudyPromotion find(int id) { Session session = null; StudyPromotion obj = null; try { session = HibernateConfiguration.getInstance().openSession(); obj = (StudyPromotion) session.get(StudyPromotion.class, id); Hibernate.initialize(obj.getCustomerStart()); Hibernate.initialize(obj.getCustomerEnd()); } catch (Exception e) { Logger.getLogger(StudyPromotion.class.getName()).log(Level.SEVERE, null, e); } finally { HibernateConfiguration.getInstance().closeSession(session); } return obj; } @Override public void pageData(DefaultAdminPagination pagination) { } }
1f49dfd9c2b73f62fbd0f0f878b75cfb201a2feb
5fd0122ac80a720eda06bc829a6bcd8523512737
/app/src/main/java/com/lemuelinchrist/android/hymns/content/CopyButton.java
18bb76af6f374040c9ff851497bb0036975e4b7a
[ "Apache-2.0" ]
permissive
Rejeev/hymnsforandroid
d27271b340d56f411b311185473291533c7028c2
b6b6616a274a042f4cb33f682aad0d58cd2d13f4
refs/heads/master
2021-02-11T03:51:45.411685
2020-05-10T07:07:47
2020-05-10T07:07:47
244,450,630
0
0
Apache-2.0
2020-03-14T03:18:59
2020-03-02T18:57:43
TSQL
UTF-8
Java
false
false
1,587
java
package com.lemuelinchrist.android.hymns.content; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; import android.view.View; import android.widget.ImageButton; import android.widget.Toast; import androidx.fragment.app.Fragment; import com.lemuelinchrist.android.hymns.entities.Hymn; import com.lemuelinchrist.android.hymns.entities.Stanza; /** * @author Lemuel Cantos * @since 22/2/2020 */ public class CopyButton extends ContentComponent<ImageButton> { public CopyButton(final Hymn hymn, final Fragment parentFragment, ImageButton imageButton) { super(hymn, parentFragment, imageButton); imageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { StringBuilder lyric = new StringBuilder(); lyric.append(hymn.getHymnId() + "\n\n"); for(Stanza stanza:hymn.getStanzas()) { lyric.append(stanza.getNo() +"\n"); lyric.append(stanza.getText().replace("<br/>","\n")); lyric.append("\n"); } ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("Hymn lyrics", lyric.toString()); assert clipboard != null; clipboard.setPrimaryClip(clip); Toast.makeText(context, "Hymn text copied to Clipboard!", Toast.LENGTH_SHORT).show(); } }); } }
466d0846c83ac56b24d3856863eedc821c2e04cd
bac766c54372d81bdaccc2cb1f6bfd4182966511
/EvilCorp/src/Validator.java
50a67a81f493f571eba57eef627ceb4d1b36a2a4
[]
no_license
MeenuRaj/EvilCorp
3e3530eab14196f92e9b1371ce9ced9fc7c8e3b8
412fa18a6aeecc603d0c176bc8cc839b9b65d4ee
refs/heads/master
2021-01-23T20:50:45.996613
2015-08-13T18:32:31
2015-08-13T18:32:31
40,505,887
0
0
null
null
null
null
UTF-8
Java
false
false
1,327
java
import java.util.Scanner; public class Validator { public static String getString(Scanner scan, String prompt) { System.out.print(prompt); String s = scan.next(); scan.nextLine(); return s; } public static int getInt(Scanner scan, String prompt) { int i = 0; boolean isValid = false; while (isValid == false) { System.out.print(prompt); if (scan.hasNextInt()) { i = scan.nextInt(); isValid = true; } else { System.out.println("Error! Invalid integer value. Try Again "); } scan.nextLine(); } return i; } public static double getDouble(Scanner scan, String prompt) { double i = 0; boolean isValid = false; while (isValid == false) { System.out.print(prompt); if (scan.hasNextDouble()) { i = scan.nextDouble(); isValid = true; } else { System.out.println("Error! Invalid integer value. Try Again "); } scan.nextLine(); } return i; } public static int getInt(Scanner scan, String prompt, int min, int max) { int i = 0; boolean isValid = false; while (isValid == false) { i = getInt(scan, prompt); if (i <= min || i >= max) System.out.println("error! number must be greater than " + min + "."); else isValid = true; } return i; } }
ec6082ce401f5adc5c9f5bfbaea98793d6abd442
08d3f0b7bf8b78b12afa087d3ee59cf5cca15cfd
/src/main/java/operatorsExamples/Operators1.java
234aff953825faa626548367c84f2e29578d49d7
[]
no_license
sharmashipra2702/DemoRepository
9e2288af8c8035af5b69304360c68fdd96ca3fe0
87de6ddeafcce0e51a17ba88a62c6535deb2c8e0
refs/heads/master
2023-08-14T06:19:48.665457
2020-06-14T08:13:09
2020-06-14T08:13:09
193,360,663
0
0
null
2023-07-25T17:24:23
2019-06-23T14:52:53
Java
UTF-8
Java
false
false
412
java
package operatorsExamples; public class Operators1 { public static void main(String[] args) { // TODO Auto-generated method stub String s1 = "vishal"; String s2 = "vishal"; System.out.println("s1 == s2 is :"+ s1 == s2); /* in java + operator precedence is more than == operator. so this expression will be evaluated as "s1 == s2 is :vishal" == "vishal" so the answer will be false. */ } }
96b7c62829e0160d9469ff0d4a2ae01f1067d6c0
5d3b1ba6a87705a8097d6facedcb4bbb9c0d69f9
/src/client/src/com/guimonsters/client/test/CommandTest.java
2c894426e0dd8514b8e6f89dcf2f5c174dd57d89
[]
no_license
elijahatkinson/guimonsters
3adf32d7c11a6047e807d4d3cb353ea33bd78faa
d6906086c02cc0898b972e8bd2552fe640fa10a1
refs/heads/master
2020-12-30T11:52:19.474490
2017-05-17T06:58:47
2017-05-17T06:58:47
91,541,302
0
0
null
null
null
null
UTF-8
Java
false
false
4,980
java
package com.guimonsters.client.test; import static org.junit.Assert.*; import java.lang.reflect.*; import org.junit.Before; import org.junit.Test; import com.guimonsters.client.Command; /** * Tests the Command class. * @author Elijah Atkinson * @version 1.00, 2013-04-18 */ public class CommandTest { Object parent; Command c1; Command c2; Command c3; Command c4; Method m1; Method m2; Method m3; Method m4; int a; int b; int c; String alpha; String beta; String cappa; /** * This function runs before every test. * @throws java.lang.Exception */ @Before public void setUp() throws Exception { try { //Get methods from this test class to attach to commands. m1 = this.getClass().getMethod("m1"); m2 = this.getClass().getMethod("m2", String.class); m3 = this.getClass().getMethod("m3"); m4 = this.getClass().getMethod("m4", String.class); //These values will be used to test runs of a void method without parameters. a = 3; b = 4; c = 0; //These values will be used to test runs of a void method with parameters. alpha = "alpha"; beta = "beta"; cappa = ""; } catch (Exception e) { System.out.println("Setup failed!"); e.printStackTrace(); } } /** * Test method for {@link com.guimonsters.client.Command#Command(java.lang.Object, java.lang.String, java.lang.String, java.lang.String, java.lang.reflect.Method)}. */ @Test public void testCommand() { //Create a command object. String descr = "This is command 1."; String error = "Command 1 error message"; c1 = new Command(parent, "c1", descr, error, m2); //Test that command data members were initialized properly. assertEquals(parent, c1.getParent()); assertEquals("c1", c1.getName()); assertEquals(descr, c1.getDescription()); assertEquals(error, c1.getErrorMessage()); assertEquals(m2, c1.getMethod()); assertEquals(String.class, c1.getParamTypes()[0]); assertEquals(void.class, c1.getReturnType()); //Test setters Object newParent = new Object(); c1.setParent(newParent); assertEquals(newParent, c1.getParent()); c1.setName("Teddy tumblebum"); assertEquals("Teddy tumblebum", c1.getName()); c1.setDescription("This command has a long nose."); assertEquals("This command has a long nose.", c1.getDescription()); c1.setErrorMessage("New error message has been set"); assertEquals("New error message has been set", c1.getErrorMessage()); c1.setMethod(m3); assertEquals(m3, c1.getMethod()); } /** * Test method for {@link com.guimonsters.client.Command#execute(java.lang.String)}. */ @Test public void testExecute1() { //Create commands for each test method. c2 = new Command(this, "c2", "This is command 2.", "Error 2", m2); c4 = new Command(this, "c4", "This is command 4.", "Error 4", m4); //Store string results of command execution. String result = ""; //Test conditions of method m2 before execution. assertEquals("", cappa); //Executes method m2 with string parameter and no return type. c2.execute("gamma"); assertEquals("alphabetagamma", cappa); //Execute method m4 with string parameter and string return type. result = c4.execute("I love testing"); assertEquals("m4 success I love testing", result); } /** * Test method for {@link com.guimonsters.client.Command#execute()}. */ @Test public void testExecute2() { //Create commands for each test method. c1 = new Command(this, "c1", "This is command 1.", "Error 1", m1); c3 = new Command(this, "c3", "This is command 3.", "Error 3", m3); //Store string results of command execution. String result = ""; //Test conditions of method m1 before execution. assertEquals(0, c); //Executes method m1 with no parameters and no return type. c1.execute(); //Test results of m1's execution. assertEquals(7, c); //Execute method m3 with no parameters but string return type. result = c3.execute(); assertEquals("m3 success", result); } /** * Used to test execution of commands linked to void functions with no parameters. */ public void m1() { c = a + b; } /** * Used to test execution of commands linked to void functions with parameters. * @param arg A test string to append to a static test string. */ public void m2(String arg) { cappa = alpha+beta+arg; } /** * Used to test execution of commands with no parameters that return a string. * @return results A static test string. */ public String m3() { return "m3 success"; } /** * Used to test execution of commands with parameters that return a string. * @param arg A string argument to append to the static test string. * @return results A static test string with method input appended. */ public String m4(String arg) { return "m4 success "+arg; } }
6e04df561173b53914e7717271931fdf70c554f4
a9c11aea4af4b56d91baaeb51597059fc7a0e7a2
/Homework_1/src/main/java/twitter_sentiment/SentimentMapper.java
36a8eb393db11302863b48e5f5ef776e4c71ac1b
[]
no_license
NCNarayanaKumar/NBA-Tweets-Sentiment-Analysis
662c57cfdb5a248661c44fbe939d23bd6cb116be
0b379b679cdb1869283b141b34b6b07fa6dd0b50
refs/heads/master
2021-04-29T14:44:46.260222
2017-07-14T19:19:13
2017-07-14T19:19:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,088
java
package twitter_sentiment; import java.io.IOException; import java.net.URI; import org.apache.commons.io.FilenameUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.lib.input.FileSplit; import utilities.LookupService; import utilities.TweetWritable; /** * The SentimentMapper scores raw tweet data from Twitter. * * * The goal of the SentimentMapper is to examine every word in every given tweet, asking: * * 1) does this word indicate a feeling, sentiment or attitude? * * 2) if so, what is the affective score for the word? (Scores are found in a lookup table) * * As the tweet is processed, the score for words found in the lookup table are summed. * * When the Mapper is done, we will have the following information: - every tweet will have ---- a total score, ---- a * size, indicating how many words are in the tweet ---- a hit rate, indicating how many times a word in the tweet was * also found in the lookup table * * To store this information, you may or may not find it useful to use the TweetWritable.class found in utilities. * * * * In this first version of Sentiment processing, we are only processing one topic - tweets about the Clippers on the * evening of May 1, 2017 * * * @author elizabeth corey * */ public class SentimentMapper extends Mapper<LongWritable, Text, Text, TweetWritable> { private static final String LOOKUP_TABLE_PROPERTY = "lookupTable"; private static final Log LOG = LogFactory.getLog(SentimentMapper.class); public static LookupService lookupService; /** * Before the Mapper starts processing any data, it needs to setup * * 1) a new lookup service using the lookup table cached in the driver * * 2) a key for the data being processed by this Mapper. We will use the input split's filename as the key. * * In this case, the filename is "Clippers_5_1" - so we have information about the tweet topic embedded in the * filename. */ @Override public void setup(Context context) throws IOException { // Get the name of the lookup table or use AFINN-111 if none set String lookupName = context.getConfiguration().get(LOOKUP_TABLE_PROPERTY, "AFINN-111"); URI lookupFile = null; // retrieve the lookup table from the cache using context.getCacheFiles(); // LOG.info("0000" + lookupName); URI[] cacheFiles = context.getCacheFiles(); for (int i = 0; i < cacheFiles.length; i++) { // LOG.info("0000" + FilenameUtils.getName(cacheFiles[i].getPath())); if (FilenameUtils.getName(cacheFiles[i].getPath()).equals(lookupName)) lookupFile = cacheFiles[i]; } LOG.info("Using lookup table " + lookupFile.getPath().toString()); // Create and initialize the lookupService using lookupTableURI lookupService = new LookupService(); lookupService.initialize(lookupFile); // get the name of the input file from the split and use if for the Mapper's TOPIC Path inputPath = ((FileSplit) context.getInputSplit()).getPath(); TOPIC.set(inputPath.getName()); } private static final Text TOPIC = new Text(); private static final TweetWritable TWEET = new TweetWritable(); @Override public void map(LongWritable key, Text line, Context context) throws IOException, InterruptedException { /* * Convert the line, which is received as a Text object, to a String object. */ String tweet = line.toString(); /* * Use the parseText method to get the tweet's text. */ String twitterText = parseText(tweet); if (twitterText == null) return; long tweetId = 0; try { tweetId = getId(tweet); } catch (Exception e) { } /* * The line.split("\\W+") call uses regular expressions to split the line up by non-word characters. You can use * it and then iterate through resulting array of words * */ int scoreCount = 0; int totalScore = 0; int wordCount = 0; for (String word : twitterText.split("\\W+")) { if (word.length() > 0) { /* * Obtain the first word and use the lookupService that you initialized during setup to search for the * word in your sentiment list */ Integer score = lookupService.get(word); wordCount++; /* * If the word is found in the sentiment list, get the number associated with that word. Add the number * to the score for the tweet. */ if (score != null) { totalScore += score; scoreCount++; } } } /*- * Using the information you gathered when processing the tweet, create a new utilities.TweetWritable. * Use the setters on TweetWritable to set the following: * tweet * nHits (the number of times a word in the tweet was found in the lookup table) * size (the number of words in a tweet) * score */ TWEET.setNHits(scoreCount); TWEET.setScore(totalScore); TWEET.setSize(wordCount); TWEET.setTweet(tweet); TWEET.setTweetId(tweetId); /* * Call the write method on the Context object to emit a key and a value from the map method. The key is the * TOPIC defined in the setter; the value is TweetWritable. */ context.write(TOPIC, TWEET); } /** * Parse our quirky data. This doesn't generalize. * * @param string * * @return String containing the textual part of the tweet (or null, if the record is invalid) */ String parseText(String string) { /* * Make sure the first part is a id -- id example: 858950241151840256. An id is an integer with 18 digits */ try { if (string.length() < 18) return null; Long.parseLong(string.substring(0, 17)); } catch (NumberFormatException e) { return null; // not a valid id } /* * If the records starts with a valid id, then the rest of the record is the tweet's text and we can return it. * */ return string.substring(18); } long getId(String string) { return Long.parseLong(string.substring(0, 17)); } }
57135220d9ad0255a2f023a878f4ed268a960516
df3cf66a00023de393ba5c3d24ce2d188d92bbbc
/src/main/java/com/example/aspect/annotation/TryCatch.java
383d263ccf785b7a84aa1b50b2a2aff5e3791c3b
[]
no_license
alvarogarcia7/annotation-aspect-java
e05a40d12c95a479e8cd3336cc8ff09cd7600596
1ae91ef82e5a80ea8e8580977a3c5ef53e0748f7
refs/heads/master
2020-06-03T11:41:47.547947
2017-05-07T07:33:53
2017-05-07T07:33:53
34,278,644
0
1
null
null
null
null
UTF-8
Java
false
false
346
java
package com.example.aspect.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface TryCatch { Class<? extends Exception>[] catchException(); }
2eb74125d613240b277eb79f5ac8b815c45cfb70
be6ccc08f6d0f4510f37451a9a3f1618bc430484
/src/de/codingair/codingapi/particles/ParticlePacket.java
c089e1fad71d1e0c213c869b8b2c20330a526095
[ "MIT" ]
permissive
Peda1996/CodingAPI
e88451942388d545410034abcdb388fd392e95a8
0a18d6f9132d61e196a0216434d89e22931b145d
refs/heads/master
2020-04-03T15:21:42.342551
2018-10-30T09:57:57
2018-10-30T09:57:57
155,359,966
0
0
MIT
2018-10-30T09:40:49
2018-10-30T09:40:49
null
UTF-8
Java
false
false
4,150
java
package de.codingair.codingapi.particles; import de.codingair.codingapi.server.reflections.IReflection; import de.codingair.codingapi.server.reflections.PacketUtils; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; import java.awt.*; import java.lang.reflect.Constructor; /** * Removing of this disclaimer is forbidden. * * @author codingair * @verions: 1.0.0 **/ public class ParticlePacket { private Particle particle; private Object packet; private Color color = null; private boolean longDistance = false; private Location location; public ParticlePacket(Particle particle) { this.particle = particle; } public ParticlePacket(Particle particle, Color color, boolean longDistance) { this.particle = particle; this.color = color; this.longDistance = longDistance; } public ParticlePacket initialize(Location loc) { if(!available()) return this; this.location = loc; Class<?> enumParticle = IReflection.getClass(IReflection.ServerPacket.MINECRAFT_PACKAGE, "EnumParticle"); Class<?> packetClass = IReflection.getClass(IReflection.ServerPacket.MINECRAFT_PACKAGE, "PacketPlayOutWorldParticles"); Constructor packetConstructor = IReflection.getConstructor(packetClass).getConstructor(); ParticleData data = null; if(particle.requiresData()) { Location below = loc.clone(); below.setY(loc.getBlockY() - 1); //noinspection deprecation data = new ParticleData(below.getBlock().getType(), below.getBlock().getData()); } if(particle.requiresWater() && !loc.getBlock().getType().equals(Material.WATER) && !loc.getBlock().getType().equals(Material.STATIONARY_WATER)) return this; float e = 0, f = 0, g = 0, h = 0; int i = 1; if(particle.isColorable() && this.color != null) { e = this.color.getRed() / 255; if(e == 0) e = 0.003921569F; f = this.color.getGreen() / 255; g = this.color.getBlue() / 255; h = 1F; i = 0; } try { packet = packetConstructor.newInstance(); IReflection.setValue(packet, "a", enumParticle.getEnumConstants()[particle.getId()]); IReflection.setValue(packet, "j", this.longDistance); if (data != null) { int[] packetData = data.getPacketData(); IReflection.setValue(packet, "k", particle == Particle.ITEM_CRACK ? packetData : new int[] { packetData[0] | (packetData[1] << 12) }); } IReflection.setValue(packet, "b", (float) loc.getX()); IReflection.setValue(packet, "c", (float) loc.getY()); IReflection.setValue(packet, "d", (float) loc.getZ()); IReflection.setValue(packet, "e", e); IReflection.setValue(packet, "f", f); IReflection.setValue(packet, "g", g); IReflection.setValue(packet, "h", h); IReflection.setValue(packet, "i", i); } catch(Exception exception) { exception.printStackTrace(); } return this; } public boolean available() { Class<?> enumParticle = IReflection.getClass(IReflection.ServerPacket.MINECRAFT_PACKAGE, "EnumParticle"); return enumParticle.getEnumConstants().length - 1 >= this.particle.getId(); } public void send(Player... p) { if(packet == null || location == null) return; for(Player player : p) { if(player.getWorld() == this.location.getWorld()) PacketUtils.sendPacket(packet, player); } } public void send() { if(packet == null || location == null) return; for(Player player : Bukkit.getOnlinePlayers()) { if(player.getWorld() == this.location.getWorld()) PacketUtils.sendPacket(packet, player); } } public Particle getParticle() { return particle; } public Object getPacket() { return packet; } public Color getColor() { return color; } public ParticlePacket setColor(Color color) { this.color = color; return this; } @Override public ParticlePacket clone() { ParticlePacket packet = new ParticlePacket(this.particle); packet.setColor(this.color); packet.setLongDistance(this.longDistance); return packet; } public boolean isLongDistance() { return longDistance; } public void setLongDistance(boolean longDistance) { this.longDistance = longDistance; } }
c88158800c49f46d135e340a2028ad49a3159291
2b8cba6ca047afd479cdd1c8848bdf47be876b66
/src/DataBean/photoType.java
7dd2dcb145713a74dda763d7c8f475cd1200eded
[]
no_license
zhengdaone/2013121182Blog
d4102666340b6554e24139476ff8dc5fcd5c1ca2
693713baa679c1fa8ffdd017fe3f560beb0788f4
refs/heads/master
2020-12-30T16:39:56.372207
2017-05-11T16:42:08
2017-05-11T16:42:08
90,997,705
0
0
null
null
null
null
UTF-8
Java
false
false
347
java
package DataBean; public class photoType { private int pTypeId; private String pTypeName; public int getpTypeId() { return pTypeId; } public void setpTypeId(int pTypeId) { this.pTypeId = pTypeId; } public String getpTypeName() { return pTypeName; } public void setpTypeName(String pTypeName) { this.pTypeName = pTypeName; } }
35c7a0957410025d6e98f56a02d44f36e119f7b0
81cc7d38c116b96bd73c5c342372742047726038
/src/main/java/org/jhipster/config/MetricsConfiguration.java
c9c0386bf3f2bf73ae2010441e6a832241ac28d5
[]
no_license
cedibu/jhipster-cart
55d76bc82ba88d258ad80c029c2a082ca5bbceac
770b97e3bede4cf7bf40db1b1d487226c0d0be1a
refs/heads/master
2021-07-03T03:51:56.980144
2017-09-22T13:59:50
2017-09-22T13:59:50
104,481,131
0
1
null
null
null
null
UTF-8
Java
false
false
5,152
java
package org.jhipster.config; import io.github.jhipster.config.JHipsterProperties; import io.github.jhipster.config.metrics.SpectatorLogMetricWriter; import com.netflix.spectator.api.Registry; import org.springframework.boot.actuate.autoconfigure.ExportMetricReader; import org.springframework.boot.actuate.autoconfigure.ExportMetricWriter; import org.springframework.boot.actuate.metrics.writer.MetricWriter; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.cloud.netflix.metrics.spectator.SpectatorMetricReader; import com.codahale.metrics.JmxReporter; import com.codahale.metrics.JvmAttributeGaugeSet; import com.codahale.metrics.MetricRegistry; import com.codahale.metrics.Slf4jReporter; import com.codahale.metrics.health.HealthCheckRegistry; import com.codahale.metrics.jvm.*; import com.ryantenney.metrics.spring.config.annotation.EnableMetrics; import com.ryantenney.metrics.spring.config.annotation.MetricsConfigurerAdapter; import com.zaxxer.hikari.HikariDataSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.Marker; import org.slf4j.MarkerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.*; import javax.annotation.PostConstruct; import java.lang.management.ManagementFactory; import java.util.concurrent.TimeUnit; @Configuration @EnableMetrics(proxyTargetClass = true) public class MetricsConfiguration extends MetricsConfigurerAdapter { private static final String PROP_METRIC_REG_JVM_MEMORY = "jvm.memory"; private static final String PROP_METRIC_REG_JVM_GARBAGE = "jvm.garbage"; private static final String PROP_METRIC_REG_JVM_THREADS = "jvm.threads"; private static final String PROP_METRIC_REG_JVM_FILES = "jvm.files"; private static final String PROP_METRIC_REG_JVM_BUFFERS = "jvm.buffers"; private static final String PROP_METRIC_REG_JVM_ATTRIBUTE_SET = "jvm.attributes"; private final Logger log = LoggerFactory.getLogger(MetricsConfiguration.class); private MetricRegistry metricRegistry = new MetricRegistry(); private HealthCheckRegistry healthCheckRegistry = new HealthCheckRegistry(); private final JHipsterProperties jHipsterProperties; private HikariDataSource hikariDataSource; public MetricsConfiguration(JHipsterProperties jHipsterProperties) { this.jHipsterProperties = jHipsterProperties; } @Autowired(required = false) public void setHikariDataSource(HikariDataSource hikariDataSource) { this.hikariDataSource = hikariDataSource; } @Override @Bean public MetricRegistry getMetricRegistry() { return metricRegistry; } @Override @Bean public HealthCheckRegistry getHealthCheckRegistry() { return healthCheckRegistry; } @PostConstruct public void init() { log.debug("Registering JVM gauges"); metricRegistry.register(PROP_METRIC_REG_JVM_MEMORY, new MemoryUsageGaugeSet()); metricRegistry.register(PROP_METRIC_REG_JVM_GARBAGE, new GarbageCollectorMetricSet()); metricRegistry.register(PROP_METRIC_REG_JVM_THREADS, new ThreadStatesGaugeSet()); metricRegistry.register(PROP_METRIC_REG_JVM_FILES, new FileDescriptorRatioGauge()); metricRegistry.register(PROP_METRIC_REG_JVM_BUFFERS, new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer())); metricRegistry.register(PROP_METRIC_REG_JVM_ATTRIBUTE_SET, new JvmAttributeGaugeSet()); if (hikariDataSource != null) { log.debug("Monitoring the datasource"); hikariDataSource.setMetricRegistry(metricRegistry); } if (jHipsterProperties.getMetrics().getJmx().isEnabled()) { log.debug("Initializing Metrics JMX reporting"); JmxReporter jmxReporter = JmxReporter.forRegistry(metricRegistry).build(); jmxReporter.start(); } if (jHipsterProperties.getMetrics().getLogs().isEnabled()) { log.info("Initializing Metrics Log reporting"); Marker metricsMarker = MarkerFactory.getMarker("metrics"); final Slf4jReporter reporter = Slf4jReporter.forRegistry(metricRegistry) .outputTo(LoggerFactory.getLogger("metrics")) .markWith(metricsMarker) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); reporter.start(jHipsterProperties.getMetrics().getLogs().getReportFrequency(), TimeUnit.SECONDS); } } /* Spectator metrics log reporting */ @Bean @ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled") @ExportMetricReader public SpectatorMetricReader spectatorMetricReader(Registry registry) { log.info("Initializing Spectator Metrics Log reporting"); return new SpectatorMetricReader(registry); } @Bean @ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled") @ExportMetricWriter MetricWriter metricWriter() { return new SpectatorLogMetricWriter(); } }
2192369781c70596808c0fff08ffbe35734b0a2c
39937cb5612a21634316efabd32b232e5eec8c4c
/app/src/main/java/com/spandana/firebaselogin/UI/TopUpReportDetailsActivity.java
d591f84bcccd801f2586a3b0f147b4e9b03763e1
[]
no_license
sunnyreddyt/FirebaseLogin
0de791782d441a87121c028e3400471562c0a8a6
04917cb29f5aa5c5d8390c1499f909939d048490
refs/heads/master
2020-03-23T05:01:50.279394
2018-07-16T09:39:25
2018-07-16T09:39:25
141,117,654
0
0
null
null
null
null
UTF-8
Java
false
false
5,351
java
package com.spandana.firebaselogin.UI; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import com.spandana.firebaselogin.adapters.BankDetailsAdapter; import com.spandana.firebaselogin.R; import com.spandana.firebaselogin.adapters.TopUpReportDetailsAdapter; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; public class TopUpReportDetailsActivity extends AppCompatActivity { RecyclerView usersRecycleView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_topup_report_details); usersRecycleView = (RecyclerView) findViewById(R.id.usersRecycleView); /* if (abUtil.isConnectingToInternet()) { new Userslist().execute(); abUtil.showSmileProgressDialog(AsyncActivity.this); }*/ new TopUpReportDetails().execute(); } private class TopUpReportDetails extends AsyncTask<String, Integer, String> { @Override protected String doInBackground(String... params) { // TODO Auto-generated method stub String str = postData(); return str; } protected void onPostExecute(String json) { try { // abUtil.dismissSmileProgressDialog(); if (json.length() > 0) { JSONObject jsonObjectMain; try { jsonObjectMain = new JSONObject(json); String path = ""; Log.e("jsonObjectMain", "" + jsonObjectMain); if (jsonObjectMain.has("Code") && jsonObjectMain.getString("Code").equalsIgnoreCase("200")) { String responseMessage = jsonObjectMain.getString("Response"); JSONArray jsonArray = jsonObjectMain.getJSONArray("topup_reports"); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(TopUpReportDetailsActivity.this, LinearLayoutManager.VERTICAL, false); usersRecycleView.setLayoutManager(linearLayoutManager); usersRecycleView.setHasFixedSize(true); TopUpReportDetailsAdapter topUpReportDetailsAdapter = new TopUpReportDetailsAdapter(TopUpReportDetailsActivity.this, jsonArray); usersRecycleView.setAdapter(topUpReportDetailsAdapter); } } catch (NullPointerException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } } else { } } catch (NullPointerException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } protected void onProgressUpdate(Integer... progress) { } @SuppressWarnings("deprecation") public String postData() { // Create a new HttpClient and Post Header HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("https://www.esytopup.co.in/mobile_service/Login/topupReports?loginid=112"); String json = ""; try { List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); /* nameValuePairs.add(new BasicNameValuePair("sign", "2"));*/ httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); // Execute HTTP Post Request HttpResponse response = httpclient.execute(httppost); HttpEntity httpEntity = response.getEntity(); InputStream is = httpEntity.getContent(); BufferedReader reader = new BufferedReader( new InputStreamReader(is, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); json = sb.toString(); Log.v("objJsonMain", "" + json); } catch (ClientProtocolException e) { e.printStackTrace(); // TODO Auto-generated catch block } catch (IOException e) { e.printStackTrace(); } return json; } } }
39feee9ef07b6883a5f0f45e3b76b9426911f00d
c056d4cf5facbc11c9963d005ca8f18f50e2d05d
/Android/test/test/test-master/android/test/mocktest/app/src/main/java/snowdream/github/com/mocktest/MainActivity.java
b8dff0ab41a601bdea2e3205441f8e255d6dbc34
[]
no_license
yuxhe/study-2
ad4cf8f1d78f5d3f4aa51788bb44d6e03cebe83c
e09d5f92416233005a5b9e5ff44bdf56379bcb40
refs/heads/master
2022-12-31T07:40:48.637525
2019-12-22T11:43:57
2019-12-22T11:43:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
342
java
package snowdream.github.com.mocktest; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
a16b59fc0788b956c0856c3436a7ba9c1a40fa8d
c338e68877cd2262ebe418561f9c69c62a237748
/workspace-openFileBackup2-UserInterface/openFileBackup2-UI/src/jp/ddhost/ofb_ui/destinationSelector.java
49cfef82d42448b6494804b89cfb1ee1c6ced682
[]
no_license
mfright/OpenFileBackup2
02114cd06f7183fc67d6b14cd66e0522b71f954a
36c5bcc0e7c7436ba5ee34ebe8b94fe715df0589
refs/heads/master
2021-01-12T04:45:43.415075
2017-01-09T06:20:10
2017-01-09T06:20:10
77,792,030
0
0
null
null
null
null
SHIFT_JIS
Java
false
false
5,707
java
package jp.ddhost.ofb_ui; import java.awt.BorderLayout; import java.awt.FlowLayout; import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JRadioButton; import javax.swing.JLabel; import javax.swing.JTextField; import java.awt.event.ActionListener; import java.io.File; import java.awt.event.ActionEvent; import java.awt.Color; public class destinationSelector extends JDialog { private static final long serialVersionUID = 1L; private final JPanel contentPanel = new JPanel(); private JTextField txtStoragePath; private JTextField txtServerUrl; private JTextField txtFtpid; private JTextField txtFtppw; /** * Create the dialog. */ public destinationSelector(UserInterface ui,JTextField targetBox,JLabel targetId,JLabel targetPw) { setTitle("\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u4FDD\u5B58\u5148"); setModalityType(ModalityType.APPLICATION_MODAL); setBounds(100, 100, 712, 348); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(null); JRadioButton rdbStorage = new JRadioButton("\u30B9\u30C8\u30EC\u30FC\u30B8\u307E\u305F\u306F\u30D5\u30A1\u30A4\u30EB\u30B5\u30FC\u30D0\u3092\u4F7F\u7528"); rdbStorage.setSelected(true); rdbStorage.setBounds(8, 46, 335, 21); contentPanel.add(rdbStorage); JRadioButton rdbFtp = new JRadioButton("FTP\u30B5\u30FC\u30D0\u3092\u4F7F\u7528"); rdbFtp.setBounds(8, 138, 404, 21); contentPanel.add(rdbFtp); JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton okButton = new JButton("OK"); okButton.setBackground(Color.ORANGE); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //設定値を親ウィンドウへ書き戻す if(rdbFtp.isSelected()){ targetBox.setText("ftp://"+txtServerUrl.getText()); targetId.setText(txtFtpid.getText()); targetPw.setText(txtFtppw.getText()); }else{ targetBox.setText(txtStoragePath.getText()); } dispose(); } }); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { dispose(); }}); cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } ButtonGroup group = new ButtonGroup(); group.add(rdbStorage); group.add(rdbFtp); JLabel label = new JLabel("\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u4FDD\u5B58\u5148\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002"); label.setBounds(12, 10, 313, 13); contentPanel.add(label); txtStoragePath = new JTextField(); txtStoragePath.setBounds(122, 73, 511, 19); contentPanel.add(txtStoragePath); txtStoragePath.setColumns(10); JButton btnSelectFolder = new JButton("\u53C2\u7167"); btnSelectFolder.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { txtStoragePath.setText(selectFolder(txtStoragePath.getText())); } }); btnSelectFolder.setBounds(372, 46, 91, 21); contentPanel.add(btnSelectFolder); txtServerUrl = new JTextField(); txtServerUrl.setBounds(196, 165, 267, 19); contentPanel.add(txtServerUrl); txtServerUrl.setColumns(10); JLabel lblNewLabel = new JLabel("FTP\u30B5\u30FC\u30D0\u30A2\u30C9\u30EC\u30B9+\u30D1\u30B9\uFF1A"); lblNewLabel.setBounds(18, 165, 173, 13); contentPanel.add(lblNewLabel); JLabel label_1 = new JLabel("\u4FDD\u5B58\u5148\uFF1A"); label_1.setBounds(34, 73, 76, 13); contentPanel.add(label_1); JLabel lblid = new JLabel("FTP\u30E6\u30FC\u30B6\u30FCID:"); lblid.setBounds(27, 217, 91, 13); contentPanel.add(lblid); txtFtpid = new JTextField(); txtFtpid.setBounds(205, 214, 258, 19); contentPanel.add(txtFtpid); txtFtpid.setColumns(10); txtFtpid.setText(targetId.getText()); JLabel lblNewLabel_1 = new JLabel("FTP\u30D1\u30B9\u30EF\u30FC\u30C9"); lblNewLabel_1.setBounds(27, 252, 91, 13); contentPanel.add(lblNewLabel_1); txtFtppw = new JTextField(); txtFtppw.setBounds(205, 249, 258, 19); contentPanel.add(txtFtppw); txtFtppw.setColumns(10); txtFtppw.setText(targetPw.getText()); JLabel lblMydomaincombackup = new JLabel("\u4F8B) mydomain.com/backup"); lblMydomaincombackup.setBounds(493, 168, 191, 13); contentPanel.add(lblMydomaincombackup); // 設定されたパスを表示 if(targetBox.getText().indexOf("ftp://")==0){ rdbFtp.setSelected(true); rdbStorage.setSelected(false); txtServerUrl.setText(targetBox.getText().substring(6)); }else{ txtStoragePath.setText(targetBox.getText()); } //アイコンを設定する。 ImageIcon img = new ImageIcon("ddleaf.png"); setIconImage(img.getImage()); } // ファイルやフォルダを選択するダイアログを表示して、選択されたパスを返す。 // 第一引数はデフォルト値 private String selectFolder(String defaultPath){ try{ JFileChooser myFileChooser = new JFileChooser(); myFileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES ); myFileChooser.showOpenDialog(null); File myFile = myFileChooser.getSelectedFile(); return myFile.getCanonicalPath(); }catch(Exception ex){ } return defaultPath; } }
590ff3af0297d761cd09a265566f43d6c4fa43e9
2d9d91c240506d5d2074676f77c8bbd38d859530
/app/src/main/java/com/egco428/a13264/MainActivity.java
1c67c569cf5e0ec68277bf0bfb57520a73efaf75
[]
no_license
naravitchan/Fortune
378303452d34f49dadc081bcc03c29be807958f0
1d3bc75b93ff3e35db9fbad63e5b445e5a4e0336
refs/heads/master
2020-12-24T06:07:40.219107
2016-11-08T21:11:35
2016-11-08T21:11:35
73,227,364
0
0
null
null
null
null
UTF-8
Java
false
false
4,381
java
package com.egco428.a13264; import android.app.Activity; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Color; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import java.util.List; public class MainActivity extends AppCompatActivity { private CommentDataSource dataSource; private ArrayAdapter<Comment> arrayAdapter; int count=1; @Override public boolean onOptionsItemSelected(MenuItem item) { Intent intent = new Intent(this, NewfortuneActivity.class); startActivityForResult(intent,count); return true; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); dataSource = new CommentDataSource(this); dataSource.open(); List<Comment> values = dataSource.getAllComments(); ListView listView = (ListView)findViewById(R.id.listView); arrayAdapter = new CourseArrayAdapter(this,0,values); // ArrayAdapter<Comment> courseArrayAdapter = new CourseArrayAdapter(this,0,values); listView.setAdapter(arrayAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent,final View view,final int position, long id) { final Comment comment =arrayAdapter.getItem(position); dataSource.deleteComment(comment); view.animate().setDuration(2000).alpha(0).withEndAction(new Runnable() { @Override public void run() { arrayAdapter.remove(comment); view.setAlpha(1); } }); } }); arrayAdapter.notifyDataSetChanged(); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu,menu); return super.onCreateOptionsMenu(menu); } class CourseArrayAdapter extends ArrayAdapter<Comment>{ Context context; List<Comment> objects; public CourseArrayAdapter(Context context,int resource,List<Comment> objects){ super(context,resource,objects); this.context = context; this.objects = objects; } @Override public View getView(int position, View convertView, ViewGroup parent){ Comment course = objects.get(position); LayoutInflater inflater = (LayoutInflater)context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.list,null); TextView txt = (TextView)view.findViewById(R.id.resultlist); txt.setText(course.getComment()); if((course.getComment().equals("Don't Panic"))||(course.getComment().equals("Work Hard"))){ txt.setTextColor(Color.parseColor("#E38334")); } else{ txt.setTextColor(Color.parseColor("#0A29F6")); } TextView txt2 = (TextView)view.findViewById(R.id.datelist); txt2.setText(course.getDate()); int res = context.getResources().getIdentifier(course.getPicture(),"drawable",context.getPackageName()); ImageView image = (ImageView)view.findViewById(R.id.imagelist); image.setImageResource(res); return view; } } @Override protected void onResume(){ super.onResume(); dataSource.open(); List<Comment> values = dataSource.getAllComments(); ListView listView = (ListView)findViewById(R.id.listView); arrayAdapter = new CourseArrayAdapter(this,0,values); listView.setAdapter(arrayAdapter); } @Override protected void onPause(){ super.onPause(); dataSource.close(); } }
[ "naravit chan" ]
naravit chan
3788a28737ca04e8f4c253addb69db6871b915d1
d72dc01fd47d735b5475191f2c56e18a2b8e1c40
/app/src/main/java/com/dmw/constraintlayoutdemo/ScreenUtil.java
eb3929945cc7df4e361e1024990b3f746a22de62
[]
no_license
cc-shifo/ConstraintLayoutDemo
7c37a921f14e902d7a992c3fcd9f530b3a665719
f0d7f364ee177cdc33cbd0c8d2b35edc35902060
refs/heads/master
2022-11-15T15:47:40.693126
2020-07-12T02:07:06
2020-07-12T02:07:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,773
java
package com.dmw.constraintlayoutdemo; import android.app.Activity; import android.content.Context; import android.graphics.Rect; import android.util.DisplayMetrics; import android.util.Log; import android.view.WindowManager; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity; /** * Created by dumingwei on 2017/4/20. */ public class ScreenUtil { private static final String TAG = ScreenUtil.class.getSimpleName(); public static int getScreenWidth(Context context) { WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); DisplayMetrics displayMetrics = new DisplayMetrics(); windowManager.getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics.widthPixels; } public static void testDensity(Context context) { WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); DisplayMetrics displayMetrics = new DisplayMetrics(); windowManager.getDefaultDisplay().getMetrics(displayMetrics); Log.d(TAG, "density: " + displayMetrics.density); Log.d(TAG, "xdpi: " + displayMetrics.xdpi); Log.d(TAG, "ydpi: " + displayMetrics.ydpi); Log.d(TAG, "densityDpi: " + displayMetrics.densityDpi); } public static int getScreenHeight(Context context) { WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); DisplayMetrics displayMetrics = new DisplayMetrics(); windowManager.getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics.heightPixels; } public static void getDisplayMetricsInfo(Context context) { WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); DisplayMetrics displayMetrics = new DisplayMetrics(); windowManager.getDefaultDisplay().getMetrics(displayMetrics); Log.e(TAG, "getDisplayMetricsInfo: " + displayMetrics.toString() + "densityDpi=" + displayMetrics.densityDpi); } public static int getStateBarHeight(Activity activity) { Rect rect = new Rect(); activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(rect); Log.e(TAG, "getStateBarHeight: " + rect.top + "rect.bottom=" + rect.bottom); return rect.top; } public static int getActionBarHeight(AppCompatActivity activity) { ActionBar actionBar = activity.getSupportActionBar(); if (actionBar != null) { Log.e(TAG, "getActionBarHeight: " + actionBar.getHeight()); return actionBar.getHeight(); } return 0; } /** * 获取我们的View显示的区域距屏幕顶部的高度 * * @param activity * @return */ public static int getContentViewTop(AppCompatActivity activity) { int top = getStateBarHeight(activity) + getActionBarHeight(activity); Log.e(TAG, "getViewTop: " + top); return top; } public static int dpToPx(Context context, int dpValue) { WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); DisplayMetrics displayMetrics = new DisplayMetrics(); windowManager.getDefaultDisplay().getMetrics(displayMetrics); return (int) (displayMetrics.density * dpValue); } public static float spToPx(Context context, int dpValue) { WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); DisplayMetrics displayMetrics = new DisplayMetrics(); windowManager.getDefaultDisplay().getMetrics(displayMetrics); return (displayMetrics.scaledDensity * dpValue); } }
0d7747db1a9029b61498b79bf50c9d1e9c1ed9b9
d756811c0f351debd1e0bd45fd8e37393c47c6b5
/org.eclipselabs.mongo.query/src-gen/org/eclipselabs/mongo/query/query/impl/AndWhereEntryImpl.java
42059bdb231fc7da372615fa540205f7b4c194fc
[]
no_license
Hdebbech/MongoEMF-query-engine
f9b941a43334a6ee63ca4fbb68c710ebb7cdff4b
4d1d58d496ceff8e32f887c39467cecfee7c6eb5
refs/heads/master
2021-01-14T14:03:08.626559
2012-03-29T15:01:04
2012-03-29T15:01:04
64,699,721
1
0
null
2016-08-01T20:35:42
2016-08-01T20:35:41
null
UTF-8
Java
false
false
3,742
java
/** * <copyright> * </copyright> * */ package org.eclipselabs.mongo.query.query.impl; import java.util.Collection; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; import org.eclipselabs.mongo.query.query.AndWhereEntry; import org.eclipselabs.mongo.query.query.QueryPackage; import org.eclipselabs.mongo.query.query.WhereEntry; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>And Where Entry</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipselabs.mongo.query.query.impl.AndWhereEntryImpl#getEntries <em>Entries</em>}</li> * </ul> * </p> * * @generated */ public class AndWhereEntryImpl extends WhereEntryImpl implements AndWhereEntry { /** * The cached value of the '{@link #getEntries() <em>Entries</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getEntries() * @generated * @ordered */ protected EList<WhereEntry> entries; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected AndWhereEntryImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return QueryPackage.Literals.AND_WHERE_ENTRY; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<WhereEntry> getEntries() { if (entries == null) { entries = new EObjectContainmentEList<WhereEntry>(WhereEntry.class, this, QueryPackage.AND_WHERE_ENTRY__ENTRIES); } return entries; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case QueryPackage.AND_WHERE_ENTRY__ENTRIES: return ((InternalEList<?>)getEntries()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case QueryPackage.AND_WHERE_ENTRY__ENTRIES: return getEntries(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case QueryPackage.AND_WHERE_ENTRY__ENTRIES: getEntries().clear(); getEntries().addAll((Collection<? extends WhereEntry>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case QueryPackage.AND_WHERE_ENTRY__ENTRIES: getEntries().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case QueryPackage.AND_WHERE_ENTRY__ENTRIES: return entries != null && !entries.isEmpty(); } return super.eIsSet(featureID); } } //AndWhereEntryImpl
c218f88b2b958879f4ecb897277ceb4294b166e7
8ea19e7721c12f9edbbaff95f654085c3bebdf94
/src/main/java/net/tcpshield/tcpshield/bukkit/protocollib/impl/ProtocolLibPacketImpl.java
91cc09bc4274ba75345a14ddfa45530a4f50c55a
[ "MIT" ]
permissive
RoboMWM/RealIP
f8791495dde23a8712e7e5c5510c4dcd03a6f552
0a8d6295b2e8987dbb730d337bc24df7484e6808
refs/heads/master
2023-02-09T22:02:49.523025
2020-12-23T15:58:41
2020-12-23T15:58:41
323,980,678
0
0
MIT
2020-12-23T19:01:17
2020-12-23T19:01:16
null
UTF-8
Java
false
false
717
java
package net.tcpshield.tcpshield.bukkit.protocollib.impl; import com.comphenix.protocol.events.PacketContainer; import net.tcpshield.tcpshield.abstraction.IPacket; public class ProtocolLibPacketImpl implements IPacket { private final PacketContainer packetContainer; private final String rawPayload; public ProtocolLibPacketImpl(PacketContainer packetContainer) { this.packetContainer = packetContainer; this.rawPayload = packetContainer.getStrings().read(0); } @Override public String getRawPayload() { return rawPayload; } @Override public void modifyOriginalPacket(String hostname) { packetContainer.getStrings().write(0, hostname); } }
04a733af6299f2386e60bfab0e0e1959a4385150
06e8d70ced972311b2b9ee478fd389f85ac1375e
/src/main/java/linkedList/LinkedListImplementationUsingStack.java
ab9a8fbdb15d37e118485e8ace1d4da9e5cc54bd
[]
no_license
ChinnuCoding/codingPractice
f7f5de233cd7cbbf497eb1dd0da5d806a4ec16d7
6ae80882f39b9da1fe069fb8bd2cb4724a893315
refs/heads/master
2021-03-11T17:02:31.260251
2021-03-10T03:27:27
2021-03-10T03:27:27
246,531,671
0
0
null
null
null
null
UTF-8
Java
false
false
3,094
java
package linkedList; // Java program to Implement a stack // using singly linked list // import package import static java.lang.System.exit; // Create Stack Using Linked list class StackUsingLinkedlist { // A linked list node private class Node { int data; // integer data Node link; // reference variable Node type } // create global top reference variable global Node top; // Constructor StackUsingLinkedlist() { this.top = null; } // Utility function to add an element x in the stack public void push(int x) // insert at the beginning { // create new node temp and allocate memory Node temp = new Node(); // check if stack (heap) is full. Then inserting an // element would lead to stack overflow if (temp == null) { System.out.print("\nHeap Overflow"); return; } // initialize data into temp data field temp.data = x; // put top reference into temp link temp.link = top; // update top reference top = temp; } // Utility function to check if the stack is empty or not public boolean isEmpty() { return top == null; } // Utility function to return top element in a stack public int peek() { // check for empty stack if (!isEmpty()) { return top.data; } else { System.out.println("Stack is empty"); return -1; } } // Utility function to pop top element from the stack public void pop() // remove at the beginning { // check for stack underflow if (top == null) { System.out.print("\nStack Underflow"); return; } // update the top pointer to point to the next node top = (top).link; } public void display() { // check for stack underflow if (top == null) { System.out.printf("\nStack Underflow"); exit(1); } else { Node temp = top; while (temp != null) { // print node data System.out.printf("%d->", temp.data); // assign temp link to temp temp = temp.link; } } } } // main class public class LinkedListImplementationUsingStack { public static void main(String[] args) { // create Object of Implementing class StackUsingLinkedlist obj = new StackUsingLinkedlist(); // insert Stack value obj.push(11); obj.push(22); obj.push(33); obj.push(44); // print Stack elements obj.display(); // print Top element of Stack System.out.printf("\nTop element is %d\n", obj.peek()); // Delete top element of Stack obj.pop(); obj.pop(); // print Stack elements obj.display(); // print Top element of Stack System.out.printf("\nTop element is %d\n", obj.peek()); } }
9787d4809005c89dc54a057eb7296c9a7402b495
1225a8999a66d4662ec5e7f700367ba4d82671b7
/Core/src/Lesson6/Season.java
bed57f4eb97d44e5a4682fc5d120edb91853007e
[]
no_license
Mariia679/AllProjects
7fe377d0bd0f66707bf9041caeecb772d95df5ad
77371b369a45fbaacf9b7b3793c259b5f394ba9f
refs/heads/master
2021-01-21T10:33:54.276205
2017-02-28T15:42:46
2017-02-28T15:42:46
83,449,942
0
0
null
null
null
null
UTF-8
Java
false
false
82
java
package Lesson6; public enum Season { WINTER, SPRING, SUMMER, AUTUMN; }
3dea44539f734b624339e8bcd094ed0640b3cad8
d69f3f3c35a96c01ccdcb7939d715ba5390e2b4d
/ObjectOriented/src/Final.java
a32015e7021d79059029b8e51c23da02a873f150
[]
no_license
SN-Vidya/JAVA-Assignment
b01d46c5f99a94c845c25ada698836f72ecbd497
41de2a6bb44d46bc0b118013a403cf4646116af5
refs/heads/master
2023-04-22T20:57:23.477799
2021-05-14T12:05:30
2021-05-14T12:05:30
367,299,127
0
0
null
null
null
null
UTF-8
Java
false
false
33
java
final abstract class Final { }
f36085ae216d272f7e16110298e8c2dc1b0a37e7
c824fb13626ad9ab8e4fbd009a5e354464137f18
/src/main/java/abstractClass/Character.java
9f6fdb401821989ac997546d153fdf16d6aecd35
[]
no_license
littlefred/EvalJDBC
dd461c51cf888dd540316a73e479f4d701753adb
265bfc12bfa59b6bbec6f46f03e4ae4e07816554
refs/heads/master
2021-09-10T08:30:20.481079
2018-03-22T23:35:36
2018-03-22T23:35:36
125,834,475
0
0
null
null
null
null
UTF-8
Java
false
false
2,555
java
/** * package abstract => to group all classes who are abstract */ package abstractClass; import java.sql.SQLException; import java.util.Date; import java.util.List; import org.postgresql.util.PSQLException; import principal.SchoolManagement; /** * @author Frederick * this class is parent of Teacher and Student */ public abstract class Character { protected Long id; protected String kind; protected String name; protected String firstName; protected Date birthDate; /** * accessors * @return */ public int getId() { return id.intValue(); } public void setId(int id) { this.id = new Long(id); } public String getKind() { return kind; } public void setKind(String kind) { this.kind = kind; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public Date getBirthDate() { return birthDate; } public void setBirthDate(Date birthDate) { this.birthDate = birthDate; } /** * common method of Teacher and Student to keep the user informations for add an element */ public void prepareCharacter() { boolean answer = false; do { String kind = SchoolManagement.getUserInputString("What is his kind (Mr, Ms or Mrs) "); if (kind.equals("Mr") || kind.equals("Ms") || kind.equals("Mrs")) { this.kind = kind; answer = true; } } while (!answer); String name; do { name = SchoolManagement.getUserInputString("What is his name"); } while (name.equals("")); this.name = name; String firstName; do { firstName = SchoolManagement.getUserInputString("What is his firstname"); } while (firstName.equals("")); this.firstName = firstName; this.birthDate = SchoolManagement.getUserInputDate("What is his birth date (YYYY-MM-DD) "); }; /** * method to see the good link between Teacher and teaches or Student and Classes */ public void prepareLink() { }; /** * method to save a new object (Teacher or Student) in database * @throws PSQLException * @throws SQLException */ public void save() throws PSQLException, SQLException { }; /** * method to update an object (Teacher or Student) */ public void update() { }; /** * method to delete an object (Teacher or Student) */ public void delete() { }; /** * method to find information in database to manage the display * @return */ public List<Character> display() { return null; }; }
c5a49a2682879db5245e843d9ed893112cb666fd
13c547cf7c31515d6a95ce0ac8bb6b0db6538921
/src/main/java/com/nylg/javaee/service/GoodsService.java
1d9252aeac2fd939f091ea3e8a47e0d3b65a605c
[]
no_license
ChinaQSH/javaee_Myproject
04d69c19bab235c20421b15ea5c864b8578c15d2
2a43805584643164e4110d3289682f3995f568f9
refs/heads/main
2023-02-02T05:46:53.242111
2020-12-23T06:33:15
2020-12-23T06:33:15
322,454,021
0
0
null
null
null
null
UTF-8
Java
false
false
1,332
java
package com.nylg.javaee.service; /** * @Created by IntelliJ IDEA. * @Auther: [email protected] * @User: Shi Hao Qu * @create: 2020/12/14 23:16 * @Version: 1.0 */ import com.nylg.javaee.bean.goods.BO.*; import com.nylg.javaee.bean.goods.VO.GetGoodInfoIndexVO; import com.nylg.javaee.bean.goods.VO.GetGoodsVO; import com.nylg.javaee.bean.goods.VO.GetSearchGoodsVO; import com.nylg.javaee.bean.goods.VO.GoodTypeVO; import java.util.List; import java.util.Map; /** *@Description: 商品信息操作 * */ public interface GoodsService { List<GoodTypeVO> getType(); /** * @Date:2020/12/15 9:09 * @Param null: * @return: null * @Author:QSH * @Description: 添加商品分类 */ int addType(GoodTypeBO goodTypeBO); /** * @Date:2020/12/15 10:53 * @Param null: * @return: null * @Author:QSH * @Description: 获取商品信息 */ List<GetGoodsVO> getGoodsByType(int typeId); int addGoods(AddGoodsBO addGoodsBO); void updateGoods(UpdateGoodsBO updateGoodsBO); Map<String, Object> getGoodsInfo(int id); int addSpec(AddSpecBO addSpecBO); int deleteSpec(DeleteSpecBO deleteSpecBO); int deleteGoods(Integer id); int deleteType(Integer id); //前台数据获取 GetGoodInfoIndexVO getGoodsInfoIndex(int id); List<GetSearchGoodsVO> searchGoods(String keyword); }
e7e2db654005f29d929fda95f15446f3cddac7e8
74e4ce9502f49146a78a3b78807ddd14c2086669
/TestPackage/kiran/luv2code/contactapp/test/TestUserServiceSave.java
227f4ab5bb64ddc7dbec37c0927f733a8e37cfce
[]
no_license
Imkbhat/spring-mvc-contact-manager-application
e779edee9e2f5e04e7c5d6205d80adc3a380c099
b99be65b1a53e4683097d242b1a986d98e8cabc5
refs/heads/master
2022-12-22T19:40:36.008023
2020-01-20T05:03:25
2020-01-20T05:03:25
232,250,908
0
0
null
2022-12-16T11:18:26
2020-01-07T05:40:20
Java
UTF-8
Java
false
false
1,026
java
package kiran.luv2code.contactapp.test; import main.webapp.com.kiran.luv2code.config.SpringRootConfig; import main.webapp.com.kiran.luv2code.dao.UserDAO; import main.webapp.com.kiran.luv2code.domain.User; import main.webapp.com.kiran.luv2code.service.UserService; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; public class TestUserServiceSave { public static void main(String[] args) { ApplicationContext ctx = new AnnotationConfigApplicationContext(SpringRootConfig.class); UserService userService = ctx.getBean(UserService.class); User u = new User(); u.setName("Mangya"); u.setPassword("Mangu123"); u.setPhone("78677dsd666632"); u.setEmail("[email protected]"); u.setAddress("Bang"); u.setLogin_name("Penga"); u.setLogin_status(UserService.LOGIN_STATUS_ACTIVE);//Active u.setRole(UserService.ROLE_ADMIN);//Admin userService.registerUser(u); System.out.println("User Registration Successfull"); } }
a6abf05a515e3caa9f41a164385de98095e6fef8
4b37883f2e5da4b7fb51b947f7d429d308275241
/src/org/usfirst/frc/team339/HardwareInterfaces/transmission/Transmission_old.java
3d4a154eb4ccd3e3514026ec036b079663f62681
[]
no_license
FIRST-Team-339/KilroyTransmission
5629a353508c61025d2e5e7fa89d8cfd191bd4e3
318d0a6e9bc26575cc37dc13fe89d4978712d4b5
refs/heads/master
2020-09-16T22:16:19.849139
2017-06-16T01:04:23
2017-06-16T01:04:23
94,488,548
0
0
null
null
null
null
UTF-8
Java
false
false
19,682
java
package org.usfirst.frc.team339.HardwareInterfaces.transmission; import org.usfirst.frc.team339.HardwareInterfaces.DoubleSolenoid; import edu.wpi.first.wpilibj.DoubleSolenoid.Value; import edu.wpi.first.wpilibj.SpeedController; import edu.wpi.first.wpilibj.command.Subsystem; /** * This is base transmission class that is used to drive the robot. * It represents the drive train subsystem/assembly on the robot. * * All other transmission classes/methods derive from this class. * It sets up important variables and has a basic drive method for * a tank drive. * * @author Noah Golmant * @date 2 July 201 */ public class Transmission_old extends Subsystem { // Always eat pure-bred, free-range giraffes, never those addicted or alien // ones. // Giraffe giraffe = new Giraffe("pure bred","free range"); /** * This stores whether or not we want to spit out debug data to the console * or whatever error processing we're doing. * * @author Noah Golmant * @written 2 July 201 */ public static enum DebugState { DEBUG_NONE, DEBUG_ONLY_NON_ZERO, DEBUG_PID_DATA, DEBUG_MOTOR_DATA, DEBUG_ALL } /** * This stores the direction of a given motor and allows us * to more easily set all the motors to a value at once. * * @author Noah Golmant * @written 2 July 201 */ public static enum MotorDirection { FORWARD (1.0), REVERSED (-1.0); // Default to forward position double val = 1; MotorDirection (double i) { this.val = i; } public double value () { return this.val; } } /** * If we're using a joystick, we don't want to use the first +/- 0.1 * because it's too close to zero. So if we read a value around 0.1 from * the joystick, we probably don't want to actually send values. */ private double deadbandPercentageZone = 0.2; /** * If we want to print out extra debug info from Transmission, we can * set what kind of info we need, i.e. motor, PID, non-zero data, etc. */ private DebugState debugState = DebugState.DEBUG_NONE; /** * Whether or not the joysticks are reversed, in which case we send * the opposite value that we originally intended */ private boolean leftJoystickReversed = true; private boolean rightJoystickReversed = true; /** * ------------------------------------------------------- * * @description keeps track of which gear we are presently in. * it refers to an index of the gearPercentages array * (plus one, so that the value at position zero refers * to the first gear value) * @author Bob Brown * @written Sep 19, 2009 * @modified by Noah Golmant, 2 July 201 * Changed to reference an index of a gear percentage array * ------------------------------------------------------- */ private int gear = 3; /** * @description the max number of the physical gear if we are using one. * after this number, any gear shift will be in the software. * * @author Noah Golmant * @written 16 July 201 */ // private final int MAX_PHYSICAL_GEAR = 2; /** * @description the physical solenoids that control the physical gears * of the transmission. * * @author Noah Golmant * @written 16 July 201 */ private DoubleSolenoid transmissionSolenoids = null; /** * ------------------------------------------------------- * * @description These constants are used when the controls() function * for the transmission is called. The transmission will * use the percentage constant for the current gear to * control the output power. For example, constant of * 40 will reduce the output power in that gear to 40% * of its value prior to calling controls(). * * In other words, if you want your drive motors to run at * half speed in first gear, set firstGearPercentage equal * to 0 (percent). * * Keep in mind that a hardware transmission is in effect * between first and second gears. Therefore, it is not * unusual to have a higher percentage constant for first * gear than second gear. * @author Bob Brown * @written 17 January 2010 * * @modified by Noah Golmant, 2 July 201 * Changed to an array of percentages * to be modified with the array index(+1) * as an argument, specifying the gear * we want to change. * ------------------------------------------------------- */ private final double[] gearPercentages = {0.40, 0.70, 0.8, 0.90, 1.00}; private final int MAX_GEAR = this.gearPercentages.length; /** * Gets the highest gear available on the transmission, 0.0 - 1.0 * (or 0% through 100%, respectively) * * @return the highest gear */ public int getMaxGear () { return this.MAX_GEAR; } /** * ----------------------------------------------------------- * * @description Create the motors and the object to store whether * or not they are reversed. For the base class, we start with * two * controllers; one per side. This would work with a robot that * has two * motors per side, each pair wired with one motor controller * on the robot. * * If this class is extended to a 4-wheel drive robot, * these two refer to the front motors on the robot. * The rear motors will be referred to explicitly as * <direction>RearSpeedController. * * * * @author Noah Golmant * @written 2 July 201 * ------------------------------------------------------------ */ public SpeedController rightSpeedController = null; private MotorDirection rightMotorDirection = MotorDirection.FORWARD; public SpeedController leftSpeedController = null; private MotorDirection leftMotorDirection = MotorDirection.FORWARD; /** * Initialize a new transmission with two base speed controllers. * No encoders are set up with this constructor. * * @param rightSpeedController * Right (front) speed controller * @param leftSpeedController * Left (front) speed controller * * @author Noah Golmant * @written 2 July 201 */ public Transmission_old (SpeedController rightSpeedController, SpeedController leftSpeedController) { this.rightSpeedController = rightSpeedController; this.leftSpeedController = leftSpeedController; } /** * Initialize a new transmission with two base speed controllers. * No encoders are set up with this constructor. * This includes a physical transmission for gear control. * * @param rightSpeedController * Right (front) speed controller * @param leftSpeedController * Left (front) speed controller * * @param transmissionSolenoids * physical transmission for gear control * * @author Noah Golmant * @written 2 July 201 */ public Transmission_old (SpeedController rightSpeedController, SpeedController leftSpeedController, DoubleSolenoid transmissionSolenoids) { this.transmissionSolenoids = transmissionSolenoids; this.rightSpeedController = rightSpeedController; this.leftSpeedController = leftSpeedController; } /** * Move the transmission gear down one. * * @see setGear() * * @author Noah Golmant * @written 16 July 201 */ public void downshift () { this.setGear(this.gear - 1); } /** * Drives the transmission in a tank drive . * rightJoystickVal controls both right motors, and vice versa for the left. * It scales it according to our deadband and the current gear, then * makes sure we're not out of our allowed motor value ranges. * * @param rightJoystickVal * joystick input for the right motor(s) * @param leftJoystickVal * joystick input for the left motor(s) * * @author Noah Golmant * @written 9 July 201 */ public void drive (double rightJoystickVal, double leftJoystickVal) { // Get the scaled versions of our joystick values double scaledRightVal = this.scaleJoystickValue(rightJoystickVal); double scaledLeftVal = this.scaleJoystickValue(leftJoystickVal); // Make sure they fit within our allowed motor ranges (just in case) // make them a max/min of +1.0/-1.0 to send to the motor scaledRightVal = this.limit(scaledRightVal); scaledLeftVal = this.limit(scaledLeftVal); // check if either joystick is reversed if (this.isLeftJoystickReversed() == true) { scaledRightVal *= -1.0; } if (this.isRightJoystickReversed() == true) { scaledLeftVal *= -1.0; } if ((this.getDebugState() == DebugState.DEBUG_MOTOR_DATA) || (this.getDebugState() == DebugState.DEBUG_ALL)) { System.out .println("drive():\tRF: " + scaledRightVal + "\tLF: " + scaledLeftVal); } // send the scaled values to the motors this.driveRightMotor(scaledRightVal); this.driveLeftMotor(scaledLeftVal); } /** * Sets the left motor to the given value based on * its given direction. * * @param motorValue * The motor value we want to send * * @author Noah Golmant * @date 9 July 201 */ public void driveLeftMotor (double motorValue) { if (this.leftSpeedController == null) { if ((this.getDebugState() == DebugState.DEBUG_MOTOR_DATA) || (this.getDebugState() == DebugState.DEBUG_ALL)) { System.out .println( "Left (front) motor is null in driveLeftMotor()"); } return; } motorValue = this.limit(motorValue); this.leftSpeedController .set(motorValue * this.leftMotorDirection.val); } /** * Sets the right motor to the given value based on * its given direction. * * @param motorValue * The motor value we want to send * * @author Noah Golmant * @date 9 July 201 */ public void driveRightMotor (double motorValue) { if (this.rightSpeedController == null) { if ((this.getDebugState() == DebugState.DEBUG_MOTOR_DATA) || (this.getDebugState() == DebugState.DEBUG_ALL)) { System.out .println( "Right (front) motor is null in driveRightMotor()"); } return; } motorValue = this.limit(motorValue); this.rightSpeedController .set(motorValue * this.rightMotorDirection.val); } public double getCurrentGearPercentage () { return this.getGearPercentage(this.getGear()); } /** * Gets the current deadband of the joystick; if a joystick motor val is * inside * this range (e.g. -.1 to +.1) we just send 0 to the motor. * * @return */ protected double getDeadbandPercentageZone () { return this.deadbandPercentageZone; } /** * Gets the current debug state (what data we want to print out) * * @return Current debug state as a member of the DebugState enum * * @author Noah Golmant * @written 9 July 201 */ public DebugState getDebugState () { return this.debugState; } /** * Gets the current gear of the transmission. * * @return the current gear */ public int getGear () { return this.gear; } /** * Gets the maximum motor value of the given gear. * The gear should be within the range of gears we have (1 to ) * * @param gear * The gear we want to get the maximum value of * @return The maximum value for the given percentage * * @author Noah Golmant * @written 9 July 201 */ public double getGearPercentage (int gear) { if ((gear < 1) || (gear > this.MAX_GEAR)) { if (this.debugState == DebugState.DEBUG_MOTOR_DATA) { System.out .println( "Invalid gear to set in getGearPercentage()"); } return 0.0; } return this.gearPercentages[gear - 1]; } /** * Gets whether or not the left motor is reversed * * @return the direction of the left (front) motor */ public MotorDirection getLeftMotorDirection () { return this.leftMotorDirection; } /** * Gets whether or not the right motor is reversed * * @return the direction of the right (front) motor */ public MotorDirection getRightMotorDirection () { return this.rightMotorDirection; } @Override public void initDefaultCommand () { // Set the default command for a subsystem here. // setDefaultCommand(new MySpecialCommand()); } /** * Gets whether or not the left joystick is reversed * * @return true if the left joystick is reversed */ public boolean isLeftJoystickReversed () { return this.leftJoystickReversed; } /** * Gets whether or not the right joystick is reversed * * @return true if the right joystick is reversed */ public boolean isRightJoystickReversed () { return this.rightJoystickReversed; } /** * Limits any motor value between -1.0 and 1.0 * * @param val * Motor value to limit * @return limited motor value * * @author Noah * @written 9 July 201 */ protected double limit (double val) { if (val > 1.0) { val = 1.0; } if (val < -1.0) { val = -1.0; } return val; } /** * Scales the input joystick value based on the actual range of values * we accept from the joystick. i.e. if we have a deadband that prevents * values between -0.1 and +0.1, then it will scale the value so that * an input of .1 to 1.0 will provide the same range as 0 to 1. * * @param joystickValue * original, unscaled input joystick value * @return a new input for motors, scaled based on the deadband range * and the current maximum gear percentage. * * @author Noah Golmant * @written 9 July 201 */ public double scaleJoystickValue (double joystickValue) { final double maxCurrentGearValue = this.getCurrentGearPercentage(); // --------------------------------------------------------------- // This gets the difference between our // absolutized input value and the deadband zone. // If it's lower than zero, this means that it's too small // to do anything with. Otherwise, we have a good value to scale. // --------------------------------------------------------------- final double absJoystickInputValue = java.lang.Math.max( (Math.abs(joystickValue) - this.deadbandPercentageZone), 0.0); // ----------------------------------------- // The range of values we will actually use // ----------------------------------------- final double deadbandRange = 1.0 - this.deadbandPercentageZone; // ------------------------------------------------- // Compute the final scaled joystick value. // Scales it by the ratio of the max gear value to // the deadband range. // ------------------------------------------------- final double scaledJoystickInput = absJoystickInputValue * (maxCurrentGearValue / deadbandRange); // ------------------------------------------------------- // Since we previously absolutized it, return a negative // motor value if the original input was negative. // ------------------------------------------------------- if (joystickValue < 0) return -scaledJoystickInput; return scaledJoystickInput; } /** * Sets the debug state of transmission. This determines what info * we want to print out. See the DebugState enum. * * @param newState * The new debug state we want to use. * * @author Noah Golmant * @written 9 July 201 */ public void setDebugState (DebugState newState) { this.debugState = newState; } /** * Sets the deadband percentage to use for the joysticks. * * @param percentage * new percentage to set the deadband to * * @author Ryan McGee * @written 2/11/17 */ public void setDeadbandPercentageZone (double percentage) { this.deadbandPercentageZone = percentage; } /** * Set the current gear of the transmission. If we have a * physical transmission and we set it within that gear range, * we adjust the solenoid accordingly. * * @param gear * new gear to set the transmission to * * @author Noah Golmant * @written 16 July 201 */ public void setGear (int gear) { if ((gear < 1) || (gear > this.MAX_GEAR)) { if ((this.getDebugState() == DebugState.DEBUG_MOTOR_DATA) || (this.getDebugState() == DebugState.DEBUG_ALL)) { System.out.println("Failed to set gear " + gear + "in setGear()"); } return; } this.gear = gear; // check for a physical transmission if (this.transmissionSolenoids != null) { switch (gear) { case 1: this.transmissionSolenoids.set(Value.kForward); break; case 2: this.transmissionSolenoids.set(Value.kReverse); break; default: this.transmissionSolenoids.set(Value.kOff); break; } } } /** * @description Sets the gear in the gears array to a new value. * If the gear is out of the range, we don't do anything. * We limit the values between -1 and +1. * * @param gear * The gear we want to set (1=first, 2=second ... =fifth) * @param value * The maximum motor value of the given gear. * * @written Noah Golmant * @date 9 July 201 */ public void setGearPercentage (int gear, double value) { // Make sure we're not outside the actual range of gears we have if ((gear < 1) || (gear > this.MAX_GEAR)) { if (this.debugState == DebugState.DEBUG_MOTOR_DATA) { System.out.println("Failed to set gear " + gear + "in setGearPercentage()"); } return; } // Check max/min gear percentage values we will allow if (value > 1.0) { value = 1.0; } else if (value < this.deadbandPercentageZone) { value = this.deadbandPercentageZone; } // Set the new gear percentage in our gear array this.gearPercentages[gear - 1] = value; } /** * Sets whether or not the left joystick is reversed * * @param isReversed * true if the joystick is reversed * * @author Noah Golmant * @written 30 July 2015 */ public void setLeftJoystickReversed (boolean isReversed) { this.leftJoystickReversed = isReversed; } /** * Sets whether or not the left (front) motor is reversed * * @param direction * new direction of the left (front) motor */ public void setLeftMotorDirection (MotorDirection direction) { this.leftMotorDirection = direction; } /** * Sets whether or not the left joystick is reversed * * @param isReversed * true if the joystick is reversed * * @author Noah Golmant * @written 30 July 2015 */ public void setRightJoystickReversed (boolean isReversed) { this.rightJoystickReversed = isReversed; } /** * Sets whether or not the right (front) motor is reversed * * @param direction * new direction of the right (front) motor */ public void setRightMotorDirection (MotorDirection direction) { this.rightMotorDirection = direction; } /** * Move the transmission gear up one. * * @see setGear() * * @author Noah Golmant * @written 16 July 201 */ public void upshift () { this.setGear(this.gear + 1); } }
aa1d3732fcbb4f42cace676d74df7178dfd6f1e3
a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb
/sas-20181203/src/main/java/com/aliyun/sas20181203/models/DescribeFrontVulPatchListResponse.java
338aa4862a54bffb30101dabe88781b0dfdf9b59
[ "Apache-2.0" ]
permissive
aliyun/alibabacloud-java-sdk
83a6036a33c7278bca6f1bafccb0180940d58b0b
008923f156adf2e4f4785a0419f60640273854ec
refs/heads/master
2023-09-01T04:10:33.640756
2023-09-01T02:40:45
2023-09-01T02:40:45
288,968,318
40
45
null
2023-06-13T02:47:13
2020-08-20T09:51:08
Java
UTF-8
Java
false
false
1,467
java
// This file is auto-generated, don't edit it. Thanks. package com.aliyun.sas20181203.models; import com.aliyun.tea.*; public class DescribeFrontVulPatchListResponse extends TeaModel { @NameInMap("headers") @Validation(required = true) public java.util.Map<String, String> headers; @NameInMap("statusCode") @Validation(required = true) public Integer statusCode; @NameInMap("body") @Validation(required = true) public DescribeFrontVulPatchListResponseBody body; public static DescribeFrontVulPatchListResponse build(java.util.Map<String, ?> map) throws Exception { DescribeFrontVulPatchListResponse self = new DescribeFrontVulPatchListResponse(); return TeaModel.build(map, self); } public DescribeFrontVulPatchListResponse setHeaders(java.util.Map<String, String> headers) { this.headers = headers; return this; } public java.util.Map<String, String> getHeaders() { return this.headers; } public DescribeFrontVulPatchListResponse setStatusCode(Integer statusCode) { this.statusCode = statusCode; return this; } public Integer getStatusCode() { return this.statusCode; } public DescribeFrontVulPatchListResponse setBody(DescribeFrontVulPatchListResponseBody body) { this.body = body; return this; } public DescribeFrontVulPatchListResponseBody getBody() { return this.body; } }
e69a7f5094e13ff426b8d2a53eae2110bf5b5b5a
8238bc5b3398bca1bdfab9a18225eb3fbd893cfd
/baselibrary/src/main/java/com/fy/base/BaseBean.java
da0788f19cc0d9e11301a5814d8a76b3017d5ddc
[]
no_license
SetAdapter/MoveNurse
2a890ff9a456b9284df69f44fe2616bb306de386
c4770363d3b136cbe1a3cf1237d39c07151be2af
refs/heads/master
2020-04-23T14:02:05.946825
2019-02-18T05:12:30
2019-02-18T05:12:30
171,218,203
0
0
null
null
null
null
UTF-8
Java
false
false
170
java
package com.fy.base; import java.io.Serializable; /** * 序列化对象基类 * Created by fangs on 2017/3/13. */ public class BaseBean implements Serializable { }
f40650d4c5fd31b07aa15f96d3ada2b0b48c445a
d1896e2fa56c8bdde440e99dbfe908c2e05d560e
/sheldon/Station.java
d632fa497ee02a432b3898d7dcefd07ff32f8044
[]
no_license
kovacs-daniel-kristof/ProjLab
f19cda763f6cae00c48a079db45ecd2e213c60de
c9fb86554e4b1b99e5bec0ac333e7ffe280a2e39
refs/heads/master
2021-01-19T18:30:37.298050
2017-04-18T18:57:00
2017-04-18T18:57:00
88,361,227
0
2
null
2017-04-18T18:57:01
2017-04-15T16:56:48
Roff
UTF-8
Java
false
false
501
java
package sheldon; public class Station extends Rail { public Station(){ } Color myColor; public boolean CompareColors (){ System.out.println("Yes the color is matching! We both swept right ;) - claimed the station to the carriage"); return true; } public boolean GetOffTheTrain (){ System.out.println("The passangers can get off this carriage! - it is mine, not yours. - ordered the station, to the astonished passangers"); return true; } public void changecolor (Color c){ myColor = c; } }
[ "Kovács Dániel" ]
Kovács Dániel
a0f044c00c51362361ad89a0e3f23b2d16c8cf28
d8cc40718b7af0193479a233a21ea2f03c792764
/aws-java-sdk-directconnect/src/main/java/com/amazonaws/services/directconnect/model/AllocateHostedConnectionResult.java
d61a7e7f8b9357276d5880f170cd0fe5a15bfe28
[ "Apache-2.0" ]
permissive
chaoweimt/aws-sdk-java
1de8c0aeb9aa52931681268cd250ca2af59a83d9
f11d648b62f2615858e2f0c2e5dd69e77a91abd3
refs/heads/master
2021-01-22T03:18:33.038352
2017-05-24T22:40:24
2017-05-24T22:40:24
92,371,194
1
0
null
2017-05-25T06:13:36
2017-05-25T06:13:35
null
UTF-8
Java
false
false
19,334
java
/* * Copyright 2012-2017 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.directconnect.model; import java.io.Serializable; import javax.annotation.Generated; /** * <p> * A connection represents the physical network connection between the AWS Direct Connect location and the customer. * </p> * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/directconnect-2012-10-25/AllocateHostedConnection" * target="_top">AWS API Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AllocateHostedConnectionResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable { /** * <p> * The AWS account that will own the new connection. * </p> */ private String ownerAccount; private String connectionId; private String connectionName; private String connectionState; private String region; private String location; /** * <p> * Bandwidth of the connection. * </p> * <p> * Example: 1Gbps (for regular connections), or 500Mbps (for hosted connections) * </p> * <p> * Default: None * </p> */ private String bandwidth; private Integer vlan; /** * <p> * The name of the AWS Direct Connect service provider associated with the connection. * </p> */ private String partnerName; /** * <p> * The time of the most recent call to <a>DescribeLoa</a> for this connection. * </p> */ private java.util.Date loaIssueTime; private String lagId; /** * <p> * The Direct Connection endpoint which the physical connection terminates on. * </p> */ private String awsDevice; /** * <p> * The AWS account that will own the new connection. * </p> * * @param ownerAccount * The AWS account that will own the new connection. */ public void setOwnerAccount(String ownerAccount) { this.ownerAccount = ownerAccount; } /** * <p> * The AWS account that will own the new connection. * </p> * * @return The AWS account that will own the new connection. */ public String getOwnerAccount() { return this.ownerAccount; } /** * <p> * The AWS account that will own the new connection. * </p> * * @param ownerAccount * The AWS account that will own the new connection. * @return Returns a reference to this object so that method calls can be chained together. */ public AllocateHostedConnectionResult withOwnerAccount(String ownerAccount) { setOwnerAccount(ownerAccount); return this; } /** * @param connectionId */ public void setConnectionId(String connectionId) { this.connectionId = connectionId; } /** * @return */ public String getConnectionId() { return this.connectionId; } /** * @param connectionId * @return Returns a reference to this object so that method calls can be chained together. */ public AllocateHostedConnectionResult withConnectionId(String connectionId) { setConnectionId(connectionId); return this; } /** * @param connectionName */ public void setConnectionName(String connectionName) { this.connectionName = connectionName; } /** * @return */ public String getConnectionName() { return this.connectionName; } /** * @param connectionName * @return Returns a reference to this object so that method calls can be chained together. */ public AllocateHostedConnectionResult withConnectionName(String connectionName) { setConnectionName(connectionName); return this; } /** * @param connectionState * @see ConnectionState */ public void setConnectionState(String connectionState) { this.connectionState = connectionState; } /** * @return * @see ConnectionState */ public String getConnectionState() { return this.connectionState; } /** * @param connectionState * @return Returns a reference to this object so that method calls can be chained together. * @see ConnectionState */ public AllocateHostedConnectionResult withConnectionState(String connectionState) { setConnectionState(connectionState); return this; } /** * @param connectionState * @see ConnectionState */ public void setConnectionState(ConnectionState connectionState) { this.connectionState = connectionState.toString(); } /** * @param connectionState * @return Returns a reference to this object so that method calls can be chained together. * @see ConnectionState */ public AllocateHostedConnectionResult withConnectionState(ConnectionState connectionState) { setConnectionState(connectionState); return this; } /** * @param region */ public void setRegion(String region) { this.region = region; } /** * @return */ public String getRegion() { return this.region; } /** * @param region * @return Returns a reference to this object so that method calls can be chained together. */ public AllocateHostedConnectionResult withRegion(String region) { setRegion(region); return this; } /** * @param location */ public void setLocation(String location) { this.location = location; } /** * @return */ public String getLocation() { return this.location; } /** * @param location * @return Returns a reference to this object so that method calls can be chained together. */ public AllocateHostedConnectionResult withLocation(String location) { setLocation(location); return this; } /** * <p> * Bandwidth of the connection. * </p> * <p> * Example: 1Gbps (for regular connections), or 500Mbps (for hosted connections) * </p> * <p> * Default: None * </p> * * @param bandwidth * Bandwidth of the connection.</p> * <p> * Example: 1Gbps (for regular connections), or 500Mbps (for hosted connections) * </p> * <p> * Default: None */ public void setBandwidth(String bandwidth) { this.bandwidth = bandwidth; } /** * <p> * Bandwidth of the connection. * </p> * <p> * Example: 1Gbps (for regular connections), or 500Mbps (for hosted connections) * </p> * <p> * Default: None * </p> * * @return Bandwidth of the connection.</p> * <p> * Example: 1Gbps (for regular connections), or 500Mbps (for hosted connections) * </p> * <p> * Default: None */ public String getBandwidth() { return this.bandwidth; } /** * <p> * Bandwidth of the connection. * </p> * <p> * Example: 1Gbps (for regular connections), or 500Mbps (for hosted connections) * </p> * <p> * Default: None * </p> * * @param bandwidth * Bandwidth of the connection.</p> * <p> * Example: 1Gbps (for regular connections), or 500Mbps (for hosted connections) * </p> * <p> * Default: None * @return Returns a reference to this object so that method calls can be chained together. */ public AllocateHostedConnectionResult withBandwidth(String bandwidth) { setBandwidth(bandwidth); return this; } /** * @param vlan */ public void setVlan(Integer vlan) { this.vlan = vlan; } /** * @return */ public Integer getVlan() { return this.vlan; } /** * @param vlan * @return Returns a reference to this object so that method calls can be chained together. */ public AllocateHostedConnectionResult withVlan(Integer vlan) { setVlan(vlan); return this; } /** * <p> * The name of the AWS Direct Connect service provider associated with the connection. * </p> * * @param partnerName * The name of the AWS Direct Connect service provider associated with the connection. */ public void setPartnerName(String partnerName) { this.partnerName = partnerName; } /** * <p> * The name of the AWS Direct Connect service provider associated with the connection. * </p> * * @return The name of the AWS Direct Connect service provider associated with the connection. */ public String getPartnerName() { return this.partnerName; } /** * <p> * The name of the AWS Direct Connect service provider associated with the connection. * </p> * * @param partnerName * The name of the AWS Direct Connect service provider associated with the connection. * @return Returns a reference to this object so that method calls can be chained together. */ public AllocateHostedConnectionResult withPartnerName(String partnerName) { setPartnerName(partnerName); return this; } /** * <p> * The time of the most recent call to <a>DescribeLoa</a> for this connection. * </p> * * @param loaIssueTime * The time of the most recent call to <a>DescribeLoa</a> for this connection. */ public void setLoaIssueTime(java.util.Date loaIssueTime) { this.loaIssueTime = loaIssueTime; } /** * <p> * The time of the most recent call to <a>DescribeLoa</a> for this connection. * </p> * * @return The time of the most recent call to <a>DescribeLoa</a> for this connection. */ public java.util.Date getLoaIssueTime() { return this.loaIssueTime; } /** * <p> * The time of the most recent call to <a>DescribeLoa</a> for this connection. * </p> * * @param loaIssueTime * The time of the most recent call to <a>DescribeLoa</a> for this connection. * @return Returns a reference to this object so that method calls can be chained together. */ public AllocateHostedConnectionResult withLoaIssueTime(java.util.Date loaIssueTime) { setLoaIssueTime(loaIssueTime); return this; } /** * @param lagId */ public void setLagId(String lagId) { this.lagId = lagId; } /** * @return */ public String getLagId() { return this.lagId; } /** * @param lagId * @return Returns a reference to this object so that method calls can be chained together. */ public AllocateHostedConnectionResult withLagId(String lagId) { setLagId(lagId); return this; } /** * <p> * The Direct Connection endpoint which the physical connection terminates on. * </p> * * @param awsDevice * The Direct Connection endpoint which the physical connection terminates on. */ public void setAwsDevice(String awsDevice) { this.awsDevice = awsDevice; } /** * <p> * The Direct Connection endpoint which the physical connection terminates on. * </p> * * @return The Direct Connection endpoint which the physical connection terminates on. */ public String getAwsDevice() { return this.awsDevice; } /** * <p> * The Direct Connection endpoint which the physical connection terminates on. * </p> * * @param awsDevice * The Direct Connection endpoint which the physical connection terminates on. * @return Returns a reference to this object so that method calls can be chained together. */ public AllocateHostedConnectionResult withAwsDevice(String awsDevice) { setAwsDevice(awsDevice); return this; } /** * Returns a string representation of this object; useful for testing and debugging. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getOwnerAccount() != null) sb.append("OwnerAccount: ").append(getOwnerAccount()).append(","); if (getConnectionId() != null) sb.append("ConnectionId: ").append(getConnectionId()).append(","); if (getConnectionName() != null) sb.append("ConnectionName: ").append(getConnectionName()).append(","); if (getConnectionState() != null) sb.append("ConnectionState: ").append(getConnectionState()).append(","); if (getRegion() != null) sb.append("Region: ").append(getRegion()).append(","); if (getLocation() != null) sb.append("Location: ").append(getLocation()).append(","); if (getBandwidth() != null) sb.append("Bandwidth: ").append(getBandwidth()).append(","); if (getVlan() != null) sb.append("Vlan: ").append(getVlan()).append(","); if (getPartnerName() != null) sb.append("PartnerName: ").append(getPartnerName()).append(","); if (getLoaIssueTime() != null) sb.append("LoaIssueTime: ").append(getLoaIssueTime()).append(","); if (getLagId() != null) sb.append("LagId: ").append(getLagId()).append(","); if (getAwsDevice() != null) sb.append("AwsDevice: ").append(getAwsDevice()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AllocateHostedConnectionResult == false) return false; AllocateHostedConnectionResult other = (AllocateHostedConnectionResult) obj; if (other.getOwnerAccount() == null ^ this.getOwnerAccount() == null) return false; if (other.getOwnerAccount() != null && other.getOwnerAccount().equals(this.getOwnerAccount()) == false) return false; if (other.getConnectionId() == null ^ this.getConnectionId() == null) return false; if (other.getConnectionId() != null && other.getConnectionId().equals(this.getConnectionId()) == false) return false; if (other.getConnectionName() == null ^ this.getConnectionName() == null) return false; if (other.getConnectionName() != null && other.getConnectionName().equals(this.getConnectionName()) == false) return false; if (other.getConnectionState() == null ^ this.getConnectionState() == null) return false; if (other.getConnectionState() != null && other.getConnectionState().equals(this.getConnectionState()) == false) return false; if (other.getRegion() == null ^ this.getRegion() == null) return false; if (other.getRegion() != null && other.getRegion().equals(this.getRegion()) == false) return false; if (other.getLocation() == null ^ this.getLocation() == null) return false; if (other.getLocation() != null && other.getLocation().equals(this.getLocation()) == false) return false; if (other.getBandwidth() == null ^ this.getBandwidth() == null) return false; if (other.getBandwidth() != null && other.getBandwidth().equals(this.getBandwidth()) == false) return false; if (other.getVlan() == null ^ this.getVlan() == null) return false; if (other.getVlan() != null && other.getVlan().equals(this.getVlan()) == false) return false; if (other.getPartnerName() == null ^ this.getPartnerName() == null) return false; if (other.getPartnerName() != null && other.getPartnerName().equals(this.getPartnerName()) == false) return false; if (other.getLoaIssueTime() == null ^ this.getLoaIssueTime() == null) return false; if (other.getLoaIssueTime() != null && other.getLoaIssueTime().equals(this.getLoaIssueTime()) == false) return false; if (other.getLagId() == null ^ this.getLagId() == null) return false; if (other.getLagId() != null && other.getLagId().equals(this.getLagId()) == false) return false; if (other.getAwsDevice() == null ^ this.getAwsDevice() == null) return false; if (other.getAwsDevice() != null && other.getAwsDevice().equals(this.getAwsDevice()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getOwnerAccount() == null) ? 0 : getOwnerAccount().hashCode()); hashCode = prime * hashCode + ((getConnectionId() == null) ? 0 : getConnectionId().hashCode()); hashCode = prime * hashCode + ((getConnectionName() == null) ? 0 : getConnectionName().hashCode()); hashCode = prime * hashCode + ((getConnectionState() == null) ? 0 : getConnectionState().hashCode()); hashCode = prime * hashCode + ((getRegion() == null) ? 0 : getRegion().hashCode()); hashCode = prime * hashCode + ((getLocation() == null) ? 0 : getLocation().hashCode()); hashCode = prime * hashCode + ((getBandwidth() == null) ? 0 : getBandwidth().hashCode()); hashCode = prime * hashCode + ((getVlan() == null) ? 0 : getVlan().hashCode()); hashCode = prime * hashCode + ((getPartnerName() == null) ? 0 : getPartnerName().hashCode()); hashCode = prime * hashCode + ((getLoaIssueTime() == null) ? 0 : getLoaIssueTime().hashCode()); hashCode = prime * hashCode + ((getLagId() == null) ? 0 : getLagId().hashCode()); hashCode = prime * hashCode + ((getAwsDevice() == null) ? 0 : getAwsDevice().hashCode()); return hashCode; } @Override public AllocateHostedConnectionResult clone() { try { return (AllocateHostedConnectionResult) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }
[ "" ]
75e345fbd18bc0fd758ff7e07a8b1e2445330795
27835b326965575e47e91e7089b918b642a91247
/src/by/it/markelov/jd01_07/Scalar.java
d96f1701c7ce37d2780e34808ce7959b083f1112
[]
no_license
s-karpovich/JD2018-11-13
c3bc03dc6268d52fd8372641b12c341aa3a3e11f
5f5be48cb1619810950a629c47e46d186bf1ad93
refs/heads/master
2020-04-07T19:54:15.964875
2019-04-01T00:37:29
2019-04-01T00:37:29
158,667,895
2
0
null
2018-11-22T08:40:16
2018-11-22T08:40:16
null
UTF-8
Java
false
false
466
java
package by.it.markelov.jd01_07; class Scalar extends Var { private double value; public Scalar(double value) { this.value = value; } public Scalar(Scalar scalar) { value = scalar.value; } public Scalar(String str) { value = Double.parseDouble(str); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(value); return sb.toString(); } }
9eda36621aabb7c1159e808aafa0afbd059f43b7
c19434176744ea4d703e1ccfd56b6c82ffaf0f01
/OOPM(Java)/MultiThreading/MultiThreading.java
83261a22a8d76a31aa7b52046e9d7a95657e66e2
[]
no_license
DivitaP/SEM3-folders
3c6b738ddd4f141f0f280f418cf2c895600cb441
8eb8f76fa1baefe316e977d1108bd2dfc56697d6
refs/heads/master
2022-11-08T09:36:42.839373
2020-06-20T17:12:55
2020-06-20T17:12:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
310
java
import java.util.*; import java.lang.*; class MultiThreading extends Thread { public void run() { System.out.println("\n Hello world \n"); } public static void main(String args[]) { MultiThreading obj = new MultiThreading(); obj.start(); } } /*OUTPUT: Hello world */
450d393c6e72c9b9ad0c7cfca843bde54aa1bced
b19810ef6a7e08bb5510c0b36ef9ecb68691684c
/xdong-dal/src/main/java/com/xdong/dal/blog/BlogContentMapper.java
4b63689285f40d7aa90207f718db919940a8add6
[]
no_license
wlstone119/xdong
8eb4c928ba6e880e457452721bb4076676df00be
0ec8a88f5e6e9add4ab76557fc178643427bba3e
refs/heads/master
2020-03-14T07:37:45.148444
2019-01-30T07:34:24
2019-01-30T07:34:24
131,508,152
0
0
null
null
null
null
UTF-8
Java
false
false
301
java
package com.xdong.dal.blog; import com.baomidou.mybatisplus.mapper.BaseMapper; import com.xdong.model.entity.blog.BlogContentDo; /** * <p> * 文章内容 Mapper 接口 * </p> * * @author wanglei * @since 2018-04-30 */ public interface BlogContentMapper extends BaseMapper<BlogContentDo> { }
66eb70c17c20cf26947a48f239ec21c76de22cbd
57b24110898a656b174e4e597c8a26b7af1816c7
/aws-storage-s3/src/androidTest/java/com/amplifyframework/storage/s3/TestStorageCategory.java
7a502afe1a3ae896cd261f515472ed1c49587be0
[ "Apache-2.0" ]
permissive
ingenieursaurav/amplify-android
e323c6589d5a2b35f450336d41d5c1bf49619013
077d2664420807739c987fadbce5a29e8b8c31e2
refs/heads/master
2022-07-28T11:06:32.666921
2020-05-14T23:31:37
2020-05-14T23:31:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,258
java
/* * Copyright 2020 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.amplifyframework.storage.s3; import android.content.Context; import androidx.annotation.NonNull; import androidx.annotation.RawRes; import com.amplifyframework.AmplifyException; import com.amplifyframework.core.AmplifyConfiguration; import com.amplifyframework.core.category.CategoryConfiguration; import com.amplifyframework.core.category.CategoryType; import com.amplifyframework.storage.StorageCategory; import java.util.Objects; /** * Factory for creating {@link StorageCategory} instance suitable for test. */ final class TestStorageCategory { private TestStorageCategory() {} /** * Creates an instance of {@link StorageCategory} using the provided configuration resource. * @param context Android Context * @param resourceId Android resource ID for a configuration file * @return A StorageCategory instance using the provided configuration */ static StorageCategory create(@NonNull Context context, @RawRes int resourceId) { Objects.requireNonNull(context); final StorageCategory storageCategory = new StorageCategory(); try { storageCategory.addPlugin(new AWSS3StoragePlugin()); CategoryConfiguration storageConfiguration = AmplifyConfiguration.fromConfigFile(context, resourceId) .forCategoryType(CategoryType.STORAGE); storageCategory.configure(storageConfiguration, context); // storageCategory.initialize(context); // Doesn't do anything right now. } catch (AmplifyException initializationFailure) { throw new RuntimeException(initializationFailure); } return storageCategory; } }
6bdd9ea430ddb8caf9e88e12a258e91f578ee084
5489f95560a646f7ee89faa08a6c558055713746
/eureka-consumer/src/main/java/com/cloudnative/ProductDetailController.java
befdf20a5314f57dee4e9c3457454f7b56e5677b
[]
no_license
rickiechina/CloudNative
f9050267e0d118b792b543a126f209ff1f929168
83cbb77f7c0b6095cfc3b37854bb9d5dd0fb1f38
refs/heads/master
2020-05-16T22:20:05.640491
2019-04-26T11:10:28
2019-04-26T11:10:28
183,333,269
3
5
null
null
null
null
UTF-8
Java
false
false
1,661
java
package com.cloudnative; import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; @RestController public class ProductDetailController { @Autowired RestTemplate restTemplate; @RequestMapping(value = "/detail/{id}",method = RequestMethod.GET) @HystrixCommand(fallbackMethod = "getFallback", commandProperties = { @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "500"),//指定超时时间,单位毫秒。超时进fallback @HystrixProperty(name = "circuitBreaker.requestVolumeThreshold", value = "2"),//判断熔断的最少请求数,默认是10;只有在一个统计窗口内处理的请求数量达到这个阈值,才会进行熔断与否的判断 } ) public String getProductDetail(@PathVariable long id){ System.out.println("getProductDetail:id = [" + id + "]"); return restTemplate.getForEntity("http://PROVIDER/price/"+id,String.class).getBody(); } protected String getFallback(long id,Throwable throwable) { System.out.println("getFallback:id = [" + id + "], throwable = [" + throwable + "]"); return "error" +id; } }
6534887e7b445f77579d7ceece88c8566b0b8fdb
d9958f03e60b0121945e2bc7b4ddd79f1a5245ce
/src/main/java/pl/konczak/tries/ihe/pharm/AdxpDelimiter.java
a056fc65906505c26462cd130321a458129120da
[ "Apache-2.0" ]
permissive
chuddyni/jaxb-pl-hl7-tries
d181d0e2f8487d29a520ac68b47b6ce14a63891f
d8322a630381de5911348cb9708e5b68d55dfa33
refs/heads/master
2023-03-18T11:20:38.922488
2020-06-15T20:50:45
2020-06-15T20:52:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
794
java
package pl.konczak.tries.ihe.pharm; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for adxp.delimiter complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="adxp.delimiter"&gt; * &lt;complexContent&gt; * &lt;restriction base="{urn:ihe:pharm}ADXP"&gt; * &lt;attribute name="partType" type="{urn:ihe:pharm}AddressPartType" fixed="DEL" /&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "adxp.delimiter") public class AdxpDelimiter extends ADXP { }
5fe93a85b14ead4d4eb9a663f5e567f68f924f0c
04aad5e9d3cb9163ef6eefae94768c6742fe0e4b
/labS1/src/main/java/company/nontermonal_alphabet/nums/columns/triple/OneOneZero.java
31237e5e147c601c50111fa130e8d2c46fa92878
[]
no_license
antey13/lab1
e4c9776f0b14937b7f9145056a6a152747fdd433
b732af4af7fe31f77303008d19cd7d794949c0df
refs/heads/master
2022-07-18T23:25:29.896742
2020-05-22T10:48:06
2020-05-22T10:48:06
265,507,000
0
0
null
null
null
null
UTF-8
Java
false
false
961
java
package company.nontermonal_alphabet.nums.columns.triple; import company.nontermonal_alphabet.Type; import company.nontermonal_alphabet.WhiteColumn; import company.nontermonal_alphabet.WhiteRow; import company.nontermonal_alphabet.nums.ZeroWhite; import company.nontermonal_alphabet.nums.columns.two.OneOne; import org.javatuples.Pair; public class OneOneZero extends Type { private static OneOneZero oneOneZero; public static OneOneZero getInstance() { if(oneOneZero == null) oneOneZero = new OneOneZero(); return oneOneZero; } private OneOneZero() { this.vRules = new Pair[]{new Pair<>( OneOne.getInstance(), ZeroWhite.getInstance()), Pair.with(this, WhiteRow.getInstance()), Pair.with( WhiteRow.getInstance(), this)}; this.hRules = new Pair[]{new Pair<>(this, WhiteColumn.getInstance()), Pair.with( WhiteColumn.getInstance(), this)}; this.rename = new Type[]{}; } }
3d97d3983a488aeb28ccdc798030f2f23856df84
503a9d7c0f9b3351a52debfbede3c0d43ce3af15
/AutomationRooms/src/actuator/LightActuatorRessource.java
ee219aef3c14b085fa001bd768d171d2960bdda4
[]
no_license
aXaile/SOA
ac97a5e47ed45ba460a4143f3faf77975fe7ceb6
3407923ad44fe4413bd80602733aabcea85e27cc
refs/heads/master
2020-04-14T23:18:45.821726
2019-01-28T20:04:24
2019-01-28T20:04:24
164,197,968
0
0
null
null
null
null
UTF-8
Java
false
false
737
java
package actuator; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; @Path("lightActionner") public class LightActuatorRessource { @GET @Produces(MediaType.TEXT_PLAIN) public String getEtatDeLaLumiere(){ LightActuator lightActuator = new LightActuator(); return lightActuator.getEtatDeLaLumiere(); } @PUT @Path("/{etatDeLaLampe}") @Consumes(MediaType.TEXT_PLAIN) public void setEtatDeLaLumiere(@PathParam("etatDeLaLampe") boolean etat){ LightActuator lightActuator = new LightActuator(); lightActuator.setEtatDeLaLumiere(etat); } }
1de0916bdf75de162ea2e6d1e4e05ea978dfeb91
a044265e28f3da8ed0ed1b6e21a553cd233a1e63
/src/main/java/com/ms/base/config/WebLogAspect.java
a5a1f31c8832259b7c7313da51ee8ae6491f7f86
[]
no_license
jreyson/base_demo
f345fe7c58a9569c24ea3da8ab714243ea426249
a92586e7614dc8135296f555ca3118fb459de10d
refs/heads/master
2020-03-23T09:26:04.171908
2018-07-18T06:32:32
2018-07-18T06:32:32
141,387,361
0
0
null
null
null
null
UTF-8
Java
false
false
1,785
java
package com.ms.base.config; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; import java.util.Arrays; /** * @author JamelHuang * @date 2018/3/7 */ @Aspect @Component public class WebLogAspect { private Logger logger = LoggerFactory.getLogger(WebLogAspect.class); @Pointcut("execution(public * com.ms.base.web.*.*(..))") public void webLog(){} @Before("webLog()") public void doBefore(JoinPoint joinPoint) throws Throwable { // 接收到请求,记录请求内容 ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); HttpServletRequest request = attributes.getRequest(); // 记录下请求内容 logger.info("---uri: " + request.getRequestURL().toString()+"---parameter:"+Arrays.toString(joinPoint.getArgs())); // logger.info("HTTP_METHOD : " + request.getMethod()); // logger.info("IP : " + request.getRemoteAddr()); // logger.info("CLASS_METHOD : " + joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName()); } @AfterReturning(returning = "ret", pointcut = "webLog()") public void doAfterReturning(Object ret) throws Throwable { // 处理完请求,返回内容 logger.info("RESPONSE : " + ret); } }
0e45dd6fa9be18215434f4e34b6312de111e4cea
6b14fc33b87e740bd076be5b8a76f79fd7eff702
/api/src/main/java/com/evolvestage/api/dtos/AuthRequest.java
3670478b2cb49d57d47856426d42ec5a6a57a39d
[]
no_license
michaelfmnk/Evolve
699d7098b79fc5204a78cbe2f3fa19cc577e8202
b1c0b7867ec97b2ee842d919146974e63b162d66
refs/heads/master
2022-12-13T03:28:31.468504
2019-07-13T17:59:00
2019-07-13T17:59:00
195,454,443
0
0
null
2022-12-10T04:34:39
2019-07-05T18:50:18
Java
UTF-8
Java
false
false
430
java
package com.evolvestage.api.dtos; import com.evolvestage.api.validation.ValidPassword; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import javax.validation.constraints.Email; @Data @Builder(toBuilder = true) @AllArgsConstructor @NoArgsConstructor public class AuthRequest { @Email private String email; @ValidPassword private String password; }
eea4171365a0d6fe47d148fa80fef9a2bcdd0bae
44e7adc9a1c5c0a1116097ac99c2a51692d4c986
/aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/transform/FleetLaunchTemplateConfigStaxUnmarshaller.java
81422ea8a3ac766cc98e906cb151b1166d79a623
[ "Apache-2.0" ]
permissive
QiAnXinCodeSafe/aws-sdk-java
f93bc97c289984e41527ae5bba97bebd6554ddbe
8251e0a3d910da4f63f1b102b171a3abf212099e
refs/heads/master
2023-01-28T14:28:05.239019
2020-12-03T22:09:01
2020-12-03T22:09:01
318,460,751
1
0
Apache-2.0
2020-12-04T10:06:51
2020-12-04T09:05:03
null
UTF-8
Java
false
false
3,130
java
/* * Copyright 2015-2020 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.ec2.model.transform; import java.util.ArrayList; import javax.xml.stream.events.XMLEvent; import javax.annotation.Generated; import com.amazonaws.services.ec2.model.*; import com.amazonaws.transform.Unmarshaller; import com.amazonaws.transform.StaxUnmarshallerContext; import com.amazonaws.transform.SimpleTypeStaxUnmarshallers.*; /** * FleetLaunchTemplateConfig StAX Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class FleetLaunchTemplateConfigStaxUnmarshaller implements Unmarshaller<FleetLaunchTemplateConfig, StaxUnmarshallerContext> { public FleetLaunchTemplateConfig unmarshall(StaxUnmarshallerContext context) throws Exception { FleetLaunchTemplateConfig fleetLaunchTemplateConfig = new FleetLaunchTemplateConfig(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return fleetLaunchTemplateConfig; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("launchTemplateSpecification", targetDepth)) { fleetLaunchTemplateConfig .setLaunchTemplateSpecification(FleetLaunchTemplateSpecificationStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("overrides", targetDepth)) { fleetLaunchTemplateConfig.withOverrides(new ArrayList<FleetLaunchTemplateOverrides>()); continue; } if (context.testExpression("overrides/item", targetDepth)) { fleetLaunchTemplateConfig.withOverrides(FleetLaunchTemplateOverridesStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return fleetLaunchTemplateConfig; } } } } private static FleetLaunchTemplateConfigStaxUnmarshaller instance; public static FleetLaunchTemplateConfigStaxUnmarshaller getInstance() { if (instance == null) instance = new FleetLaunchTemplateConfigStaxUnmarshaller(); return instance; } }
[ "" ]
05f2e3dd5898c11d1cf03c2f46b469127a9cd5a1
07a1a77e9b4737b7f50af024cb5e88fee0f3f372
/Amazone/src/Collection/Arraylist3.java
dc23b8bc5b4d9d7782de26e25559f3b6867ea26c
[]
no_license
tejkumari/Te_My_Repo
61ae834142f50e30e8fa3653908108e2accc67be
6524e7a1d6060cfd85f444d07d982616e98e6fb3
refs/heads/master
2023-08-21T08:21:17.225446
2021-10-28T12:34:42
2021-10-28T12:34:42
422,195,375
1
0
null
null
null
null
UTF-8
Java
false
false
1,219
java
package Collection; import java.util.ArrayList; public class Arraylist3 { public static void main(String[] args) { //generic type collection which store String class objects only ArrayList<String> s1=new ArrayList<String>(); s1.add("Ravi"); s1.add("Vijay"); s1.add("Ajay"); s1.add("Anuj"); s1.add("Gaurav"); System.out.println("String ArrayList elements: " +s1 ); //remove specific element from collection and return boolean(T/F) value //System.out.println(s1.remove("Anuj")); //remove element of given index and return element(Vijay) vlaue //System.out.println(s1.remove(1)); //remove all elements from list and return boolean(T/F) value //System.out.println(s1.removeAll(s1)); System.out.println("String ArrayList elements: " +s1); ArrayList<String> s2 = new ArrayList<String>(); s2.add("Ravi"); s2.add("Hanumat"); System.out.println(s2); //add all elements of s2 in s1 including duplicates s1.addAll(s2); System.out.println(s1);//Ravi,vijay,ajay,anuj,gaurav,ravi,hanumat //remove all elements of s2 from s1 s1.removeAll(s2);//ravi, vijay, ajay, anuj, gaurav System.out.println(s1);//Ravi,vijay,ajay,anuj,gaurav s1.removeIf(str->str.contains("Ajay")); s1.clear(); System.out.println(s1); } }
434f919ea6b23cb6d104885103a2c9764843e65f
e7729710e0dd9fd123c6963bbfc3f0bf054860dc
/src/test/java/ru/vatmart/webchatserver/data/MessageRepositoryTest.java
15d22320432a2a02684bb83682b98ee96629a4e2
[]
no_license
VatMart/WebChatServer
6575cc404f9343ee84f6be896d3ff3bb5e8d19d3
1983c1877ff5c5d0447cb1e533054429b10c7652
refs/heads/master
2023-06-22T02:43:17.503625
2021-07-24T20:57:35
2021-07-24T20:57:35
370,179,685
0
0
null
null
null
null
UTF-8
Java
false
false
6,570
java
package ru.vatmart.webchatserver.data; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; import org.springframework.boot.test.autoconfigure.orm.jpa.AutoConfigureTestEntityManager; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; import org.springframework.test.context.junit4.SpringRunner; import ru.vatmart.webchatserver.entities.Message; import ru.vatmart.webchatserver.entities.Room; import ru.vatmart.webchatserver.entities.User; import ru.vatmart.webchatserver.entities.enums.Role; import ru.vatmart.webchatserver.repositories.MessageRepository; import ru.vatmart.webchatserver.repositories.RoomRepository; import ru.vatmart.webchatserver.repositories.UserRepository; import javax.transaction.Transactional; import java.time.LocalDate; import java.time.LocalDateTime; @RunWith(SpringRunner.class) @DataJpaTest public class MessageRepositoryTest { @Autowired private MessageRepository messageRepository; @Autowired private UserRepository userRepository; @Autowired private RoomRepository roomRepository; @Test public void testBidirectionalAssociation() { // First part System.out.println("IT WORKS!"); User user1 = new User(); user1.setLogin("logtest2"); user1.setPassword("pastest2"); user1.setNickname("nicktest2"); user1.getRoles().add(Role.ROLE_USER); Room room1 = new Room(); room1.setCreator(user1); room1.setRoom_name("nametest2"); user1.addRoom(room1); //userRepository.saveAndFlush(user1); System.out.println("Message"); Message message = new Message(); message.setSender(user1); message.setText("texttest2"); room1.addMessage(message); messageRepository.saveAndFlush(message); // MUST SAVE USER AND ROOM TO System.out.println("Message saved"); // userRepository.saveAndFlush(user1); System.out.println("USERS"); userRepository.findAll().forEach(System.out::println); System.out.println("ROOMS"); roomRepository.findAll().forEach(System.out::println); System.out.println("MESSAGES"); messageRepository.findAll().forEach(System.out::println); // Second part System.out.println("Second part\nLoading data"); User user2 = userRepository.findByLogin("logtest2").get(); Room room2 = roomRepository.findByCreator_Login("logtest2").get(); Message message2 = messageRepository.findBySenderNickname("nicktest2").get(); System.out.println("Messages in user list: "); user2.getMessages().forEach(System.out::println); System.out.println("Messages in room list: "); room2.getMessages().forEach(System.out::println); System.out.println("Users in room list: "); room2.getUsers().forEach(System.out::println); System.out.println("Rooms in user list: "); user2.getRooms().forEach(System.out::println); System.out.println("Sender in message: "); System.out.println(message2.getSender()); System.out.println("Room in message: "); System.out.println(message2.getRoom()); System.out.println("END TEST"); } @Test public void testPageableQuery() { System.out.println("Part 1. Create and save data\n"); User user1 = new User(); User user2 = new User(); User user3 = new User(); user1.setLogin("logtest1"); user1.setPassword("pastest1"); user1.setNickname("nicktest1"); user1.getRoles().add(Role.ROLE_USER); user2.setLogin("logtest2"); user2.setPassword("pastest2"); user2.setNickname("nicktest2"); user2.getRoles().add(Role.ROLE_USER); user3.setLogin("logtest3"); user3.setPassword("pastest3"); user3.setNickname("nicktest3"); user3.getRoles().add(Role.ROLE_USER); Room room1 = new Room(); room1.setCreator(user1); room1.setRoom_name("nametest2"); user1.addRoom(room1); user2.addRoom(room1); user3.addRoom(room1); Message message1 = new Message(); Message message2 = new Message(); Message message3 = new Message(); Message message4 = new Message(); Message message5 = new Message(); Message message6 = new Message(); message1.setSender(user1); message1.setText("texttest1"); message2.setSender(user2); message2.setText("texttest2"); message3.setSender(user3); message3.setText("texttest3"); message4.setSender(user2); message4.setText("texttest4"); message5.setSender(user2); message5.setText("texttest5"); message6.setSender(user1); message6.setText("texttest6"); room1.addMessage(message1); room1.addMessage(message2); room1.addMessage(message3); room1.addMessage(message4); room1.addMessage(message5); room1.addMessage(message6); messageRepository.saveAndFlush(message1); // MUST SAVE USER AND ROOM TO messageRepository.saveAndFlush(message2); messageRepository.saveAndFlush(message3); messageRepository.saveAndFlush(message4); messageRepository.saveAndFlush(message5); messageRepository.saveAndFlush(message6); System.out.println("USERS"); userRepository.findAll().forEach(System.out::println); System.out.println("ROOMS"); roomRepository.findAll().forEach(System.out::println); System.out.println("MESSAGES"); messageRepository.findAll().forEach(System.out::println); System.out.println("Part 2. Load and pageable test\n"); Page<Message> page1 = messageRepository.findAll(PageRequest.of(0,2, Sort.by(Sort.Order.desc("sendingDate")))); page1.forEach(System.out::println); System.out.println("next page"); Page<Message> page2 = messageRepository.findAll(PageRequest.of(1,2, Sort.by(Sort.Order.desc("sendingDate")))); page2.forEach(System.out::println); } }
ef7ffbf53e9dd7a97abbe1a1050012148ac954cf
181f84d11889c63a6ae2113923bcd50e3f8007d8
/JAVA/udp-cli-srv/UdpCliBcast.java
a3197c0d4ee98f008e032f173faa5dd0b6bdef25
[]
no_license
ivoferro/PROGS-RCOMP
30698b3645fad87111b1286b40156804143ee63f
663145c6e43d1b7fa899e95cbfc447c9d0a5689d
refs/heads/master
2021-01-19T00:43:36.235209
2017-04-04T16:21:57
2017-04-04T16:21:57
87,204,085
0
0
null
2017-04-04T15:32:56
2017-04-04T15:32:56
null
UTF-8
Java
false
false
1,047
java
import java.io.*; import java.net.*; class UdpCliBcast { static InetAddress IPdestino; public static void main(String args[]) throws Exception { byte[] data = new byte[300]; String frase; IPdestino=InetAddress.getByName("255.255.255.255"); DatagramSocket sock = new DatagramSocket(); sock.setBroadcast(true); DatagramPacket udpPacket = new DatagramPacket(data, data.length, IPdestino, 9999); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); while(true) { System.out.print("Request sentence to send (\"exit\" to quit): "); frase = in.readLine(); if(frase.compareTo("exit")==0) break; udpPacket.setData(frase.getBytes()); udpPacket.setLength(frase.length()); sock.send(udpPacket); udpPacket.setData(data); udpPacket.setLength(data.length); sock.receive(udpPacket); frase = new String( udpPacket.getData(), 0, udpPacket.getLength()); System.out.println("Received reply: " + frase); } sock.close(); } }