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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c5696f0141921ae73b99db9b0e62144d4f7d5878
|
2def3739dfa0f1fb6219e6898216f5d5a2f8ecec
|
/Rental Motor FTI/src/controler/koneksi.java
|
741e92cadd84a74fc3207bd94de43acd4b7a230c
|
[] |
no_license
|
andreanrichardo/andreanrichardo-Motorcycle-Rental-using-Java-Programming-Language
|
3f49a360aac15660bb8bce13e2d5bab87c362222
|
dc3e487dd012837a9acb9e85d9ec77e2f8c6d43d
|
refs/heads/master
| 2022-11-18T23:36:23.494409 | 2020-07-19T17:09:31 | 2020-07-19T17:09:31 | 280,907,364 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 872 |
java
|
package controler;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class koneksi {
public String driver = "com.mysql.jdbc.Driver";
public String url = "jdbc:mysql://localhost/db_rentalmotor";
public String username = "root";
public String password = "";
public Connection con;
public koneksi() {
try {
Class.forName(driver);
con = DriverManager.getConnection(url, username, password);
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
} catch (SQLException ex) {
ex.printStackTrace();
}
}
public Connection getConnection() {
return con;
}
public static void main(String[] args) {
System.out.println(new koneksi().getConnection());
}
}
|
[
"[email protected]"
] | |
94971670d77be708a74f3fc2456ae392ef4e276e
|
b28305dab0be0e03765c62b97bcd7f49a4f8073d
|
/chrome/android/java/src/org/chromium/chrome/browser/explore_sites/ExploreSitesPage.java
|
2cca74c72e1e2005fad15621cca9fccf25c9c0e1
|
[
"BSD-3-Clause"
] |
permissive
|
svarvel/browser-android-tabs
|
9e5e27e0a6e302a12fe784ca06123e5ce090ced5
|
bd198b4c7a1aca2f3e91f33005d881f42a8d0c3f
|
refs/heads/base-72.0.3626.105
| 2020-04-24T12:16:31.442851 | 2019-08-02T19:15:36 | 2019-08-02T19:15:36 | 171,950,555 | 1 | 2 |
NOASSERTION
| 2019-08-02T19:15:37 | 2019-02-21T21:47:44 | null |
UTF-8
|
Java
| false | false | 13,148 |
java
|
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.explore_sites;
import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.IntDef;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.Base64;
import android.view.View;
import android.view.ViewGroup;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.metrics.RecordUserAction;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.UrlConstants;
import org.chromium.chrome.browser.modelutil.ListModel;
import org.chromium.chrome.browser.modelutil.PropertyModel;
import org.chromium.chrome.browser.modelutil.RecyclerViewAdapter;
import org.chromium.chrome.browser.native_page.BasicNativePage;
import org.chromium.chrome.browser.native_page.ContextMenuManager;
import org.chromium.chrome.browser.native_page.NativePageHost;
import org.chromium.chrome.browser.native_page.NativePageNavigationDelegateImpl;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.tab.EmptyTabObserver;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabObserver;
import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.widget.RoundedIconGenerator;
import org.chromium.content_public.browser.NavigationController;
import org.chromium.content_public.browser.NavigationEntry;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
/**
* Provides functionality when the user interacts with the explore sites page.
*/
public class ExploreSitesPage extends BasicNativePage {
private static final String TAG = "ExploreSitesPage";
private static final String CONTEXT_MENU_USER_ACTION_PREFIX = "ExploreSites";
private static final int INITIAL_SCROLL_POSITION = 3;
private static final String NAVIGATION_ENTRY_SCROLL_POSITION_KEY =
"ExploreSitesPageScrollPosition";
static final PropertyModel.WritableIntPropertyKey STATUS_KEY =
new PropertyModel.WritableIntPropertyKey();
static final PropertyModel.WritableIntPropertyKey SCROLL_TO_CATEGORY_KEY =
new PropertyModel.WritableIntPropertyKey();
static final PropertyModel
.ReadableObjectPropertyKey<ListModel<ExploreSitesCategory>> CATEGORY_LIST_KEY =
new PropertyModel.ReadableObjectPropertyKey<>();
@IntDef({CatalogLoadingState.LOADING, CatalogLoadingState.SUCCESS, CatalogLoadingState.ERROR})
@Retention(RetentionPolicy.SOURCE)
public @interface CatalogLoadingState {
int LOADING = 1; // Loading catalog info from disk.
int SUCCESS = 2;
int ERROR = 3; // Error retrieving catalog resources from internet.
int LOADING_NET = 4; // Retrieving catalog resources from internet.
}
private TabModelSelector mTabModelSelector;
private NativePageHost mHost;
private Tab mTab;
private TabObserver mTabObserver;
private Profile mProfile;
private ViewGroup mView;
private RecyclerView mRecyclerView;
private LinearLayoutManager mLayoutManager;
private String mTitle;
private PropertyModel mModel;
private ContextMenuManager mContextMenuManager;
private String mNavFragment;
private boolean mHasFetchedNetworkCatalog;
private boolean mIsLoaded;
/**
* Create a new instance of the explore sites page.
*/
public ExploreSitesPage(ChromeActivity activity, NativePageHost host) {
super(activity, host);
}
@Override
protected void initialize(ChromeActivity activity, final NativePageHost host) {
mHost = host;
mTab = mHost.getActiveTab();
mTabModelSelector = activity.getTabModelSelector();
mTitle = activity.getString(R.string.explore_sites_title);
mView = (ViewGroup) activity.getLayoutInflater().inflate(
R.layout.explore_sites_page_layout, null);
mProfile = mHost.getActiveTab().getProfile();
mHasFetchedNetworkCatalog = false;
mModel = new PropertyModel.Builder(STATUS_KEY, SCROLL_TO_CATEGORY_KEY, CATEGORY_LIST_KEY)
.with(CATEGORY_LIST_KEY, new ListModel<ExploreSitesCategory>())
.with(STATUS_KEY, CatalogLoadingState.LOADING)
.build();
Context context = mView.getContext();
mLayoutManager = new LinearLayoutManager(context);
int iconSizePx = context.getResources().getDimensionPixelSize(R.dimen.tile_view_icon_size);
RoundedIconGenerator iconGenerator = new RoundedIconGenerator(iconSizePx, iconSizePx,
iconSizePx / 2,
ApiCompatibilityUtils.getColor(
context.getResources(), R.color.default_favicon_background_color),
context.getResources().getDimensionPixelSize(R.dimen.tile_view_icon_text_size));
NativePageNavigationDelegateImpl navDelegate =
new NativePageNavigationDelegateImpl(activity, mProfile, host, mTabModelSelector);
// Don't direct reference activity because it might change if tab is reparented.
Runnable closeContextMenuCallback =
() -> host.getActiveTab().getActivity().closeContextMenu();
mContextMenuManager = new ContextMenuManager(navDelegate, this::setTouchEnabled,
closeContextMenuCallback, CONTEXT_MENU_USER_ACTION_PREFIX);
host.getActiveTab().getWindowAndroid().addContextMenuCloseListener(mContextMenuManager);
CategoryCardAdapter adapterDelegate = new CategoryCardAdapter(
mModel, mLayoutManager, iconGenerator, mContextMenuManager, navDelegate, mProfile);
mRecyclerView = (RecyclerView) mView.findViewById(R.id.explore_sites_category_recycler);
RecyclerViewAdapter<CategoryCardViewHolderFactory.CategoryCardViewHolder, Void> adapter =
new RecyclerViewAdapter<>(adapterDelegate, new CategoryCardViewHolderFactory());
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(adapter);
ExploreSitesBridge.getEspCatalog(mProfile, this::translateToModel);
RecordUserAction.record("Android.ExploreSitesPage.Open");
// TODO(chili): Set layout to be an observer of list model
}
void translateToModel(@Nullable List<ExploreSitesCategory> categoryList) {
// If list is null or we received an empty catalog from network, show error.
if (categoryList == null || (categoryList.isEmpty() && mHasFetchedNetworkCatalog)) {
onUpdatedCatalog(false);
return;
}
// If list is empty and we never fetched from network before, fetch from network.
if (categoryList.isEmpty()) {
mModel.set(STATUS_KEY, CatalogLoadingState.LOADING_NET);
mHasFetchedNetworkCatalog = true;
ExploreSitesBridge.updateCatalogFromNetwork(
mProfile, /* isImmediateFetch =*/true, this::onUpdatedCatalog);
return;
}
mModel.set(STATUS_KEY, CatalogLoadingState.SUCCESS);
ListModel<ExploreSitesCategory> categoryListModel = mModel.get(CATEGORY_LIST_KEY);
// Filter empty categories and categories with fewer sites originally than would fill a row.
for (ExploreSitesCategory category : categoryList) {
if ((category.getNumDisplayed() > 0) && (category.getMaxRows() > 0)) {
categoryListModel.add(category);
}
}
Parcelable savedScrollPosition = getLayoutManagerStateFromNavigationEntry();
if (savedScrollPosition != null) {
mLayoutManager.onRestoreInstanceState(savedScrollPosition);
} else if (mNavFragment != null) {
lookupCategoryAndScroll();
} else {
mModel.set(SCROLL_TO_CATEGORY_KEY,
Math.min(categoryListModel.size() - 1, INITIAL_SCROLL_POSITION));
}
if (mTab != null) {
// We want to observe page load start so that we can store the recycler view layout
// state, for making "back" work correctly.
mTabObserver = new EmptyTabObserver() {
@Override
public void onPageLoadStarted(Tab tab, String url) {
try {
URI uri = new URI(url);
if (UrlConstants.CHROME_NATIVE_SCHEME.equals(uri.getScheme())
&& UrlConstants.EXPLORE_HOST.equals(uri.getHost())) {
return;
}
saveLayoutManagerState();
} catch (URISyntaxException e) {
}
}
};
mTab.addObserver(mTabObserver);
}
mIsLoaded = true;
}
private void onUpdatedCatalog(Boolean hasFetchedCatalog) {
if (hasFetchedCatalog) {
ExploreSitesBridge.getEspCatalog(mProfile, this::translateToModel);
} else {
mModel.set(STATUS_KEY, CatalogLoadingState.ERROR);
mIsLoaded = true;
}
}
public boolean isLoadedForTests() {
return mIsLoaded;
}
@Override
public String getHost() {
return UrlConstants.EXPLORE_HOST;
}
@Override
public View getView() {
return mView;
}
@Override
public String getTitle() {
return mTitle;
}
@Override
public void updateForUrl(String url) {
super.updateForUrl(url);
try {
mNavFragment = new URI(url).getFragment();
} catch (URISyntaxException e) {
mNavFragment = null;
}
if (mModel.get(STATUS_KEY) == CatalogLoadingState.SUCCESS) {
lookupCategoryAndScroll();
}
}
/* Gets the state of layout manager as a marshalled Parcel that's Base64 Encoded. */
private String getLayoutManagerState() {
Parcelable layoutManagerState = mLayoutManager.onSaveInstanceState();
Parcel parcel = Parcel.obtain();
layoutManagerState.writeToParcel(parcel, 0);
String marshalledState = Base64.encodeToString(parcel.marshall(), 0);
parcel.recycle();
return marshalledState;
}
/* Saves the state of the layout manager in the NavigationEntry for the current tab. */
private void saveLayoutManagerState() {
if (mTab == null || mTab.getWebContents() == null) return;
NavigationController controller = mTab.getWebContents().getNavigationController();
int index = controller.getLastCommittedEntryIndex();
NavigationEntry entry = controller.getEntryAtIndex(index);
if (entry == null) return;
controller.setEntryExtraData(
index, NAVIGATION_ENTRY_SCROLL_POSITION_KEY, getLayoutManagerState());
}
/*
* Retrieves the layout manager state from the navigation entry and reconstitutes it into a
* Parcelable using LinearLayoutManager.SavedState.CREATOR.
*/
private Parcelable getLayoutManagerStateFromNavigationEntry() {
if (mTab.getWebContents() == null) return null;
NavigationController controller = mTab.getWebContents().getNavigationController();
int index = controller.getLastCommittedEntryIndex();
String layoutManagerState =
controller.getEntryExtraData(index, NAVIGATION_ENTRY_SCROLL_POSITION_KEY);
if (TextUtils.isEmpty(layoutManagerState)) return null;
byte[] parcelData = Base64.decode(layoutManagerState, 0);
Parcel parcel = Parcel.obtain();
parcel.unmarshall(parcelData, 0, parcelData.length);
parcel.setDataPosition(0);
Parcelable scrollPosition = LinearLayoutManager.SavedState.CREATOR.createFromParcel(parcel);
parcel.recycle();
return scrollPosition;
}
@Override
public void destroy() {
if (mTabObserver != null) {
mTab.removeObserver(mTabObserver);
}
mHost.getActiveTab().getWindowAndroid().removeContextMenuCloseListener(mContextMenuManager);
super.destroy();
}
private void setTouchEnabled(boolean enabled) {} // Does nothing.
private void lookupCategoryAndScroll() {
try {
int id = Integer.parseInt(mNavFragment);
ListModel<ExploreSitesCategory> categoryList = mModel.get(CATEGORY_LIST_KEY);
for (int i = 0; i < categoryList.size(); i++) {
if (categoryList.get(i).getId() == id) {
mModel.set(SCROLL_TO_CATEGORY_KEY, i);
break;
}
}
} catch (NumberFormatException e) {
} // do nothing
}
}
|
[
"[email protected]"
] | |
b30fbc9c7c35fe1237c9032645e2a07793d13085
|
ae5be6eeedaea861a45586bfd41f183155222b41
|
/app/src/main/java/com/baking/divyamjoshi/bake/Ui/Singleton.java
|
af23294584f959dd7403320888cb6500845ab842
|
[] |
no_license
|
dvmjoshi/Bake
|
5833ea696e4cecb1be09dda28f8150a2d2016434
|
62e832789431541b788335f35e50fe7a168e6481
|
refs/heads/master
| 2020-03-17T00:53:35.524408 | 2018-05-12T09:51:11 | 2018-05-12T09:51:11 | 133,133,562 | 4 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 980 |
java
|
package com.baking.divyamjoshi.bake.Ui;
import android.content.Context;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
public class Singleton {
private static Singleton mInstance;
private RequestQueue mRequestQueue;
private static Context mCtx;
private Singleton(Context context) {
mCtx = context.getApplicationContext();
mRequestQueue = getRequestQueue();
}
public static synchronized Singleton getInstance(Context context) {
if (mInstance == null) {
mInstance = new Singleton(context);
}
return mInstance;
}
public RequestQueue getRequestQueue() {
if (mRequestQueue == null) {
mRequestQueue = Volley.newRequestQueue(mCtx.getApplicationContext());
}
return mRequestQueue;
}
public <T> void addToRequestQueue(Request<T> req) {
getRequestQueue().add(req);
}
}
|
[
"[email protected]"
] | |
d92c5bbedb63199ef97dc0a5efbcd1a5517ec718
|
f789b6aaa442f55889b1e4969ffd9c7d82d9e493
|
/DotCom/GameHelper.java
|
8088abd7b935f171f2842fbfe92105db08b328e9
|
[] |
no_license
|
SergeySoloviov/HeadFirstJava
|
7c0c87dcac90b340142ae9e46ffc6415b0a76f6d
|
15b30ed3c5cdeeed2bdf88f36db7433dd5ec4092
|
refs/heads/master
| 2022-09-20T16:35:02.670488 | 2022-09-09T14:50:15 | 2022-09-09T14:50:15 | 34,690,010 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,503 |
java
|
package HeadFirstJava.DotCom;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
/**
* Created by Сережка on 20.04.2015.
*/
public class GameHelper {
private static final String alphabet = "abcdefg";
private int gridLenght = 7;
private int gridSize = 49;
private int[] grid = new int[gridSize];
private int comCount = 0;
public String getUserInput(String prompt) {
String inputLine = null;
System.out.println(prompt + " ");
try {
BufferedReader is = new BufferedReader(new InputStreamReader(System.in));
inputLine = is.readLine();
if (inputLine.length() == 0) return null;
}
catch (IOException e) {
System.out.println("IOException: " + e);
}
return inputLine.toLowerCase();
}
public ArrayList<String> placeDotCom(int comSize) {
ArrayList<String> alphaCells = new ArrayList<>();
String[] alphacoords = new String[comSize];
String temp = null;
int[] coords = new int[comSize];
int attempts = 0;
boolean success = false;
int location = 0;
comCount++;
int incr = 1;
if ((comCount % 2) == 1) {
incr = gridLenght;
}
while (!success & attempts++ < 200) {
location = (int)(Math.random() * gridSize);
int x = 0;
success = true;
while (success && x < comSize) {
if (grid[location] == 0) {
coords[x++] = location;
location += incr;
if (location >= gridSize) {
success = false;
}
if (x > 0 && (location % gridLenght == 0)) {
success = false;
}
}
else {
success = false;
}
}
}
int x = 0;
int row = 0;
int column = 0;
while (x < comSize) {
grid[coords[x]] = 1;
row = (int)(coords[x] / gridLenght);
column = coords[x] % gridLenght;
temp = String.valueOf(alphabet.charAt(column));
alphaCells.add(temp.concat(Integer.toString(row)));
x++;
// System.out.println(" coord " + x + " = " + alphaCells.get(x - 1));
}
return alphaCells;
}
}
|
[
"[email protected]"
] | |
98e10d1f46500203aaa2079e5ca3dceca7aec675
|
61a85f83ac1d298b9848344ae31cea3375fea38a
|
/app/build/generated/not_namespaced_r_class_sources/debug/r/androidx/fragment/R.java
|
c55eaa1639fe676a335b26af7453b07c7a50f8a4
|
[] |
no_license
|
apriliakhrnnsa/Android-fundamentals-02.1-Activities-and-intents
|
2980609df772fb28f50fbb9ae417c2f307878beb
|
2b31e32a1db035de39e1e2fb44f7bb014de163e1
|
refs/heads/master
| 2020-07-30T08:17:02.381498 | 2019-09-22T14:42:36 | 2019-09-22T14:42:36 | 210,150,895 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 12,390 |
java
|
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package androidx.fragment;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f020027;
public static final int coordinatorLayoutStyle = 0x7f020064;
public static final int font = 0x7f02007a;
public static final int fontProviderAuthority = 0x7f02007c;
public static final int fontProviderCerts = 0x7f02007d;
public static final int fontProviderFetchStrategy = 0x7f02007e;
public static final int fontProviderFetchTimeout = 0x7f02007f;
public static final int fontProviderPackage = 0x7f020080;
public static final int fontProviderQuery = 0x7f020081;
public static final int fontStyle = 0x7f020082;
public static final int fontVariationSettings = 0x7f020083;
public static final int fontWeight = 0x7f020084;
public static final int keylines = 0x7f020094;
public static final int layout_anchor = 0x7f020097;
public static final int layout_anchorGravity = 0x7f020098;
public static final int layout_behavior = 0x7f020099;
public static final int layout_dodgeInsetEdges = 0x7f0200c3;
public static final int layout_insetEdge = 0x7f0200cc;
public static final int layout_keyline = 0x7f0200cd;
public static final int statusBarBackground = 0x7f020109;
public static final int ttcIndex = 0x7f02013c;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f04003f;
public static final int notification_icon_bg_color = 0x7f040040;
public static final int ripple_material_light = 0x7f04004a;
public static final int secondary_text_default_material_light = 0x7f04004c;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f05004b;
public static final int compat_button_inset_vertical_material = 0x7f05004c;
public static final int compat_button_padding_horizontal_material = 0x7f05004d;
public static final int compat_button_padding_vertical_material = 0x7f05004e;
public static final int compat_control_corner_material = 0x7f05004f;
public static final int compat_notification_large_icon_max_height = 0x7f050050;
public static final int compat_notification_large_icon_max_width = 0x7f050051;
public static final int notification_action_icon_size = 0x7f05005b;
public static final int notification_action_text_size = 0x7f05005c;
public static final int notification_big_circle_margin = 0x7f05005d;
public static final int notification_content_margin_start = 0x7f05005e;
public static final int notification_large_icon_height = 0x7f05005f;
public static final int notification_large_icon_width = 0x7f050060;
public static final int notification_main_column_padding_top = 0x7f050061;
public static final int notification_media_narrow_margin = 0x7f050062;
public static final int notification_right_icon_size = 0x7f050063;
public static final int notification_right_side_padding_top = 0x7f050064;
public static final int notification_small_icon_background_padding = 0x7f050065;
public static final int notification_small_icon_size_as_large = 0x7f050066;
public static final int notification_subtext_size = 0x7f050067;
public static final int notification_top_pad = 0x7f050068;
public static final int notification_top_pad_large_text = 0x7f050069;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f060057;
public static final int notification_bg = 0x7f060058;
public static final int notification_bg_low = 0x7f060059;
public static final int notification_bg_low_normal = 0x7f06005a;
public static final int notification_bg_low_pressed = 0x7f06005b;
public static final int notification_bg_normal = 0x7f06005c;
public static final int notification_bg_normal_pressed = 0x7f06005d;
public static final int notification_icon_background = 0x7f06005e;
public static final int notification_template_icon_bg = 0x7f06005f;
public static final int notification_template_icon_low_bg = 0x7f060060;
public static final int notification_tile_bg = 0x7f060061;
public static final int notify_panel_notification_icon_bg = 0x7f060062;
}
public static final class id {
private id() {}
public static final int action_container = 0x7f07000d;
public static final int action_divider = 0x7f07000f;
public static final int action_image = 0x7f070010;
public static final int action_text = 0x7f070016;
public static final int actions = 0x7f070017;
public static final int async = 0x7f07001d;
public static final int blocking = 0x7f070020;
public static final int bottom = 0x7f070021;
public static final int chronometer = 0x7f07002a;
public static final int end = 0x7f07003a;
public static final int forever = 0x7f070040;
public static final int icon = 0x7f070046;
public static final int icon_group = 0x7f070047;
public static final int info = 0x7f07004a;
public static final int italic = 0x7f07004c;
public static final int left = 0x7f07004d;
public static final int line1 = 0x7f07004e;
public static final int line3 = 0x7f07004f;
public static final int none = 0x7f070056;
public static final int normal = 0x7f070057;
public static final int notification_background = 0x7f070058;
public static final int notification_main_column = 0x7f070059;
public static final int notification_main_column_container = 0x7f07005a;
public static final int right = 0x7f070062;
public static final int right_icon = 0x7f070063;
public static final int right_side = 0x7f070064;
public static final int start = 0x7f070080;
public static final int tag_transition_group = 0x7f070084;
public static final int tag_unhandled_key_event_manager = 0x7f070085;
public static final int tag_unhandled_key_listeners = 0x7f070086;
public static final int text = 0x7f070087;
public static final int text2 = 0x7f070088;
public static final int time = 0x7f07008f;
public static final int title = 0x7f070090;
public static final int top = 0x7f070093;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f080004;
}
public static final class layout {
private layout() {}
public static final int notification_action = 0x7f09001e;
public static final int notification_action_tombstone = 0x7f09001f;
public static final int notification_template_custom_big = 0x7f090020;
public static final int notification_template_icon_group = 0x7f090021;
public static final int notification_template_part_chronometer = 0x7f090022;
public static final int notification_template_part_time = 0x7f090023;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0b002d;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0c00ec;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0c00ed;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0c00ee;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0c00ef;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0c00f0;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0c0158;
public static final int Widget_Compat_NotificationActionText = 0x7f0c0159;
public static final int Widget_Support_CoordinatorLayout = 0x7f0c015a;
}
public static final class styleable {
private styleable() {}
public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f020027 };
public static final int ColorStateListItem_android_color = 0;
public static final int ColorStateListItem_android_alpha = 1;
public static final int ColorStateListItem_alpha = 2;
public static final int[] CoordinatorLayout = { 0x7f020094, 0x7f020109 };
public static final int CoordinatorLayout_keylines = 0;
public static final int CoordinatorLayout_statusBarBackground = 1;
public static final int[] CoordinatorLayout_Layout = { 0x10100b3, 0x7f020097, 0x7f020098, 0x7f020099, 0x7f0200c3, 0x7f0200cc, 0x7f0200cd };
public static final int CoordinatorLayout_Layout_android_layout_gravity = 0;
public static final int CoordinatorLayout_Layout_layout_anchor = 1;
public static final int CoordinatorLayout_Layout_layout_anchorGravity = 2;
public static final int CoordinatorLayout_Layout_layout_behavior = 3;
public static final int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 4;
public static final int CoordinatorLayout_Layout_layout_insetEdge = 5;
public static final int CoordinatorLayout_Layout_layout_keyline = 6;
public static final int[] FontFamily = { 0x7f02007c, 0x7f02007d, 0x7f02007e, 0x7f02007f, 0x7f020080, 0x7f020081 };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f02007a, 0x7f020082, 0x7f020083, 0x7f020084, 0x7f02013c };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_android_ttcIndex = 3;
public static final int FontFamilyFont_android_fontVariationSettings = 4;
public static final int FontFamilyFont_font = 5;
public static final int FontFamilyFont_fontStyle = 6;
public static final int FontFamilyFont_fontVariationSettings = 7;
public static final int FontFamilyFont_fontWeight = 8;
public static final int FontFamilyFont_ttcIndex = 9;
public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 };
public static final int GradientColor_android_startColor = 0;
public static final int GradientColor_android_endColor = 1;
public static final int GradientColor_android_type = 2;
public static final int GradientColor_android_centerX = 3;
public static final int GradientColor_android_centerY = 4;
public static final int GradientColor_android_gradientRadius = 5;
public static final int GradientColor_android_tileMode = 6;
public static final int GradientColor_android_centerColor = 7;
public static final int GradientColor_android_startX = 8;
public static final int GradientColor_android_startY = 9;
public static final int GradientColor_android_endX = 10;
public static final int GradientColor_android_endY = 11;
public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 };
public static final int GradientColorItem_android_color = 0;
public static final int GradientColorItem_android_offset = 1;
}
}
|
[
"[email protected]"
] | |
5f62ba08869d7978c9e761c91064e819f66fc678
|
4de8dc187355527d5abe6741d85b16858542f198
|
/GhostPractice/GhostPracticePhone/src/main/java/com/boha/ghostpractice/fragments/FeeTargetBranch.java
|
77512acc0cdbd5bcc661d2425325bad5eebb0676
|
[] |
no_license
|
bohatmx/GhostPractice
|
5b05358847c689f6132e4658d587070cf26588a3
|
3f05355f1d747f081fe235c496ae72ad02a086f8
|
refs/heads/master
| 2021-03-16T08:44:35.528388 | 2015-12-06T07:23:56 | 2015-12-06T07:23:56 | 34,336,086 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,588 |
java
|
package com.boha.ghostpractice.fragments;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Bundle;
import android.os.Vibrator;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.boha.ghostpractice.reports.data.Branch;
import com.boha.ghostpractice.reports.data.FeeTargetProgressReport;
import com.boha.ghostpractice.util.NumberFormatter;
import com.boha.ghostpracticephone.R;
@SuppressLint("ValidFragment")
public class FeeTargetBranch extends Fragment implements ReportInterface {
private Context ctx;
Vibrator vb;
View view;
LinearLayout bucket;
private FeeTargetProgressReport feeTargetReport;
@Override
public void onActivityCreated(Bundle state) {
super.onActivityCreated(state);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle saved) {
ctx = getActivity().getApplicationContext();
vb = (Vibrator) ctx.getSystemService(Context.VIBRATOR_SERVICE);
view = inflater.inflate(R.layout.fee_target_branch, null);
// configure header
//LinearLayout lay = (LinearLayout) view.findViewById(R.id.HEADER_layout);
//lay.setBackgroundColor(getResources().getColor(R.color.black));
TextView hdr = (TextView) view.findViewById(R.id.HEADER_title);
hdr.setText("Fee Target Progress (Branch)");
bucket = (LinearLayout)view.findViewById(R.id.FTB_layout);
setBranches();
return view;
}
void setBranches() {
LayoutInflater inf = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
for (Branch branch : feeTargetReport.getBranches()) {
LinearLayout branchLayout = (LinearLayout)inf.inflate(R.layout.fee_branch_template, null);
TextView txt = (TextView)branchLayout.findViewById(R.id.TEMP_branchName);
txt.setText(branch.getName());
TextView txt1 = (TextView)branchLayout.findViewById(R.id.TEMP_invoicedTotal);
setAmountText(txt1, branch.getBranchTotals().getInvoicedMTD());
LinearLayout mtdLayout = (LinearLayout)branchLayout.findViewById(R.id.TEMP_recordedMTD);
LinearLayout mtdTemplate = (LinearLayout)inf.inflate(R.layout.mtd, null);
TextView t1 = (TextView) mtdTemplate.findViewById(R.id.MTD_achieved);
setAmountText(t1, branch.getBranchTotals().getRecordedMTD().getAchieved());
TextView t2 = (TextView) mtdTemplate.findViewById(R.id.MTD_estimated);
setAmountText(t2, branch.getBranchTotals().getRecordedMTD().getEstimatedTarget());
TextView t3 = (TextView) mtdTemplate.findViewById(R.id.MTD_invoiced);
setAmountText(t3, branch.getBranchTotals().getRecordedMTD().getInvoicedDebits());
TextView t4 = (TextView) mtdTemplate.findViewById(R.id.MTD_unbilled);
setAmountText(t4, branch.getBranchTotals().getRecordedMTD().getUnbilled());
TextView t5 = (TextView) mtdTemplate.findViewById(R.id.MTD_total);
setAmountText(t5, branch.getBranchTotals().getRecordedMTD().getTotal());
mtdLayout.addView(mtdTemplate);
//
LinearLayout mtdLayout1 = (LinearLayout)branchLayout.findViewById(R.id.TEMP_recordedYTD);
LinearLayout mtdTemplate1 = (LinearLayout)inf.inflate(R.layout.mtd, null);
TextView t11 = (TextView) mtdTemplate1.findViewById(R.id.MTD_achieved);
setAmountText(t11, branch.getBranchTotals().getRecordedYTD().getAchieved());
TextView t21 = (TextView) mtdTemplate1.findViewById(R.id.MTD_estimated);
setAmountText(t21, branch.getBranchTotals().getRecordedYTD().getEstimatedTarget());
TextView t31 = (TextView) mtdTemplate1.findViewById(R.id.MTD_invoiced);
setAmountText(t31, branch.getBranchTotals().getRecordedYTD().getInvoicedDebits());
TextView t41 = (TextView) mtdTemplate1.findViewById(R.id.MTD_unbilled);
setAmountText(t41, branch.getBranchTotals().getRecordedYTD().getUnbilled());
TextView t51 = (TextView) mtdTemplate1.findViewById(R.id.MTD_total);
setAmountText(t51, branch.getBranchTotals().getRecordedYTD().getTotal());
mtdLayout1.addView(mtdTemplate1);
bucket.addView(branchLayout);
}
}
void setAmountText(TextView txt, double amt ) {
NumberFormatter.setAmountText(txt, amt);
}
//NumberFormat nf = NumberFormat.getInstance();
@Override
public void getName() {
// TODO Auto-generated method stub
}
public FeeTargetProgressReport getFeeTargetReport() {
return feeTargetReport;
}
public void setFeeTargetReport(FeeTargetProgressReport feeTargetReport) {
this.feeTargetReport = feeTargetReport;
}
}
|
[
"[email protected]"
] | |
5f4feddb7a9a5fd4d3874620710317224157a55c
|
92f928e99b0b78e8154838774705c431b9fbb72b
|
/src/main/java/com/example/demo/repository/UserRepository.java
|
6e2a0d1d208120fa7e222f748001ef3c12221124
|
[] |
no_license
|
dominus-7/SpringBoot-Crud-Restful-Webservices
|
ec5facebdfa411077c84f619598db435e7fc15af
|
bd7559391634c2a8e74408608fa2312948663991
|
refs/heads/main
| 2023-03-21T08:24:20.899526 | 2021-03-15T23:14:21 | 2021-03-15T23:14:21 | 348,147,541 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 273 |
java
|
package com.example.demo.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.example.demo.entity.User;
@Repository
public interface UserRepository extends JpaRepository<User, Long> {
}
|
[
"[email protected]"
] | |
f60bbe6a389f50e7920d5e0b8b9db66536233319
|
d3df2f24cf23584a655780bc418b61e8bb68cae9
|
/src/main/java/com/recipepicker/config/SwaggerConfig.java
|
0e46c38259119b07042cb3c893e31f7e47e8731e
|
[] |
no_license
|
lsternh/RecipePicker
|
dffbbf9c79322e9eea8698c165dd8c59f0d5189c
|
edc88e48d8b21faaa4c817a558cef074f5ea5484
|
refs/heads/master
| 2023-06-03T11:59:04.974455 | 2021-06-24T02:29:40 | 2021-06-24T02:29:40 | 355,020,866 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,262 |
java
|
package com.recipepicker.config;
import static com.google.common.collect.Lists.newArrayList;
import java.util.Collections;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.google.common.base.Predicates;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.builders.ResponseMessageBuilder;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig implements WebMvcConfigurer {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(Predicates.not(RequestHandlerSelectors.basePackage("any.package")))
.paths(PathSelectors.any())
.build();
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addRedirectViewController("/api/v2/api-docs", "/v2/api-docs");
registry.addRedirectViewController("/api/swagger-resources/configuration/ui", "/swagger-resources/configuration/ui");
registry.addRedirectViewController("/api/swagger-resources/configuration/security", "/swagger-resources/configuration/security");
registry.addRedirectViewController("/api/swagger-resources", "/swagger-resources");
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/swagger-ui.html**").addResourceLocations("classpath:/META-INF/resources/swagger-ui.html");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}
|
[
"[email protected]"
] | |
9669eea1bfe9f649252945512f1710c480bd9d4d
|
dcb0e6cffe8911990cc679938b0b63046b9078ad
|
/uitests/plugins/org.jboss.tools.fuse.reddeer/src/org/jboss/tools/fuse/reddeer/requirement/JolokiaRequirement.java
|
dd8d5efb2d14d8576b3ee4b49adf3ac6773b7a46
|
[] |
no_license
|
MelissaFlinn/jbosstools-fuse
|
6fe7ac5f83d05df05d8884a8576b9af4baac3cd6
|
d960f4ed562da96a82128e0a9c04e122b9e9e8b0
|
refs/heads/master
| 2021-06-25T09:30:28.876445 | 2019-07-15T09:10:12 | 2019-07-29T08:12:28 | 112,379,325 | 0 | 0 | null | 2017-11-28T19:27:42 | 2017-11-28T19:27:42 | null |
UTF-8
|
Java
| false | false | 1,673 |
java
|
/*******************************************************************************
* Copyright (c) 2017 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.fuse.reddeer.requirement;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.eclipse.reddeer.junit.requirement.AbstractConfigurableRequirement;
import org.jboss.tools.fuse.reddeer.requirement.JolokiaRequirement.Jolokia;
/**
* Requirement for a Jolokia connection. The appropriate yaml file should look
* like as follows
*
* <pre>
* org.jboss.tools.fuse.reddeer.requirement.JolokiaRequirement.Jolokia:
* - name: My Jolokia
* jolokiaJarFile: /tmp/jolokia-jvm-1.3.7-agent.jar
* host: localhost
* port: 8778
* </pre>
*
* @author Andrej Podhradsky ([email protected])
*
*/
public class JolokiaRequirement extends AbstractConfigurableRequirement<JolokiaConfiguration, Jolokia> {
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Jolokia {
}
@Override
public Class<JolokiaConfiguration> getConfigurationClass() {
return JolokiaConfiguration.class;
}
@Override
public void fulfill() {
}
@Override
public void cleanUp() {
}
}
|
[
"[email protected]"
] | |
ff7a1d43a577c118c9e9c5c7b88da80e16f4ae81
|
832c756923d48ace3f338b27ae9dc8327058d088
|
/src/contest/acm/ACM_Waterloo_Local_2017_Fall_C.java
|
3cb2e8782d8be9273a4bee375193cb3a25e8c5e4
|
[
"Apache-2.0",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
luchy0120/competitive-programming
|
1331bd53698c4b05b57a31d90eecc31c167019bd
|
d0dfc8f3f3a74219ecf16520d6021de04a2bc9f6
|
refs/heads/master
| 2020-05-04T15:18:06.150736 | 2018-11-07T04:15:26 | 2018-11-07T04:15:26 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,172 |
java
|
package contest.acm;
import java.util.*;
import java.io.*;
public class ACM_Waterloo_Local_2017_Fall_C {
static BufferedReader br;
static PrintWriter out;
static StringTokenizer st;
public static void main (String[] args) throws IOException {
br = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(new OutputStreamWriter(System.out));
// br = new BufferedReader(new FileReader("in.txt"));
// out = new PrintWriter(new FileWriter("out.txt"));
int N = readInt();
int K = readInt();
int[] val = new int[N];
for (int i = 0; i < N; i++)
val[i] = readInt();
Arrays.sort(val);
PriorityQueue<State> pq = new PriorityQueue<State>();
int margin = 0;
for (int i = 0; i < N; i++) {
// considering from [i + K - 1, i]
if (i + K - 1 < N)
pq.offer(new State(i, val[i + K - 1] - val[i]));
// considering ranges that start [i - K + 1, i]
while (pq.peek().index < i - K + 1)
pq.poll();
margin = Math.max(margin, pq.peek().pos);
}
out.println(margin);
out.close();
}
static class State implements Comparable<State> {
int index, pos;
State (int index, int pos) {
this.index = index;
this.pos = pos;
}
@Override
public int compareTo (State s) {
return pos - s.pos;
}
@Override
public boolean equals (Object o) {
if (o instanceof State) {
State s = (State)o;
return index == s.index && pos == s.pos;
}
return false;
}
}
static String next () throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine().trim());
return st.nextToken();
}
static long readLong () throws IOException {
return Long.parseLong(next());
}
static int readInt () throws IOException {
return Integer.parseInt(next());
}
static double readDouble () throws IOException {
return Double.parseDouble(next());
}
static char readCharacter () throws IOException {
return next().charAt(0);
}
static String readLine () throws IOException {
return br.readLine().trim();
}
}
|
[
"[email protected]"
] | |
93f7c48d5b387b74d841eed7c2233455ede25225
|
baacb01b15aa7ad6f3391f7837c22f53c1ad7c65
|
/app/src/main/java/com/revolt/primenews/ViewAnnouncementActivity.java
|
7fcd5b25ce4d3d2d58c825254fa419755bb06c40
|
[] |
no_license
|
Amal642/PrimeNews
|
f95367972beae992d3d61a655c1f913fce80d946
|
8ef561d3354c32dfac8766abef26cb76ab7f5745
|
refs/heads/master
| 2023-05-09T16:26:30.266971 | 2021-06-07T16:42:34 | 2021-06-07T16:42:34 | 324,722,474 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,355 |
java
|
package com.revolt.primenews;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.firebase.ui.database.FirebaseRecyclerOptions;
import com.google.firebase.database.FirebaseDatabase;
public class ViewAnnouncementActivity extends AppCompatActivity {
RecyclerView recyclerView;
Annadapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_announcement);
recyclerView =(RecyclerView)findViewById(R.id.recview);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
FirebaseRecyclerOptions<Announcements> options =
new FirebaseRecyclerOptions.Builder<Announcements>()
.setQuery(FirebaseDatabase.getInstance().getReference().child("Ann_upload"),Announcements.class)
.build();
adapter= new Annadapter(options);
recyclerView.setAdapter(adapter);
}
@Override
protected void onStart(){
super.onStart();
adapter.startListening();
}
@Override
protected void onStop(){
super.onStop();
adapter.stopListening();
}
}
|
[
"[email protected]"
] | |
0f208e8e8de5db8ff3ab5fce526b30f1968dffac
|
8187cb174642d53ef5698b423005fc3c0cbcf356
|
/src/br/com/dataminas/cbrasileiro/models/Artilheiro.java
|
a8848d41a4bd26d01edb2a34d7933d1b07fa9b4a
|
[
"MIT"
] |
permissive
|
xilenomg/campeonatobrasileiro-android
|
83f0e41c729a1f7c43ac5d1d64d10e0ffbaa43fc
|
53cb649b8cc41542a36a257007a79b41c22dedba
|
refs/heads/master
| 2021-01-19T10:11:19.964776 | 2014-10-04T18:13:20 | 2014-10-04T18:13:20 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 945 |
java
|
package br.com.dataminas.cbrasileiro.models;
import org.codehaus.jackson.annotate.JsonProperty;
public class Artilheiro {
@JsonProperty("id")
String id;
@JsonProperty("nome_jogador")
String nomeJogador;
@JsonProperty("gols")
String gols;
@JsonProperty("sigla_time")
String siglaTime;
@JsonProperty("time_dns")
String timeDNS;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getNomeJogador() {
return nomeJogador;
}
public void setNomeJogador(String nomeJogador) {
this.nomeJogador = nomeJogador;
}
public String getGols() {
return gols;
}
public void setGols(String gols) {
this.gols = gols;
}
public String getSiglaTime() {
return siglaTime;
}
public void setSiglaTime(String siglaTime) {
this.siglaTime = siglaTime;
}
public String getTimeDNS() {
return timeDNS;
}
public void setTimeDNS(String timeDNS) {
this.timeDNS = timeDNS;
}
}
|
[
"[email protected]"
] | |
db5c1f19e0945b197e46da2f63a93d931d922ad9
|
6bcaeb4d0e7e48629404d57e1590c69dd4754498
|
/NA-WebApp-DevelopersTeam-Spring/src/main/java/by/training/nc/dev5/web/controller/CustomerController.java
|
e6ec73bf84ef341b7cd532bbaba0ed73cb5cd481
|
[] |
no_license
|
ATPod/nc-training
|
56a03fa01f96ebaa075f93134485180a069b0407
|
75dffd524be61f2675c0bda2bfacfbbad66c993b
|
refs/heads/master
| 2020-05-23T08:36:57.766787 | 2017-07-11T07:26:37 | 2017-07-11T07:26:37 | 84,756,625 | 1 | 6 | null | 2017-03-17T15:17:22 | 2017-03-12T20:52:38 |
Java
|
UTF-8
|
Java
| false | false | 4,712 |
java
|
package by.training.nc.dev5.web.controller;
import by.training.nc.dev5.dto.*;
import by.training.nc.dev5.service.QualificationService;
import by.training.nc.dev5.service.TermsOfReferenceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
/**
* Created by Nikita on 24.05.2017.
*/
@Controller
@RequestMapping("/customer")
@SessionAttributes({"user", "createdTerms"})
@Scope("session")
public class CustomerController extends MultiActionController {
private final TermsOfReferenceService termsOfReferenceService;
private final QualificationService qualificationService;
@Autowired
public CustomerController(TermsOfReferenceService termsOfReferenceService,
QualificationService qualificationService) {
this.termsOfReferenceService = termsOfReferenceService;
this.qualificationService = qualificationService;
}
@RequestMapping(value = "/terms", method = RequestMethod.GET)
public ModelAndView showTermsOfReference(
@ModelAttribute("user") PersonDto user) {
ModelAndView modelAndView = new ModelAndView();
CustomerDto customer = (CustomerDto) user;
Collection<TermsOfReferenceDto> terms =
termsOfReferenceService.getTermsByCustomer(customer);
modelAndView.setViewName("customer/show-my-terms");
modelAndView.addObject("terms", terms);
return modelAndView;
}
@RequestMapping(
value = "/addTask",
method = RequestMethod.POST,
params = {"specification", "qualificationId", "developersNumber"})
public String addTask(
@ModelAttribute("createdTerms") TermsOfReferenceDto createdTerms,
@RequestParam("qualificationId") int qualificationId,
@RequestParam("specification") String specification,
@RequestParam("developersNumber") int developersNumber) {
TaskDto taskDto = new TaskDto();
QualificationDto qualification = qualificationService
.getQualification(qualificationId);
taskDto.setQuotas(new HashMap<QualificationDto, Integer>());
taskDto.getQuotas().put(qualification, developersNumber);
taskDto.setSpecification(specification);
createdTerms.getTasks().add(taskDto);
return "redirect:/customer/createTerms";
}
@RequestMapping(value = "/createTerms", method = RequestMethod.GET)
public ModelAndView createTermsGet(ModelMap modelMap) {
ModelAndView modelAndView = new ModelAndView("customer/create-terms");
if (!modelMap.containsAttribute("createdTerms")) {
addCreatedTerms(modelMap);
}
modelAndView.addObject("qualification", new QualificationDto());
return modelAndView;
}
@RequestMapping(value = "/createTerms", method = RequestMethod.POST)
public String createTermsPost(
@ModelAttribute("createdTerms") TermsOfReferenceDto createdTerms,
ModelMap modelMap) {
termsOfReferenceService.applyTermsOfReference(createdTerms);
// A little hack to reset value of createdTerms because
// ModelMap#remove() does not work properly.
addCreatedTerms(modelMap);
return "redirect:/customer/terms";
}
@RequestMapping(value = "/cancelTerms", method = RequestMethod.POST)
public String cancelTermsPost(
ModelMap modelMap) {
// A little hack to reset value of createdTerms because
// ModelMap#remove() does not work properly.
addCreatedTerms(modelMap);
return "redirect:/customer/createTerms";
}
@ModelAttribute("createdTerms")
private void addCreatedTerms(ModelMap modelMap) {
TermsOfReferenceDto createdTerms = new TermsOfReferenceDto();
CustomerDto user = (CustomerDto) modelMap.get("user");
createdTerms.setTasks(new LinkedList<TaskDto>());
createdTerms.setCustomer(user);
modelMap.addAttribute("createdTerms", createdTerms);
}
@ModelAttribute("qualifications")
public void addQualifications(ModelMap modelMap) {
Collection<QualificationDto> qualifications = qualificationService
.getQualifications();
modelMap.addAttribute("qualifications", qualifications);
}
}
|
[
"[email protected]"
] | |
2dd1835153b407aae1fd667d648d82dae045b5ad
|
76376a06ed38016c335023a6c245615d760b9f69
|
/src/graphnet/GraphTieIn.java
|
291b6969e46f88911d6eb74e7ec0a4be6bb843b4
|
[
"MIT"
] |
permissive
|
StetsenkoInna/ParallelDESS
|
660f39b69a0573f109a2a607b744604426d21209
|
51ad7e50b36337c76aa45f1cfce30d6c5c895945
|
refs/heads/master
| 2021-08-30T20:51:49.717198 | 2017-12-19T11:45:09 | 2017-12-19T11:45:09 | 109,233,640 | 3 | 3 |
MIT
| 2017-12-19T11:46:01 | 2017-11-02T07:47:40 |
Java
|
UTF-8
|
Java
| false | false | 4,090 |
java
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package graphnet;
import PetriObj.ArcIn;
import graphpresentation.GraphTie;
import java.awt.BasicStroke;
import java.awt.Graphics2D;
import java.awt.Stroke;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author Инна
*/
public class GraphTieIn extends GraphTie implements Serializable {
private static ArrayList<GraphTieIn> graphTieInList = new ArrayList<GraphTieIn>(); // added by Olha 24.09.12, cjrrect by Inna 28.11.2012
private ArcIn tie;
public GraphTieIn() { // додано Олею 28.09.12 для створення тимчасової дуги (тільки для промальовки)
super();
tie = new ArcIn();
//System.out.println("GraphTieIn "+ tie.getNameP()+" "+tie.getNumP()+" "+tie.getNameT()+" "+tie.getNumT());
}
public GraphTieIn(ArcIn tiein){
tie = tiein;
}
public ArcIn getTieIn()
{
return tie;
}
@Override
public void setPetriElements() {
tie.setQuantity(1);
tie.setInf(false);
tie.setNumP(super.getBeginElement().getNumber());
tie.setNumT(super.getEndElement().getNumber());
tie.setNameP(super.getBeginElement().getName());
tie.setNameT(super.getEndElement().getName());
/* System.out.println("GraphTIE IN : setPetriElements "+super.getBeginElement().getName()+ " "+ super.getBeginElement().getNumber()+
super.getEndElement().getName()+" "+super.getEndElement().getNumber()
);*/
addElementToArrayList(); //// added by Olha 24.09.12
}
@Override
public void addElementToArrayList() { // added by Olha 24.09.12
if (graphTieInList == null) {
graphTieInList = new ArrayList();
}
graphTieInList.add(this);
}
@Override
public void drawGraphElement(Graphics2D g) {
// System.out.println("Drawing TieIn");
Graphics2D g2 = (Graphics2D) g;
if (tie.getIsInf() ) {
Stroke drawingStroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[]{4, 4}, 0);
g2.setStroke(drawingStroke);
g2.draw(this.getGraphElement());
drawArrowHead(g2);
} else {
g2.setStroke(new BasicStroke());
g2.draw(this.getGraphElement());
drawArrowHead(g2);
}
if (tie.getQuantity()!= 1) {
this.getAvgLine().setLocation((this.getGraphElement().getX1() + this.getGraphElement().getX2()) / 2, (this.getGraphElement().getY1() + this.getGraphElement().getY2()) / 2);
g2.drawLine((int) this.getAvgLine().getX() + 5, (int) this.getAvgLine().getY() - 5, (int) this.getAvgLine().getX() - 5, (int) this.getAvgLine().getY() + 5);
g2.drawString(Integer.toString(tie.getQuantity()), (float) this.getAvgLine().getX(), (float) this.getAvgLine().getY() - 7);
}
}
public static ArrayList<GraphTieIn> getGraphTieInList() {
return graphTieInList;
}
public static ArrayList<ArcIn> getTieInList() { // added by Inna 1.11.2012
ArrayList<ArcIn> arrayTieIn = new ArrayList <ArcIn>();
for (GraphTieIn e: graphTieInList)
arrayTieIn.add(e.getTieIn());
return arrayTieIn;
}
public static void setNullTieInList() {
graphTieInList.clear();
}
@Override
public int getQuantity(){
return tie.getQuantity();
}
@Override
public void setQuantity(int i){
tie.setQuantity(i);
}
@Override
public boolean getIsInf(){
return tie.getIsInf();
}
@Override
public void setInf(boolean i){
tie.setInf(i);
}
public static void addGraphTieInList(List<GraphTieIn> tieIn){ // added by Olha 14/11/2012
for (GraphTieIn ti:tieIn){
graphTieInList.add(ti);
}
}
}
|
[
"[email protected]"
] | |
cb12553e1cbb3154cdc967679180f3a5caff778e
|
e562efc7c3ae1f0a45a384a133232c1fcebd4614
|
/src/main/java/structuralPatterns/bridge/TennisBall.java
|
951788fab0242230396eae38fe2a3d4e4e5bd119
|
[] |
no_license
|
MaxRomaschenko/JavaLessons
|
2018d54d788258ae99f3a31a210248285ba7305a
|
421263a699a113dc67dba55669f135659e4cb359
|
refs/heads/master
| 2023-07-27T18:52:01.015052 | 2021-09-11T10:01:24 | 2021-09-11T10:01:24 | 393,612,148 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 353 |
java
|
package structuralPatterns.bridge;
public class TennisBall extends SportsEquipment{
public TennisBall(CompanyManufacturer companyManufacturer) {
super(companyManufacturer);
}
@Override
public boolean IsReady() {
companyManufacturer.createEquipment();
System.out.println(true);
return true;
}
}
|
[
"[email protected]"
] | |
97076648daf3071adbcd1d61fc949592ec62ef03
|
b4c9e48b2334b5d419d43aacbbb9894d1859e08d
|
/Whatsapp/src/main/java/com/Whatsapp/dao/WhatsappDAO.java
|
b5812d55c85d875eb76c2342a37b8460804aa87c
|
[] |
no_license
|
gursabiha123/Projects
|
be35f426bff7c76f16abacb0847a30a23f374a45
|
57b480a234750295bc1d41882a6ddfb71abc9e79
|
refs/heads/master
| 2022-12-19T01:34:03.438953 | 2020-09-28T17:37:28 | 2020-09-28T17:37:28 | 298,046,022 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,386 |
java
|
package com.Whatsapp.dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import com.Whatsapp.entity.whatsappuser;
public class WhatsappDAO implements WhatsappDAOInterface{
public void deleteprofileDAO() {
}
public int createprofileDAO(whatsappuser wu) throws Exception {
int i=0;
//step1 load driver
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
//for oracle
//Class.forName("oracle.jdbc.driver.OracleDriver");
//for sql
//Class.forName("com.mysql.jdbc.Driver");
//step2Create connection with database
Connection con=DriverManager.getConnection("jdbc:derby:F:/myfirstdb;create=true","laptop","laptop");
//step3 create query
PreparedStatement ps=con.prepareStatement("insert into detailw values(?,?,?,?)");//? represents that we are going to take values for questions
ps.setString(1, wu.getName());//1 means pehla ? and = pehle column ki value
ps.setString(2, wu.getAddress());
ps.setString(3, wu.getEmail());
ps.setString(4,wu.getPassword());
//step4 executeQuery
i=ps.executeUpdate();
return i;
}
public void viewprofileDAO() {
}
public void updateprofileDAO() {
}
public void findprofileDAO() {
}
public void activeprofileDAO() {
}
}
|
[
"[email protected]"
] | |
735b1e598d8144a828b30555b6eef55c518de2fc
|
e7ca6ab46cdff0eb0247bec7d3a399e4a513b782
|
/src/Parser/LogoGrammar.java
|
3372ae9eb6e1db94cb63a3aa31c491f100177fa5
|
[] |
no_license
|
zeebenzene/TurtleIDE
|
6d310e0a05e6c78a15b9caa40d4b9bb6a407bc7d
|
40aa5310f7aca563f8ec5c87058902f60b890110
|
refs/heads/master
| 2021-01-01T17:27:38.667846 | 2014-03-08T22:13:00 | 2014-03-08T22:13:00 | 17,096,448 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,771 |
java
|
package Parser;
public class LogoGrammar extends edu.hendrix.grambler.Grammar {
public LogoGrammar() {
super();
addProduction("lines", new String[]{"lines", "cr", "line"}, new String[]{"line"}, new String[]{"x"});
addProduction("line", new String[]{"if"}, new String[]{"expr"}, new String[]{"repeat"}, new String[]{"x"}, new String[]{"procedure"});
addProduction("procedure", new String[]{"'to'", "x", "var", "x", "pVar", "x", "br", "line", "br"});
addProduction("pCall", new String[]{"var", "x", "num"});
addProduction("if", new String[]{"ifNorm"}, new String[]{"ifElse"}, new String[]{"ifBool"});
addProduction("ifNorm", new String[]{"'if'", "x", "num", "x", "comp", "x", "num", "x", "expr"});
addProduction("ifElse", new String[]{"'ifelse'", "x", "num", "x", "comp", "x", "num", "x", "expr", "x", "expr"});
addProduction("ifBool", new String[]{"'if'", "x", "pCond", "x", "bool", "x", "pCond", "x", "expr"});
addProduction("expr", new String[]{"br", "cmds", "br"}, new String[]{"cmds"});
addProduction("repeat", new String[]{"'repeat'", "x", "num", "x", "br", "line", "br"});
addProduction("cmds", new String[]{"cmds", "x", "cmds"}, new String[]{"command"});
addProduction("command", new String[]{"argCmd", "x", "num"}, new String[]{"emptCmd"}, new String[]{"pCall"});
addProduction("argCmd", new String[]{"'fd'"}, new String[]{"'forward'"}, new String[]{"'bk'"}, new String[]{"'back'"}, new String[]{"'lt'"}, new String[]{"'left'"}, new String[]{"'rt'"}, new String[]{"'right'"});
addProduction("emptCmd", new String[]{"'pd'"}, new String[]{"'pendown'"}, new String[]{"'pu'"}, new String[]{"'penup'"}, new String[]{"'home'"}, new String[]{"'cs'"}, new String[]{"'clearscreen'"}, new String[]{"'st'"}, new String[]{"'showturtle'"}, new String[]{"'ht'"}, new String[]{"'hideturtle'"});
addProduction("num", new String[]{"\"\\d+\""}, new String[]{"pVar"});
addProduction("x", new String[]{"\"\\s*\""});
addProduction("br", new String[]{"'['"}, new String[]{"']'"}, new String[]{"x"});
addProduction("pVar", new String[]{"':'", "var"});
addProduction("var", new String[]{"\"(?!repeat|fd|forward|bk|back|lt|left|rt|right|pd|pendown|pu|penup|home|cs |clearscreen|st|showturtle|ht)[A-Za-z]+\""});
addProduction("cr", new String[]{"'\r\n'"}, new String[]{"'\n'"});
addProduction("pCond", new String[]{"'('", "num", "x", "comp", "x", "num", "')'"});
addProduction("bool", new String[]{"'and'"}, new String[]{"'or'"}, new String[]{"'not'"});
addProduction("comp", new String[]{"'>'"}, new String[]{"'<'"}, new String[]{"'>='"}, new String[]{"'<='"}, new String[]{"'='"});
}
}
|
[
"[email protected]"
] | |
c36b7592a0ace35f2f70c159c8d6339557756256
|
69b21c754b532caf27f73f6b441dea9e8612f1b8
|
/app/src/main/java/com/aurora/sampleproject2/model/db/PostDataBase.java
|
0909e9dd82d9acf36d8c25cd859fa3288deeafa4
|
[] |
no_license
|
validi/PostList
|
fa447da4807ea6a4a72348dde2716f275a7e6aa3
|
d328e650678779b849552b67b87bf34c4373b4d1
|
refs/heads/master
| 2023-04-08T04:28:33.485116 | 2021-04-23T10:45:53 | 2021-04-23T10:45:53 | 360,846,799 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,275 |
java
|
package com.aurora.sampleproject2.model.db;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;
import androidx.sqlite.db.SupportSQLiteDatabase;
import com.aurora.sampleproject2.model.db.dao.PostDao;
import com.aurora.sampleproject2.model.db.entity.Post;
@Database(entities = {Post.class},version = 1)
public abstract class PostDataBase extends RoomDatabase {
public abstract PostDao getPostDao();
public static PostDataBase instance;
public static synchronized PostDataBase getInstance(Context context){
if(instance==null){
instance= Room.databaseBuilder(context.getApplicationContext()
,PostDataBase.class
,"post_datebase"
).fallbackToDestructiveMigration()
//.addCallback(roomCallback)
.build();
}
return instance;
}
// public static RoomDatabase.Callback roomCallback=new RoomDatabase.Callback() {
// @Override
// public void onCreate(@NonNull SupportSQLiteDatabase db) {
// super.onCreate(db);
// new IntitialDataAsyncTask(instanse).execute();
// }
// };
}
|
[
"[email protected]"
] | |
38bc3b7cbe3c8909f0a5e7b55283f9b5008bcdc6
|
fae5695a5f42898b74dc02f3403bf443af6451e2
|
/corepatterns/src/com/gce/patterns/adapter/WeatherFinderImpl.java
|
950003d231d1bf28c86d81e6171638ef26dca3ae
|
[] |
no_license
|
GiedriusCeinorius/Design-Patterns
|
a103741b0e6459c193e6ad2403f508e48ab266d7
|
21f74ef6726d8948e28b86048bb4e0fd6d6e7bf4
|
refs/heads/master
| 2020-04-19T05:02:50.239563 | 2019-01-29T21:28:46 | 2019-01-29T21:28:46 | 167,977,122 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 170 |
java
|
package com.gce.patterns.adapter;
public class WeatherFinderImpl implements WeatherFinder {
@Override
public int find(String city) {
return 33;
}
}
|
[
"[email protected]"
] | |
44084968b4e7a8d1e24a0182f927b4971d89ccd7
|
f06b92f151f45feb9244379e052a9d6f57198831
|
/app/src/main/java/com/fruitsandwich/zincer/ZincSearch.java
|
abe057d3a1fb5458772c7d3529f44b35132f84cf
|
[] |
no_license
|
zaltoprofen/ZINCer
|
3768e25f1ac5a6a2ba9235cad5ecee48dc8f3c14
|
ed3af3fd9cafc6466a0cbfd4794a8a44dfdeb23c
|
refs/heads/master
| 2020-05-30T15:26:26.003869 | 2015-07-24T06:25:47 | 2015-07-24T06:25:47 | 39,605,339 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,340 |
java
|
package com.fruitsandwich.zincer;
import android.os.AsyncTask;
import android.os.Message;
import android.util.Log;
import com.google.common.collect.Lists;
import org.jsoup.HttpStatusException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import rx.Observable;
import rx.Subscriber;
/**
* Created by nakac on 15/07/21.
*/
public class ZincSearch implements Observable.OnSubscribe<ZincSearchResult> {
private static final String synonymBaseUrl = "http://zinc.docking.org/synonym/";
private static final String TAG = "ZincSearch";
private String searchQuery;
public ZincSearch(String searchQuery) {
this.searchQuery = searchQuery;
}
@Override
public void call(Subscriber<? super ZincSearchResult> subscriber) {
try {
String url = synonymBaseUrl + URLEncoder.encode(searchQuery, "utf-8");
Document doc = Jsoup.connect(url).get();
Elements xs = doc.select("li.zinc.summary-item");
for (Element x : xs) {
Element sl = x.select("a.sub-link").first();
Long zincId = sl == null ? 0 : Long.parseLong(sl.text());
String subLink = sl == null ? "" : sl.attr("href");
Element iu = x.select("img.molecule").first();
String imageUrl = iu == null ? null : iu.attr("src");
ZincSearchResult result = new ZincSearchResult(zincId, imageUrl, subLink);
Log.d(TAG, "parsed: " + result.toString());
subscriber.onNext(result);
}
subscriber.onCompleted();
} catch (HttpStatusException e) {
if (e.getStatusCode() == 404)
Log.i(TAG, "search result is empty", e);
else
Log.e(TAG, "http status is not 200", e);
subscriber.onError(e);
} catch (InterruptedIOException e){
Log.i(TAG, "interrupted requests due to other requests");
subscriber.onError(e);
} catch (IOException e) {
Log.e(TAG, "onRequest error", e);
subscriber.onError(e);
}
}
}
|
[
"[email protected]"
] | |
ec8b3e6136f0426d4ab5fa1cc17e0d427e95e427
|
c940e797b5c2e5d20fe63fd065d087fee2ca6bc3
|
/itcast_p2p_domain/src/main/java/cn/itcast/domain/city/City.java
|
a6bcf42383baba7a7008c01ee5cbe86cdf77550e
|
[] |
no_license
|
beipiaocanglang/daiyiqiao_itcast_p2p
|
bf7c909045b303312c653c387f4cf713d71c4a0a
|
e103137bc38175a603b030a5960cf7fed2b0d0fe
|
refs/heads/master
| 2021-04-15T03:50:58.012115 | 2018-03-26T06:45:00 | 2018-03-26T06:45:00 | 126,783,393 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,891 |
java
|
package cn.itcast.domain.city;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
*
* @ClassName: City
* @Description: 城市字典表
*
*/
@Entity
@Table(name="T_CITY")
public class City {
@Id
@GeneratedValue()
@Column(name="T_ID")
private Integer cityId;//城市表 主键
@Column(name="T_CITY_AREA_NUM")
private String cityAreaNum;//城市编号
@Column(name="T_CITY_NAME")
private String cityName;//城市名称
@Column(name="T_CITY_LEVEL")
@JsonIgnore
private int cityLevel;//城市级别 (0:省 ;1:市;2:县)
@Column(name="T_PARENT_CITY_NUM")
@JsonIgnore
private String parentCityAreaNum;//父级城市编号
@Transient
@JsonIgnore
private City parent;
public Integer getCityId() {
return cityId;
}
public void setCityId(Integer cityId) {
this.cityId = cityId;
}
public String getCityAreaNum() {
return cityAreaNum;
}
public void setCityAreaNum(String cityAreaNum) {
this.cityAreaNum = cityAreaNum;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public int getCityLevel() {
return cityLevel;
}
public void setCityLevel(int cityLevel) {
this.cityLevel = cityLevel;
}
public String getParentCityAreaNum() {
return parentCityAreaNum;
}
public void setParentCityAreaNum(String parentCityAreaNum) {
this.parentCityAreaNum = parentCityAreaNum;
}
public City getParent() {
return parent;
}
public void setParent(City parent) {
this.parent = parent;
}
}
|
[
"yUhU3552247687"
] |
yUhU3552247687
|
f5abed20084c53a0876209ece303f504329b9c13
|
9c1aae8a2ea0b691b46b124f18164d07f4e9e3b5
|
/app/src/main/java/com/mac/isaac/socialmediaisaac/MainActivity.java
|
f8468a3e0aceb4c4ef77f8d561bfb42bd79e38fb
|
[] |
no_license
|
isaacurbina/SocialMediaASNE
|
9d6bb21a7efe8acb3b08240f875659b4faf7d46c
|
7632a4e0fb80395cba82f3989dc4525a0a513429
|
refs/heads/master
| 2021-01-10T10:22:11.539221 | 2016-03-21T14:14:31 | 2016-03-21T14:14:31 | 54,067,189 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,551 |
java
|
package com.mac.isaac.socialmediaisaac;
import android.Manifest;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Base64;
import android.util.Log;
import android.widget.Toast;
import com.fastaccess.permission.base.PermissionHelper;
import com.fastaccess.permission.base.callback.OnPermissionCallback;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class MainActivity extends AppCompatActivity implements MainFragment.GetAccountsPermission, OnPermissionCallback {
static final String SOCIAL_NETWORK_TAG = "SocialIntegrationMain.SOCIAL_NETWORK_TAG";
private static Context context;
private static ProgressDialog pd;
final int PERMISSIONS_REQUEST_CODE = 1234;
final String PERMISSION = Manifest.permission.GET_ACCOUNTS;
PermissionHelper permissionHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
context = this;
pd = new ProgressDialog(context);
pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
pd.setCancelable(false);
pd.setCanceledOnTouchOutside(false);
printHashKey();
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new MainFragment())
.commit();
}
permissionHelper = PermissionHelper.getInstance(this);
requestPermission();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Fragment fragment = getSupportFragmentManager().findFragmentByTag(SOCIAL_NETWORK_TAG);
if (fragment != null) {
fragment.onActivityResult(requestCode, resultCode, data);
}
}
protected static void showProgress(String message) {
pd.setMessage(message);
pd.show();
}
protected static void hideProgress() {
pd.dismiss();
}
public void printHashKey() {
try {
PackageInfo info = getPackageManager().getPackageInfo("com.mac.isaac.socialmediaisaac",
PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("HASH KEY:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (PackageManager.NameNotFoundException e) {
Log.e("HASH KEY:", "NameNotFoundException "+e.getMessage());
} catch (NoSuchAlgorithmException e) {
Log.e("HASH KEY:", "NoSuchAlgorithmException "+e.getMessage());
}
}
@Override
public void requestPermission() {
Log.i("MYTAG", "requestPermission()");
if (!hasPermission()) {
Log.i("MYTAG", "setForceAccepting()");
permissionHelper.setForceAccepting(false).request(PERMISSION);
}
}
@Override
public boolean hasPermission() {
if (ContextCompat.checkSelfPermission(this, PERMISSION)
!= PackageManager.PERMISSION_GRANTED) {
return false;
} else {
return true;
}
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
Log.i("MYTAG", "onRequestPermissionsResult()");
permissionHelper.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
@Override
public void onPermissionGranted(String[] permissionName) {
Log.i("MYTAG", "onPermissionGranted()");
Intent i = new Intent(this, MainActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
}
@Override
public void onPermissionDeclined(String[] permissionName) {
Log.i("MYTAG", "onPermissionDeclined()");
}
@Override
public void onPermissionPreGranted(String permissionsName) {
Log.i("MYTAG", "onPermissionPreGranted()");
}
@Override
public void onPermissionNeedExplanation(String permissionName) {
Log.i("MYTAG", "onPermissionNeedExplanation()");
AlertDialog dialog = new AlertDialog.Builder(this)
.setTitle("Accept me")
.setMessage(permissionName)
.setPositiveButton("Request", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
permissionHelper.requestAfterExplanation(PERMISSION);
}
})
.create();
dialog.show();
}
@Override
public void onPermissionReallyDeclined(String permissionName) {
Log.i("MYTAG", "onPermissionReallyDeclined()");
}
@Override
public void onNoPermissionNeeded() {
Log.i("MYTAG", "onNoPermissionNeeded()");
}
}
|
[
"[email protected]"
] | |
545604868d8b9f66d2dba57b22cb692f454f2ef2
|
0260e9b9f8befa39871f6cd0aefb3e368f40d0ef
|
/gr.upatras.ece.wcl.radl/src-gen/gr/upatras/ece/wcl/radl/impl/ruleXMLRPCImpl.java
|
8c2219249694cd2b74d3d72495cb1781e0adf000
|
[] |
no_license
|
ctranoris/fstoolkit
|
ae84a98a9196fae4ad094e1b0aa53ef876715e37
|
4adf7fa92135a002107f0c750d1068dc39857f6f
|
refs/heads/master
| 2016-09-06T07:30:31.100001 | 2012-10-17T07:31:55 | 2012-10-17T07:31:55 | 2,185,607 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 11,281 |
java
|
/**
* <copyright>
* </copyright>
*
*/
package gr.upatras.ece.wcl.radl.impl;
import gr.upatras.ece.wcl.radl.BindingParam;
import gr.upatras.ece.wcl.radl.ConfigurationParam;
import gr.upatras.ece.wcl.radl.RadlPackage;
import gr.upatras.ece.wcl.radl.ruleXMLRPC;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>rule XMLRPC</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link gr.upatras.ece.wcl.radl.impl.ruleXMLRPCImpl#getRemoteMachine <em>Remote Machine</em>}</li>
* <li>{@link gr.upatras.ece.wcl.radl.impl.ruleXMLRPCImpl#getUsername <em>Username</em>}</li>
* <li>{@link gr.upatras.ece.wcl.radl.impl.ruleXMLRPCImpl#getPassword <em>Password</em>}</li>
* <li>{@link gr.upatras.ece.wcl.radl.impl.ruleXMLRPCImpl#getRPCMethod <em>RPC Method</em>}</li>
* <li>{@link gr.upatras.ece.wcl.radl.impl.ruleXMLRPCImpl#getURLparams <em>UR Lparams</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ruleXMLRPCImpl extends ProtocolImpl implements ruleXMLRPC
{
/**
* The cached value of the '{@link #getRemoteMachine() <em>Remote Machine</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRemoteMachine()
* @generated
* @ordered
*/
protected BindingParam remoteMachine;
/**
* The cached value of the '{@link #getUsername() <em>Username</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUsername()
* @generated
* @ordered
*/
protected BindingParam username;
/**
* The cached value of the '{@link #getPassword() <em>Password</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPassword()
* @generated
* @ordered
*/
protected BindingParam password;
/**
* The cached value of the '{@link #getRPCMethod() <em>RPC Method</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRPCMethod()
* @generated
* @ordered
*/
protected BindingParam rpcMethod;
/**
* The cached value of the '{@link #getURLparams() <em>UR Lparams</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getURLparams()
* @generated
* @ordered
*/
protected EList<ConfigurationParam> urLparams;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ruleXMLRPCImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return RadlPackage.Literals.RULE_XMLRPC;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BindingParam getRemoteMachine()
{
if (remoteMachine != null && remoteMachine.eIsProxy())
{
InternalEObject oldRemoteMachine = (InternalEObject)remoteMachine;
remoteMachine = (BindingParam)eResolveProxy(oldRemoteMachine);
if (remoteMachine != oldRemoteMachine)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, RadlPackage.RULE_XMLRPC__REMOTE_MACHINE, oldRemoteMachine, remoteMachine));
}
}
return remoteMachine;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BindingParam basicGetRemoteMachine()
{
return remoteMachine;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRemoteMachine(BindingParam newRemoteMachine)
{
BindingParam oldRemoteMachine = remoteMachine;
remoteMachine = newRemoteMachine;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, RadlPackage.RULE_XMLRPC__REMOTE_MACHINE, oldRemoteMachine, remoteMachine));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BindingParam getUsername()
{
if (username != null && username.eIsProxy())
{
InternalEObject oldUsername = (InternalEObject)username;
username = (BindingParam)eResolveProxy(oldUsername);
if (username != oldUsername)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, RadlPackage.RULE_XMLRPC__USERNAME, oldUsername, username));
}
}
return username;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BindingParam basicGetUsername()
{
return username;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setUsername(BindingParam newUsername)
{
BindingParam oldUsername = username;
username = newUsername;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, RadlPackage.RULE_XMLRPC__USERNAME, oldUsername, username));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BindingParam getPassword()
{
if (password != null && password.eIsProxy())
{
InternalEObject oldPassword = (InternalEObject)password;
password = (BindingParam)eResolveProxy(oldPassword);
if (password != oldPassword)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, RadlPackage.RULE_XMLRPC__PASSWORD, oldPassword, password));
}
}
return password;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BindingParam basicGetPassword()
{
return password;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPassword(BindingParam newPassword)
{
BindingParam oldPassword = password;
password = newPassword;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, RadlPackage.RULE_XMLRPC__PASSWORD, oldPassword, password));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BindingParam getRPCMethod()
{
if (rpcMethod != null && rpcMethod.eIsProxy())
{
InternalEObject oldRPCMethod = (InternalEObject)rpcMethod;
rpcMethod = (BindingParam)eResolveProxy(oldRPCMethod);
if (rpcMethod != oldRPCMethod)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, RadlPackage.RULE_XMLRPC__RPC_METHOD, oldRPCMethod, rpcMethod));
}
}
return rpcMethod;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BindingParam basicGetRPCMethod()
{
return rpcMethod;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRPCMethod(BindingParam newRPCMethod)
{
BindingParam oldRPCMethod = rpcMethod;
rpcMethod = newRPCMethod;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, RadlPackage.RULE_XMLRPC__RPC_METHOD, oldRPCMethod, rpcMethod));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<ConfigurationParam> getURLparams()
{
if (urLparams == null)
{
urLparams = new EObjectResolvingEList<ConfigurationParam>(ConfigurationParam.class, this, RadlPackage.RULE_XMLRPC__UR_LPARAMS);
}
return urLparams;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case RadlPackage.RULE_XMLRPC__REMOTE_MACHINE:
if (resolve) return getRemoteMachine();
return basicGetRemoteMachine();
case RadlPackage.RULE_XMLRPC__USERNAME:
if (resolve) return getUsername();
return basicGetUsername();
case RadlPackage.RULE_XMLRPC__PASSWORD:
if (resolve) return getPassword();
return basicGetPassword();
case RadlPackage.RULE_XMLRPC__RPC_METHOD:
if (resolve) return getRPCMethod();
return basicGetRPCMethod();
case RadlPackage.RULE_XMLRPC__UR_LPARAMS:
return getURLparams();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case RadlPackage.RULE_XMLRPC__REMOTE_MACHINE:
setRemoteMachine((BindingParam)newValue);
return;
case RadlPackage.RULE_XMLRPC__USERNAME:
setUsername((BindingParam)newValue);
return;
case RadlPackage.RULE_XMLRPC__PASSWORD:
setPassword((BindingParam)newValue);
return;
case RadlPackage.RULE_XMLRPC__RPC_METHOD:
setRPCMethod((BindingParam)newValue);
return;
case RadlPackage.RULE_XMLRPC__UR_LPARAMS:
getURLparams().clear();
getURLparams().addAll((Collection<? extends ConfigurationParam>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case RadlPackage.RULE_XMLRPC__REMOTE_MACHINE:
setRemoteMachine((BindingParam)null);
return;
case RadlPackage.RULE_XMLRPC__USERNAME:
setUsername((BindingParam)null);
return;
case RadlPackage.RULE_XMLRPC__PASSWORD:
setPassword((BindingParam)null);
return;
case RadlPackage.RULE_XMLRPC__RPC_METHOD:
setRPCMethod((BindingParam)null);
return;
case RadlPackage.RULE_XMLRPC__UR_LPARAMS:
getURLparams().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case RadlPackage.RULE_XMLRPC__REMOTE_MACHINE:
return remoteMachine != null;
case RadlPackage.RULE_XMLRPC__USERNAME:
return username != null;
case RadlPackage.RULE_XMLRPC__PASSWORD:
return password != null;
case RadlPackage.RULE_XMLRPC__RPC_METHOD:
return rpcMethod != null;
case RadlPackage.RULE_XMLRPC__UR_LPARAMS:
return urLparams != null && !urLparams.isEmpty();
}
return super.eIsSet(featureID);
}
} //ruleXMLRPCImpl
|
[
"tranoris@88d6be61-b049-4d1a-ac2d-38c3f0f8cafa"
] |
tranoris@88d6be61-b049-4d1a-ac2d-38c3f0f8cafa
|
d0ce78427e90e98348d30f7a74a7aee81cf3b3e5
|
204630240db672594c07c0708357a58d36c0216c
|
/IdeaProjects/JAVA1/src/HomeWorkThree.java
|
4e928ba592560d798934569594e77516be70ba10
|
[] |
no_license
|
Hozalex/project
|
d9c69a5f4c4173b2f107e1c1411d3a05b1e95fe0
|
40c907a832cfe49633df4a6c0e581cd8796a9577
|
refs/heads/master
| 2020-03-14T02:15:15.798991 | 2018-06-05T13:44:26 | 2018-06-05T13:44:26 | 131,395,644 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,969 |
java
|
import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;
public class HomeWorkThree {
public static void main(String[] args) {
words();
randomNumber();
}
private static void words() {
String[] words = {"apple", "orange", "lemon", "banana", "apricot", "avocado", "broccoli", "carrot", "cherry",
"garlic", "grape", "melon", "leak", "kiwi", "mango", "mushroom", "nut", "olive", "pea", "peanut", "pear",
"pepper", "pineapple", "pumpkin", "potato"};
Scanner sc = new Scanner(System.in);
int random = new Random().nextInt(words.length);
String secretWord = words[random];
String inputWord;
System.out.println(Arrays.toString(words));
// System.out.println(secretWord);
do {
System.out.println("Угадайте загаданное слово - ");
inputWord = sc.nextLine().toLowerCase();
int quantityLetter;
if (secretWord.length() > inputWord.length()) {
quantityLetter = inputWord.length();
} else quantityLetter = secretWord.length();
if (!inputWord.equals(secretWord)) {
System.out.println("Неверно. совпадения - ");
for (int i = 0; i < quantityLetter; i++) {
char a = inputWord.charAt(i);
char b = secretWord.charAt(i);
if (a == b) {
System.out.print(a);
} else System.out.print("#");
}
System.out.println("########");
} else System.out.println("Вы угадали!!!" + "\n");
} while (!inputWord.equals(secretWord));
}
public static void randomNumber() {
Scanner sc = new Scanner(System.in);
int number;
int secretNumber = new Random().nextInt(10);
System.out.println("Введите число от 0 до 9 - ");
for (int i = 0; i < 3; i++) {
number = sc.nextInt();
if (number < 0 || number > 9) {
System.out.println("Вы ввели не верное число...");
randomNumber();
} else if (number > secretNumber) {
System.out.println("Ваше число больше");
} else if (number < secretNumber) {
System.out.println("Ваше число меньше");
} else if (number == secretNumber) {
System.out.println("Вы выиграли!!!");
break;
}
}
System.out.println("Повторить игру еще раз? 1-да / 0-нет");
switch (sc.nextInt()) {
case (1):
randomNumber();
case (0):
break;
default:
break;
}
System.out.println();
}
}
|
[
"[email protected]"
] | |
2b16605d8b7ba2a40c1a9dc635ae0feab1568631
|
ce6353d029a2bc5373c954632b896e21d324b499
|
/s-order/order-service/src/main/java/com/example/orderservice/service/OrderInfoService.java
|
ed0ce1769c066478434fac0ba4764a9e9d860018
|
[] |
no_license
|
c1028131070/demo
|
632500f33719919320687b0d4f43ac17fea80ec2
|
bc2a222dcc75e94e8c20636fb4972e16b91549c8
|
refs/heads/master
| 2023-06-29T19:01:55.684504 | 2021-07-31T03:42:39 | 2021-07-31T03:42:39 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 529 |
java
|
package com.example.orderservice.service;
import com.example.orderservice.dao.OrderInfoDAO;
import com.example.orderservice.entity.OrderInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
@Service
public class OrderInfoService {
@Autowired
private OrderInfoDAO orderInfoDAO;
public int saveOrderInfo(OrderInfo orderInfo) {
orderInfo.setCreateTime(new Date());
return orderInfoDAO.insert(orderInfo);
}
}
|
[
"[email protected]"
] | |
03286124864a72d831009dc114e654a71b9bd886
|
9b5048f57cc196821d16211cf2ef85f5a2d49efc
|
/src/main/java/ir/ahmadi/springProject/model/Book.java
|
30d1f2ee7567bd7f322dbf2884c0b564cf416e81
|
[] |
no_license
|
bazardeh/FirstProject
|
c4aca7701ddb0ce9860b8b8e7cbe6c9cd3c6c892
|
9f2a876a97781196d96f2c6570ce1ec11c4f5a7c
|
refs/heads/master
| 2020-03-28T17:05:46.932262 | 2018-11-17T18:38:56 | 2018-11-17T18:38:56 | 148,757,709 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,555 |
java
|
package ir.ahmadi.springProject.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.annotations.OnDelete;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
@Entity
@Table(name = "Book")
public class Book {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// @NotNull
// @Size(max = 100)
// @Column(unique = true)
private String author;
private String title;
private String publisher;
private Date publicationDate;
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumn(name = "bookSubject_id", nullable = false)
private BookSubject bookSubject;
public Book() {
}
public Book(Long id, String author, String title, String publisher, Date publicationDate, BookSubject bookSubject) {
this.id = id;
this.author = author;
this.title = title;
this.publisher = publisher;
this.publicationDate = publicationDate;
this.bookSubject = bookSubject;
}
public Book(String author, String title, String publisher, Date publicationDate, BookSubject bookSubject) {
this.author = author;
this.title = title;
this.publisher = publisher;
this.publicationDate = publicationDate;
this.bookSubject = bookSubject;
}
@ManyToOne(cascade = CascadeType.ALL)
public BookSubject getBookSubject() {
return bookSubject;
}
public void setBookSubject(BookSubject bookSubject) {
this.bookSubject = bookSubject;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getPublisher() {
return publisher;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
public Date getPublicationDate() {
return publicationDate;
}
public void setPublicationDate(Date publicationDate) {
this.publicationDate = publicationDate;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Override
public String toString() {
return String.format("Book [id=%s, author=%s, title=%s, publisher=%s]", id, author, title, publisher);
}
}
|
[
"[email protected]"
] | |
7cb042275f84ceaa2567a8e042837a4cb2b9e0fc
|
ef408d9f2e1ce7b46e9bb7f946164fc76c6caedc
|
/core/src/main/java/org/infinispan/notifications/cachelistener/filter/KeyFilterAsKeyValueFilter.java
|
74b0960072e963cd550b857f94167041ef9990c8
|
[
"Apache-2.0"
] |
permissive
|
carloscurotto/infinispan
|
9d553fe22d74d6df6574ccb7aeb12c35ad70feaf
|
db60e2706e00b8f31fa47cb698f5a5e691e7f8c5
|
refs/heads/master
| 2021-01-21T09:29:15.458141 | 2014-05-08T15:35:26 | 2014-05-08T19:52:24 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,846 |
java
|
package org.infinispan.notifications.cachelistener.filter;
import org.infinispan.commons.marshall.AbstractExternalizer;
import org.infinispan.commons.util.Util;
import org.infinispan.marshall.core.Ids;
import org.infinispan.metadata.Metadata;
import org.infinispan.notifications.KeyFilter;
import org.infinispan.notifications.KeyValueFilter;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.Collection;
import java.util.Set;
/**
* KeyValueFilter that implements it's filtering solely on the use of the provided KeyFilter
*
* @author wburns
* @since 7.0
*/
public class KeyFilterAsKeyValueFilter<K, V> implements KeyValueFilter<K, V> {
private final KeyFilter<? super K> filter;
public KeyFilterAsKeyValueFilter(KeyFilter<? super K> filter) {
if (filter == null) {
throw new NullPointerException();
}
this.filter = filter;
}
@Override
public boolean accept(K key, V value, Metadata metadata) {
return filter.accept(key);
}
public static class Externalizer extends AbstractExternalizer<KeyFilterAsKeyValueFilter> {
@Override
public Set<Class<? extends KeyFilterAsKeyValueFilter>> getTypeClasses() {
return Util.<Class<? extends KeyFilterAsKeyValueFilter>>asSet(KeyFilterAsKeyValueFilter.class);
}
@Override
public void writeObject(ObjectOutput output, KeyFilterAsKeyValueFilter object) throws IOException {
output.writeObject(object.filter);
}
@Override
public KeyFilterAsKeyValueFilter readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return new KeyFilterAsKeyValueFilter((KeyFilter)input.readObject());
}
@Override
public Integer getId() {
return Ids.KEY_FILTER_AS_KEY_VALUE_FILTER;
}
}
}
|
[
"[email protected]"
] | |
26e1c8500c131657257e8d13650b76c762cb29ac
|
5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1
|
/Code Snippet Repository/Spring/Spring8315.java
|
5bb013e8e81a42ff826c9e8252b988d328a90751
|
[] |
no_license
|
saber13812002/DeepCRM
|
3336a244d4852a364800af3181e03e868cf6f9f5
|
be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9
|
refs/heads/master
| 2023-03-16T00:08:06.473699 | 2018-04-18T05:29:50 | 2018-04-18T05:29:50 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 310 |
java
|
private MockHttpServletResponse getResponse(RequestBuilder requestBuilder) throws IOException {
ResultActions resultActions;
try {
resultActions = this.mockMvc.perform(requestBuilder);
}
catch (Exception ex) {
throw new IOException(ex);
}
return resultActions.andReturn().getResponse();
}
|
[
"[email protected]"
] | |
e20cbe2034306633d32a81f773d7091aa7012b9d
|
419b71fc3d39eb03f16fdb56d7f2ef896e4997dd
|
/src/main/java/com/jacky/onjava8/onjava/CountMap.java
|
86a4c7f59957502ec623d6173aed81f7b13e4167
|
[] |
no_license
|
JackyKyoto/JavaCodingKata
|
2466fd20f276b6a76698f6ed6c2de65bbaba4a57
|
130dd155e1312e7d6ba7272ab6eebf4f130be9e6
|
refs/heads/master
| 2022-07-10T13:03:04.271728 | 2022-03-14T15:03:38 | 2022-03-14T15:03:38 | 189,159,528 | 0 | 0 | null | 2022-06-29T18:44:45 | 2019-05-29T05:57:02 |
Java
|
UTF-8
|
Java
| false | false | 2,507 |
java
|
// onjava/CountMap.java
// (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information.
// Unlimited-length Map containing sample data
// {java onjava.CountMap}
package com.jacky.onjava8.onjava;
import java.util.*;
import java.util.stream.*;
public class CountMap
extends AbstractMap<Integer,String> {
private int size;
private static char[] chars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray();
private static String value(int key) {
return
chars[key % chars.length] +
Integer.toString(key / chars.length);
}
public CountMap(int size) {
this.size = size < 0 ? 0 : size;
}
@Override
public String get(Object key) {
return value((Integer)key);
}
private static class Entry
implements Map.Entry<Integer,String> {
int index;
Entry(int index) { this.index = index; }
@Override
public boolean equals(Object o) {
return o instanceof Entry &&
Objects.equals(index, ((Entry)o).index);
}
@Override
public Integer getKey() { return index; }
@Override
public String getValue() {
return value(index);
}
@Override
public String setValue(String value) {
throw new UnsupportedOperationException();
}
@Override
public int hashCode() {
return Objects.hashCode(index);
}
}
@Override
public Set<Map.Entry<Integer,String>> entrySet() {
// LinkedHashSet retains initialization order:
return IntStream.range(0, size)
.mapToObj(Entry::new)
.collect(Collectors
.toCollection(LinkedHashSet::new));
}
public static void main(String[] args) {
final int size = 6;
CountMap cm = new CountMap(60);
System.out.println(cm);
System.out.println(cm.get(500));
cm.values().stream()
.limit(size)
.forEach(System.out::println);
System.out.println();
new Random(47).ints(size, 0, 1000)
.mapToObj(cm::get)
.forEach(System.out::println);
}
}
/* Output:
{0=A0, 1=B0, 2=C0, 3=D0, 4=E0, 5=F0, 6=G0, 7=H0, 8=I0,
9=J0, 10=K0, 11=L0, 12=M0, 13=N0, 14=O0, 15=P0, 16=Q0,
17=R0, 18=S0, 19=T0, 20=U0, 21=V0, 22=W0, 23=X0, 24=Y0,
25=Z0, 26=A1, 27=B1, 28=C1, 29=D1, 30=E1, 31=F1, 32=G1,
33=H1, 34=I1, 35=J1, 36=K1, 37=L1, 38=M1, 39=N1, 40=O1,
41=P1, 42=Q1, 43=R1, 44=S1, 45=T1, 46=U1, 47=V1, 48=W1,
49=X1, 50=Y1, 51=Z1, 52=A2, 53=B2, 54=C2, 55=D2, 56=E2,
57=F2, 58=G2, 59=H2}
G19
A0
B0
C0
D0
E0
F0
Y9
J21
R26
D33
Z36
N16
*/
|
[
"[email protected]"
] | |
709d1c284a21d8fdf35628829631080f2a13b2d2
|
81e3d8772ec2b1cc95530fe87d7794cb080f49cf
|
/readthedocs/code-tabs/java/src/test/java/nl/esciencecenter/xenon/tutorial/AllTogetherNowTest.java
|
74be40203de16730690ed53cdb72e4e48bebb41a
|
[
"Apache-2.0"
] |
permissive
|
xenon-middleware/xenon-tutorial
|
704cd25920ab008d88a6c605fa77ebcf135e782f
|
92e4e4037ab2bc67c8473ac4366ff41326a7a41c
|
refs/heads/master
| 2022-02-26T08:01:22.225051 | 2019-09-12T15:50:25 | 2019-09-12T15:50:25 | 46,869,552 | 0 | 0 |
Apache-2.0
| 2019-09-12T06:57:21 | 2015-11-25T15:19:36 |
Java
|
UTF-8
|
Java
| false | false | 841 |
java
|
package nl.esciencecenter.xenon.tutorial;
import org.junit.Rule;
import org.junit.Test;
import org.testcontainers.containers.FixedHostPortGenericContainer;
import org.testcontainers.containers.wait.strategy.Wait;
public class AllTogetherNowTest {
private final String image = "xenonmiddleware/slurm:17";
private final String host = "localhost";
private final String port = "10022";
@Rule
public FixedHostPortGenericContainer<?> slurm = new FixedHostPortGenericContainer<>(image)
.withFixedExposedPort(Integer.parseInt(port), 22)
.waitingFor(Wait.forHealthcheck());
@Test(expected = Test.None.class)
public void test1() throws Exception {
AllTogetherNow.runExample(host, port);
}
}
|
[
"[email protected]"
] | |
073c0b276a293d23c6cf5a93eda92233ec31f26c
|
34182a13cd6291fc4657546e196c6447553b5eb0
|
/corejava/corejava_1/src/main/java/com/xubh01/thread/syn/SynDemo01.java
|
5f2abb4cf6c5dc52f87e4a38d03e36708d0c4996
|
[] |
no_license
|
786991884/sxnd-study
|
9bf3d417879680f94b012867ef71ba880a19e4fc
|
8c1f8e8823c077f095dc4be0c89522b6f0eb1457
|
refs/heads/master
| 2021-01-12T08:49:59.493518 | 2018-04-03T09:17:54 | 2018-04-03T09:17:54 | 76,701,131 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,385 |
java
|
package com.xubh01.thread.syn;
public class SynDemo01 {
public static void main(String[] args) {
//真实角色
Web12306 web = new Web12306();
//代理
Thread t1 = new Thread(web, "路人甲");
Thread t2 = new Thread(web, "黄牛已");
Thread t3 = new Thread(web, "攻城师");
//启动线程
t1.start();
t2.start();
t3.start();
}
}
/**
* 线程安全的类
*/
class Web12306 implements Runnable {
private int num = 10;
private boolean flag = true;
@Override
public void run() {
while (flag) {
test5();
}
}
public void test6() {
if (num <= 0) {
flag = false; //跳出循环
return;
}
//a b c
synchronized (this) {
try {
Thread.sleep(500); //模拟 延时
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName() + "抢到了" + num--);
}
}
//线程不安全 锁定资源不正确
public void test5() {
//a b c
synchronized ((Integer) num) {
if (num <= 0) {
flag = false; //跳出循环
return;
}
try {
Thread.sleep(500); //模拟 延时
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName() + "抢到了" + num--);
}
}
//锁定范围不正确 线程不安全
public void test4() {
// c 1
synchronized (this) {
//b
if (num <= 0) {
flag = false; //跳出循环
return;
}
}
// b
try {
Thread.sleep(500); //模拟 延时
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName() + "抢到了" + num--);
}//a -->1
//线程安全 锁定正确
public void test3() {
//a b c
synchronized (this) {
if (num <= 0) {
flag = false; //跳出循环
return;
}
try {
Thread.sleep(500); //模拟 延时
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName() + "抢到了" + num--);
}
}
//线程安全 锁定正确
public synchronized void test2() {
if (num <= 0) {
flag = false; //跳出循环
return;
}
try {
Thread.sleep(500); //模拟 延时
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName() + "抢到了" + num--);
}
//线程不安全
public void test1() {
if (num <= 0) {
flag = false; //跳出循环
return;
}
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName() + "抢到了" + num--);
}
}
|
[
"[email protected]"
] | |
dfba56b9001692b85c7c96d215c7ebea2ae56aea
|
516dd8c8737c8cc4df8dcfb56f3f01d8bdc6e7cb
|
/src/org/fryslan/simple/aiofisher/tasks/DropingTask.java
|
751d1378a705f881b866b62e6492def09f2f3724
|
[] |
no_license
|
Fryslan/FryAIOFishing
|
2d09228cda9f01a6cef0f0cd76d6966f0b44c68b
|
74ad2a800184286f22fe0610680fd49e10dc7d97
|
refs/heads/master
| 2021-05-21T23:22:06.026627 | 2020-04-03T22:27:29 | 2020-04-03T22:27:29 | 252,855,214 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 822 |
java
|
package org.fryslan.simple.aiofisher.tasks;
import org.fryslan.simple.aiofisher.data.Fish;
import org.fryslan.simple.aiofisher.data.Location;
import simple.hooks.scripts.task.Task;
import simple.robot.api.ClientContext;
public class DropingTask extends Task {
private final ClientContext ctx;
private final Fish fish;
private final Location location;
private final boolean banking;
private String status = "Dropping Task";
public DropingTask(ClientContext ctx, Fish fish, Location location, boolean banking) {
super(ctx);
this.ctx = ctx;
this.fish = fish;
this.location = location;
this.banking = banking;
}
@Override
public boolean condition() {
return ctx.inventory.inventoryFull() && !banking;
}
@Override
public void run() {
}
@Override
public String status() {
return status;
}
}
|
[
"[email protected]"
] | |
52d9670ea5d360f97518f107094c940d44303af5
|
22e4572f4e718536767e77bb97a8d51899a00b4a
|
/IsaacLozanoJorgePrieto/EntregaFinal/PLCtoPascal/src/plctopascal/Lexp.java
|
5409e2d0ec2d94ef9e40647e699fda71b9e0a4c1
|
[] |
no_license
|
carls52/PL2029
|
50cf80577b6b547c7d4e3b5875d4957d5c6c3821
|
de50a3446d967a22b59f484a22b9e720ea726405
|
refs/heads/master
| 2020-05-04T07:24:15.521161 | 2019-05-20T21:01:37 | 2019-05-20T21:01:37 | 179,026,788 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 81 |
java
|
package plctopascal;
public class Lexp
{
String valor = "";
public Lexp()
{
}
}
|
[
"[email protected]"
] | |
832d88afec71dd0120716cfbb4e69e3bd8ee5813
|
987ac9f42e17d6fa53c3b2543e822e503c75ee67
|
/Day2Java/src/TimePack/SumOFTwoTimesTest.java
|
8ef0706b4f3f3d5f96859a6bf36bef7ef932ba7e
|
[] |
no_license
|
pparaska/JavaClassesObjectsAndInheritance
|
83e6111e29af0d9714ea88e650b0a06e06991e97
|
35ea823fe0fc767cec77f83bfe5d473470fd9ce1
|
refs/heads/master
| 2020-04-14T01:44:52.107021 | 2018-12-30T06:58:58 | 2018-12-30T06:58:58 | 163,568,387 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 866 |
java
|
package TimePack;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
public class SumOFTwoTimesTest {
private Time time1;
private Time time2;
private Time time3;
@Before
public void setUp() {
time1 = new Time();
time2 = new Time();
time3 = new Time();
}
@Test
public void testForSumOfHours() {
time1.set(5, 30);
time2.set(7, 40);
time3.sum(time1, time2);
assertEquals(13, time3.getHour(), 0);
}
@Test
public void testForSumOfMinutes() {
time1.set(5, 70);
time2.set(7, 20);
time3.sum(time1, time2);
assertEquals(30, time3.getMinute(), 0);
}
@Test
public void testToCheckDisplayMethod() {
time1.set(5, 70);
time2.set(7, 20);
time3.sum(time1, time2);
String actual = time3.toString();
String expected = "Time [hours=13, minutes=30]";
assertEquals(actual, expected);
}
}
|
[
"[email protected]"
] | |
1e5e357974ca39af3ae29a84a6a49d55f2731ea2
|
51e45c6154a0933591fea05db592b288f1cfdc02
|
/SmileNLP/src/main/java/smile/nlp/SimpleCorpus.java
|
428f941046d24b38416ffea267116a99f2b738fe
|
[
"Apache-2.0"
] |
permissive
|
owlmsj/smile
|
3aba0ebf58386f056c9f5ebe569ac7e0f034a43a
|
6aadcf20fcfc4903560eed07305feaaf98853e44
|
refs/heads/master
| 2021-01-21T08:57:41.150403 | 2015-05-24T14:25:00 | 2015-05-24T14:25:00 | 35,841,631 | 1 | 0 | null | 2015-05-18T20:45:00 | 2015-05-18T20:45:00 | null |
UTF-8
|
Java
| false | false | 7,946 |
java
|
/*******************************************************************************
* Copyright (c) 2010 Haifeng Li
*
* 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 smile.nlp;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import smile.nlp.dictionary.EnglishPunctuations;
import smile.nlp.dictionary.EnglishStopWords;
import smile.nlp.dictionary.Punctuations;
import smile.nlp.dictionary.StopWords;
import smile.nlp.relevance.Relevance;
import smile.nlp.relevance.RelevanceRanker;
import smile.nlp.tokenizer.SentenceSplitter;
import smile.nlp.tokenizer.SimpleSentenceSplitter;
import smile.nlp.tokenizer.SimpleTokenizer;
import smile.nlp.tokenizer.Tokenizer;
/**
* A simple implementation of corpus in main memory for small datasets.
*
* @author Haifeng Li
*/
public class SimpleCorpus implements Corpus {
/**
* The number of terms in the corpus.
*/
private long size;
/**
* The set of documents.
*/
private List<SimpleText> docs = new ArrayList<SimpleText>();
/**
* Frequency of single tokens.
*/
private HashMap<String, Integer> freq = new HashMap<String, Integer>();
/**
* Frequency of bigrams.
*/
private HashMap<Bigram, Integer> freq2 = new HashMap<Bigram, Integer>();
/**
* Inverted file storing a mapping from terms to the documents containing it.
*/
private HashMap<String, List<SimpleText>> invertedFile = new HashMap<String, List<SimpleText>>();
/**
* Sentence splitter.
*/
private SentenceSplitter splitter;
/**
* Tokenizer.
*/
private Tokenizer tokenizer;
/**
* The set of stop words.
*/
private StopWords stopWords;
/**
* The set of punctuations marks.
*/
private Punctuations punctuations;
/**
* Constructor.
*/
public SimpleCorpus() {
this(SimpleSentenceSplitter.getInstance(), new SimpleTokenizer(), EnglishStopWords.DEFAULT, EnglishPunctuations.getInstance());
}
/**
* Constructor.
*
* @param splitter the sentence splitter.
* @param tokenizer the word tokenizer.
* @param stopWords the set of stop words to exclude.
* @param punctuations the set of punctuation marks to exclude. Set to null to keep all punctuation marks.
*/
public SimpleCorpus(SentenceSplitter splitter, Tokenizer tokenizer, StopWords stopWords, Punctuations punctuations) {
this.splitter = splitter;
this.tokenizer = tokenizer;
this.stopWords = stopWords;
this.punctuations = punctuations;
}
/**
* Add a document to the corpus.
*/
public Text add(String id, String title, String body) {
ArrayList<String> bag = new ArrayList<String>();
for (String sentence : splitter.split(body)) {
String[] tokens = tokenizer.split(sentence);
for (int i = 0; i < tokens.length; i++) {
tokens[i] = tokens[i].toLowerCase();
}
for (String w : tokens) {
boolean keep = true;
if (punctuations != null && punctuations.contains(w)) {
keep = false;
} else if (stopWords != null && stopWords.contains(w)) {
keep = false;
}
if (keep) {
size++;
bag.add(w);
Integer f = freq.get(w);
if (f == null) {
f = 1;
} else {
f = f + 1;
}
freq.put(w, f);
}
}
for (int i = 0; i < tokens.length - 1; i++) {
String w1 = tokens[i];
String w2 = tokens[i + 1];
if (freq.containsKey(w1) && freq.containsKey(w2)) {
Bigram bigram = new Bigram(w1, w2);
Integer f = freq2.get(bigram);
if (f == null) {
f = 1;
} else {
f = f + 1;
}
freq2.put(bigram, f);
}
}
}
String[] words = new String[bag.size()];
for (int i = 0; i < words.length; i++) {
words[i] = bag.get(i);
}
SimpleText doc = new SimpleText(id, title, body, words);
docs.add(doc);
for (String term : doc.unique()) {
List<SimpleText> hit = invertedFile.get(term);
if (hit == null) {
hit = new ArrayList<SimpleText>();
invertedFile.put(term, hit);
}
hit.add(doc);
}
return doc;
}
@Override
public long size() {
return size;
}
@Override
public int getNumDocuments() {
return docs.size();
}
@Override
public int getNumTerms() {
return freq.size();
}
@Override
public long getNumBigrams() {
return freq2.size();
}
@Override
public int getAverageDocumentSize() {
return (int) (size / docs.size());
}
@Override
public int getTermFrequency(String term) {
Integer f = freq.get(term);
if (f == null) {
return 0;
}
return f;
}
@Override
public int getBigramFrequency(Bigram bigram) {
Integer f = freq2.get(bigram);
if (f == null) {
return 0;
}
return f;
}
@Override
public Iterator<String> getTerms() {
return freq.keySet().iterator();
}
@Override
public Iterator<Bigram> getBigrams() {
return freq2.keySet().iterator();
}
@Override
public Iterator<Text> search(String term) {
ArrayList<Text> hits = new ArrayList<Text>(invertedFile.get(term));
return hits.iterator();
}
@Override
public Iterator<Relevance> search(RelevanceRanker ranker, String term) {
List<SimpleText> hits = invertedFile.get(term);
int n = hits.size();
ArrayList<Relevance> rank = new ArrayList<Relevance>(n);
for (SimpleText doc : hits) {
int tf = doc.tf(term);
rank.add(new Relevance(doc, ranker.rank(this, doc, term, tf, n)));
}
Collections.sort(rank, Collections.reverseOrder());
return rank.iterator();
}
@Override
public Iterator<Relevance> search(RelevanceRanker ranker, String[] terms) {
Set<SimpleText> hits = new HashSet<SimpleText>();
for (int i = 0; i < terms.length; i++) {
hits.addAll(invertedFile.get(terms[i]));
}
int n = hits.size();
ArrayList<Relevance> rank = new ArrayList<Relevance>(n);
for (SimpleText doc : hits) {
double r = 0.0;
for (int i = 0; i < terms.length; i++) {
int tf = doc.tf(terms[i]);
r += ranker.rank(this, doc, terms[i], tf, n);
}
rank.add(new Relevance(doc, r));
}
Collections.sort(rank, Collections.reverseOrder());
return rank.iterator();
}
}
|
[
"[email protected]"
] | |
74576f404ab2e54e240fd591b32f8fa8a03dd4fa
|
5f82f293a77a118485defea9b513a2cb25a953f1
|
/src/main/java/com/w3villa/main/authentication/userService/RepositoryService.java
|
f1fd3d898652622c4b1027c0ce418ce65cd0aa6b
|
[] |
no_license
|
guptapriyank/RegisterProject
|
8241695aceb35f777afbfb97a4cd8596cd2e8fee
|
1a9a18b9268a52b4a7c846e4fb40484486d96739
|
refs/heads/master
| 2021-01-19T14:35:06.401517 | 2014-12-10T06:21:59 | 2014-12-10T06:21:59 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,082 |
java
|
package com.w3villa.main.authentication.userService;
import java.io.ByteArrayInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.web.multipart.MultipartFile;
import com.w3villa.upload.UploadFileResponse;
import com.w3villa.voBean.FileStream;
import com.w3villa.voBean.UploadItem;
public interface RepositoryService {
public UploadFileResponse putAsset(String path, String assetName,
InputStream asset,
HttpSession session, HttpServletRequest request,
UploadFileResponse uploadFileResponse, MultipartFile file,
UploadItem uploadItem) throws Exception;
public List<String> getAssetList(String path);
public FileStream getAssetByName(String path, String name,
HttpSession session) throws FileNotFoundException;
public String putAsset(String assetPath, String string,
ByteArrayInputStream byteArrayInputStream, MultipartFile file);
String getUrl(String key);
}
|
[
"[email protected]"
] | |
4e5e11d1f68c295c822d0465389e0decdbb61419
|
51a8140861b5ee7b3e9cdf94161e254894ace4c3
|
/springfactorybean/src/main/java/com/laibao/spring5/springfactorybean/service/TransferService.java
|
ea80e17b08672beda9dcfe3b9a8a1b3ea08941be
|
[] |
no_license
|
wanglaibao/spring5-in-action
|
76bf03dddf9c395e3eb7212ac5b675b3d0468431
|
657ef5871805824e05e2e7db4031c9ff038f3448
|
refs/heads/master
| 2018-12-24T20:40:06.681661 | 2018-10-18T04:10:43 | 2018-10-18T04:10:43 | 115,723,478 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 233 |
java
|
package com.laibao.spring5.springfactorybean.service;
/**
* @author laibao wang
* @date 2018-01-02
* @version 1.0
*/
public interface TransferService {
void transferAmount(long accountAId, long accountBId, double amount);
}
|
[
"[email protected]"
] | |
b05b94079c53ba90e7d8ab824262d659b67a393b
|
6d676ba4b3b488e787982c61530c90ab9dca25be
|
/src/ua/batimyk/fridgesolver/FridgeSolver.java
|
111a796988478e2b2bef66699eded40ce8188221
|
[] |
no_license
|
nbatyts/FridgeSolver
|
d54507ce4c795e7b9672523c2c2aa32cbcc83932
|
541097210de31177f7d21209bdf8997fac7650b8
|
refs/heads/master
| 2021-01-25T00:10:55.250488 | 2020-01-14T07:56:33 | 2020-01-14T07:56:33 | 58,741,016 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,249 |
java
|
package ua.batimyk.fridgesolver;
import java.util.*;
/**
* Created by N on 05/13/16.
* FridgeSolver
*/
public class FridgeSolver {
private FridgeNode solvedFridgeNode;
private FridgeNode rootFridgeNode;
public void setRootFridgeNode(FridgeNode rootFridgeNode) {
this.rootFridgeNode = rootFridgeNode;
}
public FridgeSolver(FridgeNode rootFridgeNode) {
this.rootFridgeNode = rootFridgeNode;
}
private List<FridgeNode> turnAllHandlers(FridgeNode parentFridgeNode) {
List<FridgeNode> fridgeNodes = new ArrayList<>();
for (int y = 0; y < parentFridgeNode.getFridge().getHandlersPositions().length; y++) {
for (int x = 0; x < parentFridgeNode.getFridge().getHandlersPositions()[y].length; x++) {
fridgeNodes.add(new FridgeNode(parentFridgeNode, x, y));
}
}
return fridgeNodes;
}
private void iterateFridge(Set<FridgeNode> parentFridgeNodes) {
boolean isOpen = false;
Set<FridgeNode> fridgeNodes = new HashSet<>();
Iterator<FridgeNode> parentFridgeNodesIterator = parentFridgeNodes.iterator();
while (parentFridgeNodesIterator.hasNext() && !isOpen) {
FridgeNode pfn = parentFridgeNodesIterator.next();
if (pfn.getFridge().isOpen()) {
isOpen = true;
solvedFridgeNode = pfn;
} else {
Iterator<FridgeNode> fridgeNodesIterator = turnAllHandlers(pfn).iterator();
while (fridgeNodesIterator.hasNext() && !isOpen) {
FridgeNode fn = fridgeNodesIterator.next();
if (fn.getFridge().isOpen()) {
isOpen = true;
solvedFridgeNode = fn;
}
fridgeNodes.add(fn);
}
}
}
if (!isOpen) {
iterateFridge(fridgeNodes);
}
}
public ArrayList<FridgeNode> getSolutionChain() {
Set<FridgeNode> parentFridgeNodes = new HashSet<>();
parentFridgeNodes.add(rootFridgeNode);
iterateFridge(parentFridgeNodes);
FridgeNode fridgeNode = solvedFridgeNode;
ArrayList<FridgeNode> fridgeNodes = new ArrayList<>();
while (!rootFridgeNode.equals(fridgeNode)) {
fridgeNodes.add(fridgeNode);
fridgeNode = fridgeNode.getParentFridgeNode();
}
Collections.reverse(fridgeNodes);
return fridgeNodes;
}
public void printSolutionTurns() {
System.out.println("Initial state: ");
System.out.println(rootFridgeNode.getFridge());
System.out.println("\nSolution:\n");
int count = 1;
for (FridgeNode fn : getSolutionChain()) {
System.out.println(count++ + ":[" + fn.getX() + "," + fn.getY() + "]" + fn.getFridge());
}
}
public static void main(String[] args) {
byte[][] pilotBroPositions = {{1, -1, 1, -1}, {-1, 1, 1, 1}, {-1, 1, 1, -1}, {-1, 1, -1, 1}};
FridgeNode rootFridgeNode = new FridgeNode(new Fridge(pilotBroPositions));
FridgeSolver fridgeSolver = new FridgeSolver(rootFridgeNode);
fridgeSolver.printSolutionTurns();
}
}
|
[
"[email protected]"
] | |
5b676a685455a9a5703f45d70dcc87e69b7dde60
|
855d512dc6c99f6f4f748518e40041fdd4537618
|
/historical/the-original-opengroove/googlecode/trunk/xsm/web/src/org/opengroove/xsm/web/client/lang/XNumber.java
|
89649c619dd4ca32b6f05206185aa68963e94c21
|
[] |
no_license
|
javawizard/everything
|
f9ea29758167d14e74962a023b60bb76c3668648
|
670d3cef911113ebbb112db1d423bfeac02cf59a
|
refs/heads/master
| 2016-09-06T09:48:07.060039 | 2014-07-07T08:50:11 | 2014-07-07T08:50:11 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 940 |
java
|
package org.opengroove.xsm.web.client.lang;
public class XNumber extends XData
{
private long value;
public long getValue()
{
return value;
}
public void setValue(long value)
{
this.value = value;
}
public String toString()
{
return "" + value;
}
public XNumber(long value)
{
super();
this.value = value;
}
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + (int) (value ^ (value >>> 32));
return result;
}
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
XNumber other = (XNumber) obj;
if (value != other.value)
return false;
return true;
}
}
|
[
"[email protected]@aa5ab2c2-dddc-11dd-993c-4d20d8c3c59d"
] |
[email protected]@aa5ab2c2-dddc-11dd-993c-4d20d8c3c59d
|
f15eeea8f36c619787128dda11dbff9f77a68432
|
eaf0e8512661ea9c5e746a8a0b06fd1a5d5c611e
|
/DVDLibrary/src/main/java/com/sg/dvdlibrary/ui/DVDLibraryView.java
|
0088ae8c5577e23aedec078e6e27d995944d40ae
|
[] |
no_license
|
Gnarlic/sg-projects
|
a98a29adbb3493ad960b2468b55c49e2c692ecb1
|
68cd1a5f810a3ecdfcc2c42372e92af1625da391
|
refs/heads/master
| 2020-04-05T18:50:27.949450 | 2018-12-02T02:10:07 | 2018-12-02T02:10:07 | 157,114,245 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 9,859 |
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.sg.dvdlibrary.ui;
import com.sg.dvdlibrary.dto.Dvd;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
*
* @author Elnic
*/
public class DVDLibraryView {
public Dvd getNewDvdInfo() {
String title = io.readString("Please enter Dvd title");
String releaseDate = io.readString("Please enter release date (MM/dd/yyy)");
String mpaaRating = io.readString("Please enter MPAA rating");
String directorName = io.readString("Please enter director name");
String studio = io.readString("Please enter studio");
String userRating = io.readString("Please Enter user rating (1-10)");
Dvd currentDvd = new Dvd(title);
currentDvd.setReleaseDate(LocalDate.parse(releaseDate, formatter));
currentDvd.setDirectorName(directorName);
currentDvd.setMpaaRating(mpaaRating);
currentDvd.setUserRating(userRating);
currentDvd.setStudio(studio);
return currentDvd;
}
public Dvd editDvd(Dvd editDvd) {
boolean editContinue = true;
int userChoice;
String title;
String releaseDate;
String mpaaRating;
String directorName;
String studio;
String userRating;
while (editContinue) {
io.print("0. Title");
io.print("1. Release Date");
io.print("2. MPAA Rating");
io.print("3. Director Name");
io.print("4. Studio");
io.print("5. User Rating");
io.print("6. Exit Editing Menu");
userChoice = io.readInt("Please choose an editing option from the list: ", 0, 6);
switch (userChoice) {
case 0:
title = io.readString("Please enter the new title: ");
editDvd.setTitle(title);
io.print("Title Changed.");
break;
case 1:
releaseDate = io.readString("Please Enter the new release date: ");
editDvd.setReleaseDate(LocalDate.parse(releaseDate, formatter));
io.print("Release date changed.");
break;
case 2:
mpaaRating = io.readString("Please enter the new MPAA rating: ");
editDvd.setMpaaRating(mpaaRating);
io.print("MPAA rating changed.");
break;
case 3:
directorName = io.readString("Please enter the new director: ");
editDvd.setDirectorName(directorName);
io.print("Director name changed.");
break;
case 4:
studio = io.readString("Please enter the new studio: ");
editDvd.setStudio(studio);
io.print("Studio name changed.");
break;
case 5:
userRating = io.readString("Please enter a new User Rating: ");
editDvd.setUserRating(userRating);
io.print("User Rating changed.");
break;
case 6:
editContinue = false;
break;
default:
io.print("Invalid option. Please choose a menu choice.");
break;
}
}
return editDvd;
}
public void displayAddDvdBanner() {
io.print("=== Add DVD ===");
}
public void displayAddSuccessBanner() {
io.readString(
"DVD successfully added. Please hit enter to continue.");
}
public void displayDvdList(List<Dvd> dvdList) {
for (Dvd currentDvd : dvdList) {
io.print(currentDvd.getTitle() + " ");
}
io.readString("Please hit enter to continue.");
}
public void displayDisplayAllBanner() {
io.print("=== Display All DVDs ===");
}
public void displayDisplayDvdBanner() {
io.print("=== Display DVD ===");
}
public String getDvdTitleChoice() {
return io.readString("Please enter the Dvd Title");
}
public void displayDvd(Dvd title) {
if (title != null) {
LocalDate date = title.getReleaseDate();
String release = date.format(formatter);
io.print("\nTitle: " + title.getTitle());
io.print("Release Date: " + release);
io.print("Director: " + title.getDirectorName());
io.print("MPAA Rating: " + title.getMpaaRating());
io.print("Studio: " + title.getStudio());
io.print("User Rating: " + title.getUserRating());
io.print("");
} else {
io.print("No such Title");
}
io.readString("Please hit enter to continue");
}
public void displayEditDvdBanner() {
io.print("=== Edit DVD ===");
}
public void displayEditSuccessBanner() {
io.print("DVD edit successful. Please hit enter to continue.");
}
public void displayRemoveDvdBanner() {
io.print("=== Remove DVD ===");
}
public void displayRemoveSuccessBanner() {
io.readString("DVD successfully removed. Please hit enter to continue.");
}
public void displayExitBanner() {
io.print("Good Bye!!!");
}
public void displayUnkownCommandBanner() {
io.print("Unknown Command!");
}
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyy");
public int printMenuAndGetSelection() {
io.print("Main Menu");
io.print("1. List DVDs");
io.print("2. Add DVD");
io.print("3. View a DVD");
io.print("4. Edit DVD");
io.print("5. Remove DVD");
io.print("6. Exit");
io.print("7. List Movies In the Last Number Of Years");
io.print("8. List Movies of Certain Rating");
io.print("9. List Movies by Certain Director");
io.print("10. List Movies by Studio");
io.print("11. Average Age of Dvd Library");
io.print("12. Get Newest Movie in Collection");
io.print("13. Get Oldest Movie in Collection");
return io.readInt("Please select from the above choice.", 1, 13);
}
private UserIO io;
public DVDLibraryView(UserIO io) {
this.io = io;
}
public void displayErrorMessage(String errorMsg) {
io.print("=== Error ===");
io.print(errorMsg);
}
public void displayLibraryAverageAge(double average) {
io.print("The average age of all titles in library is " + average + ".");
}
public String getDirector() {
return io.readString("Enter the name of the Director:");
}
public void displayMoviesFromDirector(String director, Map<String, List<Dvd>> moviesOfDirector) {
io.print("Movies directed by " + director + ":");
Set<String> ratings = moviesOfDirector.keySet();
ratings.stream()
.forEach(rating -> {
io.print("Film Rating:" + rating);
moviesOfDirector.get(rating).stream().forEach(movie -> io.print(movie.getTitle() + "(" + movie.getReleaseDate().format(DateTimeFormatter.ofPattern("yyyy")) + ")"));
});
}
public String getStudio() {
return io.readString("Enter Studio name:");
}
public int getYear() {
return io.readInt("Please enter the number of years back to list movies from:");
}
public void displayMoviesInLastNumberOfYears(int moviesSince, List<Dvd> moviesInLastNYears) {
io.print("DVDS in the last " + moviesSince + " years:");
moviesInLastNYears.stream()
.forEach(m -> io.print(m.getTitle()
+ "(" + m.getReleaseDate().format(DateTimeFormatter.ofPattern("MM/dd/yyy")) + ")" + " "
+ m.getUserRating() + " "
+ m.getMpaaRating() + " "
+ m.getDirectorName() + " "
+ m.getStudio() + " "
+ m.getUserRating()));
}
public String getRating() {
return io.readString("Please enter Rating of movies to list:");
}
public void displayMoviesOfRating(String rating, List<Dvd> moviesOfRating) {
io.print("Dvds rated " + rating);
moviesOfRating.stream()
.forEach(m -> io.print(m.getTitle()
+ "(" + m.getReleaseDate().format(DateTimeFormatter.ofPattern("MM/dd/yyyy")) + ")" + " "
+ m.getUserRating() + " "
+ m.getMpaaRating() + " "
+ m.getDirectorName() + " "
+ m.getStudio() + " "
+ m.getUserRating()));
}
public void pressEnter() {
io.readString("Press enter to continue");
}
public void displayMoviesFromStudio(String studio, List<Dvd> moviesOfStudio) {
io.print("Dvds from Studio: " + studio);
moviesOfStudio.stream()
.forEach(m -> io.print(m.getTitle()
+ "(" + m.getReleaseDate().format(DateTimeFormatter.ofPattern("MM/dd/yyyy")) + ")" + " "
+ m.getUserRating() + " "
+ m.getMpaaRating() + " "
+ m.getDirectorName() + " "
+ m.getStudio() + " "
+ m.getUserRating()));
}
}
|
[
"[email protected]"
] | |
76e4791b72d49164b9f4b4b8b6d40109775d7752
|
19f8aefc88e856b07bdeeb809cb03b7c39726484
|
/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java
|
1898e2d61320c14098946349c93acd08d2ace55a
|
[
"Apache-2.0"
] |
permissive
|
moving-bricks/spring-boot-2.1.x
|
8dd7c6ba6e43ca2ec16cc262548245ced41806ab
|
78ed6ff678b51672abdbc761019edb64de36afde
|
refs/heads/master
| 2023-01-07T09:21:31.434984 | 2019-08-14T11:41:04 | 2019-08-14T11:41:04 | 202,248,924 | 0 | 1 |
Apache-2.0
| 2022-12-27T14:44:14 | 2019-08-14T01:22:07 |
Java
|
UTF-8
|
Java
| false | false | 11,335 |
java
|
/*
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.logging.logback;
import java.net.URL;
import java.security.CodeSource;
import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.logging.Handler;
import java.util.logging.LogManager;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.joran.JoranConfigurator;
import ch.qos.logback.classic.jul.LevelChangePropagator;
import ch.qos.logback.classic.turbo.TurboFilter;
import ch.qos.logback.classic.util.ContextInitializer;
import ch.qos.logback.core.joran.spi.JoranException;
import ch.qos.logback.core.spi.FilterReply;
import ch.qos.logback.core.status.OnConsoleStatusListener;
import ch.qos.logback.core.status.Status;
import ch.qos.logback.core.util.StatusListenerConfigHelper;
import org.slf4j.ILoggerFactory;
import org.slf4j.Logger;
import org.slf4j.Marker;
import org.slf4j.bridge.SLF4JBridgeHandler;
import org.slf4j.impl.StaticLoggerBinder;
import org.springframework.boot.logging.LogFile;
import org.springframework.boot.logging.LogLevel;
import org.springframework.boot.logging.LoggerConfiguration;
import org.springframework.boot.logging.LoggingInitializationContext;
import org.springframework.boot.logging.LoggingSystem;
import org.springframework.boot.logging.LoggingSystemProperties;
import org.springframework.boot.logging.Slf4JLoggingSystem;
import org.springframework.core.env.Environment;
import org.springframework.util.Assert;
import org.springframework.util.ResourceUtils;
import org.springframework.util.StringUtils;
/**
* {@link LoggingSystem} for <a href="https://logback.qos.ch">logback</a>.
*
* @author Phillip Webb
* @author Dave Syer
* @author Andy Wilkinson
* @author Ben Hale
* @since 1.0.0
*/
public class LogbackLoggingSystem extends Slf4JLoggingSystem {
private static final String CONFIGURATION_FILE_PROPERTY = "logback.configurationFile";
private static final LogLevels<Level> LEVELS = new LogLevels<>();
static {
LEVELS.map(LogLevel.TRACE, Level.TRACE);
LEVELS.map(LogLevel.TRACE, Level.ALL);
LEVELS.map(LogLevel.DEBUG, Level.DEBUG);
LEVELS.map(LogLevel.INFO, Level.INFO);
LEVELS.map(LogLevel.WARN, Level.WARN);
LEVELS.map(LogLevel.ERROR, Level.ERROR);
LEVELS.map(LogLevel.FATAL, Level.ERROR);
LEVELS.map(LogLevel.OFF, Level.OFF);
}
private static final TurboFilter FILTER = new TurboFilter() {
@Override
public FilterReply decide(Marker marker, ch.qos.logback.classic.Logger logger, Level level, String format,
Object[] params, Throwable t) {
return FilterReply.DENY;
}
};
public LogbackLoggingSystem(ClassLoader classLoader) {
super(classLoader);
}
@Override
protected String[] getStandardConfigLocations() {
return new String[] { "logback-test.groovy", "logback-test.xml", "logback.groovy", "logback.xml" };
}
@Override
public void beforeInitialize() {
LoggerContext loggerContext = getLoggerContext();
if (isAlreadyInitialized(loggerContext)) {
return;
}
super.beforeInitialize();
loggerContext.getTurboFilterList().add(FILTER);
}
@Override
public void initialize(LoggingInitializationContext initializationContext, String configLocation, LogFile logFile) {
LoggerContext loggerContext = getLoggerContext();
if (isAlreadyInitialized(loggerContext)) {
return;
}
super.initialize(initializationContext, configLocation, logFile);
loggerContext.getTurboFilterList().remove(FILTER);
markAsInitialized(loggerContext);
if (StringUtils.hasText(System.getProperty(CONFIGURATION_FILE_PROPERTY))) {
getLogger(LogbackLoggingSystem.class.getName()).warn("Ignoring '" + CONFIGURATION_FILE_PROPERTY
+ "' system property. " + "Please use 'logging.config' instead.");
}
}
@Override
protected void loadDefaults(LoggingInitializationContext initializationContext, LogFile logFile) {
LoggerContext context = getLoggerContext();
stopAndReset(context);
boolean debug = Boolean.getBoolean("logback.debug");
if (debug) {
StatusListenerConfigHelper.addOnConsoleListenerInstance(context, new OnConsoleStatusListener());
}
LogbackConfigurator configurator = debug ? new DebugLogbackConfigurator(context)
: new LogbackConfigurator(context);
Environment environment = initializationContext.getEnvironment();
context.putProperty(LoggingSystemProperties.LOG_LEVEL_PATTERN,
environment.resolvePlaceholders("${logging.pattern.level:${LOG_LEVEL_PATTERN:%5p}}"));
context.putProperty(LoggingSystemProperties.LOG_DATEFORMAT_PATTERN, environment.resolvePlaceholders(
"${logging.pattern.dateformat:${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}}"));
new DefaultLogbackConfiguration(initializationContext, logFile).apply(configurator);
context.setPackagingDataEnabled(true);
}
@Override
protected void loadConfiguration(LoggingInitializationContext initializationContext, String location,
LogFile logFile) {
super.loadConfiguration(initializationContext, location, logFile);
LoggerContext loggerContext = getLoggerContext();
stopAndReset(loggerContext);
try {
configureByResourceUrl(initializationContext, loggerContext, ResourceUtils.getURL(location));
}
catch (Exception ex) {
throw new IllegalStateException("Could not initialize Logback logging from " + location, ex);
}
List<Status> statuses = loggerContext.getStatusManager().getCopyOfStatusList();
StringBuilder errors = new StringBuilder();
for (Status status : statuses) {
if (status.getLevel() == Status.ERROR) {
errors.append((errors.length() > 0) ? String.format("%n") : "");
errors.append(status.toString());
}
}
if (errors.length() > 0) {
throw new IllegalStateException(String.format("Logback configuration error detected: %n%s", errors));
}
}
private void configureByResourceUrl(LoggingInitializationContext initializationContext, LoggerContext loggerContext,
URL url) throws JoranException {
if (url.toString().endsWith("xml")) {
JoranConfigurator configurator = new SpringBootJoranConfigurator(initializationContext);
configurator.setContext(loggerContext);
configurator.doConfigure(url);
}
else {
new ContextInitializer(loggerContext).configureByResource(url);
}
}
private void stopAndReset(LoggerContext loggerContext) {
loggerContext.stop();
loggerContext.reset();
if (isBridgeHandlerInstalled()) {
addLevelChangePropagator(loggerContext);
}
}
private boolean isBridgeHandlerInstalled() {
if (!isBridgeHandlerAvailable()) {
return false;
}
java.util.logging.Logger rootLogger = LogManager.getLogManager().getLogger("");
Handler[] handlers = rootLogger.getHandlers();
return handlers.length == 1 && SLF4JBridgeHandler.class.isInstance(handlers[0]);
}
private void addLevelChangePropagator(LoggerContext loggerContext) {
LevelChangePropagator levelChangePropagator = new LevelChangePropagator();
levelChangePropagator.setResetJUL(true);
levelChangePropagator.setContext(loggerContext);
loggerContext.addListener(levelChangePropagator);
}
@Override
public void cleanUp() {
LoggerContext context = getLoggerContext();
markAsUninitialized(context);
super.cleanUp();
context.getStatusManager().clear();
context.getTurboFilterList().remove(FILTER);
}
@Override
protected void reinitialize(LoggingInitializationContext initializationContext) {
getLoggerContext().reset();
getLoggerContext().getStatusManager().clear();
loadConfiguration(initializationContext, getSelfInitializationConfig(), null);
}
@Override
public List<LoggerConfiguration> getLoggerConfigurations() {
List<LoggerConfiguration> result = new ArrayList<>();
for (ch.qos.logback.classic.Logger logger : getLoggerContext().getLoggerList()) {
result.add(getLoggerConfiguration(logger));
}
result.sort(CONFIGURATION_COMPARATOR);
return result;
}
@Override
public LoggerConfiguration getLoggerConfiguration(String loggerName) {
return getLoggerConfiguration(getLogger(loggerName));
}
private LoggerConfiguration getLoggerConfiguration(ch.qos.logback.classic.Logger logger) {
if (logger == null) {
return null;
}
LogLevel level = LEVELS.convertNativeToSystem(logger.getLevel());
LogLevel effectiveLevel = LEVELS.convertNativeToSystem(logger.getEffectiveLevel());
String name = logger.getName();
if (!StringUtils.hasLength(name) || Logger.ROOT_LOGGER_NAME.equals(name)) {
name = ROOT_LOGGER_NAME;
}
return new LoggerConfiguration(name, level, effectiveLevel);
}
@Override
public Set<LogLevel> getSupportedLogLevels() {
return LEVELS.getSupported();
}
@Override
public void setLogLevel(String loggerName, LogLevel level) {
ch.qos.logback.classic.Logger logger = getLogger(loggerName);
if (logger != null) {
logger.setLevel(LEVELS.convertSystemToNative(level));
}
}
@Override
public Runnable getShutdownHandler() {
return new ShutdownHandler();
}
private ch.qos.logback.classic.Logger getLogger(String name) {
LoggerContext factory = getLoggerContext();
if (StringUtils.isEmpty(name) || ROOT_LOGGER_NAME.equals(name)) {
name = Logger.ROOT_LOGGER_NAME;
}
return factory.getLogger(name);
}
private LoggerContext getLoggerContext() {
ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory();
Assert.isInstanceOf(LoggerContext.class, factory,
String.format(
"LoggerFactory is not a Logback LoggerContext but Logback is on "
+ "the classpath. Either remove Logback or the competing "
+ "implementation (%s loaded from %s). If you are using "
+ "WebLogic you will need to add 'org.slf4j' to "
+ "prefer-application-packages in WEB-INF/weblogic.xml",
factory.getClass(), getLocation(factory)));
return (LoggerContext) factory;
}
private Object getLocation(ILoggerFactory factory) {
try {
ProtectionDomain protectionDomain = factory.getClass().getProtectionDomain();
CodeSource codeSource = protectionDomain.getCodeSource();
if (codeSource != null) {
return codeSource.getLocation();
}
}
catch (SecurityException ex) {
// Unable to determine location
}
return "unknown location";
}
private boolean isAlreadyInitialized(LoggerContext loggerContext) {
return loggerContext.getObject(LoggingSystem.class.getName()) != null;
}
private void markAsInitialized(LoggerContext loggerContext) {
loggerContext.putObject(LoggingSystem.class.getName(), new Object());
}
private void markAsUninitialized(LoggerContext loggerContext) {
loggerContext.removeObject(LoggingSystem.class.getName());
}
private final class ShutdownHandler implements Runnable {
@Override
public void run() {
getLoggerContext().stop();
}
}
}
|
[
"[email protected]"
] | |
d93aa8b568d8af64cffd2cd9bde9966acc42e34d
|
baa80e63746596b7e43ecf1136fbab73d49b8599
|
/app/src/main/java/tuyenpx/kidlandstudio/flashgame/customview/adapter/view/LearningAdapter.java
|
4e0d93f64046e357a661dcc5ab38576e084386b1
|
[] |
no_license
|
tuyendt6/FlashGame
|
c84a92c79796c1845179be31eadb7d22dd9270f1
|
f9cf5efb7527b79cd032c354c104b1ebd25fae44
|
refs/heads/master
| 2021-01-20T10:42:39.992547 | 2016-09-16T08:27:54 | 2016-09-16T08:27:54 | 68,344,100 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,727 |
java
|
package tuyenpx.kidlandstudio.flashgame.customview.adapter.view;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import java.util.ArrayList;
import tuyenpx.kidlandstudio.flashgame.R;
import tuyenpx.kidlandstudio.flashgame.object.AlPhaBe;
/**
* Created by tuyenpx on 16/09/2016.
*/
public class LearningAdapter extends ArrayAdapter<AlPhaBe> {
private static class ViewHolder {
private TextView itemKey;
private TextView itemValue;
}
public LearningAdapter(Context context, int textViewResourceId, ArrayList<AlPhaBe> items) {
super(context, textViewResourceId, items);
}
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder;
if (convertView == null) {
convertView = LayoutInflater.from(this.getContext())
.inflate(R.layout.item_alphabet, parent, false);
viewHolder = new ViewHolder();
viewHolder.itemKey = (TextView) convertView.findViewById(R.id.txt_key);
viewHolder.itemValue = (TextView) convertView.findViewById(R.id.txt_value);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
AlPhaBe item = getItem(position);
if (item != null) {
// My layout has only one TextView
// do whatever you want with your string and long
viewHolder.itemKey.setText(item.getmKey());
viewHolder.itemValue.setText(item.getmValue());
}
return convertView;
}
}
|
[
"[email protected]"
] | |
3f9e6d6580089e51be7ba0f51a0f614f5de9514b
|
d1d340fe1b07ef2724e1d434032ae77579481066
|
/app/src/main/java/com/asplendid/SplendidApp/Music/MusicData.java
|
b2ee58c59e19f7c17869cb696ab51470941bfa97
|
[] |
no_license
|
arisulistio37/SplendidApp
|
dd65dbd75141e083933e8e82d4228d408e33bd37
|
f9441e8367b366f215c8fa8d12a356e6fd159b81
|
refs/heads/main
| 2023-05-19T13:38:03.534400 | 2021-06-08T11:55:36 | 2021-06-08T11:55:36 | 373,990,615 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 638 |
java
|
package com.asplendid.SplendidApp.Music;
import java.util.ArrayList;
public class MusicData {
private static String[] data_musik = {
"Otomodachi Film",
"Renai Circulation",
"Fuwa Fuwa Time",
"Glistening",
"Kizuna Music"
};
public static ArrayList<MusicItem> getListData() {
ArrayList<MusicItem> list = new ArrayList<>();
for (int position = 0; position <data_musik.length; position++) {
MusicItem mi = new MusicItem();
mi.setMusicList(data_musik[position]);
list.add(mi);
}
return list;
}
}
|
[
"[email protected]"
] | |
940713534498b138975913a292f022b18ef4c0a8
|
04406cd4df93f7b1e19953e359b17cd49e0bfd96
|
/sources/com.superking.ludo.star/java/com/ironsource/sdk/data/SSAEventCalendar.java
|
e20d1673aa6f228f0747439a769466727f3c3fbd
|
[] |
no_license
|
lancelot1337/Udo
|
97c2f2249518460960b6723940615a9665d77f43
|
2e42f9e37bc7cc47cdb95aaef1a678d20dc024b9
|
refs/heads/master
| 2021-01-25T12:01:26.726595 | 2018-03-01T15:22:22 | 2018-03-01T15:22:22 | 123,451,782 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,105 |
java
|
package com.ironsource.sdk.data;
import com.facebook.share.internal.ShareConstants;
import com.ironsource.sdk.utils.Constants.ParametersKeys;
import cz.msebera.android.httpclient.cookie.ClientCookie;
public class SSAEventCalendar extends SSAObj {
private String DAILY = "daily";
private String DAYS_IN_MONTH = "daysInMonth";
private String DAYS_IN_WEEK = "daysInWeek";
private String DAYS_IN_YEAR = "daysInYear";
private String DESCRIPTION = ShareConstants.WEB_DIALOG_PARAM_DESCRIPTION;
private String END = "end";
private String EXCEPTIONDATES = "exceptionDates";
private String EXPIRES = ClientCookie.EXPIRES_ATTR;
private String FREQUENCY = "frequency";
private String ID = ShareConstants.WEB_DIALOG_PARAM_ID;
private String INTERVAL = "interval";
private String MONTHLY = "monthly";
private String MONTHS_IN_YEAR = "monthsInYear";
private String RECURRENCE = "recurrence";
private String REMINDER = "reminder";
private String START = "start";
private String STATUS = ParametersKeys.VIDEO_STATUS;
private String WEEKLY = "weekly";
private String WEEKS_IN_MONTH = "weeksInMonth";
private String YEARLY = "yearly";
private String mDescription;
private String mEnd;
private String mStart;
public SSAEventCalendar(String value) {
super(value);
if (containsKey(this.DESCRIPTION)) {
setDescription(getString(this.DESCRIPTION));
}
if (containsKey(this.START)) {
setStart(getString(this.START));
}
if (containsKey(this.END)) {
setEnd(getString(this.END));
}
}
public String getDescription() {
return this.mDescription;
}
public void setDescription(String description) {
this.mDescription = description;
}
public String getStart() {
return this.mStart;
}
public void setStart(String Start) {
this.mStart = Start;
}
public String getEnd() {
return this.mEnd;
}
public void setEnd(String end) {
this.mEnd = end;
}
}
|
[
"[email protected]"
] | |
a8e871b1be18eb6c5c765c545ffba6a31430b675
|
82d4bbc0da0738171aa5fed2ffeef5ae104936d0
|
/src/main/java/eu/codlab/pin/PinEntrySupportFragment.java
|
abc7d9413e60198c87eaf0e01880e3a10f32221a
|
[] |
no_license
|
codlab/android-pinview
|
cd3ff4f4d519c46f2557f384040362a3973eb69d
|
22815b265d6fb8705809e8960fa23127b6e840a4
|
refs/heads/master
| 2021-01-02T23:13:21.536722 | 2014-05-14T09:16:29 | 2014-05-14T09:16:29 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 637 |
java
|
package eu.codlab.pin;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by kevinleperf on 13/05/2014.
*/
public class PinEntrySupportFragment extends Fragment {
private PinController _controller;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
View v= inflater.inflate(R.layout.activity_pin_entry_view, container, false);
_controller = new PinController();
_controller.init(this, v);
return v;
}
}
|
[
"[email protected]"
] | |
eb7646343d2d2b2894dbf42898bff1223c55b5bd
|
227a3295a12d15a8baffc27b8bafee8f496a4546
|
/src/main/java/com/school/entity/CartEntity.java
|
6f87789eef9748ed261ee53b8b395fcfb0c863e2
|
[] |
no_license
|
MasterHiei/school-web
|
946c59b7947b619b004fcb27dad430c8c1d22b84
|
f3153b44cbffbfc3a00abfe02e3efbd18f17b94b
|
refs/heads/master
| 2021-09-09T15:12:21.111059 | 2018-03-17T10:00:21 | 2018-03-17T10:00:21 | 112,478,803 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,878 |
java
|
package com.school.entity;
import java.io.Serializable;
/**
* CartEntity table: tbl_cart
*
* @author
*/
public class CartEntity implements Serializable {
/** Serial UID */
private static final long serialVersionUID = 1L;
/** tcId */
private Long tcId;
/** tcNum */
private int tcNum;
/** tdId */
private Long tdId;
/** tuId */
private Long tuId;
/** tdName */
private String tdName;
/** tdImg */
private String tdImg;
/** tdPrice */
private String tdPrice;
/** tdStock */
private String tdStock;
/**
* @return the tcId
*/
public Long getTcId() {
return this.tcId;
}
/**
* @param tcId the tcId to set
*/
public void setTcId(Long tcId) {
this.tcId = tcId;
}
/**
* @return the tcNum
*/
public int getTcNum() {
return this.tcNum;
}
/**
* @param tcNum the tcNum to set
*/
public void setTcNum(int tcNum) {
this.tcNum = tcNum;
}
/**
* @return the tdId
*/
public Long getTdId() {
return this.tdId;
}
/**
* @param tdId the tdId to set
*/
public void setTdId(Long tdId) {
this.tdId = tdId;
}
/**
* @return the tuId
*/
public Long getTuId() {
return this.tuId;
}
/**
* @param tuId the tuId to set
*/
public void setTuId(Long tuId) {
this.tuId = tuId;
}
/**
* @return the tdName
*/
public String getTdName() {
return tdName;
}
/**
* @param tdName the tdName to set
*/
public void setTdName(String tdName) {
this.tdName = tdName;
}
/**
* @return the tdImg
*/
public String getTdImg() {
return tdImg;
}
/**
* @param tdImg the tdImg to set
*/
public void setTdImg(String tdImg) {
this.tdImg = tdImg;
}
/**
* @return the tdPrice
*/
public String getTdPrice() {
return this.tdPrice;
}
/**
* @param tdPrice the tdPrice to set
*/
public void setTdPrice(String tdPrice) {
this.tdPrice = tdPrice;
}
/**
* @return the tdStock
*/
public String getTdStock() {
return tdStock;
}
/**
* @param tdStock the tdStock to set
*/
public void setTdStock(String tdStock) {
this.tdStock = tdStock;
}
/**
* 覆盖父类toString方法
*/
@Override
public String toString() {
return "CartEntity ["
+"tcId:"+tcId
+",tcNum:"+tcNum
+",tdId:"+tdId
+",tcId:"+tuId
+",tdName:"+tdName
+",tdImg:"+tdImg
+",tdPrice:"+tdPrice
+",tdStock:"+tdStock
+"]";
}
}
|
[
"[email protected]"
] | |
bcd64d337279f130e603c756d86317d6e2d185b8
|
198458ccbde4b26c1ec1b790ad8a46d0a58cb76f
|
/2_Projekt_konferencja/src/paczka_konferencja/ReadConferenceFile.java
|
51705c95fe46708fb4dc70b93e8cb9b53823b963
|
[] |
no_license
|
whiteobelix/Konferencja_
|
34d08e75e2807b0e15f440107a880d5cd2798c51
|
737c25c0a74a1ed9dc326bf2fafe474d7133a9ca
|
refs/heads/master
| 2021-01-01T04:23:52.103016 | 2017-07-13T22:47:27 | 2017-07-13T22:47:27 | 97,170,325 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 665 |
java
|
package paczka_konferencja;
import java.util.ArrayList;
import java.util.List;
import java.io.BufferedReader;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.io.IOException;
import java.util.stream.Collectors;
public class ReadConferenceFile {
public static List<String> readFile(String address) {
List<String> entryList = new ArrayList<>();
try (BufferedReader buforOdczytu = Files.newBufferedReader(Paths.get(address))) {
entryList = buforOdczytu.lines().collect(Collectors.toList());
} catch (IOException e) {
System.out.println("Błąd: nie można odczytać pliku.");
}
return entryList;
}
}
|
[
"[email protected]"
] | |
f8a2d7f8cdbaad02d997f4b178f6c0067683b6af
|
25cab8b40490573c4270fd076395ce099b84371a
|
/src/main/java/com/github/lindenb/jvarkit/util/vcf/TribbleVcfFileReader.java
|
412f9c42a957fec861907db089749f09dbfc6ae5
|
[
"MIT"
] |
permissive
|
ssivilich/jvarkit
|
385a6c196fa871e21eca420b36a94d200892619b
|
5bf5e55768acffd5fa87dd682dc47e4c3e7fdd4b
|
refs/heads/master
| 2021-01-22T16:54:18.800985 | 2015-12-14T17:23:03 | 2015-12-14T17:23:03 | 47,995,461 | 1 | 0 | null | 2015-12-14T19:08:54 | 2015-12-14T19:08:52 | null |
UTF-8
|
Java
| false | false | 3,816 |
java
|
/*
The MIT License (MIT)
Copyright (c) 2014 Pierre Lindenbaum
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.
History:
* 2015 creation
*/
package com.github.lindenb.jvarkit.util.vcf;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.util.logging.Logger;
import htsjdk.samtools.util.CloserUtil;
import htsjdk.tribble.AbstractFeatureReader;
import htsjdk.tribble.CloseableTribbleIterator;
import htsjdk.tribble.FeatureCodec;
import htsjdk.tribble.Tribble;
import htsjdk.tribble.index.Index;
import htsjdk.tribble.index.IndexFactory;
import htsjdk.tribble.readers.LineIterator;
import htsjdk.variant.variantcontext.VariantContext;
import htsjdk.variant.vcf.VCFHeader;
public class TribbleVcfFileReader
implements Closeable
{
private static final Logger LOG=Logger.getLogger("jvarkit");
private FeatureCodec<VariantContext, LineIterator> tribbleCodec=null;
private Index tribbleIndex=null;
private File source;
private AbstractFeatureReader<VariantContext,LineIterator> reader;
public TribbleVcfFileReader(File vcf) throws IOException
{
this.source=vcf;
if(vcf==null) throw new NullPointerException("vcf file==null");
if(!vcf.isFile()) throw new IOException("vcf is not a file "+vcf);
if(!vcf.canRead()) throw new IOException("cannot read "+vcf);
this.tribbleCodec = VCFUtils.createAsciiFeatureCodec();
File indexFile=Tribble.indexFile(this.source);
if(indexFile.exists() && indexFile.lastModified()> vcf.lastModified())
{
LOG.info("loading index in memory for "+this.source+" index="+indexFile);
this.tribbleIndex=IndexFactory.loadIndex(indexFile.getPath());
}
else
{
LOG.info("create index from file "+this.source);
this.tribbleIndex=IndexFactory.createLinearIndex(vcf, tribbleCodec);
}
this.reader =
AbstractFeatureReader.getFeatureReader(
vcf.getPath(),
this.tribbleCodec,
this.tribbleIndex
);
}
public File getSource()
{
return this.source;
}
public VCFHeader getHeader()
{
return VCFHeader.class.cast(this.reader.getHeader());
}
public CloseableTribbleIterator<VariantContext> iterator(String chrom,int start,int end)
throws IOException
{
if(this.reader==null) throw new IllegalStateException("Reader==null");
return this.reader.query(chrom, start, end);
}
public CloseableTribbleIterator<VariantContext> iterator()
throws IOException
{
if(this.reader==null) throw new IllegalStateException("Reader==null");
return this.reader.iterator();
}
@Override
public void close() throws IOException {
CloserUtil.close(this.reader);
this.reader=null;
this.tribbleCodec=null;
}
}
|
[
"[email protected]"
] | |
617cb46ef5576ce73205eef64fa6b9ee3caff7fe
|
cc16de383b8d4ea97d21a1b43bf4fd35b5114d19
|
/vaadin-dev-server/src/main/java/com/vaadin/base/devserver/ProductAndMessage.java
|
d3ad48eb15c165a233e316930efc4d206fc57b27
|
[
"Apache-2.0"
] |
permissive
|
vaadin/flow
|
2c1e446473a2f7d53bde4e5e41c36c96189b50f0
|
9f14bcd948457c44dfc1f5cf2ad27a43153775cf
|
refs/heads/main
| 2023-09-04T04:26:45.702508 | 2023-09-01T12:52:14 | 2023-09-01T12:52:14 | 34,809,191 | 561 | 234 |
Apache-2.0
| 2023-09-14T15:11:05 | 2015-04-29T17:54:35 |
Java
|
UTF-8
|
Java
| false | false | 1,082 |
java
|
/*
* Copyright 2000-2023 Vaadin 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.vaadin.base.devserver;
import java.io.Serializable;
import com.vaadin.pro.licensechecker.Product;
class ProductAndMessage implements Serializable {
private Product product;
private String message;
public ProductAndMessage(Product product, String message) {
this.product = product;
this.message = message;
}
public String getMessage() {
return message;
}
public Product getProduct() {
return product;
}
}
|
[
"[email protected]"
] | |
ee8f5526e84222a54a0acc2b6aeca61962a83ceb
|
2e162358239e0dbc226af659843df5489523a739
|
/gmall-oms/src/main/java/com/atguigu/gmall/oms/controller/OrderOperateHistoryController.java
|
6b2e284065f5364cf5d0a0cb5f4c68ba08231e30
|
[
"Apache-2.0"
] |
permissive
|
mly80hou/gmall
|
47f62d61039596ab9eedf6d1088066d19b5b2dba
|
60501890b2c121454889aab1866628d190c5dc02
|
refs/heads/master
| 2022-07-15T00:09:22.175238 | 2020-04-26T04:51:22 | 2020-04-26T04:51:22 | 253,181,639 | 0 | 0 |
Apache-2.0
| 2022-07-06T20:48:54 | 2020-04-05T07:45:11 |
JavaScript
|
UTF-8
|
Java
| false | false | 2,758 |
java
|
package com.atguigu.gmall.oms.controller;
import java.util.Arrays;
import java.util.Map;
import com.atguigu.core.bean.PageVo;
import com.atguigu.core.bean.QueryCondition;
import com.atguigu.core.bean.Resp;
import com.atguigu.gmall.oms.entity.OrderOperateHistoryEntity;
import com.atguigu.gmall.oms.service.OrderOperateHistoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
/**
* 订单操作历史记录
*
* @author lixianfeng
* @email [email protected]
* @date 2020-04-26 12:21:11
*/
@Api(tags = "订单操作历史记录 管理")
@RestController
@RequestMapping("sms/orderoperatehistory")
public class OrderOperateHistoryController {
@Autowired
private OrderOperateHistoryService orderOperateHistoryService;
/**
* 列表
*/
@ApiOperation("分页查询(排序)")
@GetMapping("/list")
@PreAuthorize("hasAuthority('sms:orderoperatehistory:list')")
public Resp<PageVo> list(QueryCondition queryCondition) {
PageVo page = orderOperateHistoryService.queryPage(queryCondition);
return Resp.ok(page);
}
/**
* 信息
*/
@ApiOperation("详情查询")
@GetMapping("/info/{id}")
@PreAuthorize("hasAuthority('sms:orderoperatehistory:info')")
public Resp<OrderOperateHistoryEntity> info(@PathVariable("id") Long id){
OrderOperateHistoryEntity orderOperateHistory = orderOperateHistoryService.getById(id);
return Resp.ok(orderOperateHistory);
}
/**
* 保存
*/
@ApiOperation("保存")
@PostMapping("/save")
@PreAuthorize("hasAuthority('sms:orderoperatehistory:save')")
public Resp<Object> save(@RequestBody OrderOperateHistoryEntity orderOperateHistory){
orderOperateHistoryService.save(orderOperateHistory);
return Resp.ok(null);
}
/**
* 修改
*/
@ApiOperation("修改")
@PostMapping("/update")
@PreAuthorize("hasAuthority('sms:orderoperatehistory:update')")
public Resp<Object> update(@RequestBody OrderOperateHistoryEntity orderOperateHistory){
orderOperateHistoryService.updateById(orderOperateHistory);
return Resp.ok(null);
}
/**
* 删除
*/
@ApiOperation("删除")
@PostMapping("/delete")
@PreAuthorize("hasAuthority('sms:orderoperatehistory:delete')")
public Resp<Object> delete(@RequestBody Long[] ids){
orderOperateHistoryService.removeByIds(Arrays.asList(ids));
return Resp.ok(null);
}
}
|
[
"[email protected]"
] | |
6542031c72df07485be89c47fa56c4a4c27517cf
|
864441b6f053d0ebf67a9b8342c8f85227a6db44
|
/AdapterPattern/Raboin_DuckAdapterPattern/src/adapterpkg/WildTurkey.java
|
3533d9a89b008a5336f3bea0beac73bbfef89f27
|
[] |
no_license
|
eric22r/JavaDesignPatterns
|
3aa4364709446335d7153f46835eaf8c1b3af6c8
|
bb8be99f1360406dead1259520a1cd0c80afc870
|
refs/heads/main
| 2023-06-18T03:55:48.353174 | 2021-07-02T17:44:31 | 2021-07-02T17:44:31 | 382,400,963 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 225 |
java
|
package adapterpkg;
public class WildTurkey implements Turkey
{
public void gobble()
{
System.out.println("Gobble gobble");
}
public void fly()
{
System.out.println("I'm flying a short distance");
}
}
|
[
"[email protected]"
] | |
a10863c9c315228c5aeb430bbd8f1e839d64865a
|
4365604e3579b526d473c250853548aed38ecb2a
|
/modules/dfp_appengine/src/main/java/com/google/api/ads/admanager/jaxws/v202011/AdExclusionRuleType.java
|
fe3a9d4234b7d8d8b5f7939ad73b0ab71cfbb2e1
|
[
"Apache-2.0"
] |
permissive
|
lmaeda/googleads-java-lib
|
6e73572b94b6dcc46926f72dd4e1a33a895dae61
|
cc5b2fc8ef76082b72f021c11ff9b7e4d9326aca
|
refs/heads/master
| 2023-08-12T19:03:46.808180 | 2021-09-28T16:48:04 | 2021-09-28T16:48:04 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,722 |
java
|
// Copyright 2020 Google LLC
//
// 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.google.api.ads.admanager.jaxws.v202011;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for AdExclusionRuleType.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <simpleType name="AdExclusionRuleType">
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="LABEL"/>
* <enumeration value="UNKNOWN"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "AdExclusionRuleType")
@XmlEnum
public enum AdExclusionRuleType {
/**
*
* Rule is associated with labels and is relevant only for direct reservations.
*
*
*/
LABEL,
/**
*
* The value returned if the actual value is not exposed by the requested API version.
*
*
*/
UNKNOWN;
public String value() {
return name();
}
public static AdExclusionRuleType fromValue(String v) {
return valueOf(v);
}
}
|
[
"[email protected]"
] | |
b937c8a8a40cfc0eb79e7ac1b729554c31093a16
|
a8a31336cdfbdc6619993da3224409de76a441b8
|
/src/jrds/agent/jmx/RProbeActorJMX.java
|
893159d6c4c1971c476ac46192304039240d5aaf
|
[] |
no_license
|
andris-rauda/jrdsagent
|
d50fa63975e29b7c63421ab7ee9f7c58c3ece314
|
46a9b04962c8d9c7c937272743f4d297781eefab
|
refs/heads/master
| 2023-02-23T19:14:55.175440 | 2013-10-31T16:49:31 | 2013-10-31T16:49:31 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 495 |
java
|
package jrds.agent.jmx;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import jrds.agent.RProbeActor;
public class RProbeActorJMX extends RProbeActor {
final private long starttime;
public RProbeActorJMX() {
RuntimeMXBean rtbean = ManagementFactory.getRuntimeMXBean();
starttime = rtbean.getStartTime();
}
@Override
public long getUptime() {
return System.currentTimeMillis() - starttime;
}
}
|
[
"[email protected]"
] | |
a5eaee2a914ecf00ff561a34c010ef925c021ff5
|
a84c278810057a915c559585a7a272e74e84efaa
|
/src/restaurant/stackRestaurant/test/CashierTest.java
|
6b4b59db260a2fb500a590837a9d978fb14a24ca
|
[] |
no_license
|
ryancstack/SimCity201
|
5df1c7d4233b23df2c73e82b68dc425c76b5359c
|
b5a16d25ef90ad45a860be87b12426ae85263035
|
refs/heads/master
| 2021-01-10T03:28:33.926425 | 2014-02-19T22:51:00 | 2014-02-19T22:51:00 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 19,330 |
java
|
package restaurant.stackRestaurant.test;
import gui.CurrentBuildingPanel;
import restaurant.stackRestaurant.StackCashierAgent;
import restaurant.stackRestaurant.StackCashierAgent.CheckState;
import restaurant.stackRestaurant.StackCashierAgent.CustomerState;
import restaurant.stackRestaurant.StackRestaurant;
import restaurant.stackRestaurant.helpers.Check;
import restaurant.stackRestaurant.test.mock.MockCustomer;
import restaurant.stackRestaurant.test.mock.MockWaiter;
import market.MarketCheck;
import market.test.mock.MockMarket;
import junit.framework.*;
/**
*
* This class is a JUnit test class to unit test the CashierAgent's basic interaction
* with waiters, customers, and the host.
* It is provided as an example to students in CS201 for their unit testing lab.
*
* @author Monroe Ekilah
*/
public class CashierTest extends TestCase
{
//these are instantiated for each test separately via the setUp() method.
StackCashierAgent cashier;
MockWaiter waiter;
MockCustomer customer;
MockCustomer customer2;
MockCustomer customer3;
MockMarket market;
StackRestaurant stackRestaurant;
CurrentBuildingPanel panel;
/**
* This method is run before each test. You can use it to instantiate the class variables
* for your agent and mocks, etc.
*/
public void setUp() throws Exception{
super.setUp();
cashier = new StackCashierAgent();
customer = new MockCustomer("mockcustomer");
customer2 = new MockCustomer("mockcustomer2");
customer3 = new MockCustomer("mockcustomer3");
waiter = new MockWaiter("mockwaiter");
market = new MockMarket("mockmarket");
stackRestaurant = new StackRestaurant("StackRestaurant");
cashier.setRestaurant(stackRestaurant);
waiter.setRestaurant(stackRestaurant);
panel = new CurrentBuildingPanel(stackRestaurant);
stackRestaurant.setInfoPanel(panel);
}
/**
* This tests the cashier under very simple terms: one customer is ready to pay the exact bill.
*/
public void testOneNormalCustomerScenario()
{
//check preconditions
assertEquals("Till should have 1000. It is not.", cashier.getTill(), 1000.0);
// //step 1 of the test
cashier.msgComputeCheck(waiter, customer, "Pizza");
assertEquals("MockWaiter should have one event log before the Cashier's scheduler is called. Instead, the MockWaiter's event log reads: "
+ waiter.log.toString(), 1, waiter.log.size());
assertEquals("Cashier should have 1 customer with a check. It doesn't.", cashier.getCustomers().size(), 1);
assertTrue("Cashier's customer should have a state of NeedComputing. It doesn't.", cashier.getCustomers().get(0).state == CustomerState.NeedComputing);
cashier.pickAndExecuteAnAction();
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
assertTrue("Cashier's customer should have a state of NeedComputing. It doesn't.", cashier.getCustomers().get(0).state == CustomerState.Computed);
assertTrue("Waiter should have logged \"Received check from waiter for Pizza costing 8.99\" but didn't. His log reads instead: "
+ waiter.log.getLastLoggedEvent().toString(), waiter.log.containsString("Received check from waiter for Pizza costing 8.99"));
// //step 2 of the test
Check check = new Check(8.99, customer, "Pizza");
cashier.msgPayCheck(customer, check, 10.00);
assertTrue("Cashier's customer should have a state of NeedPaying. It doesn't.", cashier.getCustomers().get(0).state == CustomerState.NeedPaying);
cashier.pickAndExecuteAnAction();
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
assertTrue("Cashier's customer should have a state of Paid. It doesn't.", cashier.getCustomers().get(0).state == CustomerState.Paid);
assertTrue("Customer should have logged \"Received 1.0099999999999998 in change\" but didn't. His log reads instead: "
+ customer.log.getLastLoggedEvent().toString(), customer.log.containsString("Received 1.0099999999999998 in change"));
assertTrue("Customer should have 0 in debt. Instead he has " + cashier.getCustomers().get(0).debt, 0 == cashier.getCustomers().get(0).debt);
assertTrue("Till should now have 1008.99 in it. Instead it has: " + cashier.getTill(), 1008.99 == cashier.getTill());
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
}
public void testCheapCustomerScenario() {
//check preconditions
assertEquals("Till should be full. It is not.", cashier.getTill(), 1000.0);
//step 1 of the test
cashier.msgComputeCheck(waiter, customer, "Pizza");
assertEquals("MockWaiter should have one event log before the Cashier's scheduler is called. Instead, the MockWaiter's event log reads: "
+ waiter.log.toString(), 1, waiter.log.size());
assertEquals("Cashier should have 1 customer with a check. It doesn't.", cashier.getCustomers().size(), 1);
assertTrue("Cashier's customer should have a state of NeedComputing. It doesn't.", cashier.getCustomers().get(0).state == CustomerState.NeedComputing);
cashier.pickAndExecuteAnAction();
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
assertTrue("Cashier's customer should have a state of NeedComputing. It doesn't.", cashier.getCustomers().get(0).state == CustomerState.Computed);
assertTrue("Waiter should have logged \"Received check from waiter for Pizza costing 8.99\" but didn't. His log reads instead: "
+ waiter.log.getLastLoggedEvent().toString(), waiter.log.containsString("Received check from waiter for Pizza costing 8.99"));
//step 2 of the test
Check check = new Check(8.99, customer, "Pizza");
cashier.msgPayCheck(customer, check, 5.00);
assertTrue("Cashier's customer should have a state of NeedPaying. It doesn't.", cashier.getCustomers().get(0).state == CustomerState.NeedPaying);
cashier.pickAndExecuteAnAction();
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
assertTrue("Cashier's customer should have a state of Paid. It doesn't.", cashier.getCustomers().get(0).state == CustomerState.Paid);
assertTrue("Customer should have logged \"Received 0.0 in change\" but didn't. His log reads instead: "
+ customer.log.getLastLoggedEvent().toString(), customer.log.containsString("Received 0.0 in change"));
assertTrue("Customer should have 3.99 in debt. Instead he has " + cashier.getCustomers().get(0).debt, 3.99 == cashier.getCustomers().get(0).debt);
assertTrue("Till should now have 1005.0 in it. Instead it has: " + cashier.getTill(), 1005.0 == cashier.getTill());
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
}
public void testThreeCustomerScenario() {
Check check1 = new Check(15.99, customer, "Steak");
Check check2 = new Check(8.99, customer, "Pizza");
Check check3 = new Check(5.99, customer, "Salad");
assertEquals("Till should be full. It is not.", cashier.getTill(), 1000.0);
cashier.msgComputeCheck(waiter, customer, "Steak");
assertEquals("Cashier should have 1 customer with a check. It doesn't.", cashier.getCustomers().size(), 1);
assertTrue("Cashier's customer should have a state of NeedComputing. It doesn't.", cashier.getCustomers().get(0).state == CustomerState.NeedComputing);
cashier.pickAndExecuteAnAction();
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
assertTrue("Cashier's customer should have a state of NeedComputing. It doesn't.", cashier.getCustomers().get(0).state == CustomerState.Computed);
assertTrue("Waiter should have logged \"Received check from waiter for Steak costing 15.99\" but didn't. His log reads instead: "
+ waiter.log.getLastLoggedEvent().toString(), waiter.log.containsString("Received check from waiter for Steak costing 15.99"));
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
cashier.msgComputeCheck(waiter, customer2, "Pizza");
assertEquals("Cashier should have 2 customer with a check. It doesn't.", cashier.getCustomers().size(), 2);
assertTrue("Cashier's customer should have a state of NeedComputing. It doesn't.", cashier.getCustomers().get(1).state == CustomerState.NeedComputing);
cashier.pickAndExecuteAnAction();
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
assertTrue("Cashier's customer should have a state of NeedComputing. It doesn't.", cashier.getCustomers().get(1).state == CustomerState.Computed);
assertTrue("Waiter should have logged \"Received check from waiter for Pizza costing 15.99\" but didn't. His log reads instead: "
+ waiter.log.getLastLoggedEvent().toString(), waiter.log.containsString("Received check from waiter for Pizza costing 8.99"));
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
cashier.msgComputeCheck(waiter, customer3, "Salad");
assertEquals("Cashier should have 3 customer with a check. It doesn't.", cashier.getCustomers().size(), 3);
assertTrue("Cashier's customer should have a state of NeedComputing. It doesn't.", cashier.getCustomers().get(2).state == CustomerState.NeedComputing);
cashier.pickAndExecuteAnAction();
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
assertTrue("Cashier's customer should have a state of NeedComputing. It doesn't.", cashier.getCustomers().get(2).state == CustomerState.Computed);
assertTrue("Waiter should have logged \"Received check from waiter for Salad costing 5.99\" but didn't. His log reads instead: "
+ waiter.log.getLastLoggedEvent().toString(), waiter.log.containsString("Received check from waiter for Salad costing 5.99"));
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
cashier.msgPayCheck(customer, check1, 20.00);
assertTrue("Cashier's customer should have a state of NeedPaying. It doesn't.", cashier.getCustomers().get(0).state == CustomerState.NeedPaying);
cashier.pickAndExecuteAnAction();
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
assertTrue("Cashier's customer should have a state of Paid. It doesn't.", cashier.getCustomers().get(0).state == CustomerState.Paid);
assertTrue("Customer should have logged \"Received 4.01 in change\" but didn't. His log reads instead: "
+ customer.log.getLastLoggedEvent().toString(), customer.log.containsString("Received 4.01 in change"));
assertTrue("Till should now have 1015.99 in it. Instead it has: " + cashier.getTill(), 1015.99 == cashier.getTill());
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
cashier.msgPayCheck(customer2, check2, 20.00);
assertTrue("Cashier's customer should have a state of NeedPaying. It doesn't.", cashier.getCustomers().get(1).state == CustomerState.NeedPaying);
cashier.pickAndExecuteAnAction();
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
assertTrue("Cashier's customer should have a state of Paid. It doesn't.", cashier.getCustomers().get(1).state == CustomerState.Paid);
assertTrue("Customer should have logged \"Received 11.01 in change\" but didn't. His log reads instead: "
+ customer2.log.getLastLoggedEvent().toString(), customer2.log.containsString("Received 11.01 in change"));
assertTrue("Till should now have 1024.98 in it. Instead it has: " + cashier.getTill(), 1024.98 == cashier.getTill());
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
cashier.msgPayCheck(customer3, check3, 3.00);
assertTrue("Cashier's customer should have a state of NeedPaying. It doesn't.", cashier.getCustomers().get(2).state == CustomerState.NeedPaying);
cashier.pickAndExecuteAnAction();
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
assertTrue("Cashier's customer should have a state of Paid. It doesn't.", cashier.getCustomers().get(2).state == CustomerState.Paid);
assertTrue("Customer should have logged \"Received 0.0 in change\" but didn't. His log reads instead: "
+ customer3.log.getLastLoggedEvent().toString(), customer3.log.containsString("Received 0.0 in change"));
assertTrue("Customer should have 2.99 in debt. Instead he has " + cashier.getCustomers().get(0).debt, 2.99 == cashier.getCustomers().get(2).debt);
assertTrue("Till should now have 1027.98 in it. Instead it has: " + cashier.getTill(), 1027.98 == cashier.getTill());
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
}
public void testRepeatCheap() {
assertEquals("Till should have 1000. It is not.", cashier.getTill(), 1000.0);
//step 1 of the test
cashier.msgComputeCheck(waiter, customer, "Pizza");
assertEquals("MockWaiter should have one event log before the Cashier's scheduler is called. Instead, the MockWaiter's event log reads: "
+ waiter.log.toString(), 1, waiter.log.size());
assertEquals("Cashier should have 1 customer with a check. It doesn't.", cashier.getCustomers().size(), 1);
assertTrue("Cashier's customer should have a state of NeedComputing. It doesn't.", cashier.getCustomers().get(0).state == CustomerState.NeedComputing);
cashier.pickAndExecuteAnAction();
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
assertTrue("Cashier's customer should have a state of NeedComputing. It doesn't.", cashier.getCustomers().get(0).state == CustomerState.Computed);
assertTrue("Waiter should have logged \"Received check from waiter for Pizza costing 8.99\" but didn't. His log reads instead: "
+ waiter.log.getLastLoggedEvent().toString(), waiter.log.containsString("Received check from waiter for Pizza costing 8.99"));
//step 2 of the test
Check check = new Check(8.99, customer, "Pizza");
cashier.msgPayCheck(customer, check, 10.00);
assertTrue("Cashier's customer should have a state of NeedPaying. It doesn't.", cashier.getCustomers().get(0).state == CustomerState.NeedPaying);
cashier.pickAndExecuteAnAction();
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
assertTrue("Cashier's customer should have a state of Paid. It doesn't.", cashier.getCustomers().get(0).state == CustomerState.Paid);
System.out.println(customer.log.getLastLoggedEvent().toString());
assertTrue("Customer should have logged \"Received 1.0099999999999998 in change\" but didn't. His log reads instead: "
+ customer.log.getLastLoggedEvent().toString(), customer.log.containsString("Received 1.0099999999999998 in change"));
assertTrue("Customer should have 0.0 in debt. Instead he has " + cashier.getCustomers().get(0).debt, 0.0 == cashier.getCustomers().get(0).debt);
assertTrue("Till should now have 1008.99 in it. Instead it has: " + cashier.getTill(), 1008.99 == cashier.getTill());
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
cashier.msgPayCheck(customer, check, 1.01);
cashier.pickAndExecuteAnAction();
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
assertTrue("Cashier's customer should have a state of Paid. It doesn't.", cashier.getCustomers().get(0).state == CustomerState.Paid);
assertTrue("Customer should have logged \"Received 0.0 in change\" but didn't. His log reads instead: "
+ customer.log.getLastLoggedEvent().toString(), customer.log.containsString("Received 0.0 in change"));
assertTrue("Customer should have 7.98 in debt. Instead he has " + cashier.getCustomers().get(0).debt, 7.98 == cashier.getCustomers().get(0).debt);
assertTrue("Till should now have 1010.0 in it. Instead it has: " + cashier.getTill(), 1010.0 == cashier.getTill());
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
}
// in the scenario that the restaurant doesn't have enough money,
// it goes into debt and will soon make the money back from selling food
public void testPayingMarketScenarioNonnorm() {
assertEquals("Till should have 1000. It is not.", cashier.getTill(), 1000.0);
MarketCheck check = new MarketCheck(200.0, "Steak", 20, market);
cashier.msgGiveBill(check);
assertEquals("Cashier should have 1 check to pay. It doesn't.", cashier.getChecks().size(), 1);
assertTrue("Cashier's check should have a state of NeedPaying. It doesn't.", cashier.getChecks().get(0).state == CheckState.NeedPaying);
cashier.pickAndExecuteAnAction();
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
assertTrue("Cashier's check should have a state of NeedPaying. It doesn't.", cashier.getChecks().get(0).state == CheckState.Paid);
assertTrue("Market should have logged \"Received msgPayForOrder from cook. Money = $20\" but didn't. His log reads instead: "
+ market.log.getLastLoggedEvent().toString(), market.log.containsString("Received msgPayForOrder from cook. Money = $200"));
assertTrue("Cashier till should be 980.0. Instead it's " + cashier.getTill(), 800.0 == cashier.getTill());
}
public void testPayingMarketScenarioRegular() {
assertEquals("Till should be at 1000. It is not.", cashier.getTill(), 1000.0);
cashier.setTill(1020);
assertEquals("Till should be 1020. It is not.", cashier.getTill(), 1020.0);
MarketCheck check = new MarketCheck(200.0, "Steak", 20, market);
cashier.msgGiveBill(check);
assertEquals("Cashier should have 1 check to pay. It doesn't.", cashier.getChecks().size(), 1);
assertTrue("Cashier's check should have a state of NeedPaying. It doesn't.", cashier.getChecks().get(0).state == CheckState.NeedPaying);
cashier.pickAndExecuteAnAction();
assertFalse("Cashier's scheduler should have returned true (one action to do), but didn't.", cashier.pickAndExecuteAnAction());
assertTrue("Cashier's check should have a state of NeedPaying. It doesn't.", cashier.getChecks().get(0).state == CheckState.Paid);
assertTrue("Market should have logged \"Received msgPayForOrder from cook. Money = $20\" but didn't. His log reads instead: "
+ market.log.getLastLoggedEvent().toString(), market.log.containsString("Received msgPayForOrder from cook. Money = $200"));
assertTrue("Cashier till should be 820.0. Instead it's " + cashier.getTill(), 820.0 == cashier.getTill());
}
}
|
[
"[email protected]"
] | |
c7961c231e9e34b54b2a89987793dbd0272c70bc
|
1fc5c3f99fc565368fb04448b8ce221090ca77d8
|
/dist/bower_components/log4js/log4js-servlet/src/main/java/de/berlios/log4js/parser/ParseException.java
|
5e9cece41ff791467a38e2600175f7a49fe2eb48
|
[
"MIT",
"Apache-2.0"
] |
permissive
|
nelsonomuto/angular-ui-form-validation
|
65735ba29565462492e6dd1816d2364e770b37bc
|
5ab88160fe3512e0a7abbb369aaf0af652753766
|
refs/heads/master
| 2021-01-18T21:23:00.406840 | 2017-10-18T19:05:43 | 2017-10-18T19:05:43 | 15,302,975 | 132 | 57 | null | 2017-10-18T01:25:43 | 2013-12-19T05:13:53 |
JavaScript
|
UTF-8
|
Java
| false | false | 987 |
java
|
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.berlios.log4js.parser;
public class ParseException extends Exception {
/**
*
*/
private static final long serialVersionUID = 7390689607047694643L;
public ParseException() {
super();
}
public ParseException(String message, Throwable cause) {
super(message, cause);
}
public ParseException(String message) {
super(message);
}
public ParseException(Throwable cause) {
super(cause);
}
}
|
[
"[email protected]"
] | |
7779f7912525cf317926b4523da4e6f6b5ac668f
|
8d6fad9fe12f7ab88d43a93de54d9fa84855517d
|
/JavaBasics/src/test/java/nested/Grade.java
|
dfb4335a66d0b0839eddfabe40d6fd692ffb2f04
|
[] |
no_license
|
Faruq2014/JavaBasics
|
4d04126fe80bc98131fc9813f19efa6757509fb7
|
66557aedd38f88c0e5f278516981a55611e4d019
|
refs/heads/main
| 2023-04-13T02:59:47.927831 | 2021-04-12T01:24:39 | 2021-04-12T01:24:39 | 319,678,585 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 816 |
java
|
package nested;
import java.util.Scanner;
public class Grade {
public static void main(String[] args) {
// TODO Auto-generated method stub
int marks;
Scanner input = new Scanner (System.in);
System.out.println("enter your marks");
marks= input.nextInt();
if(marks <60){System.out.println("Fail because you did not study enough ");}
else if(marks >=60 && marks <70){System.out.println("grade d");}
else if(marks >=70 && marks <80){System.out.println("grade c");}
else if(marks >=80 && marks <90){System.out.println("grade b");}
else if(marks >=90 && marks <=100){System.out.println("grade a");}
else {System.out.println("Dont even know your own marks");}
}
}
|
[
"[email protected]"
] | |
faf0ca90a9152c527189b73c44521614a1259c7b
|
c7910cace814f81c5b4113eefb576402f27275b0
|
/calcite/src/main/java/husky/sql/calcite/plan/rules/logical/PushFilterIntoTableScanRule.java
|
72caedb4a126a5a2ad31e1a35d2773ec4f606f3e
|
[
"Apache-2.0"
] |
permissive
|
MingyuGuan/husky-sql
|
bb6ced3089766a96651c935de6019e152843fa7e
|
40dc95b5543c079bb4ab070fca2ac2a287514333
|
refs/heads/master
| 2020-04-07T19:41:32.170386 | 2019-04-27T05:24:01 | 2019-04-27T05:24:01 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,829 |
java
|
package husky.sql.calcite.plan.rules.logical;
import husky.sql.calcite.plan.util.*;
import husky.sql.calcite.plan.nodes.logical.HuskyLogicalTableScan;
import husky.sql.calcite.plan.nodes.logical.HuskyLogicalCalc;
import org.apache.calcite.plan.RelOptRule;
import org.apache.calcite.plan.RelOptRuleCall;
import org.apache.calcite.rel.core.RelFactories;
import org.apache.calcite.rel.logical.LogicalProject;
import org.apache.calcite.rex.*;
import org.apache.calcite.tools.RelBuilderFactory;
import org.apache.calcite.tools.RelBuilder;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.stream.Collectors;
import java.util.Optional;
public class PushFilterIntoTableScanRule extends RelOptRule {
public static final PushFilterIntoTableScanRule INSTANCE =
new PushFilterIntoTableScanRule();
public PushFilterIntoTableScanRule() {
super(operand(HuskyLogicalCalc.class,
operand(HuskyLogicalTableScan.class, none())),
"PushFilterIntoTableScanRule");
}
@Override
public boolean matches(RelOptRuleCall call) {
HuskyLogicalCalc calc = call.rel(0);
HuskyLogicalTableScan scan = call.rel(1);
// only continue if condition in calc is not null and we haven't pushed down a Filter yet.
return calc.getProgram().getCondition() != null && !scan.isFilterPushDown();
}
@Override
public void onMatch(RelOptRuleCall call) {
HuskyLogicalCalc calc = call.rel(0);
HuskyLogicalTableScan scan = call.rel(1);
if(scan.isFilterPushDown()) {
return;
}
RexProgram program = calc.getProgram();
List<RexNode> remainingConditions = RexProgramExtractor
.extractConjunctiveConditions(program, call.builder().getRexBuilder());
if(remainingConditions.isEmpty()) {
// no condition can be translated to expression
return;
}
// check whether framework still need to do a filter
RelBuilder relBuilder = call.builder();
RexNode remainingCondition;
if(!remainingConditions.isEmpty()) {
relBuilder.push(scan);
Optional<RexNode> resultCondition = remainingConditions.stream()
.reduce((l, r) -> relBuilder.and(l, r));
if(resultCondition.isPresent()) {
remainingCondition = resultCondition.get();
} else {
remainingCondition = null;
}
} else {
remainingCondition = null;
}
// check whether we still need a RexProgram. An RexProgram is needed when either
// projection or filter exists.
HuskyLogicalTableScan newScan = scan.copy(scan.getTraitSet(), scan.fields);
if(scan.fields.length == 0) {
// no projection in table scan; directly copy condition
newScan.applyPredicateByCopy(remainingCondition);
} else {
// projection has been pushed down; convert back to original index
newScan.applyPredicate(remainingCondition, scan.fields);
}
RexProgram newCalProgram;
// if(remainingCondition != null || !program.projectsOnlyIdentity()) {
if(!program.projectsOnlyIdentity()) {
List<RexNode> expandedProjectList = program.getProjectList().stream()
.map(ref -> program.expandLocalRef(ref))
.collect(Collectors.toList());
newCalProgram = RexProgram.create(
program.getInputRowType(),
expandedProjectList,
// remainingCondition,
null,
program.getOutputRowType(),
relBuilder.getRexBuilder());
} else {
newCalProgram = null;
}
if(newCalProgram != null) {
call.transformTo(calc.copy(calc.getTraitSet(), newScan, newCalProgram));
} else {
call.transformTo(newScan);
}
}
private int[] getProjectFields(List<RexNode> exps) {
final int[] fields = new int[exps.size()];
for(int i = 0; i < exps.size(); i++) {
final RexNode exp = exps.get(i);
if(exp instanceof RexInputRef) {
fields[i] = ((RexInputRef) exp).getIndex();
} else {
return null; // not a simple projection
}
}
return fields;
}
}
|
[
"[email protected]"
] | |
c6906e888ee7d1be42f7d2f6e296104d734c04be
|
52a13118c6fb1fe93cd2b653d5344683b168eeb8
|
/src/com/demo/game/Plane.java
|
864cc712c8c7e531e58823885d85ce7e9a465ae0
|
[] |
no_license
|
1379observer/PlaneGame
|
082c7afc5cf439054b0753e05c7f41c2ea9e8636
|
9d5d88f6935e15b77aecbdc41b16e1cd1a8d09ea
|
refs/heads/master
| 2020-05-30T23:28:55.680098 | 2019-06-03T13:47:00 | 2019-06-03T13:47:00 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,304 |
java
|
package com.demo.game;
import java.awt.*;
public class Plane extends GameObject {
public static Image image_me;
public int life;//生命值
public int restart;//重启时间延迟
public double fire;//火力
public boolean alive;//存活状态
//初始化飞机图片
static {
image_me = Tools.loadImage("images/123.png");
}
public Plane(){
super(image_me, GamePanel.PANEL_WIDTH/2-35, GamePanel.PANEL_HEIGHT-70, 70, 70, 0, 0);
life=3;
restart=0;//初始不需要延迟
alive=true;
}
public boolean isAlive(){
return alive;
}
public boolean setalive(boolean alive){
return this.alive = alive;
}
public int getrestart(){
return restart;
}
public void setrestart(int restart){
this.restart = restart;
}
//子弹需要从飞机前头中心射出
public PlaneBullet shoot(){
return new PlaneBullet(this.x+(this.width-PlaneBullet.width)/2,this.y-PlaneBullet.height);
}
@Override
public void move() {
}
public void move(int x, int y) {
this.x=x-35;
this.y=y-35;
}
public int getLife() {
return this.life;
}
public void setlife(int life){
this.life = life;
}
}
|
[
"[email protected]"
] | |
d1ea52db121ab593a82110f48ac9ee36995d4daf
|
9a52eeaf13f9f7593dbe3de539469aca1c233757
|
/common/src/main/java/com/android/tv/common/WeakHandler.java
|
87a7a14cce89e4a38253a2f64b5e034a2bc77d74
|
[] |
no_license
|
johnjcool/TV
|
1942eb4c34bb753e8dbf16ebd99114cf0a3a26da
|
e1ed59a055c41dcdc72e49df7175c5fa469374ad
|
refs/heads/master
| 2020-03-31T22:30:02.802799 | 2018-10-11T17:19:30 | 2018-10-11T17:19:30 | 152,620,829 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,674 |
java
|
/*
* Copyright (C) 2015 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
*/
package com.android.tv.common;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.support.annotation.NonNull;
import java.lang.ref.WeakReference;
/**
* A Handler that keeps a {@link WeakReference} to an object.
*
* <p>Use this to prevent leaking an Activity or other Context while messages are still pending.
* When you extend this class you <strong>MUST NOT</strong> use a non static inner class, or the
* containing object will still be leaked.
*
* <p>See <a href="http://android-developers.blogspot.com/2009/01/avoiding-memory-leaks.html">
* Avoiding memory leaks</a>.
*/
public abstract class WeakHandler<T> extends Handler {
private final WeakReference<T> mRef;
/**
* Constructs a new handler with a weak reference to the given referent using the provided
* Looper instead of the default one.
*
* @param looper The looper, must not be null.
* @param ref the referent to track
*/
public WeakHandler(@NonNull Looper looper, T ref) {
super(looper);
mRef = new WeakReference<>(ref);
}
/**
* Constructs a new handler with a weak reference to the given referent.
*
* @param ref the referent to track
*/
public WeakHandler(T ref) {
mRef = new WeakReference<>(ref);
}
/** Calls {@link #handleMessage(Message, Object)} if the WeakReference is not cleared. */
@Override
public final void handleMessage(Message msg) {
T referent = mRef.get();
if (referent == null) {
return;
}
handleMessage(msg, referent);
}
/**
* Subclasses must implement this to receive messages.
*
* <p>If the WeakReference is cleared this method will no longer be called.
*
* @param msg the message to handle
* @param referent the referent. Guaranteed to be non null.
*/
protected abstract void handleMessage(Message msg, @NonNull T referent);
}
|
[
"[email protected]"
] | |
b30c0897efe13d7796033e8d42991b51ff2cdd08
|
6508ad5517d0b534035e019f93a3b8f080701ba1
|
/src/test/java/com/sda/spring/service/TransferHistoryServiceTest.java
|
acf89e85efca801a4507893f2805e9997b13e8b1
|
[] |
no_license
|
marcincagara/Bank-Service
|
534a9bc975a67220693e0503a9eef561753b4da0
|
b669f9aba70dc3f237cf0b885382aca79059c019
|
refs/heads/master
| 2020-03-18T19:32:28.907198 | 2018-05-28T12:51:37 | 2018-05-28T12:51:37 | 135,160,304 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,103 |
java
|
package com.sda.spring.service;
import com.sda.spring.entity.TransferHistory;
import com.sda.spring.repository.TransferHistoryRepository;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.*;
import static org.mockito.MockitoAnnotations.initMocks;
public class TransferHistoryServiceTest {
private TransferHistoryServiceImpl testedObject;
@Mock
private TransferHistoryRepository mockedTransferHistoryRepository;
@Before
public void setUp() throws Exception {
initMocks(this);
testedObject = new TransferHistoryServiceImpl(mockedTransferHistoryRepository);
}
@Test
public void shouldReturnAllTransferHistories() throws Exception {
when(mockedTransferHistoryRepository.findAll()).thenReturn(getAllTransferHistories());
List<TransferHistory> thList = testedObject.getAllTransferHistories();
assertThat(thList).isNotEmpty();
assertThat(thList).isNotNull();
assertThat(thList.size()).isEqualTo(4);
}
@Test
public void shouldAddNewTransferHistory() throws Exception {
TransferHistory transferHistory = new TransferHistory();
when(mockedTransferHistoryRepository.save(transferHistory)).thenReturn(transferHistory);
testedObject.addTransferHistory(transferHistory);
verify(mockedTransferHistoryRepository, times(1)).save(transferHistory);
}
@Test
public void shouldReturnTransferHistoryForSpecificAccountWhenBankAccountNumberPassed() throws Exception {
when(mockedTransferHistoryRepository.findTransferHistoriesByBankAccountNumberFromOrderByDateDesc("123"))
.thenReturn(getAllTransferHistories());
List<TransferHistory> transferHistory = testedObject.getTransferHistoryForSpecificAccount("123");
assertThat(transferHistory).isNotNull();
assertThat(transferHistory).isNotEmpty();
assertThat(transferHistory.size()).isEqualTo(4);
assertThat(transferHistory.get(0).getAmount()).isEqualTo(new BigDecimal("25.00"));
}
private List<TransferHistory> getAllTransferHistories(){
List<TransferHistory> result = new ArrayList<>();
TransferHistory th1 = new TransferHistory("123","456","Title",
LocalDateTime.of(2011,1,23,11,58), new BigDecimal("25.00"));
TransferHistory th2 = new TransferHistory("123","456","Title",
LocalDateTime.of(2011,1,23,12,8), new BigDecimal("725.09"));
TransferHistory th3 = new TransferHistory("123","456","Title",
LocalDateTime.of(2011,11,2,11,58), new BigDecimal("5.10"));
TransferHistory th4 = new TransferHistory("123","456","Title",
LocalDateTime.of(2011,5,3,11,58), new BigDecimal("85.47"));
result.add(th1);
result.add(th2);
result.add(th3);
result.add(th4);
return result;
}
}
|
[
"[email protected]"
] | |
a07b32af56a4f11cc57e7fe07ed3d6c6d5fb67a0
|
87d51a562c3a2ab42a36c7c44ee8d31e8a8d9dc4
|
/src/main/java/com/jayqqaa12/dp/Solution152.java
|
d55a8768e77cab02a0e6863c3c78e0c8d6f66209
|
[] |
no_license
|
jayqqaa12/leetcode-exercise
|
70b0d103575b6260c3be82ed4244b87969a3029a
|
2613d5449819a478fef2a4accd0ea605e21611a0
|
refs/heads/master
| 2020-04-06T07:07:05.236438 | 2016-09-09T03:59:28 | 2016-09-09T03:59:28 | 61,536,729 | 8 | 3 | null | null | null | null |
UTF-8
|
Java
| false | false | 658 |
java
|
package com.jayqqaa12.dp;
/**
*
* 从数组中找到 子数组的最大乘积
*
* 难度2星
*
*
*/
public class Solution152 {
/**
* 保留最大值会最小值
* @param nums
* @return
*/
public int maxProduct(int[] nums) {
if(nums==null||nums.length==0)return 0;
int max =nums[0],min=nums[0],rst=nums[0];
for (int i = 0; i < nums.length; i++) {
int temp =max;
max = Math.max(Math.max(min*nums[i], nums[i]*max),nums[i]);
min = Math.min(Math.min(min*nums[i], nums[i]*temp),nums[i]);
rst = Math.max(rst,max);
}
return rst;
}
}
|
[
"[email protected]"
] | |
5e2573aa415b58594b22310270b4021fc9abed31
|
784bb0ab1c2fefa12db60275927e212345ac7538
|
/git_test_project/src/my/git/test/Student.java
|
517b6614804dc03d08a2309dd1a9f1f9bb0a40b6
|
[] |
no_license
|
kindirt/tjoeun202108
|
17288791cec3ad885acc2fce29787a1282880c10
|
0448d5210b70f562b7ac6f5100ff41f19b4c1d3a
|
refs/heads/master
| 2023-08-11T01:10:18.756614 | 2021-10-04T06:53:48 | 2021-10-04T06:53:48 | 413,296,259 | 0 | 0 | null | 2021-10-05T02:08:16 | 2021-10-04T06:14:41 |
Java
|
UTF-8
|
Java
| false | false | 506 |
java
|
package my.git.test;
public class Student {
private String name;
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
@Override
public String toString() {
return "Student [name=" + name + ", age=" + age + "]";
}
public Student(String name, int age) {
super();
this.name = name;
this.age = age;
}
}
|
[
"HP@DESKTOP-R997P7V"
] |
HP@DESKTOP-R997P7V
|
0daf88f4a7913d9e7ce3e1794422210f413f8900
|
233994b4ad1aff4fc1c1734bffd2bf628b420a56
|
/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalDivider.java
|
c395b91d55264136b97fe7e457f3086c5ce3c56f
|
[] |
no_license
|
dashersw/plantuml
|
76e3ac9a060ed63176636e75fb90b52ba77b3ee7
|
131cb71d6cd37de288463c6231228717f8f9bf15
|
refs/heads/master
| 2020-03-26T17:14:01.069156 | 2012-07-11T13:30:04 | 2012-07-11T13:30:04 | 2,986,490 | 6 | 3 | null | 2012-07-11T13:30:05 | 2011-12-15T09:18:48 |
Java
|
UTF-8
|
Java
| false | false | 2,573 |
java
|
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML 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.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 3916 $
*
*/
package net.sourceforge.plantuml.sequencediagram.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.skin.Area;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.ugraphic.UGraphic;
class GraphicalDivider extends GraphicalElement {
private final Component comp;
public GraphicalDivider(double startingY, Component comp) {
super(startingY);
this.comp = comp;
}
@Override
protected void drawInternalU(UGraphic ug, double maxX, Context2D context) {
ug.translate(0, getStartingY());
final StringBounder stringBounder = ug.getStringBounder();
final Dimension2D dim = new Dimension2DDouble(maxX, comp.getPreferredHeight(stringBounder));
comp.drawU(ug, new Area(dim), context);
}
@Override
public double getPreferredHeight(StringBounder stringBounder) {
return comp.getPreferredHeight(stringBounder);
}
@Override
public double getPreferredWidth(StringBounder stringBounder) {
return comp.getPreferredWidth(stringBounder);
}
@Override
public double getStartingX(StringBounder stringBounder) {
return 0;
}
}
|
[
"arnaud_roques@28b6c6c1-be0e-40f3-8fed-77912e9d39c1"
] |
arnaud_roques@28b6c6c1-be0e-40f3-8fed-77912e9d39c1
|
9edc22d023116c391751239d1e3b36830f52e4b1
|
fde3996fd37a073ff3097753f7fa7b746088a965
|
/src/com/liu/service/Impl/UserServiceImpl.java
|
4a619df14fe392298be34f1ae2468c00deda7876
|
[] |
no_license
|
lbq972149981/Blog_liu
|
60de2dd4fda6e165c3731524f4b1adc3583ca0ff
|
8c6814736fbd40e0bf33614a302b06f1cd1d4f16
|
refs/heads/master
| 2020-03-23T12:03:13.535627 | 2018-07-19T06:28:41 | 2018-07-19T06:28:41 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,159 |
java
|
package com.liu.service.Impl;
import com.liu.bean.mapper.UserMapper;
import com.liu.bean.po.User;
import com.liu.service.UserService;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
@Component("userService")
public class UserServiceImpl implements UserService{
@Resource
private UserMapper userMapper;
@Override
public int updateUser(User user) {
return userMapper.updateUser(user);
}
@Override
public List<User> selectUsers() {
return userMapper.selectUsers();
}
@Override
public int alterpwd(User user) {
return userMapper.alterpwd(user);
}
@Override
public int insertUser(User user) {
return userMapper.insertUser(user);
}
@Override
public List<User> searchregisterDateCount(String date) {
return userMapper.searchregisterDateCount(date);
}
@Override
public List<User> selectByrole(String role) {
return userMapper.selectByrole(role);
}
@Override
public int updateSilenceFlag(int id) {
return userMapper.updateSilenceFlag(id);
}
@Override
public int deleteUser(int id) {
return userMapper.deleteUser(id);
}
@Override
public int batchDeleteUsers(List<Integer> ids) {
return userMapper.batchDeleteUsers(ids);
}
@Override
public int batchSilenceUsers(List<Integer> ids) {
return userMapper.batchSilenceUsers(ids);
}
@Override
public int RemoveSilenceUser(int id) {
return userMapper.RemoveSilenceUser(id);
}
@Override
public List<User> searchUsersByregisterDate(String registerDate) {
return userMapper.searchUsersByregisterDate(registerDate);
}
@Override
public List<User> searchUsersBySex(String sex) {
return userMapper.searchUsersBySex(sex);
}
@Override
public int updateloginFlag(User user) {
return userMapper.updateloginFlag(user);
}
@Override
public User selectByid(int id) {
return userMapper.selectByid(id);
}
@Override
public List<String> selectnicknameByids(List<Integer> ids) {
return userMapper.selectnicknameByids(ids);
}
}
|
[
"[email protected]"
] | |
6e99e9b90e7e39905f7413e604ddcaa8e21e12bf
|
38e7e5e5e8d9d2196911f60847e3b3ac035c8cad
|
/crm/crm/src/main/java/com/tianpingpai/crm/ui/BuyerCustomersViewController.java
|
1f619e73ab3aef783b244632cc7f1c87e703fa7e
|
[] |
no_license
|
RogerLwr/TPP
|
7173fa82ee551311b10c5c74906cb101730d6222
|
8c568bc71f33bca6fb32cc465db5e621a93d9e6d
|
refs/heads/master
| 2021-06-30T02:22:56.796460 | 2017-09-16T06:28:40 | 2017-09-16T06:28:40 | 103,729,317 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 16,946 |
java
|
package com.tianpingpai.crm.ui;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.SearchView;
import android.util.Log;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.tianpingpai.core.ContextProvider;
import com.tianpingpai.core.ModelStatusListener;
import com.tianpingpai.crm.R;
import com.tianpingpai.crm.adapter.CustomerAdapter;
import com.tianpingpai.crm.adapter.CustomerFilterAdapter;
import com.tianpingpai.http.HttpError;
import com.tianpingpai.http.HttpRequest;
import com.tianpingpai.http.volley.VolleyDispatcher;
import com.tianpingpai.manager.CustomerEvent;
import com.tianpingpai.manager.CustomerManager;
import com.tianpingpai.manager.UserManager;
import com.tianpingpai.model.CustomerModel;
import com.tianpingpai.model.MarketModel;
import com.tianpingpai.model.Model;
import com.tianpingpai.model.URLApi;
import com.tianpingpai.parser.JSONListParser;
import com.tianpingpai.parser.ListResult;
import com.tianpingpai.ui.ActionSheet;
import com.tianpingpai.ui.CommonErrorHandler;
import com.tianpingpai.ui.EmptyView;
import com.tianpingpai.ui.Layout;
import com.tianpingpai.ui.ModelAdapter;
import com.tianpingpai.user.UserEvent;
import com.tianpingpai.user.UserModel;
import com.tianpingpai.utils.DimensionUtil;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
@EmptyView(imageResource = R.drawable.ic_1510_empty_view,text = R.string.empty_customers)
@Layout(id = R.layout.fragment_customers)
public class BuyerCustomersViewController extends CrmBaseViewController {
public static final String KEY_DATE_TYPE = "Key.dateType";
public static final String KEY_USER_TYPE = "Key.userType";
public static final String KEY_CUSTOMER_TYPE = "Key.customerType";
public static final String KEY_IS_ITEM_CLICK = "Key.isClick"; //是否可点击 (只有冲个人中心进来 item 才可以点击)
public static final String KEY_TITLE = "Key.title";
public static final String KEY_IS_VISIBLE_BTN = "Key.isVisibleBtn";
public static final String KEY_APPROVAL_GONE = "Key.approvalGone";
private String dateType;
private String userType = "1";// 默认买家
private String title;
private int customerType = 0;
private String searchText;
private TextView rightBtn;
boolean isSearchClose;
private CustomerAdapter customersAdapter = new CustomerAdapter();
private BuyerCustomerFilterViewController filterViewController;
private ModelAdapter.PageControl<Model> mPageControl = new ModelAdapter.PageControl<Model>() {
@Override
public void onLoadPage(int page) {
loadCustomers(page);
}
};
private SwipeRefreshLayout refreshLayout;
private ModelStatusListener<CustomerEvent, CustomerModel> customerStatusListener = new ModelStatusListener<CustomerEvent, CustomerModel>() {
@Override
public void onModelEvent(CustomerEvent event, CustomerModel model) {
loadCustomers(1);
}
};
private ModelAdapter.PageControl<Model> searchPageControl = new ModelAdapter.PageControl<Model>() {
@Override
public void onLoadPage(int page) {
search(searchText, page);
}
};
protected void onConfigureView() {
super.onConfigureView();
View rootView = getView();
dateType = getActivity().getIntent().getStringExtra(KEY_DATE_TYPE);
title = getActivity().getIntent().getStringExtra(KEY_TITLE);
customerType = getActivity().getIntent().getIntExtra(KEY_CUSTOMER_TYPE, 0);
boolean isItemClick = getActivity().getIntent().getBooleanExtra(KEY_IS_ITEM_CLICK, false);
userType = getActivity().getIntent().getStringExtra(KEY_USER_TYPE);
boolean isVisibleBtn = getActivity().getIntent().getBooleanExtra(KEY_IS_VISIBLE_BTN, true);
boolean isApprovalGone = getActivity().getIntent().getBooleanExtra(KEY_APPROVAL_GONE,false);
customersAdapter.setActivity(getActivity());
customersAdapter.setPageControl(mPageControl);
customersAdapter.setIsItemClick(isItemClick);
customersAdapter.setIsVisibleBtn(isVisibleBtn);
customersAdapter.setIsApprovalGone(isApprovalGone);
customersAdapter.setDateType(dateType);
ListView customersListView = (ListView) rootView.findViewById(R.id.customers_list_view);
customersListView.setAdapter(customersAdapter);
refreshLayout = (SwipeRefreshLayout) rootView
.findViewById(R.id.refresh_layout);
refreshLayout.setOnRefreshListener(mOnRefreshListener);
loadCustomers(1);
CustomerManager.getInstance().registerListener(customerStatusListener);//TODO
View topView = setActionBarLayout(R.layout.ab_back_title_right);
rightBtn = (TextView) topView.findViewById(R.id.ab_right_button);
rightBtn.setText("筛选");
setTitle(title);
if (customerType == 0){
SearchView searchView = (SearchView) topView.findViewById(R.id.search_view);
isSearchClose = true;
searchView.setOnCloseListener(new SearchView.OnCloseListener() {
@Override
public boolean onClose() {
// Toast.makeText(ContextProvider.getContext(), "关闭", Toast.LENGTH_LONG).show();
isSearchClose = true;
setTitle(title);
customersAdapter.setPageControl(mPageControl);
rightBtn.setClickable(true);
return false;
}
});
searchView.setOnSearchClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.e("xx", "152--------点击事件");
setTitle("");
isSearchClose = false;
customersAdapter.setPageControl(searchPageControl);
rightBtn.setClickable(false);
}
});
searchView.setOnQueryTextListener(searchQueryListener);
searchView.setVisibility(View.VISIBLE);
}
rightBtn.setOnClickListener(filterButtonListener);
}
private SearchView.OnQueryTextListener searchQueryListener = new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String q) {
searchText = q;
search(q, 1);
return false;
}
@Override
public boolean onQueryTextChange(String arg0) {
return false;
}
};
private void search(String queryString, int page) {
if (UserManager.getInstance().getCurrentUser() == null) {
customersAdapter.setData(null);
refreshLayout.setRefreshing(false);
return;
}
if(null==queryString||"".equals(queryString)){
Toast.makeText(getActivity(), "搜索内容不能为空!", Toast.LENGTH_SHORT).show();
return;
}
HttpRequest<ListResult<Model>> req = new HttpRequest<>(URLApi.Customer.getMyCustomers(), customersListener);
CommonErrorHandler handler = new CommonErrorHandler(this);
handler.setSwipeRefreshLayout(refreshLayout);
req.setErrorListener(handler);
try {
req.addParam("display_name", URLEncoder.encode(queryString, "UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
JSONListParser parser = new JSONListParser();
req.setParser(parser);
if(filterViewController!=null){
CustomerFilterAdapter filterAdapter = filterViewController.getAdapter();
if(filterAdapter.getDateType() != -1) {
req.addParam("date_type", filterAdapter.getDateType() + "");
}
// req.addParam("date_type", filterAdapter.getDateType() + "");
if (filterAdapter.getMarketerIds() != null) {
req.addParam("marketer_ids", filterAdapter.getMarketerIds());
}
MarketModel marketModel = filterAdapter.getSelectedMarket();
if (marketModel != null && marketModel.getId() != -1) {
req.addParam("market_id", marketModel.getId() + "");
}
// if(filterAdapter.getSelectedCustomerSource() != 0){
// req.addParam("source",filterAdapter.getSelectedCustomerSource()+"");
// }
// if(filterAdapter.getSelectedCustomerStatus() != 0){
// req.addParam("order_tag",filterAdapter.getSelectedCustomerStatus()-1+"");
// }
}else {
req.addParam("date_type", dateType + "");
// req.addParam("user_type", userType);//默认是买家1 个人中心进入的我的客户是全部 -1
}
req.addParam("user_type", userType);//默认买家和卖家
req.addParam("pageNo", String.valueOf(page));
req.addParam("pageSize", String.valueOf(10));
req.addParam("accessToken", UserManager.getInstance().getCurrentUser()
.getAccessToken());
req.setErrorListener(new HttpRequest.ErrorListener() {
@Override
public void onError(HttpRequest<?> request, HttpError eror) {
refreshLayout.setRefreshing(false);
hideLoading();
Toast.makeText(ContextProvider.getContext(), eror.getErrorMsg(), Toast.LENGTH_SHORT).show();
}
});
Log.e("xx", "url:" + req.getUrl());
if (page == 1) {// 1 means refresh
req.setAttachment(Boolean.TRUE);
}
VolleyDispatcher.getInstance().dispatch(req);
Log.e("xx", "loading customers");
}
@Override
protected void onDestroyView() {
super.onDestroyView();
UserManager.getInstance().unregisterListener(userInfoListener);
}
private HttpRequest.ResultListener<ListResult<Model>> customersListener = new HttpRequest.ResultListener<ListResult<Model>>() {
@Override
public void onResult(HttpRequest<ListResult<Model>> request,
ListResult<Model> data) {
if(data.getCode() == 1){
UserManager.getInstance().loginExpired(getActivity());
getActivity().finish();
}
if(request.getAttachment(Boolean.class) == Boolean.TRUE){
customersAdapter.clear();
}
if (refreshLayout != null) {
refreshLayout.setRefreshing(false);
}
if (data.isSuccess()) {
customersAdapter.setData(data);
customersAdapter.setDateType(dateType);
Log.e("xx", "121--------data=" + data.getModels());
Log.e("xx", "183----------是否为空=" + customersAdapter.isEmpty());
if (customersAdapter.isEmpty()) {
showEmptyView();
} else {
hideEmptyView();
}
} else {
Toast.makeText(ContextProvider.getContext(), data.getDesc(),
Toast.LENGTH_SHORT).show();
}
hideLoading();
}
};
private SwipeRefreshLayout.OnRefreshListener mOnRefreshListener = new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
loadCustomers(1);
}
};
private void loadCustomers(int page) {
if (UserManager.getInstance().getCurrentUser() == null) {
customersAdapter.setData(null);
refreshLayout.setRefreshing(false);
return;
}
String url = "";
switch (customerType) {
case 0:
url = URLApi.Customer.getMyCustomers();
break;
case 1:
url = URLApi.getBaseUrl() + "/crm/customer/getNewCustomer";
break;
case 2:
url = URLApi.getBaseUrl() + "/crm/customer/getOrderedCustomer";
break;
}
HttpRequest<ListResult<Model>> req = new HttpRequest<>(url, customersListener);
if (filterViewController != null) {
CustomerFilterAdapter filterAdapter = filterViewController.getAdapter();
if(filterAdapter.getDateType() != -1) {
req.addParam("date_type", filterAdapter.getDateType() + "");
}
if (filterAdapter.getMarketerIds() != null) {
req.addParam("marketer_ids", filterAdapter.getMarketerIds());
}
MarketModel marketModel = filterAdapter.getSelectedMarket();
if (marketModel != null && marketModel.getId() != -1) {
req.addParam("market_id", marketModel.getId() + "");
}
if(filterAdapter.getSelectedCustomerSource() != 0){
req.addParam("source",filterAdapter.getSelectedCustomerSource()+"");
}
if(filterAdapter.getSelectedCustomerStatus() != 0){
req.addParam("order_tag",filterAdapter.getSelectedCustomerStatus()-1+"");
}
if(filterAdapter.getSelectedNotOrderStatus() != 0){
req.addParam("last_order_time",filterAdapter.getSelectedNotOrderStatus() + "");
}
} else {
req.addParam("date_type", dateType + "");
req.addParam("user_type", userType);//默认是买家1 个人中心进入的我的客户是全部 -1
}
req.addParam("user_type", userType);//默认是买家1 个人中心进入的我的客户是全部 -1
JSONListParser parser = new JSONListParser();
req.setParser(parser);
req.addParam("pageNo", String.valueOf(page));
req.addParam("pageSize", String.valueOf(10));
req.addParam("accessToken", UserManager.getInstance().getCurrentUser()
.getAccessToken());
req.setErrorListener(new HttpRequest.ErrorListener() {
@Override
public void onError(HttpRequest<?> request, HttpError eror) {
refreshLayout.setRefreshing(false);
hideLoading();
Toast.makeText(ContextProvider.getContext(), eror.getErrorMsg(), Toast.LENGTH_SHORT).show();
}
});
Log.e("xx", "url:" + req.getUrl());
if (page == 1) {// 1 means refresh
showLoading();
req.setAttachment(Boolean.TRUE);
}
VolleyDispatcher.getInstance().dispatch(req);
Log.e("xx", "loading customers");
}
private ModelStatusListener<UserEvent, UserModel> userInfoListener = new ModelStatusListener<UserEvent, UserModel>() {
@Override
public void onModelEvent(UserEvent event, UserModel model) {
loadCustomers(1);
}
};
private View.OnClickListener filterButtonListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
showFilter();
}
};
private ActionSheet actionSheet;
private void showFilter() {
/*
if(filterViewController == null){
filterViewController = new BuyerCustomerFilterViewController();
filterViewController.setActionSheet(getActionSheet(true));
filterViewController.setOnConditionSelectedListener(new BuyerCustomerFilterViewController.OnConditionSelectedListener() {
@Override
public void onConditionSelected() {
loadCustomers(1);
}
});
filterViewController.setActivity(getActivity());
getActionSheet(true).setHeight(getView().getHeight());
getActionSheet(true).setStyle(ActionSheet.STYLE_RIGHT_TO_LEFT);
getActionSheet(true).setViewController(filterViewController);
getActionSheet(true).setWidth(DimensionUtil.dip2px(300));
}
getActionSheet(true).show();
*/
if(actionSheet == null){
actionSheet = new ActionSheet();
actionSheet.setStyle(ActionSheet.STYLE_RIGHT_TO_LEFT);
actionSheet.setWidth(DimensionUtil.dip2px(300));
actionSheet.setHeight(getView().getHeight());
actionSheet.setActivity(getActivity());
filterViewController = new BuyerCustomerFilterViewController();
filterViewController.setActionSheet(actionSheet);
filterViewController.setOnConditionSelectedListener(new BuyerCustomerFilterViewController.OnConditionSelectedListener() {
@Override
public void onConditionSelected() {
loadCustomers(1);
}
});
actionSheet.setViewController(filterViewController);
}
actionSheet.show();
}
}
|
[
"[email protected]"
] | |
dc272e8f58df45f4a76a5d63756e2fc4862cc5b0
|
cb05d1f1add449ee7fd5164482e25ed125381703
|
/src/main/java/com/qing/hu/common/ResultCode.java
|
e8a088f4af4f63e15e0b609c4ba5220487ea49f9
|
[] |
no_license
|
shiqinghu-code/code-jpa-oracle
|
e540aa68c531a60adec23c0b75353b986866a343
|
e2af678b6ceeca87eff719611e1622b0de7b3d63
|
refs/heads/main
| 2023-03-07T18:52:30.327486 | 2021-02-20T09:04:43 | 2021-02-20T09:04:43 | 340,239,717 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 633 |
java
|
package com.qing.hu.common;
public enum ResultCode implements IErrorCode {
SUCCESS(200, "操作成功"),
FAILED(500, "操作失败"),
QUERY_FAILED(405, "未查询到相关信息"),
VALIDATE_FAILED(404, "参数检验失败"),
UNAUTHORIZED(401, "暂未登录或token已经过期"),
FORBIDDEN(403, "没有相关权限");
private long code;
private String message;
private ResultCode(long code, String message) {
this.code = code;
this.message = message;
}
public long getCode() {
return code;
}
public String getMessage() {
return message;
}
}
|
[
"[email protected]"
] | |
1695da054ca93f716d14032a1018e793339cb160
|
242e90dff02d8ae45a5cc11ad2b42b0fb097a4b7
|
/guava/src/test/java/org/baeldung/hamcrest/IsPositiveInteger.java
|
0d8d2625385c743a4f572699e427b9dbffad38bf
|
[
"MIT"
] |
permissive
|
naXa777/tutorials
|
980e3ab816ad5698fdcf9c7e1b8bc6acf75c12a5
|
c575ba8d6fc32c6d523bd9d73170b90250756e22
|
refs/heads/master
| 2020-03-30T08:06:09.918501 | 2019-02-27T17:54:22 | 2019-02-27T17:54:22 | 150,989,509 | 2 | 1 |
MIT
| 2018-09-30T17:30:55 | 2018-09-30T17:30:54 | null |
UTF-8
|
Java
| false | false | 525 |
java
|
package org.baeldung.hamcrest;
import org.hamcrest.Description;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
public class IsPositiveInteger extends TypeSafeMatcher<Integer> {
public void describeTo(Description description) {
description.appendText("a positive integer");
}
@Factory
public static Matcher<Integer> isAPositiveInteger() {
return new IsPositiveInteger();
}
@Override
protected boolean matchesSafely(Integer integer) {
return integer > 0;
}
}
|
[
"[email protected]"
] | |
8f20a4854ba81f46b0ebc9abdb95697bb5199899
|
0edc67b1f8545733e25a17bfe9e0f6d206f40ade
|
/src/org/stlpriory/robotics/commands/Shoot.java
|
28bf70e330fea2ee78343e62f7a3cd78a431e91e
|
[] |
no_license
|
ViPrs1329/RoboRebels2016sb
|
639b4b5e6a4d1515cf22365613556ec7979c3ee1
|
ab75fe8d28ffcaeff5956809ac2bb5cb0ea8afbe
|
refs/heads/master
| 2022-02-16T12:24:16.826210 | 2016-02-26T21:24:32 | 2016-02-26T21:24:32 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,287 |
java
|
package org.stlpriory.robotics.commands;
import org.stlpriory.robotics.subsystems.ShooterSubsystem;
import org.strongback.command.Command;
/**
* The command that ...
*/
public class Shoot extends ShooterCommandBase {
/**
* Base for shooter type commands.
* @param shooter the ball shooter subsystem
*/
public Shoot(ShooterSubsystem shooter) {
super(shooter);
}
/**
* Base for shooter type commands.
* @param shooter the ball shooter subsystem
* @param duration the duration of this command; should be positive
*/
public Shoot(ShooterSubsystem shooter, double duration) {
super(shooter, duration);
}
/**
* Perform a one-time setup of this {@link Command} prior to any calls to {@link #execute()}.
* No physical hardware should be manipulated.
* <p>
* By default this method does nothing.
*/
@Override
public void initialize() {
super.initialize();
}
/**
* Perform the primary logic of this command. This method will be called repeatedly after
* this {@link Command} is initialized until it returns {@code true}.
*
* @return {@code true} if this {@link Command} is complete; {@code false} otherwise
*/
@Override
public boolean execute() {
if (isBallLoaded()) {
// Ensure that the loader arm is retracted
if (! isLoaderArmRetracted()) {
retractLoaderArm();
}
// start the shooter motors spinning outward
startShooter();
// pause for 1 second to allow the motors to get to full speed
pauseTime(1.0);
// extend the loader arm and to push the ball into the spinning wheels
extendLoaderArm();
// pause for 1 second before retracting arm
pauseTime(1.0);
// retract the loader arm
retractLoaderArm();
// stop the shooter motors
stop();
}
return true;
}
/**
* Signal that this command has been interrupted before {@link #initialize() initialization}
* or {@link #execute() execution} could successfully complete. A command is interrupted when
* the command is canceled, when the robot is shutdown while the command is still running, or
* when {@link #initialize()} or {@link #execute()} throw exceptions. Note that if this method
* is called, then {@link #end()} will not be called on the command.
* <p>
* By default this method does nothing.
*/
@Override
public void interrupted() {
retractLoaderArm();
stop();
}
/**
* Perform one-time clean up of the resources used by this command and typically putting the robot
* in a safe state. This method is always called after {@link #execute()} returns {@code true}
* unless {@link #interrupted()} is called.
* <p>
* By default this method does nothing.
*/
@Override
public void end() {
retractLoaderArm();
stop();
}
}
|
[
"[email protected]"
] | |
ec04f6c6f454f565fe912f890c95129aabb4bca7
|
d3b98c1661052f547dc21824e80636816132fd69
|
/Lcm_Recursive.java
|
873d6c5baa224811d50904403dd80d6fe0a3bd75
|
[] |
no_license
|
imavishek/Basic-Program
|
ac15ff224836db6c3d3c4bf7e19a927ff87359c0
|
ab17e31244b51dced52c454e2a1dc870a8cc7b05
|
refs/heads/master
| 2021-07-06T22:20:18.241594 | 2017-10-04T05:23:58 | 2017-10-04T05:23:58 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 405 |
java
|
import java.util.Scanner;
class Lcm {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
System.out.println("Enter 2 no:-");
int n1 = sc.nextInt();
int n2 = sc.nextInt();
int lcm = (n1*n2)/gcd(n1,n2);
System.out.println(lcm);
}
private static int gcd(int n1, int n2) {
if (n2==0) {
return n1;
}
else {
return gcd(n2, n1%n2);
}
}
}
|
[
"[email protected]"
] | |
96ecebe0423a18d1db506ef9b46a76f650a24467
|
138f3f7805d8b6b3f29ef4d6c01d9be49d08c8b1
|
/src/main/java/com/beingjavaguys/model/SprLom.java
|
178571b75c0dd489d0ed6e74473960ff4b0a3f61
|
[] |
no_license
|
yura1980/SpringRestCrud
|
3ad6e45a4f9339af12a188a2c3fc16a3d418997a
|
ec77bb652385b15a7563b6b3300b7900117ee48e
|
refs/heads/master
| 2021-01-21T12:58:16.778867 | 2016-06-01T14:26:08 | 2016-06-01T14:26:08 | 52,773,494 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,810 |
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.beingjavaguys.model;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
*
* @author yuri
*/
@Entity
@Table(name = "spr_lom")
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class SprLom extends Spr {
private static final long serialVersionUID = 1L;
/*@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;*/
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 200)
@Column(name = "txt_lom")
private String txtLom;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "sprLomId")
private Collection<RezLom> rezLomCollection;
public SprLom() {
}
/*public SprLom(Integer id) {
this.id = id;
}
public SprLom(Integer id, String txtLom) {
this.id = id;
this.txtLom = txtLom;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}*/
public String getTxtLom() {
return txtLom;
}
public void setTxtLom(String txtLom) {
this.txtLom = txtLom;
}
public Collection<RezLom> getRezLomCollection() {
return rezLomCollection;
}
public void setRezLomCollection(Collection<RezLom> rezLomCollection) {
this.rezLomCollection = rezLomCollection;
}
/*@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 SprLom)) {
return false;
}
SprLom other = (SprLom) 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 "com.mycompany.genentyity2.SprLom[ id=" + id + " ]";
}*/
}
|
[
"testGit"
] |
testGit
|
473c2ab065342d9a9cef3e380a2a63504b2bbf33
|
6ae77c044f628117c77733f274266464383a6a33
|
/src/com/xwkj/booking/servlet/WeChatPayedServlet.java
|
30314c1de49b8c80ee9ee416049965744b51d530
|
[] |
no_license
|
lm2343635/Booking
|
5510067cc4cf23f1a10fb197b399c5cfd1305198
|
73d06158ec1b62107fb8f984723587b21f301a6b
|
refs/heads/master
| 2021-01-20T20:15:29.472722 | 2016-07-06T11:40:35 | 2016-07-06T11:40:35 | 43,290,732 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,239 |
java
|
package com.xwkj.booking.servlet;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import com.xwkj.booking.dao.BookingDao;
import com.xwkj.booking.dao.PayDao;
import com.xwkj.booking.domain.Booking;
import com.xwkj.booking.domain.Pay;
import com.xwkj.booking.domain.Room;
import com.xwkj.booking.domain.User;
import com.xwkj.booking.service.PayManager;
import com.xwkj.booking.service.util.ManagerTemplate;
import com.xwkj.common.util.DateTool;
import com.xwkj.common.util.SMSService;
@WebServlet("/WeChatPayedServlet")
public class WeChatPayedServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public WeChatPayedServlet() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String result="";
BufferedReader reader=new BufferedReader(new InputStreamReader((ServletInputStream)request.getInputStream()));
String line = null;
while((line = reader.readLine())!=null){
result+=line;
}
Document document=null;
try {
document=DocumentHelper.parseText(result);
} catch (DocumentException e) {
e.printStackTrace();
}
if(document==null) {
response.getWriter().print("<xml><return_code>FAIL</return_code></xml>");
return;
}
Element root=document.getRootElement();
String nonce_str=root.elementText("nonce_str");
String return_code=root.elementText("return_code");
String result_code=root.elementText("result_code");
String out_trade_no=root.elementText("out_trade_no");
String time_end=root.elementText("time_end");
System.out.println(out_trade_no+" has been paeded at "+new Date());
WebApplicationContext context=WebApplicationContextUtils.getWebApplicationContext(getServletContext());
PayManager payManager=(PayManager)context.getBean("payManager");
ManagerTemplate managerTemplate=(ManagerTemplate)context.getBean("managerTemplate");
BookingDao bookingDao=managerTemplate.getBookingDao();
PayDao payDao=managerTemplate.getPayDao();
Booking booking=bookingDao.findByBno(out_trade_no);
//查询不到订单
if(booking==null) {
response.getWriter().print("<xml><return_code>FAIL</return_code></xml>");
return;
}
//返回码存在失败信息
if(return_code.equals("FAIL")||result_code.equals("FAIL")) {
response.getWriter().print("<xml><return_code>FAIL</return_code></xml>");
return;
}
Pay pay=payDao.findByBooking(booking);
//比对随机字符串
if(nonce_str.equals(pay.getWechatNonce())) {
//更新订单支付信息
booking.setPay(true);
bookingDao.update(booking);
pay.setPayed(true);
pay.setPayDate(DateTool.transferDate(time_end, "yyyyMMddhhmmss"));
payDao.update(pay);
//支付成功后、房间的销售数量加1
Room room=booking.getRoom();
room.setSold(room.getSold()+1);
managerTemplate.getRoomDao().update(room);
//发送短息通知用户支付成功
SMSService sms=(SMSService)context.getBean("SMSService");
User user=booking.getUser();
String value="#name#="+user.getUname()+"&#bno#="+booking.getBno()
+"&#payDate#="+DateTool.formatDate(pay.getPayDate(), DateTool.DATE_HOUR_MINUTE_FORMAT_CN)+"&#amount#="+booking.getAmount();
sms.send(user.getTelephone(), payManager.getPayedSMSTemplateID(), value);
sms.send(payManager.getAdminTelephone(), payManager.getPayedSMSTemplateID(), value);
response.getWriter().print("<xml><return_code>SUCCESS</return_code></xml>");
}
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
|
[
"[email protected]"
] | |
90081e95cff9684f91c06513107347c1f45fcbeb
|
e6efaf98f048f65f56b564738ddce8aa537d6654
|
/PrimePalindromeChecker.java
|
373960b9b4b0b43a2f0cfd64a71aa4602f7ae51f
|
[] |
no_license
|
Brennan-Schwamb/Week6_CST105_ProgrammingExercise7_BSchwamb
|
893f057ce7785b707caf510bc7a34a5d5357dcc7
|
056ae4c2e9563598826610c773b8345c693f1bd9
|
refs/heads/master
| 2020-04-01T09:02:55.859124 | 2018-10-15T06:08:38 | 2018-10-15T06:08:38 | 153,057,464 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,177 |
java
|
import java.util.*;
import java.util.Formatter;
public class PrimePalindromeChecker
{
public static void main (String[] args) {
Scanner scanner = new Scanner(System.in);
//System.out.println("Enter a value:");
//int n =scanner.nextInt();
int n = 100000;
for(int i=2;i<=n;i++){
//comparing both methods to find numbers that are both prime and palindrome
if (prime(i) && pal(i)) {
System.out.println(i);
}
}
}
//method to find prime numbers
public static boolean prime(int n) {
int x = 2;
while (n%x>0) {
x+=1;
}
if (x==n) {
return true;
}
else {
return false;
}
}
//method to find palindromes
public static boolean pal(int n) {
int rev = 0;
int rmd = 0;
int temp = n;
while (n>0) {
rmd = n%10;
rev = rev*10 + rmd;
n = n/10;
}
if (rev==temp){
return true;
}
else{
return false;
}
}
}
|
[
"[email protected]"
] | |
41ea59bc04ce661efaf45be8edef39b711e1559c
|
69ceb6767d4c8b669c2a01866b7188be0727e611
|
/my-test/src/test/java/com/jiuzhou/bootwork/beans/Person.java
|
79a2f3ac699d229a66d4cf9a964862bf66815c95
|
[] |
no_license
|
jiuzhou9/boot-work
|
077195a38e34aca5896308474bdfbf4547123b02
|
8db299429ecf21ef35b7ee4994a01cfb767a3231
|
refs/heads/master
| 2022-10-16T19:41:37.074122 | 2020-08-17T07:53:10 | 2020-08-17T07:53:10 | 119,803,243 | 2 | 0 | null | 2022-10-12T20:12:35 | 2018-02-01T08:01:58 |
Java
|
UTF-8
|
Java
| false | false | 685 |
java
|
package com.jiuzhou.bootwork.beans;
import com.alibaba.fastjson.JSON;
import com.jiuzhou.bootwork.result.Result;
import lombok.Data;
import java.util.List;
/**
* @author wangjiuzhou ([email protected])
* @date 2018/01/08
*/
@Data
public class Person {
private Integer id;
private String name;
private Integer age;
private List<String> companyList;
public static void main(String[] args) {
Result<Person> result = new Result<>();
Person person = new Person();
person.setAge(12);
person.setId(1);
person.setName("张三");
result.setData(person);
System.out.println(JSON.toJSONString(result));
}
}
|
[
"[email protected]"
] | |
158f186348d65d9acc7eac670cd0003d5df3681d
|
f0e1df23d99bba9d4b39c3f58acfcaa54490a77e
|
/RI/Chris/src/uo/ri/ui/admin/action/UpdateProveedorAction.java
|
6be68b0f468d8874619ffe096bf8645aa26aae44
|
[] |
no_license
|
dgsama/Curso17
|
f84948b234594099b446258d258740e7424f5517
|
c2b974305bf1f80b5934bcebf448b2f29aee5ae7
|
refs/heads/master
| 2021-03-16T05:11:53.769462 | 2016-12-12T23:37:50 | 2016-12-12T23:37:50 | 70,044,665 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,055 |
java
|
package uo.ri.ui.admin.action;
import java.util.HashMap;
import java.util.Map;
import uo.ri.business.conf.ServicesFactory;
import alb.util.console.Console;
import alb.util.menu.Action;
public class UpdateProveedorAction implements Action{
@Override
public void execute() throws Exception {
new ListProveedorAction().execute();
// Pedir datos
Long id = Console.readLong("\nId del proveedor");
String nombre = "";
String cod = "";
do{
nombre = Console.readString("Nuevo nombre del proveedor (máximo 50 "
+ "caracteres)");
}while(nombre.equals("") || nombre.length()>50);
do{
cod = Console.readString("Nuevo código del proveedor (máximo 6 " +
"caracteres)");
}while(cod.equals("") || cod.length()>6);
Map<String,Object> proveedor = new HashMap<String,Object>();
proveedor.put("id",id);
proveedor.put("nombre",nombre);
proveedor.put("cod",cod);
ServicesFactory.getAdminService().updateProveedor(proveedor);
// Mostrar resultado
Console.println("Proveedor actualizado");
}
}
|
[
"[email protected]"
] | |
c883fb66b971066270ef57ff66d7f69c6ebe2c55
|
4b52024709cc5800cf80496a0c601d687e851fe7
|
/hyperion-attr/src/main/java/com/willowtreeapps/hyperion/attr/MutableStringViewAttribute.java
|
3439756feee1946ca93bc091c235cf91da2c33da
|
[
"MIT"
] |
permissive
|
kvithayathil/Hyperion-Android
|
37c16ed14a1a0eaaf1532ea2ef3786919a89d668
|
9900c01728d065dbe590f22ab1eb809476411161
|
refs/heads/develop
| 2023-04-16T16:11:05.622240 | 2020-08-19T19:21:59 | 2020-08-19T19:21:59 | 128,554,856 | 0 | 0 |
MIT
| 2023-04-03T23:39:52 | 2018-04-07T18:03:05 |
Java
|
UTF-8
|
Java
| false | false | 415 |
java
|
package com.willowtreeapps.hyperion.attr;
import android.support.annotation.NonNull;
public abstract class MutableStringViewAttribute extends MutableViewAttribute<CharSequence> {
public MutableStringViewAttribute(String key, @NonNull CharSequence value) {
super(key, value);
}
@Override
public int getViewType() {
return AttributeDetailView.ITEM_MUTABLE_STRING_ATTRIBUTE;
}
}
|
[
"[email protected]"
] | |
edec73728b6ee3f80cfb2d7d02ce4793fce70472
|
b4fd5393f3ca702a47618d94a5ede2192c2d869a
|
/JavaCodeKnowledge/src/code/experiment/FindAge.java
|
56de9ea33ccf753d4fb81c3ebda75d9334cad87a
|
[] |
no_license
|
mnpraveensingh/KnowledgeRepo
|
0263c7dbab430a37a4282b804be0690bb8044da0
|
fd061772d7e8b80a4fb4195cc850da81247eeffc
|
refs/heads/master
| 2022-12-15T13:25:02.474643 | 2020-02-27T06:06:05 | 2020-02-27T06:06:05 | 164,085,908 | 0 | 0 | null | 2022-12-06T00:43:22 | 2019-01-04T09:19:38 |
Java
|
UTF-8
|
Java
| false | false | 733 |
java
|
package code.experiment;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
public class FindAge {
public static void main(String[] args) {
Calendar birthDay = new GregorianCalendar(2015, Calendar.AUGUST, 15);
Calendar today = new GregorianCalendar();
today.setTime(new Date());
int yearsInBetween = today.get(Calendar.YEAR) - birthDay.get(Calendar.YEAR);
int monthsDiff = today.get(Calendar.MONTH) - birthDay.get(Calendar.MONTH);
long ageInMonths = yearsInBetween * 12 + monthsDiff;
long age = yearsInBetween;
System.out.println("Number of months since James gosling born : " + ageInMonths);
System.out.println("Sir James Gosling's age : " + age);
}
}
|
[
"[email protected]"
] | |
c712c18786f480684ab7cdf25579b005b44aa49e
|
30f532fca3cef51a3d40112e000647b2fc8e4b41
|
/UtaCarParkingSystemAdmin/src/Parking_System/controller/spotUnavailableController.java
|
ce50da2fa650f12cc4e136053981dc7f88b5518e
|
[] |
no_license
|
yankev07/UtaCarParkingSystem
|
6fae31e0427678905632e1286489064e341c08f0
|
da48ee150901cb2e46262377c1d7f2ca45620c96
|
refs/heads/master
| 2020-05-16T00:33:53.161377 | 2019-04-21T21:37:27 | 2019-04-21T21:37:27 | 182,583,296 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,005 |
java
|
package Parking_System.controller;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import Parking_System.Model.Parking;
import Parking_System.Utils.ErrorHandling;
import Parking_System.Data.parkingDAO;
@WebServlet("/spotUnavailableController")
public class spotUnavailableController extends HttpServlet{
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession();
Parking parking = new Parking();
parking.setUnavailable(Integer.parseInt(request.getParameter("lname")));
parking.setAreaName(request.getParameter("role"));
parkingDAO dataObject = new parkingDAO();
ErrorHandling errorHandler = new ErrorHandling();
boolean pass = true;
if(!errorHandler.checkParkingAreaName(parking.getAreaName())) {
pass = false;
}
if(!errorHandler.checkZip(String.valueOf(parking.getUnavailable()))) {
pass = false;
}
if(pass){
dataObject.connect();
if(dataObject.makeSpotUnavailable(parking.getAreaName(), parking.getUnavailable())) {
response.sendRedirect("makeSpotUnavailableSuccess.jsp");
}
else {
response.sendRedirect("Manager_Home.jsp");
}
}
else{
getServletContext().getRequestDispatcher("/Manager_Home.jsp").forward(request, response);
}
}
}
|
[
"[email protected]"
] | |
78e1ecb648e4055b8b69b3d8da2786ae9a7e8a48
|
defe08f70ef1c6bc8aac4515503ae050986c58d3
|
/src/main/java/com/gerardoperez/drinkology/servlet/LoginServlet.java
|
276e6b13200d962f717919a1bafa833eaba8228e
|
[] |
no_license
|
2011JavaReact/Drinkology
|
fd98258737e1c5f8d0ba94b66f0f416f1023aa17
|
ba650c7150f2e94944ba6ab36afb83800ee7391d
|
refs/heads/main
| 2023-01-30T13:13:59.445146 | 2020-12-12T19:20:02 | 2020-12-12T19:20:02 | 316,059,267 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,075 |
java
|
package com.gerardoperez.drinkology.servlet;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.gerardoperez.drinkology.model.User;
import com.gerardoperez.drinkology.service.UserService;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.BufferedReader;
import java.io.IOException;
/**
* Login endpoint that works currently with an un-hashed password.
* Expects a post request with a body {"username": "person's name" , "password": "thePassword"}
*/
@WebServlet("/login")
public class LoginServlet extends HttpServlet {
private final ObjectMapper objectMapper = new ObjectMapper();
private final UserService userService = new UserService();
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
BufferedReader br = req.getReader();
StringBuilder sb = new StringBuilder();
String line;
while ((line = br.readLine()) != null) {
sb.append(line);
}
String jsonString = sb.toString();
// userTryingToLogin = username and password from body request
User userTryingToLogin = objectMapper.readValue(jsonString , User.class);
// completedUser = the user found in the database with name that matches userTryingToLogin.username
User completeUser = userService.getAUserByName(userTryingToLogin.getUsername());
if (userService.login(completeUser , userTryingToLogin)) {
HttpSession session = req.getSession();
session.setAttribute("role_id" , completeUser.getRole_id());
resp.getWriter().append("Successful login for user: ").append(completeUser.getUsername());
} else {
resp.getWriter().append("The username of password does not match...");
}
resp.setContentType("application/json");
}
}
|
[
"[email protected]"
] | |
262f746cfb90af9adc02790b91f8861529e29fbf
|
d36df8e6604f202b51193de97f646c7ab508251f
|
/Final Algorithm Assignment2/test/models/MovieTest.java
|
a09f12ecef24f35c81a72e0581b0767588bfcc2e
|
[] |
no_license
|
irishladdoyle/Movie-Recommender-Assignment-
|
f9d21ca25b5f84d8363cad409a5c7b757758f7a9
|
fd1f7a9131d775cc467ba2742732af898565dafe
|
refs/heads/master
| 2021-01-10T09:48:42.405089 | 2015-12-10T23:50:26 | 2015-12-10T23:50:26 | 47,793,713 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 892 |
java
|
package models;
import static org.junit.Assert.*;
import java.util.HashSet;
import java.util.Set;
import org.junit.Test;
import static models.Fixtures.users;
public class MovieTest
{
Movie movie1 = new movies ("title", "year", "url");
@Test
public void testCreate()
{
assertEquals ("title", movie1.title);
assertEquals ("year", movie1.year);
assertEquals ("url", movie1.url);
}
@Test
public void testIds()
{
Set<Long> ids = new HashSet<>();
for (Movie movie1 : Movie)
{
ids.add(movie1.id);
}
}
@Test
public void testToString()
{
assertEquals ("Movie{" + movie1.id + ", title, year, url}", movie1.toString());
}
@Test
public void testEquals()
{
Movie movie1 = new Movie ("title", "year", "url");
assertEquals(movie1, movie1);
assertEquals(movie1, movie1);
}
}
|
[
"[email protected]"
] | |
155b977ddee6d7607eedd1963cbd431b9908c7d9
|
a9e95cf7dc0ae6707665c76c85f06b75bde03bb0
|
/src/main/java/com/easyfun/easyframe/msg/admin/AdminUtil.java
|
f9ea9a6ac75eda4f9fe6bea576ab62bd228fee8e
|
[
"Apache-2.0"
] |
permissive
|
crossoverJie/easyframe-msg
|
87beaa328745e82fe56538a241e9e7bf9946ae3e
|
e70f0c5b06df2c45940731d6df1a1a89071af369
|
refs/heads/master
| 2021-01-19T20:57:17.973011 | 2017-08-24T02:52:28 | 2017-08-24T02:52:28 | 101,242,205 | 1 | 0 | null | 2017-08-24T01:51:50 | 2017-08-24T01:51:50 | null |
UTF-8
|
Java
| false | false | 9,831 |
java
|
package com.easyfun.easyframe.msg.admin;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import kafka.api.PartitionOffsetRequestInfo;
import kafka.cluster.Broker;
import kafka.common.OffsetMetadataAndError;
import kafka.common.TopicAndPartition;
import kafka.javaapi.OffsetCommitRequest;
import kafka.javaapi.OffsetCommitResponse;
import kafka.javaapi.OffsetFetchRequest;
import kafka.javaapi.OffsetFetchResponse;
import kafka.javaapi.OffsetRequest;
import kafka.javaapi.OffsetResponse;
import kafka.javaapi.PartitionMetadata;
import kafka.javaapi.TopicMetadata;
import kafka.javaapi.TopicMetadataRequest;
import kafka.javaapi.TopicMetadataResponse;
import kafka.javaapi.consumer.SimpleConsumer;
import kafka.utils.ZKStringSerializer;
import kafka.utils.ZkUtils;
import org.I0Itec.zkclient.ZkClient;
import org.I0Itec.zkclient.exception.ZkMarshallingError;
import org.I0Itec.zkclient.serialize.ZkSerializer;
import org.apache.zookeeper.data.Stat;
import scala.Option;
import scala.Tuple2;
import scala.collection.JavaConversions;
import scala.collection.Seq;
import scala.collection.mutable.Buffer;
import com.easyfun.easyframe.msg.KafkaHelper;
import com.easyfun.easyframe.msg.SimpleKafkaHelper;
import com.easyfun.easyframe.msg.admin.model.BrokerModel;
import com.easyfun.easyframe.msg.admin.model.PartitionModel;
import com.easyfun.easyframe.msg.admin.model.TopicModel;
/**
* Kafka的管理API
* @author linzhaoming
*
* @Created 2014
*/
public class AdminUtil {
private static ZkSerializer zkSerializer = null;
/** 获取ZooKeeper的*/
public static ZkSerializer getZkSerializer(){
if(zkSerializer == null){
synchronized (zkSerializer) {
if(zkSerializer == null){
zkSerializer = new ZkSerializer() {
public byte[] serialize(Object data) throws ZkMarshallingError {
return ZKStringSerializer.serialize(data);
}
public Object deserialize(byte[] bytes) throws ZkMarshallingError {
return ZKStringSerializer.deserialize(bytes);
}
};
}
}
}
return zkSerializer;
}
/** 获取ZkClient*/
private static ZkClient getZkClient(){
String zkConnect = KafkaHelper.getConsumerRealConfig().zkConnect();
int connTimeout = KafkaHelper.getConsumerRealConfig().zkConnectionTimeoutMs();
int sessTimeout = KafkaHelper.getConsumerRealConfig().zkSessionTimeoutMs();
ZkClient client = new ZkClient(zkConnect, connTimeout, sessTimeout, getZkSerializer());
return client;
}
/** 获取所有Brokers*/
public static List<BrokerModel> getAllBrokers(){
ZkClient client = getZkClient();
List<Broker> asJavaList = JavaConversions.asJavaList(ZkUtils.getAllBrokersInCluster(client));
List<BrokerModel> retList = new ArrayList<BrokerModel>();
for (Broker broker : asJavaList) {
BrokerModel model = new BrokerModel();
model.setHost(broker.host());
model.setId(broker.id());
model.setPort(broker.port());
retList.add(model);
}
return retList;
}
/**
* 获取Kafka的队列名字列表
* @return
*/
public static List<String> getAllTopicNames(){
ZkClient client = getZkClient();
Seq<String> allTopics = ZkUtils.getAllTopics(client);
List<String> retList = JavaConversions.asJavaList(allTopics);
return retList;
}
public static List<TopicModel> getAllTopicModels() {
List<String> allTopicNames = getAllTopicNames();
List<TopicModel> retList = new ArrayList<TopicModel>();
for (String topic : allTopicNames) {
TopicModel model = new TopicModel();
model.setName(topic);
List<PartitionModel> partitions = new ArrayList<PartitionModel>();
List<Integer> partitionIds = getAllPartitionIds(topic);
for (Integer partitionId : partitionIds) {
PartitionModel partitionInfo = getPartitionInfo(topic, partitionId);
partitions.add(partitionInfo);
}
model.setPartitions(partitions);
retList.add(model);
}
return retList;
}
/**
* 根据指定topic获取该topic的partition列表
* @param topic
* @return
*/
public static List<Integer> getAllPartitionIds(String topic) {
List list = new ArrayList();
list.add(topic);
Buffer buffer = JavaConversions.asScalaBuffer(list);
Map<String, Seq<Object>> topicPartMap = JavaConversions.asJavaMap(ZkUtils.getPartitionsForTopics(getZkClient(), buffer));
List<Object> javaList = JavaConversions.asJavaList(topicPartMap.get(topic));
List<Integer> retList = new ArrayList<Integer>();
for (Object obj : javaList) {
retList.add((Integer)obj);
}
return retList;
}
/**
* 获取partition信息
*
* @param topic
* @param partitionId
* @return
*/
public static PartitionModel getPartitionInfo(String topic, int partitionId) {
PartitionModel partition = new PartitionModel();
//获取Leader
Option<Object> leaderForPartition = ZkUtils.getLeaderForPartition(getZkClient(), topic, partitionId);
int leader = -1;
if(leaderForPartition.isDefined()){
leader = (Integer)leaderForPartition.get();
}
partition.setLeader(leader);
//epoch
int epochForPartition = ZkUtils.getEpochForPartition(getZkClient(), topic, partitionId);
partition.setEpoch(epochForPartition);
//In-Sync
List<Object> asJavaList = JavaConversions.asJavaList(ZkUtils.getInSyncReplicasForPartition(getZkClient(), topic, partitionId));
List<Integer> retInSyncList = new ArrayList<Integer>(asJavaList.size());
for (Object obj : asJavaList) {
retInSyncList.add((Integer)obj);
}
partition.setSyncs(retInSyncList);
//replication
List<Object> asJavaList2 = JavaConversions.asJavaList(ZkUtils.getReplicasForPartition(getZkClient(), topic, partitionId));
List<Integer> retReplicaList = new ArrayList<Integer>(asJavaList.size());
for (Object obj : asJavaList2) {
retReplicaList.add((Integer)obj);
}
partition.setReplicass(retReplicaList);
return partition;
}
/** 根据groupName获取[topic, partition]的当前offset
*
* @param groupName
* @param topic
* @param partitionId
* @return
*/
public static String getConsumerGroupOffset(String groupName, String topic, int partitionId){
String offsetPath = "/consumers/" + groupName + "/offsets/" + topic + "/" + partitionId;
Tuple2<String, Stat> readData = ZkUtils.readData(getZkClient(), offsetPath);
String offset = readData._1;
return offset;
}
/**
* 根据groupName获取[topic, partition]的当前owner
* @param groupName
* @param topic
* @param partitionId
* @return
*/
public static String getConsumerPartitionOwner(String groupName, String topic, int partitionId){
String ownerPath = "/consumers/" + groupName + "/owners/" + topic + "/" + partitionId;
Tuple2<String, Stat> readData = ZkUtils.readData(getZkClient(), ownerPath);
String offset = readData._1;
return offset;
}
/**
* 根据GroupName获取所有的Consumer信息
* @param groupName
* @return
*/
public static List<String> getAllGroupConsumers(String groupName){
List<String> asJavaList = JavaConversions.asJavaList(ZkUtils.getConsumersInGroup(getZkClient(), groupName));
return asJavaList;
}
/** 根据Topic列表返回TopicMetaData信息
*
* @param topics
* @return */
public static List<TopicMetadata> getTopicMetaData(List<String> topics) {
SimpleConsumer simpleConsumer = SimpleKafkaHelper.getDefaultSimpleConsumer();
TopicMetadataRequest metaDataRequest = new TopicMetadataRequest(topics);
TopicMetadataResponse resp = simpleConsumer.send(metaDataRequest);
List<TopicMetadata> metadatas = resp.topicsMetadata();
return metadatas;
}
public static OffsetFetchResponse getOffsetResponse(String groupId, List<TopicAndPartition> topicAndPartitions, short versionId, int correlationId,
String clientId) {
SimpleConsumer simpleConsumer = SimpleKafkaHelper.getDefaultSimpleConsumer();
OffsetFetchRequest offsetRequest = new OffsetFetchRequest(groupId, topicAndPartitions, versionId, correlationId, clientId);
OffsetFetchResponse offsetResponse = simpleConsumer.fetchOffsets(offsetRequest);
return offsetResponse;
}
public static OffsetCommitResponse commitOffsets(String groupId, Map<TopicAndPartition, OffsetMetadataAndError> requestInfo, short versionId,
int correlationId, String clientId) {
SimpleConsumer simpleConsumer = SimpleKafkaHelper.getDefaultSimpleConsumer();
OffsetCommitRequest commitRequest = new OffsetCommitRequest(groupId, requestInfo, versionId, correlationId, clientId);
OffsetCommitResponse commitResponse = simpleConsumer.commitOffsets(commitRequest);
return commitResponse;
}
public static OffsetResponse getOffsetsBefore(Map<TopicAndPartition, PartitionOffsetRequestInfo> requestInfo, short versionId, String clientId) {
SimpleConsumer simpleConsumer = SimpleKafkaHelper.getDefaultSimpleConsumer();
OffsetRequest offSetRequest = new OffsetRequest(requestInfo, versionId, clientId);
OffsetResponse offsetsBefore = simpleConsumer.getOffsetsBefore(offSetRequest);
return offsetsBefore;
}
public static void main1(String[] args) throws Exception{
List<String> topics = new ArrayList<String>();
topics.add("applog");
List<TopicMetadata> topicMetaData = getTopicMetaData(topics);
for (TopicMetadata meta : topicMetaData) {
System.out.println(meta.topic());
List<PartitionMetadata> list = meta.partitionsMetadata();
System.out.println(list.size());
for (PartitionMetadata pmeta : list) {
System.out.println("id: " + pmeta.partitionId());
System.out.println("isr: " + pmeta.isr());
System.out.println("leader: " + pmeta.leader());
System.out.println("replicas: " + pmeta.replicas());
}
}
}
public static void main(String[] args) {
List<TopicModel> topicModels = getAllTopicModels();
System.out.println(topicModels);
List<BrokerModel> brokers = getAllBrokers();
System.out.println(brokers);
}
}
|
[
"[email protected]"
] | |
6a05bd03589b9a19ef9da8c0eaaa4ac01a0d49d9
|
a985a53be02c51ace3b31e670762ddeb00b40506
|
/src/main/java/com/mano/courtage/server/AuthenticationRestController.java
|
42522108c0b9986a681ffb7d0f0b0facb13f9aa5
|
[] |
no_license
|
rrocher/manoCourtage
|
b06cfd9f4750665c6b25d61a4fd24d7827b01146
|
56caecac980c4fd965fbe94cfef49c0408c0cafb
|
refs/heads/master
| 2021-03-22T03:07:41.753221 | 2017-08-22T01:01:24 | 2017-08-22T01:01:24 | 100,828,962 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,294 |
java
|
package com.mano.courtage.server;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.mobile.device.Device;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.mano.courtage.config.JwtAuthenticationRequest;
import com.mano.courtage.config.JwtTokenUtil;
import com.mano.courtage.config.JwtUser;
import com.mano.courtage.service.JwtAuthenticationResponse;
import javax.servlet.http.HttpServletRequest;
@RestController
public class AuthenticationRestController {
@Value("${jwt.header}")
private String tokenHeader;
@Autowired
private AuthenticationManager authenticationManager;
@Autowired
private JwtTokenUtil jwtTokenUtil;
@Autowired
private UserDetailsService userDetailsService;
@RequestMapping(value = "${jwt.route.authentication.path}", method = RequestMethod.POST)
public ResponseEntity<?> createAuthenticationToken(@RequestBody JwtAuthenticationRequest authenticationRequest, Device device) throws AuthenticationException {
// Perform the security
final Authentication authentication = authenticationManager.authenticate(
new UsernamePasswordAuthenticationToken(
authenticationRequest.getUsername(),
authenticationRequest.getPassword()
)
);
SecurityContextHolder.getContext().setAuthentication(authentication);
// Reload password post-security so we can generate token
final UserDetails userDetails = userDetailsService.loadUserByUsername(authenticationRequest.getUsername());
final String token = jwtTokenUtil.generateToken(userDetails, device);
// Return the token
return ResponseEntity.ok(new JwtAuthenticationResponse(token));
}
@RequestMapping(value = "${jwt.route.authentication.refresh}", method = RequestMethod.GET)
public ResponseEntity<?> refreshAndGetAuthenticationToken(HttpServletRequest request) {
String token = request.getHeader(tokenHeader);
String username = jwtTokenUtil.getUsernameFromToken(token);
JwtUser user = (JwtUser) userDetailsService.loadUserByUsername(username);
if (jwtTokenUtil.canTokenBeRefreshed(token)) {
String refreshedToken = jwtTokenUtil.refreshToken(token);
return ResponseEntity.ok(new JwtAuthenticationResponse(refreshedToken));
} else {
return ResponseEntity.badRequest().body(null);
}
}
}
|
[
"[email protected]"
] | |
a3a3b6df51371c6e9c2414744c2cfae53d6d510f
|
2d2235d1b0a3c50b0d23bca6d48b47ab64b1a04a
|
/drools-core/src/main/java/org/drools/core/rule/constraint/XpathConstraint.java
|
88d8390e1d027b2b7f3d424568688506a2e7c57a
|
[
"Apache-2.0"
] |
permissive
|
NeoLoo/drools
|
25f98316c74911068d34e1692c90f1342fa435fb
|
3a31d023ea590114683a82d68c5e6ac8c5d49ae9
|
refs/heads/master
| 2020-12-30T23:08:45.309370 | 2015-04-28T11:53:06 | 2015-04-28T11:53:15 | 34,831,771 | 1 | 0 | null | 2015-04-30T03:18:18 | 2015-04-30T03:18:18 | null |
UTF-8
|
Java
| false | false | 11,212 |
java
|
package org.drools.core.rule.constraint;
import org.drools.core.WorkingMemory;
import org.drools.core.base.ClassObjectType;
import org.drools.core.common.InternalFactHandle;
import org.drools.core.common.InternalWorkingMemory;
import org.drools.core.phreak.ReactiveObject;
import org.drools.core.reteoo.LeftTuple;
import org.drools.core.rule.ContextEntry;
import org.drools.core.rule.Declaration;
import org.drools.core.rule.From;
import org.drools.core.rule.MutableTypeConstraint;
import org.drools.core.spi.AlphaNodeFieldConstraint;
import org.drools.core.spi.BetaNodeFieldConstraint;
import org.drools.core.spi.Constraint;
import org.drools.core.spi.DataProvider;
import org.drools.core.spi.InternalReadAccessor;
import org.drools.core.spi.PatternExtractor;
import org.drools.core.spi.PropagationContext;
import org.drools.core.spi.Tuple;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import static org.drools.core.util.ClassUtils.getAccessor;
public class XpathConstraint extends MutableTypeConstraint {
private final LinkedList<XpathChunk> chunks = new LinkedList<XpathChunk>();
private Declaration declaration;
public XpathConstraint() {
setType(ConstraintType.XPATH);
}
public XpathChunk addChunck(Class<?> clazz, String field, boolean iterate) {
XpathChunk chunk = XpathChunk.get(clazz, field, iterate);
if (chunk != null) {
chunks.add(chunk);
}
return chunk;
}
@Override
public Declaration[] getRequiredDeclarations() {
// TODO ?
return new Declaration[0];
}
@Override
public void replaceDeclaration(Declaration oldDecl, Declaration newDecl) {
throw new UnsupportedOperationException("org.drools.core.rule.constraint.XpathConstraint.replaceDeclaration -> TODO");
}
@Override
public MutableTypeConstraint clone() {
throw new UnsupportedOperationException("org.drools.core.rule.constraint.XpathConstraint.clone -> TODO");
}
@Override
public boolean isTemporal() {
// TODO ?
return false;
}
@Override
public boolean isAllowedCachedLeft(ContextEntry context, InternalFactHandle handle) {
throw new UnsupportedOperationException("org.drools.core.rule.constraint.XpathConstraint.isAllowedCachedLeft -> TODO");
}
@Override
public boolean isAllowedCachedRight(LeftTuple tuple, ContextEntry context) {
throw new UnsupportedOperationException("org.drools.core.rule.constraint.XpathConstraint.isAllowedCachedRight -> TODO");
}
@Override
public ContextEntry createContextEntry() {
throw new UnsupportedOperationException("org.drools.core.rule.constraint.XpathConstraint.createContextEntry -> TODO");
}
@Override
public boolean isAllowed(InternalFactHandle handle, InternalWorkingMemory workingMemory, ContextEntry context) {
throw new UnsupportedOperationException("org.drools.core.rule.constraint.XpathConstraint.isAllowed -> TODO");
}
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
throw new UnsupportedOperationException("org.drools.core.rule.constraint.XpathConstraint.readExternal -> TODO");
}
@Override
public void writeExternal(ObjectOutput out) throws IOException {
throw new UnsupportedOperationException("org.drools.core.rule.constraint.XpathConstraint.writeExternal -> TODO");
}
public LinkedList<XpathChunk> getChunks() {
return chunks;
}
public Class<?> getResultClass() {
return chunks.isEmpty() ? Object.class : chunks.getLast().getReturnedClass();
}
public Declaration getDeclaration() {
return declaration;
}
public void setDeclaration(Declaration declaration) {
declaration.setReadAccessor( getReadAccessor() );
this.declaration = declaration;
}
public InternalReadAccessor getReadAccessor() {
return new PatternExtractor( new ClassObjectType( getResultClass() ) );
}
private interface XpathEvaluator {
Iterable<?> evaluate(InternalWorkingMemory workingMemory, LeftTuple leftTuple, Object object);
}
private static class SingleChunkXpathEvaluator implements XpathEvaluator {
private final XpathChunk chunk;
private SingleChunkXpathEvaluator(XpathChunk chunk) {
this.chunk = chunk;
}
public Iterable<?> evaluate(InternalWorkingMemory workingMemory, LeftTuple leftTuple, Object object) {
return evaluateObject(workingMemory, leftTuple, chunk, new ArrayList<Object>(), object);
}
private List<Object> evaluateObject(InternalWorkingMemory workingMemory, LeftTuple leftTuple, XpathChunk chunk, List<Object> list, Object object) {
Object result = chunk.evaluate(object);
if (result instanceof ReactiveObject) {
((ReactiveObject) result).addLeftTuple(leftTuple);
}
if (chunk.iterate && result instanceof Iterable) {
for (Object value : (Iterable<?>) result) {
if (value instanceof ReactiveObject) {
((ReactiveObject) value).addLeftTuple(leftTuple);
}
if (value != null) {
list.add(value);
}
}
} else if (result != null) {
list.add(result);
}
return list;
}
}
public static class XpathChunk {
private final Class<?> clazz;
private final String field;
private final boolean iterate;
private final Method accessor;
private List<Constraint> constraints;
private XpathChunk(Class<?> clazz, String field, boolean iterate, Method accessor) {
this.clazz = clazz;
this.field = field;
this.iterate = iterate;
this.accessor = accessor;
this.accessor.setAccessible(true);
}
public void addConstraint(Constraint constraint) {
if (constraints == null) {
constraints = new ArrayList<Constraint>();
}
setConstraintType((MutableTypeConstraint)constraint);
constraints.add(constraint);
}
private void setConstraintType(final MutableTypeConstraint constraint) {
final Declaration[] declarations = constraint.getRequiredDeclarations();
boolean isAlphaConstraint = true;
for ( int i = 0; isAlphaConstraint && i < declarations.length; i++ ) {
if ( !declarations[i].isGlobal() ) {
isAlphaConstraint = false;
}
}
ConstraintType type = isAlphaConstraint ? ConstraintType.ALPHA : ConstraintType.BETA;
constraint.setType(type);
}
public <T> T evaluate(Object obj) {
try {
return (T)accessor.invoke(obj);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public static XpathChunk get(Class<?> clazz, String field, boolean iterate) {
Method accessor = getAccessor(clazz, field);
if (accessor == null) {
return null;
}
return new XpathChunk(clazz, field, iterate, accessor);
}
public Class<?> getReturnedClass() {
Class<?> lastReturnedClass = accessor.getReturnType();
return iterate && Iterable.class.isAssignableFrom(lastReturnedClass) ?
getParametricType() :
lastReturnedClass;
}
public Class<?> getParametricType() {
Type returnedType = accessor.getGenericReturnType();
if (returnedType instanceof ParameterizedType) {
Type[] parametricType = ((ParameterizedType) returnedType).getActualTypeArguments();
if (parametricType.length > 0) {
return (Class<?>)parametricType[0];
}
}
return Object.class;
}
public From asFrom() {
From from = new From( new XpathDataProvider(new SingleChunkXpathEvaluator(this)) );
from.setResultClass(getReturnedClass());
return from;
}
public List<BetaNodeFieldConstraint> getBetaaConstraints() {
if (constraints == null) {
return Collections.emptyList();
}
List<BetaNodeFieldConstraint> betaConstraints = new ArrayList<BetaNodeFieldConstraint>();
for (Constraint constraint : constraints) {
if (constraint.getType() == ConstraintType.BETA) {
betaConstraints.add(((BetaNodeFieldConstraint) constraint));
}
}
return betaConstraints;
}
public List<AlphaNodeFieldConstraint> getAlphaConstraints() {
if (constraints == null) {
return Collections.emptyList();
}
List<AlphaNodeFieldConstraint> alphaConstraints = new ArrayList<AlphaNodeFieldConstraint>();
for (Constraint constraint : constraints) {
if (constraint.getType() == ConstraintType.ALPHA) {
alphaConstraints.add(((AlphaNodeFieldConstraint) constraint));
}
}
return alphaConstraints;
}
@Override
public String toString() {
return clazz.getSimpleName() + (iterate ? " / " : " . ") + field + (constraints != null ? " " + constraints : "");
}
}
public static class XpathDataProvider implements DataProvider {
private final XpathEvaluator xpathEvaluator;
public XpathDataProvider(XpathEvaluator xpathEvaluator) {
this.xpathEvaluator = xpathEvaluator;
}
@Override
public Declaration[] getRequiredDeclarations() {
return new Declaration[0];
}
@Override
public Object createContext() {
return null;
}
@Override
public Iterator getResults(Tuple tuple, WorkingMemory wm, PropagationContext ctx, Object providerContext) {
LeftTuple leftTuple = (LeftTuple) tuple;
InternalFactHandle fh = leftTuple.getHandle();
Object obj = fh.getObject();
return xpathEvaluator.evaluate((InternalWorkingMemory)wm, leftTuple, obj).iterator();
}
@Override
public DataProvider clone() {
return this;
}
@Override
public void replaceDeclaration(Declaration declaration, Declaration resolved) {
throw new UnsupportedOperationException("org.drools.core.rule.constraint.XpathConstraint.XpathDataProvider.replaceDeclaration -> TODO");
}
}
}
|
[
"[email protected]"
] | |
5022418214e04449c2651135a916bb8371c85389
|
8f4df2a4f26231d55730e89f11ff53e4e048a1ff
|
/PlusOne.java
|
3a1c51f6e4449b5b9dc140dc8a2fe8a83099b64a
|
[] |
no_license
|
elouejmajdi/Core-Java-SE-8-
|
340a4ff0708c9c2edbcb04dce736f4c0a914fd14
|
126d66b32306c2818c2c947df7d5bfeedd896468
|
refs/heads/master
| 2020-04-03T06:56:24.836632 | 2019-02-05T20:08:38 | 2019-02-05T20:08:38 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 630 |
java
|
package the3profe.jse8.algorithms;
public class PlusOne {
public static int[] plusOne(int[] digits) {
int[] list = new int[digits.length];
for(int i =0 ; i<list.length-1; i++ )
{
list[i] = digits[i];
}
list[list.length-1]=digits[list.length-1]+1;
return list ;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] list = {1,2,3};
int [] list3 = plusOne(list);
for (int i : list3) {
System.out.print(" "+i);
}
}
}
|
[
"[email protected]"
] | |
b5a228ccca519586183b5d13863936bda4405665
|
b71c743ea958f11b15ba900b860a933818b1f11a
|
/src/main/java/com/study/springboot/dto/Order_product_infoDto.java
|
477f0169ba457972f26d8b75e0b02a4bf6d57a7e
|
[] |
no_license
|
sooyundl93/AppleShopProject
|
1de78c1c7b581316ea0d2272d41a935163ff1aff
|
8727be1beb1e3871277ba31f62a5570e8593263a
|
refs/heads/main
| 2023-08-28T00:12:33.419829 | 2021-10-24T16:30:15 | 2021-10-24T16:30:15 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,174 |
java
|
package com.study.springboot.dto;
// 주문 상품 정보 order_product_info 테이블 Dto
public class Order_product_infoDto {
private int item_no; // 주문 품목 식별번호
private String order_id; // 주문번호
private String product_code; // 상품번호
private String product_name; // 주문한 상품명
private String parent_category; // 상위 카테고리
private String child_category; // 하위 카테고리
private String manufacturer; // 제조사
private int product_price; // 주문한 상품 가격
private int shipping_cost; // 배송비
private int number_of_orders; // 주문한 개수
private String wrote_review_flag; // 리뷰 작성 여부
public Order_product_infoDto() {
super();
}
public Order_product_infoDto(int item_no, String order_id, String product_code, String product_name,
String parent_category, String child_category, String manufacturer, int product_price, int shipping_cost,
int number_of_orders, String wrote_review_flag) {
super();
this.item_no = item_no;
this.order_id = order_id;
this.product_code = product_code;
this.product_name = product_name;
this.parent_category = parent_category;
this.child_category = child_category;
this.manufacturer = manufacturer;
this.product_price = product_price;
this.shipping_cost = shipping_cost;
this.number_of_orders = number_of_orders;
this.wrote_review_flag = wrote_review_flag;
}
public int getItem_no() {
return item_no;
}
public void setItem_no(int item_no) {
this.item_no = item_no;
}
public String getOrder_id() {
return order_id;
}
public void setOrder_id(String order_id) {
this.order_id = order_id;
}
public String getProduct_code() {
return product_code;
}
public void setProduct_code(String product_code) {
this.product_code = product_code;
}
public String getProduct_name() {
return product_name;
}
public void setProduct_name(String product_name) {
this.product_name = product_name;
}
public String getParent_category() {
return parent_category;
}
public void setParent_category(String parent_category) {
this.parent_category = parent_category;
}
public String getChild_category() {
return child_category;
}
public void setChild_category(String child_category) {
this.child_category = child_category;
}
public String getManufacturer() {
return manufacturer;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public int getProduct_price() {
return product_price;
}
public void setProduct_price(int product_price) {
this.product_price = product_price;
}
public int getShipping_cost() {
return shipping_cost;
}
public void setShipping_cost(int shipping_cost) {
this.shipping_cost = shipping_cost;
}
public int getNumber_of_orders() {
return number_of_orders;
}
public void setNumber_of_orders(int number_of_orders) {
this.number_of_orders = number_of_orders;
}
public String getWrote_review_flag() {
return wrote_review_flag;
}
public void setWrote_review_flag(String wrote_review_flag) {
this.wrote_review_flag = wrote_review_flag;
}
}
|
[
"[email protected]"
] | |
6eb09a4cc3ddd3f18f4a20112032198e55ed227a
|
ba352815cdad2037ceec9a2c1c650001de261a05
|
/src/main/java/gr/codehub/service/WeatherService.java
|
58110e47178f212975d9ffb4a60f5cd0cff82732
|
[] |
no_license
|
iracleous/WeatherService
|
66927837818cb28508c2b2356199c02ad8e3a6a8
|
8ad13279b34b225e6c85f8a04ff1ce200450d815
|
refs/heads/master
| 2022-12-20T13:59:18.971260 | 2020-10-08T17:08:52 | 2020-10-08T17:08:52 | 302,393,780 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 171 |
java
|
package gr.codehub.service;
public interface WeatherService {
double getTemperature(String location);
void setTemperature(String location, double temperature);
}
|
[
"[email protected]"
] | |
5c2858a3d0ae35d8d45f1f3bc82a425abfa3e97f
|
1b307344a0dd5590e204529b7cc7557bed02d2b9
|
/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/models/DetectedLanguage.java
|
d5327a47e37893807ddf9109c64c292d48f8d092
|
[
"LicenseRef-scancode-generic-cla",
"LGPL-2.1-or-later",
"BSD-3-Clause",
"MIT",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference",
"CC0-1.0"
] |
permissive
|
alzimmermsft/azure-sdk-for-java
|
7e72a194e488dd441e44e1fd12c0d4c1cacb1726
|
9f5c9b2fd43c2f9f74c4f79d386ae00600dd1bf4
|
refs/heads/main
| 2023-09-01T00:13:48.628043 | 2023-03-27T09:00:31 | 2023-03-27T09:00:31 | 176,596,152 | 4 | 0 |
MIT
| 2023-03-08T18:13:24 | 2019-03-19T20:49:38 |
Java
|
UTF-8
|
Java
| false | false | 3,730 |
java
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.ai.textanalytics.implementation.models;
import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
/** The DetectedLanguage model. */
@Fluent
public final class DetectedLanguage {
/*
* Long name of a detected language (e.g. English, French).
*/
@JsonProperty(value = "name", required = true)
private String name;
/*
* A two letter representation of the detected language according to the ISO 639-1 standard (e.g. en, fr).
*/
@JsonProperty(value = "iso6391Name", required = true)
private String iso6391Name;
/*
* A confidence score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is
* true.
*/
@JsonProperty(value = "confidenceScore", required = true)
private double confidenceScore;
/*
* Identifies the script of the input document.
*/
@JsonProperty(value = "script")
private ScriptKind script;
/** Creates an instance of DetectedLanguage class. */
public DetectedLanguage() {}
/**
* Get the name property: Long name of a detected language (e.g. English, French).
*
* @return the name value.
*/
public String getName() {
return this.name;
}
/**
* Set the name property: Long name of a detected language (e.g. English, French).
*
* @param name the name value to set.
* @return the DetectedLanguage object itself.
*/
public DetectedLanguage setName(String name) {
this.name = name;
return this;
}
/**
* Get the iso6391Name property: A two letter representation of the detected language according to the ISO 639-1
* standard (e.g. en, fr).
*
* @return the iso6391Name value.
*/
public String getIso6391Name() {
return this.iso6391Name;
}
/**
* Set the iso6391Name property: A two letter representation of the detected language according to the ISO 639-1
* standard (e.g. en, fr).
*
* @param iso6391Name the iso6391Name value to set.
* @return the DetectedLanguage object itself.
*/
public DetectedLanguage setIso6391Name(String iso6391Name) {
this.iso6391Name = iso6391Name;
return this;
}
/**
* Get the confidenceScore property: A confidence score between 0 and 1. Scores close to 1 indicate 100% certainty
* that the identified language is true.
*
* @return the confidenceScore value.
*/
public double getConfidenceScore() {
return this.confidenceScore;
}
/**
* Set the confidenceScore property: A confidence score between 0 and 1. Scores close to 1 indicate 100% certainty
* that the identified language is true.
*
* @param confidenceScore the confidenceScore value to set.
* @return the DetectedLanguage object itself.
*/
public DetectedLanguage setConfidenceScore(double confidenceScore) {
this.confidenceScore = confidenceScore;
return this;
}
/**
* Get the script property: Identifies the script of the input document.
*
* @return the script value.
*/
public ScriptKind getScript() {
return this.script;
}
/**
* Set the script property: Identifies the script of the input document.
*
* @param script the script value to set.
* @return the DetectedLanguage object itself.
*/
public DetectedLanguage setScript(ScriptKind script) {
this.script = script;
return this;
}
}
|
[
"[email protected]"
] | |
c99699090bcface3d53005051fc7a90dad7ab22b
|
6fa3bfc29afee0bce1b4d60b3f774de4981bfc09
|
/app/src/main/java/com/hhtxproject/piafriendscollege/Tools/ViewFindUtils.java
|
ead2ed598fd3c19207f362afaee6bfcbe2401889
|
[] |
no_license
|
respectupper/android
|
fa1b33aa51888d2de1a5219ca187ab3df5151418
|
ce3b81d339358eefa3ba81af201f6a364de2bf75
|
refs/heads/develop
| 2020-03-22T08:50:31.460778 | 2018-07-26T06:51:39 | 2018-07-26T06:51:39 | 139,795,124 | 3 | 1 | null | 2018-08-23T02:17:51 | 2018-07-05T04:34:58 |
Java
|
UTF-8
|
Java
| false | false | 1,101 |
java
|
package com.hhtxproject.piafriendscollege.Tools;
import android.util.SparseArray;
import android.view.View;
@SuppressWarnings({ "unchecked" })
public class ViewFindUtils
{
/**
* ViewHolder简洁写法,避免适配器中重复定义ViewHolder,减少代码量 用法:
*
* <pre>
* if (convertView == null)
* {
* convertView = View.inflate(context, R.layout.ad_demo, null);
* }
* TextView tv_demo = ViewHolderUtils.get(convertView, R.id.tv_demo);
* ImageView iv_demo = ViewHolderUtils.get(convertView, R.id.iv_demo);
* </pre>
*/
public static <T extends View> T hold(View view, int id)
{
SparseArray<View> viewHolder = (SparseArray<View>) view.getTag();
if (viewHolder == null)
{
viewHolder = new SparseArray<View>();
view.setTag(viewHolder);
}
View childView = viewHolder.get(id);
if (childView == null)
{
childView = view.findViewById(id);
viewHolder.put(id, childView);
}
return (T) childView;
}
/**
* 替代findviewById方法
*/
public static <T extends View> T find(View view, int id)
{
return (T) view.findViewById(id);
}
}
|
[
"[email protected]"
] | |
3242df7f94976dedfb8fb7642e6411334142289d
|
8264e77176d77767c5244e24223ff26a9e193e38
|
/VideoGameShop/src/main/java/com/revature/app/services/GameSystemService.java
|
2476a2af07034d8891dcf58d0973848f2dcdb350
|
[] |
no_license
|
jordythen/Video-Game-Store
|
99ccbe7446b5af9baf11aa4c782560e09b9ea92b
|
11392eb7bfc16814af7926472ec8568412213b49
|
refs/heads/master
| 2022-12-27T11:42:24.854008 | 2020-08-03T16:35:52 | 2020-08-03T16:35:52 | 275,929,516 | 3 | 0 | null | 2020-10-13T23:26:53 | 2020-06-29T21:25:18 |
Java
|
UTF-8
|
Java
| false | false | 241 |
java
|
package com.revature.app.services;
import java.util.List;
import com.revature.app.beans.GameSystem;
public interface GameSystemService extends GenericService<GameSystem>{
public List<GameSystem> findAllSystemForGameID(Integer gameID);
}
|
[
"[email protected]"
] | |
3a58246eb574d2e3f8e1cdb6cb92853c9664e09f
|
3387b03c6788a8371b0d0988d8708290d65fcdc3
|
/app/src/main/java/cn/lenovo/reportdeviceinfo/DeviceStatus.java
|
3fbb2a67b670182d1a65f1a293ecef9bc6cbae62
|
[] |
no_license
|
woshiqiang/G1test3
|
c96c75a668ce96c4ad616ff65b5f17cf54de97d8
|
10e3708e37cd6b4ea2bcb00630dd2c627003512a
|
refs/heads/master
| 2020-03-27T06:07:21.170564 | 2018-08-25T08:49:09 | 2018-08-25T08:49:09 | 146,080,405 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,611 |
java
|
package cn.lenovo.reportdeviceinfo;
import android.content.Context;
import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject;
public class DeviceStatus {
private Context mContext;
private static DeviceStatus mInstance;
private DeviceInfo deviceInfo ;
private boolean mIsReportPowerOn;
private DeviceStatus(Context context){
mContext = context;
deviceInfo = DeviceInfo.getInstance(mContext);
}
public static DeviceStatus getInstance(Context context){
if(mInstance == null){
mInstance = new DeviceStatus(context);
}
return mInstance;
}
public void setReportPowerOn(boolean isReportPowerOn){
mIsReportPowerOn = isReportPowerOn;
}
public boolean isReportPowerOn(){
return mIsReportPowerOn;
}
public String toPowerOnStatus(){
JSONObject powerOnObj = new JSONObject();
try {
powerOnObj.put("deviceSN", deviceInfo.getSerial());
powerOnObj.put("deviceName", "Lenovo AR G1");
powerOnObj.put("osVersion", "Android " + deviceInfo.getAndroidVersion());
powerOnObj.put("coordinate", deviceInfo.beginLocatioon());
powerOnObj.put("networkType", deviceInfo.getNetWorkType());
powerOnObj.put("clientTime", System.currentTimeMillis() + "");
powerOnObj.put("others", "");
Log.d("Tmac", "coordinate = " + deviceInfo.beginLocatioon());
} catch (JSONException e) {
e.printStackTrace();
}
return powerOnObj.toString();
}
}
|
[
"[email protected]"
] | |
5a8104fc55637ab962fd8edf8cabd17f52f4ffd1
|
4042588b177817be87691fbafa0a4e4dc86c07fe
|
/src/main/java/jpabook/jpashop/service/ItemService.java
|
08dede1daf7ae40256d117d77f784ec3a6ff3d1a
|
[] |
no_license
|
lse0101/JpaStudy
|
1832604d7caee838b995767f85b8455e3fb3a309
|
22b81793561f3a55b3ef8dec02a258da8e057989
|
refs/heads/master
| 2021-01-13T02:31:00.962651 | 2017-03-03T04:39:37 | 2017-03-03T04:39:37 | 81,543,020 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 645 |
java
|
package jpabook.jpashop.service;
import jpabook.jpashop.domain.Item;
import jpabook.jpashop.repository.ItemRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by lse0101 on 2017-02-27.
*/
@Service
public class ItemService {
@Autowired
ItemRepository itemRepository;
public void saveItem(Item item) {
itemRepository.save(item);
}
public List<Item> findItems() {
return itemRepository.findAll();
}
public Item findOne(Long itemId) {
return itemRepository.findOne(itemId);
}
}
|
[
"[email protected]"
] | |
658663d5c5d4ffaf9dd6431037337cb9e0791949
|
2bc2eadc9b0f70d6d1286ef474902466988a880f
|
/tags/mule-1.4.3/transports/stream/src/test/java/org/mule/providers/stream/SystemStreamConnectorTestCase.java
|
a37a2e1d9af295afe7cf7c91eb75ab62383e537f
|
[] |
no_license
|
OrgSmells/codehaus-mule-git
|
085434a4b7781a5def2b9b4e37396081eaeba394
|
f8584627c7acb13efdf3276396015439ea6a0721
|
refs/heads/master
| 2022-12-24T07:33:30.190368 | 2020-02-27T19:10:29 | 2020-02-27T19:10:29 | 243,593,543 | 0 | 0 | null | 2022-12-15T23:30:00 | 2020-02-27T18:56:48 | null |
UTF-8
|
Java
| false | false | 1,333 |
java
|
/*
* $Id$
* --------------------------------------------------------------------------------------
* Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
*
* The software in this package is published under the terms of the CPAL v1.0
* license, a copy of which has been included with this distribution in the
* LICENSE.txt file.
*/
package org.mule.providers.stream;
import org.mule.tck.providers.AbstractConnectorTestCase;
import org.mule.umo.provider.UMOConnector;
public class SystemStreamConnectorTestCase extends AbstractConnectorTestCase
{
/*
* (non-Javadoc)
*
* @see org.mule.tck.providers.AbstractConnectorTestCase#createConnector()
*/
public UMOConnector createConnector() throws Exception
{
UMOConnector connector = new SystemStreamConnector();
connector.setName("TestStream");
connector.initialise();
return connector;
}
public String getTestEndpointURI()
{
return "stream://System.out";
}
public UMOConnector getConnector() throws Exception
{
UMOConnector cnn = new SystemStreamConnector();
cnn.setName("TestStream");
cnn.initialise();
return cnn;
}
public Object getValidMessage() throws Exception
{
return "Test Message";
}
}
|
[
"aguenther@bf997673-6b11-0410-b953-e057580c5b09"
] |
aguenther@bf997673-6b11-0410-b953-e057580c5b09
|
bbb2ae57da56c0368e08e2f664439a69687cd61b
|
e7aeb9197e3d29050bb403e02e2efd12d9215b46
|
/easy/designHashMap.java
|
fa2f03529132e249aa15d8a8de9662181ce6ee2a
|
[] |
no_license
|
navonf/leetcode
|
72a42912d2ee8fee3f34c0aeeaf8d96f3b0c0870
|
3898c314be662b70ebd02107616ae52fd1889bec
|
refs/heads/master
| 2022-11-08T07:29:16.270637 | 2022-11-02T00:33:58 | 2022-11-02T00:33:58 | 139,999,381 | 3 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,450 |
java
|
class MyHashMap {
public int size;
public LinkedList<Bucket> map;
/** Initialize your data structure here. */
public MyHashMap() {
this.size = 2069;
this.map = new LinkedList<Bucket>();
for (int i = 0; i < size; i++) {
this.map.add(i, new Bucket());
}
}
/** value will always be non-negative. */
public void put(int key, int value) {
int idx = this.hash(key);
Bucket b = this.map.get(idx);
if (b != null) {
b.insert(key, value);
}
}
/** Returns the value to which the specified key is mapped, or -1 if this map contains no mapping for the key */
public int get(int key) {
int idx = this.hash(key);
Bucket b = this.map.get(idx);
if (b != null) {
Pair p = b.getPair(key);
if (p != null) {
return p.val;
}
}
return -1;
}
/** Removes the mapping of the specified value key if this map contains a mapping for the key */
public void remove(int key) {
int idx = this.hash(key);
Bucket b = this.map.get(idx);
if (b != null) {
b.delete(key);
}
}
public int hash(int key) {
return key % size;
}
}
class Bucket {
public LinkedList<Pair> bucket;
public Bucket() {
this.bucket = new LinkedList<Pair>();
}
public Pair getPair(int key) {
for (Pair p : this.bucket) {
if (p.key == key) {
return p;
}
}
return null;
}
public void insert(int key, int val) {
boolean hasKey = false;
Pair p = this.getPair(key);
// update
if (p != null) {
this.delete(key);
}
this.bucket.addFirst(new Pair(key, val));
}
public void delete(int key) {
for (Pair p : this.bucket) {
if (p.key == key) {
this.bucket.remove(p);
break;
}
}
}
}
class Pair {
public int key;
public int val;
public Pair(int k, int v) {
this.key = k;
this.val = v;
}
}
/**
* Your MyHashMap object will be instantiated and called as such:
* MyHashMap obj = new MyHashMap();
* obj.put(key,value);
* int param_2 = obj.get(key);
* obj.remove(key);
*/
|
[
"[email protected]"
] | |
65831e3bb4b56a12004a81b1bd81e031799e32fa
|
d5e336a49c4fa55906d7be2f406a787d759b3ec6
|
/src/题目/_0007_整数翻转/Solution.java
|
923dfe31bc7f21abd0eacd1e071e4cf7e9388251
|
[] |
no_license
|
chenxy1996/leetcode
|
68853a77425041b9ec702f72630fac68e9835031
|
5204bd426a9e42bf8450704c42cd9179348bc676
|
refs/heads/master
| 2021-07-02T09:11:33.201710 | 2020-10-14T09:02:36 | 2020-10-14T09:02:36 | 179,980,417 | 4 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 498 |
java
|
package 题目._0007_整数翻转;
public class Solution {
public static int reverse(int x) {
int flag = x >>> 31;
long ans = 0;
x = flag == 1 ? -x : x;
while (x > 0) {
ans = ans * 10 + x % 10;
x /= 10;
}
ans = flag == 1 ? -ans : ans;
return ans > Integer.MAX_VALUE || ans < Integer.MIN_VALUE ? 0 : (int) ans;
}
public static void main(String[] args) {
System.out.println(reverse(-321));
}
}
|
[
"[email protected]"
] | |
4ccc2c23d68b92a3084a4eb377c3e51edf79d82e
|
d8fb868641902f0b658628a074e26137b8ee7e7a
|
/project_Domain_LlamadaDeEmergencia/src/main/java/com/juancarlosmaya/project_domain_llamadadeemergencia/ProjectDomainLlamadaDeEmergenciaApplication.java
|
fa7c601dc165865fe07a5605d251cdc5d8f1a2b1
|
[] |
no_license
|
maxdarkx/Desafio_ModeloDominio_RespuestaEmergencia
|
28d7a0f51d355021a0dc032a8b3bb99b65bb3ff8
|
15593aff43912e712dd597065b7911cce3b2e8f7
|
refs/heads/master
| 2023-08-16T11:43:10.921175 | 2021-10-02T04:23:21 | 2021-10-02T04:23:21 | 412,074,151 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 410 |
java
|
package com.juancarlosmaya.project_domain_llamadadeemergencia;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ProjectDomainLlamadaDeEmergenciaApplication {
public static void main(String[] args) {
SpringApplication.run(ProjectDomainLlamadaDeEmergenciaApplication.class, args);
}
}
|
[
"[email protected]"
] | |
141395df822f74ee91f18588b5b5d6bfbb2e5a6f
|
e4a435bfe09784a1f23df729b4a5033b3feb8a8b
|
/Udemy/The Complete Java Developer Course/Lecture 29/MethodOverloading/src/com/company/Main.java
|
100d92a0283579234ba3d8bbdb1c7ecd8005631b
|
[] |
no_license
|
bruntime/Java-Exercises
|
1b23f54a4164e74ae4758f35ba9f8d740761a555
|
a24605ea4bafd4630fe9622cd120c15be7272247
|
refs/heads/master
| 2021-05-30T03:53:02.896720 | 2015-12-11T04:45:20 | 2015-12-11T04:45:20 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 637 |
java
|
package com.company;
public class Main {
public static void main(String[] args) {
calculateScore("Tim", 500);
calculateScore(750);
calculateScore();
}
public static int calculateScore(String playerName, int score) {
System.out.println("Player " + playerName + " score was " + score);
return score * 1000;
}
public static int calculateScore(int score) {
System.out.println("Unknown player score was " + score);
return score * 1000;
}
public static int calculateScore() {
System.out.println("No player, no score.");
return -1;
}
}
|
[
"[email protected]"
] | |
074a003a3b81930e8588a9698fc4b6a9d80e6d7f
|
95cfc7fdc4ca095628bfb98198bfa4980209d469
|
/src/main/java/com/burtona/db/model/DeliveryType.java
|
690d852d8874011ee7d577b75f26cf371d77c1b1
|
[] |
no_license
|
mainephd/burtona
|
2aaf8f34166618435bb35835159e377f35d00ae5
|
bf7f66af83f86d513ea72c64edbd83031cdc8222
|
refs/heads/master
| 2021-01-25T07:07:52.053791 | 2015-12-25T16:48:52 | 2015-12-25T16:48:52 | 33,371,467 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,044 |
java
|
package com.burtona.db.model;
// Generated Apr 17, 2011 3:58:52 PM by Hibernate Tools 3.3.0.GA
import java.util.Date;
/**
* DeliveryType generated by hbm2java
*/
public class DeliveryType implements java.io.Serializable {
private int typeCode;
private String typeDescription;
private Date lastUpdateTs;
public DeliveryType() {
}
public DeliveryType(int typeCode, String typeDescription, Date lastUpdateTs) {
this.typeCode = typeCode;
this.typeDescription = typeDescription;
this.lastUpdateTs = lastUpdateTs;
}
public int getTypeCode() {
return this.typeCode;
}
public void setTypeCode(int typeCode) {
this.typeCode = typeCode;
}
public String getTypeDescription() {
return this.typeDescription;
}
public void setTypeDescription(String typeDescription) {
this.typeDescription = typeDescription;
}
public Date getLastUpdateTs() {
return this.lastUpdateTs;
}
public void setLastUpdateTs(Date lastUpdateTs) {
this.lastUpdateTs = lastUpdateTs;
}
}
|
[
"[email protected]@acf2eb99-f293-55f3-5faf-af646cbeb2fb"
] |
[email protected]@acf2eb99-f293-55f3-5faf-af646cbeb2fb
|
787e607827830c82dbd9ce4396a8868bc6b9c4e1
|
6f92c521673c3f0a48a11847419eb6308e588e12
|
/src/ShopInterface.java
|
7eadfd3df48d9b8df74b2fba2891581c773059dd
|
[] |
no_license
|
albamerdani/CompanyManagement
|
b945ecbca8ff08294001ab5efcfe2016665b7e9f
|
1da8e519d7ac44d5136d23fbaf9e1479becfbb6d
|
refs/heads/master
| 2023-03-08T04:52:48.845028 | 2021-02-24T23:17:12 | 2021-02-24T23:17:12 | 342,062,381 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 574 |
java
|
import java.util.ArrayList;
public interface ShopInterface {
public Shop addShop(ArrayList<Shop> shops);
public void continueWithBrand(Shop shop);
public Shop editShop(ArrayList<Shop> shops, int idShop);
public void deleteShop(ArrayList<Shop> shops, int index);
public void deleteAllShop(ArrayList<Shop> shopList);
public String listShops(ArrayList<Shop> shops);
public String toString(ArrayList<Shop> shops, int id);
public boolean isIdUnique(ArrayList<Shop> shops, int id);
public void addIdUnique(ArrayList<Shop> shops, int id, Shop shop);
}
|
[
"[email protected]"
] | |
e6f9e540c636ef037bb52c6c3ae1a7e414ae9125
|
85db870fc737f3eaffe1ee666247434a70017517
|
/library-foxit/src/main/java/com/foxit/uiextensions/annots/screen/multimedia/AudioPlayService.java
|
a6456c791d97e24f9ffbb1a8726d40af4cfbb879
|
[] |
no_license
|
PEP-Mobile-Team/Android_SDK_Reference
|
1b9997891fb68cbc48031330ad5d459955ae7805
|
3026e8dc19d0f43c9fe7cb23b9cbb71c47724e85
|
refs/heads/master
| 2023-08-07T20:01:22.441531 | 2021-10-12T11:45:57 | 2021-10-12T11:45:57 | 261,699,402 | 2 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,595 |
java
|
/**
* Copyright (C) 2003-2019, Foxit Software Inc..
* All Rights Reserved.
* <p>
* http://www.foxitsoftware.com
* <p>
* The following code is copyrighted and is the proprietary of Foxit Software Inc.. It is not allowed to
* distribute any parts of Foxit PDF SDK to third party or public without permission unless an agreement
* is signed between Foxit Software Inc. and customers to explicitly grant customers permissions.
* Review legal.txt for additional license and legal information.
*/
package com.foxit.uiextensions.annots.screen.multimedia;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Binder;
import android.os.IBinder;
import java.io.IOException;
import androidx.annotation.Nullable;
public class AudioPlayService extends Service {
private MediaPlayer mMediaPlayer;
private AudioManager mAudioManager;
private boolean isPauseByAudioFocusLoss = false;
@Override
public void onCreate() {
mMediaPlayer = new MediaPlayer();
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
super.onCreate();
}
@Override
public void onDestroy() {
try {
if (mMediaPlayer.isPlaying()) {
mMediaPlayer.stop();
}
mAudioManager.abandonAudioFocus(mAudioFocusChangeListener);
mMediaPlayer.release();
mAudioStatusChangeListener = null;
mAudioFocusChangeListener = null;
mMediaPlayer = null;
} catch (Exception e) {
e.printStackTrace();
}
super.onDestroy();
}
@Nullable
@Override
public IBinder onBind(Intent intent) {
return new AudioPlayBinder();
}
public class AudioPlayBinder extends Binder {
public AudioPlayService getService() {
return AudioPlayService.this;
}
}
public void prepare(String filepath, final MediaPlayer.OnPreparedListener listener) {
try {
mMediaPlayer.setDataSource(filepath);
mMediaPlayer.prepareAsync();
mMediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
if (listener != null) {
listener.onPrepared(mp);
}
}
});
} catch (IOException e) {
e.printStackTrace();
}
}
public void start() {
int result = mAudioManager.requestAudioFocus(mAudioFocusChangeListener,
AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK);
if (result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
mMediaPlayer.start();
}
}
public void pause() {
mMediaPlayer.pause();
}
public void stop() {
if (mMediaPlayer == null) {
mMediaPlayer = new MediaPlayer();
} else {
mMediaPlayer.pause();
mMediaPlayer.reset();
}
}
public void seekTo(int pos) {
mMediaPlayer.seekTo(pos);
}
public int getCurrentPosition() {
return mMediaPlayer.getCurrentPosition();
}
public int getDuration() {
return mMediaPlayer.getDuration();
}
public boolean isPlaying() {
return mMediaPlayer.isPlaying();
}
private AudioManager.OnAudioFocusChangeListener mAudioFocusChangeListener = new AudioManager.OnAudioFocusChangeListener() {
@Override
public void onAudioFocusChange(int focusChange) {
switch (focusChange) {
case AudioManager.AUDIOFOCUS_GAIN:
if (isPauseByAudioFocusLoss && !mMediaPlayer.isPlaying()) {
isPauseByAudioFocusLoss = false;
start();
if (mAudioStatusChangeListener != null) {
mAudioStatusChangeListener.replay();
}
}
break;
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
if (mMediaPlayer.isPlaying()) {
isPauseByAudioFocusLoss = true;
pause();
if (mAudioStatusChangeListener != null) {
mAudioStatusChangeListener.pause();
}
}
break;
case AudioManager.AUDIOFOCUS_LOSS:
if (mMediaPlayer.isPlaying()) {
isPauseByAudioFocusLoss = true;
pause();
if (mAudioStatusChangeListener != null) {
mAudioStatusChangeListener.pause();
}
}
break;
default:
isPauseByAudioFocusLoss = false;
break;
}
}
};
private IAudioStatusChangeListener mAudioStatusChangeListener;
public void setAudioStatusChangeListener(IAudioStatusChangeListener listener) {
mAudioStatusChangeListener = listener;
}
public interface IAudioStatusChangeListener {
void replay();
void pause();
}
}
|
[
"[email protected]"
] | |
40143ca3f80a771cbf98b15ef0c8de591fd59d37
|
a29d9d03ad58cdb6fff7f1582f9a1ceaa4ac3efb
|
/ERP_test/src/main/java/com/erp/domain/ERPVO.java
|
97e6c2fa30054a4e75855a77cbf71d0c793a4fbf
|
[] |
no_license
|
youngran90/erp
|
ccabec33a362cb1b432aaab9aed7068c2f28e460
|
94ea5d602a07fec4b29f0bd3a617846fb49eeea7
|
refs/heads/master
| 2020-06-26T15:53:49.318621 | 2017-07-13T09:20:25 | 2017-07-13T09:20:25 | 97,026,846 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,011 |
java
|
package com.erp.domain;
import java.io.Serializable;
import java.util.Date;
public class ERPVO implements Serializable{
private int staff_no;
private String staff_name;
private String gender;
private int religion_code;
private String religion_name;
private String before_graduate_day;
private String after_graduate_day;
private String graduate_day;
private String jumin_no;
private int school_code;
private String school_name;
private int skill_code;
private String skill_name;
private int staff_skill_no;
public ERPVO(){}
public ERPVO(int staff_no, String staff_name, String gender, int religion_code, String religion_name,
String before_graduate_day, String after_graduate_day, String graduate_day, String jumin_no,
int school_code, String school_name, int skill_code, String skill_name, int staff_skill_no) {
super();
this.staff_no = staff_no;
this.staff_name = staff_name;
this.gender = gender;
this.religion_code = religion_code;
this.religion_name = religion_name;
this.before_graduate_day = before_graduate_day;
this.after_graduate_day = after_graduate_day;
this.graduate_day = graduate_day;
this.jumin_no = jumin_no;
this.school_code = school_code;
this.school_name = school_name;
this.skill_code = skill_code;
this.skill_name = skill_name;
this.staff_skill_no = staff_skill_no;
}
public int getStaff_no() {
return staff_no;
}
public void setStaff_no(int staff_no) {
this.staff_no = staff_no;
}
public String getStaff_name() {
return staff_name;
}
public void setStaff_name(String staff_name) {
this.staff_name = staff_name;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public int getReligion_code() {
return religion_code;
}
public void setReligion_code(int religion_code) {
this.religion_code = religion_code;
}
public String getReligion_name() {
return religion_name;
}
public void setReligion_name(String religion_name) {
this.religion_name = religion_name;
}
public String getBefore_graduate_day() {
return before_graduate_day;
}
public void setBefore_graduate_day(String before_graduate_day) {
this.before_graduate_day = before_graduate_day;
}
public String getAfter_graduate_day() {
return after_graduate_day;
}
public void setAfter_graduate_day(String after_graduate_day) {
this.after_graduate_day = after_graduate_day;
}
public String getGraduate_day() {
return graduate_day;
}
public void setGraduate_day(String graduate_day) {
this.graduate_day = graduate_day;
}
public String getJumin_no() {
return jumin_no;
}
public void setJumin_no(String jumin_no) {
this.jumin_no = jumin_no;
}
public int getSchool_code() {
return school_code;
}
public void setSchool_code(int school_code) {
this.school_code = school_code;
}
public String getSchool_name() {
return school_name;
}
public void setSchool_name(String school_name) {
this.school_name = school_name;
}
public int getSkill_code() {
return skill_code;
}
public void setSkill_code(int skill_code) {
this.skill_code = skill_code;
}
public String getSkill_name() {
return skill_name;
}
public void setSkill_name(String skill_name) {
this.skill_name = skill_name;
}
public int getStaff_skill_code() {
return staff_skill_no;
}
public void setStaff_skill_no(int staff_skill_no) {
this.staff_skill_no = staff_skill_no;
}
@Override
public String toString() {
return "ERPVO [staff_no=" + staff_no + ", staff_name=" + staff_name + ", gender=" + gender + ", religion_code="
+ religion_code + ", religion_name=" + religion_name + ", before_graduate_day=" + before_graduate_day
+ ", after_graduate_day=" + after_graduate_day + ", graduate_day=" + graduate_day + ", jumin_no="
+ jumin_no + ", school_code=" + school_code + ", school_name=" + school_name + ", skill_code="
+ skill_code + ", skill_name=" + skill_name + ", staff_skill_no=" + staff_skill_no + "]";
}
}
|
[
"[email protected]"
] | |
24c7481fe7471d4bd5f4e879321b3821582d85a8
|
4ca7eed8f0489e875b36f527e4f8c4559c734a06
|
/src/main/aspect/nl/rfpels/learn/java/aspect/LoggableAspect.java
|
ea8c37b2aebf66ebba88a16b22b9dbd2b409d0e5
|
[] |
no_license
|
00mjk/learn-java-validation
|
f1676c5d0a7628bbc586521a6f357e88270ab5e9
|
c161aa2dc21b44bd2de4683b7a7997b7ef5a7a8f
|
refs/heads/master
| 2022-12-30T01:41:31.490372 | 2020-10-17T22:41:45 | 2020-10-17T22:41:45 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,441 |
java
|
//------------------------------------------------------------------------------
// Copyright (c) 2018 Bureau Pels. All Rights Reserved.
//------------------------------------------------------------------------------
package nl.rfpels.learn.java.aspect;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Aspect
public class LoggableAspect {
@Pointcut("@annotation(nl.rfpels.learn.java.annotations.Loggable)")
public void logIt() {}
@Pointcut("execution(* *(..))")
public void executingMethod() {}
@Around("executingMethod() && logIt()")
public Object aroundLoggableMethod(ProceedingJoinPoint pjp) throws Throwable {
Logger log = LoggerFactory.getLogger(pjp.getSignature().getDeclaringType().getName());
String methodname = pjp.getSignature().toLongString();
log.info(String.format("Entering %s", methodname));
Object result = null;
try {
result = pjp.proceed();
} catch (Throwable t) {
log.info(String.format("Exception excuting %s: %s", methodname, t.getMessage()));
throw t;
}
log.info(String.format("Exiting %s => %s", methodname, result));
return result;
}
}
|
[
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.