blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5d38db4c97583186238bef2ca0b25b39b028ac84 | fde7e814bf0f2a3b8a833bb9d109ae364c3692f1 | /methanol-testing/src/main/java/com/github/mizosoft/methanol/testing/decoder/Decode.java | d0ba06d8e4c4cbd6c3fe307ec78df0b99d06d20e | [
"MIT"
] | permissive | mizosoft/methanol | d774d6c6c023d0fde504f13bb8a04793ba9acdb2 | 784235aa16be29aab5fbebfb553848696f84782f | refs/heads/master | 2023-05-27T05:24:21.049816 | 2023-05-18T19:21:27 | 2023-05-18T19:21:27 | 239,025,775 | 208 | 10 | MIT | 2022-12-21T12:09:38 | 2020-02-07T21:28:09 | Java | UTF-8 | Java | false | false | 2,608 | java | /*
* Copyright (c) 2022 Moataz Abdelnasser
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.mizosoft.methanol.testing.decoder;
import com.github.mizosoft.methanol.decoder.AsyncDecoder;
import java.io.IOException;
public class Decode {
private static final int BUFFER_SIZE_MANY = 64;
private static final int SOURCE_INCREMENT_SCALE = 3;
private Decode() {}
public static byte[] decode(AsyncDecoder decoder, byte[] compressed, BufferSizeOption option)
throws IOException {
var source =
new IncrementalByteArraySource(
compressed, option.inSize, SOURCE_INCREMENT_SCALE * option.inSize);
var sink = new ByteArraySink(option.outSize);
try (decoder) {
do {
source.increment();
decoder.decode(source, sink);
} while (!source.finalSource());
if (source.hasRemaining()) {
throw new IOException("unconsumed source bytes");
}
}
return sink.toByteArray();
}
// Make sure the decoder works well with different buffer size configs.
@SuppressWarnings("unused")
public enum BufferSizeOption {
IN_MANY_OUT_MANY(BUFFER_SIZE_MANY, BUFFER_SIZE_MANY),
IN_ONE_OUT_MANY(1, BUFFER_SIZE_MANY),
IN_MANY_OUT_ONE(BUFFER_SIZE_MANY, 1),
IN_ONE_OUT_ONE(1, 1);
final int inSize;
final int outSize;
BufferSizeOption(int inSize, int outSize) {
this.inSize = inSize;
this.outSize = outSize;
}
public static BufferSizeOption[] inOptions() {
return new BufferSizeOption[] {IN_MANY_OUT_MANY, IN_ONE_OUT_MANY};
}
}
}
| [
"moataz.nasser20@gmail.com"
] | moataz.nasser20@gmail.com |
c3a615a2346615eb2a4f6b7db3b53a748de72de4 | f5c9e175052425cffa262fa31b67b37107313bd3 | /src/main/java/com/epam/client/Client.java | cc2bc140bdfb23019872c357763f5700733a0e16 | [] | no_license | bdupak/web-client | d2c2b90c2d717fe742dc6e473199624e23ccb4ee | 8fc627155169d604586262b2d2361b11289d264b | refs/heads/master | 2020-12-24T12:00:23.199479 | 2016-12-14T14:09:56 | 2016-12-14T14:09:56 | 73,112,930 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 262 | java | package com.epam.client;
public interface Client {
Double add();
Double subtract();
Double divide();
Double multiply();
Double percentage();
default double getDouble(String value) {
return Double.parseDouble(value);
}
}
| [
"bohdan.dupak2@wickes.co.uk"
] | bohdan.dupak2@wickes.co.uk |
304d781e04ce685435c6849801d840c7c6428e11 | 87e9df5d6d7f3208b9cdcdfa83b1da32e351437b | /chatassistant/src/main/java/asilapp/sms/com/chatassistant/Core/Chat/ChatContract.java | 488adc9d9e2959b2bb153d3d63008d215f60c5fd | [] | no_license | Alepaol/asilapp2 | 8a48f8204dea4a1f13e02610c7c5cd4704584ef0 | c76c4194879b0874f1128111ee0615c0742022f6 | refs/heads/master | 2020-05-01T12:19:54.833941 | 2019-03-24T20:30:49 | 2019-03-24T20:30:49 | 177,463,202 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,080 | java | package asilapp.sms.com.chatassistant.Core.Chat;
import android.content.Context;
import asilapp.sms.com.chatassistant.model.AsilRoom;
public interface ChatContract {
interface View {
void onSendMessageSuccess();
void onSendMessageFail(String message);
void onGetMessageSuccess(AsilRoom room);
void onGetMessageFailure(String message);
}
interface Presenter{
void sendMessage(Context context, AsilRoom chat);
void getMessage(String senderUid, String receiverUid);
void removeListener();
}
interface Interactor {
void sendMessageToFirebaseUser(Context context, AsilRoom chat);
void getMessageFromFirebaseUser(String senderUid, String receiverUid);
void removeListenerFromFirebaseChild();
}
interface OnSendMessageListener {
void onSendMessageSuccess();
void onSendMessageFailure(String message);
}
interface OnGetMessagesListener {
void onGetMessagesSuccess(AsilRoom room);
void onGetMessagesFailure(String message);
}
}
| [
"alessandro.paolicelli@gmail.com"
] | alessandro.paolicelli@gmail.com |
6f71617727090a077212ee154d23349f4df8d268 | c9d2ac453be29115cd417732259b83a884cd7786 | /app/src/main/java/com/dyyj/idd/chatmore/weiget/LazyViewPager.java | ec613b0e81390510c63cd0dade8e210fbd7bbdb0 | [] | no_license | niushiqi/liaodede | 088b422abfb13e4b5d8e14154a0a110e6e1a1465 | 0664f58d9fe05fbea55bb7980481f297b74e8ef4 | refs/heads/master | 2022-06-22T01:12:12.430393 | 2022-06-20T01:44:52 | 2022-06-20T01:44:52 | 172,618,428 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 65,524 | java | package com.dyyj.idd.chatmore.weiget;
/*
* Copyright (C) 2011 The Android Open Source Project
*
* 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.
*/
import android.content.Context;
import android.database.DataSetObserver;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemClock;
import android.support.v4.os.ParcelableCompat;
import android.support.v4.os.ParcelableCompatCreatorCallbacks;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.VelocityTrackerCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewConfigurationCompat;
import android.support.v4.widget.EdgeEffectCompat;
import android.util.AttributeSet;
import android.util.Log;
import android.view.FocusFinder;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.SoundEffectConstants;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.Interpolator;
import android.widget.Scroller;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
/**
* Layout manager that allows the user to flip left and right
* through pages of data. You supply an implementation of a
* {@link android.support.v4.view.PagerAdapter} to generate the pages that the view shows.
*
* <p>Note this class is currently under early design and
* development. The API will likely change in later updates of
* the compatibility library, requiring changes to the source code
* of apps when they are compiled against the newer version.</p>
*/
public class LazyViewPager extends ViewGroup {
private static final String TAG = "NoPreLoadViewPager";
private static final boolean DEBUG = false;
private static final boolean USE_CACHE = false;
private static final int DEFAULT_OFFSCREEN_PAGES = 0;//默认是1
private static final int MAX_SETTLE_DURATION = 600; // ms
static class ItemInfo {
Object object;
int position;
boolean scrolling;
}
private static final Comparator<ItemInfo> COMPARATOR = new Comparator<ItemInfo>(){
@Override
public int compare(ItemInfo lhs, ItemInfo rhs) {
return lhs.position - rhs.position;
}};
private static final Interpolator sInterpolator = new Interpolator() {
public float getInterpolation(float t) {
// _o(t) = t * t * ((tension + 1) * t + tension)
// o(t) = _o(t - 1) + 1
t -= 1.0f;
return t * t * t + 1.0f;
}
};
private final ArrayList<ItemInfo> mItems = new ArrayList<ItemInfo>();
private PagerAdapter mAdapter;
private int mCurItem; // Index of currently displayed page.
private int mRestoredCurItem = -1;
private Parcelable mRestoredAdapterState = null;
private ClassLoader mRestoredClassLoader = null;
private Scroller mScroller;
private PagerObserver mObserver;
private int mPageMargin;
private Drawable mMarginDrawable;
private int mChildWidthMeasureSpec;
private int mChildHeightMeasureSpec;
private boolean mInLayout;
private boolean mScrollingCacheEnabled;
private boolean mPopulatePending;
private boolean mScrolling;
private int mOffscreenPageLimit = DEFAULT_OFFSCREEN_PAGES;
private boolean mIsBeingDragged;
private boolean mIsUnableToDrag;
private int mTouchSlop;
private float mInitialMotionX;
/**
* Position of the last motion event.
*/
private float mLastMotionX;
private float mLastMotionY;
/**
* ID of the active pointer. This is used to retain consistency during
* drags/flings if multiple pointers are used.
*/
private int mActivePointerId = INVALID_POINTER;
/**
* Sentinel value for no current active pointer.
* Used by {@link #mActivePointerId}.
*/
private static final int INVALID_POINTER = -1;
/**
* Determines speed during touch scrolling
*/
private VelocityTracker mVelocityTracker;
private int mMinimumVelocity;
private int mMaximumVelocity;
private float mBaseLineFlingVelocity;
private float mFlingVelocityInfluence;
private boolean mFakeDragging;
private long mFakeDragBeginTime;
private EdgeEffectCompat mLeftEdge;
private EdgeEffectCompat mRightEdge;
private boolean mFirstLayout = true;
private OnPageChangeListener mOnPageChangeListener;
/**
* Indicates that the pager is in an idle, settled state. The current page
* is fully in view and no animation is in progress.
*/
public static final int SCROLL_STATE_IDLE = 0;
/**
* Indicates that the pager is currently being dragged by the user.
*/
public static final int SCROLL_STATE_DRAGGING = 1;
/**
* Indicates that the pager is in the process of settling to a final position.
*/
public static final int SCROLL_STATE_SETTLING = 2;
private int mScrollState = SCROLL_STATE_IDLE;
/**
* Callback interface for responding to changing state of the selected page.
*/
public interface OnPageChangeListener {
/**
* This method will be invoked when the current page is scrolled, either as part
* of a programmatically initiated smooth scroll or a user initiated touch scroll.
*
* @param position Position index of the first page currently being displayed.
* Page position+1 will be visible if positionOffset is nonzero.
* @param positionOffset Value from [0, 1) indicating the offset from the page at position.
* @param positionOffsetPixels Value in pixels indicating the offset from position.
*/
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels);
/**
* This method will be invoked when a new page becomes selected. Animation is not
* necessarily complete.
*
* @param position Position index of the new selected page.
*/
public void onPageSelected(int position);
/**
* Called when the scroll state changes. Useful for discovering when the user
* begins dragging, when the pager is automatically settling to the current page,
* or when it is fully stopped/idle.
*
* @param state The new scroll state.
* @see android.support.v4.view.ViewPager#SCROLL_STATE_IDLE
* @see android.support.v4.view.ViewPager#SCROLL_STATE_DRAGGING
* @see android.support.v4.view.ViewPager#SCROLL_STATE_SETTLING
*/
public void onPageScrollStateChanged(int state);
}
/**
* Simple implementation of the interface with stub
* implementations of each method. Extend this if you do not intend to override
* every method of
*/
public static class SimpleOnPageChangeListener implements OnPageChangeListener {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
// This space for rent
}
@Override
public void onPageSelected(int position) {
// This space for rent
}
@Override
public void onPageScrollStateChanged(int state) {
// This space for rent
}
}
public LazyViewPager(Context context) {
super(context);
initViewPager();
}
public LazyViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
initViewPager();
}
void initViewPager() {
setWillNotDraw(false);
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
setFocusable(true);
final Context context = getContext();
mScroller = new Scroller(context, sInterpolator);
final ViewConfiguration configuration = ViewConfiguration.get(context);
mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mLeftEdge = new EdgeEffectCompat(context);
mRightEdge = new EdgeEffectCompat(context);
float density = context.getResources().getDisplayMetrics().density;
mBaseLineFlingVelocity = 2500.0f * density;
mFlingVelocityInfluence = 0.4f;
}
private void setScrollState(int newState) {
if (mScrollState == newState) {
return;
}
mScrollState = newState;
if (mOnPageChangeListener != null) {
mOnPageChangeListener.onPageScrollStateChanged(newState);
}
}
public void setAdapter(PagerAdapter adapter) {
if (mAdapter != null) {
// mAdapter.unregisterDataSetObserver(mObserver);
mAdapter.startUpdate(this);
for (int i = 0; i < mItems.size(); i++) {
final ItemInfo ii = mItems.get(i);
mAdapter.destroyItem(this, ii.position, ii.object);
}
mAdapter.finishUpdate(this);
mItems.clear();
removeAllViews();
mCurItem = 0;
scrollTo(0, 0);
}
mAdapter = adapter;
if (mAdapter != null) {
if (mObserver == null) {
mObserver = new PagerObserver();
}
// mAdapter.registerDataSetObserver(mObserver);
mPopulatePending = false;
if (mRestoredCurItem >= 0) {
mAdapter.restoreState(mRestoredAdapterState, mRestoredClassLoader);
setCurrentItemInternal(mRestoredCurItem, false, true);
mRestoredCurItem = -1;
mRestoredAdapterState = null;
mRestoredClassLoader = null;
} else {
populate();
}
}
}
public PagerAdapter getAdapter() {
return mAdapter;
}
/**
* Set the currently selected page. If the ViewPager has already been through its first
* layout there will be a smooth animated transition between the current item and the
* specified item.
*
* @param item Item index to select
*/
public void setCurrentItem(int item) {
mPopulatePending = false;
setCurrentItemInternal(item, !mFirstLayout, false);
}
/**
* Set the currently selected page.
*
* @param item Item index to select
* @param smoothScroll True to smoothly scroll to the new item, false to transition immediately
*/
public void setCurrentItem(int item, boolean smoothScroll) {
mPopulatePending = false;
setCurrentItemInternal(item, smoothScroll, false);
}
public int getCurrentItem() {
return mCurItem;
}
void setCurrentItemInternal(int item, boolean smoothScroll, boolean always) {
setCurrentItemInternal(item, smoothScroll, always, 0);
}
void setCurrentItemInternal(int item, boolean smoothScroll, boolean always, int velocity) {
if (mAdapter == null || mAdapter.getCount() <= 0) {
setScrollingCacheEnabled(false);
return;
}
if (!always && mCurItem == item && mItems.size() != 0) {
setScrollingCacheEnabled(false);
return;
}
if (item < 0) {
item = 0;
} else if (item >= mAdapter.getCount()) {
item = mAdapter.getCount() - 1;
}
final int pageLimit = mOffscreenPageLimit;
if (item > (mCurItem + pageLimit) || item < (mCurItem - pageLimit)) {
// We are doing a jump by more than one page. To avoid
// glitches, we want to keep all current pages in the view
// until the scroll ends.
for (int i=0; i<mItems.size(); i++) {
mItems.get(i).scrolling = true;
}
}
final boolean dispatchSelected = mCurItem != item;
mCurItem = item;
populate();
final int destX = (getWidth() + mPageMargin) * item;
if (smoothScroll) {
smoothScrollTo(destX, 0, velocity);
if (dispatchSelected && mOnPageChangeListener != null) {
mOnPageChangeListener.onPageSelected(item);
}
} else {
if (dispatchSelected && mOnPageChangeListener != null) {
mOnPageChangeListener.onPageSelected(item);
}
completeScroll();
scrollTo(destX, 0);
}
}
public void setOnPageChangeListener(OnPageChangeListener listener) {
mOnPageChangeListener = listener;
}
/**
* Returns the number of pages that will be retained to either side of the
* current page in the view hierarchy in an idle state. Defaults to 1.
*
* @return How many pages will be kept offscreen on either side
* @see #setOffscreenPageLimit(int)
*/
public int getOffscreenPageLimit() {
return mOffscreenPageLimit;
}
/**
* Set the number of pages that should be retained to either side of the
* current page in the view hierarchy in an idle state. Pages beyond this
* limit will be recreated from the adapter when needed.
*
* <p>This is offered as an optimization. If you know in advance the number
* of pages you will need to support or have lazy-loading mechanisms in place
* on your pages, tweaking this setting can have benefits in perceived smoothness
* of paging animations and interaction. If you have a small number of pages (3-4)
* that you can keep active all at once, less time will be spent in layout for
* newly created view subtrees as the user pages back and forth.</p>
*
* <p>You should keep this limit low, especially if your pages have complex layouts.
* This setting defaults to 1.</p>
*
* @param limit How many pages will be kept offscreen in an idle state.
*/
public void setOffscreenPageLimit(int limit) {
if (limit < DEFAULT_OFFSCREEN_PAGES) {
Log.w(TAG, "Requested offscreen page limit " + limit + " too small; defaulting to " +
DEFAULT_OFFSCREEN_PAGES);
limit = DEFAULT_OFFSCREEN_PAGES;
}
if (limit != mOffscreenPageLimit) {
mOffscreenPageLimit = limit;
populate();
}
}
/**
* Set the margin between pages.
*
* @param marginPixels Distance between adjacent pages in pixels
* @see #getPageMargin()
* @see #setPageMarginDrawable(android.graphics.drawable.Drawable)
* @see #setPageMarginDrawable(int)
*/
public void setPageMargin(int marginPixels) {
final int oldMargin = mPageMargin;
mPageMargin = marginPixels;
final int width = getWidth();
recomputeScrollPosition(width, width, marginPixels, oldMargin);
requestLayout();
}
/**
* Return the margin between pages.
*
* @return The size of the margin in pixels
*/
public int getPageMargin() {
return mPageMargin;
}
/**
* Set a drawable that will be used to fill the margin between pages.
*
* @param d Drawable to display between pages
*/
public void setPageMarginDrawable(Drawable d) {
mMarginDrawable = d;
if (d != null) refreshDrawableState();
setWillNotDraw(d == null);
invalidate();
}
/**
* Set a drawable that will be used to fill the margin between pages.
*
* @param resId Resource ID of a drawable to display between pages
*/
public void setPageMarginDrawable(int resId) {
setPageMarginDrawable(getContext().getResources().getDrawable(resId));
}
@Override
protected boolean verifyDrawable(Drawable who) {
return super.verifyDrawable(who) || who == mMarginDrawable;
}
@Override
protected void drawableStateChanged() {
super.drawableStateChanged();
final Drawable d = mMarginDrawable;
if (d != null && d.isStateful()) {
d.setState(getDrawableState());
}
}
// We want the duration of the page snap animation to be influenced by the distance that
// the screen has to travel, however, we don't want this duration to be effected in a
// purely linear fashion. Instead, we use this method to moderate the effect that the distance
// of travel has on the overall snap duration.
float distanceInfluenceForSnapDuration(float f) {
f -= 0.5f; // center the values about 0.
f *= 0.3f * Math.PI / 2.0f;
return (float) Math.sin(f);
}
/**
* Like {@link android.view.View#scrollBy}, but scroll smoothly instead of immediately.
*
* @param x the number of pixels to scroll by on the X axis
* @param y the number of pixels to scroll by on the Y axis
*/
void smoothScrollTo(int x, int y) {
smoothScrollTo(x, y, 0);
}
/**
* Like {@link android.view.View#scrollBy}, but scroll smoothly instead of immediately.
*
* @param x the number of pixels to scroll by on the X axis
* @param y the number of pixels to scroll by on the Y axis
* @param velocity the velocity associated with a fling, if applicable. (0 otherwise)
*/
void smoothScrollTo(int x, int y, int velocity) {
if (getChildCount() == 0) {
// Nothing to do.
setScrollingCacheEnabled(false);
return;
}
int sx = getScrollX();
int sy = getScrollY();
int dx = x - sx;
int dy = y - sy;
if (dx == 0 && dy == 0) {
completeScroll();
setScrollState(SCROLL_STATE_IDLE);
return;
}
setScrollingCacheEnabled(true);
mScrolling = true;
setScrollState(SCROLL_STATE_SETTLING);
final float pageDelta = (float) Math.abs(dx) / (getWidth() + mPageMargin);
int duration = (int) (pageDelta * 100);
velocity = Math.abs(velocity);
if (velocity > 0) {
duration += (duration / (velocity / mBaseLineFlingVelocity)) * mFlingVelocityInfluence;
} else {
duration += 100;
}
duration = Math.min(duration, MAX_SETTLE_DURATION);
mScroller.startScroll(sx, sy, dx, dy, duration);
invalidate();
}
void addNewItem(int position, int index) {
ItemInfo ii = new ItemInfo();
ii.position = position;
ii.object = mAdapter.instantiateItem(this, position);
if (index < 0) {
mItems.add(ii);
} else {
mItems.add(index, ii);
}
}
void dataSetChanged() {
// This method only gets called if our observer is attached, so mAdapter is non-null.
boolean needPopulate = mItems.size() < 3 && mItems.size() < mAdapter.getCount();
int newCurrItem = -1;
for (int i = 0; i < mItems.size(); i++) {
final ItemInfo ii = mItems.get(i);
final int newPos = mAdapter.getItemPosition(ii.object);
if (newPos == PagerAdapter.POSITION_UNCHANGED) {
continue;
}
if (newPos == PagerAdapter.POSITION_NONE) {
mItems.remove(i);
i--;
mAdapter.destroyItem(this, ii.position, ii.object);
needPopulate = true;
if (mCurItem == ii.position) {
// Keep the current item in the valid range
newCurrItem = Math.max(0, Math.min(mCurItem, mAdapter.getCount() - 1));
}
continue;
}
if (ii.position != newPos) {
if (ii.position == mCurItem) {
// Our current item changed position. Follow it.
newCurrItem = newPos;
}
ii.position = newPos;
needPopulate = true;
}
}
Collections.sort(mItems, COMPARATOR);
if (newCurrItem >= 0) {
// TODO This currently causes a jump.
setCurrentItemInternal(newCurrItem, false, true);
needPopulate = true;
}
if (needPopulate) {
populate();
requestLayout();
}
}
void populate() {
if (mAdapter == null) {
return;
}
// Bail now if we are waiting to populate. This is to hold off
// on creating views from the time the user releases their finger to
// fling to a new position until we have finished the scroll to
// that position, avoiding glitches from happening at that point.
if (mPopulatePending) {
if (DEBUG) Log.i(TAG, "populate is pending, skipping for now...");
return;
}
// Also, don't populate until we are attached to a window. This is to
// avoid trying to populate before we have restored our view hierarchy
// state and conflicting with what is restored.
if (getWindowToken() == null) {
return;
}
mAdapter.startUpdate(this);
final int pageLimit = mOffscreenPageLimit;
final int startPos = Math.max(0, mCurItem - pageLimit);
final int N = mAdapter.getCount();
final int endPos = Math.min(N-1, mCurItem + pageLimit);
if (DEBUG) Log.v(TAG, "populating: startPos=" + startPos + " endPos=" + endPos);
// Add and remove pages in the existing list.
int lastPos = -1;
for (int i=0; i<mItems.size(); i++) {
ItemInfo ii = mItems.get(i);
if ((ii.position < startPos || ii.position > endPos) && !ii.scrolling) {
if (DEBUG) Log.i(TAG, "removing: " + ii.position + " @ " + i);
mItems.remove(i);
i--;
mAdapter.destroyItem(this, ii.position, ii.object);
} else if (lastPos < endPos && ii.position > startPos) {
// The next item is outside of our range, but we have a gap
// between it and the last item where we want to have a page
// shown. Fill in the gap.
lastPos++;
if (lastPos < startPos) {
lastPos = startPos;
}
while (lastPos <= endPos && lastPos < ii.position) {
if (DEBUG) Log.i(TAG, "inserting: " + lastPos + " @ " + i);
addNewItem(lastPos, i);
lastPos++;
i++;
}
}
lastPos = ii.position;
}
// Add any new pages we need at the end.
lastPos = mItems.size() > 0 ? mItems.get(mItems.size()-1).position : -1;
if (lastPos < endPos) {
lastPos++;
lastPos = lastPos > startPos ? lastPos : startPos;
while (lastPos <= endPos) {
if (DEBUG) Log.i(TAG, "appending: " + lastPos);
addNewItem(lastPos, -1);
lastPos++;
}
}
if (DEBUG) {
Log.i(TAG, "Current page list:");
for (int i=0; i<mItems.size(); i++) {
Log.i(TAG, "#" + i + ": page " + mItems.get(i).position);
}
}
ItemInfo curItem = null;
for (int i=0; i<mItems.size(); i++) {
if (mItems.get(i).position == mCurItem) {
curItem = mItems.get(i);
break;
}
}
mAdapter.setPrimaryItem(this, mCurItem, curItem != null ? curItem.object : null);
mAdapter.finishUpdate(this);
if (hasFocus()) {
View currentFocused = findFocus();
ItemInfo ii = currentFocused != null ? infoForAnyChild(currentFocused) : null;
if (ii == null || ii.position != mCurItem) {
for (int i=0; i<getChildCount(); i++) {
View child = getChildAt(i);
ii = infoForChild(child);
if (ii != null && ii.position == mCurItem) {
if (child.requestFocus(FOCUS_FORWARD)) {
break;
}
}
}
}
}
}
public static class SavedState extends BaseSavedState {
int position;
Parcelable adapterState;
ClassLoader loader;
public SavedState(Parcelable superState) {
super(superState);
}
@Override
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeInt(position);
out.writeParcelable(adapterState, flags);
}
@Override
public String toString() {
return "FragmentPager.SavedState{"
+ Integer.toHexString(System.identityHashCode(this))
+ " position=" + position + "}";
}
public static final Creator<SavedState> CREATOR
= ParcelableCompat.newCreator(new ParcelableCompatCreatorCallbacks<SavedState>() {
@Override
public SavedState createFromParcel(Parcel in, ClassLoader loader) {
return new SavedState(in, loader);
}
@Override
public SavedState[] newArray(int size) {
return new SavedState[size];
}
});
SavedState(Parcel in, ClassLoader loader) {
super(in);
if (loader == null) {
loader = getClass().getClassLoader();
}
position = in.readInt();
adapterState = in.readParcelable(loader);
this.loader = loader;
}
}
@Override
public Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
SavedState ss = new SavedState(superState);
ss.position = mCurItem;
if (mAdapter != null) {
ss.adapterState = mAdapter.saveState();
}
return ss;
}
@Override
public void onRestoreInstanceState(Parcelable state) {
if (!(state instanceof SavedState)) {
super.onRestoreInstanceState(state);
return;
}
SavedState ss = (SavedState)state;
super.onRestoreInstanceState(ss.getSuperState());
if (mAdapter != null) {
mAdapter.restoreState(ss.adapterState, ss.loader);
setCurrentItemInternal(ss.position, false, true);
} else {
mRestoredCurItem = ss.position;
mRestoredAdapterState = ss.adapterState;
mRestoredClassLoader = ss.loader;
}
}
@Override
public void addView(View child, int index, LayoutParams params) {
if (mInLayout) {
addViewInLayout(child, index, params);
child.measure(mChildWidthMeasureSpec, mChildHeightMeasureSpec);
} else {
super.addView(child, index, params);
}
if (USE_CACHE) {
if (child.getVisibility() != GONE) {
child.setDrawingCacheEnabled(mScrollingCacheEnabled);
} else {
child.setDrawingCacheEnabled(false);
}
}
}
ItemInfo infoForChild(View child) {
for (int i=0; i<mItems.size(); i++) {
ItemInfo ii = mItems.get(i);
if (mAdapter.isViewFromObject(child, ii.object)) {
return ii;
}
}
return null;
}
ItemInfo infoForAnyChild(View child) {
ViewParent parent;
while ((parent=child.getParent()) != this) {
if (parent == null || !(parent instanceof View)) {
return null;
}
child = (View)parent;
}
return infoForChild(child);
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
mFirstLayout = true;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// For simple implementation, or internal size is always 0.
// We depend on the container to specify the layout size of
// our view. We can't really know what it is since we will be
// adding and removing different arbitrary views and do not
// want the layout to change as this happens.
setMeasuredDimension(getDefaultSize(0, widthMeasureSpec),
getDefaultSize(0, heightMeasureSpec));
// Children are just made to fill our space.
mChildWidthMeasureSpec = MeasureSpec.makeMeasureSpec(getMeasuredWidth() -
getPaddingLeft() - getPaddingRight(), MeasureSpec.EXACTLY);
mChildHeightMeasureSpec = MeasureSpec.makeMeasureSpec(getMeasuredHeight() -
getPaddingTop() - getPaddingBottom(), MeasureSpec.EXACTLY);
// Make sure we have created all fragments that we need to have shown.
mInLayout = true;
populate();
mInLayout = false;
// Make sure all children have been properly measured.
final int size = getChildCount();
for (int i = 0; i < size; ++i) {
final View child = getChildAt(i);
if (child.getVisibility() != GONE) {
if (DEBUG) Log.v(TAG, "Measuring #" + i + " " + child
+ ": " + mChildWidthMeasureSpec);
child.measure(mChildWidthMeasureSpec, mChildHeightMeasureSpec);
}
}
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
// Make sure scroll position is set correctly.
if (w != oldw) {
recomputeScrollPosition(w, oldw, mPageMargin, mPageMargin);
}
}
private void recomputeScrollPosition(int width, int oldWidth, int margin, int oldMargin) {
final int widthWithMargin = width + margin;
if (oldWidth > 0) {
final int oldScrollPos = getScrollX();
final int oldwwm = oldWidth + oldMargin;
final int oldScrollItem = oldScrollPos / oldwwm;
final float scrollOffset = (float) (oldScrollPos % oldwwm) / oldwwm;
final int scrollPos = (int) ((oldScrollItem + scrollOffset) * widthWithMargin);
scrollTo(scrollPos, getScrollY());
if (!mScroller.isFinished()) {
// We now return to your regularly scheduled scroll, already in progress.
final int newDuration = mScroller.getDuration() - mScroller.timePassed();
mScroller.startScroll(scrollPos, 0, mCurItem * widthWithMargin, 0, newDuration);
}
} else {
int scrollPos = mCurItem * widthWithMargin;
if (scrollPos != getScrollX()) {
completeScroll();
scrollTo(scrollPos, getScrollY());
}
}
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
mInLayout = true;
populate();
mInLayout = false;
final int count = getChildCount();
final int width = r-l;
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
ItemInfo ii;
if (child.getVisibility() != GONE && (ii=infoForChild(child)) != null) {
int loff = (width + mPageMargin) * ii.position;
int childLeft = getPaddingLeft() + loff;
int childTop = getPaddingTop();
if (DEBUG) Log.v(TAG, "Positioning #" + i + " " + child + " f=" + ii.object
+ ":" + childLeft + "," + childTop + " " + child.getMeasuredWidth()
+ "x" + child.getMeasuredHeight());
child.layout(childLeft, childTop,
childLeft + child.getMeasuredWidth(),
childTop + child.getMeasuredHeight());
}
}
mFirstLayout = false;
}
@Override
public void computeScroll() {
if (DEBUG) Log.i(TAG, "computeScroll: finished=" + mScroller.isFinished());
if (!mScroller.isFinished()) {
if (mScroller.computeScrollOffset()) {
if (DEBUG) Log.i(TAG, "computeScroll: still scrolling");
int oldX = getScrollX();
int oldY = getScrollY();
int x = mScroller.getCurrX();
int y = mScroller.getCurrY();
if (oldX != x || oldY != y) {
scrollTo(x, y);
}
if (mOnPageChangeListener != null) {
final int widthWithMargin = getWidth() + mPageMargin;
final int position = x / widthWithMargin;
final int offsetPixels = x % widthWithMargin;
final float offset = (float) offsetPixels / widthWithMargin;
mOnPageChangeListener.onPageScrolled(position, offset, offsetPixels);
}
// Keep on drawing until the animation has finished.
invalidate();
return;
}
}
// Done with scroll, clean up state.
completeScroll();
}
private void completeScroll() {
boolean needPopulate = mScrolling;
if (needPopulate) {
// Done with scroll, no longer want to cache view drawing.
setScrollingCacheEnabled(false);
mScroller.abortAnimation();
int oldX = getScrollX();
int oldY = getScrollY();
int x = mScroller.getCurrX();
int y = mScroller.getCurrY();
if (oldX != x || oldY != y) {
scrollTo(x, y);
}
setScrollState(SCROLL_STATE_IDLE);
}
mPopulatePending = false;
mScrolling = false;
for (int i=0; i<mItems.size(); i++) {
ItemInfo ii = mItems.get(i);
if (ii.scrolling) {
needPopulate = true;
ii.scrolling = false;
}
}
if (needPopulate) {
populate();
}
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
/*
* This method JUST determines whether we want to intercept the motion.
* If we return true, onMotionEvent will be called and we do the actual
* scrolling there.
*/
final int action = ev.getAction() & MotionEventCompat.ACTION_MASK;
// Always take care of the touch gesture being complete.
if (action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP) {
// Release the drag.
if (DEBUG) Log.v(TAG, "Intercept done!");
mIsBeingDragged = false;
mIsUnableToDrag = false;
mActivePointerId = INVALID_POINTER;
return false;
}
// Nothing more to do here if we have decided whether or not we
// are dragging.
if (action != MotionEvent.ACTION_DOWN) {
if (mIsBeingDragged) {
if (DEBUG) Log.v(TAG, "Intercept returning true!");
return true;
}
if (mIsUnableToDrag) {
if (DEBUG) Log.v(TAG, "Intercept returning false!");
return false;
}
}
switch (action) {
case MotionEvent.ACTION_MOVE: {
/*
* mIsBeingDragged == false, otherwise the shortcut would have caught it. Check
* whether the user has moved far enough from his original down touch.
*/
/*
* Locally do absolute value. mLastMotionY is set to the y value
* of the down event.
*/
final int activePointerId = mActivePointerId;
if (activePointerId == INVALID_POINTER) {
// If we don't have a valid id, the touch down wasn't on content.
break;
}
final int pointerIndex = MotionEventCompat.findPointerIndex(ev, activePointerId);
final float x = MotionEventCompat.getX(ev, pointerIndex);
final float dx = x - mLastMotionX;
final float xDiff = Math.abs(dx);
final float y = MotionEventCompat.getY(ev, pointerIndex);
final float yDiff = Math.abs(y - mLastMotionY);
final int scrollX = getScrollX();
final boolean atEdge = (dx > 0 && scrollX == 0) || (dx < 0 && mAdapter != null &&
scrollX >= (mAdapter.getCount() - 1) * getWidth() - 1);
if (DEBUG) Log.v(TAG, "Moved x to " + x + "," + y + " diff=" + xDiff + "," + yDiff);
if (canScroll(this, false, (int) dx, (int) x, (int) y)) {
// Nested view has scrollable area under this point. Let it be handled there.
mInitialMotionX = mLastMotionX = x;
mLastMotionY = y;
return false;
}
if (xDiff > mTouchSlop && xDiff > yDiff) {
if (DEBUG) Log.v(TAG, "Starting drag!");
mIsBeingDragged = true;
setScrollState(SCROLL_STATE_DRAGGING);
mLastMotionX = x;
setScrollingCacheEnabled(true);
} else {
if (yDiff > mTouchSlop) {
// The finger has moved enough in the vertical
// direction to be counted as a drag... abort
// any attempt to drag horizontally, to work correctly
// with children that have scrolling containers.
if (DEBUG) Log.v(TAG, "Starting unable to drag!");
mIsUnableToDrag = true;
}
}
break;
}
case MotionEvent.ACTION_DOWN: {
/*
* Remember location of down touch.
* ACTION_DOWN always refers to pointer index 0.
*/
mLastMotionX = mInitialMotionX = ev.getX();
mLastMotionY = ev.getY();
mActivePointerId = MotionEventCompat.getPointerId(ev, 0);
if (mScrollState == SCROLL_STATE_SETTLING) {
// Let the user 'catch' the pager as it animates.
mIsBeingDragged = true;
mIsUnableToDrag = false;
setScrollState(SCROLL_STATE_DRAGGING);
} else {
completeScroll();
mIsBeingDragged = false;
mIsUnableToDrag = false;
}
if (DEBUG) Log.v(TAG, "Down at " + mLastMotionX + "," + mLastMotionY
+ " mIsBeingDragged=" + mIsBeingDragged
+ "mIsUnableToDrag=" + mIsUnableToDrag);
break;
}
case MotionEventCompat.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
/*
* The only time we want to intercept motion events is if we are in the
* drag mode.
*/
return mIsBeingDragged;
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (mFakeDragging) {
// A fake drag is in progress already, ignore this real one
// but still eat the touch events.
// (It is likely that the user is multi-touching the screen.)
return true;
}
if (ev.getAction() == MotionEvent.ACTION_DOWN && ev.getEdgeFlags() != 0) {
// Don't handle edge touches immediately -- they may actually belong to one of our
// descendants.
return false;
}
if (mAdapter == null || mAdapter.getCount() == 0) {
// Nothing to present or scroll; nothing to touch.
return false;
}
if (mVelocityTracker == null) {
mVelocityTracker = VelocityTracker.obtain();
}
mVelocityTracker.addMovement(ev);
final int action = ev.getAction();
boolean needsInvalidate = false;
switch (action & MotionEventCompat.ACTION_MASK) {
case MotionEvent.ACTION_DOWN: {
/*
* If being flinged and user touches, stop the fling. isFinished
* will be false if being flinged.
*/
completeScroll();
// Remember where the motion event started
mLastMotionX = mInitialMotionX = ev.getX();
mActivePointerId = MotionEventCompat.getPointerId(ev, 0);
break;
}
case MotionEvent.ACTION_MOVE:
if (!mIsBeingDragged) {
final int pointerIndex = MotionEventCompat.findPointerIndex(ev, mActivePointerId);
final float x = MotionEventCompat.getX(ev, pointerIndex);
final float xDiff = Math.abs(x - mLastMotionX);
final float y = MotionEventCompat.getY(ev, pointerIndex);
final float yDiff = Math.abs(y - mLastMotionY);
if (DEBUG) Log.v(TAG, "Moved x to " + x + "," + y + " diff=" + xDiff + "," + yDiff);
if (xDiff > mTouchSlop && xDiff > yDiff) {
if (DEBUG) Log.v(TAG, "Starting drag!");
mIsBeingDragged = true;
mLastMotionX = x;
setScrollState(SCROLL_STATE_DRAGGING);
setScrollingCacheEnabled(true);
}
}
if (mIsBeingDragged) {
// Scroll to follow the motion event
final int activePointerIndex = MotionEventCompat.findPointerIndex(
ev, mActivePointerId);
final float x = MotionEventCompat.getX(ev, activePointerIndex);
final float deltaX = mLastMotionX - x;
mLastMotionX = x;
float oldScrollX = getScrollX();
float scrollX = oldScrollX + deltaX;
final int width = getWidth();
final int widthWithMargin = width + mPageMargin;
final int lastItemIndex = mAdapter.getCount() - 1;
final float leftBound = Math.max(0, (mCurItem - 1) * widthWithMargin);
final float rightBound =
Math.min(mCurItem + 1, lastItemIndex) * widthWithMargin;
if (scrollX < leftBound) {
if (leftBound == 0) {
float over = -scrollX;
needsInvalidate = mLeftEdge.onPull(over / width);
}
scrollX = leftBound;
} else if (scrollX > rightBound) {
if (rightBound == lastItemIndex * widthWithMargin) {
float over = scrollX - rightBound;
needsInvalidate = mRightEdge.onPull(over / width);
}
scrollX = rightBound;
}
// Don't lose the rounded component
mLastMotionX += scrollX - (int) scrollX;
scrollTo((int) scrollX, getScrollY());
if (mOnPageChangeListener != null) {
final int position = (int) scrollX / widthWithMargin;
final int positionOffsetPixels = (int) scrollX % widthWithMargin;
final float positionOffset = (float) positionOffsetPixels / widthWithMargin;
mOnPageChangeListener.onPageScrolled(position, positionOffset,
positionOffsetPixels);
}
}
break;
case MotionEvent.ACTION_UP:
if (mIsBeingDragged) {
final VelocityTracker velocityTracker = mVelocityTracker;
velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
int initialVelocity = (int) VelocityTrackerCompat.getXVelocity(
velocityTracker, mActivePointerId);
mPopulatePending = true;
final int widthWithMargin = getWidth() + mPageMargin;
final int scrollX = getScrollX();
final int currentPage = scrollX / widthWithMargin;
int nextPage = initialVelocity > 0 ? currentPage : currentPage + 1;
setCurrentItemInternal(nextPage, true, true, initialVelocity);
mActivePointerId = INVALID_POINTER;
endDrag();
needsInvalidate = mLeftEdge.onRelease() | mRightEdge.onRelease();
}
break;
case MotionEvent.ACTION_CANCEL:
if (mIsBeingDragged) {
setCurrentItemInternal(mCurItem, true, true);
mActivePointerId = INVALID_POINTER;
endDrag();
needsInvalidate = mLeftEdge.onRelease() | mRightEdge.onRelease();
}
break;
case MotionEventCompat.ACTION_POINTER_DOWN: {
final int index = MotionEventCompat.getActionIndex(ev);
final float x = MotionEventCompat.getX(ev, index);
mLastMotionX = x;
mActivePointerId = MotionEventCompat.getPointerId(ev, index);
break;
}
case MotionEventCompat.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
mLastMotionX = MotionEventCompat.getX(ev,
MotionEventCompat.findPointerIndex(ev, mActivePointerId));
break;
}
if (needsInvalidate) {
invalidate();
}
return true;
}
@Override
public void draw(Canvas canvas) {
super.draw(canvas);
boolean needsInvalidate = false;
final int overScrollMode = ViewCompat.getOverScrollMode(this);
if (overScrollMode == ViewCompat.OVER_SCROLL_ALWAYS ||
(overScrollMode == ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS &&
mAdapter != null && mAdapter.getCount() > 1)) {
if (!mLeftEdge.isFinished()) {
final int restoreCount = canvas.save();
final int height = getHeight() - getPaddingTop() - getPaddingBottom();
canvas.rotate(270);
canvas.translate(-height + getPaddingTop(), 0);
mLeftEdge.setSize(height, getWidth());
needsInvalidate |= mLeftEdge.draw(canvas);
canvas.restoreToCount(restoreCount);
}
if (!mRightEdge.isFinished()) {
final int restoreCount = canvas.save();
final int width = getWidth();
final int height = getHeight() - getPaddingTop() - getPaddingBottom();
final int itemCount = mAdapter != null ? mAdapter.getCount() : 1;
canvas.rotate(90);
canvas.translate(-getPaddingTop(),
-itemCount * (width + mPageMargin) + mPageMargin);
mRightEdge.setSize(height, width);
needsInvalidate |= mRightEdge.draw(canvas);
canvas.restoreToCount(restoreCount);
}
} else {
mLeftEdge.finish();
mRightEdge.finish();
}
if (needsInvalidate) {
// Keep animating
invalidate();
}
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// Draw the margin drawable if needed.
if (mPageMargin > 0 && mMarginDrawable != null) {
final int scrollX = getScrollX();
final int width = getWidth();
final int offset = scrollX % (width + mPageMargin);
if (offset != 0) {
// Pages fit completely when settled; we only need to draw when in between
final int left = scrollX - offset + width;
mMarginDrawable.setBounds(left, 0, left + mPageMargin, getHeight());
mMarginDrawable.draw(canvas);
}
}
}
/**
* Start a fake drag of the pager.
*
* <p>A fake drag can be useful if you want to synchronize the motion of the ViewPager
* with the touch scrolling of another view, while still letting the ViewPager
* control the snapping motion and fling behavior. (e.g. parallax-scrolling tabs.)
* Call {@link #fakeDragBy(float)} to simulate the actual drag motion. Call
* {@link #endFakeDrag()} to complete the fake drag and fling as necessary.
*
* <p>During a fake drag the ViewPager will ignore all touch events. If a real drag
* is already in progress, this method will return false.
*
* @return true if the fake drag began successfully, false if it could not be started.
*
* @see #fakeDragBy(float)
* @see #endFakeDrag()
*/
public boolean beginFakeDrag() {
if (mIsBeingDragged) {
return false;
}
mFakeDragging = true;
setScrollState(SCROLL_STATE_DRAGGING);
mInitialMotionX = mLastMotionX = 0;
if (mVelocityTracker == null) {
mVelocityTracker = VelocityTracker.obtain();
} else {
mVelocityTracker.clear();
}
final long time = SystemClock.uptimeMillis();
final MotionEvent ev = MotionEvent.obtain(time, time, MotionEvent.ACTION_DOWN, 0, 0, 0);
mVelocityTracker.addMovement(ev);
ev.recycle();
mFakeDragBeginTime = time;
return true;
}
/**
* End a fake drag of the pager.
*
* @see #beginFakeDrag()
* @see #fakeDragBy(float)
*/
public void endFakeDrag() {
if (!mFakeDragging) {
throw new IllegalStateException("No fake drag in progress. Call beginFakeDrag first.");
}
final VelocityTracker velocityTracker = mVelocityTracker;
velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
int initialVelocity = (int)VelocityTrackerCompat.getYVelocity(
velocityTracker, mActivePointerId);
mPopulatePending = true;
if ((Math.abs(initialVelocity) > mMinimumVelocity)
|| Math.abs(mInitialMotionX-mLastMotionX) >= (getWidth()/3)) {
if (mLastMotionX > mInitialMotionX) {
setCurrentItemInternal(mCurItem-1, true, true);
} else {
setCurrentItemInternal(mCurItem+1, true, true);
}
} else {
setCurrentItemInternal(mCurItem, true, true);
}
endDrag();
mFakeDragging = false;
}
/**
* Fake drag by an offset in pixels. You must have called {@link #beginFakeDrag()} first.
*
* @param xOffset Offset in pixels to drag by.
* @see #beginFakeDrag()
* @see #endFakeDrag()
*/
public void fakeDragBy(float xOffset) {
if (!mFakeDragging) {
throw new IllegalStateException("No fake drag in progress. Call beginFakeDrag first.");
}
mLastMotionX += xOffset;
float scrollX = getScrollX() - xOffset;
final int width = getWidth();
final int widthWithMargin = width + mPageMargin;
final float leftBound = Math.max(0, (mCurItem - 1) * widthWithMargin);
final float rightBound =
Math.min(mCurItem + 1, mAdapter.getCount() - 1) * widthWithMargin;
if (scrollX < leftBound) {
scrollX = leftBound;
} else if (scrollX > rightBound) {
scrollX = rightBound;
}
// Don't lose the rounded component
mLastMotionX += scrollX - (int) scrollX;
scrollTo((int) scrollX, getScrollY());
if (mOnPageChangeListener != null) {
final int position = (int) scrollX / widthWithMargin;
final int positionOffsetPixels = (int) scrollX % widthWithMargin;
final float positionOffset = (float) positionOffsetPixels / widthWithMargin;
mOnPageChangeListener.onPageScrolled(position, positionOffset,
positionOffsetPixels);
}
// Synthesize an event for the VelocityTracker.
final long time = SystemClock.uptimeMillis();
final MotionEvent ev = MotionEvent.obtain(mFakeDragBeginTime, time, MotionEvent.ACTION_MOVE,
mLastMotionX, 0, 0);
mVelocityTracker.addMovement(ev);
ev.recycle();
}
/**
* Returns true if a fake drag is in progress.
*
* @return true if currently in a fake drag, false otherwise.
*
* @see #beginFakeDrag()
* @see #fakeDragBy(float)
* @see #endFakeDrag()
*/
public boolean isFakeDragging() {
return mFakeDragging;
}
private void onSecondaryPointerUp(MotionEvent ev) {
final int pointerIndex = MotionEventCompat.getActionIndex(ev);
final int pointerId = MotionEventCompat.getPointerId(ev, pointerIndex);
if (pointerId == mActivePointerId) {
// This was our active pointer going up. Choose a new
// active pointer and adjust accordingly.
final int newPointerIndex = pointerIndex == 0 ? 1 : 0;
mLastMotionX = MotionEventCompat.getX(ev, newPointerIndex);
mActivePointerId = MotionEventCompat.getPointerId(ev, newPointerIndex);
if (mVelocityTracker != null) {
mVelocityTracker.clear();
}
}
}
private void endDrag() {
mIsBeingDragged = false;
mIsUnableToDrag = false;
if (mVelocityTracker != null) {
mVelocityTracker.recycle();
mVelocityTracker = null;
}
}
private void setScrollingCacheEnabled(boolean enabled) {
if (mScrollingCacheEnabled != enabled) {
mScrollingCacheEnabled = enabled;
if (USE_CACHE) {
final int size = getChildCount();
for (int i = 0; i < size; ++i) {
final View child = getChildAt(i);
if (child.getVisibility() != GONE) {
child.setDrawingCacheEnabled(enabled);
}
}
}
}
}
/**
* Tests scrollability within child views of v given a delta of dx.
*
* @param v View to test for horizontal scrollability
* @param checkV Whether the view v passed should itself be checked for scrollability (true),
* or just its children (false).
* @param dx Delta scrolled in pixels
* @param x X coordinate of the active touch point
* @param y Y coordinate of the active touch point
* @return true if child views of v can be scrolled by delta of dx.
*/
protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
if (v instanceof ViewGroup) {
final ViewGroup group = (ViewGroup) v;
final int scrollX = v.getScrollX();
final int scrollY = v.getScrollY();
final int count = group.getChildCount();
// Count backwards - let topmost views consume scroll distance first.
for (int i = count - 1; i >= 0; i--) {
// TODO: Add versioned support here for transformed views.
// This will not work for transformed views in Honeycomb+
final View child = group.getChildAt(i);
if (x + scrollX >= child.getLeft() && x + scrollX < child.getRight() &&
y + scrollY >= child.getTop() && y + scrollY < child.getBottom() &&
canScroll(child, true, dx, x + scrollX - child.getLeft(),
y + scrollY - child.getTop())) {
return true;
}
}
}
return checkV && ViewCompat.canScrollHorizontally(v, -dx);
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
// Let the focused view and/or our descendants get the key first
return super.dispatchKeyEvent(event) || executeKeyEvent(event);
}
/**
* You can call this function yourself to have the scroll view perform
* scrolling from a key event, just as if the event had been dispatched to
* it by the view hierarchy.
*
* @param event The key event to execute.
* @return Return true if the event was handled, else false.
*/
public boolean executeKeyEvent(KeyEvent event) {
boolean handled = false;
if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_DPAD_LEFT:
handled = arrowScroll(FOCUS_LEFT);
break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
handled = arrowScroll(FOCUS_RIGHT);
break;
case KeyEvent.KEYCODE_TAB:
if (event.hasNoModifiers()) {
handled = arrowScroll(FOCUS_FORWARD);
} else if (event.hasModifiers(KeyEvent.META_SHIFT_ON)) {
handled = arrowScroll(FOCUS_BACKWARD);
}
break;
}
}
return handled;
}
public boolean arrowScroll(int direction) {
View currentFocused = findFocus();
if (currentFocused == this) currentFocused = null;
boolean handled = false;
View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused,
direction);
if (nextFocused != null && nextFocused != currentFocused) {
if (direction == View.FOCUS_LEFT) {
// If there is nothing to the left, or this is causing us to
// jump to the right, then what we really want to do is page left.
if (currentFocused != null && nextFocused.getLeft() >= currentFocused.getLeft()) {
handled = pageLeft();
} else {
handled = nextFocused.requestFocus();
}
} else if (direction == View.FOCUS_RIGHT) {
// If there is nothing to the right, or this is causing us to
// jump to the left, then what we really want to do is page right.
if (currentFocused != null && nextFocused.getLeft() <= currentFocused.getLeft()) {
handled = pageRight();
} else {
handled = nextFocused.requestFocus();
}
}
} else if (direction == FOCUS_LEFT || direction == FOCUS_BACKWARD) {
// Trying to move left and nothing there; try to page.
handled = pageLeft();
} else if (direction == FOCUS_RIGHT || direction == FOCUS_FORWARD) {
// Trying to move right and nothing there; try to page.
handled = pageRight();
}
if (handled) {
playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction));
}
return handled;
}
boolean pageLeft() {
if (mCurItem > 0) {
setCurrentItem(mCurItem-1, true);
return true;
}
return false;
}
boolean pageRight() {
if (mAdapter != null && mCurItem < (mAdapter.getCount()-1)) {
setCurrentItem(mCurItem+1, true);
return true;
}
return false;
}
/**
* We only want the current page that is being shown to be focusable.
*/
@Override
public void addFocusables(ArrayList<View> views, int direction, int focusableMode) {
final int focusableCount = views.size();
final int descendantFocusability = getDescendantFocusability();
if (descendantFocusability != FOCUS_BLOCK_DESCENDANTS) {
for (int i = 0; i < getChildCount(); i++) {
final View child = getChildAt(i);
if (child.getVisibility() == VISIBLE) {
ItemInfo ii = infoForChild(child);
if (ii != null && ii.position == mCurItem) {
child.addFocusables(views, direction, focusableMode);
}
}
}
}
// we add ourselves (if focusable) in all cases except for when we are
// FOCUS_AFTER_DESCENDANTS and there are some descendants focusable. this is
// to avoid the focus search finding layouts when a more precise search
// among the focusable children would be more interesting.
if (
descendantFocusability != FOCUS_AFTER_DESCENDANTS ||
// No focusable descendants
(focusableCount == views.size())) {
// Note that we can't call the superclass here, because it will
// add all views in. So we need to do the same thing View does.
if (!isFocusable()) {
return;
}
if ((focusableMode & FOCUSABLES_TOUCH_MODE) == FOCUSABLES_TOUCH_MODE &&
isInTouchMode() && !isFocusableInTouchMode()) {
return;
}
if (views != null) {
views.add(this);
}
}
}
/**
* We only want the current page that is being shown to be touchable.
*/
@Override
public void addTouchables(ArrayList<View> views) {
// Note that we don't call super.addTouchables(), which means that
// we don't call View.addTouchables(). This is okay because a ViewPager
// is itself not touchable.
for (int i = 0; i < getChildCount(); i++) {
final View child = getChildAt(i);
if (child.getVisibility() == VISIBLE) {
ItemInfo ii = infoForChild(child);
if (ii != null && ii.position == mCurItem) {
child.addTouchables(views);
}
}
}
}
/**
* We only want the current page that is being shown to be focusable.
*/
@Override
protected boolean onRequestFocusInDescendants(int direction,
Rect previouslyFocusedRect) {
int index;
int increment;
int end;
int count = getChildCount();
if ((direction & FOCUS_FORWARD) != 0) {
index = 0;
increment = 1;
end = count;
} else {
index = count - 1;
increment = -1;
end = -1;
}
for (int i = index; i != end; i += increment) {
View child = getChildAt(i);
if (child.getVisibility() == VISIBLE) {
ItemInfo ii = infoForChild(child);
if (ii != null && ii.position == mCurItem) {
if (child.requestFocus(direction, previouslyFocusedRect)) {
return true;
}
}
}
}
return false;
}
@Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
// ViewPagers should only report accessibility info for the current page,
// otherwise things get very confusing.
// TODO: Should this note something about the paging container?
final int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
final View child = getChildAt(i);
if (child.getVisibility() == VISIBLE) {
final ItemInfo ii = infoForChild(child);
if (ii != null && ii.position == mCurItem &&
child.dispatchPopulateAccessibilityEvent(event)) {
return true;
}
}
}
return false;
}
private class PagerObserver extends DataSetObserver {
@Override
public void onChanged() {
dataSetChanged();
}
@Override
public void onInvalidated() {
dataSetChanged();
}
}
}
| [
"719586684@qq.com"
] | 719586684@qq.com |
64f51c2cfafba8bf63ff62771285da4091c3e04b | 23d63f7b74766f36706fa917b1c937df59dff08d | /src/main/java/com/art/mapper/actable/constants/MySqlTypeConstant.java | 6fd42d1a993e6eefec255adc1d08faacd3a9955d | [] | no_license | collectionpark007/art-backstage | 26456528d8c0316e46c53b9337849d06cb2167ae | d08821d9167486385cd04f6af180d34ac8ea94fc | refs/heads/master | 2020-05-16T05:03:31.866150 | 2019-04-25T16:46:15 | 2019-04-25T16:46:15 | 182,801,500 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,067 | java | package com.art.mapper.actable.constants;
import com.art.mapper.actable.annotation.LengthCount;
/**
* 用于配置Mysql数据库中类型,并且该类型需要设置几个长度
* 这里配置多少个类型决定了,创建表能使用多少类型
* 例如:varchar(1)
* double(5,2)
* datetime
*
* @author sunchenbin
* @version 2016年6月23日 下午5:59:33
*/
public class MySqlTypeConstant {
@LengthCount
public static final String INT = "int";
@LengthCount
public static final String VARCHAR = "varchar";
@LengthCount(LengthCount=0)
public static final String TEXT = "text";
@LengthCount(LengthCount=0)
public static final String DATETIME = "datetime";
@LengthCount(LengthCount=2)
public static final String DECIMAL = "decimal";
@LengthCount(LengthCount=2)
public static final String DOUBLE = "double";
@LengthCount
public static final String CHAR = "char";
/**
* 等于java中的long
*/
@LengthCount
public static final String BIGINT = "bigint";
}
| [
"306677018@qq.com"
] | 306677018@qq.com |
9ab9330141702ee9c7efcfb598bd2b0f4bdb848b | d68fccef6f0000637fe33149c5eddf34739ecfce | /app/src/main/com/tutk/util/zxing/DecodeThread.java | c1cc7536760b4d99a424980ac919f072f8277035 | [] | no_license | greatriver007/CamBoss | 766d182fff01dbd00aa5d6ebc707a8ff1ef7d202 | c122c7987a4546d0b88d8bb4c47fed829656521f | refs/heads/master | 2021-01-21T20:47:39.698358 | 2017-05-24T10:30:54 | 2017-05-24T10:30:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,586 | java | /*
* Copyright (C) 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tutk.util.zxing;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.DecodeHintType;
import com.google.zxing.ResultPointCallback;
import android.os.Handler;
import android.os.Looper;
import com.tutk.P2PCam264.DELUX.Activity.qr_codeActivity;
import java.util.Hashtable;
import java.util.Vector;
import java.util.concurrent.CountDownLatch;
//import android.content.SharedPreferences;
//import android.preference.PreferenceManager;
/**
* This thread does all the heavy lifting of decoding the images.
*
* @author dswitkin@google.com (Daniel Switkin)
*/
final class DecodeThread extends Thread {
public static final String BARCODE_BITMAP = "barcode_bitmap";
private final qr_codeActivity activity;
private final Hashtable<DecodeHintType, Object> hints;
private Handler handler;
private final CountDownLatch handlerInitLatch;
DecodeThread(qr_codeActivity activity,
Vector<BarcodeFormat> decodeFormats,
String characterSet,
ResultPointCallback resultPointCallback) {
this.activity = activity;
handlerInitLatch = new CountDownLatch(1);
hints = new Hashtable<DecodeHintType, Object>(3);
// // The prefs can't change while the thread is running, so pick them up once here.
// if (decodeFormats == null || decodeFormats.isEmpty()) {
// SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
// decodeFormats = new Vector<BarcodeFormat>();
// if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_1D, true)) {
// decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
// }
// if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_QR, true)) {
// decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
// }
// if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_DATA_MATRIX, true)) {
// decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
// }
// }
if (decodeFormats == null || decodeFormats.isEmpty()) {
decodeFormats = new Vector<BarcodeFormat>();
decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
}
hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);
if (characterSet != null) {
hints.put(DecodeHintType.CHARACTER_SET, characterSet);
}
hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, resultPointCallback);
}
Handler getHandler() {
try {
handlerInitLatch.await();
} catch (InterruptedException ie) {
// continue?
}
return handler;
}
@Override
public void run() {
Looper.prepare();
handler = new DecodeHandler(activity, hints);
handlerInitLatch.countDown();
Looper.loop();
}
}
| [
"mingtseng.chang@huafu.com.tw"
] | mingtseng.chang@huafu.com.tw |
5259343086c6cb18832f5a7d809745d2ef690f17 | 7fe0e4014c12c2fe41c09de9e882462ba253797b | /java-8/src/com/learn/java/methodreference/RefactorMethodReferenceExample.java | 69f8dfe10da584e5d083976ba451bc96683d9198 | [] | no_license | devsoft1999/practice-java | f8101abfc9da4f61c9853f436477d187873285bd | 3da9dc67d4d1094fafb70aea77502a582ac42317 | refs/heads/main | 2023-08-15T14:19:21.378902 | 2021-09-27T11:05:04 | 2021-09-27T11:05:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 600 | java | package com.learn.java.methodreference;
import com.learn.java.data.Student;
import com.learn.java.data.StudentDataBase;
import java.util.function.Predicate;
public class RefactorMethodReferenceExample {
// static Predicate<Student> p1 = (s) -> s.getGradeLevel() >= 3;
static Predicate<Student> p1 =RefactorMethodReferenceExample::greaterThanGradeLevel;
public static boolean greaterThanGradeLevel(Student s){
return s.getGradeLevel()>=3;
}
public static void main(String[] args) {
System.out.println(p1.test(StudentDataBase.studentSupplier.get()));
}
}
| [
"thongchai.sh@gmail.com"
] | thongchai.sh@gmail.com |
847b718415ca54c87a0744a5450cde87fec4a4ee | f3987c1bb8d8171ebe7b06e4917d8836fdf3a4c9 | /SpringCore/src/main/java/com/spring/core/examples/dependency_InjectionDemo/Mobile.java | cbd4812e9ee3238833ad4662094e8cc145e172f0 | [] | no_license | SyedRiyazUddin1/riyaz-corejava | 88650ea93db5ebe931811920bd16416dfb4bfe7d | 96452a4ef33cb46f6d1de5c3f95300cc76abd8a6 | refs/heads/CoreJava | 2022-06-25T17:52:59.007478 | 2020-09-23T17:57:50 | 2020-09-23T17:57:50 | 232,097,721 | 0 | 0 | null | 2022-06-21T02:46:55 | 2020-01-06T12:37:36 | Java | UTF-8 | Java | false | false | 1,619 | java | package com.spring.core.examples.dependency_InjectionDemo;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Mobile {
public static void main(String[] args) {
// SimCard simCard = new Iphone();
// simCard.calling();
// simCard.data();
//This Class should be configurable without changing the source code
//We are not going to create objects now, spring IOC can create objects for us
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("beans.xml");
System.out.println("Config loaded");
// Samsung air = (Samsung) applicationContext.getBean("airtel");
//instead of typecasting, we can also mention the class name inside getBean method
// Samsung air = applicationContext.getBean("airtel",Samsung.class);
// air.calling();
// air.data();
//This class should be configurable without changing the source code, just change the class name in bean.xml
//SimCard simCard = applicationContext.getBean("simCard", SimCard.class);
//Annotation based configuration
SimCard simCard = (SimCard) applicationContext.getBean("airtel");
SimCard simCard1 = (SimCard) applicationContext.getBean("jio");
simCard.calling();
simCard.data();
simCard1.calling();
simCard1.data();
Speaker speaker = (Speaker) applicationContext.getBean("speaker");
System.out.println(speaker);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
620c3bbeda7570aa6a792c5bd59d6f963b123721 | ca4081fc412f3a1051915ef04fa93afc1513373d | /android/src/com/example/eventplanning/ListBox.java | e94f3d4829bd8c46edf79604b02d05210a139da7 | [] | no_license | Corly/OutGoingPlanner | 5a9e9b6f44cdef7cd94e9f1b6e9914ac8e37bac8 | f8a6bfa9151ffc85d8a931dd97b947187e63da4b | refs/heads/master | 2016-09-11T02:49:14.297068 | 2013-07-03T15:16:40 | 2013-07-03T15:16:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,143 | java | package com.example.eventplanning;
import java.util.ArrayList;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class ListBox extends ListView
{
ArrayList<String> elements;
Context context;
ArrayAdapter<String> myarrayAdapter;
public ListBox(Context context , AttributeSet str)
{
super(context ,str);
this.context = context;
elements = new ArrayList<String>();
myarrayAdapter = new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1, elements);
this.setAdapter(myarrayAdapter);
}
public void InsertItem(String item)
{
elements.add(item);
myarrayAdapter.notifyDataSetChanged();
}
public void RemoveItem(int position)
{
elements.remove(position);
myarrayAdapter.notifyDataSetChanged();
}
public void Clear()
{
elements.clear();
myarrayAdapter.notifyDataSetChanged();
}
public void SetContents(ArrayList<String> elements)
{
this.elements.clear();
for (int i = 0;i<elements.size();i++)
{
this.elements.add(elements.get(i));
}
myarrayAdapter.notifyDataSetChanged();
}
}
| [
"botezatu.mihaicatalin@gmail.com"
] | botezatu.mihaicatalin@gmail.com |
3d3308cffd38fd87f38d0e6ba8ee3a5b5b123883 | 95e1d755e34a3da8f1627cc1326b419cf2848ad8 | /spring-feign-consumer/src/main/java/cn/intellif/bucheng/yin/springfeignconsumer/failback/Provider3Impl.java | 2ca3ec14c6f21f94497b4bfe30c4796668e0e8bc | [] | no_license | yinbucheng/spring-cloud-test | fe4263293636efa2f0fff089223123a5468390d2 | b4ec003f7d4e7ae678c7ed1006967e5195761c0c | refs/heads/master | 2020-03-25T11:26:12.035404 | 2018-12-05T12:05:11 | 2018-12-05T12:05:11 | 143,732,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 456 | java | package cn.intellif.bucheng.yin.springfeignconsumer.failback;
import cn.intellif.bucheng.yin.springfeignconsumer.provider.IProvider3;
import org.springframework.stereotype.Component;
@Component
public class Provider3Impl implements IProvider3 {
@Override
public String bookSave() {
throw new RuntimeException("回滚事务");
}
@Override
public String bookSave2() {
throw new RuntimeException("回滚事务");
}
}
| [
"yin.chong@intellif.com"
] | yin.chong@intellif.com |
9009deb01d9a25ebe175374a3990d6a340478184 | cb7f493fedfc0f9d4f874b7752c677bb04bfaf50 | /oving2/oppgave1/Calculator.java | e3664cf59eb90a0746587f6acea0730f55e644bc | [] | no_license | oyvang/nettverksprogrammering-school | ec096c5707b8ea640797a5eeab1d3e6786678ef3 | d69d0fc6bcf75fc0d22a050d5b07bdb2121e32e6 | refs/heads/master | 2020-06-02T20:40:36.457509 | 2014-04-09T10:28:42 | 2014-04-09T10:28:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 992 | java | package oving2.oppgave1;
import java.text.ParseException;
import java.util.*;
/**
* Created by GeirMorten on 23.02.14.
*/
public class Calculator {
private String[] inputSplited;
public Calculator (){
}
private String[] inputSplitter(String input){
return inputSplited = input.split(" ");
}
private boolean isOperatorAdder(String operator){
return operator.equals("+");
}
public Integer Calculate(String input) throws ParseException {
if(!input.matches("^-?\\d+\\s[+|-]\\s-?\\d+")){
throw new ParseException("Feil syntax! eks: -1 + -5",25);
}
inputSplited = inputSplitter(input);
try{
int a = Integer.parseInt(inputSplited[0]);
int b = Integer.parseInt(inputSplited[2]);
return isOperatorAdder(inputSplited[1]) ? a+b : a-b;
}catch (NumberFormatException e){
throw new ParseException("Kan ikke omforme tallene!", 29);
}
}
}
| [
"gm_larsen@oyvang.org"
] | gm_larsen@oyvang.org |
31acd014c27a25c1c5e4e7df091f63088a7516f2 | e3eeb0bf2c9731da373e1ed959e02374454f347c | /hello-java/src/test/java/fx/leyu/jdk/text/DecimalFormatTest.java | 29af3d8c547c85ffff411074dd6ab836a0930e02 | [] | no_license | fxleyu/cu-cafes | fc92f3c566041066544f682ab681f334bc8367bf | 00132e535e1f6705fcf0a808c43e21ec38a6140c | refs/heads/master | 2023-08-16T13:18:53.106167 | 2023-08-10T07:04:39 | 2023-08-10T07:04:39 | 86,216,704 | 3 | 1 | null | 2023-06-14T22:36:31 | 2017-03-26T07:55:58 | Java | UTF-8 | Java | false | false | 895 | java | package fx.leyu.jdk.text;
import org.junit.Assert;
import org.junit.Test;
import java.math.BigDecimal;
import java.text.DecimalFormat;
/**
* 数字格式化
*
* @author fxleyu
*/
public class DecimalFormatTest {
@Test
public void testFormat() {
Assert.assertEquals(".0120", new DecimalFormat(".0000").format(new BigDecimal("0.012001")));
Assert.assertEquals(".012", new DecimalFormat(".####").format(new BigDecimal("0.01200001")));
Assert.assertEquals("0.0120", new DecimalFormat("0.0000").format(new BigDecimal("0.01200001")));
Assert.assertEquals("0.012", new DecimalFormat("#.####").format(new BigDecimal("0.01201")));
Assert.assertEquals("010.0120", new DecimalFormat("000.0000").format(new BigDecimal("10.01200001")));
Assert.assertEquals("10.012", new DecimalFormat("###.####").format(new BigDecimal("10.01200001")));
}
}
| [
"fxleyu@qq.com"
] | fxleyu@qq.com |
870cbdd9b149ba825d5008d804cb13719b10d03c | d81edfe9d6cc318fce964026ce37aacfdaa8e1a6 | /src/Palindromes.java | 41e433cce60f072d911dd9186dc26441083aeb04 | [] | no_license | Andrew-Seo/Level-4 | 2885f7b96204ab8753608833c07957f536edff6f | eb19d095b1b286233928535b245a3c7e36c989d8 | refs/heads/master | 2020-06-11T05:09:53.784079 | 2017-07-28T01:33:49 | 2017-07-28T01:33:49 | 76,000,036 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 587 | java |
public class Palindromes {
public boolean isPalindrome(String string) {
String z = string.toLowerCase();
String f = z.replaceAll("[ ,\\., \\!]", "");
// for (int i = 0; i < f.length(); i++) {
// if (f.charAt(i) != f.charAt(f.length() - i - 1)) {
// return false;
// }
// }
StringBuffer buffer = new StringBuffer(f);
buffer.reverse();
return f.equals(buffer.toString());
}
public Object reverseMe(String string) {
String m = "";
for (int i = 0; i < string.length(); i++) {
m = string.charAt(i) + m;
}
return m;
}
}
//Copyright AndrewSeo Inc. 2016
| [
"league@WTS8.attlocal.net"
] | league@WTS8.attlocal.net |
f10111c9559391a8dfcf6da69dbce84d0971e5fd | 4f89e4d15d667277f87cd409265815753657f5b7 | /src/main/java/managers/FileReaderManager.java | 2c596647a0cb48fab922c0e7eee724fe64935725 | [] | no_license | sreddy18/Trunarrative | 3fea154e292e9f186e18ef9528f60da6b37aa0ec | 4366d86e6305ca40f3a797289e51ac434aea42db | refs/heads/master | 2022-07-19T09:53:10.744600 | 2019-10-13T06:17:58 | 2019-10-13T06:17:58 | 214,264,829 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 595 | java | package managers;
import dataProviders.ConfigFileReader;
/**This Class is maintain single insatnce of class at a time rather than creating many objects of the same class**/
public class FileReaderManager {
private static FileReaderManager fileReaderManager = new FileReaderManager();
private static ConfigFileReader configFileReader;
private FileReaderManager() {
}
public static FileReaderManager getInstance( ) {
return fileReaderManager;
}
public ConfigFileReader getConfigReader() {
return (configFileReader == null) ? new ConfigFileReader() : configFileReader;
}
} | [
"susmitha.vinta@dwp.gov.uk"
] | susmitha.vinta@dwp.gov.uk |
ef3489ed62ac57b07769aa4c080f08b289663c60 | 2a6f2ecacd6f23219edb4144c0a80617b22507ca | /Day3/Session1/MediatorDesignPattern/IUser.java | 1651f5c81830c927c840fbac47f6565a1a3eeb8c | [] | no_license | lionelsamrat10/DesignPatternsJava | 4fca1e5491a1d0db54cb4aace26e5a7803e00ec1 | 0e7643f8bbf4da5f29013266736e2b31729658f5 | refs/heads/main | 2023-03-24T08:29:02.375830 | 2021-03-19T13:18:05 | 2021-03-19T13:18:05 | 348,692,977 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 144 | java | package com.mediator.patter.handson;
public interface IUser {
void sendMessage(String message);
void receiveMessage(String message);
}
| [
"noreply@github.com"
] | noreply@github.com |
bac24ef07dfe0cb59656dbb2d00e6e74744e4599 | a1025e05049f8024ecf346b16844023ca50c39b3 | /Puddle-Interpreter/src/org/cmpiler/kotlin/utils/config/GlobalConfig.java | 16107a7d26289fe386b71b68c8da5fc16c74a12b | [] | no_license | FukuCat/Puddle-IDE | 262e141d077be3af402e9058a263c8ba8d5c6b62 | 870214e09402ba08090b6fdccb1b24b741b8f331 | refs/heads/master | 2023-08-08T11:21:09.559226 | 2017-12-06T12:47:07 | 2017-12-06T12:47:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,964 | java | package org.cmpiler.kotlin.utils.config;
import org.cmpiler.kotlin.utils.PropertiesIO;
import java.io.IOException;
public class GlobalConfig {
private static GlobalConfig instance = null;
private static final String path = "rcs/config.properties";
private boolean quickRun;
private boolean devMode;
private boolean runUI;
private String quickRunPath;
private GlobalConfig(){
String sQuickRun = null, sDevMode = null;
quickRun = devMode = false;
setRunUI(true);
try {
//PropertiesIO.printProperty("rcs/config.properties");
sDevMode = PropertiesIO.readProperty("developerMode", path);
sQuickRun = PropertiesIO.readProperty("quickRun", path);
setQuickRunPath(PropertiesIO.readProperty("quickRunPath", path));
} catch (IOException e) {
e.printStackTrace();
}
if(sDevMode != null)
if(sDevMode.equalsIgnoreCase("true")){
setDevMode(true);
}
if(sQuickRun != null && getQuickRunPath() != null)
if(sQuickRun.equalsIgnoreCase("true")){
setRunUI(false);
setQuickRun(true);
}
}
public static GlobalConfig getInstance(){return instance == null? (instance = new GlobalConfig()) : instance; }
public boolean isQuickRun() {
return quickRun;
}
public void setQuickRun(boolean quickRun) {
this.quickRun = quickRun;
}
public boolean isDevMode() {
return devMode;
}
public void setDevMode(boolean devMode) {
this.devMode = devMode;
}
public boolean isRunUI() {
return runUI;
}
public void setRunUI(boolean runUI) {
this.runUI = runUI;
}
public String getQuickRunPath() {
return quickRunPath;
}
public void setQuickRunPath(String quickRunPath) {
this.quickRunPath = quickRunPath;
}
}
| [
"kenji_fukuoka@dlsu.edu.ph"
] | kenji_fukuoka@dlsu.edu.ph |
31ef9887e5643c8e5f56948aa468ce09c53c64c6 | 3de3dae722829727edfdd6cc3b67443a69043475 | /edexOsgi/com.raytheon.uf.common.dataplugin.profiler/src/com/raytheon/uf/common/dataplugin/profiler/Profilers.java | 7ad92cc285e31c3eacec2bcec09febf9fe95191f | [
"LicenseRef-scancode-public-domain",
"Apache-2.0"
] | permissive | Unidata/awips2 | 9aee5b7ec42c2c0a2fa4d877cb7e0b399db74acb | d76c9f96e6bb06f7239c563203f226e6a6fffeef | refs/heads/unidata_18.2.1 | 2023-08-18T13:00:15.110785 | 2023-08-09T06:06:06 | 2023-08-09T06:06:06 | 19,332,079 | 161 | 75 | NOASSERTION | 2023-09-13T19:06:40 | 2014-05-01T00:59:04 | Java | UTF-8 | Java | false | false | 3,545 | java | /**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.dataplugin.profiler;
import java.io.File;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 28, 2009 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
public class Profilers implements Serializable {
private static final long serialVersionUID = 1L;
private HashMap<Integer,ProfilerSite> stationIdMap = null;
@XmlElement
private List<ProfilerSite> site;
public void addSite(ProfilerSite profilerSite) {
if(site == null) {
site = new ArrayList<ProfilerSite>();
}
site.add(profilerSite);
}
public List<ProfilerSite> getSites() {
return site;
}
public void setSites(List<ProfilerSite> sites) {
this.site = sites;
}
public boolean isLoaded() {
return ((site != null) && (site.size() > 0));
}
/**
*
* @param stationId
* @return
*/
public ProfilerSite get(Integer stationId) {
return stationIdMap.get(stationId);
}
/**
* Lazy creation of the stationIdMap.
*/
private void populateMap() {
stationIdMap = new HashMap<Integer,ProfilerSite>();
for(ProfilerSite s : site) {
try {
Integer key = Integer.parseInt(s.getStationId());
stationIdMap.put(key,s);
} catch(NumberFormatException nfe) {
}
}
}
/**
*
* @param filePath
* @return
*/
public static final Profilers loadProfilers(String filePath) {
return loadProfilers(new File(filePath));
}
/**
*
* @param filePath
* @return
*/
public static final Profilers loadProfilers(File file) {
Profilers profilers = null;
try {
JAXBContext ctx = JAXBContext.newInstance(Profilers.class);
Unmarshaller umsh = ctx.createUnmarshaller();
profilers = (Profilers) umsh.unmarshal(file);
} catch(Exception e) {
e.printStackTrace();
}
profilers.populateMap();
return profilers;
}
}
| [
"mjames@unidata.ucar.edu"
] | mjames@unidata.ucar.edu |
594e66f24b4a7692ddf13b19b746299856a79da3 | 57293e951e1f0b8836428aa93a8a95ac89a7ef44 | /app/src/main/java/com/test/tugasdua/MainActivity.java | 891f8d7c6f3056b4d7d9fd390cc474dca14216b7 | [] | no_license | Kelas-Pemrograman-Mobile-IF-18/18421032-Rulannur-Tugas2 | 4b2561087cd88f2686615a97b200ded955249dac | 2f60f6d6a4cf653e3e40afc5463f8b327aa82699 | refs/heads/main | 2023-04-04T20:12:29.952412 | 2021-04-15T17:01:37 | 2021-04-15T17:01:37 | 358,332,874 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,549 | java | package com.test.tugasdua;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
TextView TxtTampil, TxtJudul;
EditText EdtNama, EdtNo_tlp, EdtProdi, EdtFakultas;
Button BtnSubmit;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TxtJudul = (TextView) findViewById(R.id.TxtJudul);
TxtJudul.setText("Data Diri");
TxtTampil = (TextView) findViewById(R.id.TxtTampil);
EdtNo_tlp = (EditText) findViewById(R.id.EdtNo_tlp);
EdtNama = (EditText) findViewById(R.id.EdtNama);
EdtFakultas = (EditText) findViewById(R.id.EdtFakultas);
EdtProdi = (EditText) findViewById(R.id.EdtProdi);
BtnSubmit = (Button) findViewById(R.id.BtnSubmit);
BtnSubmit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String strNo_tlp = EdtNo_tlp.getText().toString();
String strNama = EdtNama.getText().toString();
String strFakultas = EdtFakultas.getText().toString();
String strProdi = EdtProdi.getText().toString();
TxtTampil.setText(strNo_tlp + "\n" + strNama + "\n" + strProdi+ "\n" + strFakultas);
}
});
}
} | [
"selvyretno520@gmail.com"
] | selvyretno520@gmail.com |
9c1609ef79bdeaea66937b780cd1d2fef65946f1 | a3b6373dfa2d4a2c44ff2f60103265a1b7389c2a | /src/main/java/trackit/TrackIt.java | 0e0f03f0fbbe760ed5943623ea5e998d2baec98b | [] | no_license | jhanreg11/TrackItJava | 3cab56b864ff29087f30161e502d984d00821e5a | bb9c54be71a8430695d436e95daf544ce7f6c7f6 | refs/heads/master | 2022-09-21T10:22:38.403669 | 2020-06-01T02:52:57 | 2020-06-01T02:52:57 | 268,409,383 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,000 | java | // MADE BY: Jacob Hanson-Regalado
package trackit;
import javafx.application.Application;
import javafx.stage.Stage;
import trackit.controllers.*;
import trackit.models.*;
import trackit.views.panes.NavPane;
import java.util.*;
public class TrackIt extends Application {
private static final HashMap<String, Controller> views = new HashMap<>();
private static Stage window;
@Override
public void start(Stage stage) {
window = stage;
User.prepareStatements();
Item.prepareStatements();
Entry.prepareStatements();
views.put("login", new LoginController());
views.put("create", new CreateAccController());
views.put("home", new HomeController());
views.put("stats", new StatsController());
views.put("edit", new EditController());
stage.setTitle("TrackIt");
setViewer("login");
createNavActions(views.get("home").getPage().getNav());
createNavActions(views.get("stats").getPage().getNav());
createNavActions(views.get("edit").getPage().getNav());
}
/**
* Utility method for switching between pages.
*
* @param view key in views to get page to show.
*/
public static void setViewer(String view) {
window.hide();
window.setScene(views.get(view).getPage().getScene());
views.get(view).loadPage();
window.show();
}
/**
* Utility method to set navbar actions for each necessary page.
*
* @param nav nullable navbar to set actions for
*/
private static void createNavActions(NavPane nav) {
if (nav == null)
return;
nav.getHomeLink().setOnAction(e -> setViewer("home"));
nav.getStatsLink().setOnAction(e -> setViewer("stats"));
nav.getLogOutLink().setOnAction(e -> setViewer("login"));
nav.getEditLink().setOnAction(e -> setViewer("edit"));
}
public static void main(String[] args) {
launch(args);
}
}
| [
"jhanreg11@gmail.com"
] | jhanreg11@gmail.com |
66e2c9423a270bebfa0318a08122afaa4546d75f | f8aa2b66e28a1e2861cf35455acf4f0dc2467e32 | /src/lys/javabase/clone/Card.java | 2e97290c7073adbdd6ffba81ab89d3193345415b | [] | no_license | liyinsong/testproject | acfe4e41cc44c28230859b121e63673f88846fcf | fd6d18e21fdd4250e7bfbe4c9516f81c237c2d45 | refs/heads/master | 2016-09-08T00:43:38.833891 | 2015-12-07T03:19:29 | 2015-12-07T03:19:29 | 29,533,600 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 514 | java | package lys.javabase.clone;
public class Card implements Cloneable{
@Override
protected Object clone() throws CloneNotSupportedException {
// TODO Auto-generated method stub
return super.clone();
}
private int cardNum;
private String cardType;
public int getCardNum() {
return cardNum;
}
public void setCardNum(int cardNum) {
this.cardNum = cardNum;
}
public String getCardType() {
return cardType;
}
public void setCardType(String cardType) {
this.cardType = cardType;
}
}
| [
"liyinsong@192.168.0.100"
] | liyinsong@192.168.0.100 |
64151a472e345dfa56680eb8a9cf0f6f337b568a | b6caa29673194ece2652030a384e65a07bc74f66 | /Ejercicios/02_Games/01_TresEnRaya/app/src/main/java/com/miguelcr/a01_tresenraya/BoardActivity.java | 65db3b54fb77322f550c078e84da7bc3389b90e2 | [] | no_license | ManuelRamallo/androidStudioMiguel | 6ea3cb61c9050ccea697fa542faa5252e357241a | 455e0cdecf73a578073e098d9004a33ca2a3007b | refs/heads/master | 2021-05-12T00:03:51.518682 | 2018-02-23T12:17:09 | 2018-02-23T12:17:09 | 117,524,508 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,259 | java | package com.miguelcr.a01_tresenraya;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.GridLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
public class BoardActivity extends AppCompatActivity implements View.OnClickListener {
TextView player1, player2, playerPlay;
ImageView iv0, iv1, iv2, iv3, iv4, iv5, iv6, iv7, iv8;
boolean isPlaying1 = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_board);
player1 = findViewById(R.id.player1);
player2 = findViewById(R.id.player2);
iv0 = findViewById(R.id.imageView);
iv1 = findViewById(R.id.imageView2);
iv2 = findViewById(R.id.imageView5);
iv3 = findViewById(R.id.imageView6);
iv4 = findViewById(R.id.imageView7);
iv5 = findViewById(R.id.imageView8);
iv6 = findViewById(R.id.imageView9);
iv7 = findViewById(R.id.imageView10);
iv8 = findViewById(R.id.imageView11);
playerPlay = findViewById(R.id.playerPlay);
// Rescatar los nombres de los jugadores
Bundle extras = getIntent().getExtras();
String p1Name = extras.getString(Constantes.EXTRA_PLAYER_1);
String p2Name = extras.getString(Constantes.EXTRA_PLAYER_2);
//String idiomaUsuario = getString(R.string.idioma);
player1.setText(p1Name);
player2.setText(p2Name);
playerPlay.setText(p2Name + " plays!");
eventListeners();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_opciones_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
switch (item.getItemId()) {
case R.id.nuevaPartida:
nuevaPartida();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private void nuevaPartida() {
Toast.makeText(this, "Va a empezar una nueva partida", Toast.LENGTH_SHORT).show();
}
private void eventListeners() {
iv0.setOnClickListener(this);
iv1.setOnClickListener(this);
iv2.setOnClickListener(this);
iv3.setOnClickListener(this);
iv4.setOnClickListener(this);
iv5.setOnClickListener(this);
iv6.setOnClickListener(this);
iv7.setOnClickListener(this);
iv8.setOnClickListener(this);
}
@Override
public void onClick(View v) {
int idCasilla = v.getId();
ImageView casillaSeleccionada = null;
switch (idCasilla) {
case R.id.imageView:
casillaSeleccionada = iv0;
break;
case R.id.imageView2:
casillaSeleccionada = iv1;
break;
case R.id.imageView5:
casillaSeleccionada = iv2;
break;
case R.id.imageView6:
casillaSeleccionada = iv3;
break;
case R.id.imageView7:
casillaSeleccionada = iv4;
break;
case R.id.imageView8:
casillaSeleccionada = iv5;
break;
case R.id.imageView9:
casillaSeleccionada = iv6;
break;
case R.id.imageView10:
casillaSeleccionada = iv7;
break;
case R.id.imageView11:
casillaSeleccionada = iv8;
break;
}
if (isPlaying1) {
casillaSeleccionada.setImageResource(R.drawable.ic_github_sign);
} else {
casillaSeleccionada.setImageResource(R.drawable.ic_bitbucket_sign);
}
isPlaying1 = !isPlaying1;
}
}
| [
"mramallodiaz96@gmail.com"
] | mramallodiaz96@gmail.com |
7f4e8946cc132d24d6398f1cabdb162274fefbac | 566bf78adeb8d4ea76abdbdcddedfc094abfb1bc | /src/main/java/com/invoister/web/rest/UserResource.java | 9d0d1a744cdd94c678ec2b95134b58b68bc953ac | [
"Apache-2.0"
] | permissive | anumber8/invoister | c519dbefcc128c3878fd5988ed83e3e16a8a0619 | fc8742ecf3126ee8f4ea4e6913293efa9d1efcb3 | refs/heads/master | 2023-07-04T00:47:18.103548 | 2018-10-04T18:41:25 | 2018-10-04T18:41:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,182 | java | package com.invoister.web.rest;
import com.invoister.config.Constants;
import com.invoister.domain.User;
import com.invoister.repository.UserRepository;
import com.invoister.repository.search.UserSearchRepository;
import com.invoister.security.AuthoritiesConstants;
import com.invoister.service.MailService;
import com.invoister.service.UserService;
import com.invoister.service.dto.UserDTO;
import com.invoister.web.rest.errors.BadRequestAlertException;
import com.invoister.web.rest.errors.EmailAlreadyUsedException;
import com.invoister.web.rest.errors.LoginAlreadyUsedException;
import com.invoister.web.rest.util.HeaderUtil;
import com.invoister.web.rest.util.PaginationUtil;
import com.codahale.metrics.annotation.Timed;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import static org.elasticsearch.index.query.QueryBuilders.*;
/**
* REST controller for managing users.
* <p>
* This class accesses the User entity, and needs to fetch its collection of authorities.
* <p>
* For a normal use-case, it would be better to have an eager relationship between User and Authority,
* and send everything to the client side: there would be no View Model and DTO, a lot less code, and an outer-join
* which would be good for performance.
* <p>
* We use a View Model and a DTO for 3 reasons:
* <ul>
* <li>We want to keep a lazy association between the user and the authorities, because people will
* quite often do relationships with the user, and we don't want them to get the authorities all
* the time for nothing (for performance reasons). This is the #1 goal: we should not impact our users'
* application because of this use-case.</li>
* <li> Not having an outer join causes n+1 requests to the database. This is not a real issue as
* we have by default a second-level cache. This means on the first HTTP call we do the n+1 requests,
* but then all authorities come from the cache, so in fact it's much better than doing an outer join
* (which will get lots of data from the database, for each HTTP call).</li>
* <li> As this manages users, for security reasons, we'd rather have a DTO layer.</li>
* </ul>
* <p>
* Another option would be to have a specific JPA entity graph to handle this case.
*/
@RestController
@RequestMapping("/api")
public class UserResource {
private final Logger log = LoggerFactory.getLogger(UserResource.class);
private final UserService userService;
private final UserRepository userRepository;
private final MailService mailService;
private final UserSearchRepository userSearchRepository;
public UserResource(UserService userService, UserRepository userRepository, MailService mailService, UserSearchRepository userSearchRepository) {
this.userService = userService;
this.userRepository = userRepository;
this.mailService = mailService;
this.userSearchRepository = userSearchRepository;
}
/**
* POST /users : Creates a new user.
* <p>
* Creates a new user if the login and email are not already used, and sends an
* mail with an activation link.
* The user needs to be activated on creation.
*
* @param userDTO the user to create
* @return the ResponseEntity with status 201 (Created) and with body the new user, or with status 400 (Bad Request) if the login or email is already in use
* @throws URISyntaxException if the Location URI syntax is incorrect
* @throws BadRequestAlertException 400 (Bad Request) if the login or email is already in use
*/
@PostMapping("/users")
@Timed
@PreAuthorize("hasRole(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<User> createUser(@Valid @RequestBody UserDTO userDTO) throws URISyntaxException {
log.debug("REST request to save User : {}", userDTO);
if (userDTO.getId() != null) {
throw new BadRequestAlertException("A new user cannot already have an ID", "userManagement", "idexists");
// Lowercase the user login before comparing with database
} else if (userRepository.findOneByLogin(userDTO.getLogin().toLowerCase()).isPresent()) {
throw new LoginAlreadyUsedException();
} else if (userRepository.findOneByEmailIgnoreCase(userDTO.getEmail()).isPresent()) {
throw new EmailAlreadyUsedException();
} else {
User newUser = userService.createUser(userDTO);
mailService.sendCreationEmail(newUser);
return ResponseEntity.created(new URI("/api/users/" + newUser.getLogin()))
.headers(HeaderUtil.createAlert( "userManagement.created", newUser.getLogin()))
.body(newUser);
}
}
/**
* PUT /users : Updates an existing User.
*
* @param userDTO the user to update
* @return the ResponseEntity with status 200 (OK) and with body the updated user
* @throws EmailAlreadyUsedException 400 (Bad Request) if the email is already in use
* @throws LoginAlreadyUsedException 400 (Bad Request) if the login is already in use
*/
@PutMapping("/users")
@Timed
@PreAuthorize("hasRole(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<UserDTO> updateUser(@Valid @RequestBody UserDTO userDTO) {
log.debug("REST request to update User : {}", userDTO);
Optional<User> existingUser = userRepository.findOneByEmailIgnoreCase(userDTO.getEmail());
if (existingUser.isPresent() && (!existingUser.get().getId().equals(userDTO.getId()))) {
throw new EmailAlreadyUsedException();
}
existingUser = userRepository.findOneByLogin(userDTO.getLogin().toLowerCase());
if (existingUser.isPresent() && (!existingUser.get().getId().equals(userDTO.getId()))) {
throw new LoginAlreadyUsedException();
}
Optional<UserDTO> updatedUser = userService.updateUser(userDTO);
return ResponseUtil.wrapOrNotFound(updatedUser,
HeaderUtil.createAlert("userManagement.updated", userDTO.getLogin()));
}
/**
* GET /users : get all users.
*
* @param pageable the pagination information
* @return the ResponseEntity with status 200 (OK) and with body all users
*/
@GetMapping("/users")
@Timed
public ResponseEntity<List<UserDTO>> getAllUsers(Pageable pageable) {
final Page<UserDTO> page = userService.getAllManagedUsers(pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/users");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
/**
* @return a string list of the all of the roles
*/
@GetMapping("/users/authorities")
@Timed
@PreAuthorize("hasRole(\"" + AuthoritiesConstants.ADMIN + "\")")
public List<String> getAuthorities() {
return userService.getAuthorities();
}
/**
* GET /users/:login : get the "login" user.
*
* @param login the login of the user to find
* @return the ResponseEntity with status 200 (OK) and with body the "login" user, or with status 404 (Not Found)
*/
@GetMapping("/users/{login:" + Constants.LOGIN_REGEX + "}")
@Timed
public ResponseEntity<UserDTO> getUser(@PathVariable String login) {
log.debug("REST request to get User : {}", login);
return ResponseUtil.wrapOrNotFound(
userService.getUserWithAuthoritiesByLogin(login)
.map(UserDTO::new));
}
/**
* DELETE /users/:login : delete the "login" User.
*
* @param login the login of the user to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/users/{login:" + Constants.LOGIN_REGEX + "}")
@Timed
@PreAuthorize("hasRole(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<Void> deleteUser(@PathVariable String login) {
log.debug("REST request to delete User: {}", login);
userService.deleteUser(login);
return ResponseEntity.ok().headers(HeaderUtil.createAlert( "userManagement.deleted", login)).build();
}
/**
* SEARCH /_search/users/:query : search for the User corresponding
* to the query.
*
* @param query the query to search
* @return the result of the search
*/
@GetMapping("/_search/users/{query}")
@Timed
public List<User> search(@PathVariable String query) {
return StreamSupport
.stream(userSearchRepository.search(queryStringQuery(query)).spliterator(), false)
.collect(Collectors.toList());
}
}
| [
"ivanmartinezmateu@icloud.com"
] | ivanmartinezmateu@icloud.com |
cb8a8782d863826f42e04b65db0ba5d976bbc7d3 | 00cd46c5722fbb4623d8cefc33bbce6e4c6bf970 | /Easy/1. A + B Problem/Solution.java | 9b6ac57c9ca1aa1fe849ebc087e583c00a1e91d9 | [
"MIT"
] | permissive | jxhangithub/lintcode | 9126d0d951cdc69cd5f061799313f1a96ffe5ab8 | afd79d790d0a7495d75e6650f80adaa99bd0ff07 | refs/heads/master | 2022-04-02T22:02:57.515169 | 2020-02-26T21:32:02 | 2020-02-26T21:32:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 438 | java | public class Solution {
/**
* @param a: An integer
* @param b: An integer
* @return: The sum of a and b
*/
public int aplusb(int a, int b) {
// write your code here
int result = a ^ b; // + without carry 0+0=0, 0+1=1+0=1, 1+1=0
int carry = (a & b) << 1; // 1 + 1 = 2
if (carry != 0) {
return aplusb(result, carry);
}
return result;
}
} | [
"32248549+Zhenye-Na@users.noreply.github.com"
] | 32248549+Zhenye-Na@users.noreply.github.com |
0a4211cd16f558fbb7272b06250c7e90f02a5cff | 88452e69032525b35f3e6d6940722e5836b2f78e | /restanddatabinding/crudrest/src/main/java/com/learn/springboot/crudrest/CrudrestApplication.java | b5e68e1175bd407f3fca1ab846fcf0638e66bb1b | [] | no_license | KenvilPham/SpringbootLearning | ebb1784608c1445155befdb53c41e9b8ab3e80a6 | 56c2e2721adcc775127ad454257ad0eeaf743b6d | refs/heads/master | 2023-06-05T21:44:30.463016 | 2021-07-02T02:22:21 | 2021-07-02T02:22:21 | 371,870,577 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 326 | java | package com.learn.springboot.crudrest;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class CrudrestApplication {
public static void main(String[] args) {
SpringApplication.run(CrudrestApplication.class, args);
}
}
| [
"kenvil.pham92@gmail.com"
] | kenvil.pham92@gmail.com |
80201010855473f899bfb2ab8c81a861ebc981e3 | 6c7a385b8fb496f9e62ef66126b35c159da2f4b5 | /sec-module-xbrlrepository/src/main/java/de/scope/scopeone/reporting/sec/module/xbrlrepository/model/Release.java | bd83f558fd9bdb88efa1b0b22a9c0cc7d669b009 | [] | no_license | JinyKafe/SEC_Reporting_Service_FX | 9ac7ae1ec29d9644b40b6ce8d4e26a39b59aefa3 | fba5f7b72f872e82f1dcd21196fac2505151406f | refs/heads/master | 2023-01-20T02:53:46.373317 | 2020-12-03T18:46:33 | 2020-12-03T18:46:33 | 318,286,173 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 415 | java | package de.scope.scopeone.reporting.sec.module.xbrlrepository.model;
import java.time.LocalDate;
import lombok.Builder;
import lombok.Data;
import lombok.NonNull;
@Data
@Builder
public class Release {
private @NonNull String id;
private @NonNull String jobId;
private @NonNull String fileName;
private @NonNull byte[] content;
private @NonNull String state;
private @NonNull LocalDate releaseDate;
}
| [
"j.kotek@scopegroup.com"
] | j.kotek@scopegroup.com |
e8ac7dbdac48fe1e3811afdae24abbbe5a70721a | ea98535d9be4281521d5084524374a455bae8fe5 | /src/com/yellerapp/client/Reporter.java | 36f01449d6d7c7930b43c52bbeac28ff3a86d631 | [] | no_license | sleyzerzon/yeller_java | 7f083039739b60caeec95b588ef0345f76f5fbfe | 062a0f4f90a735d2a184acbb2e060ccb8fa80d82 | refs/heads/master | 2020-12-11T07:18:32.740091 | 2015-09-22T02:41:11 | 2015-09-22T02:41:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,621 | java | package com.yellerapp.client;
import java.io.PrintWriter;
import java.io.StringWriter;
public class Reporter {
private final String apiKey;
private final String[] urls;
private HTTPClient http;
private int currentBackend = 0;
private YellerErrorHandler handler;
private Debug debug;
public Reporter(String apiKey, String[] urls, HTTPClient http,
YellerErrorHandler handler) {
this.apiKey = apiKey;
this.urls = urls;
this.http = http;
this.handler = handler;
this.debug = null;
}
public Reporter(String apiKey, String[] urls, HTTPClient http,
YellerErrorHandler handler, Debug debug) {
this.apiKey = apiKey;
this.urls = urls;
this.http = http;
this.handler = handler;
this.debug = debug;
}
public void report(FormattedException exception) {
if (exception.applicationEnvironment != null
&& (exception.applicationEnvironment.equals("test") || exception.applicationEnvironment
.equals("development"))) {
this.debugLog("INFO ignoring-error-due-do-development-environment environment=" + exception.applicationEnvironment);
} else {
report(exception, 0, null);
}
}
protected void debugLog(String message) {
if (this.debug != null) {
this.debug.debug(message);
}
}
protected String throwableToString(Throwable t) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
return sw.toString();
}
protected void report(FormattedException exception, int retryCount, Exception previousException) {
if (retryCount > (2 * urls.length)) {
this.debugLog("ERROR ran-out-of-retries retry-count=" + retryCount + " last-error=" + previousException.toString());
this.handler.reportIOError(this.urls[this.currentBackend], previousException);
return;
} else {
try {
this.debugLog("POST at=begin to=" + this.urls[this.currentBackend] + "/" + this.apiKey + " retry-count=" + retryCount);
http.post(this.urls[this.currentBackend] + "/" + this.apiKey,
exception);
this.debugLog("POST at=success to=" + this.urls[this.currentBackend] + "/" + this.apiKey + " retry-count=" + retryCount);
this.cycleBackend();
} catch (AuthorizationException e) {
this.handler.reportAuthError(this.urls[this.currentBackend], e);
} catch (Exception e) {
this.handler.reportIOError(this.urls[this.currentBackend], e);
this.cycleBackend();
report(exception, retryCount + 1, e);
}
}
}
protected synchronized void cycleBackend() {
this.currentBackend = (this.currentBackend + 1) % urls.length;
}
}
| [
"tcrayford@googlemail.com"
] | tcrayford@googlemail.com |
2e6ca6148b366fa27a2cda27c1eea114cd63f839 | 69630494927d65cbd2defb46ba1a9b96ed21db5e | /L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/olympiad/OlympiadManager.java | 1339cb4d5eaf17e40c110685d1fd11cf93dd494a | [] | no_license | nascimentolh/l2dos | 54d33ee00d7b023e9052ad609d789b0636f78dd9 | 35e3aad72f7d99a71a494d9e9ce11ab975c153dd | refs/heads/main | 2023-02-09T21:02:34.543420 | 2021-01-05T22:39:41 | 2021-01-05T22:39:41 | 327,100,108 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,633 | java | /*
* This file is part of the L2J Mobius project.
*
* 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.l2jmobius.gameserver.model.olympiad;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.enums.CategoryType;
import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* @author DS
*/
public class OlympiadManager
{
private final Set<Integer> _nonClassBasedRegisters = ConcurrentHashMap.newKeySet();
private final Map<Integer, Set<Integer>> _classBasedRegisters = new ConcurrentHashMap<>();
protected OlympiadManager()
{
}
public static OlympiadManager getInstance()
{
return SingletonHolder.INSTANCE;
}
public Set<Integer> getRegisteredNonClassBased()
{
return _nonClassBasedRegisters;
}
public Map<Integer, Set<Integer>> getRegisteredClassBased()
{
return _classBasedRegisters;
}
protected final List<Set<Integer>> hasEnoughRegisteredClassed()
{
List<Set<Integer>> result = null;
for (Map.Entry<Integer, Set<Integer>> classList : _classBasedRegisters.entrySet())
{
if ((classList.getValue() != null) && (classList.getValue().size() >= Config.ALT_OLY_CLASSED))
{
if (result == null)
{
result = new ArrayList<>();
}
result.add(classList.getValue());
}
}
return result;
}
protected final boolean hasEnoughRegisteredNonClassed()
{
return _nonClassBasedRegisters.size() >= Config.ALT_OLY_NONCLASSED;
}
protected final void clearRegistered()
{
_nonClassBasedRegisters.clear();
_classBasedRegisters.clear();
AntiFeedManager.getInstance().clear(AntiFeedManager.OLYMPIAD_ID);
}
public boolean isRegistered(PlayerInstance noble)
{
return isRegistered(noble, noble, false);
}
private boolean isRegistered(PlayerInstance noble, PlayerInstance player, boolean showMessage)
{
final Integer objId = noble.getObjectId();
if (_nonClassBasedRegisters.contains(objId))
{
if (showMessage)
{
final SystemMessage sm = new SystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_WAITING_LIST_FOR_THE_ALL_CLASS_BATTLE);
sm.addPcName(noble);
player.sendPacket(sm);
}
return true;
}
final Set<Integer> classed = _classBasedRegisters.get(getClassGroup(noble));
if ((classed != null) && classed.contains(objId))
{
if (showMessage)
{
final SystemMessage sm = new SystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_CLASS_MATCH_WAITING_LIST);
sm.addPcName(noble);
player.sendPacket(sm);
}
return true;
}
return false;
}
public boolean isRegisteredInComp(PlayerInstance noble)
{
return isRegistered(noble, noble, false) || isInCompetition(noble, noble, false);
}
private boolean isInCompetition(PlayerInstance noble, PlayerInstance player, boolean showMessage)
{
if (!Olympiad._inCompPeriod)
{
return false;
}
AbstractOlympiadGame game;
for (int i = OlympiadGameManager.getInstance().getNumberOfStadiums(); --i >= 0;)
{
game = OlympiadGameManager.getInstance().getOlympiadTask(i).getGame();
if (game == null)
{
continue;
}
if (game.containsParticipant(noble.getObjectId()))
{
if (!showMessage)
{
return true;
}
switch (game.getType())
{
case CLASSED:
{
final SystemMessage sm = new SystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_CLASS_MATCH_WAITING_LIST);
sm.addPcName(noble);
player.sendPacket(sm);
break;
}
case NON_CLASSED:
{
final SystemMessage sm = new SystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_WAITING_LIST_FOR_THE_ALL_CLASS_BATTLE);
sm.addPcName(noble);
player.sendPacket(sm);
break;
}
}
return true;
}
}
return false;
}
public boolean registerNoble(PlayerInstance player, CompetitionType type)
{
if (!Olympiad._inCompPeriod)
{
player.sendPacket(SystemMessageId.THE_OLYMPIAD_GAMES_ARE_NOT_CURRENTLY_IN_PROGRESS);
return false;
}
if (Olympiad.getInstance().getMillisToCompEnd() < 1200000)
{
player.sendPacket(SystemMessageId.PARTICIPATION_REQUESTS_ARE_NO_LONGER_BEING_ACCEPTED);
return false;
}
final int charId = player.getObjectId();
if (Olympiad.getInstance().getRemainingWeeklyMatches(charId) < 1)
{
player.sendPacket(SystemMessageId.THE_MAXIMUM_MATCHES_YOU_CAN_PARTICIPATE_IN_1_WEEK_IS_30);
return false;
}
if (isRegistered(player, player, true) || isInCompetition(player, player, true))
{
return false;
}
StatSet statDat = Olympiad.getNobleStats(charId);
if (statDat == null)
{
statDat = new StatSet();
statDat.set(Olympiad.CLASS_ID, player.getBaseClass());
statDat.set(Olympiad.CHAR_NAME, player.getName());
statDat.set(Olympiad.POINTS, Olympiad.DEFAULT_POINTS);
statDat.set(Olympiad.COMP_DONE, 0);
statDat.set(Olympiad.COMP_WON, 0);
statDat.set(Olympiad.COMP_LOST, 0);
statDat.set(Olympiad.COMP_DRAWN, 0);
statDat.set(Olympiad.COMP_DONE_WEEK, 0);
statDat.set("to_save", true);
Olympiad.addNobleStats(charId, statDat);
}
switch (type)
{
case CLASSED:
{
if (player.isOnEvent())
{
player.sendMessage("You can't join olympiad while participating on an Event.");
return false;
}
if ((Config.DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.OLYMPIAD_ID, player, Config.DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP))
{
final NpcHtmlMessage message = new NpcHtmlMessage(player.getLastHtmlActionOriginId());
message.setFile(player, "data/html/mods/OlympiadIPRestriction.htm");
message.replace("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(player, Config.DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP)));
player.sendPacket(message);
return false;
}
_classBasedRegisters.computeIfAbsent(getClassGroup(player), k -> ConcurrentHashMap.newKeySet()).add(charId);
player.sendPacket(SystemMessageId.YOU_HAVE_BEEN_REGISTERED_FOR_THE_OLYMPIAD_WAITING_LIST_FOR_A_CLASS_BATTLE);
break;
}
case NON_CLASSED:
{
if (player.isOnEvent())
{
player.sendMessage("You can't join olympiad while participating on TvT Event.");
return false;
}
if ((Config.DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.OLYMPIAD_ID, player, Config.DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP))
{
final NpcHtmlMessage message = new NpcHtmlMessage(player.getLastHtmlActionOriginId());
message.setFile(player, "data/html/mods/OlympiadIPRestriction.htm");
message.replace("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(player, Config.DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP)));
player.sendPacket(message);
return false;
}
_nonClassBasedRegisters.add(charId);
player.sendPacket(SystemMessageId.YOU_ARE_CURRENTLY_REGISTERED_FOR_A_1V1_CLASS_IRRELEVANT_MATCH);
break;
}
}
return true;
}
public boolean unRegisterNoble(PlayerInstance noble)
{
if (!Olympiad._inCompPeriod)
{
noble.sendPacket(SystemMessageId.THE_OLYMPIAD_GAMES_ARE_NOT_CURRENTLY_IN_PROGRESS);
return false;
}
if ((!noble.isInCategory(CategoryType.THIRD_CLASS_GROUP) && !noble.isInCategory(CategoryType.FOURTH_CLASS_GROUP)) || (noble.getLevel() < 55)) // Classic noble equivalent check.
{
final SystemMessage sm = new SystemMessage(SystemMessageId.CHARACTER_C1_DOES_NOT_MEET_THE_CONDITIONS_ONLY_CHARACTERS_WHO_HAVE_CHANGED_TWO_OR_MORE_CLASSES_CAN_PARTICIPATE_IN_OLYMPIAD);
sm.addString(noble.getName());
noble.sendPacket(sm);
return false;
}
if (!isRegistered(noble, noble, false))
{
noble.sendPacket(SystemMessageId.YOU_ARE_NOT_CURRENTLY_REGISTERED_FOR_THE_OLYMPIAD);
return false;
}
if (isInCompetition(noble, noble, false))
{
return false;
}
final Integer objId = noble.getObjectId();
if (_nonClassBasedRegisters.remove(objId))
{
if (Config.DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0)
{
AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, noble);
}
noble.sendPacket(SystemMessageId.YOU_HAVE_BEEN_REMOVED_FROM_THE_OLYMPIAD_WAITING_LIST);
return true;
}
final Set<Integer> classed = _classBasedRegisters.get(getClassGroup(noble));
if ((classed != null) && classed.remove(objId))
{
if (Config.DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0)
{
AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, noble);
}
noble.sendPacket(SystemMessageId.YOU_HAVE_BEEN_REMOVED_FROM_THE_OLYMPIAD_WAITING_LIST);
return true;
}
return false;
}
public void removeDisconnectedCompetitor(PlayerInstance player)
{
final OlympiadGameTask task = OlympiadGameManager.getInstance().getOlympiadTask(player.getOlympiadGameId());
if ((task != null) && task.isGameStarted())
{
task.getGame().handleDisconnect(player);
}
final Integer objId = player.getObjectId();
if (_nonClassBasedRegisters.remove(objId))
{
return;
}
_classBasedRegisters.getOrDefault(getClassGroup(player), Collections.emptySet()).remove(objId);
}
public int getCountOpponents()
{
return _nonClassBasedRegisters.size() + _classBasedRegisters.size();
}
private static class SingletonHolder
{
protected static final OlympiadManager INSTANCE = new OlympiadManager();
}
private int getClassGroup(PlayerInstance player)
{
return player.getBaseClass();
}
}
| [
"mobius@cyber-wizard.com"
] | mobius@cyber-wizard.com |
cc3624a5459d4f660c24160c327b1273ebc756b2 | 337cb92559eff5f2055d304b464a6289f64c20eb | /support/cas-server-support-thymeleaf/src/test/java/org/apereo/cas/web/view/ThemeFileTemplateResolverTests.java | e213d063ea321737904880a304bf7052c9bb7abd | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | quibeLee/cas | a2b845ae390919e00a9d3ef07e2cb1c7b3889711 | 49eb3617c9a870e65faa1f3d04384000adfb9a6f | refs/heads/master | 2022-12-25T18:31:39.013523 | 2020-09-25T17:02:06 | 2020-09-25T17:02:06 | 299,008,041 | 1 | 0 | Apache-2.0 | 2020-09-27T10:33:58 | 2020-09-27T10:33:57 | null | UTF-8 | Java | false | false | 3,282 | java | package org.apereo.cas.web.view;
import org.apereo.cas.configuration.CasConfigurationProperties;
import lombok.val;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.autoconfigure.RefreshAutoConfiguration;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletContext;
import org.springframework.webflow.context.ExternalContextHolder;
import org.springframework.webflow.context.servlet.ServletExternalContext;
import org.thymeleaf.IEngineConfiguration;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;
/**
* This is {@link ThemeFileTemplateResolverTests}.
*
* @author Misagh Moayyed
* @since 6.2.0
*/
@SpringBootTest(classes = {
RefreshAutoConfiguration.class,
ThymeleafAutoConfiguration.class
})
@EnableConfigurationProperties(CasConfigurationProperties.class)
@Tag("Web")
public class ThemeFileTemplateResolverTests {
@Autowired
private CasConfigurationProperties casProperties;
@Test
public void verifyOperationByRequestAttribute() throws Exception {
val request = new MockHttpServletRequest();
val paramName = casProperties.getTheme().getParamName();
request.setAttribute(paramName, "test");
val mock = new ServletExternalContext(new MockServletContext(), request, new MockHttpServletResponse());
ExternalContextHolder.setExternalContext(mock);
verifyThemeFile();
}
@Test
public void verifyOperationBySessionAttribute() throws Exception {
val request = new MockHttpServletRequest();
val paramName = casProperties.getTheme().getParamName();
request.getSession(true).setAttribute(paramName, "test");
val mock = new ServletExternalContext(new MockServletContext(), request, new MockHttpServletResponse());
ExternalContextHolder.setExternalContext(mock);
verifyThemeFile();
}
private void verifyThemeFile() throws IOException {
val themeDir = new File(FileUtils.getTempDirectory(), "test");
if (!themeDir.exists() && !themeDir.mkdir()) {
fail("Unable to create directory " + themeDir);
}
val path = new File(themeDir, "casLoginView.html");
FileUtils.write(path, "<html><html>", StandardCharsets.UTF_8);
val resolver = new ThemeFileTemplateResolver(casProperties);
resolver.setSuffix(".html");
resolver.setCheckExistence(true);
resolver.setPrefix(FileUtils.getTempDirectoryPath() + "/%s/");
val view = resolver.resolveTemplate(mock(IEngineConfiguration.class), StringUtils.EMPTY, "casLoginView", Map.of());
assertNotNull(view);
}
}
| [
"mm1844@gmail.com"
] | mm1844@gmail.com |
36edb666e4ec8b07b1950fb9086f029d927c8c6d | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Time/25/org/joda/time/LocalTime_parse_129.java | 3e47882604cd8229747173257df499b8055653d4 | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 2,413 | java |
org joda time
local time localtim immut time repres time
time zone
local time localtim link readabl partial readableparti
method focu kei field
hour dai hourofdai minut hour minuteofhour minut secondofminut milli millisofsecond
time field fact queri
calcul local time localtim perform link chronolog
chronolog set intern utc time zone
calcul
individu field queri wai
code hour dai gethourofdai code
code hour dai hourofdai code
techniqu access method
field
numer
text
text
maximum minimum valu
add subtract
set
round
local time localtim thread safe immut provid chronolog
standard chronolog class suppli thread safe immut
author stephen colebourn
local time localtim
pars code local time localtim string formatt
param str string pars
param formatt formatt
local time localtim pars string str date time formatt datetimeformatt formatt
formatt pars local time parselocaltim str
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
130cb70661b48df04a841d7bfd2c99d32c01111f | 7810cdd920da2a794ef6051ec4609188b33fe295 | /src/main/java/org/web/controller/MyController.java | ff2fea9c32cf3b451ebad02925ee326fae6b7d97 | [] | no_license | Priyankat-1996/SpringMVCJDBCAnnotation | 02e5cb5d2bcb5178add40eefd82591a5eb9c36a1 | d76508cc339a7ed60d8d8c8fa63f5b751e349bb7 | refs/heads/master | 2020-04-06T14:16:29.105718 | 2018-11-22T05:42:20 | 2018-11-22T05:42:20 | 157,534,687 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 704 | java | package org.web.controller;
import java.io.IOException;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.web.dao.EmployeeDao;
import org.web.model.Employee;
@Controller
public class MyController {
@Autowired
private EmployeeDao empDao;
@RequestMapping(value = "/fetch")
public ModelAndView listEmployee(ModelAndView model) throws IOException {
List<Employee> listEmp = empDao.empList();
model.addObject("listEmp", listEmp);
model.setViewName("index");
return model;
}
}
| [
"priyanka.thakur@globant.com"
] | priyanka.thakur@globant.com |
b5393c6ac830a5923f86a8b12e9fc9cd621b1853 | 1022ec4d5e90803c96af9bc5eb69ba589b5eb668 | /src/main/java/controller/HRProcess.java | fdafd721bb8c4e13284372a26f7b0e16ee7cdbfb | [] | no_license | hitoamit555/localMvn | 8e890860e1662a6ee1c25030c693cb1e75080f46 | 81e9f752d0258de5a5c7651e2c90f72cac75e0ff | refs/heads/master | 2022-12-04T01:17:58.340109 | 2020-08-24T07:24:15 | 2020-08-24T07:24:15 | 289,858,010 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 336 | java | package controller;
//import org.springframework.web.bind.annotation.restcontroller
import controller.EmployeProcess;
import org.springframework.stereotype.Service;
@Service
public class HRProcess implements EmployeProcess {
@Override
public void permanentEmp() {
System.out.println("permanent process done");
}
}
| [
"hitoamit555@gmail.com"
] | hitoamit555@gmail.com |
417fa68f974b5b4ac61b9d36c7d5d77b3e6dfe51 | d447fc19450714f4b6e5409c624f064a9b74e1e9 | /Forumate/src/forumate/model/Facility.java | ee7ca2db26c878ca178c433bef8c3e09238ac5a2 | [] | no_license | Syon0303/Forumate | 5d16f76d00a79febf300e304b78c7bfd17443c13 | 0e1d8c84cb36918588993e4758ea7dec649ce3a0 | refs/heads/master | 2023-04-01T10:32:56.718677 | 2021-04-05T05:26:03 | 2021-04-05T05:26:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,473 | java | package forumate.model;
public class Facility {
String facilityId;
String facilityName;
String facilityClassification;
String closeDay;
String weekdaySttm;
String weekdayEndtm;
String weekendSttm;
String weekendEndtm;
String paidUse;
String fee;
String capacity;
String additionalFacilityInfo;
String howApply;
String address;
String organizationName;
String phoneNumber;
String url;
double latitude;
double longitude;
int reservations;
public String getFacilityId() {
return facilityId;
}
public void setFacilityId(String facilityId) {
this.facilityId = facilityId;
}
public String getFacilityName() {
return facilityName;
}
public void setFacilityName(String facilityName) {
this.facilityName = facilityName;
}
public String getFacilityClassification() {
return facilityClassification;
}
public void setFacilityClassification(String facilityClassification) {
this.facilityClassification = facilityClassification;
}
public String getCloseDay() {
return closeDay;
}
public void setCloseDay(String closeDay) {
this.closeDay = closeDay;
}
public String getWeekdaySttm() {
return weekdaySttm;
}
public void setWeekdaySttm(String weekdaySttm) {
this.weekdaySttm = weekdaySttm;
}
public String getWeekdayEndtm() {
return weekdayEndtm;
}
public void setWeekdayEndtm(String weekdayEndtm) {
this.weekdayEndtm = weekdayEndtm;
}
public String getWeekendSttm() {
return weekendSttm;
}
public void setWeekendSttm(String weekendSttm) {
this.weekendSttm = weekendSttm;
}
public String getWeekendEndtm() {
return weekendEndtm;
}
public void setWeekendEndtm(String weekendEndtm) {
this.weekendEndtm = weekendEndtm;
}
public String getPaidUse() {
return paidUse;
}
public void setPaidUse(String paidUse) {
this.paidUse = paidUse;
}
public String getFee() {
return fee;
}
public void setFee(String fee) {
this.fee = fee;
}
public String getCapacity() {
return capacity;
}
public void setCapacity(String capacity) {
this.capacity = capacity;
}
public String getAdditionalFacilityInfo() {
return additionalFacilityInfo;
}
public void setAdditionalFacilityInfo(String additionalFacilityInfo) {
this.additionalFacilityInfo = additionalFacilityInfo;
}
public String getHowApply() {
return howApply;
}
public void setHowApply(String howApply) {
this.howApply = howApply;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getOrganizationName() {
return organizationName;
}
public void setOrganizationName(String organizationName) {
this.organizationName = organizationName;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public int getReservations() {
return reservations;
}
public void setReservations(int reservations) {
this.reservations = reservations;
}
}
| [
"bepyan@naver.com"
] | bepyan@naver.com |
18a4dca1390e1f7aef1b5d1fb727d69697ff0125 | 5a0472d901affc72eb3e6cc11fd200eec3858dad | /depthmind-core/src/test/java/com/depthmind/concurrent/CountDownLatchTest.java | 8d76edce54ec9d79acf235898bea36024d0837ad | [
"Apache-2.0"
] | permissive | depthmind/compiled-spring | cbf2915646d83e2925226c1fcef0ad0a2033ff69 | da5d6f9c95289f2e30b9ab8342c3615bbcb9df66 | refs/heads/master | 2023-03-25T13:46:15.280948 | 2021-03-25T06:51:46 | 2021-03-25T06:51:46 | 266,912,057 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,204 | java | package com.depthmind.concurrent;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantLock;
public class CountDownLatchTest {
// volatile int num = 0; 此时加了volatile也不能保证打印结果正确
AtomicInteger num = new AtomicInteger(0);
@org.junit.jupiter.api.Test
public void test() throws InterruptedException {
ReentrantLock reentrantLock = new ReentrantLock(false);
Semaphore semaphore = new Semaphore(2);
CountDownLatch countDownLatch = new CountDownLatch(5);
ExecutorService executorService = Executors.newCachedThreadPool();
for (int i = 0; i < 5; i++) {
int finalI = i;
executorService.execute(() -> {
try {
semaphore.acquire();
printNum();
} catch (InterruptedException e) {
e.printStackTrace();
}
semaphore.release();
countDownLatch.countDown();
});
}
//Thread.sleep(2000);
countDownLatch.await();
executorService.shutdown();
System.out.println("------" + num);
}
private void printNum() throws InterruptedException {
for (int i = 0; i < 2000; i++) {
System.out.println(num.incrementAndGet());
}
TimeUnit.SECONDS.sleep(2);
}
}
| [
"liu_han@ctvit.com.cn"
] | liu_han@ctvit.com.cn |
9e6c8f4291edc12f7191482b78d943099077d0dd | 67fe6495a8c18f442a1a5f0650b89d58252b52d1 | /common/src/main/java/cn/common/ui/fragment/BaseWorkerFragment.java | 2079a37cf78b7fe0fbcf4fcac895bf29e5957af9 | [] | no_license | czg12300/JakeFramework | 96c898db24683be93f61b4684574f6856ccf4cb1 | e33a19142b892832d7670e38875f92c5bc8cebe1 | refs/heads/master | 2021-01-18T01:44:38.085076 | 2016-04-18T10:39:34 | 2016-04-18T10:39:34 | 40,299,232 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,762 | java |
package cn.common.ui.fragment;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import java.lang.ref.WeakReference;
import cn.common.ui.activity.BaseApplication;
public abstract class BaseWorkerFragment extends BaseFragment {
private HandlerThread mHandlerThread;
private BackgroundHandler mBackgroundHandler;
private static class BackgroundHandler extends Handler {
private final WeakReference<BaseWorkerFragment> mActivityReference;
BackgroundHandler(BaseWorkerFragment activity, Looper looper) {
super(looper);
mActivityReference = new WeakReference<BaseWorkerFragment>(activity);
}
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (mActivityReference.get() != null) {
mActivityReference.get().handleBackgroundMessage(msg);
}
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mHandlerThread = new HandlerThread("activity worker:" + getClass().getSimpleName());
mHandlerThread.start();
mBackgroundHandler = new BackgroundHandler(this, mHandlerThread.getLooper());
}
@Override
public void onDestroy() {
super.onDestroy();
if (mBackgroundHandler != null && mBackgroundHandler.getLooper() != null) {
mBackgroundHandler.getLooper().quit();
}
}
protected void loadImage(String url, ImageView view) {
if (view != null && !TextUtils.isEmpty(url)) {
Glide.with(this).load(url)
.placeholder(BaseApplication.getInstance().getDefaultImageResourse())
.crossFade(800).into(view);
}
}
public void handleBackgroundMessage(Message msg) {
}
protected void sendBackgroundMessage(Message msg) {
mBackgroundHandler.sendMessage(msg);
}
protected void sendBackgroundMessageDelayed(Message msg, long delay) {
mBackgroundHandler.sendMessageDelayed(msg, delay);
}
protected void sendEmptyBackgroundMessage(int what) {
mBackgroundHandler.sendEmptyMessage(what);
}
protected void sendEmptyBackgroundMessageDelayed(int what, long delay) {
mBackgroundHandler.sendEmptyMessageDelayed(what, delay);
}
protected void removeBackgroundMessages(int what) {
mBackgroundHandler.removeMessages(what);
}
protected Message obtainBackgroundMessage() {
return mBackgroundHandler.obtainMessage();
}
}
| [
"903475400@qq.com"
] | 903475400@qq.com |
531ed322beb9d693cc03f31848acb76e2a212022 | 6b0ccf9530ad3dd7b2517e66a91373efbffdee70 | /app/src/main/java/com/keybackup/fullscreenfragments/contactchooser/contactadapter/Item.java | ebc4975a3169f5a06e66f4187d7a94fac2d22de2 | [
"Apache-2.0"
] | permissive | tobiasschuelke/FreeUsableCryptographicKeyBackup | 60ce2decbe7fb29f3388515450594b572df6dc5b | 4fb5f05884d9cc14f745208d1cb2566ac59ea0e5 | refs/heads/master | 2021-01-18T16:12:28.795842 | 2017-04-18T23:21:28 | 2017-04-18T23:21:28 | 86,726,448 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 447 | java | package com.keybackup.fullscreenfragments.contactchooser.contactadapter;
import android.content.Context;
import android.os.Parcelable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public interface Item extends Parcelable {
int getViewType();
View getView(LayoutInflater inflater, View convertView, ViewGroup parent, Context context, ContactsAdapter adapter);
boolean isEnabled();
}
| [
"tobys.briese@yahoo.de"
] | tobys.briese@yahoo.de |
7dfde726e63b20aa988fe6f084db44736ee372b5 | 46f5b12b1caa0f18baafc0697b8ca4571be8a65c | /app/src/main/java/com/android/mobile/mywealth/framework/service/impl/ClientServicesLoader.java | 733a946ecd0ad59784764f8a957eaf98db500179 | [] | no_license | ObitoNaruto/mywealth | c878d483f664ef331c32d4d5f51e37ddee3521c5 | 31fbc4414dd2f8484170287a29170a5f7a522d1d | refs/heads/master | 2020-12-24T21:11:51.358440 | 2016-05-20T02:03:56 | 2016-05-20T02:03:56 | 59,257,107 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 178 | java | package com.android.mobile.mywealth.framework.service.impl;
/**
* Created by xinming.xxm on 2016/5/15.
*/
public class ClientServicesLoader extends CommonServiceLoadAgent{
}
| [
"xinming.xxm@alibaba-inc.com"
] | xinming.xxm@alibaba-inc.com |
eac9938f928810f40107149c058a9f6dc02800e9 | c4d419a24cf90d75f654073b25aa29d56005c8e6 | /adventOfCode/ticket-translation/src/main/java/com/kk/aoc/tt/validation/TicketValidator.java | a211702009b9c62627ae62a6241e90a7dc42271a | [] | no_license | kondzio/aoc | d74cb034182c070d4b9178faea602967e6d8202b | 5c2f5a58829415769b08bb44d078044cdd04a55f | refs/heads/main | 2023-02-10T16:03:24.612337 | 2021-01-03T17:10:05 | 2021-01-03T17:10:05 | 318,187,771 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,374 | java | package com.kk.aoc.tt.validation;
import com.kk.aoc.tt.ticket.Field;
import com.kk.aoc.tt.ticket.Ticket;
import lombok.RequiredArgsConstructor;
import java.util.Map;
@RequiredArgsConstructor
public class TicketValidator implements Validator<ValidationResult<Integer>, Ticket> {
private final Map<String, Validator<Boolean, Field<Integer>>> validators;
@Override
public String getName() {
return "Ticket-Validator";
}
public ValidationResult<Integer> validate(Ticket ticket) {
ValidationResult<Integer> validationResult = new ValidationResult<>();
validationResult.setSuccess(true);
for (Field<Integer> field : ticket.getFields()) {
boolean finalValidationStatus = false;
for (Validator<Boolean, Field<Integer>> validator : validators.values()) {
boolean validationStatus = validator.validate(field);
if (validationStatus) {
validationResult.addValidationDetails(validator.getName(), field);
}
finalValidationStatus |= validationStatus;
}
if (!finalValidationStatus) {
validationResult.setSuccess(false);
validationResult.setIncorrectField(field);
return validationResult;
}
}
return validationResult;
}
}
| [
"konrad.kielbasa@ihsmarkit.com"
] | konrad.kielbasa@ihsmarkit.com |
0c0a1d8cc908ece3cefe2890eb0b12d59d281325 | 576073ea1a0847be23882792755eb6fafab341ae | /proj2c/bearmaps/proj2c/MyTrieSet.java | ea05ff149ec522dbe0ebcc39a0cd53302f8ca44d | [] | no_license | yangyuankai/BearMaps | 687e26005b88bba3cca3581db030c31bf30adcc1 | 4249ac9451b4623a7cd180de9e2805fecfb3637d | refs/heads/master | 2020-06-27T13:55:34.706207 | 2019-08-01T03:38:18 | 2019-08-01T03:38:18 | 199,970,556 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,970 | java | package bearmaps.proj2c;
import java.util.ArrayList;
import java.util.List;
public class MyTrieSet {
private Node root;
private static class Node {
private boolean isKey;
private Node[] arr;
private Node(boolean b) {
arr = new Node[256];
isKey = b;
}
private boolean containsChar(char c) {
int num = (int) c; // character to ascii
return (arr[num] != null);
}
private int charIndex(char c) {
int num = (int) c;
return num;
}
private Node charChildNode(char c) {
Node n = arr[charIndex(c)];
return n;
}
private void addChar(char c, boolean isKey) {
int pos = charIndex(c);
arr[pos] = new Node(isKey);
}
private List<Node> allChildrenNode() {
List<Node> l = new ArrayList<>();
for (int i = 0; i < 256; i++) {
if (arr[i] != null) {
l.add(arr[i]);
}
}
return l;
}
private List<String> allChildrenChar(Node n) {
List<String> l = new ArrayList<>();
for (int i = 0; i < 256; i++) {
if (n.arr[i] != null) {
l.add(Character.toString((char) i));
}
}
return l;
}
}
// CCCCCConstructor
public MyTrieSet() {
clear();
}
/**
* Clears all items out of Trie
*/
public void clear() {
root = new Node(false);
}
/**
* Returns true if the Trie contains KEY, false otherwise
*/
public boolean contains(String key) {
Node curr = root;
for (char c : key.toCharArray()) {
if (curr == null) {
return false;
}
if (!curr.containsChar(c)) {
return false;
}
curr = curr.charChildNode(c);
}
return (curr.isKey);
}
/**
* Inserts string KEY into Trie >>>>>>>>>>>>>>>>>>> @source SPEC
*/
public void add(String key) {
if (key == null || key.length() < 1) {
return;
}
Node curr = root;
for (int i = 0, n = key.length(); i < n; i++) {
char c = key.charAt(i);
if (!curr.containsChar(c)) {
curr.addChar(c, false);
}
curr = curr.charChildNode(c);
}
curr.isKey = true;
}
/**
* Returns a list of all words that start with PREFIX
*/
public List<String> keysWithPrefix(String prefix) {
Node curr = root;
for (char c : prefix.toCharArray()) {
if (!curr.containsChar(c)) {
return null;
}
curr = curr.charChildNode(c); // now at the end of the prefix
}
List<String> wordsAfterPrefixx = collectAtNode(curr);
List<String> result = new ArrayList<>();
for (String str : wordsAfterPrefixx) {
result.add(prefix + str);
}
if (this.contains(prefix)) {
result.add(prefix);
}
return result;
}
private List<String> collectAtNode(Node n) {
List<String> x = new ArrayList<>();
for (String c : n.allChildrenChar(n)) {
collectHelp(c, x, n.charChildNode(c.charAt(0)));
}
return x;
}
private void collectHelp(String s, List<String> x, Node n) {
if (n.isKey) {
x.add(s);
}
for (String c : n.allChildrenChar(n)) {
collectHelp(s + c, x, n.charChildNode(c.charAt(0)));
}
}
public static void main(String[] args) {
MyTrieSet my = new MyTrieSet();
my.add("sp");
my.add("spp");
my.add("sppp");
my.add("spppp");
System.out.print(my.keysWithPrefix("spp"));
}
}
| [
"noreply@github.com"
] | noreply@github.com |
a513b8c1c079442d38a38e5fa973f1c94db9e21a | 66969cc83ff6abae115f5ff9a514af589ff320ff | /pidgeot-server/src/main/java/io/jovi/pidgeot/server/PidgeotServer.java | 535b6ec8d9de103fec00d251bf741aa15e81db8d | [] | no_license | maojiawei/pidgeot-im | f0e4ce9c737023735de0e024157776b7a22b0234 | 2d3d8b2925833460d9e737fc6f244700272c44e0 | refs/heads/master | 2021-01-03T04:17:57.319810 | 2020-02-17T10:20:20 | 2020-02-17T10:20:20 | 239,919,276 | 1 | 0 | null | 2020-02-12T03:55:46 | 2020-02-12T03:32:35 | null | UTF-8 | Java | false | false | 2,973 | java | package io.jovi.pidgeot.server;
import io.jovi.pidgeot.handler.ChatReceiveHandler;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.buffer.PooledByteBufAllocator;
import io.netty.channel.*;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import java.net.InetSocketAddress;
/**
* <p>
* Title:
* </p >
* <p>
* Description:
* </p >
* <p>
* Copyright: Copyright (c) 2019
* All rights reserved. 2020-02-12.
* </p >
*
* @author MaoJiaWei
* @version 1.0
*/
@Slf4j
@Component
public class PidgeotServer implements CommandLineRunner {
/**
* 本地文件路径
*/
@Value("${pidgeot.im.port}")
private int port;
@Autowired
private ChatReceiveHandler chatReceiveHandler;
@Override
public void run(String... args) throws Exception {
log.info("正在启动netty服务,端口:{}",port);
// 创建反应器线程组
// 包工头 负责服务器通道新连接的IO事件的监听
EventLoopGroup boosGroup = new NioEventLoopGroup();
// 工人 主要负责传输通道的IO事件处理
EventLoopGroup workerGroup = new NioEventLoopGroup();
ServerBootstrap bootstrap = new ServerBootstrap();
try{
// 1. 设置反应器线程组
bootstrap.group(boosGroup, workerGroup);
// 2. 设置nio类型通道
bootstrap.channel(NioServerSocketChannel.class);
// 3. 设置监听端口
bootstrap.localAddress(new InetSocketAddress(port));
// 4. 设置通道选项
bootstrap.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
// 5. 装配流水线
bootstrap.childHandler(new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel channel) {
channel.pipeline().addLast(chatReceiveHandler);
}
});
// 6. 开始绑定server
// 通过调用sync同步方法阻塞直到绑定成功
ChannelFuture future = bootstrap.bind().sync();
// 7. 监听通道关闭事件
// 应用程序会一直等待,直到channel关闭
future.channel().closeFuture().sync();
}catch (Exception e){
log.error(e.getMessage());
}finally {
// 8. 优雅关闭EventLoopGroup,
// 释放掉所有资源包括创建的线程
boosGroup.shutdownGracefully();
workerGroup.shutdownGracefully();
}
}
/**
* 启动服务
* @param port
*/
public static void run(int port){
}
}
| [
"maojiawei2012180@126.com"
] | maojiawei2012180@126.com |
379d9b144f4f73adbd6eaaff832611d60bb287d5 | 00501da8dba21fcf95e9ffa9aa3b5fdcdad21aca | /src/main/java/com/ja/classgroupware/board/domain/ThumbnailDTO.java | decc74e165933398d83339da0ee0830d0a1ca644 | [] | no_license | Lollllipop/class-groupware | 11904488604af3bdfade95b70a0133eaae3acf87 | 1270982332379b7574a86e7a38e282acd4156213 | refs/heads/master | 2020-04-06T13:19:26.437453 | 2018-12-11T07:24:21 | 2018-12-11T07:24:21 | 157,494,509 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 692 | java | package com.ja.classgroupware.board.domain;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter // 각 필드에 대한 getter 자동 생성
@Setter // 각 필드에 대한 setter 자동 생성
@NoArgsConstructor // 파라미터가 하나도 없는 기본 생성자 자동 생성
@AllArgsConstructor // 모든 필드를 파라미터로 가지는 생성자 자동 생성
public class ThumbnailDTO {
private int file_idx;
private int bo_idx;
private int class_idx;
private String file_link;
private String file_name;
private String file_role;
private String thumbnail_link;
private String file_link_name;
}
| [
"dahan0113@gmail.com"
] | dahan0113@gmail.com |
04a4a0fc468520db9970d76798dacade4b4f94ab | 38af4f2442adab7cfdeb2fed21f26d51bb167ced | /Kathyrose.java | 33fadfb894908c55fe86e1df1b8ea759a102f54b | [] | no_license | Kathyrose/learngit | b7aac3abcb3af7f4fdd00aa5972e86c87eca4221 | e1bf4b9e26db54cb2be0473ec398c1fbbc216c3a | refs/heads/master | 2021-01-10T16:45:25.610473 | 2015-10-24T10:35:56 | 2015-10-24T10:35:56 | 44,859,500 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 379 | java | package com.kathyrose.git;
/**
*@author Kathyrose
*/
public class git{
public static void main(String args[]){
System.out.println("Hello Git");
System.out.println("I'm Kathyrose~");
System.out.println("Hello GitHub");
System.out.println("add a dev branch");
System.out.println("master branch");
System.out.println("aha~");
}
}
| [
"704531702@qq.com"
] | 704531702@qq.com |
d3cf1cbaf457a24cbd7f9080ac67428a815a38d6 | 676d9f586a2848c6239427fdde90de28980632b7 | /app/src/main/java/com/example/nikoweather/db/County.java | a4adfcd10693c4a7033aafd0d893f86707764293 | [
"Apache-2.0"
] | permissive | nikoCLang/NikoWeather | 872db3a50050d62f233e32342f7e62b131625758 | 98f5721ab2920336bfaa0514ae5ca5dc6359a0d6 | refs/heads/master | 2020-04-07T08:19:55.289840 | 2018-11-19T13:52:00 | 2018-11-19T13:52:00 | 158,209,252 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 782 | java | package com.example.nikoweather.db;
/**
* Created by Nikos on 2018/11/19.
*/
public class County {
private int id;
private String countyName;
private String weatherId;
private int cityId;
public int getId(){
return id;
}
public void setId(int id){
this.id = id;
}
private String getCountyName(){
return countyName;
}
private void setCountyName(String countyName){
this.countyName = countyName;
}
public String getWeatherId(){
return weatherId;
}
public void setWeatherId(String weatherId){
this.weatherId = weatherId;
}
public int getCityId(){
return cityId;
}
public void setCityId(int cityId){
this.cityId = cityId;
}
}
| [
"1768540781@qq.com"
] | 1768540781@qq.com |
d6d5f182c2dde9fa7203c6c78d01772ead108fc6 | c60b658115c16e58b4ee1740b90267f246c71ddc | /src/main/java/com/linda/framework/rpc/nio/RpcNioConnector.java | 28d594471a7dc5f02a382784e2618bd473b5348c | [
"MIT"
] | permissive | ice563102472/rpc | d94ea704213d6ef7973c8ac630cf5ce3b0d13b2a | d587ac35de74c38cf971ceea16c84d3c1999d08a | refs/heads/master | 2021-01-24T14:26:59.121512 | 2016-01-11T09:12:00 | 2016-01-11T09:12:00 | 48,944,162 | 1 | 0 | null | 2016-01-03T12:02:41 | 2016-01-03T12:02:41 | null | UTF-8 | Java | false | false | 4,380 | java | package com.linda.framework.rpc.nio;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel;
import org.apache.log4j.Logger;
import com.linda.framework.rpc.exception.RpcException;
import com.linda.framework.rpc.net.AbstractRpcConnector;
import com.linda.framework.rpc.net.RpcNetListener;
import com.linda.framework.rpc.utils.RpcUtils;
public class RpcNioConnector extends AbstractRpcConnector{
private SocketChannel channel;
private AbstractRpcNioSelector selector;
private Logger logger = Logger.getLogger(RpcNioConnector.class);
private ByteBuffer channelWriteBuffer;
private ByteBuffer channelReadBuffer;
private SelectionKey selectionKey;
private RpcNioBuffer rpcNioReadBuffer;
private RpcNioBuffer rpcNioWriteBuffer;
private RpcNioAcceptor acceptor;
public RpcNioConnector(SocketChannel socketChanel,AbstractRpcNioSelector selection){
this(selection);
this.channel = socketChanel;
}
public RpcNioConnector(AbstractRpcNioSelector selector){
super(null);
if(selector==null){
this.selector = new SimpleRpcNioSelector();
}else{
this.selector = selector;
}
this.initBuf();
}
@Override
public void addRpcNetListener(RpcNetListener listener) {
super.addRpcNetListener(listener);
this.selector.addRpcNetListener(listener);
}
public RpcNioConnector(){
this(null);
}
private void initBuf(){
channelWriteBuffer = ByteBuffer.allocate(RpcUtils.MEM_32KB);
channelReadBuffer = ByteBuffer.allocate(RpcUtils.MEM_32KB);
rpcNioReadBuffer = new RpcNioBuffer(RpcUtils.MEM_32KB);
rpcNioWriteBuffer = new RpcNioBuffer(RpcUtils.MEM_32KB);
}
@Override
public void startService() {
super.startService();
try{
if(channel==null){
channel = SocketChannel.open();
channel.connect(new InetSocketAddress(this.getHost(),this.getPort()));
channel.configureBlocking(false);
while(!channel.isConnected());
logger.info("connect to "+this.getHost()+":"+this.getPort()+" success");
selector.startService();
selector.register(this);
}
InetSocketAddress remoteAddress = (InetSocketAddress)channel.socket().getRemoteSocketAddress();
InetSocketAddress localAddress = (InetSocketAddress)channel.socket().getLocalSocketAddress();
//fix jdk 1.6 not support
//InetSocketAddress remoteAddress = (InetSocketAddress)channel.getRemoteAddress();
//InetSocketAddress localAddress = (InetSocketAddress)channel.getLocalAddress();
String remote = RpcUtils.genAddressString("remoteAddress-> ", remoteAddress);
String local = RpcUtils.genAddressString("localAddress-> ", localAddress);
logger.info(local+" "+remote);
remotePort = remoteAddress.getPort();
remoteHost = remoteAddress.getAddress().getHostAddress();
this.fireStartNetListeners();
}catch(IOException e){
logger.error("connect to host "+this.getHost()+" port "+this.getPort()+" failed", e);
throw new RpcException("connect to host error");
}
}
public ByteBuffer getChannelWriteBuffer() {
return channelWriteBuffer;
}
public ByteBuffer getChannelReadBuffer() {
return channelReadBuffer;
}
@Override
public void stopService() {
super.stopService();
this.selector.unRegister(this);
this.sendQueueCache.clear();
this.rpcContext.clear();
try {
channel.close();
channelWriteBuffer.clear();
channelReadBuffer.clear();
rpcNioReadBuffer.clear();
rpcNioWriteBuffer.clear();
} catch (IOException e) {
}
this.stop = true;
}
public boolean isValid(){
return !stop;
}
public SocketChannel getChannel() {
return channel;
}
public SelectionKey getSelectionKey() {
return selectionKey;
}
public void setSelectionKey(SelectionKey selectionKey) {
this.selectionKey = selectionKey;
}
@Override
public void notifySend() {
selector.notifySend(this);
}
public RpcNioBuffer getRpcNioReadBuffer() {
return rpcNioReadBuffer;
}
public RpcNioBuffer getRpcNioWriteBuffer() {
return rpcNioWriteBuffer;
}
public RpcNioAcceptor getAcceptor() {
return acceptor;
}
public void setAcceptor(RpcNioAcceptor acceptor) {
this.acceptor = acceptor;
}
@Override
public void handleConnectorException(Exception e) {
logger.error("connector "+this.getHost()+":"+this.getPort()+" io exception start to shutdown");
this.stopService();
}
}
| [
"linsony0@163.com"
] | linsony0@163.com |
6074a84cc516da7a840328e4e9c39d8a9f8cc890 | 000798d2e261cb9702f01f15863f76f5391c4983 | /main/java/io/github/vexytal/FatigueMechanics/FatigueMechanics.java | a30783d4927710a451ae09f208289ddace76e094 | [] | no_license | VexyTal/vexytal.github.io | daea2f71fe2b6a0b9b9bffc51766ace5b555ad7c | 0cc633a27ea26db094db5a3599f4d2947e07f246 | refs/heads/master | 2021-01-10T15:26:04.331730 | 2015-12-18T23:30:43 | 2015-12-18T23:30:43 | 47,913,894 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 25,500 | java | package io.github.vexytal.FatigueMechanics;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Logger;
import io.github.vexytal.Main;
import io.github.vexytal.DuelMechanics.DuelMechanics;
import io.github.vexytal.FatigueMechanics.commands.CommandFat;
import io.github.vexytal.Hive.ParticleEffect;
import io.github.vexytal.InstanceMechanics.InstanceMechanics;
import io.github.vexytal.ItemMechanics.ItemMechanics;
import io.github.vexytal.MonsterMechanics.MonsterMechanics;
import io.github.vexytal.ProfessionMechanics.ProfessionMechanics;
import io.github.vexytal.RepairMechanics.RepairMechanics;
import io.github.vexytal.TutorialMechanics.TutorialMechanics;
import net.minecraft.server.v1_7_R4.NBTTagCompound;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Result;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerExpChangeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerToggleSprintEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.BlockIterator;
public class FatigueMechanics implements Listener {
static Logger log = Logger.getLogger("Minecraft");
public static ConcurrentHashMap<Player, Integer> fatigue_effect = new ConcurrentHashMap<Player, Integer>();
public static HashMap<String, Float> energy_regen_data = new HashMap<String, Float>();
public static HashMap<String, Float> old_energy = new HashMap<String, Float>();
public static HashMap<String, Long> last_attack = new HashMap<String, Long>();
// Last time a player issued an entityDamage event.
public static CopyOnWriteArrayList<Player> sprinting = new CopyOnWriteArrayList<Player>();
public static CopyOnWriteArrayList<Player> starving = new CopyOnWriteArrayList<Player>();
public String main_world_name = "";
static FatigueMechanics instance = null;
public void onEnable() {
Bukkit.getServer().getPluginManager().registerEvents(this, Main.plugin);
main_world_name = Bukkit.getWorlds().get(0).getName();
instance = this;
Main.plugin.getCommand("fat").setExecutor(new CommandFat());
// Nasty hack to prevent sprinting while starving.
new BukkitRunnable() {
@Override
public void run() {
blockSprinting();
}
}.runTaskTimerAsynchronously(Main.plugin, 2 * 20L, 5L);
// Handles energy regen event.
new BukkitRunnable() {
@Override
public void run() {
replenishEnergy();
}
}.runTaskTimerAsynchronously(Main.plugin, 2 * 20L, 3L);
// Handles the 2 second 'delay' when you run out of energy.
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(Main.plugin, new Runnable() {
public void run() {
ClearFatiguePlayers();
}
}, 2 * 20L, 25L);
// Remove energy for sprinting. AND Handles starving player visual effects.
new BukkitRunnable() {
@Override
public void run() {
for(Player p : Bukkit.getOnlinePlayers()) {
if(p.isSprinting()) {
if(DuelMechanics.isDamageDisabled(p.getLocation()) && !(DuelMechanics.duel_map.containsKey(p.getName())) && !(TutorialMechanics.onIsland.contains(p.getName()))) {
continue;
}
removeEnergy(p, 0.15F); // ORIGINAL: 0.15F
}
}
for(Player p : starving) {
p.removePotionEffect(PotionEffectType.HUNGER);
if(p.getFoodLevel() <= 0) {
p.addPotionEffect(new PotionEffect(PotionEffectType.HUNGER, 40, 0)); // 80
} else {
starving.remove(p.getName());
}
//p.setFoodLevel(0);
}
}
}.runTaskTimerAsynchronously(Main.plugin, 2 * 20L, 10L);
log.info("[FatigueMechanics] V1.0 has been enabled.");
}
public void onDisable() {
log.info("[FatigueMechanics] V1.0 has been disabled.");
}
public void blockSprinting() {
for(Player p : fatigue_effect.keySet()) {
p.setSprinting(false);
}
}
public ItemStack clearModifiers(ItemStack item) {
net.minecraft.server.v1_7_R4.ItemStack is = CraftItemStack.asNMSCopy(item);
if(!is.hasTag()) { return item; }
NBTTagCompound tag = is.tag;
tag.remove("AttributeModifiers");
is.tag = tag;
is.setTag(tag);
return CraftItemStack.asBukkitCopy(is);
}
public static void updateEnergyRegenData(Player p, boolean echo) {
int old_total_regen = 0;
if(energy_regen_data.containsKey(p.getName())) {
old_total_regen = (int) (100 * energy_regen_data.get(p.getName())) - 10;
}
float new_total_regen = generateEnergyRegenAmount(p);
int i_new_total_regen = (int) (new_total_regen * 100) - 10;
energy_regen_data.put(p.getName(), new_total_regen);
if((old_total_regen != i_new_total_regen) && echo == true) {
if(old_total_regen > i_new_total_regen) {
p.sendMessage(ChatColor.RED + "-" + (old_total_regen - i_new_total_regen) + "% ENERGY REGEN [" + (i_new_total_regen + 100) + "%]");
} else {
p.sendMessage(ChatColor.GREEN + "+" + (i_new_total_regen - old_total_regen) + "% ENERGY REGEN [" + (i_new_total_regen + 100) + "%]");
}
}
}
public void ClearFatiguePlayers() {
HashMap<Player, Integer> fatigue_effect_mirror = new HashMap<Player, Integer>(fatigue_effect);
for(Entry<Player, Integer> entry : fatigue_effect_mirror.entrySet()) {
Player p = entry.getKey();
int i = entry.getValue();
if(i >= 1) {
p.removePotionEffect(PotionEffectType.SLOW_DIGGING);
fatigue_effect.remove(p);
p.setExp(0.10F);
updatePlayerLevel(p);
continue;
}
i++;
fatigue_effect.put(p, i);
}
}
public static void updatePlayerLevel(Player p) {
float exp = p.getExp();
double percent = exp * 100.0D;
if(percent > 100) {
percent = 100;
}
if(percent < 0) {
percent = 0;
}
p.setLevel((int) percent);
}
public static float getEnergyPercent(Player p) {
return p.getExp();
}
public void addEnergy(Player p, float add) {
float current_xp = getEnergyPercent(p);
if(current_xp == 1) { return; }
p.setExp(getEnergyPercent(p) + add);
updatePlayerLevel(p);
}
public static void removeEnergy(Player p, float remove) {
if(p.isOp())return;
if(p.hasMetadata("last_energy")) {
if((System.currentTimeMillis() - p.getMetadata("last_energy").get(0).asLong()) < 75) { return; // Less than 100ms since last energy taken, skip.
}
}
p.setMetadata("last_energy", new FixedMetadataValue(Main.plugin, System.currentTimeMillis()));
float current_xp = getEnergyPercent(p);
old_energy.put(p.getName(), current_xp);
if(current_xp <= 0) { return; }
if((getEnergyPercent(p) - remove) <= 0) {
fatigue_effect.put(p, 0);
p.setExp(0.0F);
updatePlayerLevel(p);
//sendPotionPacket(p, new PotionEffect(PotionEffectType.SLOW_DIGGING, 50, 4));
p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, 50, 4));
// Add slow swing
return;
}
p.setExp(getEnergyPercent(p) - remove);
updatePlayerLevel(p);
}
public void replenishEnergy() {
for(Player p : Bukkit.getServer().getOnlinePlayers()) {
if(p.getPlayerListName().equalsIgnoreCase("")) {
continue;
}
if(p.hasMetadata("NPC")) {
continue;
}
if(getEnergyPercent(p) == 1.0F) {
continue;
}
if(getEnergyPercent(p) > 1.0F) {
p.setExp(1.0F);
updatePlayerLevel(p);
continue;
}
if(!fatigue_effect.containsKey(p)) { // If they don't have the 2 second 'no regen' delay.
float res_amount = getEnergyRegainPercent(p.getName());
if(starving.contains(p)) {
res_amount = 0.05F;
// They're starving, static, slow regen rate.
}
res_amount = res_amount / 6.3F; // 6.3, 5.8, 5
if(ProfessionMechanics.fish_energy_regen.containsKey(p.getName())) {
res_amount += (ProfessionMechanics.fish_energy_regen.get(p.getName()) / 400.0F);
}
addEnergy(p, res_amount);
}
}
}
public float getEnergyRegainPercent(String p_name) {
if(!energy_regen_data.containsKey(p_name)) {
energy_regen_data.put(p_name, 0.10F);
}
float energy_regen = energy_regen_data.get(p_name);
if(ItemMechanics.int_data.containsKey(p_name) && (ItemMechanics.int_data.get(p_name) > 0)) {
double int_mod = 0;
if(ItemMechanics.int_data.get(p_name) > 0) {
int_mod = ItemMechanics.int_data.get(p_name);
}
if(Bukkit.getPlayer(p_name) != null) {
Player pl = Bukkit.getPlayer(p_name);
String dmg_data = ItemMechanics.getDamageData(pl.getItemInHand());
if(dmg_data.contains("int=")) {
int_mod += Double.parseDouble(dmg_data.split("int=")[1].split(":")[0]);
}
}
//energy_regen += (int)(double)((double)energy_regen * (double)(((int_mod * 0.015)/100.0D)));
energy_regen += (float) ((float) (((int_mod * 0.015F) / 100.0F)));
}
return energy_regen;
}
public float getEnergyRegenVal(ItemStack i) {
String armor_data = getArmorData(i);
if(armor_data.contains("energy_regen")) {
int energy_regen_val = Integer.parseInt(armor_data.substring(armor_data.indexOf("energy_regen=") + 13, armor_data.indexOf("@energy_regen_split@")));
float f_total_regen = ((float) energy_regen_val / 100.0F);
f_total_regen = f_total_regen + 0.10F;
return f_total_regen;
}
return 0.00F;
}
public static float generateEnergyRegenAmount(Player p) {
ItemStack[] is = p.getInventory().getArmorContents();
int total_regen = 0;
for(ItemStack armor : is) {
if(armor.getType() == Material.AIR) {
continue;
}
String armor_data = getArmorData(armor);
if(armor_data.contains("energy_regen")) {
int energy_regen_val = Integer.parseInt(armor_data.substring(armor_data.indexOf("energy_regen=") + 13, armor_data.indexOf("@energy_regen_split@")));
total_regen += energy_regen_val;
}
}
// TODO: Uncomment 0.10F on 1.1
float f_total_regen = ((float) total_regen / 100.0F); //* 0.50F;
f_total_regen = f_total_regen + 0.10F;
return f_total_regen;
}
public static String getArmorData(ItemStack i) {
return ItemMechanics.getArmorData(i);
}
public static float getEnergyCost(ItemStack i) {
Material m = i.getType();
if(m == Material.AIR) { return 0.05F; }
if(m == Material.WOOD_SWORD) { return 0.06F; }
if(m == Material.STONE_SWORD) { return 0.071F; }
if(m == Material.IRON_SWORD) { return 0.0833F; }
if(m == Material.DIAMOND_SWORD) { return 0.125F; }
if(m == Material.GOLD_SWORD) { return 0.135F; }
if(m == Material.WOOD_AXE) { return 0.0721F * 1.1F; }
if(m == Material.STONE_AXE) { return 0.0833F * 1.1F; }
if(m == Material.IRON_AXE) { return 0.10F * 1.1F; }
if(m == Material.DIAMOND_AXE) { return 0.125F * 1.1F; }
if(m == Material.GOLD_AXE) { return 0.135F * 1.1F; }
if(m == Material.WOOD_SPADE) { return 0.0721F; }
if(m == Material.STONE_SPADE) { return 0.0833F; }
if(m == Material.IRON_SPADE) { return 0.10F; }
if(m == Material.DIAMOND_SPADE) { return 0.125F; }
if(m == Material.GOLD_SPADE) { return 0.135F; }
if(m == Material.WOOD_HOE) { return 0.10F / 1.1F; }
if(m == Material.STONE_HOE) { return 0.12F / 1.1F; }
if(m == Material.IRON_HOE) { return 0.13F / 1.1F; }
if(m == Material.DIAMOND_HOE) { return 0.14F / 1.1F; }
if(m == Material.GOLD_HOE) { return 0.15F / 1.1F; }
if(m == Material.BOW) { // Arrow shooting. Bow punch will be addressed at event level.
int tier = ItemMechanics.getItemTier(i);
if(tier == 1) { return 0.08F; }
if(tier == 2) { return 0.10F; }
if(tier == 3) { return 0.11F; }
if(tier == 4) { return 0.13F; }
if(tier == 5) { return 0.15F; }
}
return 0.10F;
}
public void disableSprint(final Player p) {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Main.plugin, new Runnable() {
public void run() {
p.setSprinting(false);
}
}, 1L);
}
public LivingEntity getTarget(Player pl, boolean livingentity) {
List<Entity> nearbyE = pl.getNearbyEntities(4.0D, 4.0D, 4.0D);
ArrayList<LivingEntity> livingE = new ArrayList<LivingEntity>();
for(Entity e : nearbyE) {
if(e instanceof LivingEntity) {
livingE.add((LivingEntity) e);
}
}
LivingEntity target = null;
BlockIterator bItr = null;
try {
bItr = new BlockIterator(pl, 4);
} catch(IllegalStateException ise) {
return null;
}
Block block;
Location loc;
int bx, by, bz;
double ex, ey, ez;
// loop through player's line of sight
while(bItr.hasNext()) {
block = bItr.next();
bx = block.getX();
by = block.getY();
bz = block.getZ();
// check for entities near this block in the line of sight
for(LivingEntity e : livingE) {
if(!MonsterMechanics.mob_health.containsKey(e) && !(e instanceof Player)) {
continue; // Not something we'll be damaging.
}
loc = e.getLocation();
ex = loc.getX();
ey = loc.getY();
ez = loc.getZ();
if((bx - .75 <= ex && ex <= bx + 1.75) && (bz - .75 <= ez && ez <= bz + 1.75) && (by - 1 <= ey && ey <= by + 2.5)) {
// entity is close enough, set target and stop
target = (LivingEntity) e;
break;
}
}
}
return target;
}
public Player getTarget(Player trader) {
List<Entity> nearbyE = trader.getNearbyEntities(2.0D, 2.0D, 2.0D);
ArrayList<Player> livingE = new ArrayList<Player>();
for(Entity e : nearbyE) {
if(e.getType() == EntityType.PLAYER) {
livingE.add((Player) e);
}
}
Player target = null;
BlockIterator bItr = null;
try {
bItr = new BlockIterator(trader, 2);
} catch(IllegalStateException ise) {
return null;
}
Block block;
Location loc;
int bx, by, bz;
double ex, ey, ez;
// loop through player's line of sight
while(bItr.hasNext()) {
block = bItr.next();
bx = block.getX();
by = block.getY();
bz = block.getZ();
// check for entities near this block in the line of sight
for(LivingEntity e : livingE) {
loc = e.getLocation();
ex = loc.getX();
ey = loc.getY();
ez = loc.getZ();
if((bx - .75 <= ex && ex <= bx + 1.75) && (bz - .75 <= ez && ez <= bz + 1.75) && (by - 1 <= ey && ey <= by + 2.5)) {
// entity is close enough, set target and stop
target = (Player) e;
break;
}
}
}
return target;
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
public void onPlayerAnimation(PlayerInteractEvent e) {
Player p = e.getPlayer();
ItemStack weapon = e.getItem();
if(weapon == null || !e.hasItem()) {
weapon = new ItemStack(Material.AIR);
}
if(!(e.getAction() == Action.LEFT_CLICK_AIR || e.getAction() == Action.LEFT_CLICK_BLOCK)) { return; }
if(p.getWorld().getName().equalsIgnoreCase(main_world_name) && e.hasBlock() && (e.getClickedBlock().getType() == Material.LONG_GRASS)) {
e.setCancelled(true);
e.setUseItemInHand(Result.DENY);
return;
}
if(ItemMechanics.getDamageData(weapon).equalsIgnoreCase("no") && (weapon.getType() != Material.AIR || (weapon.getType() == Material.AIR && !p.getWorld().getName().equalsIgnoreCase(main_world_name)))) {
// Not a weapon, who cares. Will do 1 DMG.
return;
}
if(ProfessionMechanics.isSkillItem(weapon)) { return; // It's a skill item.
}
//if(getTarget(p) != null || (!p.getWorld().getName().equalsIgnoreCase(main_world_name) && !InstanceMechanics.isInstance(p.getWorld().getName()))){return;} // They have a target. The energy will be taken on damage event thingy.
// TODO: Make all swings take energy, beware of mining!!
/*Block b = null;
Material m = null;
try{
b = p.getTargetBlock(ProfessionMechanics.transparent, 4);
m = b.getType();
} catch(IllegalStateException ise){
m = Material.AIR;
//return; // Don't take away energy.
}
if(m == Material.LONG_GRASS){return;} // They might have a target, they might not, but they're hitting a solid block. (right click anvil fix).*/
/*Iif(ItemMechanics.getDamageData(weapon).equalsIgnoreCase("no") && weapon.getType() != Material.AIR){
// Not a weapon, who cares. Will do 1 DMG.
return;
}*/
float energy_cost = getEnergyCost(weapon);
if(weapon.getType() == Material.BOW) {
energy_cost = energy_cost + 0.15F; // Add 15% more for a bow punch than arrow.
p.playSound(p.getLocation(), Sound.PISTON_EXTEND, 1F, 1.5F);
// TODO: Knockback!
}
if(fatigue_effect.containsKey(p)) {
e.setUseItemInHand(Result.DENY);
e.setCancelled(true);
if(p.getWorld().getName().equalsIgnoreCase(Bukkit.getWorlds().get(0).getName()) || InstanceMechanics.isInstance(p.getWorld().getName())) {
//p.playEffect(EntityEffect.HURT);
p.playSound(p.getLocation(), Sound.WOLF_PANT, 10F, 1.5F);
}
return;
}
if(last_attack.containsKey(p.getName()) && (System.currentTimeMillis() - last_attack.get(p.getName())) < 100) {
// Less than 100ms since last attack. -- Don't take any energy.
e.setUseItemInHand(Result.DENY);
e.setCancelled(true);
return;
}
//if(getTarget(p, true) == null){ // If not null, take on damage event.
removeEnergy(p, energy_cost);
//}
/*if(b == null || m == Material.AIR){
removeEnergy(p, energy_cost);
}
else{
if(getTarget(p, true) == null){
// Hitting a block -- animation event is called 3x cause minecraft sucks,
energy_cost = (energy_cost / 3);
}
removeEnergy(p, energy_cost);
}*/
}
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityDamageByEntity(EntityDamageByEntityEvent e) {
if(e.getDamager() instanceof Player) {
if(e.getCause() == DamageCause.CUSTOM) { return; }
Player p = (Player) e.getDamager();
ItemStack weapon = p.getItemInHand();
float energy_cost = getEnergyCost(weapon);
if(weapon.getType() == Material.BOW) {
energy_cost = energy_cost + 0.15F; // Add 15% more for a bow punch than arrow.
// TODO: Knockback!
}
if(fatigue_effect.containsKey(p)) {
e.setCancelled(true);
if(p.getWorld().getName().equalsIgnoreCase(Bukkit.getWorlds().get(0).getName()) || InstanceMechanics.isInstance(p.getWorld().getName())) {
//p.playEffect(EntityEffect.HURT);
p.playSound(p.getLocation(), Sound.WOLF_PANT, 12F, 1.5F);
if(!(e.getEntity() instanceof Player)) {
try {
ParticleEffect.sendToLocation(ParticleEffect.CRIT, e.getEntity().getLocation().add(0, 1, 0), new Random().nextFloat(), new Random().nextFloat(), new Random().nextFloat(), 0.75F, 40);
} catch(Exception e1) {
e1.printStackTrace();
}
}
}
return;
}
if(last_attack.containsKey(p.getName()) && (System.currentTimeMillis() - last_attack.get(p.getName())) < 100) {
// Less than 100ms since last attack.
if(!(ItemMechanics.processing_proj_event.contains(p.getName()))) {
e.setCancelled(true);
e.setDamage(0);
return;
}
}
last_attack.put(p.getName(), System.currentTimeMillis());
if(!ItemMechanics.processing_proj_event.contains(p.getName()) && (!ItemMechanics.getDamageData(weapon).equalsIgnoreCase("no") || (p.getWorld().getName().equalsIgnoreCase(main_world_name)))) {
// Remove energy.
removeEnergy(p, energy_cost);
}
if(!e.isCancelled() && e.getDamage() > 0 && p.getItemInHand() != null && p.getItemInHand().getType() != Material.AIR) {
ItemStack in_hand = p.getItemInHand();
if(in_hand.getType() == Material.WOOD_SWORD || in_hand.getType() == Material.STONE_SWORD || in_hand.getType() == Material.IRON_SWORD || in_hand.getType() == Material.DIAMOND_SWORD || in_hand.getType() == Material.GOLD_SWORD || in_hand.getType() == Material.WOOD_AXE || in_hand.getType() == Material.STONE_AXE || in_hand.getType() == Material.IRON_AXE || in_hand.getType() == Material.DIAMOND_AXE || in_hand.getType() == Material.GOLD_AXE || in_hand.getType() == Material.WOOD_SPADE || in_hand.getType() == Material.STONE_SPADE || in_hand.getType() == Material.IRON_SPADE || in_hand.getType() == Material.DIAMOND_SPADE || in_hand.getType() == Material.GOLD_SPADE || in_hand.getType() == Material.BOW) {
// It's a weapon!
if(DuelMechanics.isDamageDisabled(p.getLocation())) { return; } // No durabillity loss in safe zones.
if(DuelMechanics.duel_map.containsKey(p.getName())) { return; }
RepairMechanics.subtractCustomDurability(p, in_hand, 1, "wep");
//log.info(String.valueOf(getCustomDurability(in_hand, "wep")));
}
}
}
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void FoodLevelChange(FoodLevelChangeEvent event) {
if(!(event.getEntity() instanceof Player)) { return; }
Player p = (Player) event.getEntity();
if(event.getFoodLevel() < p.getFoodLevel()) { // Make sure they're loosing food level.
int r = new Random().nextInt(4); // 0, 1, 2, 3
if(r >= 1) { // Cancel 75% of the time.
event.setCancelled(true);
return;
}
}
if(event.getFoodLevel() > 0 && starving.contains(p)) {
starving.remove(p);
p.removePotionEffect(PotionEffectType.HUNGER);
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
public void onPlayerExpChangeEvent(PlayerExpChangeEvent e) {
e.setAmount(0);
}
@EventHandler(priority = EventPriority.LOW)
public void onEntityDeath(EntityDeathEvent e) {
e.setDroppedExp(0);
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent e) {
final Player p = e.getPlayer();
if(p.getFoodLevel() <= 0) {
if(!(starving.contains(p))) {
starving.add(p);
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Main.plugin, new Runnable() {
public void run() {
p.sendMessage(ChatColor.DARK_GREEN + "" + ChatColor.BOLD + " *STARVING*");
}
}, 20L);
}
}
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent e) {
Player p = e.getPlayer();
starving.remove(p);
sprinting.remove(p);
}
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityDamage(EntityDamageEvent e) {
/*if(e.getCause() == DamageCause.POISON){
if(e.getEntity() instanceof Player){
Player p = (Player)e.getEntity();
if(starving.contains(p)){
e.setCancelled(true);
e.setDamage(0);
return;
}
}
}*/
if(e.getCause() == DamageCause.STARVATION) {
e.setCancelled(true);
e.setDamage(0);
Player p = (Player) e.getEntity();
if(!(p.hasPotionEffect(PotionEffectType.HUNGER))) {
p.addPotionEffect(new PotionEffect(PotionEffectType.HUNGER, 40, 0)); // 50
if(!(starving.contains(p))) {
starving.add(p);
p.sendMessage(ChatColor.DARK_GREEN + "" + ChatColor.BOLD + " *STARVING*");
}
}
//removeEnergy(p, 0.20F);
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerToggleSprint(PlayerToggleSprintEvent e) {
Player p = e.getPlayer();
boolean dmg_disabled = DuelMechanics.isDamageDisabled(p.getLocation());
if(p.getExp() <= 0.0F && (!dmg_disabled || TutorialMechanics.onIsland.contains(p.getName()))) { //fatigue_effect.containsKey(p)
disableSprint(p);
sprinting.remove(p);
} else if(e.isSprinting()) {
sprinting.add(p);
if(!dmg_disabled || TutorialMechanics.onIsland.contains(p.getName())) {
removeEnergy(p, 0.15F);
}
} else {
sprinting.remove(p);
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerFireBow(EntityShootBowEvent e) {
if(!(e.getEntity().getType() == EntityType.PLAYER)) { return; }
Player p = (Player) e.getEntity();
ItemStack i = p.getItemInHand();
float energy_cost = getEnergyCost(i);
if(p.getExp() <= 0.0F) { //fatigue_effect.containsKey(p)
e.setCancelled(true);
return;
}
removeEnergy(p, energy_cost);
}
@EventHandler(priority = EventPriority.LOW)
public void onEntityDamageEntity(EntityDamageByEntityEvent e) {
if(e.getDamager().getType() == EntityType.PLAYER) {
Player p = (Player) e.getDamager();
float energy = p.getExp();
if(old_energy.containsKey(p.getName())) {
energy = old_energy.get(p.getName()); // Fix for player interact taking the energy.
}
if(p.getExp() <= 0.0F) {
if(energy <= 0.0F) {
e.setCancelled(true);
e.setDamage(0);
return;
}
old_energy.put(p.getName(), 0.0F);
}
}
}
@EventHandler
public void onPlayerDeath(PlayerDeathEvent e) {
Player p = e.getEntity();
p.removePotionEffect(PotionEffectType.HUNGER);
sprinting.remove(p);
fatigue_effect.remove(p);
starving.remove(p);
}
}
| [
"noga.austin@gmail.com"
] | noga.austin@gmail.com |
9b95a8d94d9f9a53459bf5343fa83ee4f770620e | db449417eedec3e4bb91c515f0602f2b4f36a26e | /app/src/main/java/asa/org/bd/ammsma/activity/insideLogin/insideHome/OverdueMemberActivity.java | b53931175a7cc6f4945f379dc589eddd5a0b4bd3 | [
"Apache-2.0"
] | permissive | Mahfuj75/AMMSMA | 6672f61d3dd118bd5941eb3c5e91bf7d81439e0d | 6260059db88f68e73c5d9ab7f1300a2bdf732ae7 | refs/heads/master | 2020-11-27T13:46:03.907295 | 2019-12-21T18:36:25 | 2019-12-21T18:36:25 | 229,419,628 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,497 | java | package asa.org.bd.ammsma.activity.insideLogin.insideHome;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Intent;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Spinner;
import android.widget.TextView;
import com.evrencoskun.tableview.TableView;
import com.evrencoskun.tableview.adapter.AbstractTableAdapter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.TimeZone;
import asa.org.bd.ammsma.R;
import asa.org.bd.ammsma.activity.LoginAmmsActivity;
import asa.org.bd.ammsma.customAdapter.SpinnerCustomAdapter;
import asa.org.bd.ammsma.database.DataSourceOperationsCommon;
import asa.org.bd.ammsma.database.DataSourceRead;
import asa.org.bd.ammsma.extra.GroupNameForSpinnerObject;
import asa.org.bd.ammsma.extra.OverDueMember;
import asa.org.bd.ammsma.service.ExtraTask;
import asa.org.bd.ammsma.tableview.TableViewAdapterForOverDueMember;
import asa.org.bd.ammsma.tableview.TableViewListenerForOverDueMember;
import asa.org.bd.ammsma.tableview.TableViewModelForOverDueMmber;
import asa.org.bd.ammsma.tableview.model.Cell;
import asa.org.bd.ammsma.tableview.model.ColumnHeader;
import asa.org.bd.ammsma.tableview.model.RowHeader;
public class OverdueMemberActivity extends AppCompatActivity {
private boolean groupLoadSuccessful = false;
private int programOfficerId;
private List<Integer> groupIdList = new ArrayList<>();
private List<String> groupNames = new ArrayList<>();
private Toolbar toolbar;
private DataSourceRead dataSourceRead;
private TextView textViewNoGroupSelected;
private TextView textView_groupName;
private Spinner spinnerGroup;
private ExtraTask extraTask = new ExtraTask();
private TableView tableView;
private List<OverDueMember> overDueMemberArrayList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_overdue_member);
toolbar = findViewById(R.id.toolbar);
toolbar.setNavigationIcon(R.drawable.back_icon);
setSupportActionBar(toolbar);
Objects.requireNonNull(getSupportActionBar()).setLogo(R.drawable.logowith_space);
TextView textViewProgramOfficerName = findViewById(R.id.textView_programOfficerName);
textView_groupName = findViewById(R.id.textView_groupName);
//CustomNonScrollerListView listViewGroupMembers = findViewById(R.id.listViewGroupMembersName);
//CustomNonScrollerListView listViewMemberOtherInformation = findViewById(R.id.listViewMemberOtherInformation);
spinnerGroup = findViewById(R.id.spinnerGroup);
textViewNoGroupSelected = findViewById(R.id.textViewNoGroupSelected);
dataSourceRead = new DataSourceRead(getApplicationContext());
programOfficerId = getIntent().getIntExtra("ProgramOfficerId", -1);
String programOfficerName = getIntent().getStringExtra("programOfficerName");
String groupName = getIntent().getStringExtra("groupName");
int groupId = getIntent().getIntExtra("groupId", 0);
tableView = findViewById(R.id.tableView);
/*View headerViewMemberName = ((LayoutInflater) Objects.requireNonNull(getSystemService(Context.LAYOUT_INFLATER_SERVICE))).inflate(R.layout.header_view_list_view_member_balance_member_name, null, false);
View headerViewMemberOthers = ((LayoutInflater) Objects.requireNonNull(getSystemService(Context.LAYOUT_INFLATER_SERVICE))).inflate(R.layout.list_title_member_balance_others, null, false);
listViewGroupMembers.addHeaderView(headerViewMemberName);
listViewMemberOtherInformation.addHeaderView(headerViewMemberOthers);*/
if (programOfficerId != -1) {
textViewProgramOfficerName.setText(programOfficerName);
}
if (programOfficerId == -1) {
textViewProgramOfficerName.setText(R.string.user_admin);
}
toolbarNavigationClick();
if (groupId != 0) {
spinnerGroup.setVisibility(View.GONE);
textViewNoGroupSelected.setVisibility(View.GONE);
textView_groupName.setText(groupName);
AsyncTaskForDataLoad asyncTaskForDataLoad = new AsyncTaskForDataLoad(groupId);
asyncTaskForDataLoad.execute();
}
else {
AsyncTaskForGroupListLoad asyncTaskForGroupListLoad = new AsyncTaskForGroupListLoad();
asyncTaskForGroupListLoad.execute();
}
extraTask.serviceTimerTaskReset(ExtraTask.TaskType.Assign, getApplicationContext());
}
@SuppressLint("StaticFieldLeak")
private class AsyncTaskForGroupListLoad extends AsyncTask<Void, Integer, Void> {
private Dialog dialog;
@Override
protected void onPreExecute() {
super.onPreExecute();
dialog = new Dialog(OverdueMemberActivity.this);
dialog.setCancelable(false);
dialog.setContentView(R.layout.progress_dialog);
dialog.show();
}
@Override
protected Void doInBackground(Void... params) {
groupLoadSuccessful = loadSpinnerData();
return null;
}
@Override
protected void onProgressUpdate(Integer... values) {
super.onProgressUpdate(values);
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
if (groupLoadSuccessful) {
loadSpinner();
groupLoadSuccessful = false;
dialog.dismiss();
}
}
}
private boolean loadSpinnerData() {
groupIdList.clear();
groupNames.clear();
try {
List<GroupNameForSpinnerObject> groupNameForSpinnerObjects = dataSourceRead.getAllGroupNameWithoutBadDebtForOverDueMember(programOfficerId);
groupNames.add(0, "Select Group");
groupIdList.add(0, -55);
for (int i = 0; i < groupNameForSpinnerObjects.size(); i++) {
groupNames.add(i + 1, groupNameForSpinnerObjects.get(i).getGroupFullName());
groupIdList.add(i + 1, groupNameForSpinnerObjects.get(i).getGroupId());
}
} catch (Exception e) {
Log.i("error", e.toString());
}
return true;
}
private void toolbarNavigationClick() {
toolbar.setNavigationOnClickListener(v -> {
extraTask.serviceTimerTaskReset(ExtraTask.TaskType.Stop, getApplicationContext());
finish();
});
}
@SuppressLint("SetTextI18n")
private void loadSpinner() {
textView_groupName.setText("No Group");
spinnerGroup.setAdapter(new SpinnerCustomAdapter().arrayListAdapterForSpinnerMemberBalance(groupNames, getApplicationContext()));
spinnerGroup.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (position != 0) {
textView_groupName.setText(spinnerGroup.getSelectedItem().toString().trim());
textViewNoGroupSelected.setVisibility(View.GONE);
tableView.setVisibility(View.GONE);
AsyncTaskForDataLoad asyncTaskForDataLoad = new AsyncTaskForDataLoad(groupIdList.get(position));
asyncTaskForDataLoad.execute();
} else {
textView_groupName.setText("No Group");
tableView.setVisibility(View.GONE);
textViewNoGroupSelected.setText(R.string.no_group_selected);
textViewNoGroupSelected.setVisibility(View.VISIBLE);
}
extraTask.serviceTimerTaskReset(ExtraTask.TaskType.Reset, getApplicationContext());
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
}
@SuppressLint("StaticFieldLeak")
private class AsyncTaskForDataLoad extends AsyncTask<Void, Integer, Void> {
private Dialog dialog;
private int groupId;
AsyncTaskForDataLoad(int groupId) {
this.groupId = groupId;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
dialog = new Dialog(OverdueMemberActivity.this);
dialog.setCancelable(false);
dialog.setContentView(R.layout.progress_dialog);
dialog.show();
}
@Override
protected Void doInBackground(Void... params) {
overDueMemberArrayList = dataSourceRead.getAllMembersForOverDue(groupId);
return null;
}
@Override
protected void onProgressUpdate(Integer... values) {
super.onProgressUpdate(values);
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
if (overDueMemberArrayList!= null && overDueMemberArrayList.size()>0) {
tableView.setVisibility(View.VISIBLE);
textViewNoGroupSelected.setVisibility(View.GONE);
textViewNoGroupSelected.setText(R.string.no_group_selected);
TableViewModelForOverDueMmber tableViewModelForOverDueMmber;
AbstractTableAdapter<ColumnHeader, RowHeader, Cell> mTableViewAdapter;
tableViewModelForOverDueMmber = new TableViewModelForOverDueMmber(overDueMemberArrayList);
mTableViewAdapter = new TableViewAdapterForOverDueMember(getApplicationContext(),overDueMemberArrayList);
tableView.setAdapter(mTableViewAdapter);
tableView.setIgnoreSelectionColors(true);
tableView.setSelectedColor(Color.parseColor("#5efc82"));
tableView.setTableViewListener(new TableViewListenerForOverDueMember(tableView,overDueMemberArrayList));
mTableViewAdapter.setAllItems(tableViewModelForOverDueMmber.getColumnHeaderList(), tableViewModelForOverDueMmber
.getRowHeaderList(), tableViewModelForOverDueMmber.getCellList());
dialog.dismiss();
}
else
{
textViewNoGroupSelected.setVisibility(View.VISIBLE);
textViewNoGroupSelected.setText(R.string.no_overdue_member_found);
tableView.setVisibility(View.GONE);
dialog.dismiss();
}
dialog.dismiss();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_amms, menu);
try {
String currentDate = new DataSourceOperationsCommon(getApplicationContext()).getFirstRealDate();
SimpleDateFormat dateFromDatabase = new SimpleDateFormat("dd/MM/yyyy", Locale.getDefault());
dateFromDatabase.setTimeZone(TimeZone.getTimeZone("GMT+6"));
Date dfd = dateFromDatabase.parse(currentDate);
SimpleDateFormat convertedDate = new SimpleDateFormat("EE", Locale.getDefault());
convertedDate.setTimeZone(TimeZone.getTimeZone("GMT+6"));
String day = convertedDate.format(dfd);
menu.findItem(R.id.action_working_day).setTitle(currentDate + " " + day);
} catch (Exception e) {
e.printStackTrace();
}
String branchName = dataSourceRead.getBranchName();
menu.findItem(R.id.action_location).setTitle(branchName);
menu.findItem(R.id.action_close_current_day).setVisible(false);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_logout) {
AlertDialog.Builder builder = new AlertDialog.Builder(
OverdueMemberActivity.this);
builder.setMessage(
"Are you sure Log-Out from Application?")
.setCancelable(false)
.setTitle("Log Out")
.setPositiveButton("Yes",
(dialog, id1) -> {
Intent i = new Intent(getApplicationContext(), LoginAmmsActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
extraTask.serviceTimerTaskReset(ExtraTask.TaskType.Kill, getApplicationContext());
startActivity(i);
finish();
})
.setNegativeButton("No",
(dialog, id12) -> dialog.cancel());
AlertDialog alert = builder.create();
alert.show();
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed() {
//super.onBackPressed();
}
}
| [
"mahfujur.rahman75@gmail.com"
] | mahfujur.rahman75@gmail.com |
f40f38d908e9576f1c82af4c0eb7fc1565d54f19 | a5ffb1e9c7f9d2af7872c04b5584257d8352c7ab | /code/IDEA-springboot-projectes/012-springboot-mybatis/src/main/java/com/bjpowernode/springboot/web/StudentController.java | 42360b317e6dfb9a20039dddf4ef1052d74807fb | [] | no_license | geng9516/SpringBoot | 1da86dfaa71fe8fa2e4f00ab97517cb02db18537 | 32c22f6b39e2255f8f37b9259c00365daa477825 | refs/heads/main | 2023-01-21T13:00:33.836015 | 2020-12-03T15:15:38 | 2020-12-03T15:15:38 | 318,233,051 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 858 | java | package com.bjpowernode.springboot.web;
import com.bjpowernode.springboot.model.Student;
import com.bjpowernode.springboot.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* ClassName:StudentController
* Package:com.bjpowernode.springboot.web
* Description:
*
* @date:2020/3/6 11:47
* @author:蛙课网
*/
@Controller
public class StudentController {
@Autowired
private StudentService studentService;
@RequestMapping(value = "/student")
public @ResponseBody Object student(Integer id) {
Student student = studentService.queryStudentById(id);
return student;
}
}
| [
"chengeng0516@gmail.com"
] | chengeng0516@gmail.com |
fc8de5f5870a8c793c08f09b35c076d80e85d5eb | 2a2861ca7dfdcdc233af258b4a20b45aab82326f | /taetaetae/step02/src/main/java/spms/dao/ProjectDao.java | 5848655af372e949d5e32d3aa56f5f0d8a63eae5 | [
"Unlicense"
] | permissive | leehojae/taekbae | a8083fa1b2d881a27902dd103bab6d39f9681c66 | a38df7ba7db77d8f613bb18217efa7f15f5e0fa5 | refs/heads/master | 2021-01-02T08:52:18.031324 | 2014-04-03T01:35:35 | 2014-04-03T01:35:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 418 | java | package spms.dao;
import java.util.List;
import java.util.Map;
import spms.vo.Project;
public interface ProjectDao {
public List<Project> selectList(Map<String,Object> paramMap)
throws Exception;
public Project selectOne(int no) throws Exception;
public int insert(Project project) throws Exception;
public int update(Project project) throws Exception;
public int delete(int no) throws Exception;
}
| [
"leehojae.theo@gmail.com"
] | leehojae.theo@gmail.com |
034012933874ba15d898748b7863808fcd252479 | 79c29fc1c46805043cf93d18ad2ccb4c7818b41e | /apiconsultorio/src/main/java/com/example/apiconsultorio/dao/EnderecoRepository.java | 077d824a7299195c1c8d32f081b354ecdd4479e0 | [] | no_license | cesarsst/ApiConsultorio | 94a9afe94aeb8101ddb348ac2ddc06e0751a3842 | 689caa5b0901b07f44a7654880c47de45f1fbd5d | refs/heads/master | 2022-12-29T04:36:22.854706 | 2020-10-21T19:51:14 | 2020-10-21T19:51:14 | 297,874,188 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 272 | java | package com.example.apiconsultorio.dao;
import com.example.apiconsultorio.model.Endereco;
import org.springframework.data.repository.CrudRepository;
public interface EnderecoRepository extends CrudRepository<Endereco, Integer> {
Endereco findByPacienteId(int id);
}
| [
"32494389+cesarsst@users.noreply.github.com"
] | 32494389+cesarsst@users.noreply.github.com |
6e52acde9b94f5ec3f8278e07a3bdd4939bde674 | c74d2a639c6cc0d675fee2503c7966ff875b489c | /app/src/main/java/com/parfois/kotlinrippleview/view/RippleView.java | 23404d38ca8acf6f352b5d441630144c13695277 | [] | no_license | ParfoisMeng/KotlinRippleView | f74026c1e5853a27689928f23a1c808ff5c7f5ac | cb150831d82356bc8df49747993cfe64b8d99237 | refs/heads/master | 2021-01-25T04:49:27.290241 | 2017-06-06T07:55:27 | 2017-06-06T07:55:27 | 93,484,779 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,915 | java | package com.parfois.kotlinrippleview.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;
import com.parfois.kotlinrippleview.R;
import java.util.ArrayList;
import java.util.List;
/**
* Created by parfoismeng on 2017/5/31.
*/
public class RippleView extends View {
private Paint paint;
private boolean isStarting;// 是否运行
private int centerRadius;// 中心圆半径
private int circleSum;// 同心圆总数
public RippleView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
public RippleView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
initAttr(context, attrs);
}
public RippleView(Context context) {
super(context);
init();
}
private void init() {
isStarting = false;
paint = new Paint();
list.add(new Round(0, 255, Color.BLUE));
}
private void initAttr(Context context, AttributeSet attrs) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ripple);
centerRadius = a.getDimensionPixelSize(R.styleable.ripple_centerRadius, 50);
circleSum = a.getInteger(R.styleable.ripple_circleSum, 5);
}
private List<Round> list = new ArrayList<>();
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
paint.setTextSize(24);
canvas.drawText("" + list.size(), getWidth() / 2, 50, paint);
setBackgroundColor(Color.TRANSPARENT);// 颜色:完全透明
for (int i = 0; i < list.size(); i++) {
paint.setColor(list.get(i).color);
paint.setAlpha(list.get(i).alpha);
canvas.drawCircle(getWidth() / 2, getHeight() / 2, list.get(i).radius + centerRadius, paint);
if (isStarting && list.get(i).alpha > 0 && list.get(i).radius < getWidth()) {
list.get(i).alpha--;
list.get(i).radius++;
}
}
if (isStarting && list.get(list.size() - 1).radius == getWidth() / 2 / circleSum) {
list.add(new Round(0, 255, Color.BLUE));
}
if (isStarting && list.size() > 10) {
list.remove(0);
}
invalidate();
}
// 执行动画
public void toggle() {
isStarting = !isStarting;
}
// 判断动画在不在执行
public boolean isStarting() {
return isStarting;
}
private class Round {
int radius;
int alpha;
int color;
public Round(int radius, int alpha, int color) {
this.radius = radius;
this.alpha = alpha;
this.color = color;
}
}
} | [
"youshi520000@163.com"
] | youshi520000@163.com |
1bb56da5ea79505b6dc834a74911e53bba43e30f | 244f8f59f21dd513d3efe62195d70cf703fa9d42 | /Repaso/src/comm/ComunicacionTCP.java | c016475754949356b9a0c869c59eb403cd17a517 | [] | no_license | sofiaHormaza/repaso-de-parcial-1 | 9a79d0d0f0dd657e25a9face3ab21c041eb129b4 | a0e51dc3719f4aaf7e2d213176fdd8f749625283 | refs/heads/master | 2021-03-19T05:42:40.194761 | 2020-03-13T18:31:45 | 2020-03-13T18:31:45 | 247,137,664 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,006 | java | package comm;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.ServerSocket;
import java.net.Socket;
import main.Figura;
import main.Main;
import processing.core.PApplet;
public class ComunicacionTCP extends Thread {
private Socket socket;
private BufferedReader reader;
private BufferedWriter writer;
private PApplet app;
String line;
Main main;
public ComunicacionTCP(Main main) {
this.main=main;
}
public void run() {
try {
ServerSocket server=new ServerSocket(5000);
System.out.println("esperando");
this.socket=server.accept();
System.out.println("conexion aceptada");
InputStream is=socket.getInputStream();
InputStreamReader isr=new InputStreamReader(is);
this.reader=new BufferedReader(isr);
OutputStream os=socket.getOutputStream();
OutputStreamWriter osw=new OutputStreamWriter(os);
this.writer=new BufferedWriter(osw);
while(true) {
recibirMensaje();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void esperarConexion() {
this.start();
}
public void mandarMensaje(String mensaje) {
new Thread(
()->{
try {
writer.write(mensaje+"\n");
writer.flush();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
).start();
}
public void recibirMensaje() throws IOException {
line=reader.readLine();
System.out.println(line);
String[]info=line.split(":");
int x=Integer.parseInt(info[0]);
int y=Integer.parseInt(info[1]);
String mensaj=info[2];
main.getFigures().add(new Figura(app, x, y, mensaj));
}
public void cerrarConexion() {
try {
socket.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"sofiahormazasandoval@gmail.com"
] | sofiahormazasandoval@gmail.com |
6df9d242f6793d9bd0f4d6da87aabd8fdd4fe709 | 66c79604fd7c188066917c0bffb54e55381d8cd6 | /Laboratorio4-Ordenamiento/src/ordenamiento/ComparaOrdenFrame.java | 2f8cbc3e5430bf2710abddcc92b6bc5a58f4071e | [] | no_license | Rk-Hk/Javeando | dfb41dbbf03795fc7774294fcedad1e66d88b4f9 | c94f26ce9c561b07b3f3807e82284202f538be3e | refs/heads/master | 2020-12-02T09:54:16.952822 | 2017-07-09T03:58:23 | 2017-07-09T03:58:23 | 96,657,038 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 27,832 | 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 ordenamiento;
/**
*
* @author Pregrado
*/
public class ComparaOrdenFrame extends javax.swing.JFrame {
/**
* Creates new form ComparaOrdenFrame
*/
public ComparaOrdenFrame() {
initComponents();
Llena_quicksort();
Llena_Insercion();
Llena_burbuja();
}
public void Llena_burbuja(){
Empresa miEmpresa3 = new Empresa();
miEmpresa3.OrdenBurbuja();
for(int i=0; i<miEmpresa3.getNumeroDeEmpleados(); i++){
jTable1.setValueAt(i+1,i,0);
jTable1.setValueAt(miEmpresa3.getCodigoDelEmpleado(i),i,1);
jTable1.setValueAt(miEmpresa3.getNombreDelEmpleado(i),i,2);
jTable1.setValueAt(miEmpresa3.getSueldoDelEmpleado(i),i,3);
}
;
jTextField1.setText(miEmpresa3.getComparaciones()+"");
jTextField2.setText(miEmpresa3.getIntercambios()+"");
}
public void Llena_Insercion(){
Empresa miEmpresa3 = new Empresa();
miEmpresa3.OrdenInsercionDirecta();
for(int i=0; i<miEmpresa3.getNumeroDeEmpleados(); i++){
jTable2.setValueAt(i+1,i,0);
jTable2.setValueAt(miEmpresa3.getCodigoDelEmpleado(i),i,1);
jTable2.setValueAt(miEmpresa3.getNombreDelEmpleado(i),i,2);
jTable2.setValueAt(miEmpresa3.getSueldoDelEmpleado(i),i,3);
}
;
jTextField3.setText(miEmpresa3.getComparaciones()+"");
jTextField4.setText(miEmpresa3.getIntercambios()+"");
}
public void Llena_quicksort(){
Empresa miEmpresa3 = new Empresa();
miEmpresa3.quicksort(0, 19);
for(int i=0; i<miEmpresa3.getNumeroDeEmpleados(); i++){
jTable3.setValueAt(i+1,i,0);
jTable3.setValueAt(miEmpresa3.getCodigoDelEmpleado(i),i,1);
jTable3.setValueAt(miEmpresa3.getNombreDelEmpleado(i),i,2);
jTable3.setValueAt(miEmpresa3.getSueldoDelEmpleado(i),i,3);
}
;
jTextField6.setText(miEmpresa3.getComparaciones()+"");
jTextField5.setText(miEmpresa3.getIntercambios()+"");
}
/**
* 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() {
jPanel1 = new javax.swing.JPanel();
jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
jTextField7 = new javax.swing.JTextField();
jScrollPane4 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jButton1 = new javax.swing.JButton();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jScrollPane2 = new javax.swing.JScrollPane();
jTable2 = new javax.swing.JTable();
jScrollPane3 = new javax.swing.JScrollPane();
jTable3 = new javax.swing.JTable();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jTextField3 = new javax.swing.JTextField();
jTextField4 = new javax.swing.JTextField();
jTextField5 = new javax.swing.JTextField();
jLabel9 = new javax.swing.JLabel();
jTextField6 = new javax.swing.JTextField();
jLabel10 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(51, 51, 51));
jPanel1.setBackground(new java.awt.Color(102, 102, 102));
jLabel11.setFont(new java.awt.Font("Arial Black", 0, 12)); // NOI18N
jLabel11.setForeground(new java.awt.Color(255, 255, 255));
jLabel11.setText("METODOS DE BUSQUEDAS");
jLabel12.setFont(new java.awt.Font("Arial Black", 0, 12)); // NOI18N
jLabel12.setForeground(new java.awt.Color(255, 255, 255));
jLabel12.setText("BUSQUEDA BINARIA ");
jLabel13.setForeground(new java.awt.Color(255, 255, 255));
jLabel13.setText("CODIGO : ");
jTextField7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField7ActionPerformed(evt);
}
});
jTextArea1.setColumns(20);
jTextArea1.setRows(5);
jScrollPane4.setViewportView(jTextArea1);
jButton1.setText("BUSCAR");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jLabel14.setBackground(new java.awt.Color(0, 255, 204));
jLabel14.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel14.setForeground(new java.awt.Color(0, 204, 204));
jLabel14.setText("AUTORES :");
jLabel15.setBackground(new java.awt.Color(0, 255, 204));
jLabel15.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel15.setForeground(new java.awt.Color(0, 204, 204));
jLabel15.setText("Balvin Esteban Raul Ricardo 13200139");
jLabel16.setBackground(new java.awt.Color(0, 255, 204));
jLabel16.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel16.setForeground(new java.awt.Color(0, 204, 204));
jLabel16.setText("Jaimes Gonzales Nelson 13200139");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jLabel11)
.addGap(59, 59, 59))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jButton1))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addGap(28, 28, 28)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel13)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane4)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel14)
.addComponent(jLabel12))
.addGap(0, 0, Short.MAX_VALUE)))))
.addGap(37, 37, 37))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(28, 28, 28)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel16, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel15, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel11)
.addGap(31, 31, 31)
.addComponent(jLabel12)
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel13)
.addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(21, 21, 21)
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel14)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel15)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel16)
.addGap(52, 52, 52))
);
jPanel2.setBackground(new java.awt.Color(102, 102, 102));
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"NUM", "CODIGO", "NOMBRE", "SUELDO"
}
));
jScrollPane1.setViewportView(jTable1);
jTable2.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"NUM", "CODIGO", "NOMBRE", "SUELDO"
}
));
jScrollPane2.setViewportView(jTable2);
jTable3.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"NUM", "CODIGO", "NOMBRE", "SUELDO"
}
));
jScrollPane3.setViewportView(jTable3);
jLabel1.setFont(new java.awt.Font("Arial Black", 0, 12)); // NOI18N
jLabel1.setForeground(new java.awt.Color(255, 255, 255));
jLabel1.setText("METODO BURBUJA");
jLabel2.setFont(new java.awt.Font("Arial Black", 0, 12)); // NOI18N
jLabel2.setForeground(new java.awt.Color(255, 255, 255));
jLabel2.setText("METODO INSERCION DIRECTA");
jLabel3.setFont(new java.awt.Font("Arial Black", 0, 12)); // NOI18N
jLabel3.setForeground(new java.awt.Color(255, 255, 255));
jLabel3.setText("METODO QUICKSORT");
jLabel4.setFont(new java.awt.Font("Arial Black", 0, 12)); // NOI18N
jLabel4.setForeground(new java.awt.Color(255, 255, 255));
jLabel4.setText("METODOS DE ORDENACION");
jLabel5.setForeground(new java.awt.Color(255, 255, 255));
jLabel5.setText("COMPARACIONES : ");
jLabel6.setForeground(new java.awt.Color(255, 255, 255));
jLabel6.setText("INTERCAMBIOS :");
jLabel7.setForeground(new java.awt.Color(255, 255, 255));
jLabel7.setText("COMPARACIONES : ");
jLabel8.setForeground(new java.awt.Color(255, 255, 255));
jLabel8.setText("INTERCAMBIOS :");
jLabel9.setForeground(new java.awt.Color(255, 255, 255));
jLabel9.setText("INTERCAMBIOS :");
jLabel10.setForeground(new java.awt.Color(255, 255, 255));
jLabel10.setText("COMPARACIONES : ");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel3)
.addComponent(jScrollPane1)
.addComponent(jLabel1)
.addComponent(jScrollPane2)
.addComponent(jScrollPane3)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addComponent(jLabel4)
.addGap(164, 164, 164))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(32, 32, 32)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(43, 43, 43)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(28, 28, 28)
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(52, 52, 52)
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel2))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel10)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(52, 52, 52)
.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(46, 46, 46))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel4)
.addGap(18, 18, 18)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5)
.addComponent(jLabel6)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7)
.addComponent(jLabel8)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel10)
.addComponent(jLabel9)
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(17, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jTextField7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField7ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField7ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
int posi = Integer.parseInt(jTextField7.getText());
Empresa miempresa4 = new Empresa();
miempresa4.OrdenBurbuja();
int posi2 =miempresa4.busquedaBinaria(posi);
if(posi2==-1)
jTextArea1.setText("\nEMPLEADO NO ENCONTRADO !!");
else
jTextArea1.setText("EMPLEADO ENCONTRADO \n\n Nombre : "+miempresa4.getNombreDelEmpleado(posi2)+"\n\n Sueldo : "+miempresa4.getSueldoDelEmpleado(posi2));
}//GEN-LAST:event_jButton1ActionPerformed
/**
* @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(ComparaOrdenFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ComparaOrdenFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ComparaOrdenFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ComparaOrdenFrame.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 ComparaOrdenFrame().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JTable jTable1;
private javax.swing.JTable jTable2;
private javax.swing.JTable jTable3;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
private javax.swing.JTextField jTextField5;
private javax.swing.JTextField jTextField6;
private javax.swing.JTextField jTextField7;
// End of variables declaration//GEN-END:variables
}
| [
"ricardobdark@gmail.com"
] | ricardobdark@gmail.com |
edc2fb796ad315ec3207f25ea528d653741732bb | 83adeb3a4eefed40e9f0ac935adf34f4b41de2d6 | /src/main/java/com/lyao/practice/springbootjpa/domain/jpa/Student.java | 85fdf07828e2404002b178e2fea0d13ee31e7b38 | [] | no_license | lhtdd/spring-boot-jpa | 32ed0093f8002a5dc6e8a3aa4e12150c89db595d | 9f987d19964172d036b5e5004c509a898de6ecd4 | refs/heads/master | 2020-03-29T11:56:06.283121 | 2019-07-09T00:47:05 | 2019-07-09T00:47:05 | 149,877,510 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,240 | java | package com.lyao.practice.springbootjpa.domain.jpa;
import javax.persistence.*;
/**
* @author lyao
* @date 2018/9/20 11:01
* @description
*/
@Entity
@Table(name = "t_student")
public class Student {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
private String name;
private int classId;
private String master;
private String monitor;
private String remark;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getClassId() {
return classId;
}
public void setClassId(int classId) {
this.classId = classId;
}
public String getMaster() {
return master;
}
public void setMaster(String master) {
this.master = master;
}
public String getMonitor() {
return monitor;
}
public void setMonitor(String monitor) {
this.monitor = monitor;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
| [
"lihao@xlpayment.com"
] | lihao@xlpayment.com |
150b285aa3e5b6f39fc7dfe2a680ab2d947a0d98 | edaf0650eaa780be2562eaa81d99e33e3fa3f91b | /src/main/java/com/teddy/albert/fonction/FonctionSigmoid.java | 67e2450861dcbb3525aa75d0602084eef4bfff1e | [] | no_license | WKilliam/MonPr-cieux | 6a5dbb696c1e1d3cc0ced699f4ebfc526c6d95a0 | 9fbad3e15b83e65bf456e7205403793ea078c6cf | refs/heads/master | 2020-12-14T10:32:58.900283 | 2020-03-26T13:17:49 | 2020-03-26T13:17:49 | 234,713,082 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 326 | java | package com.teddy.albert.fonction;
public class FonctionSigmoid extends FonctionBase{
public double function_Activate(double x){
return (1/(1+((int)Math.exp((-x)))));
}
public double function_Derivative(double x){
return (1/(1+((int)Math.exp((-x)))))*(1-(1/(1+((int)Math.exp((-x))))));
}
}
| [
"william.k97430@gmail.com"
] | william.k97430@gmail.com |
5c4c3c0a1b3b136c1e81f28ef5dc30c80b61292f | b74af058c8f6fe92c3fcdb00a434f94797a98a03 | /Edunova08/src/edunova/Mjesto.java | bca226857519aae88e7e5e08a8fe4374405ab83f | [] | no_license | tisaj00/Java | d2b3a3b46b1e2d6d0fd9ed122173d9c4b13a6723 | 92dde8fb6f24e51949524edbac39cce898e5b06f | refs/heads/master | 2020-04-09T15:09:29.648399 | 2019-01-27T10:15:00 | 2019-01-27T10:15:00 | 160,417,430 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 402 | java | package edunova;
public class Mjesto {
private String naziv;
private String postanskiBroj;
public String getNaziv() {
return naziv;
}
public void setNaziv(String naziv) {
this.naziv = naziv;
}
public String getPostanskiBroj() {
return postanskiBroj;
}
public void setPostanskiBroj(String postanskiBroj) {
this.postanskiBroj = postanskiBroj;
}
}
| [
"Josip@192.168.117.1"
] | Josip@192.168.117.1 |
d40c5c2c8ebdeecb5b01d123a9a9423d9d20d583 | 1c9bdf7e53599fa79f4e808a6daf1bab08b35a00 | /peach/app/src/main/java/com/xygame/sg/task/certification/TransferCup.java | f4102a1aa5b51495aa9a789a0da8e201c361ab98 | [] | no_license | snoylee/GamePromote | cd1380613a16dc0fa8b5aa9656c1e5a1f081bd91 | d017706b4d6a78b5c0a66143f6a7a48fcbd19287 | refs/heads/master | 2021-01-21T20:42:42.116142 | 2017-06-18T07:59:38 | 2017-06-18T07:59:38 | 94,673,520 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 759 | java | package com.xygame.sg.task.certification;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import base.action.Action;
import base.action.Task;
/**
* Created by minhua on 2015/11/14.
*/
public class TransferCup extends Task {
Map<String,Integer> maps = new TreeMap<String,Integer>();
{
maps.put("A",1);
maps.put("B",2);
maps.put("C",3);
maps.put("D",4);
maps.put("E",5);
maps.put("F",6);
maps.put("G",7);
maps.put("H",8);
maps.put("I",9);
maps.put("J",10);
}
@Override
public Object run(String methodname, List<String> params, Action.Param param) {
return maps.get(params.get(0))+"";
}
}
| [
"litieshan549860123@126.com"
] | litieshan549860123@126.com |
732f1daf2f0fe33127103d031ce2172e52e4ff6f | 7ec0194c493e63b18ab17b33fe69a39ed6af6696 | /masterlock/app_decompiled/sources/com/akta/android/p004ui/floatinglabeledittext/FloatingLabelEditText.java | cce9c306dc97a7198fffbe25d8d4892665a0571e | [] | no_license | rasaford/CS3235 | 5626a6e7e05a2a57e7641e525b576b0b492d9154 | 44d393fb3afb5d131ad9d6317458c5f8081b0c04 | refs/heads/master | 2020-07-24T16:00:57.203725 | 2019-11-05T13:00:09 | 2019-11-05T13:00:09 | 207,975,557 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 10,771 | java | package com.akta.android.p004ui.floatinglabeledittext;
import android.animation.Animator;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION;
import android.text.Editable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.OnFocusChangeListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.TextView;
import com.akta.android_ui.C0400R;
/* renamed from: com.akta.android.ui.floatinglabeledittext.FloatingLabelEditText */
public class FloatingLabelEditText extends FrameLayout {
private static final String ERROR_TAG = "error";
private static final String HINT_TAG = "hint";
private Drawable errorDrawable;
Context mContext;
private EditText mEditText;
private TextView mErrorView;
/* access modifiers changed from: private */
public TextView mLabelView;
/* access modifiers changed from: private */
public boolean showLabelAlways;
public FloatingLabelEditText(Context context) {
this(context, null);
}
public FloatingLabelEditText(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.mContext = context;
init(attributeSet);
}
private void init(AttributeSet attributeSet) {
String str;
this.mLabelView = new TextView(this.mContext);
this.mErrorView = new TextView(this.mContext);
TypedArray obtainStyledAttributes = this.mContext.obtainStyledAttributes(attributeSet, C0400R.styleable.FloatingEditText);
int dimensionPixelSize = obtainStyledAttributes.getDimensionPixelSize(C0400R.styleable.FloatingEditText_labelPadding, 0);
int dimensionPixelSize2 = obtainStyledAttributes.getDimensionPixelSize(C0400R.styleable.FloatingEditText_labelPaddingLeft, 0);
int dimensionPixelSize3 = obtainStyledAttributes.getDimensionPixelSize(C0400R.styleable.FloatingEditText_labelPaddingTop, 0);
int dimensionPixelSize4 = obtainStyledAttributes.getDimensionPixelSize(C0400R.styleable.FloatingEditText_labelPaddingRight, 0);
int dimensionPixelSize5 = obtainStyledAttributes.getDimensionPixelSize(C0400R.styleable.FloatingEditText_labelPaddingBottom, 0);
int dimensionPixelSize6 = obtainStyledAttributes.getDimensionPixelSize(C0400R.styleable.FloatingEditText_errorMessagePadding, 0);
int dimensionPixelSize7 = obtainStyledAttributes.getDimensionPixelSize(C0400R.styleable.FloatingEditText_errorMessagePaddingLeft, 0);
int dimensionPixelSize8 = obtainStyledAttributes.getDimensionPixelSize(C0400R.styleable.FloatingEditText_errorMessagePaddingTop, 0);
int dimensionPixelSize9 = obtainStyledAttributes.getDimensionPixelSize(C0400R.styleable.FloatingEditText_errorMessagePaddingRight, 0);
int dimensionPixelSize10 = obtainStyledAttributes.getDimensionPixelSize(C0400R.styleable.FloatingEditText_errorMessagePaddingBottom, 0);
String string = obtainStyledAttributes.getString(C0400R.styleable.FloatingEditText_errorMessage);
String string2 = obtainStyledAttributes.getString(C0400R.styleable.FloatingEditText_label);
this.showLabelAlways = obtainStyledAttributes.getBoolean(C0400R.styleable.FloatingEditText_showLabelAlways, false);
this.errorDrawable = obtainStyledAttributes.getDrawable(C0400R.styleable.FloatingEditText_errorDrawable);
if (VERSION.SDK_INT >= 17) {
str = string;
this.mErrorView.setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, this.errorDrawable, null);
} else {
str = string;
this.mErrorView.setCompoundDrawables(null, null, this.errorDrawable, null);
}
if (dimensionPixelSize != 0) {
setViewPadding(this.mLabelView, dimensionPixelSize, dimensionPixelSize, dimensionPixelSize, dimensionPixelSize);
} else {
setViewPadding(this.mLabelView, dimensionPixelSize2, dimensionPixelSize3, dimensionPixelSize4, dimensionPixelSize5);
}
if (dimensionPixelSize6 != 0) {
setViewPadding(this.mErrorView, dimensionPixelSize6, dimensionPixelSize6, dimensionPixelSize6, dimensionPixelSize6);
} else {
setViewPadding(this.mErrorView, dimensionPixelSize7, dimensionPixelSize8, dimensionPixelSize9, dimensionPixelSize10);
}
if (!isInEditMode()) {
this.mLabelView.setTextAppearance(this.mContext, obtainStyledAttributes.getResourceId(C0400R.styleable.FloatingEditText_labelTextAppearance, 16973892));
this.mErrorView.setTextAppearance(this.mContext, obtainStyledAttributes.getResourceId(C0400R.styleable.FloatingEditText_errorTextAppearance, 16973894));
}
if (!this.showLabelAlways) {
this.mLabelView.setVisibility(4);
this.mLabelView.setAlpha(0.0f);
}
this.mLabelView.setText(string2);
this.mErrorView.setVisibility(4);
this.mErrorView.setText(str);
this.mLabelView.setTag(HINT_TAG);
this.mErrorView.setTag(ERROR_TAG);
addView(this.mLabelView, -2, -2);
obtainStyledAttributes.recycle();
}
public void addView(View view, int i, LayoutParams layoutParams) {
String str = (String) view.getTag();
FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(layoutParams);
if (str != null && str.equals(ERROR_TAG)) {
layoutParams2.topMargin = this.mLabelView.getHeight() + this.mEditText.getHeight();
}
if (view instanceof EditText) {
if (this.mEditText == null) {
layoutParams2.topMargin = (int) (this.mLabelView.getTextSize() + ((float) this.mLabelView.getPaddingTop()) + ((float) this.mLabelView.getPaddingBottom()));
setEditText((EditText) view);
} else {
throw new IllegalArgumentException("Can only have one EditText sub view");
}
}
super.addView(view, i, layoutParams2);
}
private void setEditText(EditText editText) {
this.mEditText = editText;
if (!this.showLabelAlways) {
this.mEditText.addTextChangedListener(new SimpleTextWatcher() {
public void afterTextChanged(Editable editable) {
FloatingLabelEditText.this.setShowHint(!TextUtils.isEmpty(editable));
}
});
this.mLabelView.setText(this.mEditText.getHint());
if (!TextUtils.isEmpty(this.mEditText.getText())) {
this.mLabelView.setVisibility(0);
}
}
this.mEditText.setOnFocusChangeListener(new OnFocusChangeListener() {
public void onFocusChange(View view, boolean z) {
if (!FloatingLabelEditText.this.showLabelAlways) {
if (z && FloatingLabelEditText.this.mLabelView.getVisibility() == 0) {
FloatingLabelEditText.this.mLabelView.animate().alpha(1.0f).setListener(null).start();
} else if (FloatingLabelEditText.this.mLabelView.getVisibility() == 0) {
FloatingLabelEditText.this.mLabelView.animate().alpha(0.33f).setListener(null).start();
}
}
if (z) {
FloatingLabelEditText.this.hideError();
}
}
});
}
/* access modifiers changed from: private */
public void setShowHint(boolean z) {
if (this.mLabelView.getVisibility() == 0 && !z) {
animateHint(0.0f, (float) (this.mLabelView.getHeight() / 8), z);
} else if (this.mLabelView.getVisibility() != 0 && z) {
animateHint(this.mEditText.isFocused() ? 1.0f : 0.33f, 0.0f, z);
}
}
private void animateHint(float f, float f2, final boolean z) {
this.mLabelView.animate().alpha(f).translationY(f2).setListener(new SimpleAnimationListener() {
public void onAnimationStart(Animator animator) {
super.onAnimationStart(animator);
FloatingLabelEditText.this.mLabelView.setVisibility(0);
}
public void onAnimationEnd(Animator animator) {
super.onAnimationEnd(animator);
FloatingLabelEditText.this.mLabelView.setVisibility(z ? 0 : 4);
FloatingLabelEditText.this.mLabelView.setAlpha(z ? 1.0f : 0.0f);
}
}).start();
}
public EditText getEditText() {
return this.mEditText;
}
public String getText() {
return this.mEditText.getText().toString();
}
public void setText(String str) {
EditText editText = this.mEditText;
if (editText != null) {
editText.setText(str);
}
}
public void showError(int i, int i2) {
this.mEditText.setActivated(true);
this.mEditText.clearFocus();
if (!this.mErrorView.isShown()) {
addView(this.mErrorView, i, i2);
}
this.mErrorView.setVisibility(0);
}
public void showError() {
showError(-2, -2);
}
public void showError(String str) {
if (str != null) {
this.mErrorView.setText(str);
}
showError();
}
public void showError(String str, int i, int i2) {
if (str != null) {
this.mErrorView.setText(str);
}
showError(i, i2);
}
public void showError(String str, Drawable drawable) {
this.errorDrawable = drawable;
if (VERSION.SDK_INT >= 17) {
this.mErrorView.setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, drawable, null);
} else {
this.mErrorView.setCompoundDrawables(null, null, drawable, null);
}
showError(str);
}
public void showError(String str, Drawable drawable, int i, int i2) {
this.errorDrawable = drawable;
if (VERSION.SDK_INT >= 17) {
this.mErrorView.setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, drawable, null);
} else {
this.mErrorView.setCompoundDrawables(null, null, drawable, null);
}
showError(str, i, i2);
}
public void hideError() {
removeView(this.mErrorView);
this.mErrorView.setVisibility(4);
this.mEditText.setActivated(false);
}
private void setViewPadding(TextView textView, int i, int i2, int i3, int i4) {
if (VERSION.SDK_INT >= 16) {
textView.setPaddingRelative(i, i2, i3, i4);
} else {
textView.setPadding(i, i2, i3, i4);
}
}
}
| [
"fruehaufmaximilian@gmail.com"
] | fruehaufmaximilian@gmail.com |
fb46e24344432b0ae8b22389ff0db5808c774221 | c36babb7ba0c112cbf2554d617502e2ae9da2907 | /java/nexos/controller/cm/CM04040EController.java | 09012745eb9efc0ef1a5f63126793be716c1554b | [] | no_license | arborb/main | c263a84572dc0ada27855c74246385e9b66aa18d | 17f2c5bc50fd7a9e218fd71601479a9b3b6ddb0e | refs/heads/master | 2021-01-18T14:58:16.177748 | 2015-06-22T08:39:22 | 2015-06-22T08:39:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,491 | java | package nexos.controller.cm;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import nexos.common.Consts;
import nexos.controller.common.CommonController;
import nexos.service.cm.CM04040EService;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
/**
* Class: 딜상품 관리 컨트롤러<br>
* Description: 딜상품 관리 Controller<br>
* Copyright: Copyright (c) 2013 ASETEC Corporation. All rights reserved.<br>
* Company : ASETEC<br>
*
* @author ASETEC
* @version 1.0
*
* <pre style="font-family: NanumGothicCoding, GulimChe">
* ---------------------------------------------------------------------------------------------------------------------
* Version Date Author Description
* --------- ------------ --------------- ---------------------------------------------------------------------------
* 1.0 2013-01-01 ASETEC 신규작성
* ---------------------------------------------------------------------------------------------------------------------
* </pre>
*/
@Controller
@RequestMapping("/CM04040E")
public class CM04040EController extends CommonController {
@Resource
private CM04040EService service;
@RequestMapping(value = "/getDataSet.do", method = RequestMethod.POST)
public ResponseEntity<String> getDataSet(HttpServletRequest request,
@RequestParam(Consts.PK_QUERY_ID) String queryId, @RequestParam(Consts.PK_QUERY_PARAMS) String queryParams) {
ResponseEntity<String> result = null;
Map<String, Object> params = getParameter(queryParams);
String oMsg = getResultMessage(params);
if (!Consts.OK.equals(oMsg)) {
result = getResponseEntityError(request, oMsg);
return result;
}
try {
result = getResponseEntity(request, service.getDataSet(queryId, params));
} catch (Exception e) {
result = getResponseEntityError(request, e);
}
return result;
}
/**
* 저장 처리
* @param request HttpServletRequest
* @param masterDS 딜 DataSet
* @param detailDS 딜옵션 DataSet
* @param subDS 딜상품 DataSet
* @param user_Id 사용자ID
* @return
*/
@RequestMapping(value = "/save.do", method = RequestMethod.POST)
public ResponseEntity<String> save(HttpServletRequest request, @RequestParam(Consts.PK_DS_MASTER) String masterDS,
@RequestParam(Consts.PK_DS_DETAIL) String detailDS, @RequestParam(Consts.PK_DS_SUB) String subDS,
@RequestParam(Consts.PK_USER_ID) String user_Id) {
ResponseEntity<String> result = null;
// 딜 DataSet Map에 추가
Map<String, Object> params = getDataSet(masterDS, Consts.PK_DS_MASTER);
String oMsg = getResultMessage(params);
if (!Consts.OK.equals(oMsg)) {
result = getResponseEntityError(request, oMsg);
return result;
}
// 딜옵션 DataSet Map에 추가
setDataSet(params, detailDS, Consts.PK_DS_DETAIL);
oMsg = getResultMessage(params);
if (!Consts.OK.equals(oMsg)) {
result = getResponseEntityError(request, oMsg);
return result;
}
// 딜상품 DataSet Map에 추가
setDataSet(params, subDS, Consts.PK_DS_SUB);
oMsg = getResultMessage(params);
if (!Consts.OK.equals(oMsg)) {
result = getResponseEntityError(request, oMsg);
return result;
}
params.put(Consts.PK_USER_ID, user_Id);
try {
result = getResponseEntity(request, service.save(params));
} catch (Exception e) {
result = getResponseEntityError(request, e);
}
return result;
}
@RequestMapping(value = "/callSP.do", method = RequestMethod.POST)
public ResponseEntity<String> callSP(HttpServletRequest request, @RequestParam(Consts.PK_QUERY_ID) String queryId,
@RequestParam(Consts.PK_QUERY_PARAMS) String queryParams) {
ResponseEntity<String> result = null;
Map<String, Object> params = getParameter(queryParams);
String oMsg = getResultMessage(params);
if (!Consts.OK.equals(oMsg)) {
result = getResponseEntityError(request, oMsg);
return result;
}
try {
HashMap<String, Object> mapResult = service.callSP(queryId, params);
result = getResponseEntity(request, mapResult);
} catch (Exception e) {
result = getResponseEntityError(request, e);
}
return result;
}
@RequestMapping(value = "/callInsert.do", method = RequestMethod.POST)
public ResponseEntity<String> callInsert(HttpServletRequest request,
@RequestParam(Consts.PK_DS_MASTER) String saveSubDS1) {
ResponseEntity<String> result = null;
// DataSet Map에 추가
Map<String, Object> params = getDataSet(saveSubDS1, Consts.PK_DS_MASTER);
String oMsg = getResultMessage(params);
if (!Consts.OK.equals(oMsg)) {
result = getResponseEntityError(request, oMsg);
return result;
}
try {
result = getResponseEntity(request, service.callInsert(params));
} catch (Exception e) {
result = getResponseEntityError(request, e);
}
return result;
}
}
| [
"brianpaek@Brianui-MacBook-Pro.local"
] | brianpaek@Brianui-MacBook-Pro.local |
bf2fc130c5f66030f376f4711b418602dd05f048 | a842c139c2de07596587b389a972afd414d391e3 | /05-gui-02-alumnos/src/VisualizarAlumnos.java | 763c86a1afb60adc202a5db0cfa98947d56065be | [] | no_license | mikelAretxabaleta/05-gui-mikel | af58ac44bcac609e6470f7707896c2d058245c26 | 11f2f7070b97f6e495084e14667e8e3ebc05769d | refs/heads/master | 2021-01-22T19:25:45.918274 | 2017-03-20T21:47:41 | 2017-03-20T21:47:41 | 85,199,128 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,174 | 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.
*/
/**
*
* @author m
*/
public class VisualizarAlumnos extends javax.swing.JFrame {
/**
* Creates new form VisualizarAlumnos
*/
public VisualizarAlumnos() {
initComponents();
setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
}
/**
* 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() {
jLabel1 = new javax.swing.JLabel();
jScrollPane2 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosed(java.awt.event.WindowEvent evt) {
formWindowClosed(evt);
}
});
jLabel1.setText("Los Alumnos son:");
jTextArea1.setColumns(20);
jTextArea1.setRows(5);
jTextArea1.setText(BaseDeDatos.getAlumnos().toString());
jScrollPane2.setViewportView(jTextArea1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(249, 249, 249)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 1074, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addContainerGap(60, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(116, 116, 116)
.addComponent(jLabel1)
.addGap(123, 123, 123)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 584, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(92, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
// TODO add your handling code here:
}//GEN-LAST:event_formWindowClosed
/**
* @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(VisualizarAlumnos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(VisualizarAlumnos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(VisualizarAlumnos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(VisualizarAlumnos.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() {
VisualizarAlumnos v = new VisualizarAlumnos();
v.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTextArea jTextArea1;
// End of variables declaration//GEN-END:variables
}
| [
"mikel.aretxabaleta@gmail.com"
] | mikel.aretxabaleta@gmail.com |
b8a05e0db20003f368311dc1326c7b003690ca8b | 9b0d8022e3c224afcb917adfd835b71bdabe14c2 | /src/main/java/com/java/chapter14/net/mindview/util/Print.java | 2d251061fe47199e3b94281ed4507717b7c69705 | [] | no_license | gongchunru/effectiveJava | 46efab4e0fc25827e7ea1dbff2c761798781cb25 | 5909a88de7672f449f0eca00eac5956f685ac4ce | refs/heads/master | 2021-01-19T10:08:55.232041 | 2019-02-27T16:24:37 | 2019-02-27T16:24:37 | 82,163,537 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 560 | java | package com.java.chapter14.net.mindview.util;
import java.io.PrintStream;
/**
* @author gongchunru
* @Package com.java.chapter14.net.mindview.util
* @date 16/3/31 23:06
*/
public class Print {
public static void print(Object obj){
System.out.println(obj);
}
public static void print(){
System.out.println();
}
public static void printnb(Object obj){
System.out.println(obj);
}
public static PrintStream printf(String format,Object... args){
return System.out.printf(format,args);
}
} //
| [
"gongchunru@163.com"
] | gongchunru@163.com |
3475948509663f275c2db213b8fef90610bf48eb | 34047bbaa7ba4116611fdd733246d960d54bf929 | /src/main/resources/lock/src/main/java/com/example/lock/test/Test.java | 22714d19d41b120b713ce71e9447801a5177b001 | [] | no_license | nhnhynh/demo11 | ed751cd3f613c4af8c180241003ed5d97fa3eaf0 | 09272b83f4f64699c0dfbec92e63d4bffacb7c80 | refs/heads/master | 2022-12-27T13:20:58.805380 | 2019-11-04T03:34:14 | 2019-11-04T03:34:14 | 219,409,480 | 0 | 0 | null | 2022-12-10T05:42:56 | 2019-11-04T03:26:29 | Java | UTF-8 | Java | false | false | 1,209 | java | //package com.example.lock.test;
//
//import java.util.ArrayList;
//
///**
// * @author baimugudu
// * @email 2415621370@qq.com
// * @date 2019/10/26 9:59
// */
//public class Test {
//
// public static void main(String[] args) {
// final InsertData insertData = new InsertData();
//
// new Thread() {
// public void run() {
// insertData.insert(Thread.currentThread());
// };
// }.start();
//
//
// new Thread() {
// public void run() {
// insertData.insert(Thread.currentThread());
// };
// }.start();
//
// new Thread() {
// public void run() {
// insertData.insert(Thread.currentThread());
// };
// }.start();
// }
//}
//
//class InsertData {
// private ArrayList<Integer> arrayList = new ArrayList<Integer>();
// private Object object = new Object();
//
// public void insert(Thread thread){
//
// synchronized(object){
// for(int i=0;i<5;i++){
// System.out.println(thread.getName()+"在插入数据"+i);
// arrayList.add(i);
// }
// }
//
// }
//
//}
//
//
| [
"935066067@qq.com"
] | 935066067@qq.com |
5a526a8f71820821f942ff242549dc355a5cf172 | 6f9a534c8e1b46f300be6bdeec99b0b0ed5236b0 | /dfgx/ordertask-scheduled2/src/main/java/com/bonc/busi/task/base/FtpTools.java | 9f1699eb5885793fe0625129168e6b2fcd94e9d5 | [] | no_license | snailshen2014/career | 4ffd7e30fdc2e4ae74b990e679ac3f1c2998d588 | c5f08e0f007d23b13150ef18e999a39f87e64b17 | refs/heads/master | 2020-04-10T12:15:58.280308 | 2018-12-09T09:32:16 | 2018-12-09T09:32:16 | 161,016,843 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,626 | java | package com.bonc.busi.task.base;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.SocketException;
import java.util.Map;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPReply;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class FtpTools {
private final static Logger log= LoggerFactory.getLogger(FtpTools.class);
/*
* 连接FTP服务器
*/
private static FTPClient connectFtpServer(String SrvIp,String User,String Password,int Port){
FTPClient ftpClient = null; //FTP 客户端代理
int reply;
try {
ftpClient = new FTPClient();
ftpClient.setControlEncoding("UTF-8");
//ftpClient.configure(getFtpConfig());
if(Port >= 0)
ftpClient.connect(SrvIp, Port);
else
ftpClient.connect(SrvIp);
ftpClient.login(User,Password);
reply = ftpClient.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
ftpClient.disconnect();
log.error("FTP server refused connection.");
log.error("FTP 服务拒绝连接!");
return null;
}
int defaultTimeoutSecond=30*60 * 1000; // --- 设置超时 1800秒(30分钟)---
ftpClient.setDefaultTimeout(defaultTimeoutSecond);
ftpClient.setConnectTimeout(defaultTimeoutSecond );
ftpClient.setDataTimeout(defaultTimeoutSecond);
log.info(" --- connect server sucess ---");
} catch (SocketException e) {
e.printStackTrace();
log.error("登录ftp服务器 {} 失败,连接超时!",SrvIp);
return null;
} catch (IOException e) {
e.printStackTrace();
log.error("登录ftp服务器{} 失败,FTP服务器无法打开!",SrvIp);
return null;
}
return ftpClient;
}
/*
* 退出FTP,退出FTP也可能抛异常,所以单独处理
*/
private static void disconnect(FTPClient ftpClient){
try{
ftpClient.logout();
ftpClient.disconnect();
}catch(Exception e){
}
}
/*
* 上传文件到FTP服务器
*/
public static int upload(String SrvIp,String User,String Password,int Port,
String RemoteFileName,String LocalFileName){
FTPClient ftpClient = null; //FTP 客户端代理
try{
ftpClient = connectFtpServer(SrvIp,User,Password,Port);
if(ftpClient == null){
log.warn("连不上FTP服务器");
return -1;
}
log.info("连上了FTP服务器");
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);// 设置传输二进制文件
//ftpClient.enterLocalPassiveMode();
ftpClient.setFileTransferMode(FTP.STREAM_TRANSFER_MODE);
// --- 是否自动创建远程路径 ? ---
// ---得到远程目录 ---
String strRemotePath = getPath(RemoteFileName);
if(strRemotePath != null){
ftpClient.enterLocalPassiveMode();
if(ftpClient.changeWorkingDirectory(strRemotePath) == false){ // --- 工作路径不存在 ---
// --- 创建路径 ---
ftpClient.enterLocalPassiveMode();
if(ftpClient.makeDirectory(strRemotePath) == false){
log.warn("--- create path:{} failed",strRemotePath);
disconnect(ftpClient);
return -1;
}
ftpClient.enterLocalPassiveMode();
if(ftpClient.changeWorkingDirectory(strRemotePath) == false){
log.warn("--- enter working path:{} failed",strRemotePath);
disconnect(ftpClient);
return -1;
}
}
}
InputStream input = new FileInputStream(LocalFileName);
ftpClient.enterLocalPassiveMode();
boolean flag = ftpClient.storeFile(strRemotePath, input);
if(flag){
log.info("upload file :{} sucess ",RemoteFileName);
}else{
log.info("upload file :{} failed ",RemoteFileName);
return -1;
}
}catch(Exception e){
e.printStackTrace();
log.error(e.getMessage());
return -1;
}
return 0;
}
/*
* 下载行云生成的文件,先检查文件是否存在,如果文件不存在,检查临时文件是否存在
*/
public static String downloadXcloudFile(String SrvIp,String User,String Password,int Port,
String RemoteFileName,String LocalFileName,boolean deleteFileFlag){
// --- 联接远程FTP ---
FTPClient ftpClient = null; //FTP 客户端代理
try{
ftpClient = connectFtpServer(SrvIp,User,Password,Port);
if(ftpClient == null){
log.warn("连不上FTP服务器");
return "can't connect to FTP server";
}
log.info("连上了FTP服务器");
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);// 设置传输二进制文件
// --- 判断本地路径是否存在,不存在则创建 ---
String LocalPath = getPath(LocalFileName);
if(LocalPath != null){
File file = new File(LocalPath);
if( !file.exists() ){
log.info("path:"+LocalPath +" not exist !!!");
// --- 创建目录 ---
if(file.mkdirs() == false) {
log.error("创建路径: {} 失败!!! " ,LocalPath);
disconnect(ftpClient);
return "create local path failed";
}
}
else{
log.info("path:"+LocalPath +" already exist ");
}
}// --- 本地路径处理 ---
// --- 远程路径处理 ---
// --- 得到远程的路径 ---
String RemotePath = getPath(RemoteFileName);
log.info("远程路径:{}",RemotePath);
if(RemotePath != null){
ftpClient.enterLocalPassiveMode();
if(ftpClient.changeWorkingDirectory(RemotePath) == false){
log.error("进入工作目录:{}失败",RemotePath);
disconnect(ftpClient);
return "enter into ftp working path : "+RemotePath +" failed!";
}
}
// --- 查找文件是否存在 ---
ftpClient.enterLocalPassiveMode();
String[] names = ftpClient.listNames();
if(names == null){
disconnect(ftpClient);
log.warn("无文件存在");
return "no file exist";
}
String strRemoteFile= getFile(RemoteFileName);
String strRemoteTempFile= strRemoteFile+".xcloud.temp";
log.info("远程文件名{},远程临时文件名:{}",strRemoteFile,strRemoteTempFile);
boolean bFile = false;
boolean bTempFile = false;
for(String fileName:names){
log.info("目录下的文件名:{}",fileName);
if(fileName.equalsIgnoreCase(strRemoteFile)){ // --- 找到了文件 ---
bFile = true;
break;
}
else if(fileName.equalsIgnoreCase(strRemoteTempFile)){ // --- 找到了临时文件 ---
bTempFile = true;
}
}
if(bFile == false && bTempFile == false ){
disconnect(ftpClient);
log.warn("没有找到文件或临时文件");
return "can't find file or temp file ";
}
int iSleep = 0;
while(bFile == false){
++iSleep;
ftpClient.enterLocalPassiveMode();
String[] filenames = ftpClient.listNames();
for(String fileName:filenames){
log.info("current path filename:{}",fileName);
if(fileName.equalsIgnoreCase(strRemoteFile)){ // --- 找到了文件 ---
bFile = true;
break;
}
}
if(iSleep > 120){ // --- 超过了二分钟 ---
break;
}
// --- 没有找到文件则等待 ---
try{
Thread.sleep(1000);
}catch(Exception e){}
}
if(bFile == false){
disconnect(ftpClient);
log.warn("有临时文件但找不到正式文件");
return "file can't finded but temp file exist ";
}
// --- 提取文件 ---
log.info("开始提取文件");
// --- 提取文件 ---
BufferedOutputStream buffOut = null;
buffOut = new BufferedOutputStream(new FileOutputStream(LocalFileName));
ftpClient.enterLocalPassiveMode();
if(ftpClient.retrieveFile(RemoteFileName, buffOut) == false){
log.error("提取文件:"+RemoteFileName +"失败!!");
disconnect(ftpClient);
return "提取文件失败";
}
else{
log.info(" --- sucess download remote file :{},local file : {} ",RemoteFileName,LocalFileName);
}
// --- 退出 ---
buffOut.flush();
buffOut.close();
// --- 判断是否删除远程文件 ---
if(deleteFileFlag){
// --- 删除失败也不管了 ,只要传输成功就行 -----------------
deleteRemoteFile(SrvIp,User,Password,Port,RemoteFileName);
}
disconnect(ftpClient);
log.info("从FTP获取文件:"+LocalFileName + "结束");
}
catch(Exception e){
e.printStackTrace();
return e.toString();
}
return "000000";
}
/*
* 从FTP服务器得到数据,远程路径需要提前准备好,本地路径如不存在会自动创建
*/
public static int download(String SrvIp,String User,String Password,int Port,
String RemoteFileName,String LocalFileName,boolean deleteFileFlag){
// --- 联接远程FTP ---
FTPClient ftpClient = null; //FTP 客户端代理
try{
ftpClient = connectFtpServer(SrvIp,User,Password,Port);
if(ftpClient == null){
log.warn("连不上FTP服务器");
return -1;
}
log.info("连上了FTP服务器");
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);// 设置传输二进制文件
//ftpClient.enterLocalActiveMode(); //这句重要,不行换enterRemoteActiveMode 看看
//ftpClient.enterRemotePassiveMode();
//ftpClient.enterLocalPassiveMode(); // --- 经测试,联接UBUNTU LINUX 这个方法可用 ---
//ftpClient.enterRemoteActiveMode(host, port)
//ftpClient.enterRemoteActiveMode(InetAddress.getByName(SrvIp),21);
// --- 判断本地路径是否存在,不存在则创建 ---
String LocalPath = getPath(LocalFileName);
if(LocalPath != null){
File file = new File(LocalPath);
if( !file.exists() ){
log.info("path:"+LocalPath +" not exist !!!");
// --- 创建目录 ---
if(file.mkdirs() == false) {
log.error("创建路径: {} 失败!!! " ,LocalPath);
disconnect(ftpClient);
return -1;
}
}
else{
log.info("path:"+LocalPath +" already exist ");
}
}
log.info("开始提取文件");
// --- 提取文件 ---
BufferedOutputStream buffOut = null;
buffOut = new BufferedOutputStream(new FileOutputStream(LocalFileName));
ftpClient.enterLocalPassiveMode();
if(ftpClient.retrieveFile(RemoteFileName, buffOut) == false){
log.error("提取文件:"+RemoteFileName +"失败!!");
disconnect(ftpClient);
return -1;
}
else{
log.info(" --- sucess download remote file :{},local file : {} ",RemoteFileName,LocalFileName);
}
// --- 退出 ---
buffOut.flush();
buffOut.close();
// --- 判断是否删除远程文件 ---
if(deleteFileFlag){
// --- 删除失败也不管了 ,只要传输成功就行 -----------------
deleteRemoteFile(SrvIp,User,Password,Port,RemoteFileName);
}
disconnect(ftpClient);
log.info("从FTP获取文件:"+LocalFileName + "结束");
}catch(Exception e){
e.printStackTrace();
log.error(e.getMessage());
return -1;
}
return 0;
}
/*
* 删除远程服务器上的文件
*/
public static int deleteRemoteFile(String SrvIp,String User,String Password,int Port,
String strFileName){
FTPClient ftpClient = null; //FTP 客户端代理
try{
ftpClient = connectFtpServer(SrvIp,User,Password,Port);
if(ftpClient == null){
log.warn("deleteRemoteFile can't connect FTP SERVER !!!");
return -1;
}
ftpClient.enterLocalPassiveMode();
ftpClient.deleteFile(strFileName);
}catch(Exception e){
e.printStackTrace();
return -1;
}
return 0;
}
/*
* 查询本地某目录下的所有文件
*/
public static void listLocalFile(String localPath){
File file = new File(localPath);
File[] filetmp= file.listFiles();
for(File item:filetmp){
log.info(" filename:"+item.getName() + " length:"+item.length());
}
}
/*
* 提取目录
*/
public static String getPath(String strFileAll){
int LocalSepPos = -1;
LocalSepPos = strFileAll.lastIndexOf('/');
if(LocalSepPos == -1){
LocalSepPos = strFileAll.lastIndexOf('\\');
}
String LocalPath = null;
if(LocalSepPos != -1)
LocalPath = strFileAll.substring(0, LocalSepPos);
return LocalPath;
}
/*
* 提取文件名
*/
public static String getFile(String strFileAll){
int LocalSepPos = -1;
LocalSepPos = strFileAll.lastIndexOf('/');
if(LocalSepPos == -1){
LocalSepPos = strFileAll.lastIndexOf('\\');
}
String fileName = null;
if(LocalSepPos != -1){
fileName = strFileAll.substring(LocalSepPos + 1);
}
else fileName = strFileAll;
return fileName;
}
/*
* 替换SQL中的特定字段
*/
public static String getChangeSql(String sqlData,Map<String,Object> mapData){
StringBuilder sb = new StringBuilder();
StringBuilder sbTmp = new StringBuilder();
sb.setLength(0);
int i = 0;
int iWhere = sqlData.indexOf("WHERE");
boolean bEqualCode = false;
for(i = 0;i < iWhere ;++i){
if(bEqualCode){
boolean bKongGe = true;
boolean bDyh = false;
sbTmp.setLength(0);
while(1 > 0){
if(sqlData.charAt(i) == ' '){ // --- 空格 ---
if(bKongGe) {
++i;
continue;
}
else{ // --- 该退出了 ---
break;
}
}
else if(sqlData.charAt(i) == ','){ // --- 该退出了 ---
break;
}
else if(sqlData.charAt(i) == '\''){
if(bDyh == false){
sb.append(sqlData.charAt(i));
bDyh = true;
++i;
continue;
}
else{
break;
}
}
else{
if(bKongGe ) bKongGe = false; // --- 不再是第一次空格了 ---
sbTmp.append(sqlData.charAt(i) );
++i;
}
}
// --- 替换 ---
sb.append(mapData.get(sbTmp.toString()));
// --- 如果是逗号还得带进来 ---
sb.append(sqlData.charAt(i));
bEqualCode = false;
continue;
}
if(sqlData.charAt(i) == '='){ // --- 发现了= 号
bEqualCode = true;
}
sb.append(sqlData.charAt(i));
}
sb.append(sqlData.substring(iWhere));
return sb.toString();
}
/*
*
*/
}
| [
"shenyanjun1@jd.com"
] | shenyanjun1@jd.com |
0bb7167c854e46f6b3b104b5bb843e5e8ff7deb2 | c4563ef4d8766600640da8b7536aa0c9c4825f5a | /employeemanager/src/main/java/com/jd/employeemanager/repo/EmployeeRepo.java | 446f032e7aa68146e50995d93c1520c1ec27317a | [] | no_license | thejoaodamiao/GerenciadorEmpregados-Spring-mysql | b38d32b6abe34fb9fea164fd4b1263f50b481dfc | dd3e8bebf9e28ead36d94486bf37cdacf2cd9518 | refs/heads/main | 2023-06-15T22:28:21.287178 | 2021-07-20T06:58:14 | 2021-07-20T06:58:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 363 | java | package com.jd.employeemanager.repo;
import com.jd.employeemanager.model.Employee;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.Optional;
//interface de repostorio
public interface EmployeeRepo extends JpaRepository<Employee, Long> {
void deleteEmployeeById(Long id);
Optional<Employee> findEmployeeById(Long id);
}
| [
"thejoaodamiao@gmail.com"
] | thejoaodamiao@gmail.com |
64806db96a1c62d65829941ea1d4fe19732fa663 | 81b0bb3cfb2e9501f53451e7f03ec072ee2b0e13 | /src/com/stripe/model/TransferCollection.java | c5761cb8627815a22c42725b176a34d77980bf30 | [] | no_license | reverseengineeringer/me.lyft.android | 48bb85e8693ce4dab50185424d2ec51debf5c243 | 8c26caeeb54ffbde0711d3ce8b187480d84968ef | refs/heads/master | 2021-01-19T02:32:03.752176 | 2016-07-19T16:30:00 | 2016-07-19T16:30:00 | 63,710,356 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 236 | java | package com.stripe.model;
public class TransferCollection
extends StripeCollection<Transfer>
{}
/* Location:
* Qualified Name: com.stripe.model.TransferCollection
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"reverseengineeringer@hackeradmin.com"
] | reverseengineeringer@hackeradmin.com |
ea90d435883276a724f4fd4316a274ba2b61c5d6 | 1dba156940968a4fd94946ec4f1a5497e2d0ffc7 | /src/main/java/org/seckill/exception/RepeatKillException.java | a3660f481dc7f2a81a1f92cb1a4ca110a1a536c9 | [] | no_license | Tian-Liu/ltSeckill | fe7ebee0b2599a35e8022566766b39865427014e | d9d479a113fba5af17513bf4ad723e7141607138 | refs/heads/master | 2022-12-26T00:36:37.443609 | 2019-07-10T03:59:48 | 2019-07-10T03:59:48 | 196,124,303 | 1 | 0 | null | 2022-12-16T05:54:26 | 2019-07-10T03:25:47 | Java | UTF-8 | Java | false | false | 325 | java | package org.seckill.exception;
/**
* 重复秒杀异常(运行期异常)
*/
public class RepeatKillException extends SeckillException{
public RepeatKillException(String message){
super(message);
}
public RepeatKillException(String message,Throwable cause){
super(message, cause);
}
}
| [
"2449849315@qq.com"
] | 2449849315@qq.com |
c93c3bd2cbcb98a1674d3b3ca1e5d9ad75f66a9b | 2d2660d100523e0370679d82a7f6f1106e16598e | /src/main/java/com/ahzak/utils/excel2/annotation/ExcelExport.java | 0ebe7a8c2147f84bd1048a15f9f0274dd2263aea | [] | no_license | sengeiou/utils | 0747212bc61aaa2a6283d08a13972e2e31271683 | 48b501fb5ae71b38fbd22901a07fa656a06c9b52 | refs/heads/master | 2022-11-13T00:50:52.715333 | 2020-07-10T03:27:09 | 2020-07-10T03:27:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 927 | java | /*
* @(#)Operation.java
* Copyright (C) 2019 Neusoft Corporation All rights reserved.
*
* VERSION DATE BY CHANGE/COMMENT
* ----------------------------------------------------------------------------
* @version 1.00 2019-03-29 Golconda 初版
*
*/
package com.ahzak.utils.excel2.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author Zhu Kaixiao
* @date 2020/3/14 13:40
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface ExcelExport {
/**
* excel文件名
* 不用加后缀名, 加了也会自动去掉
*/
String name() default "export";
/**
* 字段在excel中的表头
*/
String[] heads();
/**
* 需要生成excel的字段
*/
String[] fields();
}
| [
"3617246657@qq.com"
] | 3617246657@qq.com |
e41ba7eafebad0885dafdd0a653bd5eaad02c43a | 5be5ed77b9a8b46255a7b19d0c9eea3c96e89905 | /Animals/App2.java | 62caa8c2667ca9a1f46ef88f8a7948bc0a555e3a | [] | no_license | ArvydasA/java | 94958eab3b90d0707daf746c14bd2be78d056928 | 3e61802d426da17b525f337662a2d2ab96e16c5c | refs/heads/master | 2020-04-12T03:39:57.620696 | 2018-12-18T11:11:08 | 2018-12-18T11:11:08 | 162,273,482 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,540 | java | package com.skiabox.java_apps2;
/**
* Created by administrator on 10/10/2016.
*/
public class App2 {
public static void main(String[] args) {
//Separator
System.out.println("Inheritance in action");
System.out.println("------------------------------------------------------");
Animal w = new Wolf();
w.makeNoise(); //method is called from Wolf class
w.roam(); //method is called from Canine class
w.eat(); //method is called from Wolf class
w.sleep(); //method is called from Animal class
System.out.println();
//Separator
System.out.println("Polymorphism in action");
System.out.println("------------------------------------------------------");
//Now let's create an array of animals to see polymorphism in action
Animal[] animals = new Animal[5];
animals[0] = new Dog();
animals[1] = new Cat();
animals[2] = new Wolf(); //remember that Wolf has its own roam method
animals[3] = new Hippo();
animals[4] = new Lion();
for (int i = 0; i < animals.length; i++)
{
animals[i].eat();
animals[i].roam();
}
System.out.println();
//Separator
System.out.println("Polymorphic arguments");
System.out.println("------------------------------------------------------");
//We can have polymorphic arguments
Vet newVet = new Vet();
newVet.giveShot(w);
}
}
| [
"arvydas.arnasius@gmail.com"
] | arvydas.arnasius@gmail.com |
f6b8defae879ea315320190a394434fac6b946a0 | 5b43123c405b79a93acf0d7793c497df4576f770 | /session27/session27/services-api/src/main/java/co/karans/session27/services/Book.java | c210aaa6b3a03833e192131d5b8dd6b3d45e93e1 | [] | no_license | SamanDev/karans-training | f9bc1912d6c5b6c522f612d7739872f8b311ab23 | e6fcb306fb57ab06263b91128b171f3bdd180d87 | refs/heads/master | 2020-07-09T17:14:23.894461 | 2014-12-21T18:36:13 | 2014-12-21T18:36:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 558 | java | package co.karans.session27.services;
public class Book {
private long id;
private String name;
private Integer publishYear;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getPublishYear() {
return publishYear;
}
public void setPublishYear(Integer publishYear) {
this.publishYear = publishYear;
}
}
| [
"morteza@ubuntu.(none)"
] | morteza@ubuntu.(none) |
2a591deb6cb75dfb188a6ea5e9ba2745f6eb2250 | bf79df3b2e65aedbd03341a07632bd1afc55e00f | /src/main/java/model/Order.java | 6e327dea10fec8282cf975180910ec029d5d44e0 | [] | no_license | gerych94/Eshop2 | 2cf69da8932a7921969987b1df61ac1277e29536 | c1a7145ad479c6a22e9ff5c28591be6fd72c5339 | refs/heads/master | 2021-01-21T14:02:05.466670 | 2016-03-11T21:21:48 | 2016-03-11T21:21:48 | 40,476,962 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,353 | java | package model;
import javax.persistence.*;
import java.util.Date;
/**
* Created by Vitaliy on 21.07.2015.
*/
@Entity
@Table(name = "orders")
public class Order {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id_Order;
@ManyToOne(fetch = FetchType.LAZY,optional = false)
@JoinColumn(name = "id_client" ,referencedColumnName = "id_client")
private Client client;
@OneToOne()
@JoinColumn(name = "id_Bucket",referencedColumnName = "id_Bucket")
private Bucket bucket;
@Temporal(TemporalType.TIMESTAMP)
@Column
private Date dateCreation;
@Column
private double amount;
@Enumerated(EnumType.STRING)
@Column
private OrderStatus orderStatus;
public Order (){
}
public Order( Client client, Bucket bucket, Date dateCreation, double amount, OrderStatus orderStatus) {
this.client = client;
this.bucket = bucket;
this.dateCreation = dateCreation;
this.amount = amount;
this.orderStatus = orderStatus;
}
public int getId_Order() {
return id_Order;
}
public void setId_Order(int id_Order) {
this.id_Order = id_Order;
}
public Client getClient() {
return client;
}
public void setClient(Client client) {
this.client = client;
}
public Bucket getBucket() {
return bucket;
}
public void setBucket(Bucket bucket) {
this.bucket = bucket;
}
public Date getDateCreation() {
return dateCreation;
}
public void setDateCreation(Date dateCreation) {
this.dateCreation = dateCreation;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public OrderStatus getOrderStatus() {
return orderStatus;
}
public void setOrderStatus(OrderStatus orderStatus) {
this.orderStatus = orderStatus;
}
@Override
public String toString() {
return "Order{" +
"id_Order=" + id_Order +
", client=" + client.getName() +
", bucket=" + bucket.getBucket() +
", dateCreation=" + dateCreation +
", amount=" + amount +
", orderStatus=" + orderStatus +
'}';
}
}
| [
"vitaliy.kondratyuk.1994@gmail.com"
] | vitaliy.kondratyuk.1994@gmail.com |
390d097ade701f81b898df729ee3099afd53fe95 | 2d2e6c52bd9c854d8d9fee014ae0cfcc44f4eb4b | /app/src/test/java/com/example/xuepeng/usemenu/ExampleUnitTest.java | 24b8ed6b4a24136c95ec25fcd26b91edea4471d2 | [] | no_license | xuepengs/useMenu | 3994f95162bc408e21595244dd0c3e2f7dd5719e | 9f0904373905e547026fa5fe21d35ce99466b468 | refs/heads/master | 2020-03-06T14:25:23.645633 | 2018-03-27T05:53:18 | 2018-03-27T05:53:18 | 126,935,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 405 | java | package com.example.xuepeng.usemenu;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"helloxuepeng@gmail.com"
] | helloxuepeng@gmail.com |
4b570eb3f825b7b6b62cc6f30620bc9391688364 | 3d4f8a5cd96555d5c19070f0f0ea8795fdaffb72 | /电影/src/电影0820/Test.java | d5bbabafc857809a2b3cb120700317d0baf7b8d6 | [] | no_license | winter123456/myeclipse | 861cb26cdd1cc2bde6e1a0bc5b310e374a394d1a | f935017d5273e1bae759d9b2df8dbc6fd5b30084 | refs/heads/master | 2020-09-07T22:02:02.697734 | 2019-11-11T09:01:14 | 2019-11-11T09:01:14 | 220,924,742 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,692 | java | package 电影0820;
import java.util.List;
import java.util.Scanner;
public class Test {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
Service ser = new Service();
// 1.输出座位*******************************
ser.print();
// 初始化数据
Service.movies = (List<Movie>) ser.getData("Movies.txt");
boolean flag = true;
while (flag) {
System.out.println("今日播放电影如下:");
if (Service.movies == null) {
Service.movies = (List<Movie>) ser.getData("Movies.txt");
}
// 输出电影的列表
for (int i = 0; i < Service.movies.size(); i++) {
System.out.println(i + " " + Service.movies.get(i).getName());
}
System.out.println("请选择:1、购买电影票 2.退出系统");
String str = sc.next();
if (str.equals("1")) {
getTiceket(ser);
} else if(str.equals("2")) {
flag = false;
}else {
System.out.println("输入有误,请重新选择?");
}
}
}
private static void getTiceket(Service ser) {
System.out.println("请选择你要看的电影编号:");
int movieNumber = sc.nextInt();
System.out.println("请输入电影播放时间:以xx:xx的格式");
String time = sc.next();
System.out.println("请输入您所要购买的票的类型:1.普通票 2.学生票 3.赠送票");
int type = sc.nextInt();
System.out.println("请输入您所需要的折扣:1到9的整数");
int price = (int) (Service.movies.get(movieNumber).getPrice() * sc.nextInt() * 0.1);
System.out.println("请输入您所需要的座位号:以排-列的形式");
String number = sc.next();
Ticket ticket = new Ticket(Service.movies.get(movieNumber).getName(), time, price + "", number,
(type == 1) ? "普通票" : (type == 2) ? "学生票" : "赠送票");
// 将售票的对象放到记事本
boolean b = ser.putTicket(ticket);
if (b) {
System.out.println(" ***************************\n 陶陶影院 (" + ticket.getType()
+ ")\n ---------------------------\r\n" + " 电影名:" + ticket.getName() + " \r\n"
+ " 时间:" + ticket.getTime() + " \r\n" + " 座位号:" + ticket.getNumber() + " \r\n"
+ " 价格: " + ticket.getPrice() + " \r\n" + " ***************************");
}
System.out.println("请选择:1.继续购票 2.查询已售票 3.放回上一层 4.直接退出系统");
String in = sc.next();
switch (in) {
case "2":
List<?> data = ser.getData("Ticket.txt");
data.forEach(li -> System.out.println(li));
break;
case "4":
System.exit(0);
break;
}
}
}
| [
"1911592338@qq.com"
] | 1911592338@qq.com |
42c7a69d980808ab797d97074532fa2019083d57 | 3d8ff6cf8ca091be8f517ca713afe3ed07995bf0 | /mq/mq-producer/src/main/java/com/liang/producer/outerBind/OuterBindSender.java | 6849420877908c5f04dd952b0466018b2a3c77be | [] | no_license | liangliangmax/cloud-demo | 988bd87b0689ea6d6b67949fa0a4fe0cdb9f501e | 860103fb7f90eded4792f80cf732bc73c6971ae7 | refs/heads/master | 2022-07-02T21:06:07.880129 | 2020-09-11T03:04:31 | 2020-09-11T03:04:31 | 188,383,444 | 0 | 0 | null | 2022-06-21T02:53:12 | 2019-05-24T08:26:49 | Java | UTF-8 | Java | false | false | 1,085 | java | package com.liang.producer.outerBind;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;
@Component
public class OuterBindSender {
@Autowired
private RabbitTemplate rabbitTemplate;
public void stringSend() throws Exception{
Date date = new Date();
String dateString = new SimpleDateFormat("YYYY-mm-DD hh:MM:ss").format(date);
System.out.println("[liang] send msg:" + dateString);
CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
// 第一个参数为刚刚定义的队列名称
for(int i = 0;i<10;i++){
rabbitTemplate.convertAndSend("liangTopicExchange", "liang.topic.msg", dateString,correlationId);
Thread.sleep(1000);
}
}
}
| [
"32696645+max-translia@users.noreply.github.com"
] | 32696645+max-translia@users.noreply.github.com |
1c33e48c54e68d79fb9198a802b206fc2ba464c6 | 9c142a70814a5dbaf78e6844ceb2ee10a3eba1b8 | /src/carss/action/admin/sys/BankAddAction.java | 1501fd4656a3a091020ce76ad993a209b1d361ef | [] | no_license | xiuer121/creditcardm | cf25a30591703add2dce176fbb48ea4fe24049ec | 24f8aff637c33fbffaf4e59d3ba26094c77cde65 | refs/heads/master | 2021-01-25T07:08:31.075427 | 2015-07-21T01:48:23 | 2015-07-21T01:48:23 | 39,417,747 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,642 | java | /**
* @功能
*/
package carss.action.admin.sys;
import javax.annotation.Resource;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import carss.po.BankCardInfo;
import carss.service.BankCardInfoService;
import com.opensymphony.xwork2.ActionSupport;
@Controller
@Scope("prototype")
@Results({ @Result(type = "redirectAction", location = "bank-list"),
@Result(name = "input", location = "bank-add.jsp") })
public class BankAddAction extends ActionSupport {
private static final long serialVersionUID = 1L;
@Resource
private BankCardInfoService bankCardInfoService;
private String bankNo;
private String bankTitle;
private String bankCardNo;
/**
* @功能 新增管理员
*/
public String execute() throws Exception {
BankCardInfo o = new BankCardInfo();
o.setBankNo(bankNo);
o.setBankTitle(bankTitle);
o.setBankCardNo(bankCardNo);
o.setBankMoney(0d);
bankCardInfoService.save(o);
return SUCCESS;
}
/**
* @功能
*/
public void validate() {
}
public String getBankNo() {
return bankNo;
}
public void setBankNo(String bankNo) {
this.bankNo = bankNo;
}
public String getBankTitle() {
return bankTitle;
}
public void setBankTitle(String bankTitle) {
this.bankTitle = bankTitle;
}
public String getBankCardNo() {
return bankCardNo;
}
public void setBankCardNo(String bankCardNo) {
this.bankCardNo = bankCardNo;
}
}
| [
"lansq150616@gxwsxx.com"
] | lansq150616@gxwsxx.com |
710042250f2fad41c79ecc338fced7bc3a44fc24 | 28c86b16f09250371f433ec040a97d87bf0bd277 | /app/src/main/java/com/petproject/andy/bcstorage/data/BarcodeViewModel.java | 97ca5ca4c342ecf46d2dd093daf784a001b72ec7 | [] | no_license | AndyTereshko/BCStorage | e878e86709de8ee1f7038d7ff860cda025aa2518 | ec2db97ea352d986aa387e46197687d21039bd2c | refs/heads/master | 2020-03-09T20:10:20.769705 | 2019-02-14T09:48:35 | 2019-02-14T09:48:35 | 128,977,224 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,156 | java | package com.petproject.andy.bcstorage.data;
import android.app.Application;
import android.arch.lifecycle.AndroidViewModel;
import android.arch.lifecycle.LiveData;
import com.petproject.andy.bcstorage.data.BarcodeRepository;
import com.petproject.andy.bcstorage.data.database.Barcode;
import java.util.List;
public class BarcodeViewModel extends AndroidViewModel {
private BarcodeRepository mRepository;
private LiveData<List<Barcode>> mAllBarcodes;
public BarcodeViewModel (Application application) {
super(application);
mRepository = new BarcodeRepository(application);
mAllBarcodes = mRepository.getAllBarcodes();
}
public LiveData<List<Barcode>> getAllBarcodes() { return mAllBarcodes; }
public LiveData<List<Barcode>> getSpecificBarcodes(String barcode) {
return mRepository.getSpecificBarcodes(barcode);
}
public void insert(Barcode barcode) { mRepository.insert(barcode); }
public void delete(Barcode barcode) { mRepository.delete(barcode); }
public void deleteAll(){mRepository.deleteAll();}
public void update(Barcode barcode) { mRepository.update(barcode); }
}
| [
"andrey.tereshko@gmail.com"
] | andrey.tereshko@gmail.com |
4a7c73c24f61a085522fcc3eeb7f580c3021a4da | 95e6ae6ee48322a25a4fed142e50e96e2e5fcde7 | /app/src/androidTest/java/com/example/youtubeapp/alee/ExampleInstrumentedTest.java | 5b0b6f7ea6f7f640545e454be79a0a27ecc511e7 | [] | no_license | AlexWonkeunLee/YoutubeApp | 27850cf74babf7c2a5ad8ae8d5593afe5faab420 | 252c40a9a0e44de549c938c5c570a3f5e3169a5b | refs/heads/master | 2022-12-13T06:16:02.101472 | 2020-08-31T21:22:21 | 2020-08-31T21:22:21 | 291,203,131 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 768 | java | package com.example.youtubeapp.alee;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.youtubeapp.alee", appContext.getPackageName());
}
} | [
"AlexWonkeunLee@gmail.com"
] | AlexWonkeunLee@gmail.com |
5cb03ca542c1f142f588a00cd3a7d675ef5fe9c9 | 70807cfc1e055db93046442db1d8adb45132681e | /src/main/java/com/worldkey/entity/WindowShow.java | 6a2d541669106eac5a967a515b679fb0b14f2eb9 | [] | no_license | York-Charles/worldkey | 05a6246195d20d3091d0be0fc6c421a8d4f8b919 | f3a9285fae7825f65d575d4880f4a96ee7da1e5e | refs/heads/master | 2022-07-11T14:48:52.594381 | 2019-03-15T02:31:02 | 2019-03-15T02:31:02 | 140,788,092 | 0 | 1 | null | 2022-06-21T00:17:36 | 2018-07-13T02:42:39 | Java | UTF-8 | Java | false | false | 299 | java | package com.worldkey.entity;
import lombok.*;
@Data
public class WindowShow {
private Integer id;
private String title;
private String titleImg;
private String webUrl;
private Long usersId;
private String loginName;
private String author;
private String headImg;
}
| [
"13699284439@163.com"
] | 13699284439@163.com |
b57f4df6e0dd120d5e58f808f4540604d7afb0b1 | b4dce9866090a28441fce22647afef21b28dfbae | /src/chat7/MultiClient.java | e28fd8eaa69bdecf4d2bffb1ea62692ac11b400d | [] | no_license | cysi230/K01NetworkChat | 0b957e5b32f73fd436bcaf950654d1da142797ac | 6b830d97e9cf62c5f8901d24eee8125c7fc00254 | refs/heads/master | 2023-01-05T21:12:40.194609 | 2020-11-04T09:48:27 | 2020-11-04T09:48:27 | 309,947,300 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 850 | java | package chat7;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.Scanner;
public class MultiClient {
public static void main(String[] args) {
System.out.print("이름을 입력하세요");
Scanner scanner = new Scanner(System.in);
String s_name = scanner.nextLine();
// PrintWriter out = null;
// BufferedReader in = null;
try {
String ServerIP = "localhost";
if(args.length>0) {
ServerIP = args[0];
}
Socket socket = new Socket(ServerIP,9999);
System.out.println("서버와 연결되었습니다");
Thread receiver = new Receiver(socket);
receiver.start();
Thread sender = new Sender(socket, s_name);
sender.start();
}
catch (Exception e) {
System.out.println("예외발생"+e);
}
}
} | [
"cysik94@gmail.com"
] | cysik94@gmail.com |
ce61ccf844b074b30753e9f6f3b827539b1081ac | c20a5e0bb406c1e1760bfc3a89544065a4c4f210 | /src/main/java/site/clzblog/mybatis/high/imitation/annotation/Select.java | 8bae6d441a352085f3909e4d1b8bc2683b2caa77 | [
"Apache-2.0"
] | permissive | zouchengli/mybatis-high-imitation | 985c7619ea823d7a45ecb7625f2c0a9ae789f1a3 | 8a73bfefb4209b3d9efdd6cc89a0c53eb82b58e8 | refs/heads/master | 2022-07-01T06:31:19.338781 | 2019-07-03T10:34:14 | 2019-07-03T10:34:14 | 195,032,527 | 0 | 0 | Apache-2.0 | 2022-06-21T01:23:46 | 2019-07-03T10:31:13 | Java | UTF-8 | Java | false | false | 332 | java | package site.clzblog.mybatis.high.imitation.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 Select {
String value();
}
| [
"chengli.zou@gmail.com"
] | chengli.zou@gmail.com |
4c68c6371d1388c08b639406a059f143e497a945 | 6844e99791fcdcdabdca571a72ec6e27ebdd00ec | /Spring4MVCAngularJSExample/src/main/java/com/websystique/springmvc/service/ValidationService.java | 80503e95a14fb35ed58a373870392f84f28675f9 | [] | no_license | Meenakumar01/CTSAssignment | 993dade948b9d39fdfa24f8d5741cef3e672623c | 64d8e42bc17c35a7158fb29d0f80fe993668f8cd | refs/heads/master | 2020-03-26T17:42:47.859642 | 2018-08-18T09:03:13 | 2018-08-18T09:03:13 | 145,175,894 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 180 | java | package com.websystique.springmvc.service;
import com.websystique.springmvc.model.Reports;
public interface ValidationService {
Reports validate(Reports records);
}
| [
"noreply@github.com"
] | noreply@github.com |
616fcec55a2b0477c0cbac69b635b75561804f3a | 80395354ebc40e7c5a574d0219ce610642ead635 | /Chapter08/photobeans-main/src/main/java/com/steeplesoft/photobeans/manager/reload/ReloadImagesAction.java | 60107fc16f7b17daab4b040ae6ee3d45dc3a50cd | [
"MIT"
] | permissive | PacktPublishing/Java-9-Programming-Blueprints | ed636ec8ddd07a78ef5987262376746493794d18 | bea9ee0825d31d991dc3382391cbe4a46d7f11ec | refs/heads/master | 2023-02-15T20:13:40.110460 | 2023-01-30T08:44:13 | 2023-01-30T08:44:13 | 97,231,654 | 14 | 10 | MIT | 2023-02-09T19:47:26 | 2017-07-14T12:29:08 | Java | UTF-8 | Java | false | false | 1,213 | java | package com.steeplesoft.photobeans.manager.reload;
import com.steeplesoft.photobeans.manager.PhotoManager;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionRegistration;
import org.openide.util.Lookup;
import org.openide.util.NbBundle.Messages;
import org.openide.util.RequestProcessor;
@ActionID(
category = "File",
id = "com.steeplesoft.photobeans.main.ReloadImagesAction"
)
@ActionRegistration(
displayName = "#CTL_ReloadImagesAction",
lazy = false
)
@ActionReference(path = "Menu/File", position = 1300)
@Messages("CTL_ReloadImagesAction=Reload")
public final class ReloadImagesAction extends AbstractAction {
public ReloadImagesAction() {
putValue(AbstractAction.NAME, "Reload");
}
public ReloadImagesAction(Lookup lookup) {
this();
}
@Override
public boolean isEnabled() {
return true;
}
@Override
public void actionPerformed(ActionEvent e) {
RequestProcessor.getDefault().execute(() ->
Lookup.getDefault().lookup(PhotoManager.class).scanSourceDirs());
}
}
| [
"abhisheksharma@packtpub.com"
] | abhisheksharma@packtpub.com |
a48a9f724182d6360924c6912e8ba572dff710a9 | be99d0a436f6a3380ade360fd310b472fcf3f13d | /src/Term_1/Lesson_12_Activities/Lesson_12_Activity_Two.java | 6ec47705cef35167b48fb215dbcfee20f575b53e | [
"MIT"
] | permissive | EroSkulled/ComputerSciencec | bac39be1c5d6c0f000cc9eeaee350139f77b69e7 | 25d184a472a72be667f49ebab00a88cf6dd5a6ba | refs/heads/master | 2021-01-19T06:03:24.501407 | 2017-07-05T13:19:13 | 2017-07-05T13:19:13 | 67,829,317 | 0 | 0 | null | 2017-07-05T13:19:13 | 2016-09-09T20:07:39 | Java | UTF-8 | Java | false | false | 828 | java | package Term_1.Lesson_12_Activities;/*
* Lesson 12 Coding Activity 2
* Input two decimal numbers and print the largest.
* If the numbers are equal, print one of them.
*
* Sample Run 1
* Please enter two numbers:
* 45.7
* 45.1
*
* Largest is: 45.7
*
* Sample Run 2
* Please enter two numbers:
* 14
* 14
*
* Largest is: 14.0
*
*/
import java.util.Scanner;
class Lesson_12_Activity_Two {
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
double a = s.nextDouble();
double b = s.nextDouble();
if (a >= b) {
System.out.println("Largest = " + a);
} else {
System.out.println("Largest = " + b);
}
}
} | [
"satouakatsuki@gmail.com"
] | satouakatsuki@gmail.com |
9815bd07d7b41dfe0da5868fa94067b418d40ef1 | 174f4ee8d10581479d4f611b45f5efc2080f44fd | /src/com/algorithm/training/leetcode/802_find_eventual_safe_states/Solution.java | 1e72423a360911f9531e8f1cb1a127e974b73bdf | [] | no_license | solbread/algorithm | c0fac2376a7e578e8aa84266ef7b499c918aabdb | 75cdbd180e8681692d03ae227c6a50074a7234b0 | refs/heads/master | 2022-01-11T14:15:52.626303 | 2019-07-16T14:50:42 | 2019-07-16T14:50:42 | 84,454,407 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,276 | java | package com.algorithm.training.depth_first_search.find_eventual_safe_states;
import java.util.ArrayList;
import java.util.List;
public class Solution {
int[][] graph;
public List<Integer> eventualSafeNodes(int[][] graph) {
this.graph = graph;
int[] visitied = new int[graph.length];
List<Integer> safeNodes = new ArrayList<>();
for(int i = 0; i < graph.length; i++) {
if(isSafe(i, visitied)) safeNodes.add(i);
}
return safeNodes;
}
private boolean isSafe(int visitNodeNumber, int[] visited) {
if(visited[visitNodeNumber] != 0) return visited[visitNodeNumber] == 1;
boolean isSafe = true;
visited[visitNodeNumber] = 2;
for(int i = 0; isSafe && i < graph[visitNodeNumber].length; i++) {
isSafe = isSafe(graph[visitNodeNumber][i], visited);
}
visited[visitNodeNumber] = isSafe ? 1 : 2;
return isSafe;
}
public static void main(String[] args) {
Solution solution = new Solution();
System.out.println(solution.eventualSafeNodes(new int[][]{{1,2},{2,3},{5},{0},{5},{},{}})); //{2,4,5,6}
System.out.println(solution.eventualSafeNodes(new int[][]{{},{0,2,3,4},{3},{4},{}})); //0,1,2,3,4
}
}
| [
"solbread.dev@gmail.com"
] | solbread.dev@gmail.com |
0062b8918489f618f8f12eb4460743838763c44f | f3d1edd7d4ed0da853b5a314ecc65730cbb5e6a4 | /SpeakBuy/src/main/java/com/amazon/webservices/awsecommerceservice/_2011_08_01/Price.java | 45ff87deaefe9e23f1050f27e84b1d2abf103322 | [
"Apache-2.0"
] | permissive | namanrajpal/SpeakBuy-Android-Chat-Bot | 1ad2d14c5c1794debdec127dbe20e59a77c25d1d | 7bc537a9fef5fef9a3dc4b915d813421a2d39525 | refs/heads/master | 2021-06-19T12:08:19.162778 | 2017-07-15T16:24:11 | 2017-07-15T16:24:11 | 76,144,800 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 589 | java | // Generated by xsd compiler for android/java
// DO NOT CHANGE!
package com.amazon.webservices.awsecommerceservice._2011_08_01;
import java.io.Serializable;
import com.leansoft.nano.annotation.*;
import java.math.BigInteger;
public class Price implements Serializable {
private static final long serialVersionUID = -1L;
@Element(name = "Amount")
@Order(value=0)
public BigInteger amount;
@Element(name = "CurrencyCode")
@Order(value=1)
public String currencyCode;
@Element(name = "FormattedPrice")
@Order(value=2)
public String formattedPrice;
} | [
"namanrajpal16@ufl.edu"
] | namanrajpal16@ufl.edu |
26b754fef6e20275fe3837880d784e8544fc2f90 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/7/7_2126bc9be124a0171f67416d6302e37410540757/RowKeyDistributorByHashPrefix/7_2126bc9be124a0171f67416d6302e37410540757_RowKeyDistributorByHashPrefix_t.java | 54e4a8d214a7871a74a727bfe09744b8cba3d303 | [] | 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 | 4,414 | java | /**
* Copyright 2010 Sematext International
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.sematext.hbase.wd;
import java.util.Arrays;
import org.apache.hadoop.hbase.util.Bytes;
/**
* Provides handy methods to distribute
*
* @author Alex Baranau
*/
public class RowKeyDistributorByHashPrefix extends AbstractRowKeyDistributor {
private static final String DELIM = "--";
private Hasher hasher;
/** Constructor reflection. DO NOT USE */
public RowKeyDistributorByHashPrefix() {
}
public RowKeyDistributorByHashPrefix(Hasher hasher) {
this.hasher = hasher;
}
public static interface Hasher extends Parametrizable {
byte[] getHashPrefix(byte[] originalKey);
byte[][] getAllPossiblePrefixes();
int getPrefixLength(byte[] adjustedKey);
}
public static class OneByteSimpleHash implements Hasher {
private int mod;
/**
* For reflection, do NOT use it.
*/
public OneByteSimpleHash() {}
/**
* Creates a new instance of this class.
* @param maxBuckets max buckets number, should be in 1...255 range
*/
public OneByteSimpleHash(int maxBuckets) {
if (maxBuckets < 1 || maxBuckets > 255) {
throw new IllegalArgumentException("maxBuckets should be in 1..255 range");
}
// i.e. "real" maxBuckets value = maxBuckets or maxBuckets-1
this.mod = (maxBuckets + 1) / 2;
}
// Used to minimize # of created object instances
// Should not be changed. TODO: secure that
private static final byte[][] PREFIXES;
static {
PREFIXES = new byte[Byte.MAX_VALUE - Byte.MIN_VALUE + 1][];
for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++) {
PREFIXES[i - Byte.MIN_VALUE] = new byte[] {(byte) i};
}
}
@Override
public byte[] getHashPrefix(byte[] originalKey) {
long hash = 0;
for (byte b : originalKey) {
hash = hash << Byte.SIZE;
hash += b;
}
return new byte[] {(byte) (hash % mod)};
}
@Override
public byte[][] getAllPossiblePrefixes() {
return Arrays.copyOfRange(PREFIXES, (0 - mod + 1) - Byte.MIN_VALUE, mod - Byte.MIN_VALUE);
}
@Override
public int getPrefixLength(byte[] adjustedKey) {
return 1;
}
@Override
public String getParamsToStore() {
return String.valueOf(mod);
}
@Override
public void init(String storedParams) {
this.mod = Integer.valueOf(storedParams);
}
}
@Override
public byte[] getDistributedKey(byte[] originalKey) {
return Bytes.add(hasher.getHashPrefix(originalKey), originalKey);
}
@Override
public byte[] getOriginalKey(byte[] adjustedKey) {
int prefixLength = hasher.getPrefixLength(adjustedKey);
if (prefixLength > 0) {
return Bytes.tail(adjustedKey, adjustedKey.length - prefixLength);
} else {
return adjustedKey;
}
}
@Override
public byte[][] getAllDistributedKeys(byte[] originalKey) {
byte[][] allPrefixes = hasher.getAllPossiblePrefixes();
byte[][] keys = new byte[allPrefixes.length][];
for (int i = 0; i < allPrefixes.length; i++) {
keys[i] = Bytes.add(allPrefixes[i], originalKey);
}
return keys;
}
@Override
public String getParamsToStore() {
String hasherParamsToStore = hasher.getParamsToStore();
return hasher.getClass().getName() + DELIM + (hasherParamsToStore == null ? "" : hasherParamsToStore);
}
@Override
public void init(String params) {
String[] parts = params.split(DELIM, 2);
try {
this.hasher = (Hasher) Class.forName(parts[0]).newInstance();
this.hasher.init(parts[1]);
} catch (Exception e) {
throw new RuntimeException("RoKeyDistributor initialization failed", e);
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
33ebccbf0f0029a309abf13edc29d91cc20a5576 | 91e8d3977291226d0b0cee4bd82f36650a5e6d11 | /main/java/ca2/testproject/shotgunstudios2/palprepbeta1/ScoreActivity.java | 419238808c7cea9a886045c4a3ad785f8309c39e | [] | no_license | YousafRaja/PAL_Prep | deb53552f51dec074acd881044ee0d726ce75461 | 41e9878f213b40d9adf949e64262110b3874c952 | refs/heads/master | 2022-07-17T11:46:14.086557 | 2020-05-19T23:18:59 | 2020-05-19T23:18:59 | 257,593,635 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,605 | java | package ca2.testproject.shotgunstudios2.palprepbeta1;
import android.content.Intent;
import android.os.Bundle;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.appcompat.app.ActionBarActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.text.DecimalFormat;
import java.util.ArrayList;
import ca2.testproject.shotgunstudios.palprepbeta1.R;
/**ScoreActivity
*- creates the final score page, called after practice test is complete
*/
public class ScoreActivity extends ActionBarActivity implements View.OnClickListener {
private Toolbar toolbar;
Button restart;
TextView scoreTitle;
TextView score;
float correctAnswers;
static ArrayList<prompt> pList = PracticeTestActivity.getList();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_score_appbar);
toolbar = (Toolbar) findViewById(R.id.app_bar);
setSupportActionBar(toolbar);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
NavigationDrawerFragment drawerFragment= (NavigationDrawerFragment)
getSupportFragmentManager().findFragmentById(R.id.fragment_navigation_drawer);
drawerFragment.setUp(R.id.fragment_navigation_drawer ,(DrawerLayout) findViewById(R.id.drawer_layout), toolbar );
scoreTitle = (TextView) findViewById(R.id.scoretitle);
score = (TextView) findViewById(R.id.scoredisplay);
}
public void calculateAndSetScore (){
correctAnswers=0;
for (int i=0; i<pList.size(); i++){
if (pList.get(i).questionStatus=="Correct"){
correctAnswers++;
}
}
int correct = (int) correctAnswers;
float percentage = (correctAnswers/(float)pList.size())*100;
DecimalFormat df = new DecimalFormat("##");
score.setText(df.format(percentage)+"%"+" - "+correct + "/" + pList.size()+ "");
if (percentage>=80){
scoreTitle.setText("You Passed!");
} else {
scoreTitle.setText("You FAIL. Try Again?");
}
}
@Override
public void onBackPressed() {
startActivity(new Intent(this, PracticeTestActivity.class));
this.finish();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_myprogress, menu);
calculateAndSetScore();
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
if(id==R.id.navigate){
startActivity(new Intent(this, SubActivity.class));
}
if(id==android.R.id.home){
//NavUtils.navigateUpFromSameTask(this);
}
return super.onOptionsItemSelected(item);
}
@Override
public void onClick(View v) {
onBackPressed();
}
}
| [
"waynestudent38@gmail.com"
] | waynestudent38@gmail.com |
59d179e01287a566c6e9c9b762166026939fce0d | 858307ec37cc7d66620f6b1e9f010903471acf97 | /gmall_bpg/src/main/java/com/jyy/gmall/pms/service/CommentReplayService.java | dcc22c0e6b1233611875316fa6e90adf4f2581ae | [] | no_license | CoderRainbow/gmall | 36b27942c7d557c08e3ff193c39fa75b8fa292d5 | 3a60417692acb04b8bb1648e2627c3e4c7b752a4 | refs/heads/master | 2022-06-26T08:19:58.808849 | 2019-12-13T09:23:55 | 2019-12-13T09:23:55 | 226,762,497 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 316 | java | package com.jyy.gmall.pms.service;
import com.jyy.gmall.pms.entity.CommentReplay;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 产品评价回复表 服务类
* </p>
*
* @author jyy
* @since 2019-12-11
*/
public interface CommentReplayService extends IService<CommentReplay> {
}
| [
"58131359+CoderRainbow@users.noreply.github.com"
] | 58131359+CoderRainbow@users.noreply.github.com |
d45d207112f11b180ffd79c99604e95ae7c99bd4 | d55375eb56ad7901df53d0d321436fc8f6a2f6db | /app/src/main/java/com/example/hp/statiosis/navigation.java | fdf491daaf90e04b351940e35c04f2d2faa0d32a | [] | no_license | Dennis-Kingori/Statiosis | 5f856ad69f5d65924e69d2aec0b6ee0ba143804e | 3525653d5ad4eff0a9dbde03900850b48e412afb | refs/heads/master | 2021-10-25T16:10:30.954032 | 2019-04-05T07:24:42 | 2019-04-05T07:24:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,952 | java | package com.example.hp.statiosis;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.view.View;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import com.example.hp.statiosis.FRAGEMENTS.FixturesFragment;
import com.example.hp.statiosis.FRAGEMENTS.PlayerProfileFragement;
import com.example.hp.statiosis.FRAGEMENTS.ResultFragment;
import com.example.hp.statiosis.FRAGEMENTS.TeamsFragement;
import com.example.hp.statiosis.FRAGEMENTS.TournamentFragment;
public class navigation extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_navigation);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.navigation, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_profile) {
// Handle the camera action
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_nav ,new PlayerProfileFragement())
.commit();
} else if (id == R.id.nav_team_profile) {
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_nav, new TeamsFragement())
.commit();
} else if (id == R.id.nav_teams) {
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_nav, new TeamsFragement())
.commit();
} else if (id == R.id.nav_tournaments) {
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_nav, new TournamentFragment())
.commit();
} else if (id == R.id.nav_fixtures) {
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_nav , new FixturesFragment())
.commit();
} else if (id == R.id.nav_results) {
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_nav, new ResultFragment())
.commit();
}
DrawerLayout drawer = findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
}
| [
"Bostcelt75@gmail.com"
] | Bostcelt75@gmail.com |
ab9bbd7a03a70757c2d0b04648914b6de6e6e433 | c901f9e1c3fee765c05ef58b6cd952c467e86a7b | /src/main/java/dz/cirtaflow/models/act/ActProcdefInfo.java | 753042bb2090598abc237582dd26796f32e0eb29 | [] | no_license | abdessamed-diab/cirtaflow-login-module | f55e603adac56963dac31aeb731d707eab60f22e | 8fa31558baa74f2ba3bee6db99832826afe1afa2 | refs/heads/master | 2021-08-30T02:06:13.179351 | 2017-12-03T00:49:44 | 2017-12-03T00:49:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,865 | 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 dz.cirtaflow.models.act;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
/**
*
* @author diab
*/
@Entity
@Table(name = "ACT_PROCDEF_INFO", uniqueConstraints = {
@UniqueConstraint(columnNames = {"PROC_DEF_ID_"})})
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "ActProcdefInfo.findAll", query = "SELECT a FROM ActProcdefInfo a")
, @NamedQuery(name = "ActProcdefInfo.findById", query = "SELECT a FROM ActProcdefInfo a WHERE a.id = :id")
, @NamedQuery(name = "ActProcdefInfo.findByRev", query = "SELECT a FROM ActProcdefInfo a WHERE a.rev = :rev")})
public class ActProcdefInfo implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@Column(name = "ID_", nullable = false, length = 64)
private String id;
@Column(name = "REV_")
private Integer rev;
@JoinColumn(name = "INFO_JSON_ID_", referencedColumnName = "ID_")
@ManyToOne(fetch = FetchType.LAZY)
private ActGeBytearray infoJsonId;
@JoinColumn(name = "PROC_DEF_ID_", referencedColumnName = "ID_", nullable = false)
@OneToOne(optional = false, fetch = FetchType.LAZY)
private ActReProcdef procDefId;
public ActProcdefInfo() {
}
public ActProcdefInfo(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Integer getRev() {
return rev;
}
public void setRev(Integer rev) {
this.rev = rev;
}
public ActGeBytearray getInfoJsonId() {
return infoJsonId;
}
public void setInfoJsonId(ActGeBytearray infoJsonId) {
this.infoJsonId = infoJsonId;
}
public ActReProcdef getProcDefId() {
return procDefId;
}
public void setProcDefId(ActReProcdef procDefId) {
this.procDefId = procDefId;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ActProcdefInfo)) {
return false;
}
ActProcdefInfo other = (ActProcdefInfo) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "cirtaflow.business.cirtaflow.ActProcdefInfo[ id=" + id + " ]";
}
}
| [
"diabconcept@outlook.com"
] | diabconcept@outlook.com |
b9d4455ca18a46f3142dd3ccf9b9d1f0e49c042d | ced51bf166c88f5b6d6cbb1a6661bd99d72ecff1 | /Doc/JBuilder/Chapter09/Cards/src/firstproject/FirstProjectFrame.java | 5c70bc91506955ecf855231abb32ebd214e83b15 | [] | no_license | kew7/Flenov_Programming_Cpp_Hacker | a1de268c3ab964fb6385faa522da053168aa165b | 113f5c32b37cb8aa9d4a5cad6d9811e51ef97ce7 | refs/heads/master | 2020-09-17T09:54:47.724006 | 2019-12-08T11:23:55 | 2019-12-08T11:23:55 | 224,067,769 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,985 | java |
/**
* Title: First project<p>
* Description: <p>
* Copyright: Copyright (c) Flenov Mikhail<p>
* Company: CyD Software Labs<p>
* @author Flenov Mikhail
* @version 1.0
*/
package firstproject;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class FirstProjectFrame extends JFrame {
JPanel contentPane;
JMenuBar menuBar1 = new JMenuBar();
JMenu menuFile = new JMenu();
JMenuItem menuFileExit = new JMenuItem();
JMenu menuHelp = new JMenu();
JMenuItem menuHelpAbout = new JMenuItem();
JToolBar toolBar = new JToolBar();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JButton jButton3 = new JButton();
ImageIcon image1;
ImageIcon image2;
ImageIcon image3;
BorderLayout borderLayout1 = new BorderLayout();
JPanel jPanel1 = new JPanel();
JButton jButton4 = new JButton();
JButton jButton5 = new JButton();
JButton jButton6 = new JButton();
CardLayout cardLayout1 = new CardLayout();
//Construct the frame
public FirstProjectFrame() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
image1 = new ImageIcon(FirstProjectFrame.class.getResource("openFile.gif"));
image2 = new ImageIcon(FirstProjectFrame.class.getResource("closeFile.gif"));
image3 = new ImageIcon(FirstProjectFrame.class.getResource("help.gif"));
contentPane = (JPanel) this.getContentPane();
contentPane.setLayout(borderLayout1);
this.setSize(new Dimension(374, 286));
this.setTitle("My First Project");
menuFile.setText("File");
menuFileExit.setText("Exit");
menuFileExit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
fileExit_actionPerformed(e);
}
});
menuHelp.setText("Help");
menuHelpAbout.setText("About");
menuHelpAbout.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
helpAbout_actionPerformed(e);
}
});
jButton1.setIcon(image1);
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton1_actionPerformed(e);
}
});
jButton1.setToolTipText("Open File");
jButton2.setIcon(image2);
jButton2.setToolTipText("Close File");
jButton3.setIcon(image3);
jButton3.setToolTipText("Help");
jButton4.setText("jButton4");
jButton5.setText("jButton5");
jButton6.setText("jButton6");
jPanel1.setLayout(cardLayout1);
toolBar.add(jButton1);
toolBar.add(jButton2);
toolBar.add(jButton3);
menuFile.add(menuFileExit);
menuHelp.add(menuHelpAbout);
menuBar1.add(menuFile);
menuBar1.add(menuHelp);
contentPane.add(toolBar, BorderLayout.NORTH);
contentPane.add(jPanel1, BorderLayout.CENTER);
jPanel1.add(jButton6, "jButton6");
jPanel1.add(jButton5, "jButton5");
jPanel1.add(jButton4, "jButton4");
this.setJMenuBar(menuBar1);
}
//File | Exit action performed
public void fileExit_actionPerformed(ActionEvent e) {
System.exit(0);
}
//Help | About action performed
public void helpAbout_actionPerformed(ActionEvent e) {
FirstProjectFrame_AboutBox dlg = new FirstProjectFrame_AboutBox(this);
Dimension dlgSize = dlg.getPreferredSize();
Dimension frmSize = getSize();
Point loc = getLocation();
dlg.setLocation((frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y);
dlg.setModal(true);
dlg.show();
}
//Overridden so we can exit when window is closed
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
fileExit_actionPerformed(null);
}
}
void jButton1_actionPerformed(ActionEvent e) {
cardLayout1.next(jPanel1);
}
} | [
"kew7@yandex.ru"
] | kew7@yandex.ru |
cfc71e9b5bc6ea8108e64258832a68f20159f7bc | 1e065eedde1df053f7dfa9f758430347219a035e | /app/src/main/java/com/app/oliverace/util/LocationService.java | 52df3c104be4f122bfdeb6916e07e9a129559236 | [] | no_license | carlosoliveraf/bora | 46ce79dd76c18dd02f53a874ae7f99f14d00951e | bd9aa57f058d5fc186c9d0c6656386c16d9c1326 | refs/heads/master | 2020-06-11T06:20:17.833772 | 2016-12-06T16:09:15 | 2016-12-06T16:09:15 | 75,747,702 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,427 | java | package com.app.oliverace.util;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
/**
* Created by oliverace on 11/11/2016.
*/
public class LocationService implements LocationListener {
//The minimum distance to change updates in meters
private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 0; // 10 meters
//The minimum time beetwen updates in milliseconds
private static final long MIN_TIME_BW_UPDATES = 0;//1000 * 60 * 1; // 1 minute
private final static boolean forceNetwork = false;
private static LocationService instance = null;
private LocationManager locationManager;
public Location location;
public double longitude;
public double latitude;
private boolean isGPSEnabled;
private boolean isNetworkEnabled;
private boolean locationServiceAvailable;
/**
* Singleton implementation
* @return
*/
public static LocationService getLocationManager(Context context) {
if (instance == null) {
instance = new LocationService(context);
}
return instance;
}
/**
* Local constructor
*/
private LocationService( Context context ) {
initLocationService(context);
// LogService.log("LocationService created");
}
/**
* Sets up location service after permissions is granted
*/
@TargetApi(23)
private void initLocationService(Context context) {
if ( Build.VERSION.SDK_INT >= 23 &&
ContextCompat.checkSelfPermission( context, android.Manifest.permission.ACCESS_FINE_LOCATION ) != PackageManager.PERMISSION_GRANTED &&
ContextCompat.checkSelfPermission( context, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return ;
}
try {
this.longitude = 0.0;
this.latitude = 0.0;
this.locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
// Get GPS and network status
this.isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
this.isNetworkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
if (forceNetwork) isGPSEnabled = false;
if (!isNetworkEnabled && !isGPSEnabled) {
// cannot get location
this.locationServiceAvailable = false;
}
//else
{
this.locationServiceAvailable = true;
if (isNetworkEnabled) {
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
MIN_TIME_BW_UPDATES,
MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
if (locationManager != null) {
location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
updateCoordinates();
}
}//end if
if (isGPSEnabled) {
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
MIN_TIME_BW_UPDATES,
MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
if (locationManager != null) {
location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
updateCoordinates();
}
}
}
} catch (Exception ex) {
// LogService.log( "Error creating location service: " + ex.getMessage() );
}
}
@Override
public void onLocationChanged(Location location) {
// do stuff here with location object
}
@Override
public void onStatusChanged(String s, int i, Bundle b) {
// do stuff here with location object
}
@Override
public void onProviderEnabled(String s) {
}
@Override
public void onProviderDisabled(String s) {
}
public void updateCoordinates(){
};
}
| [
"oliverace@saude.sc.gov.br"
] | oliverace@saude.sc.gov.br |
ee3dbd0f7087a99ac1fc66f5e9364a2edaee4e57 | 4f0f6b6bcabf2328f2e5c703bef88f0f77eb9f8e | /src/LatihanSoal3.java | b48520ac26cbf718f80691a1204022159f002162 | [] | no_license | daffariski2002/jobsheet9 | 2c3596ece66663ff9f210c32bda11c9e1b96a407 | de3ae0df4fa215ddb50a5e95e48802f796f873aa | refs/heads/master | 2020-03-25T03:36:45.252966 | 2018-08-02T22:43:31 | 2018-08-02T22:43:31 | 143,350,989 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 463 | 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.
*/
/**
*
* @author Kbex1908
*/
public class LatihanSoal3 {
public static int Hitung (int a, int b)
{
int c = a + b;
return c;
}
public static void main(String[] args) {
int x ;
x = Hitung (2,3);
}
}
| [
"daffariski2002@gmail.com"
] | daffariski2002@gmail.com |
fea6af9f458caa9ba665ad099e7a8abf439186de | 031ae20ef643bc9d4001c114a9b82d718f79a008 | /src/main/java/gr/james/stats/measures/Pearson.java | bbe15bd3b76819e57fcb73dc3d0602e1d79b750a | [
"MIT"
] | permissive | gstamatelat/stats | b612c248b52e05f88689373859a9833ec2e3d6ce | 90e47db0aabd7d8fd6cc327910a26e7a4c05c1ee | refs/heads/master | 2023-08-23T14:32:52.485874 | 2021-09-18T14:54:47 | 2021-09-18T14:54:47 | 341,863,882 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,661 | java | package gr.james.stats.measures;
import java.util.Iterator;
import java.util.Set;
import java.util.function.ToDoubleFunction;
/**
* Pearson correlation coefficient implementation.
*/
public class Pearson {
private final double value;
/**
* Create a new {@link Pearson} from the given sets.
* <p>
* This form of Pearson correlation coefficient is identical to the Phi coefficient.
* <p>
* The {@code world} set must be a superset of {@code a} and {@code b} and this constructor will make no checks to
* ensure that.
*
* @param a one set
* @param b the other set
* @param world the world set
* @param <T> the type of elements in the inputs
* @throws NullPointerException if either {@code a}, {@code b} or {@code world} is {@code null}
* @throws IllegalArgumentException if either {@code a} or {@code b} is empty
*/
public <T> Pearson(Set<T> a, Set<T> b, Set<T> world) {
if (a.isEmpty() || b.isEmpty()) {
throw new IllegalArgumentException("Inputs cannot be empty");
}
Set<T> big;
Set<T> small;
if (a.size() > b.size()) {
big = a;
small = b;
} else {
big = b;
small = a;
}
int intersection = 0;
int union = big.size();
for (T t : small) {
if (big.contains(t)) {
intersection++;
} else {
union++;
}
}
final double n00 = world.size() - union;
final double n10 = a.size() - intersection;
final double n01 = b.size() - intersection;
final double n0_ = world.size() - a.size();
final double n_0 = world.size() - a.size();
this.value = ((double) intersection * n00 - n10 * n01) /
Math.sqrt((double) a.size() * (double) b.size() * n0_ * n_0);
assert Double.isNaN(this.value) || (this.value >= -1 && this.value <= 1);
}
/**
* Create a new {@link Pearson} from the given {@link Double} vectors.
* <p>
* This method assumes that elements are matched between the input vectors by index. For example, the first element
* of the iterator of {@code a} will be matched to the first element of the iterator of {@code b}. As a result,
* the input {@link Iterable iterables} also need to have deterministic {@link Iterator iterators}.
*
* @param a the one vector
* @param b the other vector
* @throws NullPointerException if either {@code a} or {@code b} is {@code null}
* @throws NullPointerException if any element inside {@code a} or {@code b} is {@code null}
* @throws IllegalArgumentException if either {@code a} or {@code b} is empty
* @throws IllegalArgumentException if {@code a} and {@code b} are of different size
*/
public Pearson(Iterable<Double> a, Iterable<Double> b) {
if (!a.iterator().hasNext() || !b.iterator().hasNext()) {
throw new IllegalArgumentException("Inputs cannot be empty");
}
int aSize = 0;
double averageA = 0;
int bSize = 0;
double averageB = 0;
for (Double x : a) {
aSize++;
averageA += x;
}
for (Double x : b) {
bSize++;
averageB += x;
}
averageA /= aSize;
averageB /= bSize;
double cov = 0;
double varA = 0;
double varB = 0;
final Iterator<Double> aIterator = a.iterator();
final Iterator<Double> bIterator = b.iterator();
while (aIterator.hasNext() && bIterator.hasNext()) {
final Double aNext = aIterator.next() - averageA;
final Double bNext = bIterator.next() - averageB;
cov += aNext * bNext;
varA += Math.pow(aNext, 2);
varB += Math.pow(bNext, 2);
}
if (aIterator.hasNext() || bIterator.hasNext()) {
throw new IllegalArgumentException("Inputs must have the same size");
}
cov /= aSize;
varA /= aSize;
varB /= bSize;
varA = Math.sqrt(varA);
varB = Math.sqrt(varB);
this.value = cov / (varA * varB);
assert this.value >= -1 && this.value <= 1;
}
/**
* Create a new {@link Pearson} from the given {@link Double} iterators.
* <p>
* This method assumes that elements are matched between the input vectors by index. For example, the first element
* of the {@code a} iterator will be matched to the first element of the {@code b} iterator.
* <p>
* This method is executed in a single pass using the formula in the Wikipedia article but can sometimes be
* numerically unstable.
*
* @param a the one iterator
* @param b the other iterator
* @throws NullPointerException if either {@code a} or {@code b} is {@code null}
* @throws NullPointerException if any element inside {@code a} or {@code b} is {@code null}
* @throws IllegalArgumentException if either {@code a} or {@code b} is empty
* @throws IllegalArgumentException if {@code a} and {@code b} are of different size
*/
public Pearson(Iterator<Double> a, Iterator<Double> b) {
if (!a.hasNext() || !b.hasNext()) {
throw new IllegalArgumentException("Inputs cannot be empty");
}
int n = 0;
double aSum = 0;
double bSum = 0;
double aSquaredSum = 0;
double bSquaredSum = 0;
double productSum = 0;
while (a.hasNext() && b.hasNext()) {
final double aNext = a.next();
final double bNext = b.next();
n++;
aSum += aNext;
bSum += bNext;
aSquaredSum += aNext * aNext;
bSquaredSum += bNext * bNext;
productSum += aNext * bNext;
}
if (a.hasNext() || b.hasNext()) {
throw new IllegalArgumentException("Inputs must have the same size");
}
this.value = (n * productSum - aSum * bSum) / (Math.sqrt(n * aSquaredSum - aSum * aSum) * Math.sqrt(n * bSquaredSum - bSum * bSum));
assert this.value >= -1 && this.value <= 1;
}
/**
* Create a new {@link Pearson} from the given arguments.
*
* @param population the population set
* @param mapping1 a function representing one input
* @param mapping2 a function representing one input
* @param <T> the type of elements in the inputs
* @throws NullPointerException if any input is {@code null}
* @throws NullPointerException if any value returned from either {@code mapping1} or {@code mapping2} is
* {@code null}
* @throws IllegalArgumentException if {@code population} is empty
* @throws IllegalArgumentException if some property of {@code mapping1} or {@code mapping2} prevents their average
* values to be computed
* @throws RuntimeException as propagated from the {@link ToDoubleFunction#applyAsDouble(Object)} method
*/
public <T> Pearson(Set<T> population, ToDoubleFunction<T> mapping1, ToDoubleFunction<T> mapping2) {
if (population.isEmpty()) {
throw new IllegalArgumentException("Inputs cannot be empty");
}
final double averageA = population.stream().mapToDouble(mapping1).average()
.orElseThrow(() -> new IllegalArgumentException("Can't get the average of a"));
final double averageB = population.stream().mapToDouble(mapping2).average()
.orElseThrow(() -> new IllegalArgumentException("Can't get the average of b"));
double cov = 0;
double varA = 0;
double varB = 0;
for (T t : population) {
cov += (mapping1.applyAsDouble(t) - averageA) * (mapping2.applyAsDouble(t) - averageB);
varA += Math.pow(mapping1.applyAsDouble(t) - averageA, 2);
varB += Math.pow(mapping2.applyAsDouble(t) - averageB, 2);
}
cov /= population.size();
varA /= population.size();
varB /= population.size();
varA = Math.sqrt(varA);
varB = Math.sqrt(varB);
this.value = cov / (varA * varB);
assert this.value >= -1 && this.value <= 1;
}
/**
* Returns the Pearson correlation coefficient of the inputs that this instance was created from.
*
* @return the Pearson correlation coefficient of the inputs that this instance was created from
*/
public double value() {
return this.value;
}
}
| [
"gstamatelat@gmail.com"
] | gstamatelat@gmail.com |
e66d383d8b4a0d713e091ccb944a794f99556d06 | 7c73620f5725782a64676b89e4dee518d1aa2e39 | /src/test/java/com/viridis/management/config/timezone/HibernateTimeZoneIT.java | bbd21231217f6416a85d7ea3fcdd24801caeda37 | [] | no_license | duduhbsilva/viridis-exercise | 89214e9b91a9d1a4f5a5ad49d35bc8dcace68803 | 93d62f9443bdc6118f51b0e0ca4cc8c559539ad3 | refs/heads/master | 2022-12-20T17:15:18.860842 | 2019-12-10T06:11:42 | 2019-12-10T06:11:42 | 227,034,871 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,874 | java | package com.viridis.management.config.timezone;
import com.viridis.management.ManagementApp;
import com.viridis.management.repository.timezone.DateTimeWrapper;
import com.viridis.management.repository.timezone.DateTimeWrapperRepository;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.rowset.SqlRowSet;
import org.springframework.transaction.annotation.Transactional;
import java.time.*;
import java.time.format.DateTimeFormatter;
import static java.lang.String.format;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Integration tests for the UTC Hibernate configuration.
*/
@SpringBootTest(classes = ManagementApp.class)
public class HibernateTimeZoneIT {
@Autowired
private DateTimeWrapperRepository dateTimeWrapperRepository;
@Autowired
private JdbcTemplate jdbcTemplate;
private DateTimeWrapper dateTimeWrapper;
private DateTimeFormatter dateTimeFormatter;
private DateTimeFormatter timeFormatter;
private DateTimeFormatter dateFormatter;
@BeforeEach
public void setup() {
dateTimeWrapper = new DateTimeWrapper();
dateTimeWrapper.setInstant(Instant.parse("2014-11-12T05:50:00.0Z"));
dateTimeWrapper.setLocalDateTime(LocalDateTime.parse("2014-11-12T07:50:00.0"));
dateTimeWrapper.setOffsetDateTime(OffsetDateTime.parse("2011-12-14T08:30:00.0Z"));
dateTimeWrapper.setZonedDateTime(ZonedDateTime.parse("2011-12-14T08:30:00.0Z"));
dateTimeWrapper.setLocalTime(LocalTime.parse("14:30:00"));
dateTimeWrapper.setOffsetTime(OffsetTime.parse("14:30:00+02:00"));
dateTimeWrapper.setLocalDate(LocalDate.parse("2016-09-10"));
dateTimeFormatter = DateTimeFormatter
.ofPattern("yyyy-MM-dd HH:mm:ss.S")
.withZone(ZoneId.of("UTC"));
timeFormatter = DateTimeFormatter
.ofPattern("HH:mm:ss")
.withZone(ZoneId.of("UTC"));
dateFormatter = DateTimeFormatter
.ofPattern("yyyy-MM-dd");
}
@Test
@Transactional
public void storeInstantWithUtcConfigShouldBeStoredOnGMTTimeZone() {
dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
String request = generateSqlRequest("instant", dateTimeWrapper.getId());
SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
String expectedValue = dateTimeFormatter.format(dateTimeWrapper.getInstant());
assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
}
@Test
@Transactional
public void storeLocalDateTimeWithUtcConfigShouldBeStoredOnGMTTimeZone() {
dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
String request = generateSqlRequest("local_date_time", dateTimeWrapper.getId());
SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
String expectedValue = dateTimeWrapper
.getLocalDateTime()
.atZone(ZoneId.systemDefault())
.format(dateTimeFormatter);
assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
}
@Test
@Transactional
public void storeOffsetDateTimeWithUtcConfigShouldBeStoredOnGMTTimeZone() {
dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
String request = generateSqlRequest("offset_date_time", dateTimeWrapper.getId());
SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
String expectedValue = dateTimeWrapper
.getOffsetDateTime()
.format(dateTimeFormatter);
assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
}
@Test
@Transactional
public void storeZoneDateTimeWithUtcConfigShouldBeStoredOnGMTTimeZone() {
dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
String request = generateSqlRequest("zoned_date_time", dateTimeWrapper.getId());
SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
String expectedValue = dateTimeWrapper
.getZonedDateTime()
.format(dateTimeFormatter);
assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
}
@Test
@Transactional
public void storeLocalTimeWithUtcConfigShouldBeStoredOnGMTTimeZoneAccordingToHis1stJan1970Value() {
dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
String request = generateSqlRequest("local_time", dateTimeWrapper.getId());
SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
String expectedValue = dateTimeWrapper
.getLocalTime()
.atDate(LocalDate.of(1970, Month.JANUARY, 1))
.atZone(ZoneId.systemDefault())
.format(timeFormatter);
assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
}
@Test
@Transactional
public void storeOffsetTimeWithUtcConfigShouldBeStoredOnGMTTimeZoneAccordingToHis1stJan1970Value() {
dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
String request = generateSqlRequest("offset_time", dateTimeWrapper.getId());
SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
String expectedValue = dateTimeWrapper
.getOffsetTime()
.toLocalTime()
.atDate(LocalDate.of(1970, Month.JANUARY, 1))
.atZone(ZoneId.systemDefault())
.format(timeFormatter);
assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
}
@Test
@Transactional
public void storeLocalDateWithUtcConfigShouldBeStoredWithoutTransformation() {
dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
String request = generateSqlRequest("local_date", dateTimeWrapper.getId());
SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
String expectedValue = dateTimeWrapper
.getLocalDate()
.format(dateFormatter);
assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
}
private String generateSqlRequest(String fieldName, long id) {
return format("SELECT %s FROM jhi_date_time_wrapper where id=%d", fieldName, id);
}
private void assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(SqlRowSet sqlRowSet, String expectedValue) {
while (sqlRowSet.next()) {
String dbValue = sqlRowSet.getString(1);
assertThat(dbValue).isNotNull();
assertThat(dbValue).isEqualTo(expectedValue);
}
}
}
| [
"eduardo.h.silva@accenture.com"
] | eduardo.h.silva@accenture.com |
3f15fdfbe084fcf698a458e621c49f6c971be1b6 | 51c2a501abfdfc22b6ea1cda2328cc5310b16767 | /src/main/java/com/alibaba/druid/pool/DruidDataSourceStatLoggerImpl.java | fff2b122e85f60524b1ce879384d0bc62d316964 | [
"Apache-2.0"
] | permissive | dazen/druid | 1e34bf07cb7a61122a4acf2da241860900878444 | 183572a9d330810dacabc9c729d8f666a6a67a93 | refs/heads/master | 2021-01-18T10:22:50.911316 | 2015-08-05T08:32:47 | 2015-08-05T08:32:47 | 40,251,980 | 1 | 0 | null | 2015-08-05T15:04:33 | 2015-08-05T15:04:33 | null | UTF-8 | Java | false | false | 8,586 | java | /*
* Copyright 1999-2011 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.druid.pool;
import static com.alibaba.druid.util.JdbcSqlStatUtils.rtrim;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Properties;
import com.alibaba.druid.stat.JdbcSqlStatValue;
import com.alibaba.druid.support.json.JSONUtils;
import com.alibaba.druid.support.logging.Log;
import com.alibaba.druid.support.logging.LogFactory;
/**
* @author wenshao<szujobs@hotmail.com>
* @since 0.2.19
*/
public class DruidDataSourceStatLoggerImpl extends DruidDataSourceStatLoggerAdapter {
private static Log LOG = LogFactory.getLog(DruidDataSourceStatLoggerImpl.class);
private Log logger = LOG;
public DruidDataSourceStatLoggerImpl(){
this.configFromProperties(System.getProperties());
}
/**
* @since 0.2.21
*/
@Override
public void configFromProperties(Properties properties) {
String property = properties.getProperty("druid.stat.loggerName");
if (property != null && property.length() > 0) {
setLoggerName(property);
}
}
public Log getLogger() {
return logger;
}
@Override
public void setLoggerName(String loggerName) {
logger = LogFactory.getLog(loggerName);
}
@Override
public void setLogger(Log logger) {
if (logger == null) {
throw new IllegalArgumentException("logger can not be null");
}
this.logger = logger;
}
public boolean isLogEnable() {
return logger.isInfoEnabled();
}
public void log(String value) {
logger.info(value);
}
@Override
public void log(DruidDataSourceStatValue statValue) {
if (!isLogEnable()) {
return;
}
Map<String, Object> map = new LinkedHashMap<String, Object>();
map.put("url", statValue.url);
map.put("dbType", statValue.getDbType());
map.put("name", statValue.getName());
map.put("activeCount", statValue.getActiveCount());
if (statValue.getActivePeak() > 0) {
map.put("activePeak", statValue.getActivePeak());
map.put("activePeakTime", statValue.getActivePeakTime());
}
map.put("poolingCount", statValue.getPoolingCount());
if (statValue.getPoolingPeak() > 0) {
map.put("poolingPeak", statValue.getPoolingPeak());
map.put("poolingPeakTime", statValue.getPoolingPeakTime());
}
map.put("connectCount", statValue.getConnectCount());
map.put("closeCount", statValue.getCloseCount());
if (statValue.getWaitThreadCount() > 0) {
map.put("waitThreadCount", statValue.getWaitThreadCount());
}
if (statValue.getNotEmptyWaitCount() > 0) {
map.put("notEmptyWaitCount", statValue.getNotEmptyWaitCount());
}
if (statValue.getNotEmptyWaitMillis() > 0) {
map.put("notEmptyWaitMillis", statValue.getNotEmptyWaitMillis());
}
if (statValue.getLogicConnectErrorCount() > 0) {
map.put("logicConnectErrorCount", statValue.getLogicConnectErrorCount());
}
if (statValue.getPhysicalConnectCount() > 0) {
map.put("physicalConnectCount", statValue.getPhysicalConnectCount());
}
if (statValue.getPhysicalCloseCount() > 0) {
map.put("physicalCloseCount", statValue.getPhysicalCloseCount());
}
if (statValue.getPhysicalConnectErrorCount() > 0) {
map.put("physicalConnectErrorCount", statValue.getPhysicalConnectErrorCount());
}
if (statValue.getExecuteCount() > 0) {
map.put("executeCount", statValue.getExecuteCount());
}
if (statValue.getErrorCount() > 0) {
map.put("errorCount", statValue.getErrorCount());
}
if (statValue.getCommitCount() > 0) {
map.put("commitCount", statValue.getCommitCount());
}
if (statValue.getRollbackCount() > 0) {
map.put("rollbackCount", statValue.getRollbackCount());
}
if (statValue.getPstmtCacheHitCount() > 0) {
map.put("pstmtCacheHitCount", statValue.getPstmtCacheHitCount());
}
if (statValue.getPstmtCacheMissCount() > 0) {
map.put("pstmtCacheMissCount", statValue.getPstmtCacheMissCount());
}
if (statValue.getStartTransactionCount() > 0) {
map.put("startTransactionCount", statValue.getStartTransactionCount());
map.put("transactionHistogram", rtrim(statValue.getTransactionHistogram()));
}
if (statValue.getConnectCount() > 0) {
map.put("connectionHoldTimeHistogram", rtrim(statValue.getConnectionHoldTimeHistogram()));
}
if (statValue.getClobOpenCount() > 0) {
map.put("clobOpenCount", statValue.getClobOpenCount());
}
if (statValue.getBlobOpenCount() > 0) {
map.put("blobOpenCount", statValue.getBlobOpenCount());
}
if (statValue.getSqlSkipCount() > 0) {
map.put("sqlSkipCount", statValue.getSqlSkipCount());
}
ArrayList<Map<String, Object>> sqlList = new ArrayList<Map<String, Object>>();
if (statValue.sqlList.size() > 0) {
for (JdbcSqlStatValue sqlStat : statValue.getSqlList()) {
Map<String, Object> sqlStatMap = new LinkedHashMap<String, Object>();
sqlStatMap.put("sql", sqlStat.getSql());
if (sqlStat.getExecuteCount() > 0) {
sqlStatMap.put("executeCount", sqlStat.getExecuteCount());
sqlStatMap.put("executeMillisMax", sqlStat.getExecuteMillisMax());
sqlStatMap.put("executeMillisTotal", sqlStat.getExecuteMillisTotal());
sqlStatMap.put("executeHistogram", rtrim(sqlStat.getExecuteHistogram()));
sqlStatMap.put("executeAndResultHoldHistogram", rtrim(sqlStat.getExecuteAndResultHoldHistogram()));
}
long executeErrorCount = sqlStat.getExecuteErrorCount();
if (executeErrorCount > 0) {
sqlStatMap.put("executeErrorCount", executeErrorCount);
}
int runningCount = sqlStat.getRunningCount();
if (runningCount > 0) {
sqlStatMap.put("runningCount", runningCount);
}
int concurrentMax = sqlStat.getConcurrentMax();
if (concurrentMax > 0) {
sqlStatMap.put("concurrentMax", concurrentMax);
}
if (sqlStat.getFetchRowCount() > 0) {
sqlStatMap.put("fetchRowCount", sqlStat.getFetchRowCount());
sqlStatMap.put("fetchRowCount", sqlStat.getFetchRowCountMax());
sqlStatMap.put("fetchRowHistogram", rtrim(sqlStat.getFetchRowHistogram()));
}
if (sqlStat.getUpdateCount() > 0) {
sqlStatMap.put("updateCount", sqlStat.getUpdateCount());
sqlStatMap.put("updateCountMax", sqlStat.getUpdateCountMax());
sqlStatMap.put("updateHistogram", rtrim(sqlStat.getUpdateHistogram()));
}
if (sqlStat.getInTransactionCount() > 0) {
sqlStatMap.put("inTransactionCount", sqlStat.getInTransactionCount());
}
if (sqlStat.getClobOpenCount() > 0) {
sqlStatMap.put("clobOpenCount", sqlStat.getClobOpenCount());
}
if (sqlStat.getBlobOpenCount() > 0) {
sqlStatMap.put("blobOpenCount", sqlStat.getBlobOpenCount());
}
sqlList.add(sqlStatMap);
}
map.put("sqlList", sqlList);
}
String text = JSONUtils.toJSONString(map);
log(text);
}
}
| [
"szujobs@hotmail.com"
] | szujobs@hotmail.com |
f4db8ea5f6d900bcffe65df5f7e00cff9382f8fb | d2b5541494604fa489a8f16750591181e85a4ff5 | /src/main/java/com/zhch/paysvc/core/config/MybatisPlusConfiguration.java | 1a134c8a5681a6fe795f3dea40477207799d6b00 | [] | no_license | xingchenyefeng/pay-svc | e29db7966369fc7962c5d511ed101ed444d750e2 | f146e3c45b55cf6a7ca1aa97e084c2accf416dc6 | refs/heads/main | 2023-03-16T13:24:15.106232 | 2021-03-17T01:33:25 | 2021-03-17T01:33:25 | 310,468,427 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 928 | java | package com.zhch.paysvc.core.config;
import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* @author luoxiaoming
*/
@EnableTransactionManagement
@ConditionalOnClass(MybatisPlusAutoConfiguration.class)
@Configuration
@MapperScan("com.zhch.**.mapper*")
public class MybatisPlusConfiguration {
/**
* mybatis-plus分页插件<br>
* 文档:http://mp.baomidou.com<br>
*/
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
}
| [
"xingchenyefeng@qq.com"
] | xingchenyefeng@qq.com |
546d702b3bb8ab7deba474e0b6b3e09c3174c999 | 893a4fe6c116e729c93b40a49d23afa5755bb067 | /app/src/main/java/helloworld/Main.java | 48034df26c4b2a84d3643c6619220b015326f3b9 | [
"MIT"
] | permissive | wellingtoncosta/hello-world-annotation-processing | 0b5a169c92b6cb6a55d1d6e8e7c91a9efbf0de7b | 5be30b8ea607a417f6bb89ef757101d638ea297c | refs/heads/master | 2020-03-22T18:03:07.396981 | 2018-07-10T17:21:58 | 2018-07-10T17:21:58 | 140,433,582 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 228 | java | package helloworld;
import helloworld.processing.HelloWorld;
/**
* @author Wellington Costa on 10/07/18.
*/
@HelloWorld
public class Main {
public static void main(String[] args) {
new MainHelloWorld();
}
} | [
"wellington.costa128@gmail.com"
] | wellington.costa128@gmail.com |
c1908aec9f6f7008103ba86474e3735048fc19e7 | 43fa4afc1f176eba1b5077116bcd57bb6291f9f9 | /app/src/main/java/com/dinghao/rowetalk2/util/Constant.java | c60d6ee21d7c714968b560eaa98c123a705c8100 | [] | no_license | likainian/RoweTalk2 | 1ca63bbbc841a96c890f1d40ca5a51bc794e79d7 | a8efc446c88fe8551c4bc8c8382f9272a5ec2f68 | refs/heads/master | 2021-01-11T17:54:57.798996 | 2017-01-24T02:47:42 | 2017-01-24T02:47:42 | 79,868,789 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,398 | java | package com.dinghao.rowetalk2.util;
import android.os.Environment;
public class Constant {
public static final String TY_TAKE_SCREEN_SHOT = "com.ty.intent.take_screen_shot"; //hongbiao.zhang@2016.5.18: add
private static final String SERVER_RELEASE = "http://120.26.129.37:8060"; //"http://192.168.199.100:8060";
private static final String SERVER_TEST = "http://192.168.2.100:8060"; //"http://192.168.199.100:8060";
private static String SERVER_HOST = SERVER_TEST;
public static final String FTP_SERVER = "192.168.2.100";
public static final String FTP_USER = "tyftp";
public static final String FTP_PASSWORD = "ty#edc4f";
public static int SERVER_MINIMUM_API = 1;
public static String getSERVER_HOST() {
return SERVER_HOST;
}
public static String getSERVER_TEST() {
return SERVER_TEST;
}
public static String getSERVER_RELEASE() {
return SERVER_RELEASE;
}
public static void setSERVER_HOST(String sERVER_HOST) {
SERVER_HOST = sERVER_HOST;
}
public static String getURL_TEST_CONNECT() {
return getSERVER_HOST()+"/misc/test";
}
public static String getURL_REGISTER_PHONE() {
return getSERVER_HOST()+"/phone/register";
}
public static String getURL_REGISTER_DEVICE() {
return getSERVER_HOST()+"/device/register";
}
public static String getURL_TASK_ALLOC() {
return getSERVER_HOST()+"/task/alloc";
}
public static String getURL_TASK_REPORT() {
return getSERVER_HOST()+"/task/report";
}
public static String getURL_SEND_IP() {
return getSERVER_HOST()+"/task/send_ip";
}
public static String getURL_DOWNLOAD_TASK_SCRIPT() {
return getSERVER_HOST()+"/common/download/script";
}
public static String getURL_DOWNLOAD_TASK_EXTRA() {
return getSERVER_HOST()+"/common/download/extra_zip";
}
public static String getURL_DOWNLOAD_TASK_APK() {
return getSERVER_HOST()+"/common/download/apk";
}
public static String getURL_DOWNLOAD_SHOT_DATA() {
return getSERVER_HOST()+"/common/download/shot_data";
}
public static String getURL_QUERY_NUMBER() {
return getSERVER_HOST()+"/misc/get_number";
}
public static String getTaskStoragePath() {
return Environment.getExternalStorageDirectory().getAbsolutePath()+"/rowetalk/task";
}
public static String getTempStoragePath() {
return Environment.getExternalStorageDirectory().getAbsolutePath()+"/rowetalk/tmp";
}
public static String getScriptPath() {
return Environment.getExternalStorageDirectory().getAbsolutePath()+"/myScripts";
}
public static String getTaskScriptPath() {
return getScriptPath()+"/task";
}
public static String getURL_UPDATE_CHECK_VERSION() {
return getSERVER_HOST()+"/update/check_version";
}
public static String getURL_DOWNLOAD_APP_VERSION() {
return getSERVER_HOST()+"/common/download/update_app";
}
public static String getURL_SEND_CRASH_LOG() {
return getSERVER_HOST()+"/misc/send_crashlog";
}
public static String getURL_GET_SIM_SLOT() {
return getSERVER_HOST()+"/misc/get_simslot";
}
public static String getURL_UPDATE_SIM_SLOT() {
return getSERVER_HOST()+"/misc/update_simslot";
}
public static String getURL_UPDATE_SIM_RECENT_STATUS() {
return getSERVER_HOST()+"/misc/update_sim_recent_status";
}
public static String getURL_ALLOC_VPN() {
return getSERVER_HOST()+"/vpn/alloc_vpn";
}
public static String getURL_FREE_VPN() {
return getSERVER_HOST()+"/vpn/free_vpn";
}
public static String getURL_TEST_VPN_CONNECT() {
return getSERVER_HOST()+"/vpn/test_connect";
}
public static String getURL_REPORT_VPN_FAILED() {
return getSERVER_HOST()+"/vpn/notify_failed";
}
public static String getURL_APP_GET_DATA() {
return getSERVER_HOST()+"/account/getwebdata";
}
public static String getURL_APP_SUBMIT_DATA() {
return getSERVER_HOST()+"/account/sumitwebdata";
}
public static String getURL_GET_TASk() {
return getSERVER_HOST()+"/task/get_task";
}
public static String getURL_GET_MY_IP() {
return getSERVER_RELEASE()+"/misc/get_my_ip";
}
public static String getURL_RANDOM_WORD() {
return getSERVER_HOST()+"/misc/rand_word";
}
public static String getURL_RANDOM_PLATFORM() {
return getSERVER_HOST()+"/misc/rand_platform";
}
public static String getURL_SYSTEM_CHECK_VERSION() {
return getSERVER_HOST()+"/system_update/check_version";
}
public static String getURL_SYSTEM_DOWNLOAD_VERSION() {
return getSERVER_HOST()+"/common/download/system_update";
}
}
| [
"m0_37331904nomail@code.csdn.net"
] | m0_37331904nomail@code.csdn.net |
7d0eced81c2f51e9ec629558f12caa32dc78c79e | 2ac6543b1560723047c0524404b758c576181676 | /week-07/day-01/src/main/java/com/greenfoxacademy/demo/GreetingController.java | a5e6267970b0c7292645298ff9354504a9a5fe0c | [] | no_license | AndrasMadiSzabo/madiszaboa | 07109036f151cfba0f96ff9433693f1ac4516cea | ef38160b679881fee35a967bc70a5610c9fd599a | refs/heads/master | 2022-04-26T07:16:08.502945 | 2020-04-30T07:53:10 | 2020-04-30T07:53:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 958 | java | package com.greenfoxacademy.demo;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class GreetingController {
@GetMapping("/greeting")
public String greeting(@RequestParam(name = "name", required = false, defaultValue = "World")
String name, Model model) {
model.addAttribute("thisIsTheHtmlReference", name);
return "greeting";
}
@RequestMapping(value = "/ex/foos", method = GET)
@ResponseBody
public String postFoos() {
return "Post some Foos";
}
}
| [
"madiszabo@gmail.com"
] | madiszabo@gmail.com |
7607c307ddf262ca8ab8e62a638d638500373c61 | c9c7f360c4fbe72777bf89e4790cd03d2886b722 | /src/main/java/com/sandipan/rest/restfulwebservices/dao/UserDAO.java | 99c68e223779b6596d8a87c24ca288b7f7199299 | [] | no_license | smartsandi98/userSevices-rest | ec90b44c0bfe0ecbc302b01ac53f4ca2bc8be08e | 0c412d08765be2b7dadc1e944f6f145c4ab4f9f2 | refs/heads/master | 2023-06-07T10:17:52.977897 | 2021-07-13T18:19:00 | 2021-07-13T18:19:00 | 385,695,776 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,314 | java | package com.sandipan.rest.restfulwebservices.dao;
import com.sandipan.rest.restfulwebservices.model.User;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
@Component
public class UserDAO {
private static final List<User> users = new ArrayList<>();
private static int usersCount = 3;
static {
users.add(new User(1, "Adam", new Date()));
users.add(new User(2, "Eve", new Date()));
users.add(new User(3, "Jack", new Date()));
}
public List<User> findAll() {
return users;
}
public User save(User user) {
if (user.getId() == null) {
user.setId(++usersCount);
}
users.add(user);
return user;
}
public User findOne(int id) {
for (User user : users) {
if (user.getId() == id) {
return user;
}
}
return null;
}
public User deleteById(int id) {
Iterator<User> iterator = users.iterator();
while (iterator.hasNext()) {
User user = iterator.next();
if (user.getId() == id) {
iterator.remove();
return user;
}
}
return null;
}
}
| [
"basusandipan0@gmail.com"
] | basusandipan0@gmail.com |
62bf206c353c975016cf5068f15dbc047ec72984 | 820ee13eeb6bf6163cde1b0c5f087dd62ae69434 | /src/main/java/co/edu/unicauca/distribuidos/core/repositories/conexion/ConexionBD.java | 014af7492ae0efe73636c40e0b71a5864766a6d2 | [] | no_license | danielp111/CRUD_ANGULAR_SPRING_BACKEND | b088f7cda973854f2ec3ec3eb9079cedcf6b5d8b | c05707b62dddebf2f78159790aa914c68c8d869b | refs/heads/master | 2023-02-06T07:59:01.298975 | 2020-12-18T22:15:11 | 2020-12-18T22:15:11 | 314,722,651 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,921 | java | /**
* Utiliza la API JDBC de java para conectarse a una base de datos MySQL
* -----------------------------------------------------------------
*/
package co.edu.unicauca.distribuidos.core.repositories.conexion;
import java.sql.*;
/**
* Esta clase permite que las Clases tipo Entidad tengan persistencia
* por medio de una base de datos relacional
*/
public class ConexionBD {
private Connection objConexionBaseDatos;
private String nombreBaseDatos;
private String login;
private String password;
private String url;
public ConexionBD() {
objConexionBaseDatos=null;
nombreBaseDatos="empresa";
login="root";
password="root";
url = "jdbc:mysql://localhost/"+nombreBaseDatos+"?serverTimezone=UTC";
}
/**Permite hacer la conexion con la base de datos
*/
public int conectar(){
int bandera=-1;
try{
Class.forName("com.mysql.cj.jdbc.Driver").newInstance();
//crea una instancia de la controlador de la base de datos
objConexionBaseDatos = DriverManager.getConnection(url,login,password);
// gnera una conexión con la base de datos
bandera=1;
}
catch(SQLException e){
System.out.println("Error: " + e.getMessage());
}
catch(Exception e){
System.out.println("Error: " + e.getMessage());
}
return bandera;
}
/**Cierra la conexion con la base de datos
*
*/
public void desconectar(){
try{
objConexionBaseDatos.close();
}
catch(Exception e){
System.out.println("Error " + e.getMessage());
}
}
/**Retorna un objeto que almacena la referencia a la conexion con la base de datos
*
*/
public Connection getConnection(){
return objConexionBaseDatos;
}
}
| [
"danielp@unicauca.edu.co"
] | danielp@unicauca.edu.co |
99aff8f5de7920d2db66c24a81e2ad352f3e3777 | 3cd9ed38e6e5e5f0e6992fe470bfb66357670845 | /src/main/java/com/xife/springboot_102/HomeController.java | 1bd4fe8ab2f5b61f9ee2183ee19af3aed880daac | [] | no_license | AdeBoi/SpringBoot_102 | 4576ef594f308589a33af3faaf89d4de7e0bb96d | 2baabfe054168b46edfaeefa2dbf8b3918346c0a | refs/heads/master | 2020-05-04T04:47:51.406987 | 2019-04-02T01:21:07 | 2019-04-02T01:21:07 | 178,974,147 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package com.xife.springboot_102;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class HomeController
{
@RequestMapping("/")
public String homePage(Model model)
{
model.addAttribute("myvar", "Say Hi.");
return "hometemplate";
}
}
| [
"adebotheentertainer@gmail.com"
] | adebotheentertainer@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.