blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
9f5ed585495df8a2398385fccbb4c2796b4c9536
ab8cd25c242a41a325b56c348fdac4c9d8a6e738
/features/widget/src/main/java/com/metinkale/prayerapp/vakit/WidgetLegacy.java
15ee7cc23c69cd6a1149d8a4641bd9aae4c0c00f
[ "Apache-2.0" ]
permissive
MarouaneAzza/prayer-times-android
a0a12363af9600a1f766fc447d1acc1e3ab448ad
5d1ac90644343241c61d9d3081568fa9f55e0917
refs/heads/master
2022-06-17T08:57:15.432970
2020-05-04T16:26:07
2020-05-04T16:26:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
29,553
java
/* * Copyright (c) 2013-2019 Metin Kale * * 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.metinkale.prayerapp.vakit; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.RectF; import android.graphics.Typeface; import android.net.Uri; import android.provider.AlarmClock; import android.provider.CalendarContract; import android.util.TypedValue; import android.widget.RemoteViews; import com.crashlytics.android.Crashlytics; import com.metinkale.prayer.Preferences; import com.metinkale.prayer.date.HijriDate; import com.metinkale.prayer.times.SilenterPrompt; import com.metinkale.prayer.times.fragments.TimesFragment; import com.metinkale.prayer.times.times.Times; import com.metinkale.prayer.times.times.Vakit; import com.metinkale.prayer.utils.LocaleUtils; import com.metinkale.prayer.utils.UUID; import com.metinkale.prayer.widgets.R; import org.joda.time.LocalDate; import org.joda.time.LocalDateTime; import org.joda.time.LocalTime; /** * Created by metin on 24.03.2017. */ class WidgetLegacy { static void update1x1(Context context, AppWidgetManager appWidgetManager, int widgetId) { Resources r = context.getResources(); float dp = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, r.getDisplayMetrics()); LocalDateTime now = LocalDateTime.now(); LocalDate today = now.toLocalDate(); Theme theme = WidgetUtils.getTheme(widgetId); Times times = WidgetUtils.getTimes(widgetId); if (times == null) { WidgetUtils.showNoCityWidget(context, appWidgetManager, widgetId); return; } WidgetUtils.Size size = WidgetUtils.getSize(context, appWidgetManager, widgetId, 1f); int s = size.width; if (s <= 0) return; RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.vakit_widget); int next = times.getNextTime(); String left = LocaleUtils.formatPeriod(now, times.getTime(today, next), false); if (Preferences.VAKIT_INDICATOR_TYPE.get().equals("next")) next = next + 1; remoteViews.setOnClickPendingIntent(R.id.widget, TimesFragment.getPendingIntent(times)); Bitmap bmp = Bitmap.createBitmap(s, s, Bitmap.Config.ARGB_4444); Canvas canvas = new Canvas(bmp); canvas.scale(0.99f, 0.99f, s / 2f, s / 2f); Paint paint = new Paint(); paint.setAntiAlias(true); paint.setDither(true); paint.setFilterBitmap(true); paint.setStyle(Paint.Style.FILL); paint.setColor(theme.bgcolor); canvas.drawRect(0, 0, s, s, paint); paint.setColor(theme.textcolor); paint.setStyle(Paint.Style.FILL_AND_STROKE); paint.setAntiAlias(true); paint.setSubpixelText(true); paint.setColor(theme.hovercolor); String city = times.getName(); paint.setColor(theme.textcolor); float cs = s / 5f; float ts = (s * 35) / 100f; int vs = s / 4; paint.setTextSize(cs); cs = (cs * s * 0.9f) / paint.measureText(city); cs = (cs > vs) ? vs : cs; paint.setTextSize(vs); paint.setTextAlign(Paint.Align.CENTER); canvas.drawText(Vakit.getByIndex(next).prevTime().getString(), s / 2f, (s * 22) / 80f, paint); paint.setTextSize(ts); paint.setTextAlign(Paint.Align.CENTER); canvas.drawText(left, s / 2f, (s / 2f) + ((ts * 1) / 3), paint); paint.setTextSize(cs); paint.setTextAlign(Paint.Align.CENTER); canvas.drawText(city, s / 2f, ((s * 3) / 4f) + ((cs * 2) / 3), paint); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(dp); paint.setColor(theme.strokecolor); canvas.drawRect(0, 0, s, s, paint); remoteViews.setImageViewBitmap(R.id.widget, bmp); try { appWidgetManager.updateAppWidget(widgetId, remoteViews); } catch (RuntimeException e) { if (!e.getMessage().contains("exceeds maximum bitmap memory usage")) { Crashlytics.logException(e); } } } static void update4x1(Context context, AppWidgetManager appWidgetManager, int widgetId) { Resources r = context.getResources(); float dp = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, r.getDisplayMetrics()); Theme theme = WidgetUtils.getTheme(widgetId); Times times = WidgetUtils.getTimes(widgetId); if (times == null) { WidgetUtils.showNoCityWidget(context, appWidgetManager, widgetId); return; } WidgetUtils.Size size = WidgetUtils.getSize(context, appWidgetManager, widgetId, 300f / 60f); int w = size.width; int h = size.height; if (w <= 0 || h <= 0) return; RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.vakit_widget); LocalDateTime dateTime = LocalDateTime.now(); LocalDate date = dateTime.toLocalDate(); int next = times.getNextTime(); String left = LocaleUtils.formatPeriod(LocalDateTime.now(), times.getTime(date, next)); if (Preferences.VAKIT_INDICATOR_TYPE.get().equals("next")) next = next + 1; remoteViews.setOnClickPendingIntent(R.id.widget, TimesFragment.getPendingIntent(times)); Bitmap bmp = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_4444); Canvas canvas = new Canvas(bmp); canvas.scale(0.99f, 0.99f, w / 2f, h / 2f); Paint paint = new Paint(); paint.setAntiAlias(true); paint.setDither(true); paint.setFilterBitmap(true); paint.setStyle(Paint.Style.FILL); paint.setColor(theme.bgcolor); canvas.drawRect(0, 0, w, h, paint); paint.setStyle(Paint.Style.FILL_AND_STROKE); paint.setAntiAlias(true); paint.setSubpixelText(true); paint.setColor(theme.hovercolor); if (next != Vakit.FAJR.ordinal() && !Preferences.SHOW_ALT_WIDGET_HIGHLIGHT.get() && next <= Vakit.ISHAA.ordinal()) { canvas.drawRect((w * (next - 1)) / 6f, h * 3 / 9f, w * next / 6f, h, paint); } float s = paint.getStrokeWidth(); float dip = 3f; paint.setStrokeWidth(dip * dp); canvas.drawLine(0, (h * 3) / 9f, w, h * 3 / 9f, paint); // canvas.drawRect(0, 0, w, h * 3 / 9, paint); paint.setStrokeWidth(s); paint.setColor(theme.textcolor); paint.setTextAlign(Paint.Align.LEFT); paint.setTextSize(h / 4f); canvas.drawText(" " + times.getName(), 0, h / 4f, paint); paint.setTextAlign(Paint.Align.RIGHT); canvas.drawText(left + " ", w, h / 4f, paint); paint.setTextSize(h / 5f); paint.setTextAlign(Paint.Align.CENTER); int y = (h * 6) / 7; if (Preferences.CLOCK_12H.get()) { y += h / 14; } boolean fits = true; do { if (!fits) { paint.setTextSize((float) (paint.getTextSize() * 0.95)); } fits = true; for (Vakit v : Vakit.values()) { if ((paint.measureText(v.getString()) > (w / 6f)) && (w > 5)) { fits = false; } } } while (!fits); for (Vakit v : Vakit.values()) { int i = v.ordinal(); if (i == next - 1 && Preferences.SHOW_ALT_WIDGET_HIGHLIGHT.get()) { paint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD_ITALIC)); } canvas.drawText(v.getString(), (w * (1 + (2 * i))) / 12f, y, paint); if (i == next - 1 && Preferences.SHOW_ALT_WIDGET_HIGHLIGHT.get()) { paint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL)); } } paint.setTextSize((h * 2) / 9f); if (Preferences.CLOCK_12H.get()) { for (Vakit v : Vakit.values()) { int i = v.ordinal(); if (i == next - 1 && Preferences.SHOW_ALT_WIDGET_HIGHLIGHT.get()) { paint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD_ITALIC)); } String time = LocaleUtils.formatTime(times.getTime(date, v.ordinal()).toLocalTime()); String suffix = time.substring(time.indexOf(" ") + 1); time = time.substring(0, time.indexOf(" ")); paint.setTextSize((h * 2) / 9f); canvas.drawText(time, (w * (1 + (2 * i))) / 12f, h * 6 / 10f, paint); paint.setTextSize(h / 9f); canvas.drawText(suffix, (w * (1 + (2 * i))) / 12f, h * 7 / 10f, paint); if (i == next - 1 && Preferences.SHOW_ALT_WIDGET_HIGHLIGHT.get()) { paint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL)); } } } else { for (Vakit v : Vakit.values()) { int i = v.ordinal(); if (i == next - 1 && Preferences.SHOW_ALT_WIDGET_HIGHLIGHT.get()) { paint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD_ITALIC)); } canvas.drawText(LocaleUtils.formatTime(times.getTime(date, v.ordinal()).toLocalTime()), (w * (1 + (2 * i))) / 12f, h * 3 / 5f, paint); if (i == next - 1 && Preferences.SHOW_ALT_WIDGET_HIGHLIGHT.get()) { paint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL)); } } } paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(dp); paint.setColor(theme.strokecolor); canvas.drawRect(0, 0, w, h, paint); remoteViews.setImageViewBitmap(R.id.widget, bmp); try { appWidgetManager.updateAppWidget(widgetId, remoteViews); } catch (RuntimeException e) { if (!e.getMessage().contains("exceeds maximum bitmap memory usage")) { Crashlytics.logException(e); } } } static void update2x2(Context context, AppWidgetManager appWidgetManager, int widgetId) { Resources r = context.getResources(); float dp = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, r.getDisplayMetrics()); Theme theme = WidgetUtils.getTheme(widgetId); Times times = WidgetUtils.getTimes(widgetId); if (times == null) { WidgetUtils.showNoCityWidget(context, appWidgetManager, widgetId); return; } WidgetUtils.Size size = WidgetUtils.getSize(context, appWidgetManager, widgetId, 130f / 160f); int w = size.width; int h = size.height; if (w <= 0 || h <= 0) return; RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.vakit_widget); LocalDate date = LocalDate.now(); int next = times.getNextTime(); String left = LocaleUtils.formatPeriod(LocalDateTime.now(), times.getTime(date, next)); if (Preferences.VAKIT_INDICATOR_TYPE.get().equals("next")) next = next + 1; remoteViews.setOnClickPendingIntent(R.id.widget, TimesFragment.getPendingIntent(times)); Bitmap bmp = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_4444); Canvas canvas = new Canvas(bmp); canvas.scale(0.99f, 0.99f, w / 2f, h / 2f); Paint paint = new Paint(); paint.setAntiAlias(true); paint.setDither(true); paint.setFilterBitmap(true); paint.setStyle(Paint.Style.FILL); paint.setColor(theme.bgcolor); canvas.drawRect(0, 0, w, h, paint); paint.setColor(theme.textcolor); paint.setStyle(Paint.Style.FILL_AND_STROKE); paint.setAntiAlias(true); paint.setSubpixelText(true); double l = h / 10f; paint.setTextSize((int) l); paint.setTextAlign(Paint.Align.CENTER); canvas.drawText(times.getName(), w / 2f, (int) (l * 1.8), paint); paint.setTextSize((int) ((l * 8) / 10)); if (next != Vakit.FAJR.ordinal() && !Preferences.SHOW_ALT_WIDGET_HIGHLIGHT.get() && next <= Vakit.ISHAA.ordinal()) { paint.setColor(theme.hovercolor); canvas.drawRect(0, (int) (l * (next + 1.42f)), w, (int) (l * (next + 2.42)), paint); } paint.setColor(theme.textcolor); paint.setTextAlign(Paint.Align.LEFT); for (Vakit v : Vakit.values()) { int i = v.ordinal(); if (i == next - 1 && Preferences.SHOW_ALT_WIDGET_HIGHLIGHT.get()) { paint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD_ITALIC)); } canvas.drawText(v.getString(), w / 6f, (int) (l * (3.2 + v.ordinal())), paint); if (i == next - 1 && Preferences.SHOW_ALT_WIDGET_HIGHLIGHT.get()) { paint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL)); } } paint.setTextAlign(Paint.Align.RIGHT); if (Preferences.CLOCK_12H.get()) { for (Vakit v : Vakit.values()) { int i = v.ordinal(); if (i == next - 1 && Preferences.SHOW_ALT_WIDGET_HIGHLIGHT.get()) { paint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD_ITALIC)); } String time = LocaleUtils.formatTime(times.getTime(date, v.ordinal()).toLocalTime()); String suffix = time.substring(time.indexOf(" ") + 1); time = time.substring(0, time.indexOf(" ")); paint.setTextSize((int) ((l * 8) / 10)); canvas.drawText(time, ((w * 5) / 6f) - paint.measureText("A"), (int) (l * 3.2 + i * l), paint); paint.setTextSize((int) ((l * 4) / 10)); canvas.drawText(suffix, ((w * 5) / 6f) + (paint.measureText(time) / 4), (int) (l * 3 + i * l), paint); if (i == next - 1 && Preferences.SHOW_ALT_WIDGET_HIGHLIGHT.get()) { paint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL)); } } } else { for (Vakit v : Vakit.values()) { int i = v.ordinal(); if (i == next - 1 && Preferences.SHOW_ALT_WIDGET_HIGHLIGHT.get()) { paint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD_ITALIC)); } canvas.drawText(LocaleUtils.formatTime(times.getTime(date, v.ordinal()).toLocalTime()), (w * 5) / 6f, (int) (l * 3.2 + i * l), paint); if (i == next - 1 && Preferences.SHOW_ALT_WIDGET_HIGHLIGHT.get()) { paint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL)); } } } paint.setTextSize((int) l); paint.setTextAlign(Paint.Align.CENTER); canvas.drawText(left, w / 2f, (int) (l * 9.5), paint); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(dp); paint.setColor(theme.strokecolor); canvas.drawRect(0, 0, w, h, paint); remoteViews.setImageViewBitmap(R.id.widget, bmp); try { appWidgetManager.updateAppWidget(widgetId, remoteViews); } catch (RuntimeException e) { if (!e.getMessage().contains("exceeds maximum bitmap memory usage")) { Crashlytics.logException(e); } } } static void updateSilenter(Context context, AppWidgetManager appWidgetManager, int widgetId) { Resources r = context.getResources(); float dp = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, r.getDisplayMetrics()); Theme theme = WidgetUtils.getTheme(widgetId); WidgetUtils.Size size = WidgetUtils.getSize(context, appWidgetManager, widgetId, 1f); int s = size.width; if (s <= 0) return; RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.vakit_widget); Intent i = new Intent(context, SilenterPrompt.class); remoteViews.setOnClickPendingIntent(R.id.widget, PendingIntent.getActivity(context, 0, i, PendingIntent.FLAG_UPDATE_CURRENT)); Bitmap bmp = Bitmap.createBitmap(s, s, Bitmap.Config.ARGB_4444); Canvas canvas = new Canvas(bmp); canvas.scale(0.99f, 0.99f, s / 2f, s / 2f); Paint paint = new Paint(); paint.setAntiAlias(true); paint.setDither(true); paint.setFilterBitmap(true); paint.setStyle(Paint.Style.FILL); paint.setColor(theme.bgcolor); canvas.drawRect(0, 0, s, s, paint); paint.setColor(theme.textcolor); paint.setStyle(Paint.Style.FILL_AND_STROKE); paint.setAntiAlias(true); paint.setSubpixelText(true); paint.setColor(theme.hovercolor); paint.setColor(theme.textcolor); paint.setTextSize((s * 25) / 100f); paint.setTextAlign(Paint.Align.CENTER); canvas.drawText("Sessize", s / 2f, (s * 125) / 300f, paint); canvas.drawText("al", s / 2f, (s * 25) / 30f, paint); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(dp); paint.setColor(theme.strokecolor); canvas.drawRect(0, 0, s, s, paint); remoteViews.setImageViewBitmap(R.id.widget, bmp); try { appWidgetManager.updateAppWidget(widgetId, remoteViews); } catch (RuntimeException e) { if (!e.getMessage().contains("exceeds maximum bitmap memory usage")) { Crashlytics.logException(e); } } } static void update4x2Clock(Context context, AppWidgetManager appWidgetManager, int widgetId) { Times times = WidgetUtils.getTimes(widgetId); if (times == null) { WidgetUtils.showNoCityWidget(context, appWidgetManager, widgetId); return; } WidgetUtils.Size size = WidgetUtils.getSize(context, appWidgetManager, widgetId, 500f / 200f); int w = size.width; int h = size.height; if (w <= 0 || h <= 0) return; RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.vakit_widget_clock); remoteViews.setOnClickPendingIntent(R.id.abovePart, PendingIntent.getActivity(context, UUID.asInt(), new Intent(AlarmClock.ACTION_SHOW_ALARMS), PendingIntent.FLAG_UPDATE_CURRENT)); remoteViews.setOnClickPendingIntent(R.id.belowPart, TimesFragment.getPendingIntent(times)); Uri.Builder builder = CalendarContract.CONTENT_URI.buildUpon(); builder.appendPath("time"); builder.appendPath(Long.toString(System.currentTimeMillis())); Intent intent = new Intent(Intent.ACTION_VIEW, builder.build()); remoteViews.setOnClickPendingIntent(R.id.center, PendingIntent.getActivity(context, UUID.asInt(), intent, PendingIntent.FLAG_UPDATE_CURRENT)); int next = times.getNextTime(); int last = next - 1; Bitmap bmp = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_4444); Canvas canvas = new Canvas(bmp); Paint paint = new Paint(); paint.setAntiAlias(true); paint.setDither(true); paint.setFilterBitmap(true); paint.setStyle(Paint.Style.FILL_AND_STROKE); paint.setAntiAlias(true); paint.setSubpixelText(true); paint.setShadowLayer(2, 2, 2, 0xFF555555); paint.setTextAlign(Paint.Align.CENTER); paint.setColor(Color.WHITE); LocalTime ltime = LocalTime.now(); paint.setTextSize(h * 0.55f); if (Preferences.CLOCK_12H.get()) { String time = LocaleUtils.formatTime(ltime); String suffix = time.substring(time.indexOf(" ") + 1); time = time.substring(0, time.indexOf(" ")); canvas.drawText(time, (w / 2f) - (paint.measureText(suffix) / 4), h * 0.4f, paint); paint.setTextSize(h * 0.275f); canvas.drawText(suffix, (w / 2f) + paint.measureText(time), h * 0.2f, paint); } else { canvas.drawText(LocaleUtils.formatNumber(LocaleUtils.formatTime(ltime)), w / 2f, h * 0.4f, paint); } String greg = LocaleUtils.formatDate(LocalDate.now()); String hicri = LocaleUtils.formatDate(HijriDate.now()); paint.setTextSize(h * 0.12f); float m = paint.measureText(greg + " " + hicri); if (m > (w * 0.8f)) { paint.setTextSize((h * 0.12f * w * 0.8f) / m); } paint.setTextAlign(Paint.Align.LEFT); canvas.drawText(greg, w * .1f, h * 0.55f, paint); paint.setTextAlign(Paint.Align.RIGHT); canvas.drawText(hicri, w * .9f, h * 0.55f, paint); remoteViews.setImageViewBitmap(R.id.widget, bmp); canvas.drawRect(w * 0.1f, h * 0.6f, w * 0.9f, h * 0.63f, paint); if (times.isKerahat()) { paint.setColor(0xffbf3f5b); } else { paint.setColor(Theme.Light.strokecolor); } canvas.drawRect(w * 0.1f, h * 0.6f, (w * 0.1f) + (w * 0.8f * WidgetV24.getPassedPart(times)), h * 0.63f, paint); paint.setColor(Color.WHITE); paint.setTextSize(h * 0.2f); paint.setTextAlign(Paint.Align.LEFT); if (Preferences.CLOCK_12H.get()) { String l = LocaleUtils.formatTime(times.getTime(LocalDate.now(), last).toLocalTime()); String s = l.substring(l.indexOf(" ") + 1); l = l.substring(0, l.indexOf(" ")); canvas.drawText(l, w * 0.1f, h * 0.82f, paint); paint.setTextSize(h * 0.1f); canvas.drawText(s, (w * 0.1f) + (2 * paint.measureText(l)), h * 0.72f, paint); } else { canvas.drawText(LocaleUtils.formatTime(times.getTime(LocalDate.now(), last).toLocalTime()), w * 0.1f, h * 0.82f, paint); } paint.setTextSize(h * 0.12f); canvas.drawText(Vakit.getByIndex(last).getString(), w * 0.1f, h * 0.95f, paint); paint.setColor(Color.WHITE); paint.setTextSize(h * 0.2f); paint.setTextAlign(Paint.Align.RIGHT); if (Preferences.CLOCK_12H.get()) { String l = LocaleUtils.formatTime(times.getTime(LocalDate.now(), next).toLocalTime()); String s = l.substring(l.indexOf(" ") + 1); l = l.substring(0, l.indexOf(" ")); canvas.drawText(l, (w * 0.9f) - (paint.measureText(s) / 2), h * 0.82f, paint); paint.setTextSize(h * 0.1f); canvas.drawText(s, w * 0.9f, h * 0.72f, paint); } else { canvas.drawText(LocaleUtils.formatTime(times.getTime(LocalDate.now(), next).toLocalTime()), w * 0.9f, h * 0.82f, paint); } paint.setTextSize(h * 0.12f); canvas.drawText(Vakit.getByIndex(next).getString(), w * 0.9f, h * 0.95f, paint); paint.setColor(Color.WHITE); paint.setTextSize(h * 0.25f); paint.setTextAlign(Paint.Align.CENTER); paint.setFakeBoldText(true); canvas.drawText(LocaleUtils.formatPeriod(LocalDateTime.now(), times.getTime(LocalDateTime.now().toLocalDate(), next)), w * 0.5f, h * 0.9f, paint); paint.setFakeBoldText(false); try { appWidgetManager.updateAppWidget(widgetId, remoteViews); } catch (RuntimeException e) { if (!e.getMessage().contains("exceeds maximum bitmap memory usage")) { Crashlytics.logException(e); } } } static void update2x2Clock(Context context, AppWidgetManager appWidgetManager, int widgetId) { Times times = WidgetUtils.getTimes(widgetId); if (times == null) { WidgetUtils.showNoCityWidget(context, appWidgetManager, widgetId); return; } WidgetUtils.Size size = WidgetUtils.getSize(context, appWidgetManager, widgetId, 1f); int w = size.width; int h = size.height; if (w <= 0 || h <= 0) return; RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.vakit_widget_clock); remoteViews.setOnClickPendingIntent(R.id.abovePart, PendingIntent .getActivity(context, (int) System.currentTimeMillis(), new Intent(AlarmClock.ACTION_SHOW_ALARMS), PendingIntent.FLAG_UPDATE_CURRENT)); remoteViews.setOnClickPendingIntent(R.id.belowPart, TimesFragment.getPendingIntent(times)); Uri.Builder builder = CalendarContract.CONTENT_URI.buildUpon(); builder.appendPath("time"); builder.appendPath(Long.toString(System.currentTimeMillis())); Intent intent = new Intent(Intent.ACTION_VIEW, builder.build()); remoteViews.setOnClickPendingIntent(R.id.center, PendingIntent.getActivity(context, UUID.asInt(), intent, PendingIntent.FLAG_UPDATE_CURRENT)); Bitmap bmp = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_4444); Canvas canvas = new Canvas(bmp); Paint paint = new Paint(); paint.setAntiAlias(true); paint.setDither(true); paint.setFilterBitmap(true); paint.setStyle(Paint.Style.STROKE); paint.setAntiAlias(true); paint.setSubpixelText(true); paint.setShadowLayer(2, 2, 2, 0xFF555555); paint.setTextAlign(Paint.Align.CENTER); paint.setColor(Color.WHITE); paint.setColor(0xFFFFFFFF); paint.setStrokeWidth(w / 100f); canvas.drawArc(new RectF(w / 100f, w / 100f, w - w / 100f, h - w / 100f), 0, 360, false, paint); boolean isKerahat = times.isKerahat(); if (isKerahat) { paint.setColor(0xffbf3f5b); } else { paint.setColor(Theme.Light.strokecolor); } int next = times.getNextTime(); int indicator = next - 1; if (Preferences.VAKIT_INDICATOR_TYPE.get().equals("next")) indicator = indicator + 1; canvas.drawArc(new RectF(w / 100f, w / 100f, w - w / 100f, h - w / 100f), -90, WidgetV24.getPassedPart(times) * 360, false, paint); paint.setStrokeWidth(1); LocalDateTime ltime = LocalDateTime.now(); String[] time = LocaleUtils.formatNumber(ltime.toString("HH:mm")).replace(":", " ").split(" "); paint.setTextSize(h * 0.50f); paint.setStyle(Paint.Style.FILL); paint.setColor(Color.WHITE); if (time.length == 3) { paint.setTextAlign(Paint.Align.RIGHT); canvas.drawText(time[0], w * 0.59f, h * 0.65f, paint); paint.setTextAlign(Paint.Align.LEFT); if (isKerahat) { paint.setColor(0xffbf3f5b); } else { paint.setColor(Theme.Light.strokecolor); } paint.setTextSize(h * 0.18f); canvas.drawText(time[1], w * 0.60f, h * 0.45f, paint); paint.setTextSize(h * 0.1f); paint.setTextSize(h * 0.1f); canvas.drawText(time[2], w * 0.80f, h * 0.45f, paint); paint.setColor(0xFFFFFFFF); paint.setTextSize(h * 0.07f); canvas.drawText(LocaleUtils.formatNumber(ltime.toString("d'.' MMM'.'")), w * 0.60f, h * 0.55f, paint); canvas.drawText(Vakit.getByIndex(indicator).getString(), w * 0.60f, h * 0.65f, paint); } else { paint.setTextAlign(Paint.Align.RIGHT); canvas.drawText(time[0], w * 0.62f, h * 0.65f, paint); paint.setTextAlign(Paint.Align.LEFT); if (isKerahat) { paint.setColor(0xffbf3f5b); } else { paint.setColor(Theme.Light.strokecolor); } paint.setTextSize(h * 0.22f); canvas.drawText(time[1], w * 0.63f, h * 0.45f, paint); paint.setColor(0xFFFFFFFF); paint.setTextSize(h * 0.07f); canvas.drawText(LocaleUtils.formatNumber(ltime.toString("d'.' MMM'.'")), w * 0.63f, h * 0.55f, paint); canvas.drawText(Vakit.getByIndex(indicator).getString(), w * 0.63f, h * 0.65f, paint); } paint.setTextAlign(Paint.Align.CENTER); paint.setTextSize(h * 0.15f); canvas.drawText(LocaleUtils.formatPeriod(LocalDateTime.now(), times.getTime(LocalDate.now(), next)), w / 2f, h * 0.85f, paint); paint.setTextSize(h * 0.12f); canvas.drawText(ltime.toString("EEEE"), w / 2f, h * 0.22f, paint); remoteViews.setImageViewBitmap(R.id.widget, bmp); try { appWidgetManager.updateAppWidget(widgetId, remoteViews); } catch (RuntimeException e) { if (!e.getMessage().contains("exceeds maximum bitmap memory usage")) { Crashlytics.logException(e); } } } }
[ "metinkale38@gmail.com" ]
metinkale38@gmail.com
1857e04af61e6ef9b6c60246d921e6b9835ddb27
a7f9fc62b46e60417c6391466349f4d4f35b70da
/SnackSales_hou/src/main/java/com/shop/entity/Comment.java
eea694b0ddf1559c5b04e9de6e861ee83af09084
[]
no_license
yz18504228736/SnackSales
5c0ca07c418de9a45b811e92ff03fadde83b4e71
c81162ce02501ed21730121e4cbd358bb0f3bf77
refs/heads/master
2023-05-27T19:21:14.055437
2021-05-22T13:11:51
2021-05-22T13:11:51
353,956,303
0
0
null
null
null
null
UTF-8
Java
false
false
1,659
java
package com.shop.entity; import java.util.Date; public class Comment { private Integer commentId; private User user; private Product product; private String commentContent; private Integer commentGrade; private Date commentTime; public Integer getCommentId() { return commentId; } public void setCommentId(Integer commentId) { this.commentId = commentId; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public Product getProduct() { return product; } public void setProduct(Product product) { this.product = product; } public String getCommentContent() { return commentContent; } public void setCommentContent(String commentContent) { this.commentContent = commentContent == null ? null : commentContent.trim(); } public Integer getCommentGrade() { return commentGrade; } public void setCommentGrade(Integer commentGrade) { this.commentGrade = commentGrade; } public Date getCommentTime() { return commentTime; } public void setCommentTime(Date commentTime) { this.commentTime = commentTime; } @Override public String toString() { return "Comment{" + "commentId=" + commentId + ", user=" + user + ", product=" + product + ", commentContent='" + commentContent + '\'' + ", commentGrade=" + commentGrade + ", commentTime=" + commentTime + '}'; } }
[ "18504228736@163.com" ]
18504228736@163.com
a1ad8d7ca58e364481cac7554f93133b9d71b7ad
a29b7ab365b3c9d65e679c638f0e0ef3fd654e05
/Study/src/example/run/Run.java
68aacc87b1e4ae51c300e09af461d6a66b8e6475
[]
no_license
b-bok/BackUp
6ee7af38e9590a1220a0221906c125daab635b7c
1d78088b6ce2028f9a2a086bfe5ae15cd1f1d142
refs/heads/master
2022-11-19T10:01:17.989825
2020-07-16T12:36:24
2020-07-16T12:36:24
280,147,659
0
0
null
null
null
null
UTF-8
Java
false
false
431
java
package com.kh.chap02.practice.example.run; import com.kh.chap02.practice.example.*; public class Run { public static void main(String[] args) { //LoopPractice l = new LoopPractice(); // l.practice1(); // l.practice2(); // l.practice3(); // l.practice4(); // l.practice5(); // l.practice6(); // l.practice7(); // l.practice8(); // l.practice9(); // l.practice10(); // l.practice11(); l.practice12(); } }
[ "hooyuki123@gmail.com" ]
hooyuki123@gmail.com
24e8120ebe9afdbe0d8c56505007cbbc156cce0b
a2e6a5507462be3b982f11d2849eb92b9739eb91
/Emofinal/Vue/vue/AffinityEdit.java
0d5a99158da742279facb75fa5a548192513697f
[]
no_license
jollivier/Emotions
f288d074dfb324334ff20f0adebce94bd739edb7
0e5b3e7016eb2940b01f16c552ebd9a9898e05dd
refs/heads/master
2021-01-10T22:08:01.568928
2012-11-10T17:56:05
2012-11-10T17:56:05
6,351,618
1
0
null
null
null
null
UTF-8
Java
false
false
2,224
java
package vue; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import javax.swing.AbstractListModel; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.ListSelectionModel; import javax.swing.border.EmptyBorder; import emo.Affinity; import emo.Tuple; import javax.swing.JMenuBar; import javax.swing.JMenuItem; public class AffinityEdit extends JFrame { /** * */ private static final long serialVersionUID = 1L; private JPanel contentPane; private String[] val; /** * Create the frame. */ public AffinityEdit(final Affinity affinity) { setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(100, 100, 300, 400); setVisible(true); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); val = new String[affinity.getList().size()]; for(int i=0; i<affinity.getList().size(); i++){ val[i] = affinity.getList().get(i).toString(); } JScrollPane scrollPane = new JScrollPane(); contentPane.add(scrollPane, BorderLayout.CENTER); JList<String> list = new JList<String>(); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setModel(new AbstractListModel<String>() { /** * */ private static final long serialVersionUID = 1L; String[] values = val; public int getSize() { return values.length; } public String getElementAt(int index) { return values[index]; } }); scrollPane.setViewportView(list); JMenuBar menuBar = new JMenuBar(); contentPane.add(menuBar, BorderLayout.NORTH); JMenuItem mntmSave = new JMenuItem("Save"); menuBar.add(mntmSave); mntmSave.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub affinity.export_txt(); } }); ArrayList<Tuple> aff_list = affinity.getList(); for(int i=0; i<aff_list.size(); i++){ list.add(new JLabel(aff_list.get(i).toString())); } } }
[ "jollivier@centrale-marseille.fr" ]
jollivier@centrale-marseille.fr
4e07c8d83a885751f9de448d5c2e4104c306a342
fee18736f6da4569e4103163df413f1813c63754
/app/src/main/java/com/example/retrofitdata/MainActivity.java
3a8f81578a17b6454057ad73cc9c971590e7f3eb
[]
no_license
NavjotKaur1996/RetrofitData
5171c3bd8ed82017571f9e846991b154601aca67
7235b84ddf2035f9d4074ea0394b94d410f17e92
refs/heads/master
2023-01-28T04:19:56.243933
2020-12-12T02:19:10
2020-12-12T02:19:10
320,711,415
0
0
null
null
null
null
UTF-8
Java
false
false
2,653
java
package com.example.retrofitdata; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import com.example.retrofitdata.Api_Interface.JsonApiInterface; import com.example.retrofitdata.Models.User; import java.util.List; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; public class MainActivity extends AppCompatActivity { private TextView textView; private Button button; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textView = findViewById(R.id.textView); button = findViewById(R.id.showData); createPost(); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(getApplicationContext(),ShowData.class); startActivity(intent); } }); } public void createPost(){ User user = new User("","newuser@gmail.com", 112233,"New User"); Retrofit retrofit = new Retrofit.Builder() .baseUrl("http://10.0.2.2:3000/") .addConverterFactory(GsonConverterFactory.create()) .build(); JsonApiInterface jsonPlaceholderApi = retrofit.create(JsonApiInterface.class); Call<User> call = jsonPlaceholderApi.createUser(user); call.enqueue(new Callback<User>() { @Override public void onResponse(Call<User> call, Response<User> response) { if(!response.isSuccessful()){ textView.setText("Code :"+response.code()); return; } User postResponse = response.body(); String content =""; content += "Code :" +response.code() + "\n"; content += "Email: " +user.getEmail()+ "\n"; content += "Password: " +user.getPassword()+ "\n"; content += "Name: " +user.getName()+ "\n"; textView.append(content); Toast.makeText(MainActivity.this,"User has been created",Toast.LENGTH_LONG).show(); } @Override public void onFailure(Call<User> call, Throwable t) { textView.setText(t.getMessage()); } }); } }
[ "kaurnavjot1302@gmail" ]
kaurnavjot1302@gmail
14eab757c6d347ad68b464289062e78dfc7354c5
1f7f98c232761caeb9c2aadb9e721bef39fe1a1c
/src/main/java/com/infoDiscover/infoAnalyse/service/restful/vo/MeasurableVO.java
5fdd4cfe3a9c75d3c9cb3182d587d746e9dc19b4
[]
no_license
wangyingchu/Info-discover-analyse-Microservice_viewfunction
f8726b618ebfd343b60332866ccf6abbbf38ff34
591ed878e064343199669ad0eed11eb2122f0b61
refs/heads/master
2020-03-09T09:15:29.092936
2018-07-16T06:05:30
2018-07-16T06:05:30
128,708,660
0
0
null
null
null
null
UTF-8
Java
false
false
635
java
package com.infoDiscover.infoAnalyse.service.restful.vo; import java.util.List; /** * Created by wangychu on 3/6/17. */ public class MeasurableVO { private List<PropertyVO> measurableProperties; private String recordId; public List<PropertyVO> getMeasurableProperties() { return measurableProperties; } public void setMeasurableProperties(List<PropertyVO> measurableProperties) { this.measurableProperties = measurableProperties; } public String getRecordId() { return recordId; } public void setRecordId(String recordId) { this.recordId = recordId; } }
[ "yingchuwang@gmail.com" ]
yingchuwang@gmail.com
aefa3519db121901924bff28923abc6426f270ff
613de083cea531de806576922f6052933a0de204
/app/src/androidTest/java/com/sudokuai/ExampleInstrumentedTest.java
b412aca5c4b07941a014666acb51c95c9f8fe7f6
[ "MIT" ]
permissive
piotrwawryka/SudokuAI
02635b08ba95687546a93ab1549aec32ca5330d5
11c62561bc5749287f818ea530ad6239cc375985
refs/heads/master
2020-03-23T05:59:51.233503
2018-07-16T19:22:48
2018-07-16T19:22:48
141,182,137
0
0
null
null
null
null
UTF-8
Java
false
false
708
java
package com.sudokuai; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.sudokuai", appContext.getPackageName()); } }
[ "piotr.wawryka@codete.com" ]
piotr.wawryka@codete.com
1b90f8b0f35ea88a4be6155893556f61c813074c
3ebaee3a565d5e514e5d56b44ebcee249ec1c243
/assetBank 3.77 decomplied fixed/src/java/com/bright/assetbank/usage/action/DeleteScheduledReportAction.java
4da7c21d964fad5c8e9eec0b0d87fb2e0a31ca1c
[]
no_license
webchannel-dev/Java-Digital-Bank
89032eec70a1ef61eccbef6f775b683087bccd63
65d4de8f2c0ce48cb1d53130e295616772829679
refs/heads/master
2021-10-08T19:10:48.971587
2017-11-07T09:51:17
2017-11-07T09:51:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,154
java
/* */ package com.bright.assetbank.usage.action; /* */ /* */ import com.bn2web.common.exception.Bn2Exception; /* */ import com.bright.assetbank.usage.constant.UsageConstants; /* */ import com.bright.assetbank.usage.form.ReportForm; /* */ import com.bright.assetbank.usage.service.UsageReportManager; /* */ import com.bright.framework.common.action.BTransactionAction; /* */ import com.bright.framework.constant.FrameworkConstants; /* */ import com.bright.framework.database.bean.DBTransaction; /* */ import javax.servlet.http.HttpServletRequest; /* */ import javax.servlet.http.HttpServletResponse; /* */ import org.apache.struts.action.ActionForm; /* */ import org.apache.struts.action.ActionForward; /* */ import org.apache.struts.action.ActionMapping; /* */ /* */ public class DeleteScheduledReportAction extends BTransactionAction /* */ implements UsageConstants, FrameworkConstants /* */ { /* 44 */ private UsageReportManager m_usageReportManager = null; /* */ /* */ public ActionForward execute(ActionMapping a_mapping, ActionForm a_form, HttpServletRequest a_request, HttpServletResponse a_response, DBTransaction a_dbTransaction) /* */ throws Bn2Exception /* */ { /* 68 */ ActionForward afForward = null; /* 69 */ ReportForm form = (ReportForm)a_form; /* */ /* 72 */ long lReportId = Long.parseLong(a_request.getParameter("reportId").trim()); /* */ /* 75 */ this.m_usageReportManager.deleteScheduledReport(a_dbTransaction, lReportId); /* */ /* 79 */ form.setScheduledReports(this.m_usageReportManager.getScheduledReports(a_dbTransaction)); /* */ /* 81 */ afForward = a_mapping.findForward("Success"); /* */ /* 83 */ return afForward; /* */ } /* */ /* */ public void setUsageReportManager(UsageReportManager a_usageReportManager) /* */ { /* 88 */ this.m_usageReportManager = a_usageReportManager; /* */ } /* */ } /* Location: C:\Users\mamatha\Desktop\com.zip * Qualified Name: com.bright.assetbank.usage.action.DeleteScheduledReportAction * JD-Core Version: 0.6.0 */
[ "42003122+code7885@users.noreply.github.com" ]
42003122+code7885@users.noreply.github.com
881a14ce4430a91f1257b642742399da22dacdc5
90d4a04b1076e692343bb4ccbffb0eb506625a96
/src/main/java/com/mmall/common/TokenCache.java
711e234c8e8766070a503fe39a1d663e5870b438
[]
no_license
tian-li/mmall
cd6ba786d436c550a888c0054a6170379817f470
60c80d140eec399b2c6f7efc0ba50ce8fc8b5d5d
refs/heads/master
2021-05-22T23:07:23.449488
2020-04-29T01:05:07
2020-04-29T01:05:07
253,135,619
1
0
null
2020-04-05T19:24:47
2020-04-05T01:52:16
Java
UTF-8
Java
false
false
1,536
java
package com.mmall.common; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.TimeUnit; public class TokenCache { private static Logger logger = LoggerFactory.getLogger(TokenCache.class); public static final String TOKEN_PREFIX = "token_"; // LRU 算法 private static LoadingCache<String, String> localCache = CacheBuilder.newBuilder().initialCapacity(1000) .maximumSize(10000) .expireAfterAccess(12, TimeUnit.HOURS) .build(new CacheLoader<String, String>() { // 默认数据家在实现,当调用get取值的时候,如果key没有对应的值,就调用这个方法进行加载 @Override public String load(String key) throws Exception { return "null"; } }); public static void setKey(String key, String value) { localCache.put(key, value); } public static String getKey(String key) { String value = null; try { value = localCache.get(key); if ("null".equals(value)) { return null; } return value; } catch (Exception e) { logger.error("localCache get error", e); } return null; } }
[ "litiansq89@gmail.com" ]
litiansq89@gmail.com
3e3853600dc6e25afec799b7b0f62acceabab765
f0d301dfdf9c71e67e2d2d20e002e644aaa6971a
/Selenium/src/selenium_test_1101/Example08.java
b07fc7cfc8b1625614e1e962a8a64f08233cde3e
[]
no_license
MinjiJo/BaekJoon_Online_Judge
c581ee388110d06be646a4ec60f664dba0328a6f
144b96e1c965fb87ef0f6e2e0619ac147d05a50b
refs/heads/master
2020-07-12T23:28:27.336793
2020-07-03T00:49:01
2020-07-03T00:49:01
204,933,410
0
0
null
null
null
null
UHC
Java
false
false
3,164
java
package selenium_test_1101; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.Select; public class Example08 { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "D:\\seleniumlib\\chromedriver.exe"); for(int i=0; i<3; i++) { WebDriver driver= new ChromeDriver(); driver.get("http://192.168.40.8:8088/Se_Web/ex3/NewFile5.html"); JavascriptExecutor jsexe=(JavascriptExecutor)driver; WebElement id=driver.findElement(By.id("id")); id.sendKeys("Q1234"+i); jsexe.executeScript("idcheck()"); WebElement idbutton=driver.findElement(By.xpath("html/body/div/form/div/fieldset/input[2]")); idbutton.click(); //driver.switchTo().parentFrame(); //getWindowHandle() : 현재 페이지의 고유 식별자를 가져옵니다. // getWindowHandle()은 webDriver가 현재 제어하고 있는 페이지의 핸들을 가져옵니다. 이 핸들은 웹 페이지의 고유 식별자입니다. // 동일한 URL인 경우에도 페이지를 열 때마다 다릅니다. //getWindowHandles()는 웹 드라이버가 이해하는 모든 페이지에 대한 모든 핸들을 제공합니다. //이들을 목록에 넣으면 열린 순서대로 나열됩니다. String main=driver.getWindowHandle(); for(String web:driver.getWindowHandles()) { if(!web.equals(main)) { //팝업창으로 전환합니다. driver.switchTo().window(web).close(); } } //메인창으로 전환합니다. driver.switchTo().window(main); WebElement pass=driver.findElement(By.id("pass")); pass.sendKeys("1234"); WebElement jumin1=driver.findElement(By.id("jumin1")); jumin1.sendKeys("600101"); WebElement jumin2=driver.findElement(By.id("jumin2")); jumin2.sendKeys("1345824"); WebElement email=driver.findElement(By.id("email")); email.sendKeys("Q1234"); Select sel=new Select(driver.findElement(By.id("sel"))); sel.selectByIndex(1); //Select domain=new Select(driver.findElement(By.id("domain"))); //domain.sendKeys("naver.com"); List<WebElement> gender=driver.findElements(By.cssSelector("input[type='radio']")); gender.get(0).click(); List<WebElement> hobby=driver.findElements(By.cssSelector("input[type='checkbox']")); hobby.get(0).click(); hobby.get(1).click(); WebElement post1=driver.findElement(By.id("post1")); post1.sendKeys("1234"); WebElement address=driver.findElement(By.id("address")); address.sendKeys("서울시 종로구"); WebElement intro=driver.findElement(By.id("intro")); intro.sendKeys("잘 부탁 드립니다."); //함수 check()만 실행해서 submit 되지 않아요. jsexe.executeScript("check()"); //submit 버튼을 클릭하면 action 페이지로 이동합니다. WebElement sign=driver.findElement(By.cssSelector("button[class='signupbtn']")); //WebElement sign=driver.findElement(By.className("signupbtn")); sign.click(); driver.close(); } } }
[ "MinjiJo@users.noreply.github.com" ]
MinjiJo@users.noreply.github.com
7b4a7fa048b3100133e2489d0426ac591685592c
f7e706ccea35fd94f669123c1d4d6404f50926d9
/src/main/java/br/com/alura/forum/ForumApplication.java
533b29a82db3535dade1b2886a03191731ef9f77
[]
no_license
lucas-cavalcanti-ads/api-forum-alura
09ace5dc56cfd72e330a66d55c014ce88459a95a
03082fff1b6173006259891d65039f09890d111b
refs/heads/master
2023-04-04T11:23:11.705239
2021-04-15T05:31:03
2021-04-15T05:31:03
358,130,887
0
0
null
null
null
null
UTF-8
Java
false
false
703
java
package br.com.alura.forum; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cache.annotation.EnableCaching; import org.springframework.data.web.config.EnableSpringDataWebSupport; import springfox.documentation.swagger2.annotations.EnableSwagger2; @SpringBootApplication @EnableSpringDataWebSupport //Habilita o suporte para o Spring pegar os parametros da requisição e inserir no Spring Data @EnableCaching //Habilita o uso de Cache na aplicação @EnableSwagger2 public class ForumApplication { public static void main(String[] args) { SpringApplication.run(ForumApplication.class, args); } }
[ "lucas.tnv27@gmail.com" ]
lucas.tnv27@gmail.com
9ca46d761b06ef5a0384c24dfa7923c4e0851795
855327b1e33671408dc12f67fda46c09ecf7fc82
/src/main/java/com/mybus/login/configuration/AbstractUserFriendlyRuntimeException.java
13df0fa4fb29dd24b69fabfc5b3943581ce77a8f
[]
no_license
srinikandula/spring-login
3f5cbdc599969fe1de54f0a3a8a202fc591e1a0a
b8796b308ecbb5a54dbc47ac6facc7173c2f67df
refs/heads/master
2020-04-03T11:36:39.190071
2018-10-29T14:34:39
2018-10-29T14:34:39
155,226,862
0
0
null
null
null
null
UTF-8
Java
false
false
1,081
java
package com.mybus.login.configuration; import lombok.Getter; import lombok.NonNull; import lombok.ToString; @ToString public abstract class AbstractUserFriendlyRuntimeException extends RuntimeException { @Getter @NonNull private final String userFriendlyMessage; protected AbstractUserFriendlyRuntimeException(final String message, final String userFriendlyMessage) { super(message); this.userFriendlyMessage = userFriendlyMessage; } protected AbstractUserFriendlyRuntimeException(final String userFriendlyMessage) { super(userFriendlyMessage); this.userFriendlyMessage = userFriendlyMessage; } protected AbstractUserFriendlyRuntimeException(final String userFriendlyMessage, Throwable cause) { super(userFriendlyMessage, cause); this.userFriendlyMessage = userFriendlyMessage; } protected AbstractUserFriendlyRuntimeException(String message, String userFriendlyMessage, Throwable cause) { super(message, cause); this.userFriendlyMessage = userFriendlyMessage; } }
[ "srini.kandula@shodogg.com" ]
srini.kandula@shodogg.com
644fcc9a42dad3c299ae89740bf90f91effdca85
c98d3c6a6656d79d7313ceb528f7cf26aee8d843
/src/lista/Media.java
4a158ccf900dc26f801925b678715ce3a7f8fa89
[]
no_license
shinaider112/Lista
28f67f9b1b23448466f3dd02be124dbc7e5636e3
a20f8ac13f3edcf6a67c6419eae3e768c4368cf0
refs/heads/master
2020-06-16T15:46:57.780204
2016-11-30T01:58:12
2016-11-30T01:58:12
75,087,179
0
0
null
null
null
null
WINDOWS-1250
Java
false
false
870
java
/** * Unicesumar ? Centro Universitário Cesumar * Curso: Análise e Desenvolvimento de Sistemas * Autor(es): Wendell Neander * Data: 29/11/2016 * Repositório: https://github.com/shinaider112/Lista.git */ package lista; import java.util.Scanner; public class Media { public static void main(String[] args) { Scanner s = new Scanner(System.in); double n1 = 0, n2 = 0, n3 = 0, n4 = 0, media = 0; System.out.println("Digite a nota: "); n1 = s.nextDouble(); System.out.println("Digite a nota: "); n2 = s.nextDouble(); System.out.println("Digite a nota: "); n3 = s.nextDouble(); System.out.println("Digite a nota: "); n4 = s.nextDouble(); media = (n1 + n2 + n3 + n4)/4; System.out.println("Media: " + media); if(media >= 6){ System.out.println("Aprovado"); }else{ System.out.println("Reprovado"); } } }
[ "wendell_neander@hotmail.com" ]
wendell_neander@hotmail.com
11777c28a61106840ef7e018e4ae10210e87caa6
8b18b8fa7c01ce62ba8957bd647594017c7da81e
/src/com/nikesh/strategic/Employee.java
b112f44164b2dc1c1b656f826237e8c7ca3648ff
[]
no_license
nikeshpathak/strategy-pattern
f9e1db6e3751b7611be126e3975a9e6c739f8dc1
b802bacf93933ef2a007043bfbbb0abb402d9ff2
refs/heads/master
2021-01-11T03:25:28.086962
2016-10-16T06:36:32
2016-10-16T06:36:32
71,034,250
0
0
null
null
null
null
UTF-8
Java
false
false
304
java
package com.nikesh.strategic; /** * Created by Nikesh 10/22/15. */ public abstract class Employee { public IWork iwork; abstract void doWork(); public void setWork(IWork iwork) { this.iwork = iwork; } public IWork getWork() { return this.iwork; } }
[ "nikesh@tagrem.com" ]
nikesh@tagrem.com
e7a067921cdce6fcc03d06c2d73a52bc2b5dc56c
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/34/34_9a0fd4115ab642b7a04316bd273a57d7b032aa96/Service/34_9a0fd4115ab642b7a04316bd273a57d7b032aa96_Service_s.java
d6ab36d80001893558389d76408346fa548d9ef6
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
3,912
java
package com.alagad.ant4cf; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.NameValuePair; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Task; import com.alagad.ant4cf.util.ConfigReader; import com.alagad.ant4cf.util.Util; public class Service extends Task { private String component; private String method; private String property; private ArrayList<Argument> arguments = new ArrayList<Argument>(); private ConfigReader config; // The method executing the task public void execute() throws BuildException { config = new ConfigReader(getProject()); String result; try{ result = runService(); } catch(Exception e){ throw new BuildException(e.getMessage()); } // set the property getProject().setProperty(this.property, result); } private String runService() throws IOException, Exception{ HttpClient client = new HttpClient(); String url = getComponentUrl(); PostMethod post = new PostMethod(url); NameValuePair[] data = getArguments(); if(config.getDebug()){ for(int x = 0 ; x < data.length ; x++){ System.out.println(data[x].getName() + ": " + data[x].getValue()); } } post.setRequestBody(data); int status = client.executeMethod(post); String result; if(status == 200){ InputStream in = post.getResponseBodyAsStream(); // dump the response. result = Util.read(new InputStreamReader(in)); } else { throw new Exception("HTTP Error: " + status + ", Detail: " + Util.read(new InputStreamReader(post.getResponseBodyAsStream()))); } // disconnect post.releaseConnection(); return result; } private NameValuePair[] getArguments(){ ArrayList<NameValuePair> args = new ArrayList<NameValuePair>(); args.add(new NameValuePair("adminPassword", this.config.getAdminPassword())); if(this.config.getAdminUserId() != null){ args.add(new NameValuePair("adminUserId", this.config.getAdminUserId())); } args.add(new NameValuePair("method", this.method)); for(int x = 0 ; x < this.arguments.size() ; x++){ Argument argument = (Argument) this.arguments.get(x); args.add(new NameValuePair(argument.getName(), argument.getValue())); } NameValuePair[] result = new NameValuePair[args.size()]; args.toArray(result); return result; } private String getComponentUrl(){ String url = this.config.getAnt4cfUrl() + "/services/" + this.component.replace(".", "/") + ".cfc"; return url; } public Argument createArgument() { Argument argument = new Argument(); this.arguments.add(argument); return argument; } public void setComponent(String component){ this.component = component; } public void setMethod(String method){ this.method = method; } public void setProperty(String property){ this.property = property; } public class Argument extends Task { private String name; private String value; public void setName(String name){ this.name = name; } public String getName(){ return this.name; } public void setValue(String value){ this.value = value; } public String getValue(){ return this.value; } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
f974a78eee40a9d6ff67145d83fa0d16d44a87ec
705376c36dc179c031593df6b762db081f9da96b
/LoginModule/src/com/login/Logout.java
c925f333568c020f6d93188c042dbf8b9cfae245
[]
no_license
sagarbadiyani/Login-App-Using-JavaServlets-JSP-JDBC
5f0f5884a5b7826b200c44420a09e5105d056e7c
2fb390153ad2ef3a97839d81c7c76ed3bed37c94
refs/heads/master
2023-04-22T12:04:19.943434
2021-05-08T10:36:51
2021-05-08T10:36:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
650
java
package com.login; import java.io.IOException; import jakarta.servlet.ServletException; import jakarta.servlet.annotation.WebServlet; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpSession; @WebServlet("/Logout") public class Logout extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ HttpSession session = request.getSession(); session.removeAttribute("uname"); session.invalidate(); response.sendRedirect("login.jsp"); } }
[ "sagar.a.badiyani@gmail.com" ]
sagar.a.badiyani@gmail.com
efacf0339554a2eb646f0105749b317e417903b7
5e928edb7276cb53a84cae2868b198e617fd8409
/src/main/java/com/basu/repository/UserRepository.java
94cb066a19806c68aad90d840b43fabc9eaba8ae
[]
no_license
basavarajarani/eCommSite
c44ebb4c1ac69cd19839bde11a6a71fc039de004
51b3b063acfdaa1acbd3531ad8247875caa3e502
refs/heads/master
2021-01-19T20:47:00.661537
2014-05-07T07:51:37
2014-05-07T07:51:37
18,352,533
0
0
null
null
null
null
UTF-8
Java
false
false
249
java
package com.basu.repository; import org.springframework.data.jpa.repository.JpaRepository; import com.basu.schemas.User; public interface UserRepository extends JpaRepository<User, String> { public User findByUserNameLike(String userName); }
[ "basavaraj.arani@gmail.com" ]
basavaraj.arani@gmail.com
a8dd200fa3693bf59ac3b0340583e0dad4d17153
2b4c258a6f28f9669b65bdc1f26e7567d99ca97b
/model/src/test/java/group/ydq/model/ModelApplicationTests.java
08d87a28044bd90b51740fca633aa8be31bd834a
[]
no_license
Natsukawamasuzu/ydq
38d9238c7c0a4701ae6c63d17afb81b69d58c6ff
f89118faff93828f3edde7defe4692b3ab06c255
refs/heads/master
2020-04-05T17:59:00.417763
2018-11-11T12:57:18
2018-11-11T12:57:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
331
java
package group.ydq.model; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class ModelApplicationTests { @Test public void contextLoads() { } }
[ "491739727@qq.com" ]
491739727@qq.com
a50261dd11ecb672e747df2fe4dcb8e51843d580
65fa70c2097fdb7a692be29a94b52a9e65cefb89
/webcollector/src/com/xyz/hayhay/db/JDBCConnection.java
c7c60f9e53889088a7c9564b64b38fb4116a734f
[]
no_license
kientv80/webcollector
858a4349d46eb1d1d0c7b966f5e65277adf4c89f
0066aea3bd8ff11760438b315dfeb944bb2e6172
refs/heads/master
2021-01-19T18:30:53.825465
2017-10-17T16:56:41
2017-10-17T16:56:41
88,363,291
0
0
null
null
null
null
UTF-8
Java
false
false
2,407
java
package com.xyz.hayhay.db; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; import org.apache.log4j.Logger; public class JDBCConnection { // private static ComboPooledDataSource connectionPool = new ComboPooledDataSource(); private static JDBCConnection instance; Logger log = Logger.getLogger(JDBCConnection.class); public static JDBCConnection getInstance(){ if(instance == null) instance = new JDBCConnection(); return instance; } private JDBCConnection() { // try { // connectionPool.setDriverClass("com.mysql.jdbc.Driver"); // connectionPool.setJdbcUrl(ConfigurationHelper.getInstance().getValue("mysqlDB")); // connectionPool.setUser(ConfigurationHelper.getInstance().getValue("dbuser")); // connectionPool.setPassword(ConfigurationHelper.getInstance().getValue("dbpassword")); // Properties p = new Properties(); // p.setProperty("useUnicode", "true"); // p.setProperty("characterEncoding", "utf-8"); // p.setProperty("user", ConfigurationHelper.getInstance().getValue("dbuser")); // p.setProperty("password", ConfigurationHelper.getInstance().getValue("dbpassword")); // p.setProperty("validationQuery","/* ping */ SELECT 1"); // p.setProperty("testWhileIdle","true"); // connectionPool.setProperties(p); // connectionPool.setMaxPoolSize(50); // connectionPool.setInitialPoolSize(10); // connectionPool.setMaxIdleTime(50); // connectionPool.setMaxStatementsPerConnection(10); // } catch (PropertyVetoException e) { // log.error("", e); // } } public Connection getConnection() { Connection conn = null; try { Properties p = new Properties(); p.setProperty("useUnicode", "true"); p.setProperty("autoReconnect", "true"); p.setProperty("characterEncoding", "utf-8"); p.put("connectTimeout", "5000"); p.setProperty("user", ConfigurationHelper.getInstance().getValue("dbuser")); p.setProperty("password", ConfigurationHelper.getInstance().getValue("dbpassword")); conn = DriverManager.getConnection(ConfigurationHelper.getInstance().getValue("mysqlDB"), p); } catch (SQLException e) { e.printStackTrace(); } return conn; /* try { Connection conn = connectionPool.getConnection(); return conn; } catch (SQLException e) { log.error("", e); } return null;*/ } }
[ "kientv@vng.com.vn" ]
kientv@vng.com.vn
1372fd729c03e3e28e35b8f1409c8250efd25e59
8816bd99163d4adc357e76664a64be036b9be1c1
/AL-Game7/data/scripts/system/handlers/quest/sanctum/_80064EventMysteriousMission.java
94fa58ecaf30e0efbff80a7a89628d7cd2225e71
[]
no_license
w4terbomb/SPP-AionGermany
274b250b7b7b73cdd70485aef84b3900c205a928
a77b4ef188c69f2bc3b850e021545f9ad77e66f3
refs/heads/master
2022-11-25T23:31:21.049612
2019-09-23T13:45:58
2019-09-23T13:45:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,052
java
/** * This file is part of Aion-Lightning <aion-lightning.org>. * * Aion-Lightning 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. * * Aion-Lightning is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Aion-Lightning. * If not, see <http://www.gnu.org/licenses/>. */ package quest.sanctum; import com.aionemu.gameserver.model.DialogAction; import com.aionemu.gameserver.model.gameobjects.player.Player; import com.aionemu.gameserver.questEngine.handlers.QuestHandler; import com.aionemu.gameserver.questEngine.model.QuestEnv; import com.aionemu.gameserver.questEngine.model.QuestState; import com.aionemu.gameserver.questEngine.model.QuestStatus; /** * @author QuestGenerator by Mariella */ public class _80064EventMysteriousMission extends QuestHandler { private final static int questId = 80064; public _80064EventMysteriousMission() { super(questId); } @Override public void register() { qe.registerQuestNpc(205475).addOnTalkEvent(questId); // Emeele } @Override public boolean onLvlUpEvent(QuestEnv env) { return defaultOnLvlUpEvent(env, 1000, true); } @Override public boolean onDialogEvent(QuestEnv env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); DialogAction dialog = env.getDialog(); int targetId = env.getTargetId(); if (qs == null) { return false; } if (qs.getStatus() == QuestStatus.START) { switch (targetId) { case 205475: { switch (dialog) { default: break; } break; } default: break; } } return false; } }
[ "conan_513@hotmail.com" ]
conan_513@hotmail.com
86de4b83f6d7ee0645eee7b6308779949ebc70c6
68f95af003f0d82bfbb6b1c392e2e94c2d16e55c
/src/test/java/pe/permanente_evaluatie/domain/UtilsTest.java
5181afec9983c66233b11ebd5fcc002b3dddb7b4
[]
no_license
AbelVandenBriel/permanente_evaluatie_ipminor_VandenBrielAbel
b64c69301c66e4c8bd0c557b9e62dae272bb7b10
727d59a93ad869b16b38e15e265c2d3b815c1c63
refs/heads/master
2021-03-29T19:46:41.413680
2020-05-29T13:18:33
2020-05-29T13:18:33
247,980,876
0
0
null
2020-10-13T22:27:42
2020-03-17T13:45:39
Java
UTF-8
Java
false
false
4,109
java
package pe.permanente_evaluatie.domain; import org.junit.Before; import org.junit.Test; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.util.UUID; import static org.junit.Assert.assertEquals; public class UtilsTest { Task task; LocalDateTime ldt; SubTask subTask1; SubTask subTask2; TaskDTO taskDTO; SubTaskDTO subTaskDTO1; SubTaskDTO subTaskDTO2; @Before public void setUp(){ ldt = LocalDateTime.of(LocalDate.of(2020,04,20), LocalTime.of(14, 30)); task = new Task("name", "description",ldt); task.setId(UUID.randomUUID()); subTask1 = new SubTask("subTask1", "subTask1 description"); subTask1.setId(UUID.randomUUID()); subTask2 = new SubTask("subTask2", "subTask2 description"); subTask2.setId(UUID.randomUUID()); } @Test public void taskToDTO_converts_task_with_no_subtasks_correctly(){ TaskDTO taskDTO = Utils.taskToDTO(task); assertEquals(task.getName(), taskDTO.getName()); assertEquals(task.getDueDate(), taskDTO.getDueDate()); assertEquals(task.getDescription(), taskDTO.getDescription()); assertEquals(task.getId(), taskDTO.getId()); assertEquals(task.getSubTasks().size(), taskDTO.getSubTasks().size()); } @Test public void taskToDTO_converts_task_with_subtasks_correctly(){ task.addSubTask(subTask1); task.addSubTask(subTask2); assertEquals(2, task.getSubTasks().size()); TaskDTO taskDTO = Utils.taskToDTO(task); assertEquals(task.getName(), taskDTO.getName()); assertEquals(task.getDueDate(), taskDTO.getDueDate()); assertEquals(task.getDescription(), taskDTO.getDescription()); assertEquals(task.getId(), taskDTO.getId()); assertEquals(2, taskDTO.getSubTasks().size()); assertEquals(task.getSubTasks().get(0).getId(), taskDTO.getSubTasks().get(0).getId()); assertEquals(task.getSubTasks().get(1).getId(), taskDTO.getSubTasks().get(1).getId()); } @Test public void DTOToTask_converts_taskdto_with_no_subtasks_correctly(){ taskDTO = Utils.taskToDTO(task); Task task1 = Utils.DTOToTask(taskDTO); assertEquals(taskDTO.getName(), task1.getName()); assertEquals(taskDTO.getDueDate(), task1.getDueDate()); assertEquals(taskDTO.getDescription(), task1.getDescription()); assertEquals(taskDTO.getId(), task1.getId()); assertEquals(taskDTO.getSubTasks().size(), task1.getSubTasks().size()); } @Test public void DTOToTask_converts_taskdto_with_subtasks_correctly(){ task.addSubTask(subTask1); task.addSubTask(subTask2); assertEquals(2, task.getSubTasks().size()); taskDTO = Utils.taskToDTO(task); Task task1 = Utils.DTOToTask(taskDTO); assertEquals(taskDTO.getName(), task1.getName()); assertEquals(taskDTO.getDueDate(), task1.getDueDate()); assertEquals(taskDTO.getDescription(), task1.getDescription()); assertEquals(taskDTO.getId(), task1.getId()); assertEquals(2, task1.getSubTasks().size()); assertEquals(taskDTO.getSubTasks().get(0).getId(), task1.getSubTasks().get(0).getId()); assertEquals(taskDTO.getSubTasks().get(1).getId(), task1.getSubTasks().get(1).getId()); } @Test public void subTaskToDTO_converts_subTask_correctly(){ SubTaskDTO subTaskDTO = Utils.subTaskToDTO(subTask1); assertEquals(subTask1.getId(), subTaskDTO.getId()); assertEquals(subTask1.getName(), subTaskDTO.getName()); assertEquals(subTask1.getDescription(), subTaskDTO.getDescription()); } @Test public void DTOToSubTask_converts_subTaskDTO_correctly(){ subTaskDTO1 = Utils.subTaskToDTO(subTask1); SubTask subTask = Utils.DTOToSubTask(subTaskDTO1); assertEquals(subTaskDTO1.getId(), subTask.getId()); assertEquals(subTaskDTO1.getName(), subTask.getName()); assertEquals(subTaskDTO1.getDescription(), subTask.getDescription()); } }
[ "abel.vandenbriel@student.ucll.be" ]
abel.vandenbriel@student.ucll.be
815b1a653bdb33eda28e1cef4bfe21b9e8453113
349637c7eaca7e29954ea9ae1cf366711bfdd6cf
/algorithm/seaweed/9) 그리디/BOJ11399.java
ec3613c3618e945cb6bf96a0ef0f104434f1fd7c
[]
no_license
glenn93516/algo_web_study
d1cdbb0d8aa24253e79b719ebc266fed61dacd71
c7ddaaec86612d0efe55eee5d4000df3eb301557
refs/heads/main
2023-03-18T15:16:29.202014
2021-03-07T12:15:37
2021-03-07T12:15:37
313,369,098
1
4
null
null
null
null
UTF-8
Java
false
false
1,320
java
package day1203; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class BOJ11399 { // i번째 사람이 인출하는데 걸리는 총 시간 = i-1번째 사람이 인출하는데 걸리는 시간 + i번째 사람이 뽑는 시간 // 빨리 인출할 수 있는 사람부터 돈을 뽑으면 기다려야 하는 시간을 최소화 할 수 있다. public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); int[] P = new int[N]; // 인출하는데 걸리는 시간 int[] time = new int[N]; // 각 사람이 인출하는데 필요한 시간의 합 int totalTime = 0; // 모든 사람이 돈을 인출하는데 필요한 시간 합의 최솟값 String[] input = br.readLine().split(" "); for(int i = 0; i < N; i++) { P[i] = Integer.parseInt(input[i]); } Arrays.sort(P); // 인출하는데 걸리는 시간 오름차순 정렬 for(int i = 0; i < N; i++) { if(i == 0) { time[i] = P[i]; totalTime += time[i]; continue; } time[i] = time[i-1] + P[i]; // i번째 사람이 인출하는데 필요한 시간 totalTime += time[i]; } System.out.println(totalTime); } }
[ "glenn93516@gmail.com" ]
glenn93516@gmail.com
d942aafad1e01e4b919e1dd2b81d7b4af4d93fd7
5e0e6eeb4d1e57d999442aa07a730f3f2c7ae0f8
/ServicesHSM/src/main/java/com/novatronic/components/hsm/bean/HsmServer.java
972bd42c5f47e13864bdde64157f086181b310e8
[]
no_license
jilopeza/SectorCode
59bde7b20cbee152974dca5d539dbeb02d0b528c
2f7e12d010d9105d3cf0eb3ed003d46dc46fc032
refs/heads/master
2021-05-02T07:53:27.293230
2018-02-09T02:41:34
2018-02-09T03:00:52
120,841,034
0
0
null
null
null
null
UTF-8
Java
false
false
10,877
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2017.07.05 at 04:35:38 PM COT // package com.novatronic.components.hsm.bean; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for hsmServer complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="hsmServer"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="classModelName" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="modelName" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="classRequestName" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="classResponseName" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="idLMK" type="{http://www.w3.org/2001/XMLSchema}int"/> * &lt;element name="lenHeader" type="{http://www.w3.org/2001/XMLSchema}int"/> * &lt;element name="ip" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="port" type="{http://www.w3.org/2001/XMLSchema}int"/> * &lt;element name="connectionType" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="timeout" type="{http://www.w3.org/2001/XMLSchema}int"/> * &lt;element name="intervalEcho" type="{http://www.w3.org/2001/XMLSchema}int"/> * &lt;element name="retriesNumber" type="{http://www.w3.org/2001/XMLSchema}int"/> * &lt;element name="balanceType" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="percentWork" type="{http://www.w3.org/2001/XMLSchema}int"/> * &lt;element name="environmentType" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="version" type="{http://www.w3.org/2001/XMLSchema}int"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "hsmServer", propOrder = { "id", "classModelName", "modelName", "classRequestName", "classResponseName", "idLMK", "lenHeader", "ip", "port", "connectionType", "timeout", "intervalEcho", "retriesNumber", "balanceType", "percentWork", "environmentType", "version" }) public class HsmServer { @XmlElement(required = true) protected String id; @XmlElement(required = true) protected String classModelName; @XmlElement(required = true) protected String modelName; @XmlElement(required = true) protected String classRequestName; @XmlElement(required = true) protected String classResponseName; protected int idLMK; protected int lenHeader; @XmlElement(required = true) protected String ip; protected int port; @XmlElement(required = true) protected String connectionType; protected int timeout; protected int intervalEcho; protected int retriesNumber; @XmlElement(required = true) protected String balanceType; protected int percentWork; @XmlElement(required = true) protected String environmentType; protected int version; /** * Gets the value of the id property. * * @return * possible object is * {@link String } * */ public String getId() { return id; } /** * Sets the value of the id property. * * @param value * allowed object is * {@link String } * */ public void setId(String value) { this.id = value; } /** * Gets the value of the classModelName property. * * @return * possible object is * {@link String } * */ public String getClassModelName() { return classModelName; } /** * Sets the value of the classModelName property. * * @param value * allowed object is * {@link String } * */ public void setClassModelName(String value) { this.classModelName = value; } /** * Gets the value of the modelName property. * * @return * possible object is * {@link String } * */ public String getModelName() { return modelName; } /** * Sets the value of the modelName property. * * @param value * allowed object is * {@link String } * */ public void setModelName(String value) { this.modelName = value; } /** * Gets the value of the classRequestName property. * * @return * possible object is * {@link String } * */ public String getClassRequestName() { return classRequestName; } /** * Sets the value of the classRequestName property. * * @param value * allowed object is * {@link String } * */ public void setClassRequestName(String value) { this.classRequestName = value; } /** * Gets the value of the classResponseName property. * * @return * possible object is * {@link String } * */ public String getClassResponseName() { return classResponseName; } /** * Sets the value of the classResponseName property. * * @param value * allowed object is * {@link String } * */ public void setClassResponseName(String value) { this.classResponseName = value; } /** * Gets the value of the idLMK property. * */ public int getIdLMK() { return idLMK; } /** * Sets the value of the idLMK property. * */ public void setIdLMK(int value) { this.idLMK = value; } /** * Gets the value of the lenHeader property. * */ public int getLenHeader() { return lenHeader; } /** * Sets the value of the lenHeader property. * */ public void setLenHeader(int value) { this.lenHeader = value; } /** * Gets the value of the ip property. * * @return * possible object is * {@link String } * */ public String getIp() { return ip; } /** * Sets the value of the ip property. * * @param value * allowed object is * {@link String } * */ public void setIp(String value) { this.ip = value; } /** * Gets the value of the port property. * */ public int getPort() { return port; } /** * Sets the value of the port property. * */ public void setPort(int value) { this.port = value; } /** * Gets the value of the connectionType property. * * @return * possible object is * {@link String } * */ public String getConnectionType() { return connectionType; } /** * Sets the value of the connectionType property. * * @param value * allowed object is * {@link String } * */ public void setConnectionType(String value) { this.connectionType = value; } /** * Gets the value of the timeout property. * */ public int getTimeout() { return timeout; } /** * Sets the value of the timeout property. * */ public void setTimeout(int value) { this.timeout = value; } /** * Gets the value of the intervalEcho property. * */ public int getIntervalEcho() { return intervalEcho; } /** * Sets the value of the intervalEcho property. * */ public void setIntervalEcho(int value) { this.intervalEcho = value; } /** * Gets the value of the retriesNumber property. * */ public int getRetriesNumber() { return retriesNumber; } /** * Sets the value of the retriesNumber property. * */ public void setRetriesNumber(int value) { this.retriesNumber = value; } /** * Gets the value of the balanceType property. * * @return * possible object is * {@link String } * */ public String getBalanceType() { return balanceType; } /** * Sets the value of the balanceType property. * * @param value * allowed object is * {@link String } * */ public void setBalanceType(String value) { this.balanceType = value; } /** * Gets the value of the percentWork property. * */ public int getPercentWork() { return percentWork; } /** * Sets the value of the percentWork property. * */ public void setPercentWork(int value) { this.percentWork = value; } /** * Gets the value of the environmentType property. * * @return * possible object is * {@link String } * */ public String getEnvironmentType() { return environmentType; } /** * Sets the value of the environmentType property. * * @param value * allowed object is * {@link String } * */ public void setEnvironmentType(String value) { this.environmentType = value; } /** * Gets the value of the version property. * */ public int getVersion() { return version; } /** * Sets the value of the version property. * */ public void setVersion(int value) { this.version = value; } }
[ "josue.lopez.acosta@gmail.com" ]
josue.lopez.acosta@gmail.com
35e28dfc28b5e69b45be8f2a69f7c64facea4273
8719efedbc7276a5a5bd4fcdd06da6547f994b1b
/src/main/java/io/pivotal/pal/tracker/TimeEntryRepository.java
a81a423f957914aecc686a499b66e24809628cfb
[]
no_license
Matt-Rhodes93/pal-tracker
d8e37f3adf2d5db9a7383b53f81c91c9c868c779
daea1e61bc93e2d6fc80cd76e08344788a7a97fc
refs/heads/master
2020-03-28T21:16:40.162083
2018-09-19T18:05:53
2018-09-19T18:05:53
149,143,522
0
0
null
null
null
null
UTF-8
Java
false
false
408
java
package io.pivotal.pal.tracker; import org.springframework.context.annotation.Bean; import org.springframework.http.ResponseEntity; import java.util.List; public interface TimeEntryRepository { public TimeEntry create(TimeEntry any); public TimeEntry find(long id); public List<TimeEntry> list(); public TimeEntry update(long eq, TimeEntry any); public boolean delete(long l); }
[ "matt.rhodes.ee7a@statefarm.com" ]
matt.rhodes.ee7a@statefarm.com
a00574121e67d396f6fceb00eb76d5405283d974
ee1fc12feef20f8ebe734911acdd02b1742e417c
/android_sourcecode/app/src/main/java/com/ak/pt/bean/FilterReplaceBean.java
4c42db183ee705d50825bf68f19869491cbcf34d
[ "MIT" ]
permissive
xiaozhangxin/test
aee7aae01478a06741978e7747614956508067ed
aeda4d6958f8bf7af54f87bc70ad33d81545c5b3
refs/heads/master
2021-07-15T21:52:28.171542
2020-03-09T14:30:45
2020-03-09T14:30:45
126,810,840
0
0
null
null
null
null
UTF-8
Java
false
false
7,181
java
package com.ak.pt.bean; import java.io.Serializable; import java.util.List; /** * Created by admin on 2019/5/22. */ public class FilterReplaceBean implements Serializable { /** * filter_id : 24 * staff_id : 113 * staff_name : 二哥 * department_name : 南方营销中心 * customer_name : 呵呵 * customer_sex : 先生 * customer_tel : 431959894949 * customer_address : 上海市 上海市 浦东新区 * address_info : 闺蜜您 * address_code : 200000 * serve_shop : 咯哦咯公公 * serve_name : 8英亩 * serve_tel : 87984646 * is_delete : 0 * create_time : 2019-05-31 16:45:44 * update_time : 2019-05-31 16:45:44 * filter_no : LXTH2019053148178 * group_no : 001001 * job_name_list : [] * upFileList : [] * downFileList : [] * productList : [{"product_id":27,"filter_id":24,"product_soft":"反渗透净水机","product_type":"CR400-K1","product_no":"6924010000321","product_name":"PP1,RO膜","create_time":"2019-05-31 16:45:44"},{"product_id":28,"filter_id":24,"product_soft":"超滤净水机","product_type":"CWUF-3100","product_no":"突突突6924010000321","product_name":"超滤膜,后置活性炭","create_time":"2019-05-31 16:45:44"}] * job_name : 外部水工 * start_time : * end_time : * staff_uuid : * group_parent_uuid : * all_name : */ private String filter_id; private String staff_id; private String staff_name; private String department_name; private String customer_name; private String customer_sex; private String customer_tel; private String customer_address; private String address_info; private String address_code; private String serve_shop; private String serve_name; private String serve_tel; private String is_delete; private String create_time; private String update_time; private String filter_no; private String group_no; private String job_name; private String start_time; private String end_time; private String staff_uuid; private String group_parent_uuid; private String all_name; private String group_id; private List<DownFileBean> upFileList; public String getGroup_id() { return group_id; } public void setGroup_id(String group_id) { this.group_id = group_id; } private List<DownFileBean> downFileList; private List<FilterTypeBean> productList; public List<FilterTypeBean> getProductList() { return productList; } public void setProductList(List<FilterTypeBean> productList) { this.productList = productList; } public String getFilter_id() { return filter_id; } public void setFilter_id(String filter_id) { this.filter_id = filter_id; } public String getStaff_id() { return staff_id; } public void setStaff_id(String staff_id) { this.staff_id = staff_id; } public String getStaff_name() { return staff_name; } public void setStaff_name(String staff_name) { this.staff_name = staff_name; } public String getDepartment_name() { return department_name; } public void setDepartment_name(String department_name) { this.department_name = department_name; } public String getCustomer_name() { return customer_name; } public void setCustomer_name(String customer_name) { this.customer_name = customer_name; } public String getCustomer_sex() { return customer_sex; } public void setCustomer_sex(String customer_sex) { this.customer_sex = customer_sex; } public String getCustomer_tel() { return customer_tel; } public void setCustomer_tel(String customer_tel) { this.customer_tel = customer_tel; } public String getCustomer_address() { return customer_address; } public void setCustomer_address(String customer_address) { this.customer_address = customer_address; } public String getAddress_info() { return address_info; } public void setAddress_info(String address_info) { this.address_info = address_info; } public String getAddress_code() { return address_code; } public void setAddress_code(String address_code) { this.address_code = address_code; } public String getServe_shop() { return serve_shop; } public void setServe_shop(String serve_shop) { this.serve_shop = serve_shop; } public String getServe_name() { return serve_name; } public void setServe_name(String serve_name) { this.serve_name = serve_name; } public String getServe_tel() { return serve_tel; } public void setServe_tel(String serve_tel) { this.serve_tel = serve_tel; } public String getIs_delete() { return is_delete; } public void setIs_delete(String is_delete) { this.is_delete = is_delete; } public String getCreate_time() { return create_time; } public void setCreate_time(String create_time) { this.create_time = create_time; } public String getUpdate_time() { return update_time; } public void setUpdate_time(String update_time) { this.update_time = update_time; } public String getFilter_no() { return filter_no; } public void setFilter_no(String filter_no) { this.filter_no = filter_no; } public String getGroup_no() { return group_no; } public void setGroup_no(String group_no) { this.group_no = group_no; } public String getJob_name() { return job_name; } public void setJob_name(String job_name) { this.job_name = job_name; } public String getStart_time() { return start_time; } public void setStart_time(String start_time) { this.start_time = start_time; } public String getEnd_time() { return end_time; } public void setEnd_time(String end_time) { this.end_time = end_time; } public String getStaff_uuid() { return staff_uuid; } public void setStaff_uuid(String staff_uuid) { this.staff_uuid = staff_uuid; } public String getGroup_parent_uuid() { return group_parent_uuid; } public void setGroup_parent_uuid(String group_parent_uuid) { this.group_parent_uuid = group_parent_uuid; } public String getAll_name() { return all_name; } public void setAll_name(String all_name) { this.all_name = all_name; } public List<DownFileBean> getUpFileList() { return upFileList; } public void setUpFileList(List<DownFileBean> upFileList) { this.upFileList = upFileList; } public List<DownFileBean> getDownFileList() { return downFileList; } public void setDownFileList(List<DownFileBean> downFileList) { this.downFileList = downFileList; } }
[ "xiaozhangxin@shifuhelp.com" ]
xiaozhangxin@shifuhelp.com
bd12de4d4b036554e95750288e21f29f5ffa29be
630edeeddcddb7b1c9f7d8e19317d62f2364cb83
/src/main/java/gtech/agriculturerent/service/impl/jpa/LandLordPropertyRepositoryCustom.java
6279b8ac985c16485717321c71b56924a1fac3c1
[]
no_license
Dilyan-Galabov/Agriculture
f0047b4725166b2eb7db837ac9d7f031bb9acfe0
08a6c0c48189de3d9aa90db2d7bc8fec3dc3118b
refs/heads/master
2022-12-08T11:15:05.453620
2020-09-05T06:53:50
2020-09-05T06:53:50
293,020,597
0
0
null
null
null
null
UTF-8
Java
false
false
346
java
package gtech.agriculturerent.service.impl.jpa; import java.util.List; import gtech.agriculturerent.service.api.filter.LandLordPropertyFilter; import gtech.agriculturerent.service.impl.model.LandLordPropertyEntity; public interface LandLordPropertyRepositoryCustom { List<LandLordPropertyEntity> findAll(LandLordPropertyFilter filter); }
[ "galabov@media-it-services.de" ]
galabov@media-it-services.de
10ea1235b8fade545a31144d4437e5d180107e86
20b97c92ef3f1da23080960bc52aadd7ada3ad29
/src/main/java/io/github/afei/zhihu/adapter/ThemeSummaryAdapter.java
91fdf80c96a81c661837966ec43a9ff7ab74edf1
[]
no_license
afeilives/zhihuApp
4fbbdde91dc4d6ff065382c2af340aa28d93016c
23ae9e50eddc31b56e12e6f0c1d4f56002e569fb
refs/heads/master
2020-12-30T11:59:22.889581
2017-05-16T15:01:13
2017-05-16T15:01:13
91,471,851
0
0
null
null
null
null
UTF-8
Java
false
false
4,345
java
package io.github.afei.zhihu.adapter; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import java.util.List; import io.github.afei.zhihu.entity.NewsTheme; import io.github.afei.zhihu.entity.Summary; import io.github.afei.zhihu.view.JustifyTextView; import io.github.leibnik.zhihu.R; /** * Created by afei on 2016/10/1. */ public class ThemeSummaryAdapter extends RecyclerView.Adapter<ThemeSummaryAdapter.ViewHolder> { private List<Summary> mData; private String mTitle; private String mImageUrl; private Context mContext; public static final int IS_HEADER = 0; public static final int IS_NORMAL = 1; private boolean isColorTheme; private OnItemClickListener mOnItemClickListener; public void updateTheme(boolean isColorTheme) { this.isColorTheme = isColorTheme; } public interface OnItemClickListener { void OnItemClick(View v, Summary data); } public void setOnItemClickListener(OnItemClickListener listener) { this.mOnItemClickListener = listener; } class ViewHolder extends RecyclerView.ViewHolder { JustifyTextView itemTv; ImageView itemIv, headerIv; TextView headerTv; public ViewHolder(View itemView, int viewType) { super(itemView); if (viewType == IS_NORMAL) { itemTv = (JustifyTextView) itemView.findViewById(R.id.summary_tv); itemIv = (ImageView) itemView.findViewById(R.id.summary_iv); } if (viewType == IS_HEADER) { headerIv = (ImageView) itemView.findViewById(R.id.header_iv); headerTv = (TextView) itemView.findViewById(R.id.header_tv); } } } public ThemeSummaryAdapter(Context context, NewsTheme data) { this.mData = data.getStories(); this.mTitle = data.getDescription(); this.mImageUrl = data.getBackground(); this.mContext = context; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if (viewType == IS_HEADER) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_theme_summary_header, parent, false); return new ViewHolder(view, viewType); } else { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_summary_normal, parent, false); return new ViewHolder(view, viewType); } } @Override public void onBindViewHolder(ViewHolder holder, final int position) { if (mData == null) { return; } if (holder.getItemViewType() == IS_NORMAL) { if (mData.get(position - 1).getImages() != null && mData.get(position - 1).getImages().size() > 0) { holder.itemIv.setVisibility(View.VISIBLE); Glide.with(mContext).load(mData.get(position - 1).getImages().get(0)) .placeholder(R.drawable.loading).error(R.drawable.error).into(holder.itemIv); holder.itemTv.setText(mData.get(position - 1).getTitle()); } else { holder.itemIv.setVisibility(View.GONE); holder.itemTv.setText(mData.get(position - 1).getTitle()); } holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mOnItemClickListener.OnItemClick(v, mData.get(position - 1)); } }); } if (holder.getItemViewType() == IS_HEADER) { if (!TextUtils.isEmpty(mImageUrl)) { Glide.with(mContext.getApplicationContext()).load(mImageUrl).into(holder.headerIv); } holder.headerTv.setText(mTitle); } } @Override public int getItemCount() { if (mData != null) { return mData.size() + 1; } return 1; } @Override public int getItemViewType(int position) { return position == 0 ? IS_HEADER : IS_NORMAL; } }
[ "719584671@qq.com" ]
719584671@qq.com
8bec25e988079ad10e5cab9b8894a5ddcc413c73
97fc880efc8bd72befb73cbe66866c4d12bf09ab
/src/com/exacttarget/wsdl/partnerapi/impl/UpdateResultImpl.java
9763113675c9cdcc05d845ae9688261113c1b53b
[]
no_license
tomkjkim/exacttarget-soap-java
0a682e89e6129d523374ff30e925b1679c4f6dbb
e8796228560577a02bb3abb5ab16411d87bf7aac
refs/heads/master
2021-01-15T11:42:57.934717
2015-09-23T07:30:21
2015-09-23T07:30:21
38,222,665
0
0
null
2015-06-29T02:05:08
2015-06-29T02:05:07
null
UTF-8
Java
false
false
9,070
java
/* * XML Type: UpdateResult * Namespace: http://exacttarget.com/wsdl/partnerAPI * Java type: com.exacttarget.wsdl.partnerapi.UpdateResult * * Automatically generated - do not modify. */ package com.exacttarget.wsdl.partnerapi.impl; /** * An XML UpdateResult(@http://exacttarget.com/wsdl/partnerAPI). * * This is a complex type. */ public class UpdateResultImpl extends com.exacttarget.wsdl.partnerapi.impl.ResultImpl implements com.exacttarget.wsdl.partnerapi.UpdateResult { public UpdateResultImpl(org.apache.xmlbeans.SchemaType sType) { super(sType); } private static final javax.xml.namespace.QName OBJECT$0 = new javax.xml.namespace.QName("http://exacttarget.com/wsdl/partnerAPI", "Object"); private static final javax.xml.namespace.QName UPDATERESULTS$2 = new javax.xml.namespace.QName("http://exacttarget.com/wsdl/partnerAPI", "UpdateResults"); private static final javax.xml.namespace.QName PARENTPROPERTYNAME$4 = new javax.xml.namespace.QName("http://exacttarget.com/wsdl/partnerAPI", "ParentPropertyName"); /** * Gets the "Object" element */ public com.exacttarget.wsdl.partnerapi.APIObject getObject() { synchronized (monitor()) { check_orphaned(); com.exacttarget.wsdl.partnerapi.APIObject target = null; target = (com.exacttarget.wsdl.partnerapi.APIObject)get_store().find_element_user(OBJECT$0, 0); if (target == null) { return null; } return target; } } /** * Sets the "Object" element */ public void setObject(com.exacttarget.wsdl.partnerapi.APIObject object) { synchronized (monitor()) { check_orphaned(); com.exacttarget.wsdl.partnerapi.APIObject target = null; target = (com.exacttarget.wsdl.partnerapi.APIObject)get_store().find_element_user(OBJECT$0, 0); if (target == null) { target = (com.exacttarget.wsdl.partnerapi.APIObject)get_store().add_element_user(OBJECT$0); } target.set(object); } } /** * Appends and returns a new empty "Object" element */ public com.exacttarget.wsdl.partnerapi.APIObject addNewObject() { synchronized (monitor()) { check_orphaned(); com.exacttarget.wsdl.partnerapi.APIObject target = null; target = (com.exacttarget.wsdl.partnerapi.APIObject)get_store().add_element_user(OBJECT$0); return target; } } /** * Gets array of all "UpdateResults" elements */ public com.exacttarget.wsdl.partnerapi.UpdateResult[] getUpdateResultsArray() { synchronized (monitor()) { check_orphaned(); java.util.List targetList = new java.util.ArrayList(); get_store().find_all_element_users(UPDATERESULTS$2, targetList); com.exacttarget.wsdl.partnerapi.UpdateResult[] result = new com.exacttarget.wsdl.partnerapi.UpdateResult[targetList.size()]; targetList.toArray(result); return result; } } /** * Gets ith "UpdateResults" element */ public com.exacttarget.wsdl.partnerapi.UpdateResult getUpdateResultsArray(int i) { synchronized (monitor()) { check_orphaned(); com.exacttarget.wsdl.partnerapi.UpdateResult target = null; target = (com.exacttarget.wsdl.partnerapi.UpdateResult)get_store().find_element_user(UPDATERESULTS$2, i); if (target == null) { throw new IndexOutOfBoundsException(); } return target; } } /** * Returns number of "UpdateResults" element */ public int sizeOfUpdateResultsArray() { synchronized (monitor()) { check_orphaned(); return get_store().count_elements(UPDATERESULTS$2); } } /** * Sets array of all "UpdateResults" element */ public void setUpdateResultsArray(com.exacttarget.wsdl.partnerapi.UpdateResult[] updateResultsArray) { synchronized (monitor()) { check_orphaned(); arraySetterHelper(updateResultsArray, UPDATERESULTS$2); } } /** * Sets ith "UpdateResults" element */ public void setUpdateResultsArray(int i, com.exacttarget.wsdl.partnerapi.UpdateResult updateResults) { synchronized (monitor()) { check_orphaned(); com.exacttarget.wsdl.partnerapi.UpdateResult target = null; target = (com.exacttarget.wsdl.partnerapi.UpdateResult)get_store().find_element_user(UPDATERESULTS$2, i); if (target == null) { throw new IndexOutOfBoundsException(); } target.set(updateResults); } } /** * Inserts and returns a new empty value (as xml) as the ith "UpdateResults" element */ public com.exacttarget.wsdl.partnerapi.UpdateResult insertNewUpdateResults(int i) { synchronized (monitor()) { check_orphaned(); com.exacttarget.wsdl.partnerapi.UpdateResult target = null; target = (com.exacttarget.wsdl.partnerapi.UpdateResult)get_store().insert_element_user(UPDATERESULTS$2, i); return target; } } /** * Appends and returns a new empty value (as xml) as the last "UpdateResults" element */ public com.exacttarget.wsdl.partnerapi.UpdateResult addNewUpdateResults() { synchronized (monitor()) { check_orphaned(); com.exacttarget.wsdl.partnerapi.UpdateResult target = null; target = (com.exacttarget.wsdl.partnerapi.UpdateResult)get_store().add_element_user(UPDATERESULTS$2); return target; } } /** * Removes the ith "UpdateResults" element */ public void removeUpdateResults(int i) { synchronized (monitor()) { check_orphaned(); get_store().remove_element(UPDATERESULTS$2, i); } } /** * Gets the "ParentPropertyName" element */ public java.lang.String getParentPropertyName() { synchronized (monitor()) { check_orphaned(); org.apache.xmlbeans.SimpleValue target = null; target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(PARENTPROPERTYNAME$4, 0); if (target == null) { return null; } return target.getStringValue(); } } /** * Gets (as xml) the "ParentPropertyName" element */ public org.apache.xmlbeans.XmlString xgetParentPropertyName() { synchronized (monitor()) { check_orphaned(); org.apache.xmlbeans.XmlString target = null; target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(PARENTPROPERTYNAME$4, 0); return target; } } /** * True if has "ParentPropertyName" element */ public boolean isSetParentPropertyName() { synchronized (monitor()) { check_orphaned(); return get_store().count_elements(PARENTPROPERTYNAME$4) != 0; } } /** * Sets the "ParentPropertyName" element */ public void setParentPropertyName(java.lang.String parentPropertyName) { synchronized (monitor()) { check_orphaned(); org.apache.xmlbeans.SimpleValue target = null; target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(PARENTPROPERTYNAME$4, 0); if (target == null) { target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(PARENTPROPERTYNAME$4); } target.setStringValue(parentPropertyName); } } /** * Sets (as xml) the "ParentPropertyName" element */ public void xsetParentPropertyName(org.apache.xmlbeans.XmlString parentPropertyName) { synchronized (monitor()) { check_orphaned(); org.apache.xmlbeans.XmlString target = null; target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(PARENTPROPERTYNAME$4, 0); if (target == null) { target = (org.apache.xmlbeans.XmlString)get_store().add_element_user(PARENTPROPERTYNAME$4); } target.set(parentPropertyName); } } /** * Unsets the "ParentPropertyName" element */ public void unsetParentPropertyName() { synchronized (monitor()) { check_orphaned(); get_store().remove_element(PARENTPROPERTYNAME$4, 0); } } }
[ "michaelallenclark@gmail.com" ]
michaelallenclark@gmail.com
f7e3bb2486cccc039e76ba8c20ae0b024825b25c
7ea94f78543379f5b3d9f3cbc45f74735be7afe8
/src/main/java/portal/service/impl/DataRequestLogServiceImpl.java
31c5bda08e271676f303964d34db5f845a965f5d
[]
no_license
fkapetanovic/tsosm
3030c3daedb5a0f3ff78fd35d8f05a1207a03baa
5266207a8dd3331547bb98fd65d29f056159a997
refs/heads/master
2021-01-12T01:48:54.155958
2017-01-09T14:13:02
2017-01-09T14:13:02
78,434,191
0
0
null
null
null
null
UTF-8
Java
false
false
1,782
java
package portal.service.impl; import java.util.Collection; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import portal.domain.impl.DataRequestLog; import portal.domain.impl.Tag; import portal.domain.impl.WebItemType; import portal.repository.DataRequestLogDAO; import portal.security.context.SecurityContextFacade; import portal.service.DataRequestLogService; import portal.web.context.RequestContextFacade; @Service @Transactional(rollbackFor = Exception.class) public class DataRequestLogServiceImpl implements DataRequestLogService{ @Autowired private DataRequestLogDAO dataRequestLogDao; @Autowired private SecurityContextFacade securityContextFacade; @Autowired @Qualifier("requestContext") private RequestContextFacade requestContext; @Override public DataRequestLog insertDataRequestLog(DataRequestLog dataRequestLog) { return dataRequestLogDao.insertEntity(dataRequestLog); } @Override public Collection<DataRequestLog> getDataRequestLogs(int entitiesReturnedLimit) { return dataRequestLogDao.getDataRequestLogs(entitiesReturnedLimit); } @Override public DataRequestLog insertDataRequestLog(Collection<Tag> tags, Collection<WebItemType> webItemTypes) { DataRequestLog dataRequestLog = new DataRequestLog(); dataRequestLog.setRequestedTags(tags); dataRequestLog.setRequestedWebItemTypes(webItemTypes); dataRequestLog.setCreatedBy(securityContextFacade.getLoggedInUser()); dataRequestLog.setIpAddress(requestContext.ipAddress()); return this.insertDataRequestLog(dataRequestLog); } }
[ "kapetanovic.faruk@gmail.com" ]
kapetanovic.faruk@gmail.com
d66d76d9c8da93a9813fef23a9efecbd8bfc5a5c
bb84be43a73705c285b49b31e4fe0dd7c121ce27
/Problema4/src/problema4/Problema4.java
289467d11b0cc09b6e4570d3256d99c375469c72
[]
no_license
concpetosfundamentalesprogramacionaa19/laboratorio1-bimestre1-fjsaca2001
accd2f83efea3a2001ccdcea746e6d716408056b
06d3448a632a1432ded22e2b62bbeaae308c5924
refs/heads/master
2020-05-15T06:05:20.327802
2019-04-18T18:19:21
2019-04-18T18:19:21
182,117,010
0
0
null
null
null
null
UTF-8
Java
false
false
422
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 problema4; /** * * @author DELL */ public class Problema4 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here } }
[ "sacafrank2@gmail.com" ]
sacafrank2@gmail.com
41a6ef1189f28978736b26c88e9fdcba06ee6769
40d844c1c780cf3618979626282cf59be833907f
/src/testcases/CWE369_Divide_by_Zero/s02/CWE369_Divide_by_Zero__int_File_modulo_14.java
6c85bc722f2e77c7e15c3b3ba9a34579dd95cc90
[]
no_license
rubengomez97/juliet
f9566de7be198921113658f904b521b6bca4d262
13debb7a1cc801977b9371b8cc1a313cd1de3a0e
refs/heads/master
2023-06-02T00:37:24.532638
2021-06-23T17:22:22
2021-06-23T17:22:22
379,676,259
1
0
null
null
null
null
UTF-8
Java
false
false
14,682
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE369_Divide_by_Zero__int_File_modulo_14.java Label Definition File: CWE369_Divide_by_Zero__int.label.xml Template File: sources-sinks-14.tmpl.java */ /* * @description * CWE: 369 Divide by zero * BadSource: File Read data from file (named c:\data.txt) * GoodSource: A hardcoded non-zero, non-min, non-max, even number * Sinks: modulo * GoodSink: Check for zero before modulo * BadSink : Modulo by a value that may be zero * Flow Variant: 14 Control flow: if(IO.staticFive==5) and if(IO.staticFive!=5) * * */ package testcases.CWE369_Divide_by_Zero.s02; import testcasesupport.*; import javax.servlet.http.*; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.FileInputStream; import java.io.File; import java.io.IOException; import java.util.logging.Level; public class CWE369_Divide_by_Zero__int_File_modulo_14 extends AbstractTestCase { public void bad() throws Throwable { int data; if (IO.staticFive==5) { data = Integer.MIN_VALUE; /* Initialize data */ { File file = new File("C:\\data.txt"); FileInputStream streamFileInput = null; InputStreamReader readerInputStream = null; BufferedReader readerBuffered = null; try { /* read string from file into data */ streamFileInput = new FileInputStream(file); readerInputStream = new InputStreamReader(streamFileInput, "UTF-8"); readerBuffered = new BufferedReader(readerInputStream); /* POTENTIAL FLAW: Read data from a file */ /* This will be reading the first "line" of the file, which * could be very long if there are little or no newlines in the file */ String stringNumber = readerBuffered.readLine(); if (stringNumber != null) /* avoid NPD incidental warnings */ { try { data = Integer.parseInt(stringNumber.trim()); } catch(NumberFormatException exceptNumberFormat) { IO.logger.log(Level.WARNING, "Number format exception parsing data from string", exceptNumberFormat); } } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error with stream reading", exceptIO); } finally { /* Close stream reading objects */ try { if (readerBuffered != null) { readerBuffered.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing BufferedReader", exceptIO); } try { if (readerInputStream != null) { readerInputStream.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing InputStreamReader", exceptIO); } try { if (streamFileInput != null) { streamFileInput.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing FileInputStream", exceptIO); } } } } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = 0; } if (IO.staticFive==5) { /* POTENTIAL FLAW: Zero modulus will cause an issue. An integer division will result in an exception. */ IO.writeLine("100%" + data + " = " + (100 % data) + "\n"); } } /* goodG2B1() - use goodsource and badsink by changing first IO.staticFive==5 to IO.staticFive!=5 */ private void goodG2B1() throws Throwable { int data; if (IO.staticFive!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = 0; } else { /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */ data = 2; } if (IO.staticFive==5) { /* POTENTIAL FLAW: Zero modulus will cause an issue. An integer division will result in an exception. */ IO.writeLine("100%" + data + " = " + (100 % data) + "\n"); } } /* goodG2B2() - use goodsource and badsink by reversing statements in first if */ private void goodG2B2() throws Throwable { int data; if (IO.staticFive==5) { /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */ data = 2; } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = 0; } if (IO.staticFive==5) { /* POTENTIAL FLAW: Zero modulus will cause an issue. An integer division will result in an exception. */ IO.writeLine("100%" + data + " = " + (100 % data) + "\n"); } } /* goodB2G1() - use badsource and goodsink by changing second IO.staticFive==5 to IO.staticFive!=5 */ private void goodB2G1() throws Throwable { int data; if (IO.staticFive==5) { data = Integer.MIN_VALUE; /* Initialize data */ { File file = new File("C:\\data.txt"); FileInputStream streamFileInput = null; InputStreamReader readerInputStream = null; BufferedReader readerBuffered = null; try { /* read string from file into data */ streamFileInput = new FileInputStream(file); readerInputStream = new InputStreamReader(streamFileInput, "UTF-8"); readerBuffered = new BufferedReader(readerInputStream); /* POTENTIAL FLAW: Read data from a file */ /* This will be reading the first "line" of the file, which * could be very long if there are little or no newlines in the file */ String stringNumber = readerBuffered.readLine(); if (stringNumber != null) /* avoid NPD incidental warnings */ { try { data = Integer.parseInt(stringNumber.trim()); } catch(NumberFormatException exceptNumberFormat) { IO.logger.log(Level.WARNING, "Number format exception parsing data from string", exceptNumberFormat); } } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error with stream reading", exceptIO); } finally { /* Close stream reading objects */ try { if (readerBuffered != null) { readerBuffered.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing BufferedReader", exceptIO); } try { if (readerInputStream != null) { readerInputStream.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing InputStreamReader", exceptIO); } try { if (streamFileInput != null) { streamFileInput.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing FileInputStream", exceptIO); } } } } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = 0; } if (IO.staticFive!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ IO.writeLine("Benign, fixed string"); } else { /* FIX: test for a zero modulus */ if (data != 0) { IO.writeLine("100%" + data + " = " + (100 % data) + "\n"); } else { IO.writeLine("This would result in a modulo by zero"); } } } /* goodB2G2() - use badsource and goodsink by reversing statements in second if */ private void goodB2G2() throws Throwable { int data; if (IO.staticFive==5) { data = Integer.MIN_VALUE; /* Initialize data */ { File file = new File("C:\\data.txt"); FileInputStream streamFileInput = null; InputStreamReader readerInputStream = null; BufferedReader readerBuffered = null; try { /* read string from file into data */ streamFileInput = new FileInputStream(file); readerInputStream = new InputStreamReader(streamFileInput, "UTF-8"); readerBuffered = new BufferedReader(readerInputStream); /* POTENTIAL FLAW: Read data from a file */ /* This will be reading the first "line" of the file, which * could be very long if there are little or no newlines in the file */ String stringNumber = readerBuffered.readLine(); if (stringNumber != null) /* avoid NPD incidental warnings */ { try { data = Integer.parseInt(stringNumber.trim()); } catch(NumberFormatException exceptNumberFormat) { IO.logger.log(Level.WARNING, "Number format exception parsing data from string", exceptNumberFormat); } } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error with stream reading", exceptIO); } finally { /* Close stream reading objects */ try { if (readerBuffered != null) { readerBuffered.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing BufferedReader", exceptIO); } try { if (readerInputStream != null) { readerInputStream.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing InputStreamReader", exceptIO); } try { if (streamFileInput != null) { streamFileInput.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing FileInputStream", exceptIO); } } } } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = 0; } if (IO.staticFive==5) { /* FIX: test for a zero modulus */ if (data != 0) { IO.writeLine("100%" + data + " = " + (100 % data) + "\n"); } else { IO.writeLine("This would result in a modulo by zero"); } } } public void good() throws Throwable { goodG2B1(); goodG2B2(); goodB2G1(); goodB2G2(); } /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException { mainFromParent(args); } }
[ "you@example.com" ]
you@example.com
70dea3b350b2102351bf3d06ea2368b2eb2d0bbd
aae43633563add607fe464bfc505d47ea2e6225a
/app/src/main/java/unity/com/unityapp/unity/com/unityapp/base/view/RecentProfileView.java
cc65f189a9a55952b18559bd647fcc338612f0cc
[]
no_license
sanket203/unity_droid
da5a8324603e1c9bc6679012266a16a7cb95c7d9
909435ef86c4b0a0dd7925bc3b214285610fcbd5
refs/heads/master
2020-04-10T17:02:35.788266
2019-03-31T12:58:41
2019-03-31T12:58:41
161,163,472
0
0
null
null
null
null
UTF-8
Java
false
false
419
java
package unity.com.unityapp.unity.com.unityapp.base.view; import unity.com.unityapp.unity.com.unityapp.base.BaseView; import unity.com.unityapp.unity.com.unityapp.base.view.model.RecentProfileResponseViewModel; /** * Created by admin on 11/12/18. */ public interface RecentProfileView extends BaseView { void showRecentProfiles(RecentProfileResponseViewModel viewModel); void showError(String message); }
[ "sanket.kasrekar@nihilent.com" ]
sanket.kasrekar@nihilent.com
b7eddf54191cb1e06457fc357da4263f17be633a
f2246b944f87879c57fa13fc61ab9d9420e6c6fd
/src/edu/berkeley/nlp/assignments/parsing/parser/lexparser/IntTaggedWord.java
03fad757dde31420aa6e2dd487a861fc691d7022
[]
no_license
KunlinY/CSE291-NLP-AS3
c1e2ce57cd22d62a6c40436507952a3bfc994199
224da983fca885cd46122ff62b8f11df568a1a36
refs/heads/master
2022-11-04T02:01:04.472124
2020-06-14T01:17:57
2020-06-14T01:17:57
268,222,502
0
0
null
null
null
null
UTF-8
Java
false
false
5,097
java
package edu.berkeley.nlp.assignments.parsing.parser.lexparser; import edu.berkeley.nlp.assignments.parsing.ling.TaggedWord; import edu.berkeley.nlp.assignments.parsing.util.Index; import java.io.Serializable; /** Represents a WordTag (in the sense that equality is defined * on both components), where each half is represented by an * int indexed by a Index. In this representation, -1 is * used to represent the wildcard ANY value, and -2 is used * to represent a STOP value (i.e., no more dependents). * * TODO: does that cause any problems regarding unseen words also being -1? * TODO: any way to not have links to the Index in each object? * * @author Dan Klein * @author Christopher Manning */ public class IntTaggedWord implements Serializable, Comparable<IntTaggedWord> { public static final int ANY_WORD_INT = -1; public static final int ANY_TAG_INT = -1; public static final int STOP_WORD_INT = -2; public static final int STOP_TAG_INT = -2; public static final String ANY = ".*."; public static final String STOP = "STOP"; public final int word; public final short tag; public int tag() { return tag; } public int word() { return word; } public String wordString(Index<String> wordIndex) { String wordStr; if (word >= 0) { wordStr = wordIndex.get(word); } else if (word == ANY_WORD_INT) { wordStr = ANY; } else { wordStr = STOP; } return wordStr; } public String tagString(Index<String> tagIndex) { String tagStr; if (tag >= 0) { tagStr = tagIndex.get(tag); } else if (tag == ANY_TAG_INT) { tagStr = ANY; } else { tagStr = STOP; } return tagStr; } @Override public int hashCode() { return word ^ (tag << 16); } @Override public boolean equals(Object o) { if (this == o) { return true; } else if (o instanceof IntTaggedWord) { IntTaggedWord i = (IntTaggedWord) o; return (word == i.word && tag == i.tag); } else { return false; } } public int compareTo(IntTaggedWord that) { if (tag != that.tag) { return tag - that.tag; } else { return word - that.word; } } private static final char[] charsToEscape = { '\"' }; public String toLexicalEntry(Index<String> wordIndex, Index<String> tagIndex) { return ""; } @Override public String toString() { return word + "/" + tag; } public String toString(Index<String> wordIndex, Index<String> tagIndex) { return wordString(wordIndex)+ '/' +tagString(tagIndex); } public String toString(String arg, Index<String> wordIndex, Index<String> tagIndex) { if (arg.equals("verbose")) { return (wordString(wordIndex) + '[' + word + "]/" + tagString(tagIndex) + '[' + tag + ']'); } else { return toString(wordIndex, tagIndex); } } public IntTaggedWord(int word, int tag) { this.word = word; this.tag = (short) tag; } public TaggedWord toTaggedWord(Index<String> wordIndex, Index<String> tagIndex) { String wordStr = wordString(wordIndex); String tagStr = tagString(tagIndex); return new TaggedWord(wordStr, tagStr); } /** * Creates an IntTaggedWord given by the String representation * of the form &lt;word&gt;|&lt;tag*gt; */ public IntTaggedWord(String s, char splitChar, Index<String> wordIndex, Index<String> tagIndex) { // awkward, calls s.indexOf(splitChar) twice this(extractWord(s, splitChar), extractTag(s, splitChar), wordIndex, tagIndex); // System.out.println("s: " + s); // System.out.println("tagIndex: " + tagIndex); // System.out.println("word: " + word); // System.out.println("tag: " + tag); } private static String extractWord(String s, char splitChar) { int n = s.lastIndexOf(splitChar); String result = s.substring(0, n); // System.out.println("extracted word: " + result); return result; } private static String extractTag(String s, char splitChar) { int n = s.lastIndexOf(splitChar); String result = s.substring(n + 1); // System.out.println("extracted tag: " + result); return result; } /** * Creates an IntTaggedWord given by the tagString and wordString */ public IntTaggedWord(String wordString, String tagString, Index<String> wordIndex, Index<String> tagIndex) { switch (wordString) { case ANY: word = ANY_WORD_INT; break; case STOP: word = STOP_WORD_INT; break; default: word = wordIndex.addToIndex(wordString); break; } switch (tagString) { case ANY: tag = (short) ANY_TAG_INT; break; case STOP: tag = (short) STOP_TAG_INT; break; default: tag = (short) tagIndex.addToIndex(tagString); break; } } private static final long serialVersionUID = 1L; } // end class IntTaggedWord
[ "kunliny@qq.com" ]
kunliny@qq.com
c7f20f72e0e15dd9cb1d3392ce07802c330c0bb0
670da1ba25c83a8cb11b554416650f05f0a1a835
/app/src/main/java/com/example/kuybeer26092016/lionmonitoringdemo/adapters/AdapterMonitorItem.java
9546f29e89735f76224cbcf46315bbb586c962fc
[]
no_license
13dec2537/LionMonitoringDemo
67f0a22a31cd65c454007c98d5219738da67142f
997fe5d2a0dbae40df03c318995143147f1423dd
refs/heads/master
2021-01-12T15:59:02.052510
2016-11-02T12:13:09
2016-11-02T12:13:09
69,327,103
0
0
null
null
null
null
UTF-8
Java
false
false
15,041
java
package com.example.kuybeer26092016.lionmonitoringdemo.adapters; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Color; import android.graphics.Typeface; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.example.kuybeer26092016.lionmonitoringdemo.R; import com.example.kuybeer26092016.lionmonitoringdemo.activitys.DescripActivity; import com.example.kuybeer26092016.lionmonitoringdemo.activitys.UploadImageActivity; import com.example.kuybeer26092016.lionmonitoringdemo.models.Mis_monitoringitem; import com.squareup.picasso.MemoryPolicy; import com.squareup.picasso.NetworkPolicy; import com.squareup.picasso.Picasso; import java.util.ArrayList; import java.util.List; /** * Created by KuyBeer26092016 on 27/9/2559. */ public class AdapterMonitorItem extends RecyclerView.Adapter<AdapterMonitorItem.ViewHolder>{ private static final String IMAGEURL = "http://www.thaidate4u.com/service/json/img/"; private final String ADMIN = "ADMIN"; private List<Mis_monitoringitem> mList = new ArrayList<>(); private String act,min,max,status; private SharedPreferences sp,sp_uploadimg; private SharedPreferences.Editor editor,editor_uploadimg; private Context context; private Boolean ReloadImage = true; private int sizeimg = 0; private int lastPosition = -1; private Boolean mIcon_status = true; LayoutInflater layoutInflater; private Animation mAnimation; public AdapterMonitorItem(Context context) { this.mList = mList; this.context = context; } @Override public AdapterMonitorItem.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View viewrow = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_monitoritem,parent,false); context = parent.getContext(); return new ViewHolder(viewrow); } @Override public void onBindViewHolder(final AdapterMonitorItem.ViewHolder holder, int position) { final Mis_monitoringitem setList = mList.get(position); MyCustomFonts(holder.mAct_1,holder.mAct_2,holder.mAct_3,holder.mAct_4); MyCustomAnimation(holder.mAct_1,holder.mAct_2,holder.mAct_3,holder.mAct_4); sp = context.getSharedPreferences("DataAccount",Context.MODE_PRIVATE); editor = sp.edit(); sp_uploadimg = context.getSharedPreferences("img",Context.MODE_PRIVATE); editor_uploadimg = sp_uploadimg.edit(); holder.mMc_name.setText(setList.getMc_name()); holder.mAct_1.setText(setList.getMo_act().getAct_1()); holder.mAct_2.setText(setList.getMo_act().getAct_2()); holder.mAct_3.setText(setList.getMo_act().getAct_3()); holder.mAct_4.setText(setList.getMo_act().getAct_4()); ReloadImage = sp_uploadimg.getBoolean("img_reload",true); if(sizeimg<mList.size() && ReloadImage == true){ Picasso.with(context) .load(IMAGEURL + setList.getMc_id() + ".jpg") .memoryPolicy(MemoryPolicy.NO_CACHE) .networkPolicy(NetworkPolicy.NO_CACHE) .resize(128, 128) .centerCrop() .placeholder(R.drawable.progress_aniloadimg) .error(R.drawable.ic_me) .noFade() .into(holder.mImvMachine); sizeimg++; // Animation_List(position,holder); if(sizeimg==mList.size()){ editor_uploadimg.putBoolean("img_reload",false); editor_uploadimg.commit(); editor.putBoolean("RunAnim",false); sizeimg = 0; } } else if(sizeimg<mList.size() && ReloadImage == false){ Picasso.with(context) .load(IMAGEURL + setList.getMc_id() + ".jpg") .resize(128, 128) .centerCrop() .into(holder.mImvMachine); } holder.mImvMachine.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(sp.getString("Userdivision","No Information").equals(ADMIN)){ Intent i = new Intent(context.getApplicationContext(), UploadImageActivity.class); i.putExtra("I_URL_IMAGE" , IMAGEURL + setList.getMc_id() + ".jpg"); i.putExtra("ID_IMAGE",setList.getMc_id()); context.startActivity(i); } } }); holder.mlinearOnclick.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(v.getContext(),DescripActivity.class); i.putExtra("Ianim","1"); i.putExtra("mc_id",setList.getMc_id()); i.putExtra("mc_name",setList.getMc_name()); editor.putString("division",setList.getMc_division()); editor.putBoolean("Runanim",true); editor.commit(); v.getContext().startActivity(i); ((Activity)context).finish(); } }); if(holder.mAct_1.getText().equals("") || holder.mAct_1.getText().equals(null)){ holder.mLinearAll_txt_1.setVisibility(View.GONE); } if(holder.mAct_2.getText().equals("") || holder.mAct_2.getText().equals(null)){ holder.mLinearAll_txt_2.setVisibility(View.GONE); } if(holder.mAct_3.getText().equals("") || holder.mAct_3.getText().equals(null)){ holder.mLinearAll_txt_3.setVisibility(View.GONE); } if(holder.mAct_4.getText().equals("") || holder.mAct_4.getText().equals(null)){ holder.mLinearAll_txt_4.setVisibility(View.GONE); } if(holder.mAct_1.getText().length()>0){ holder.mLinearAll_txt_1.setVisibility(View.VISIBLE); act = String.valueOf(setList.getMo_act().getAct_1()); min = String.valueOf(setList.getMo_min().getMin_1()); max = String.valueOf(setList.getMo_max().getMax_1()); status = String.valueOf(setList.getMo_status().getStatus_1()); setColorView(status,holder.mAct_1,act,min,max,holder.Icon); } if(holder.mAct_2.getText().length()>0){ holder.mLinearAll_txt_2.setVisibility(View.VISIBLE); act = String.valueOf(setList.getMo_act().getAct_2()); min = String.valueOf(setList.getMo_min().getMin_2()); max = String.valueOf(setList.getMo_max().getMax_2()); status = String.valueOf(setList.getMo_status().getStatus_2()); setColorView(status,holder.mAct_2,act,min,max,holder.Icon); } if(holder.mAct_3.getText().length()>0){ holder.mLinearAll_txt_3.setVisibility(View.VISIBLE); act = String.valueOf(setList.getMo_act().getAct_3()); min = String.valueOf(setList.getMo_min().getMin_3()); max = String.valueOf(setList.getMo_max().getMax_3()); status = String.valueOf(setList.getMo_status().getStatus_3()); setColorView(status,holder.mAct_3,act,min,max,holder.Icon); } if(holder.mAct_4.getText().length()>0){ holder.mLinearAll_txt_4.setVisibility(View.VISIBLE); act = String.valueOf(setList.getMo_act().getAct_4()); min = String.valueOf(setList.getMo_min().getMin_4()); max = String.valueOf(setList.getMo_max().getMax_4()); status = String.valueOf(setList.getMo_status().getStatus_4()); setColorView(status,holder.mAct_4,act,min,max,holder.Icon); } setViewIcon(holder.Icon,holder.mAct_1,holder.mAct_2,holder.mAct_3,holder.mAct_4); mIcon_status = true; holder.mPram_1.setText(setList.getMo_pram().getPram_1()); holder.mPram_2.setText(setList.getMo_pram().getPram_2()); holder.mPram_3.setText(setList.getMo_pram().getPram_3()); holder.mPram_4.setText(setList.getMo_pram().getPram_4()); holder.mUnit_1.setText(setList.getMo_unit().getUnit_1()); holder.mUnit_2.setText(setList.getMo_unit().getUnit_2()); holder.mUnit_3.setText(setList.getMo_unit().getUnit_3()); holder.mUnit_4.setText(setList.getMo_unit().getUnit_4()); if(position > lastPosition) { Animation animation = AnimationUtils.loadAnimation(context, R.anim.up_from_bottom); holder.itemView.startAnimation(animation); lastPosition = position; } } private void setColorView(String status, TextView mAct, String act, String min, String max,ImageView icon) { if(status.equals("1")){ mAct.setTextColor(Color.parseColor(setColor(act,min,max))); Double act_int = Double.valueOf(act); Double min_int = Double.valueOf(min); Double max_int = Double.valueOf(max); if(act_int == 0 && min_int == 0 && max_int == 0){ icon.setImageResource(R.drawable.shape_round_disble); } else if(act_int<min_int || act_int> max_int){ icon.setImageResource(R.drawable.shape_round_ofline); mIcon_status = false; } else if(mIcon_status == true){ icon.setImageResource(R.drawable.shape_round_online); } Log.d("C",String.valueOf(mIcon_status)); }else{ mAct.setText("-"); mAct.setTextColor(Color.parseColor(setColor("0","0","0"))); icon.setImageResource(R.drawable.shape_round_disble); } } private void MyCustomAnimation(TextView mAct_1, TextView mAct_2, TextView mAct_3, TextView mAct_4) { mAnimation = AnimationUtils.loadAnimation(context, R.anim.fade_in); mAct_1.setAnimation(mAnimation); mAct_2.setAnimation(mAnimation); mAct_3.setAnimation(mAnimation); mAct_4.setAnimation(mAnimation); } private void MyCustomFonts(TextView mAct_1, TextView mAct_2, TextView mAct_3, TextView mAct_4) { Typeface MyCustomFont = Typeface.createFromAsset(context.getAssets(),"fonts/DS-DIGIT.TTF"); mAct_1.setTypeface(MyCustomFont); mAct_2.setTypeface(MyCustomFont); mAct_3.setTypeface(MyCustomFont); mAct_4.setTypeface(MyCustomFont); } // private void Animation_List(Integer position, ViewHolder holder) { // // if(position > prevPosition){ // AnimationListitem.animate(holder , true); // Log.d("log","TRUE"); // }else{ // AnimationListitem.animate(holder , false); // Log.d("log","FALSE"); // } // prevPosition = position-1; // Log.d("log",String.valueOf(prevPosition + " | " + position)); // } @Override public int getItemCount() { return mList.size(); } public void addList(List<Mis_monitoringitem> list_monitoringitem) { mList.clear(); mList.addAll(list_monitoringitem); this.notifyDataSetChanged(); } static String setColor(String act, String min, String max){ Double act_int = Double.valueOf(act); Double min_int = Double.valueOf(min); Double max_int = Double.valueOf(max); String color = ""; if(act_int == 0 && min_int == 0 && max_int == 0){ color = "#BDBDBD"; } else if(act_int>=min_int && act_int<= max_int){ color = "#B2FF59"; } else{ color = "#F44336"; } return color; } public void setViewIcon(ImageView viewIcon, TextView mAct_1, TextView mAct_2, TextView mAct_3, TextView mAct_4) { if(String.valueOf(mAct_1.getTextColors().getDefaultColor()).equals("-2617068") || String.valueOf(mAct_2.getTextColors().getDefaultColor()).equals("-2617068") || String.valueOf(mAct_3.getTextColors().getDefaultColor()).equals("-2617068") || String.valueOf(mAct_4.getTextColors().getDefaultColor()).equals("-2617068")){ viewIcon.setImageResource(R.drawable.shape_round_ofline); } } public static class ViewHolder extends RecyclerView.ViewHolder { public TextView mMc_name,mAct_1,mAct_2,mAct_3,mAct_4; private TextView mUnit_1,mUnit_2,mUnit_3,mUnit_4; private TextView mPram_1,mPram_2,mPram_3,mPram_4; private ImageView mImvMachine,Icon; private LinearLayout mlinearOnclick,mLinearAll_txt_1,mLinearAll_txt_2,mLinearAll_txt_3,mLinearAll_txt_4; public ViewHolder(View itemView) { super(itemView); mImvMachine = (ImageView)itemView.findViewById(R.id.imvMachine); Icon = (ImageView)itemView.findViewById(R.id.shapeIconOnline); mMc_name = (TextView)itemView.findViewById(R.id.mc_name); mlinearOnclick = (LinearLayout)itemView.findViewById(R.id.Linearalltower2); mLinearAll_txt_1 = (LinearLayout)itemView.findViewById(R.id.LinearAll_txt_1); mLinearAll_txt_2 = (LinearLayout)itemView.findViewById(R.id.LinearAll_txt_2); mLinearAll_txt_3 = (LinearLayout)itemView.findViewById(R.id.LinearAll_txt_3); mLinearAll_txt_4 = (LinearLayout)itemView.findViewById(R.id.LinearAll_txt_4); mAct_1 = (TextView)itemView.findViewById(R.id.act_1); mAct_2 = (TextView)itemView.findViewById(R.id.act_2); mAct_3 = (TextView)itemView.findViewById(R.id.act_3); mAct_4 = (TextView)itemView.findViewById(R.id.act_4); mPram_1 = (TextView)itemView.findViewById(R.id.pram_1); mPram_2 = (TextView)itemView.findViewById(R.id.pram_2); mPram_3 = (TextView)itemView.findViewById(R.id.pram_3); mPram_4 = (TextView)itemView.findViewById(R.id.pram_4); mUnit_1 = (TextView)itemView.findViewById(R.id.unit_1); mUnit_2 = (TextView)itemView.findViewById(R.id.unit_2); mUnit_3 = (TextView)itemView.findViewById(R.id.unit_3); mUnit_4 = (TextView)itemView.findViewById(R.id.unit_4); } } }
[ "13dec2537@gmail.com" ]
13dec2537@gmail.com
557d8d9f31aeef600ae1b5ab63aa35c045d1a591
67803251fd48047ebb3aa77513a01e7d9cf3ba5f
/mama-buy-stock-service/src/main/java/com/njupt/swg/mamabuystockservice/stock/entity/Stock.java
12dc1ca80d667b05fcb1e34e12cc1a9457696863
[]
no_license
hai0378/mama-buy
8fdd57fad1925cb4e0a1a636f8151f75c5c2933f
2967898a1808fc9065cfd53a6b0d1ebbebe3a7f0
refs/heads/master
2020-04-14T17:26:53.175233
2018-12-30T08:48:00
2018-12-30T08:48:00
163,980,685
1
0
null
2019-01-03T14:05:01
2019-01-03T14:05:00
null
UTF-8
Java
false
false
298
java
package com.njupt.swg.mamabuystockservice.stock.entity; import lombok.Data; import java.util.Date; @Data public class Stock { private Long id; private Long skuId; private Integer stock; private Integer lockStock; private Date createTime; private Date updateTime; }
[ "317758022@qq.com" ]
317758022@qq.com
a690c2f586aef02c6fd5fd04f44964c79e136cda
da429eb9acf676d06942669bcc53d03ab5b961dd
/src/com/company/model/Bullet.java
f6b9c1449515e4bf7ace1ef9416e5f27263ae168
[]
no_license
SergiyBoyko/SpaceProject2
cb1e87c9bdfe9905601b62203580751506cb958b
1cf75476603bc4a7d273d8d3867fae9666668e9b
refs/heads/master
2021-01-16T18:49:14.568933
2019-04-05T18:59:25
2019-04-05T18:59:25
100,119,522
0
0
null
null
null
null
UTF-8
Java
false
false
196
java
package com.company.model; /** * Created by Serhii Boiko on 28.08.2017. */ public class Bullet extends BaseObject { public Bullet(double x, double y) { super(x, y, 0.1, 1); } }
[ "developer.sergiyboyko@gmail.com" ]
developer.sergiyboyko@gmail.com
8bb853cee6925c2b8dd57f436b556f18e5906461
7f00393a88276e86916b5bc8ecf4ce9262b4d23f
/javaparserModel/src/javaparsermodel/process/FileParser.java
68d71de53f504e0092423206ddeb2b5bcd0633f1
[]
no_license
Albertbmm/case-tool-for-detecting-source-code-incompatibility-with-sequence-diagrams
43b1283cd9bf9813132bb28150f973c189f5045f
43d28c489247bf2511283bde5e0ffb9d7dea4eb6
refs/heads/master
2020-03-19T11:10:01.588004
2018-06-07T07:19:35
2018-06-07T07:19:35
136,435,912
0
1
null
null
null
null
UTF-8
Java
false
false
18,129
java
package javaparserModel.process; import data.SequenceDiagram; import data.Triplet; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import javaparserModel.Account; import javaparsermodel.FragmentTemp; import javaparsermodel.Lifelinetemp; import javaparsermodel.message; import javaparsermodel.fragment; import javaparsermodel.triplet; import javaparsermodel.MessageTriplet; import javaparsermodel.OwnedAttributes; import javaparsermodel.PackagedElement; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; /** * BUTUH DI EDIT * @author USER */ public class FileParser extends DefaultHandler{ private Account acct; private message msgg; private String temp; private fragment fgmm; //private Lifelinetemp tempLifeline; private triplet triplet; private PackagedElement packageElement = new PackagedElement(); private OwnedAttributes ownedAttr = new OwnedAttributes(); FragmentTemp tempFragment = new FragmentTemp(); Lifelinetemp tempLifeline = new Lifelinetemp(); private MessageTriplet msgtriplet; private ArrayList<FragmentTemp> listFragmentTemp = new ArrayList<FragmentTemp>(); private ArrayList<Lifelinetemp> listLifelineTemp = new ArrayList<Lifelinetemp>(); private ArrayList<MessageTriplet> listmsgtriplet = new ArrayList<MessageTriplet>(); private ArrayList<Account> accList = new ArrayList<Account>(); private ArrayList<message> msg = new ArrayList<message>(); private ArrayList<fragment> fgm = new ArrayList<fragment>(); private ArrayList<triplet> trp = new ArrayList<triplet>(); private ArrayList<PackagedElement> pkgElement = new ArrayList<PackagedElement>(); private ArrayList<OwnedAttributes> owdElement = new ArrayList<OwnedAttributes>(); private ArrayList<triplet> tripletku; //untuk menyimpan actor private ArrayList<String> simpanActor = new ArrayList<String>(); private SequenceDiagram sequenceData = new SequenceDiagram(); //private ArrayList<triplet> trpSC = new ArrayList<triplet>(); private SAXParser sp; public static void main(String[] args) throws IOException, SAXException,ParserConfigurationException, org.xml.sax.SAXException { //Create an instance of this class; it defines all the handler methods FileParser fp = new FileParser(); fp.parseFile("src/xml/Untitled.xmi"); //fp.parseFile("src/xml/contoh1.xmi"); fp.creatinTriplet(); fp.getActor(); fp.readList(); } public FileParser() throws IOException, SAXException,ParserConfigurationException, org.xml.sax.SAXException { SAXParserFactory spfac = SAXParserFactory.newInstance(); sp = spfac.newSAXParser(); tripletku = new ArrayList<triplet>(); } public void parseFile(String filename) throws SAXException,IOException { //Finally, tell the parser to parse the input and notify the handler sp.parse(filename, this); } public void characters(char[] buffer, int start, int length) { temp = new String(buffer, start, length); } public void startElement(String uri, String localName,String qName, Attributes attributes) throws SAXException { temp = ""; if (qName.equalsIgnoreCase("lifeline")) { acct = new Account(); String packageName = attributes.getValue("name"); String packageType = attributes.getValue("xmi:type"); String PackageID = attributes.getValue("xmi:id"); String representId = attributes.getValue("represents"); acct.setRepresent(representId); acct.setType(packageType); acct.setName(packageName); acct.setId(PackageID); } else if (qName.equalsIgnoreCase("message")) { msgtriplet = new MessageTriplet(); String messageName = attributes.getValue("name"); String receiveEvent = attributes.getValue("receiveEvent"); String sendEvent = attributes.getValue("sendEvent"); msgtriplet.setMethod(messageName); msgtriplet.setIdMessage(receiveEvent); msgtriplet.setCoveredId(sendEvent); } else if (qName.equalsIgnoreCase("fragment")) { fgmm = new fragment(); String messageEvent = attributes.getValue("xmi:id"); String lifelineCovered = attributes.getValue("covered"); fgmm.setId(messageEvent); fgmm.setCovered(lifelineCovered); } else if(qName.equalsIgnoreCase("ownedAttribute")){ ownedAttr = new OwnedAttributes(); String xmIdOwned = attributes.getValue("xmi:id"); String idPackageOwned = attributes.getValue("type"); ownedAttr.setOwnedAttributes(xmIdOwned, idPackageOwned); } else if(qName.equalsIgnoreCase("packagedElement")){ //untuk mengambil daftar actor lalu masukkan ke fungsi get actor packageElement = new PackagedElement(); String idFragment = attributes.getValue("xmi:id"); String tipeUML = attributes.getValue("xmi:type"); String namaPackage = attributes.getValue("name"); packageElement.setPackagedElement(tipeUML,idFragment, namaPackage); } } public void endElement(String uri, String localName, String qName)throws SAXException { if (qName.equalsIgnoreCase("lifeline")) { // add it to the list accList.add(acct); } else if (qName.equalsIgnoreCase("message")) { // add it to the list listmsgtriplet.add(msgtriplet); msg.add(msgg); } else if (qName.equalsIgnoreCase("fragment")) { // add it to the list fgm.add(fgmm); } else if(qName.equalsIgnoreCase("ownedAttribute")){ owdElement.add(ownedAttr); } else if(qName.equalsIgnoreCase("packagedElement")){ pkgElement.add(packageElement); } } public void creatinTriplet(){ String Subyek; String predikat; String Obyek; int size = listmsgtriplet.size(); System.out.println(size); for(int i= 0;i<size;i++) { String isiObyek = listmsgtriplet.get(i).getIdMessage().toString(); //System.out.println(listmsgtriplet.get(i)); triplet tpl = new triplet(); tripletku.add(tpl); predikat = listmsgtriplet.get(i).getMethod().toString(); Subyek = getSubyek(listmsgtriplet.get(i).getCoveredId().toString()); Obyek = getObyek(isiObyek); //System.out.println(Subyek+" "+predikat+" "+Obyek); //masukkan ke arraylist triplet yang sudah ada di dalam kelas Triplet Triplet tripletData = new Triplet(Subyek,Obyek,predikat); sequenceData.insertTriplet(tripletData); tpl.setObyek(Obyek); tpl.setPredikat(predikat); tpl.setSubyek(Subyek); tripletku.add(tpl); } } public void setSequenceData(SequenceDiagram sequenceData){ this.sequenceData = sequenceData; } public SequenceDiagram getSequence(){ return this.sequenceData; } public ArrayList<String> getListActor(){ return this.simpanActor; } public void readList() throws IOException, SAXException, ParserConfigurationException { // ArrayList<Triplet> ada = new ArrayList<Triplet>(); // sequenceData.checkIsiTriplet(); // ada = sequenceData.getIsiTriplet(); // System.out.println("ini banyak triplet "+ada.size()); // System.out.println(); // sequenceData.checkIsiTriplet(); simpanActor.removeAll(Collections.singleton(null)); System.out.println(simpanActor.size()); for(int x=0;x<simpanActor.size();x++){ System.out.println(simpanActor.get(x)); } // disini keluar // ArrayList<Triplet> ada = new ArrayList<Triplet>(); // ada = sequenceData.getListTriplet(); // System.out.println(ada.size()); // System.out.println(); // for(int x=0;x<pkgElement.size();x++){ // System.out.println(pkgElement.get(x).toString()); // } // System.out.println(); // for(int x=0;x<owdElement.size();x++){ // System.out.println(owdElement.get(x).toString()); // } } private String getSubyek(String subyek) { int size = accList.size(); int sizefragment = fgm.size(); String idFragment; String coveredId; int sizeMessageTriplet = listmsgtriplet.size(); for(int y=0;y<sizeMessageTriplet;y++){ for(int x=0;x<sizefragment;x++){ idFragment = fgm.get(x).getId().toString(); coveredId = fgm.get(x).getCovered().toString(); tempFragment.setIdFragment(idFragment); tempFragment.setIdCovered(coveredId); listFragmentTemp.add(tempFragment); for(int i=0;i<size;i++){ String idLifeline = accList.get(i).getId().toString(); //String namaLifeline = accList.get(i).getName().toString(); String idRepresentLifeline = accList.get(i).getRepresent().toString(); tempLifeline.setId(idLifeline); tempLifeline.setRepresent(idRepresentLifeline); //tempLifeline.setName(namaLifeline); listLifelineTemp.add(tempLifeline); if(subyek.equals(listFragmentTemp.get(x).getIdFragment().toString())) { if(listFragmentTemp.get(x).getIdCovered().toString().equals(listLifelineTemp.get(i).getId().toString())) { //sudah dapat idCoveredFragment for(int j=0;j<owdElement.size();j++){ String idOwnedAttribute = owdElement.get(j).getIdOwnedAttributes(); if(idRepresentLifeline.equals(idOwnedAttribute)){ String idTypeOwdElement = owdElement.get(j).getIdTypePackageElement(); for(int h=0;h<pkgElement.size();h++){ String idPkgElement = pkgElement.get(h).getId(); if(idTypeOwdElement.equals(idPkgElement)){ subyek = pkgElement.get(h).getName(); } } } } } } } } } return subyek; } private String getObyek(String obyek) { int size = accList.size(); int sizefragment = fgm.size(); int sizeMessageTriplet = listmsgtriplet.size(); String idFragment; String coveredId; for(int x=0;x<sizeMessageTriplet;x++) { for(int y=0;y<sizefragment;y++){ idFragment = fgm.get(y).getId().toString(); coveredId = fgm.get(y).getCovered().toString(); tempFragment.setIdFragment(idFragment); tempFragment.setIdCovered(coveredId); listFragmentTemp.add(tempFragment); for(int i=0;i<size;i++){ String idLifeline = accList.get(i).getId().toString(); //String namaLifeline = accList.get(i).getName().toString(); //String idRepresentLifeline = accList.get(i).getRepresent().toString(); tempLifeline.setId(idLifeline); //tempLifeline.setName(namaLifeline); //tempLifeline.setRepresent(idRepresentLifeline); listLifelineTemp.add(tempLifeline); if(obyek.equals(listFragmentTemp.get(y).getIdFragment().toString())){ if(listFragmentTemp.get(y).getIdCovered().toString().equals(listLifelineTemp.get(i).getId().toString())){ //represent udah dapat langsung loop untuk yang di dalam owned attribut String idRepresentLifeline = accList.get(i).getRepresent().toString(); for(int j=0;j<owdElement.size();j++){ String idOwned = owdElement.get(j).getIdOwnedAttributes(); if(idRepresentLifeline.equals(idOwned)){ //mengambil id type String idTypeOwdElement = owdElement.get(j).getIdTypePackageElement(); //cocokkan id type dengan yang ada di package elemen for(int h=0;h<pkgElement.size();h++){ String idPackagedElement = pkgElement.get(h).getId(); if(idTypeOwdElement.equals(idPackagedElement)){ obyek = pkgElement.get(h).getName(); } } } } //obyek = listLifelineTemp.get(i).getName().toString(); } } } } } return obyek; } public void getActor() { //salah logic harusnya yang di cek itu UMLtype sama dengan actor kalo ada baru cari //fungsi untuk mencari aktor sudah selesai tinggal dimasukkan ke dalam arraylist, lalu fungsinya langsung di taruh disini saja //tidak usah memakai pemanggilan buildListActor String actor=""; //pkgElement = new ArrayList<PackagedElement>(); for(int x=0;x<pkgElement.size();x++){ String actorType = pkgElement.get(x).getType(); if(actorType.equalsIgnoreCase("uml:Actor")){ actor = buildListActor(pkgElement.get(x).getId().toString()); simpanActor.add(actor); } else{ System.out.println("tidak ditemukan actor"); } //simpanActor.add(actor); //System.out.println(actor); } } private String buildListActor(String actor) { String simpanIdOwned = null; String hasil = null; String hasilAkhir = null; //cari nama aktor yang ada melalui dari hasil string actor(id dari package) dicocokkan ke dalam owned attribute lalu ke lifeline yang sesuai id nya for(int x=0;x<owdElement.size();x++){ simpanIdOwned = owdElement.get(x).getIdTypePackageElement(); //owdElement memilikki typeid yang sama dengan package elemen jadi typeID = actor if(actor.equals(simpanIdOwned)){ simpanIdOwned = owdElement.get(x).getIdOwnedAttributes(); //masuk ke looping untuk fragment mencocokkan idOwned attribute ,idOwnedAttribute = idLifeline for(int y=0;y<accList.size();y++) { hasil = accList.get(y).getRepresent(); //System.out.println(hasil); //if nya harusnya bukan ke id dari lifeline tetapi represent dari lifeline if(simpanIdOwned.equals(hasil)){ //handle untuk getname nya //harusnnya langsung mencari seperti di subyek dan obyek for(int i=0;i<owdElement.size();i++){ String idOwdElement = owdElement.get(i).getIdOwnedAttributes(); if(hasil.equals(idOwdElement)){ String idTypeOwd = owdElement.get(i).getIdTypePackageElement(); for(int j=0;j<pkgElement.size();j++){ String idPkgElement = pkgElement.get(j).getId(); if(idTypeOwd.equals(idPkgElement)){ hasilAkhir = pkgElement.get(j).getName(); break; } } } } } } } } return hasilAkhir; } }
[ "mebungaranmanik@gmail.com" ]
mebungaranmanik@gmail.com
2c5e28b7a55536a6141dc984182b09d658fd0bfa
056ff5f928aec62606f95a6f90c2865dc126bddc
/javashop/shop-core/src/main/java/com/enation/app/shop/component/payment/plugin/alipay/sdk34/api/domain/AlipayOfflineMarketLeadsReleaseModel.java
3c50291c28b4b102dbb99bef856c504f3aeb0e97
[]
no_license
luobintianya/javashop
7846c7f1037652dbfdd57e24ae2c38237feb1104
ac15b14e8f6511afba93af60e8878ff44e380621
refs/heads/master
2022-11-17T11:12:39.060690
2019-09-04T08:57:58
2019-09-04T08:57:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,743
java
package com.enation.app.shop.component.payment.plugin.alipay.sdk34.api.domain; import com.enation.app.shop.component.payment.plugin.alipay.sdk34.api.AlipayObject; import com.enation.app.shop.component.payment.plugin.alipay.sdk34.api.internal.mapping.ApiField; /** * 服务商openApi操作私海leads释放 * * @author auto create * @since 1.0, 2017-02-07 16:46:47 */ public class AlipayOfflineMarketLeadsReleaseModel extends AlipayObject { private static final long serialVersionUID = 6554163546855618563L; /** * leads主键 */ @ApiField("leads_id") private String leadsId; /** * 当前操作id */ @ApiField("op_id") private String opId; /** * 异步结果通知 */ @ApiField("operate_notify_url") private String operateNotifyUrl; /** * 释放原因 */ @ApiField("release_reason") private String releaseReason; /** * 外部流水号 */ @ApiField("request_id") private String requestId; public String getLeadsId() { return this.leadsId; } public void setLeadsId(String leadsId) { this.leadsId = leadsId; } public String getOpId() { return this.opId; } public void setOpId(String opId) { this.opId = opId; } public String getOperateNotifyUrl() { return this.operateNotifyUrl; } public void setOperateNotifyUrl(String operateNotifyUrl) { this.operateNotifyUrl = operateNotifyUrl; } public String getReleaseReason() { return this.releaseReason; } public void setReleaseReason(String releaseReason) { this.releaseReason = releaseReason; } public String getRequestId() { return this.requestId; } public void setRequestId(String requestId) { this.requestId = requestId; } }
[ "sylow@javashop.cn" ]
sylow@javashop.cn
bb6085053ad29770799fa23b7f62f06cc2dff862
b4eb739b52ded4c263ab30f617dad125e4b5f862
/src/main/java/com/zk/jdbc/query/QuerySQL.java
bbffa312627aeb78d3aa85d2d5e4b380f3df6345
[]
no_license
qysl123/myWeb-new
0d64ebfddc1a93476e82740d0d98f89ad49109da
9dfe323e9266377bebbf3999ebbb6188db6c96b2
refs/heads/master
2021-05-01T12:55:05.196203
2017-06-30T07:09:35
2017-06-30T07:09:35
79,549,903
0
0
null
null
null
null
UTF-8
Java
false
false
421
java
package com.zk.jdbc.query; import java.util.List; import java.util.Map; /** * Created by zhongkun on 2017/6/30. */ public interface QuerySQL { <T> List<T> page(int var1, int var2); <T> List<T> all(); <T> List<T> limit(int var1); <T> T first(); <T> T last(); <T> T find(Object var1); Long count(); Map findOfMap(); List<Map<String, Object>> pageOfMap(int var1, int var2); }
[ "576296924@qq.com" ]
576296924@qq.com
8bd0370f803c6de3240c2a92effecf19a4d2c9ab
a5d01febfd8d45a61f815b6f5ed447e25fad4959
/Source Code/5.5.1/sources/com/iqoption/fragment/rightpanel/b.java
0fb2d1c771f49a29ef26302fef37be5a7a682da3
[]
no_license
kkagill/Decompiler-IQ-Option
7fe5911f90ed2490687f5d216cb2940f07b57194
c2a9dbbe79a959aa1ab8bb7a89c735e8f9dbc5a6
refs/heads/master
2020-09-14T20:44:49.115289
2019-11-04T06:58:55
2019-11-04T06:58:55
223,236,327
1
0
null
2019-11-21T18:17:17
2019-11-21T18:17:16
null
UTF-8
Java
false
false
16,413
java
package com.iqoption.fragment.rightpanel; import android.databinding.DataBindingUtil; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.content.res.ResourcesCompat; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.iqoption.analytics.EventManager; import com.iqoption.app.managers.a.k; import com.iqoption.app.managers.af; import com.iqoption.app.managers.tab.a.g; import com.iqoption.core.data.model.InstrumentType; import com.iqoption.d.aio; import com.iqoption.dto.Event; import com.iqoption.dto.entity.expiration.Expiration; import com.iqoption.fragment.az; import com.iqoption.service.e.m; import com.iqoption.system.a.e; import com.iqoption.system.a.i; import com.iqoption.tutorial.StepDoneType; import com.iqoption.tutorial.TutorialViewModel; import com.iqoption.tutorial.utils.d; import com.iqoption.util.aw; import com.iqoption.util.l; import com.iqoption.util.q; import com.iqoption.view.h; import com.iqoption.x.R; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.Locale; /* compiled from: BinaryRightPanelDelegate */ public final class b extends au implements com.iqoption.view.a.b.a { private double aTA; private Integer activeId; private TutorialViewModel aeq; private final a cEA = new a(this, null); private final b cEB = new b(this); private final y cEC = new y(); private final SimpleDateFormat cED = new SimpleDateFormat("0:mm:ss", Locale.getDefault()); private final com.iqoption.h.a.a cEE = com.iqoption.app.managers.tab.a.Il().Iu(); private aw cEF; private aw cEG; private x cEH; private int cEI; private int cEJ; private int cEK; private boolean cEL; private aio cEM; private at cEN; private final DecimalFormat cEy = q.I("#", 2); private int commission; private long expiration; private InstrumentType instrumentType; /* compiled from: BinaryRightPanelDelegate */ public static final class c { private final b cEX; private final e cEY; public c(b bVar) { this.cEX = bVar; this.cEY = new e(bVar); } public void amX() { az.a(this.cEX.getFragmentManager(), R.id.fragment); EventManager.Bm().a(Event.Builder(Event.CATEGORY_BUTTON_PRESSED, "traderoom_expiration-time").build()); } public void amY() { EventManager.Bm().a(Event.Builder(Event.CATEGORY_BUTTON_PRESSED, "deal-keyboard_keyboard").setValue(Double.valueOf(h.b(this.cEX.getFragmentManager(), R.id.fragment, this.cEX.UO()) ? 1.0d : 0.0d)).build()); } public void amZ() { this.cEX.y(this.cEX.UO() - 1.0d); EventManager.Bm().a(Event.Builder(Event.CATEGORY_BUTTON_PRESSED, "traderoom_deal-minus").build()); } public void ana() { this.cEX.y(this.cEX.UO() + 1.0d); EventManager.Bm().a(Event.Builder(Event.CATEGORY_BUTTON_PRESSED, "traderoom_deal-plus").build()); } public void bh(View view) { if (this.cEX.amS()) { this.cEX.bg(view); } this.cEX.ds(true); this.cEY.ane(); this.cEX.aeq.a(d.aFX(), StepDoneType.TAP_ON_TARGET); } public void bi(View view) { if (this.cEX.amS()) { this.cEX.bg(view); } this.cEX.ds(false); this.cEY.ane(); this.cEX.aeq.a(d.aFX(), StepDoneType.TAP_ON_TARGET); } public void anb() { this.cEX.amP(); this.cEY.anf(); } public void anc() { this.cEX.amP(); } public void and() { com.iqoption.app.managers.tab.a.Il().IB(); } } /* compiled from: BinaryRightPanelDelegate */ public static final class a extends e<b> { /* synthetic */ a(b bVar, AnonymousClass1 anonymousClass1) { this(bVar); } private a(b bVar) { super(bVar); } @com.google.common.b.e public void onInitializationCompletedEvent(com.iqoption.app.managers.tab.a.d dVar) { com.iqoption.core.d.a.aSe.execute(new Runnable() { public void run() { b bVar = (b) a.this.drU.get(); if (bVar != null) { bVar.amM(); } } }); } @com.google.common.b.e public void onAmountChangedIQKeyboardEvent(final com.iqoption.view.h.a aVar) { com.iqoption.core.d.a.aSe.execute(new Runnable() { public void run() { b bVar = (b) a.this.drU.get(); if (bVar != null) { bVar.x(((Double) aVar.getValue()).doubleValue()); } } }); } @com.google.common.b.e public void onShowedIQKeyboardEvent(final com.iqoption.view.h.b bVar) { com.iqoption.core.d.a.aSe.execute(new Runnable() { public void run() { b bVar = (b) a.this.drU.get(); if (bVar != null) { bVar.dr(((Boolean) bVar.getValue()).booleanValue()); } } }); } @com.google.common.b.e public void onShowedExpirationFragmentEvent(final k.d dVar) { com.iqoption.core.d.a.aSe.execute(new Runnable() { public void run() { b bVar = (b) a.this.drU.get(); if (bVar != null) { bVar.dq(dVar.aos); } } }); } @com.google.common.b.e public void onChangeCurrentActiveCommissionEvent(com.iqoption.app.helpers.a.c cVar) { com.iqoption.core.d.a.aSe.execute(new Runnable() { public void run() { b bVar = (b) a.this.drU.get(); if (bVar != null) { com.iqoption.core.microservices.tradingengine.response.active.a Iw = com.iqoption.app.managers.tab.a.Il().Iw(); if (Iw != null) { bVar.dR(Iw.Xi().intValue()); } } } }); } @com.google.common.b.e public void onChangeExpirationEvent(final com.iqoption.app.managers.a.k.a aVar) { if (aVar.aoq == com.iqoption.app.managers.tab.a.Il().ID()) { com.iqoption.core.d.a.aSe.execute(new Runnable() { public void run() { b bVar = (b) a.this.drU.get(); if (bVar != null) { bVar.br(aVar.aop.expValue.longValue()); bVar.amM(); com.iqoption.core.microservices.tradingengine.response.active.a Iw = com.iqoption.app.managers.tab.a.Il().Iw(); if (Iw != null) { bVar.dR(Iw.Xi().intValue()); } } } }); } } } /* compiled from: BinaryRightPanelDelegate */ public static class b extends i<b> { public b(b bVar) { super(bVar); } @com.google.common.b.e public void onChangeBalanceType(com.iqoption.service.e.b bVar) { com.iqoption.core.d.a.aSe.execute(new Runnable() { public void run() { b bVar = (b) b.this.drU.get(); if (bVar != null) { bVar.y(bVar.Ea()); bVar.amM(); } } }); } @com.google.common.b.e public void onUpdateBalanceValue(m mVar) { com.iqoption.core.d.a.aSe.execute(new Runnable() { public void run() { b bVar = (b) b.this.drU.get(); if (bVar != null) { bVar.amM(); } } }); } @com.google.common.b.e public void onChangeCurrentCurrency(com.iqoption.service.e.c cVar) { com.iqoption.core.d.a.aSe.execute(new Runnable() { public void run() { b bVar = (b) b.this.drU.get(); if (bVar != null) { bVar.amL(); bVar.amO(); } } }); } } b(RightPanelFragment rightPanelFragment, com.iqoption.core.microservices.tradingengine.response.active.a aVar) { super(rightPanelFragment); this.activeId = Integer.valueOf(aVar.getActiveId()); this.instrumentType = aVar.getInstrumentType(); this.cEI = ResourcesCompat.getColor(rightPanelFragment.getResources(), R.color.red, rightPanelFragment.getContext().getTheme()); this.cEJ = ResourcesCompat.getColor(rightPanelFragment.getResources(), R.color.white, rightPanelFragment.getContext().getTheme()); this.cEK = rightPanelFragment.getResources().getDimensionPixelSize(R.dimen.dp24); this.cEA.register(); this.cEB.register(); com.iqoption.view.a.b.aIK().a((com.iqoption.view.a.b.a) this); this.aeq = TutorialViewModel.D(rightPanelFragment.zzakw()); } public void x(double d) { y(d); } public double UO() { return this.aTA; } public boolean amH() { return com.iqoption.settings.b.aDQ().aDX() ^ 1; } public void amI() { this.cEM.bSd.setType(amK()); this.cEM.bSd.setExpiration(k.av(this.expiration)); this.cEH.L(this.cEM.bSd); } public void amJ() { Long balanceId = com.iqoption.app.a.Cw().getBalanceId(); g IC = com.iqoption.app.managers.tab.a.Il().IC(); if (IC != null && balanceId != null) { com.iqoption.mobbtech.connect.request.api.a.a.a(IC.IM(), IC.getActiveId(), IC.getInstrumentType(), IC.IP(), this.aTA, balanceId.longValue(), 100 - this.commission, this.cEL); } } public boolean amK() { return this.cEL; } public void onTick(long j) { com.iqoption.app.managers.tab.a Il = com.iqoption.app.managers.tab.a.Il(); com.iqoption.core.microservices.tradingengine.response.active.a Iw = Il.Iw(); if (v(Iw)) { if (this.cEH.bl(this.cEM.bRp)) { if (b(Iw, j)) { this.cEM.bRp.setTimeToClose(this.cED.format(this.cEC.bw(this.expiration - j))); } else { amP(); } } else if (b(Iw, j)) { amQ(); } if (this.cEH.bl(this.cEM.bSd)) { this.cEM.bSd.setLevel(this.cEE.format(com.iqoption.gl.b.aow().glchTabGetActualValue(Il.IE()))); } if (!this.cHt) { return; } if (af.Hu().Hz()) { this.cEN.amD(); this.cEN.amF(); return; } this.cEN.amE(); this.cEN.amG(); } } private boolean b(@NonNull com.iqoption.core.microservices.tradingengine.response.active.a aVar, long j) { if (j <= this.expiration - k.HB().c(aVar, Expiration.notInitilizedExpiration) || j >= this.expiration) { return false; } return com.iqoption.app.managers.c.Gn().b(new com.iqoption.mobbtech.connect.response.options.i(Long.valueOf(this.expiration / 1000), Integer.valueOf(aVar.getActiveId()), aVar.getInstrumentType())) ^ 1; } private boolean v(@Nullable com.iqoption.core.microservices.tradingengine.response.active.a aVar) { return aVar != null && aw.equals(aVar.getInstrumentType(), this.instrumentType) && aVar.getActiveId() == this.activeId.intValue(); } @NonNull View f(@NonNull LayoutInflater layoutInflater, @NonNull ViewGroup viewGroup) { this.cEM = (aio) DataBindingUtil.inflate(layoutInflater, R.layout.right_panel_delegate_turbo_binary, viewGroup, false); final c cVar = new c(this); this.cEM.a(cVar); this.cEN = new a(layoutInflater, this.cEM.bSi); at atVar = this.cEN; cVar.getClass(); atVar.a(c.b(cVar)); atVar = this.cEN; cVar.getClass(); atVar.b(d.b(cVar)); this.cEM.bSi.addView(this.cEN.getView(), 0); this.cEF = new aw(this.cEM.bSS, this.cEM.bSe); this.cEG = new aw(this.cEM.bwP, this.cEM.bwO); this.cEH = new x(this.cEK, this.cEN.getView(), this.cEM.bSd, this.cEM.bRp); this.cEM.bSd.setConfirmListener(new com.iqoption.view.d.b(1000) { public void q(View view) { cVar.anb(); } }); this.cEM.bSd.setCancelListener(new com.iqoption.view.d.b() { public void q(View view) { cVar.anc(); } }); this.cEM.bRp.setBuyNewListener(new com.iqoption.view.d.b() { public void q(View view) { cVar.and(); } }); y(Ea()); com.iqoption.core.microservices.tradingengine.response.active.a Iw = com.iqoption.app.managers.tab.a.Il().Iw(); if (Iw != null) { dR(Iw.Xi().intValue()); } br(com.iqoption.app.managers.tab.a.Il().IA()); return this.cEM.getRoot(); } void w(@NonNull com.iqoption.core.microservices.tradingengine.response.active.a aVar) { super.w(aVar); this.activeId = Integer.valueOf(aVar.getActiveId()); this.instrumentType = aVar.getInstrumentType(); } void destroy() { super.destroy(); this.cEA.unregister(); this.cEB.unregister(); com.iqoption.view.a.b.aIK().b((com.iqoption.view.a.b.a) this); } void y(double d) { if (d < 0.0d) { d = 0.0d; } this.aTA = d; this.cEM.bwP.setText(l.a(d, this.cEy)); amM(); amO(); } private void amL() { this.cEM.bwP.setText(l.a(this.aTA, this.cEy)); } void amM() { if (this.cEM != null) { double doubleValue = com.iqoption.app.a.Cw().Cx().doubleValue(); double[] N = l.N(getInstrumentType()); if (this.aTA > doubleValue || this.aTA > N[1] || this.aTA < N[0]) { this.cEM.bwP.setTextColor(this.cEI); } else { this.cEM.bwP.setTextColor(this.cEJ); } } } void br(long j) { this.expiration = j; amN(); } private void amN() { if (this.cEM != null) { com.iqoption.core.microservices.tradingengine.response.active.a Iw = com.iqoption.app.managers.tab.a.Il().Iw(); if (v(Iw)) { this.cEM.bSS.setText(k.HB().a(Iw, this.expiration)); } else { this.cEM.bSS.setText(null); } if (this.cEH.bl(this.cEM.bSd)) { this.cEM.bSd.setExpiration(k.av(this.expiration)); } } } void dR(int i) { this.commission = i; amO(); } private void amO() { if (this.cEM != null) { double d = (this.aTA * (200.0d - ((double) this.commission))) / 100.0d; int i = 100 - this.commission; this.cEN.g(d, i); this.cEN.h(d, i); } } void dq(boolean z) { this.cEM.bSg.setSelected(z); this.cEM.bSR.setSelected(z); if (z) { this.cEF.select(); } else { this.cEF.aoe(); } } void dr(boolean z) { this.cEM.bRi.setSelected(z); this.cEM.bRh.setSelected(z); if (z) { this.cEG.select(); } else { this.cEG.aoe(); } } void amP() { this.cEH.L(this.cEN.getView()); } void amQ() { this.cEH.L(this.cEM.bRp); } void ds(boolean z) { this.cEL = z; } @Nullable public InstrumentType getInstrumentType() { return this.instrumentType; } }
[ "yihsun1992@gmail.com" ]
yihsun1992@gmail.com
5a97163a1c41dfda92df306e69d93347ed08c397
adab91bfa1608a3a8fd1fe225d079cbbe022aa99
/src/main/java/hello/hellospring/domain/Member.java
1d456c3066151ed965cbf0ca51f5c9083af9a1f4
[]
no_license
DuYeong0020/Spring_Inflearn_Basic
f62c7dbf05d01f5ad447ab618601ec67a3afe5ff
64014cdbaa2e901f9e467d27135c60b53afe3f3d
refs/heads/main
2023-02-01T18:19:52.507883
2020-12-17T10:19:30
2020-12-17T10:19:30
321,944,488
0
0
null
null
null
null
UTF-8
Java
false
false
618
java
package hello.hellospring.domain; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity public class Member { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; // 자동으로 증가한다. : 아이덴티티 전략 private String name; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
[ "chlendud00@naver.com" ]
chlendud00@naver.com
396d7c436cd1465f85caf6e78507e4590de77269
6e379759703a6b5ff2d66b4fa57443497732dee7
/app/src/main/java/br/com/ecarrara/popularmovies/reviews/presentation/view/MovieReviewsFragment.java
0829798b5c8c104d1073df4a72f0f7dee42c5308
[]
no_license
ecarrara-araujo/mypopularmovies
18b6b7356dd60609e81cf1565b4d0635c0cf5d8c
3d49cbeec94baa298510dfa354b78017dae936e2
refs/heads/master
2021-01-11T14:56:35.768698
2017-09-14T02:33:39
2017-09-14T02:33:39
80,256,922
0
0
null
null
null
null
UTF-8
Java
false
false
6,355
java
package br.com.ecarrara.popularmovies.reviews.presentation.view; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; import android.widget.ProgressBar; import android.widget.TextView; import java.util.List; import javax.inject.Inject; import br.com.ecarrara.popularmovies.R; import br.com.ecarrara.popularmovies.core.di.Injector; import br.com.ecarrara.popularmovies.reviews.presentation.model.MovieReviewListItemViewModel; import br.com.ecarrara.popularmovies.reviews.presentation.presenter.MovieReviewsListPresenter; import butterknife.BindView; import butterknife.ButterKnife; import static android.view.View.GONE; import static android.view.View.VISIBLE; public class MovieReviewsFragment extends Fragment implements MovieReviewsListView, MovieReviewsAdapter.MovieReviewSelectedListener { @Inject MovieReviewsListPresenter movieReviewsListPresenter; @BindView(R.id.recycler_view_movie_reviews_list) RecyclerView movieReviesListView; @BindView(R.id.progress_indicator) ProgressBar progressIndicator; @BindView(R.id.text_view_error_message) TextView errorDisplay; @BindView(R.id.button_retry) ImageButton retryButton; private static final String ARGUMENT_MOVIE_ID = "movie_id"; private static final int INVALID_MOVIE_ID = -1; private static final String LAST_KNOWN_REVIEWS_LIST_POSITION_KEY = "last_known_movie_list_position"; private static final int DEFAULT_REVIEWS_LIST_INITIAL_POSITION = 0; private int lastKnownReviewsListPosition = DEFAULT_REVIEWS_LIST_INITIAL_POSITION; private MovieReviewsAdapter movieReviewsAdapter; private int movieId = INVALID_MOVIE_ID; public MovieReviewsFragment() { // Required empty public constructor } /** * Create a new Movie Reviews List for the informed movieId * @param movieId * @return */ public static MovieReviewsFragment newInstance(int movieId) { MovieReviewsFragment movieReviewsFragment = new MovieReviewsFragment(); Bundle args = new Bundle(); args.putInt(ARGUMENT_MOVIE_ID, movieId); movieReviewsFragment.setArguments(args); return movieReviewsFragment; } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); processSavedInstanceState(savedInstanceState); if (getArguments() != null) { movieId = getArguments().getInt(ARGUMENT_MOVIE_ID); } } private void processSavedInstanceState(Bundle savedInstanceState) { if(savedInstanceState != null) { lastKnownReviewsListPosition = savedInstanceState.getInt( LAST_KNOWN_REVIEWS_LIST_POSITION_KEY, DEFAULT_REVIEWS_LIST_INITIAL_POSITION); } } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View inflatedView = inflater.inflate(R.layout.movie_reviews_list_fragment, container, false); ButterKnife.bind(this, inflatedView); initialize(); if(movieId == INVALID_MOVIE_ID) { showError(getString(R.string.error_fetching_movie_trailers)); } return inflatedView; } private void initialize() { Injector.applicationComponent().inject(this); setupRecyclerView(); } private void setupRecyclerView() { LinearLayoutManager layoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false); movieReviewsAdapter = new MovieReviewsAdapter(getContext(), this); movieReviesListView.setAdapter(movieReviewsAdapter); movieReviesListView.setLayoutManager(layoutManager); movieReviesListView.setHasFixedSize(true); } @Override public void onResume() { super.onResume(); this.movieReviewsListPresenter.attachTo(this, this.movieId); } @Override public void onSaveInstanceState(Bundle outState) { outState.putInt(LAST_KNOWN_REVIEWS_LIST_POSITION_KEY, ((LinearLayoutManager)movieReviesListView.getLayoutManager()).findFirstVisibleItemPosition()); super.onSaveInstanceState(outState); } @Override public void onDestroy() { this.movieReviewsListPresenter.destroy(); super.onDestroy(); } @Override public void showLoading() { hideError(); hideRetry(); hideContent(); progressIndicator.setVisibility(VISIBLE); } @Override public void hideLoading() { progressIndicator.setVisibility(GONE); } @Override public void showRetry() { retryButton.setVisibility(VISIBLE); } @Override public void hideRetry() { retryButton.setVisibility(GONE); } @Override public void showError(String message) { hideLoading(); hideContent(); errorDisplay.setVisibility(VISIBLE); errorDisplay.setText(message); } @Override public void hideError() { errorDisplay.setVisibility(GONE); } private void hideContent() { movieReviesListView.setVisibility(GONE); } private void showContent() { hideLoading(); hideError(); hideRetry(); movieReviesListView.setVisibility(VISIBLE); } @Override public void displayMovieReviewsList(List<MovieReviewListItemViewModel> movieReviewsList) { this.showContent(); this.movieReviewsAdapter.setMovieReviewsListItemViewModelsList(movieReviewsList); restoreReviewsListPosition(); } private void restoreReviewsListPosition() { if(movieReviewsAdapter.getItemCount() < lastKnownReviewsListPosition) { movieReviesListView.scrollToPosition(lastKnownReviewsListPosition); } } @Override public void expandMovieReview(int index) { } @Override public void onMovieReviewSelected(int reviewIndex) { this.movieReviewsListPresenter.movieReviewSelected(reviewIndex); } }
[ "ecarrara.araujo@gmail.com" ]
ecarrara.araujo@gmail.com
207b178b850a0983fad628fb612e36024d4abc73
72d12c927c9eb773d9dd927293a466b122e94481
/src/Command/Uitwerking.java
b4dd725064fd672a67514428244cca233de56d47
[]
no_license
KHommes/DesignPatterns
f57db30da48d30d115504ff21d23dc5d8b382358
1b42550b5bdad0fef5f4506ab51bc4971f0214f5
refs/heads/main
2023-04-21T08:36:12.504108
2021-05-21T14:43:30
2021-05-21T14:43:30
369,561,537
0
0
null
null
null
null
UTF-8
Java
false
false
2,257
java
//package Command; // // //import java.util.ArrayList; //import java.util.List; // //public class Demo{ // public static void main(String[] args) { // TicketVerwerker tv = new TicketVerwerker(); // Ticket tc = new Ticket("Pietersen"); // // tv.voegOpdrachtToe( new TicketWeggooien( new Ticket("Janssen") ) ); // tv.voegOpdrachtToe( new TicketBeantwoorden(tc) ); // tv.voegOpdrachtToe( new TicketOpvolgen(tc) ); // tv.voegOpdrachtToe( new TicketWeggooien(tc) ); // // tv.voerVerwerkingUit(); // } //} // //interface TicketVerwerking{ // void verwerken(); //} // //class Ticket{ // String klantnaam; // // Ticket(String klantnaam){ // shadowing // this.klantnaam = klantnaam; // } // // void weggooien() { // System.out.println("ticket weggooien"+klantnaam); // } // void beantwoorden() { // System.out.println("ticket beantwoorden"+klantnaam); // } // void opvolgen() { // System.out.println("ticket opvolgen"+klantnaam); // } //} // //class TicketWeggooien implements TicketVerwerking{ // private Ticket ticket; // public TicketWeggooien(Ticket ticket) { // this.ticket = ticket; // } // @Override // public void verwerken() { // ticket.weggooien(); // } //} //class TicketBeantwoorden implements TicketVerwerking{ // private Ticket ticket; // public TicketBeantwoorden(Ticket ticket) { // this.ticket = ticket; // } // @Override // public void verwerken() { // ticket.beantwoorden(); // } //} //class TicketOpvolgen implements TicketVerwerking{ // private Ticket ticket; // public TicketOpvolgen(Ticket ticket) { // this.ticket = ticket; // } // @Override // public void verwerken() { // ticket.opvolgen(); // } //} //class TicketVerwerker{ // private List<TicketVerwerking> verwerkingslijst = new ArrayList(); // // public void voegOpdrachtToe(TicketVerwerking tv) { // verwerkingslijst.add(tv); // } // public void voerVerwerkingUit() { // for(TicketVerwerking tv : verwerkingslijst) { // tv.verwerken(); // } // verwerkingslijst.clear(); // } //} // // // // // //
[ "k.hommes@st.hanze.nl" ]
k.hommes@st.hanze.nl
b5e394db012fe28775df0c027a30765a4a247142
a8d84b46542cc1dfdb5cde81abcb9b3765c3039b
/third_party/pmd/src/test/java/net/sourceforge/pmd/lang/xml/rule/AbstractDomXmlRuleTest.java
0786c51907190260314ce32da750658d6e5a752c
[ "BSD-3-Clause" ]
permissive
ideadapt/SAFE
f0d6f2cd3a46b929ee194001d4dffa3ffcc01ce1
4f9e51f4182ee8a0db249996bf3ceb6ec604f25e
refs/heads/master
2020-04-30T09:44:44.896790
2015-04-14T19:47:18
2015-04-14T19:47:18
33,944,874
0
0
null
null
null
null
UTF-8
Java
false
false
5,856
java
package net.sourceforge.pmd.lang.xml.rule; import static org.junit.Assert.assertEquals; import java.io.StringReader; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import net.sourceforge.pmd.RuleContext; import net.sourceforge.pmd.lang.Language; import net.sourceforge.pmd.lang.Parser; import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.xml.XmlParserOptions; import net.sourceforge.pmd.lang.xml.ast.XmlNode; import net.sourceforge.pmd.lang.xml.rule.AbstractDomXmlRule; import org.junit.Test; import org.w3c.dom.Attr; import org.w3c.dom.CharacterData; import org.w3c.dom.Comment; import org.w3c.dom.Document; import org.w3c.dom.DocumentType; import org.w3c.dom.Element; import org.w3c.dom.Entity; import org.w3c.dom.EntityReference; import org.w3c.dom.Notation; import org.w3c.dom.ProcessingInstruction; import org.w3c.dom.Text; public class AbstractDomXmlRuleTest { @Test public void testVisit() throws Exception { String source = "<?xml version=\"1.0\"?><?mypi?><!DOCTYPE testDoc [<!ENTITY entity \"e\">]><!--Comment--><foo abc=\"abc\"><bar>TEXT</bar><![CDATA[cdata!]]>&gt;&entity;&lt;</foo>"; XmlParserOptions parserOptions = new XmlParserOptions(); parserOptions.setExpandEntityReferences(false); Parser parser = Language.XML.getDefaultVersion().getLanguageVersionHandler().getParser(parserOptions); XmlNode xmlNode = (XmlNode) parser.parse(null, new StringReader(source)); List<XmlNode> nodes = new ArrayList<XmlNode>(); nodes.add(xmlNode); MyRule rule = new MyRule(); rule.apply(nodes, null); List<org.w3c.dom.Node> visited = rule.visitedNodes.get("Attr"); assertEquals(1, visited.size()); assertEquals("abc", visited.get(0).getLocalName()); visited = rule.visitedNodes.get("CharacterData"); assertEquals(1, visited.size()); assertEquals("cdata!", ((CharacterData) visited.get(0)).getData()); visited = rule.visitedNodes.get("Comment"); assertEquals("Comment", ((Comment) visited.get(0)).getData()); visited = rule.visitedNodes.get("Document"); assertEquals(1, visited.size()); visited = rule.visitedNodes.get("DocumentType"); assertEquals("testDoc", ((DocumentType) visited.get(0)).getName()); visited = rule.visitedNodes.get("Element"); assertEquals(2, visited.size()); assertEquals("foo", visited.get(0).getLocalName()); assertEquals("bar", visited.get(1).getLocalName()); // TODO Figure out how to trigger this. // visited = rule.visitedNodes.get("Entity"); // assertEquals(0, visited.size()); visited = rule.visitedNodes.get("EntityReference"); assertEquals(1, visited.size()); assertEquals("entity", ((EntityReference) visited.get(0)).getNodeName()); // TODO Figure out how to trigger this. // visited = rule.visitedNodes.get("Notation"); // assertEquals(0, visited.size()); visited = rule.visitedNodes.get("ProcessingInstruction"); assertEquals(1, visited.size()); assertEquals("mypi", ((ProcessingInstruction) visited.get(0)).getTarget()); visited = rule.visitedNodes.get("Text"); assertEquals(4, visited.size()); assertEquals("TEXT", ((Text) visited.get(0)).getData()); assertEquals(">", ((Text) visited.get(1)).getData()); assertEquals("e", ((Text) visited.get(2)).getData()); assertEquals("<", ((Text) visited.get(3)).getData()); } private static class MyRule extends AbstractDomXmlRule { final Map<String, List<org.w3c.dom.Node>> visitedNodes = new HashMap<String, List<org.w3c.dom.Node>>(); public MyRule() { } private void visit(String key, org.w3c.dom.Node node) { List<org.w3c.dom.Node> nodes = visitedNodes.get(key); if (nodes == null) { nodes = new ArrayList<org.w3c.dom.Node>(); visitedNodes.put(key, nodes); } nodes.add(node); } @Override public void apply(List<? extends Node> nodes, RuleContext ctx) { super.apply(nodes, ctx); } @Override protected void visit(XmlNode node, Attr attr, RuleContext ctx) { visit("Attr", attr); super.visit(node, attr, ctx); } @Override protected void visit(XmlNode node, CharacterData characterData, RuleContext ctx) { visit("CharacterData", characterData); super.visit(node, characterData, ctx); } @Override protected void visit(XmlNode node, Comment comment, RuleContext ctx) { visit("Comment", comment); super.visit(node, comment, ctx); } @Override protected void visit(XmlNode node, Document document, RuleContext ctx) { visit("Document", document); super.visit(node, document, ctx); } @Override protected void visit(XmlNode node, DocumentType documentType, RuleContext ctx) { visit("DocumentType", documentType); super.visit(node, documentType, ctx); } @Override protected void visit(XmlNode node, Element element, RuleContext ctx) { visit("Element", element); super.visit(node, element, ctx); } @Override protected void visit(XmlNode node, Entity entity, RuleContext ctx) { visit("Entity", entity); super.visit(node, entity, ctx); } @Override protected void visit(XmlNode node, EntityReference entityReference, RuleContext ctx) { visit("EntityReference", entityReference); super.visit(node, entityReference, ctx); } @Override protected void visit(XmlNode node, Notation notation, RuleContext ctx) { visit("Notation", notation); super.visit(node, notation, ctx); } @Override protected void visit(XmlNode node, ProcessingInstruction processingInstruction, RuleContext ctx) { visit("ProcessingInstruction", processingInstruction); super.visit(node, processingInstruction, ctx); } @Override protected void visit(XmlNode node, Text text, RuleContext ctx) { visit("Text", text); super.visit(node, text, ctx); } } public static junit.framework.Test suite() { return new junit.framework.JUnit4TestAdapter(AbstractDomXmlRuleTest.class); } }
[ "kunz@ideadapt.net" ]
kunz@ideadapt.net
8636ad625c853275af00bbc831e53dce06da0531
b3e3d69ce47afb1ca7d7c8aee58d29e016d18d0a
/app/src/main/java/app/stundenplan/ms/rats/ratsapp/fragment_no_existing_QPhase.java
f3d14a0a96ee9e9864f291559bb0ecbe6f4a846a
[]
no_license
nebur115/RatsApp
32af2bf17b243210f0684d2bcaef58a0ade57f01
8a54bff035f85243bacb5f3844b167cc0e06178e
refs/heads/master
2020-03-12T00:45:34.356898
2019-12-27T18:22:44
2019-12-27T18:22:44
130,357,659
5
1
null
null
null
null
UTF-8
Java
false
false
1,087
java
package app.stundenplan.ms.rats.ratsapp; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; public class fragment_no_existing_QPhase extends Fragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){ View view = inflater.inflate(R.layout.fragment_button_plane_qphase, container,Boolean.parseBoolean(null)); Button button = view.findViewById(R.id.button_create_stundenplan); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent i = new Intent(getContext(), QPhase_create.class); i.putExtra("NotOutofSettingsSettings", false); startActivity(i); } }); return view; } }
[ "rubenfoerster@gmx.de" ]
rubenfoerster@gmx.de
cc4480d63b3e2804024090124e9e89116bcad04a
a43d795ee1f151bd291bee4eccc4d7d2ea8d51ea
/app/src/main/java/com/fm/factorytest/base/CommandSource.java
d4ce992e685682b1e2967606798b79c428fb271c
[]
no_license
sengeiou/FactoryTest
13dd1bb11fc51912d25f3c89f334778f3b7289b6
4473e2790c3d503e82952e332e27f97dfc0277da
refs/heads/master
2020-04-30T22:03:08.674572
2019-03-20T12:04:22
2019-03-20T12:04:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,917
java
package com.fm.factorytest.base; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.util.Log; import com.fm.factorytest.global.FactorySetting; import com.fm.fengmicomm.usb.USB; import com.fm.fengmicomm.usb.USBContext; import com.fm.fengmicomm.usb.callback.GlobalCommandReceiveListener; import com.fm.fengmicomm.usb.command.CommandRxWrapper; import com.fm.fengmicomm.usb.command.CommandTxWrapper; import com.fm.fengmicomm.usb.task.CL200CommTask; import com.fm.fengmicomm.usb.task.CL200ProtocolTask; import com.fm.fengmicomm.usb.task.CP210xCommTask; import com.fm.fengmicomm.usb.task.CP210xProtocolTask; import java.io.PrintWriter; import java.lang.ref.WeakReference; import java.util.Arrays; import static com.fm.fengmicomm.usb.USBContext.cl200CommTask; import static com.fm.fengmicomm.usb.USBContext.cl200ProtocolTask; import static com.fm.fengmicomm.usb.USBContext.cl200Usb; import static com.fm.fengmicomm.usb.USBContext.cp210xUsb; /* receive command from remoter, maybe network, broadcast receiver ....*/ public class CommandSource implements GlobalCommandReceiveListener { private static final String FAKE_COMMAN_ACTION = "com.duokan.command.fake"; private static final String TAG = "FactoryCommandSource"; private OnCommandListener mCmdListener; private final BroadcastReceiver fakeCommandReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action != null && action.equals(FAKE_COMMAN_ACTION)) { String para0 = intent.getStringExtra(FactorySetting.EXTRA_CMDID); String para1 = intent.getStringExtra(FactorySetting.EXTRA_CMDPARA); if (para0 != null) { para0 = para0.toUpperCase(); try { Integer.parseInt(para0, 16); } catch (NumberFormatException e) { Log.e(TAG, e.toString()); return; } } if (para1 != null) { para1 = stringToAscii(para1); } // } Log.i(TAG, "Got FAKE_COMMAN_ACTION, para0 : [ " + para0 + " ], para1 : [" + para1 + " ]"); mCmdListener.handleCommand(para0, para1); } } public String stringToAscii(String value) { StringBuffer sbu = new StringBuffer(); char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { if (i != chars.length - 1) { sbu.append((int) chars[i]).append(","); } else { sbu.append((int) chars[i]); } } return sbu.toString(); } }; private WeakReference<Context> ctx; private CommandTxWrapper txWrapper; CommandSource(Context context, OnCommandListener listener) { ctx = new WeakReference<>(context); mCmdListener = listener; registerFakeCommand(); initCL200A(context); initCP210x(context); CommandRxWrapper.addGlobalRXListener(this); } private void registerFakeCommand() { Context context = ctx.get(); if (context != null) { IntentFilter filter = new IntentFilter(FAKE_COMMAN_ACTION); context.registerReceiver(fakeCommandReceiver, filter); } } public void finishCommandSouce() { Context context = ctx.get(); if (context != null) { context.unregisterReceiver(fakeCommandReceiver); } if (cp210xUsb != null) { cp210xUsb.destroy(context); cp210xUsb = null; } } public void sendMsg(String cmdID, byte[] data) { txWrapper = CommandTxWrapper.initTX(cmdID, null, data, CommandTxWrapper.DATA_BYTES, USBContext.TYPE_FUNC); txWrapper.send(); } /** * 初始化 USB 端口 */ private void initCP210x(Context context) { if (cp210xUsb == null) { cp210xUsb = new USB.USBBuilder(context) .setBaudRate(115200) .setDataBits(8) .setParity(1) .setStopBits(0) .setMaxReadBytes(80) .setVID(4292) .setPID(60000) .build(); cp210xUsb.setOnUsbChangeListener(new USB.OnUsbChangeListener() { @Override public void onUsbConnect() { Log.d(TAG, "onUsbConnect"); if (USBContext.cp210xProtocolTask != null || USBContext.cp210xCommTask != null) { killServer(); } startServer(); } @Override public void onUsbDisconnect() { killServer(); Log.d(TAG, "onUsbDisconnect"); } @Override public void onUsbConnectFailed() { Log.d(TAG, "onUsbConnectFailed"); } @Override public void onPermissionGranted() { Log.d(TAG, "onPermissionGranted"); } @Override public void onPermissionRefused() { Log.d(TAG, "onPermissionRefused"); } @Override public void onDriverNotSupport() { Log.d(TAG, "onDriverNotSupport"); } @Override public void onWriteDataFailed(String s) { Log.d(TAG, "onWriteDataFailed == " + s); } @Override public void onWriteSuccess(int i) { Log.d(TAG, "onWriteSuccess"); } }); if (cp210xUsb.getTargetDevice() != null) { //调用此方法先触发一次USB检测 cp210xUsb.afterGetUsbPermission(cp210xUsb.getTargetDevice()); } } } private void initCL200A(Context context) { cl200Usb = new USB.USBBuilder(context) .setBaudRate(9600) .setDataBits(7) .setParity(2)//EVEN .setStopBits(1) .setMaxReadBytes(80) .setVID(1027) .setPID(24577) .build(); cl200Usb.setOnUsbChangeListener(new USB.OnUsbChangeListener() { @Override public void onUsbConnect() { if (cl200ProtocolTask == null) { cl200ProtocolTask = new CL200ProtocolTask(); cl200ProtocolTask.initTask(); cl200ProtocolTask.start(); } if (cl200CommTask == null) { cl200CommTask = new CL200CommTask(); cl200CommTask.initTask(); cl200CommTask.start(); } } @Override public void onUsbDisconnect() { if (cl200CommTask != null) { cl200CommTask.killComm(); cl200CommTask = null; } if (cl200ProtocolTask != null) { cl200ProtocolTask.killProtocol(); cl200ProtocolTask = null; } } @Override public void onUsbConnectFailed() { Log.d(TAG, "onUsbConnectFailed"); } @Override public void onPermissionGranted() { Log.d(TAG, "onPermissionGranted"); } @Override public void onPermissionRefused() { Log.d(TAG, "onPermissionRefused"); } @Override public void onDriverNotSupport() { Log.d(TAG, "onDriverNotSupport"); } @Override public void onWriteDataFailed(String s) { Log.d(TAG, "onWriteDataFailed == " + s); } @Override public void onWriteSuccess(int i) { Log.d(TAG, "onWriteSuccess"); } }); } @Override public void onRXWrapperReceived(String cmdID, byte[] data) { Log.d(TAG, "we received cmd id = " + cmdID + ", value is " + (data == null ? "null" : Arrays.toString(data))); String P = ""; if (data != null) { StringBuilder par = new StringBuilder(); for (int i = 0; i < data.length; i++) { par.append(data[i]).append(","); } P = par.toString(); } mCmdListener.handleCommand(cmdID, P); } private void killServer() { if (USBContext.cp210xCommTask != null) { USBContext.cp210xCommTask.killComm(); USBContext.cp210xCommTask = null; } if (USBContext.cp210xProtocolTask != null) { USBContext.cp210xProtocolTask.killProtocol(); USBContext.cp210xProtocolTask = null; } } private void startServer() { USBContext.cp210xProtocolTask = new CP210xProtocolTask(); USBContext.cp210xProtocolTask.taskInit(); USBContext.cp210xProtocolTask.start(); USBContext.cp210xCommTask = new CP210xCommTask(); USBContext.cp210xCommTask.initTask(); USBContext.cp210xCommTask.start(); } public interface OnCommandListener { //handle receiver command void handleCommand(String msgid, String param); //return the result void setResultOuter(PrintWriter writer); } }
[ "lijie@formovie.cn" ]
lijie@formovie.cn
0cd4871bcd7dda769b93b3752f8b26579b8da7ad
bc1ba8f5d84155cc9015b9c1a79604fd3a7e6927
/flexible-adapter-app/src/main/java/eu/davidea/samples/anim/FromTopItemAnimator.java
2bad6ee9285604aa98889679dcf89927239bdaf9
[ "Apache-2.0" ]
permissive
zoopolitic/FlexibleAdapter
4b6fa49240e6dadc0b98b09e8556b8c46d126897
3016771c84382ddc2adc0a44927f35ca6a33bbbf
refs/heads/master
2020-12-24T15:41:38.178110
2016-06-16T18:45:31
2016-06-16T18:45:31
61,316,862
2
0
null
2016-06-16T18:32:50
2016-06-16T18:32:49
null
UTF-8
Java
false
false
1,625
java
package eu.davidea.samples.anim; import android.graphics.Point; import android.support.v4.view.ViewCompat; import android.support.v4.view.ViewPropertyAnimatorCompat; import android.view.animation.AccelerateInterpolator; import android.view.animation.OvershootInterpolator; import android.support.v7.widget.RecyclerView.ViewHolder; import eu.davidea.utils.Utils; public class FromTopItemAnimator extends PendingItemAnimator { public FromTopItemAnimator() { setMoveDuration(200); setRemoveDuration(500); setAddDuration(300); } @Override protected boolean prepHolderForAnimateRemove(ViewHolder holder) { return true; } @Override protected ViewPropertyAnimatorCompat animateRemoveImpl(ViewHolder holder) { Point screen = Utils.getScreenDimensions(holder.itemView.getContext()); int top = holder.itemView.getTop(); return ViewCompat.animate(holder.itemView) .rotation(80) .translationY(screen.y - top) .setInterpolator(new AccelerateInterpolator()); } @Override protected void onRemoveCanceled(ViewHolder holder) { ViewCompat.setTranslationY(holder.itemView, 0); } @Override protected boolean prepHolderForAnimateAdd(ViewHolder holder) { int bottom = holder.itemView.getBottom(); ViewCompat.setTranslationY(holder.itemView, -bottom); return true; } @Override protected ViewPropertyAnimatorCompat animateAddImpl(ViewHolder holder) { return ViewCompat.animate(holder.itemView) .translationY(0) .setInterpolator(new OvershootInterpolator()); } @Override protected void onAddCanceled(ViewHolder holder) { ViewCompat.setTranslationY(holder.itemView, 0); } }
[ "dave.dna@gmail.com" ]
dave.dna@gmail.com
91d9bd54bb5afc4ff586c97ed691446f642c5b86
7d0a66f16fdc573ef96ecde420709c038232e7b1
/src/main/java/com/houde/threadgroup/WaitNotify.java
073469603445b9d76e5a903916caca5ea49a674f
[]
no_license
qiuhoude/baili_java_test
97e3b56410f4d1d1a66857aac0c3000151f9c6b1
cd961e7e68dce35ea0ba21e4f9d73fde5df687ba
refs/heads/master
2022-12-25T12:16:03.283310
2022-02-25T01:57:59
2022-02-25T01:57:59
209,278,537
0
0
null
2022-12-16T02:54:58
2019-09-18T10:12:48
Java
UTF-8
Java
false
false
1,438
java
package com.houde.threadgroup; import java.util.concurrent.TimeUnit; /** * Created by I on 2017/12/16. */ public class WaitNotify { static boolean flag = true; static Object lock = new Object(); public static void main(String[] args) throws InterruptedException { Thread A = new Thread(new Wait(), "wait thread"); A.start(); TimeUnit.SECONDS.sleep(2); Thread B = new Thread(new Notify(), "notify thread"); B.start(); } static class Wait implements Runnable { @Override public void run() { synchronized (lock) { while (flag) { try { System.out.println(Thread.currentThread() + " flag is true"); lock.wait(); } catch (InterruptedException e) { } } System.out.println(Thread.currentThread() + " flag is false"); } } } static class Notify implements Runnable { @Override public void run() { synchronized (lock) { flag = false; lock.notifyAll(); //此处Wait线程从WAITING 变成 BLOCKED try { TimeUnit.SECONDS.sleep(7); } catch (InterruptedException e) { e.printStackTrace(); } } } } }
[ "3617150@qq.com" ]
3617150@qq.com
70bb214452f89f017369ba506782b09256b22999
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/23/23_b123ca71cd688de34e59bd15d4a861662f8f371d/HStoreSite/23_b123ca71cd688de34e59bd15d4a861662f8f371d_HStoreSite_t.java
dbc1c279ce35fdf7bdcb2632d56aa97eab76f909
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
133,543
java
/*************************************************************************** * Copyright (C) 2012 by H-Store Project * * Brown University * * Massachusetts Institute of Technology * * Yale University * * * * 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 BE LIABLE FOR ANY CLAIM, DAMAGES OR * * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * * OTHER DEALINGS IN THE SOFTWARE. * ***************************************************************************/ package edu.brown.hstore; import java.io.File; import java.io.IOException; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.ConcurrentModificationException; import java.util.HashMap; import java.util.IdentityHashMap; import java.util.List; import java.util.Map; import java.util.Queue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; import org.apache.commons.collections15.buffer.CircularFifoBuffer; import org.apache.log4j.Logger; import org.voltdb.CatalogContext; import org.voltdb.ClientResponseImpl; import org.voltdb.MemoryStats; import org.voltdb.ParameterSet; import org.voltdb.StatsAgent; import org.voltdb.StatsSource; import org.voltdb.StoredProcedureInvocation; import org.voltdb.SysProcSelector; import org.voltdb.TransactionIdManager; import org.voltdb.catalog.Database; import org.voltdb.catalog.Host; import org.voltdb.catalog.Procedure; import org.voltdb.catalog.Site; import org.voltdb.catalog.Table; import org.voltdb.compiler.AdHocPlannedStmt; import org.voltdb.compiler.AsyncCompilerResult; import org.voltdb.compiler.AsyncCompilerWorkThread; import org.voltdb.exceptions.ClientConnectionLostException; import org.voltdb.exceptions.EvictedTupleAccessException; import org.voltdb.exceptions.MispredictionException; import org.voltdb.exceptions.SerializableException; import org.voltdb.exceptions.ServerFaultException; import org.voltdb.messaging.FastDeserializer; import org.voltdb.messaging.FastSerializer; import org.voltdb.network.Connection; import org.voltdb.network.VoltNetwork; import org.voltdb.utils.DBBPool; import org.voltdb.utils.EstTime; import org.voltdb.utils.EstTimeUpdater; import org.voltdb.utils.Pair; import org.voltdb.utils.SystemStatsCollector; import com.google.protobuf.RpcCallback; import edu.brown.catalog.CatalogUtil; import edu.brown.hashing.AbstractHasher; import edu.brown.hstore.ClientInterface.ClientInputHandler; import edu.brown.hstore.HStoreThreadManager.ThreadGroupType; import edu.brown.hstore.Hstoreservice.QueryEstimate; import edu.brown.hstore.Hstoreservice.Status; import edu.brown.hstore.Hstoreservice.WorkFragment; import edu.brown.hstore.callbacks.ClientResponseCallback; import edu.brown.hstore.callbacks.LocalInitQueueCallback; import edu.brown.hstore.callbacks.LocalFinishCallback; import edu.brown.hstore.callbacks.PartitionCountingCallback; import edu.brown.hstore.callbacks.RedirectCallback; import edu.brown.hstore.cmdlog.CommandLogWriter; import edu.brown.hstore.conf.HStoreConf; import edu.brown.hstore.estimators.EstimatorState; import edu.brown.hstore.estimators.TransactionEstimator; import edu.brown.hstore.estimators.remote.RemoteEstimator; import edu.brown.hstore.estimators.remote.RemoteEstimatorState; import edu.brown.hstore.internal.SetDistributedTxnMessage; import edu.brown.hstore.stats.AntiCacheManagerProfilerStats; import edu.brown.hstore.stats.BatchPlannerProfilerStats; import edu.brown.hstore.stats.MarkovEstimatorProfilerStats; import edu.brown.hstore.stats.PartitionExecutorProfilerStats; import edu.brown.hstore.stats.PoolCounterStats; import edu.brown.hstore.stats.SiteProfilerStats; import edu.brown.hstore.stats.SpecExecProfilerStats; import edu.brown.hstore.stats.TransactionCounterStats; import edu.brown.hstore.stats.TransactionProfilerStats; import edu.brown.hstore.stats.TransactionQueueManagerProfilerStats; import edu.brown.hstore.txns.AbstractTransaction; import edu.brown.hstore.txns.LocalTransaction; import edu.brown.hstore.txns.MapReduceTransaction; import edu.brown.hstore.txns.RemoteTransaction; import edu.brown.hstore.util.MapReduceHelperThread; import edu.brown.hstore.util.TransactionCounter; import edu.brown.interfaces.Configurable; import edu.brown.interfaces.DebugContext; import edu.brown.interfaces.Shutdownable; import edu.brown.logging.LoggerUtil; import edu.brown.logging.LoggerUtil.LoggerBoolean; import edu.brown.logging.RingBufferAppender; import edu.brown.markov.EstimationThresholds; import edu.brown.plannodes.PlanNodeUtil; import edu.brown.profilers.HStoreSiteProfiler; import edu.brown.statistics.FastIntHistogram; import edu.brown.utils.ClassUtil; import edu.brown.utils.CollectionUtil; import edu.brown.utils.EventObservable; import edu.brown.utils.EventObservableExceptionHandler; import edu.brown.utils.EventObserver; import edu.brown.utils.ExceptionHandlingRunnable; import edu.brown.utils.PartitionEstimator; import edu.brown.utils.PartitionSet; import edu.brown.utils.StringUtil; /** * THE ALL POWERFUL H-STORE SITE! * This is the central hub for a site and all of its partitions * All incoming transactions come into this and all transactions leave through this * @author pavlo */ public class HStoreSite implements VoltProcedureListener.Handler, Shutdownable, Configurable, Runnable { public static final Logger LOG = Logger.getLogger(HStoreSite.class); private static final LoggerBoolean debug = new LoggerBoolean(LOG.isDebugEnabled()); private static final LoggerBoolean trace = new LoggerBoolean(LOG.isTraceEnabled()); static { LoggerUtil.setupLogging(); LoggerUtil.attachObserver(LOG, debug, trace); } // ---------------------------------------------------------------------------- // INSTANCE MEMBERS // ---------------------------------------------------------------------------- /** * The H-Store Configuration Object */ private final HStoreConf hstore_conf; /** Catalog Stuff **/ private long instanceId; private final CatalogContext catalogContext; private final Host catalog_host; private final Site catalog_site; private final int site_id; private final String site_name; /** * This buffer pool is used to serialize ClientResponses to send back * to clients. */ private final DBBPool buffer_pool = new DBBPool(false, false); /** * Incoming request deserializer */ private final IdentityHashMap<Thread, FastDeserializer> incomingDeserializers = new IdentityHashMap<Thread, FastDeserializer>(); /** * Outgoing response serializers */ private final IdentityHashMap<Thread, FastSerializer> outgoingSerializers = new IdentityHashMap<Thread, FastSerializer>(); /** * This is the object that we use to generate unqiue txn ids used by our * H-Store specific code. There can either be a single manager for the entire site, * or we can use one per partition. * @see HStoreConf.site.txn_partition_id_managers */ private final TransactionIdManager txnIdManagers[]; /** * The TransactionInitializer is used to figure out what txns will do * before we start executing them */ private final TransactionInitializer txnInitializer; /** * This class determines what partitions transactions/queries will * need to execute on based on their input parameters. */ private final PartitionEstimator p_estimator; private final AbstractHasher hasher; /** * Keep track of which txns that we have in-flight right now */ private final Map<Long, AbstractTransaction> inflight_txns = new ConcurrentHashMap<Long, AbstractTransaction>(); /** * Queues for transactions that are ready to be cleaned up and deleted * There is one queue for each Status type */ private final Map<Status, Queue<Long>> deletable_txns = new HashMap<Status, Queue<Long>>(); /** * The list of the last txn ids that were successfully deleted * This is primarily used for debugging */ private final CircularFifoBuffer<String> deletable_last = new CircularFifoBuffer<String>(10); /** * Reusable Object Pools */ private final HStoreObjectPools objectPools; /** * This TransactionEstimator is a stand-in for transactions that need to access * this partition but who are running at some other node in the cluster. */ private final RemoteEstimator remoteTxnEstimator; // ---------------------------------------------------------------------------- // STATS STUFF // ---------------------------------------------------------------------------- private final StatsAgent statsAgent = new StatsAgent(); private TransactionProfilerStats txnProfilerStats; private MemoryStats memoryStats; // ---------------------------------------------------------------------------- // NETWORKING STUFF // ---------------------------------------------------------------------------- /** * This thread is responsible for listening for incoming txn requests from * clients. It will then forward the request to HStoreSite.procedureInvocation() */ // private VoltProcedureListener voltListeners[]; // private final NIOEventLoop procEventLoops[]; private final VoltNetwork voltNetwork; private ClientInterface clientInterface; // ---------------------------------------------------------------------------- // TRANSACTION COORDINATOR/PROCESSING THREADS // ---------------------------------------------------------------------------- /** * This manager is used to pin threads to specific CPU cores */ private final HStoreThreadManager threadManager; /** * PartitionExecutors * These are the single-threaded execution engines that have exclusive * access to a partition. Any transaction that needs to access data at a partition * will have to first get queued up by one of these executors. */ private final PartitionExecutor executors[]; private final Thread executor_threads[]; /** * The queue manager is responsible for deciding what distributed transaction * is allowed to acquire the locks for each partition. It can also requeue * restart transactions. */ private final TransactionQueueManager txnQueueManager; /** * The HStoreCoordinator is responsible for communicating with other HStoreSites * in the cluster to execute distributed transactions. * NOTE: We will bind this variable after construction so that we can inject some * testing code as needed. */ private HStoreCoordinator hstore_coordinator; /** * TransactionPreProcessor Threads */ private List<TransactionPreProcessor> preProcessors = null; private BlockingQueue<Pair<ByteBuffer, RpcCallback<ClientResponseImpl>>> preProcessorQueue = null; /** * TransactionPostProcessor Thread * These threads allow a PartitionExecutor to send back ClientResponses back to * the clients without blocking */ private List<TransactionPostProcessor> postProcessors = null; private BlockingQueue<Object[]> postProcessorQueue = null; /** * Transaction Handle Cleaner */ private final List<TransactionCleaner> txnCleaners = new ArrayList<TransactionCleaner>(); /** * MapReduceHelperThread */ private boolean mr_helper_started = false; private final MapReduceHelperThread mr_helper; /** * Transaction Command Logger (WAL) */ private final CommandLogWriter commandLogger; /** * AdHoc: This thread waits for AdHoc queries. */ private boolean adhoc_helper_started = false; private final AsyncCompilerWorkThread asyncCompilerWork_thread; /** * Anti-Cache Abstraction Layer */ private final AntiCacheManager anticacheManager; /** * This catches any exceptions that are thrown in the various * threads spawned by this HStoreSite */ private final EventObservableExceptionHandler exceptionHandler = new EventObservableExceptionHandler(); // ---------------------------------------------------------------------------- // INTERNAL STATE OBSERVABLES // ---------------------------------------------------------------------------- /** * EventObservable for when the HStoreSite is finished initializing * and is now ready to execute transactions. */ private boolean ready = false; private final EventObservable<HStoreSite> ready_observable = new EventObservable<HStoreSite>(); /** * EventObservable for when we receive the first non-sysproc stored procedure * Other components of the system can attach to the EventObservable to be told when this occurs */ private boolean startWorkload = false; private final EventObservable<HStoreSite> startWorkload_observable = new EventObservable<HStoreSite>(); /** * EventObservable for when the HStoreSite has been told that it needs to shutdown. */ private Shutdownable.ShutdownState shutdown_state = ShutdownState.INITIALIZED; private final EventObservable<Object> prepare_observable = new EventObservable<Object>(); private final EventObservable<Object> shutdown_observable = new EventObservable<Object>(); // ---------------------------------------------------------------------------- // PARTITION SPECIFIC MEMBERS // ---------------------------------------------------------------------------- /** * Collection of local partitions managed at this HStoreSite */ private final PartitionSet local_partitions = new PartitionSet(); /** * PartitionId -> Internal Offset * This is so that we don't have to keep long arrays of local partition information */ private final int local_partition_offsets[]; // ---------------------------------------------------------------------------- // TRANSACTION ESTIMATION // ---------------------------------------------------------------------------- /** * Estimation Thresholds */ private EstimationThresholds thresholds = new EstimationThresholds(); // default values // ---------------------------------------------------------------------------- // STATUS + PROFILING MEMBERS // ---------------------------------------------------------------------------- /** * Status Monitor */ private final HStoreSiteStatus status_monitor; /** * Profiler */ private HStoreSiteProfiler profiler = new HStoreSiteProfiler(); // ---------------------------------------------------------------------------- // CACHED STRINGS // ---------------------------------------------------------------------------- private final String REJECTION_MESSAGE; // ---------------------------------------------------------------------------- // CONSTRUCTOR // ---------------------------------------------------------------------------- /** * Constructor * @param coordinators * @param p_estimator */ protected HStoreSite(int site_id, CatalogContext catalogContext, HStoreConf hstore_conf) { assert(hstore_conf != null); assert(catalogContext != null); this.hstore_conf = hstore_conf; this.catalogContext = catalogContext; this.catalog_site = this.catalogContext.getSiteById(site_id); if (this.catalog_site == null) throw new RuntimeException("Invalid site #" + site_id); this.catalog_host = this.catalog_site.getHost(); this.site_id = this.catalog_site.getId(); this.site_name = HStoreThreadManager.getThreadName(this.site_id, null); final int num_partitions = this.catalogContext.numberOfPartitions; this.local_partitions.addAll(CatalogUtil.getLocalPartitionIds(catalog_site)); int num_local_partitions = this.local_partitions.size(); for (Status s : Status.values()) { this.deletable_txns.put(s, new ConcurrentLinkedQueue<Long>()); } // FOR this.executors = new PartitionExecutor[num_partitions]; this.executor_threads = new Thread[num_partitions]; // Get the hasher we will use for this HStoreSite this.hasher = ClassUtil.newInstance(hstore_conf.global.hasherClass, new Object[]{ this.catalogContext.database, num_partitions }, new Class<?>[]{ Database.class, int.class }); this.p_estimator = new PartitionEstimator(this.catalogContext, this.hasher); this.remoteTxnEstimator = new RemoteEstimator(this.p_estimator); // **IMPORTANT** // Always clear out the CatalogUtil and BatchPlanner before we start our new HStoreSite // TODO: Move this cache information into CatalogContext CatalogUtil.clearCache(this.catalogContext.database); BatchPlanner.clear(this.catalogContext.numberOfPartitions); TransactionCounter.resetAll(this.catalogContext); // Only preload stuff if we were asked to if (hstore_conf.site.preload) { if (debug.val) LOG.debug("Preloading cached objects"); try { // Don't forget our CatalogUtil friend! CatalogUtil.preload(this.catalogContext.database); // Load up everything the QueryPlanUtil PlanNodeUtil.preload(this.catalogContext.database); // Then load up everything in the PartitionEstimator this.p_estimator.preload(); } catch (Exception ex) { throw new RuntimeException("Failed to prepare HStoreSite", ex); } } // Offset Hack this.local_partition_offsets = new int[num_partitions]; Arrays.fill(this.local_partition_offsets, HStoreConstants.NULL_PARTITION_ID); int offset = 0; for (int partition : this.local_partitions) { this.local_partition_offsets[partition] = offset++; } // FOR // Object Pools this.objectPools = new HStoreObjectPools(this); // ------------------------------- // THREADS // ------------------------------- EventObserver<Pair<Thread, Throwable>> observer = new EventObserver<Pair<Thread, Throwable>>() { @Override public void update(EventObservable<Pair<Thread, Throwable>> o, Pair<Thread, Throwable> arg) { Thread thread = arg.getFirst(); Throwable error = arg.getSecond(); String threadName = "<unknown>"; if (thread != null) threadName = thread.getName(); LOG.fatal(String.format("Thread %s had a fatal error: %s", threadName, (error != null ? error.getMessage() : null))); error.printStackTrace(); hstore_coordinator.shutdownClusterBlocking(error); } }; this.exceptionHandler.addObserver(observer); Thread.setDefaultUncaughtExceptionHandler(this.exceptionHandler); // HStoreSite Thread Manager (this always get invoked first) this.threadManager = new HStoreThreadManager(this); // Distributed Transaction Queue Manager this.txnQueueManager = new TransactionQueueManager(this); // One Transaction Cleaner for every eight partitions int numCleaners = (int)Math.ceil(num_local_partitions / 8.0); for (int i = 0; i < numCleaners; i++) { this.txnCleaners.add(new TransactionCleaner(this)); } // FOR // MapReduce Transaction helper thread if (catalogContext.getMapReduceProcedures().isEmpty() == false) { this.mr_helper = new MapReduceHelperThread(this); } else { this.mr_helper = null; } // Separate TransactionIdManager per partition if (hstore_conf.site.txn_partition_id_managers) { this.txnIdManagers = new TransactionIdManager[num_partitions]; for (int partition : this.local_partitions) { this.txnIdManagers[partition] = new TransactionIdManager(partition); } // FOR } // Single TransactionIdManager for the entire site else { this.txnIdManagers = new TransactionIdManager[] { new TransactionIdManager(this.site_id) }; } // Command Logger if (hstore_conf.site.commandlog_enable) { // It would be nice if we could come up with a unique name for this // invocation of the system (like the cluster instanceId). But for now // we'll just write out to our directory... File logFile = new File(hstore_conf.site.commandlog_dir + File.separator + this.getSiteName().toLowerCase() + ".log"); this.commandLogger = new CommandLogWriter(this, logFile); } else { this.commandLogger = null; } // AdHoc Support if (hstore_conf.site.exec_adhoc_sql) { this.asyncCompilerWork_thread = new AsyncCompilerWorkThread(this, this.site_id); } else { this.asyncCompilerWork_thread = null; } // The AntiCacheManager will allow us to do special things down in the EE // for evicted tuples if (hstore_conf.site.anticache_enable) { this.anticacheManager = new AntiCacheManager(this); } else { this.anticacheManager = null; } // ------------------------------- // NETWORK SETUP // ------------------------------- this.voltNetwork = new VoltNetwork(this); this.clientInterface = new ClientInterface(this, this.catalog_site.getProc_port()); // ------------------------------- // TRANSACTION ESTIMATION // ------------------------------- // Transaction Properties Initializer this.txnInitializer = new TransactionInitializer(this); // CACHED MESSAGES this.REJECTION_MESSAGE = "Transaction was rejected by " + this.getSiteName(); // ------------------------------- // STATS SETUP // ------------------------------- this.initTxnProcessors(); this.initStatSources(); // Profiling if (hstore_conf.site.profiling) { this.profiler = new HStoreSiteProfiler(); if (hstore_conf.site.status_exec_info) { this.profiler.network_idle.resetOnEventObservable(this.startWorkload_observable); } } else { this.profiler = null; } this.status_monitor = new HStoreSiteStatus(this, hstore_conf); LoggerUtil.refreshLogging(hstore_conf.global.log_refresh); } // ---------------------------------------------------------------------------- // INITIALIZATION STUFF // ---------------------------------------------------------------------------- /** * Initializes all the pieces that we need to start this HStore site up * This should only be called by our run() method */ protected HStoreSite init() { if (debug.val) LOG.debug("Initializing HStoreSite " + this.getSiteName()); this.hstore_coordinator = this.initHStoreCoordinator(); // First we need to tell the HStoreCoordinator to start-up and initialize its connections if (debug.val) LOG.debug("Starting HStoreCoordinator for " + this.getSiteName()); this.hstore_coordinator.start(); ThreadGroup auxGroup = this.threadManager.getThreadGroup(ThreadGroupType.AUXILIARY); // Start TransactionQueueManager Thread t = new Thread(auxGroup, this.txnQueueManager); t.setDaemon(true); t.setUncaughtExceptionHandler(this.exceptionHandler); t.start(); // Start VoltNetwork t = new Thread(this.voltNetwork); t.setName(HStoreThreadManager.getThreadName(this, HStoreConstants.THREAD_NAME_VOLTNETWORK)); t.setDaemon(true); t.setUncaughtExceptionHandler(this.exceptionHandler); t.start(); // Start CommandLogWriter t = new Thread(auxGroup, this.commandLogger); t.setDaemon(true); t.setUncaughtExceptionHandler(this.exceptionHandler); t.start(); // Start AntiCacheManager Queue Processor if (this.anticacheManager != null && this.anticacheManager.getEvictableTables().isEmpty() == false) { t = new Thread(auxGroup, this.anticacheManager); t.setDaemon(true); t.setUncaughtExceptionHandler(this.exceptionHandler); t.start(); } // TransactionPreProcessors if (this.preProcessors != null) { for (TransactionPreProcessor tpp : this.preProcessors) { t = new Thread(this.threadManager.getThreadGroup(ThreadGroupType.PROCESSING), tpp); t.setDaemon(true); t.setUncaughtExceptionHandler(this.exceptionHandler); t.start(); } // FOR } // TransactionPostProcessors if (this.postProcessors != null) { for (TransactionPostProcessor tpp : this.postProcessors) { t = new Thread(this.threadManager.getThreadGroup(ThreadGroupType.PROCESSING), tpp); t.setDaemon(true); t.setUncaughtExceptionHandler(this.exceptionHandler); t.start(); } // FOR } // Then we need to start all of the PartitionExecutor in threads if (debug.val) LOG.debug(String.format("Starting PartitionExecutor threads for %s partitions on %s", this.local_partitions.size(), this.getSiteName())); for (int partition : this.local_partitions.values()) { PartitionExecutor executor = this.getPartitionExecutor(partition); executor.initHStoreSite(this); t = new Thread(this.threadManager.getThreadGroup(ThreadGroupType.EXECUTION), executor); t.setDaemon(true); t.setPriority(Thread.MAX_PRIORITY); // Probably does nothing... t.setUncaughtExceptionHandler(this.exceptionHandler); this.executor_threads[partition] = t; t.start(); } // FOR // Start Transaction Cleaners int i = 0; for (TransactionCleaner cleaner : this.txnCleaners) { String name = String.format("%s-%02d", HStoreThreadManager.getThreadName(this, HStoreConstants.THREAD_NAME_TXNCLEANER), i); t = new Thread(this.threadManager.getThreadGroup(ThreadGroupType.CLEANER), cleaner); t.setName(name); t.setDaemon(true); t.setUncaughtExceptionHandler(this.exceptionHandler); t.start(); i += 1; } // FOR this.initPeriodicWorks(); // Add in our shutdown hook // Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownHook())); return (this); } private void initTxnProcessors() { if (hstore_conf.site.exec_preprocessing_threads == false && hstore_conf.site.exec_postprocessing_threads == false) { return; } // Transaction Pre/Post Processing Threads // We need at least one core per partition and one core for the VoltProcedureListener // Everything else we can give to the pre/post processing guys final int num_local_partitions = this.local_partitions.size(); int num_available_cores = this.threadManager.getNumCores() - (num_local_partitions + 1); // If there are no available cores left, then we won't create any extra processors if (num_available_cores <= 0) { LOG.warn("Insufficient number of cores on " + catalog_host.getIpaddr() + ". " + "Disabling transaction pre/post processing threads"); hstore_conf.site.exec_preprocessing_threads = false; hstore_conf.site.exec_postprocessing_threads = false; return; } int num_preProcessors = 0; int num_postProcessors = 0; // Both Types of Processors if (hstore_conf.site.exec_preprocessing_threads && hstore_conf.site.exec_postprocessing_threads) { int split = (int)Math.ceil(num_available_cores / 2d); num_preProcessors = split; } // TransactionPreProcessor Only else if (hstore_conf.site.exec_preprocessing_threads) { num_preProcessors = num_available_cores; } // We only need one TransactionPostProcessor per HStoreSite if (hstore_conf.site.exec_postprocessing_threads) { num_postProcessors = 1; } // Overrides if (hstore_conf.site.exec_preprocessing_threads_count >= 0) { num_preProcessors = hstore_conf.site.exec_preprocessing_threads_count; } // Initialize TransactionPreProcessors if (num_preProcessors > 0) { if (debug.val) LOG.debug(String.format("Starting %d %s threads", num_preProcessors, TransactionPreProcessor.class.getSimpleName())); this.preProcessors = new ArrayList<TransactionPreProcessor>(); this.preProcessorQueue = new LinkedBlockingQueue<Pair<ByteBuffer, RpcCallback<ClientResponseImpl>>>(); for (int i = 0; i < num_preProcessors; i++) { TransactionPreProcessor t = new TransactionPreProcessor(this, this.preProcessorQueue); this.preProcessors.add(t); } // FOR } // Initialize TransactionPostProcessors if (num_postProcessors > 0) { if (debug.val) LOG.debug(String.format("Starting %d %s threads", num_postProcessors, TransactionPostProcessor.class.getSimpleName())); this.postProcessors = new ArrayList<TransactionPostProcessor>(); this.postProcessorQueue = new LinkedBlockingQueue<Object[]>(); for (int i = 0; i < num_postProcessors; i++) { TransactionPostProcessor t = new TransactionPostProcessor(this, this.postProcessorQueue); this.postProcessors.add(t); } // FOR } } /** * Initial internal stats sources */ private void initStatSources() { StatsSource statsSource = null; // TXN PROFILERS this.txnProfilerStats = new TransactionProfilerStats(this.catalogContext); this.statsAgent.registerStatsSource(SysProcSelector.TXNPROFILER, 0, this.txnProfilerStats); // MEMORY this.memoryStats = new MemoryStats(); this.statsAgent.registerStatsSource(SysProcSelector.MEMORY, 0, this.memoryStats); // TXN COUNTERS statsSource = new TransactionCounterStats(this.catalogContext); this.statsAgent.registerStatsSource(SysProcSelector.TXNCOUNTER, 0, statsSource); // EXECUTOR PROFILERS statsSource = new PartitionExecutorProfilerStats(this); this.statsAgent.registerStatsSource(SysProcSelector.EXECPROFILER, 0, statsSource); // QUEUE PROFILER statsSource = new TransactionQueueManagerProfilerStats(this); this.statsAgent.registerStatsSource(SysProcSelector.QUEUEPROFILER, 0, statsSource); // ANTI-CACHE PROFILER statsSource = new AntiCacheManagerProfilerStats(this); this.statsAgent.registerStatsSource(SysProcSelector.ANTICACHE, 0, statsSource); // MARKOV ESTIMATOR PROFILER statsSource = new MarkovEstimatorProfilerStats(this); this.statsAgent.registerStatsSource(SysProcSelector.MARKOVPROFILER, 0, statsSource); // SPECEXEC PROFILER statsSource = new SpecExecProfilerStats(this); this.statsAgent.registerStatsSource(SysProcSelector.SPECEXECPROFILER, 0, statsSource); // CLIENT INTERFACE PROFILER statsSource = new SiteProfilerStats(this); this.statsAgent.registerStatsSource(SysProcSelector.SITEPROFILER, 0, statsSource); // BATCH PLANNER PROFILER statsSource = new BatchPlannerProfilerStats(this, this.catalogContext); this.statsAgent.registerStatsSource(SysProcSelector.PLANNERPROFILER, 0, statsSource); // OBJECT POOL COUNTERS statsSource = new PoolCounterStats(this.objectPools); this.statsAgent.registerStatsSource(SysProcSelector.POOL, 0, statsSource); } /** * Schedule all the periodic works */ private void initPeriodicWorks() { // Make sure that we always initialize the periodic thread so that // we can ensure that it only shows up on the cores that we want it to. this.threadManager.initPerioidicThread(); // Periodic Work Processor this.threadManager.schedulePeriodicWork(new ExceptionHandlingRunnable() { @Override public void runImpl() { try { HStoreSite.this.processPeriodicWork(); } catch (Throwable ex) { ex.printStackTrace(); } } }, 0, hstore_conf.site.exec_periodic_interval, TimeUnit.MILLISECONDS); // HStoreStatus if (hstore_conf.site.status_enable) { this.threadManager.schedulePeriodicWork( this.status_monitor, hstore_conf.site.status_interval, hstore_conf.site.status_interval, TimeUnit.MILLISECONDS); } // AntiCache Memory Monitor if (this.anticacheManager != null) { if (this.anticacheManager.getEvictableTables().isEmpty() == false) { this.threadManager.schedulePeriodicWork( this.anticacheManager.getMemoryMonitorThread(), hstore_conf.site.anticache_check_interval, hstore_conf.site.anticache_check_interval, TimeUnit.MILLISECONDS); } else { LOG.warn("There are no tables marked as evictable. Disabling anti-cache monitoring"); } } // small stats samples this.threadManager.schedulePeriodicWork(new ExceptionHandlingRunnable() { @Override public void runImpl() { SystemStatsCollector.asyncSampleSystemNow(false, false); } }, 0, 5, TimeUnit.SECONDS); // medium stats samples this.threadManager.schedulePeriodicWork(new ExceptionHandlingRunnable() { @Override public void runImpl() { SystemStatsCollector.asyncSampleSystemNow(true, false); } }, 0, 1, TimeUnit.MINUTES); // large stats samples this.threadManager.schedulePeriodicWork(new ExceptionHandlingRunnable() { @Override public void runImpl() { SystemStatsCollector.asyncSampleSystemNow(true, true); } }, 0, 6, TimeUnit.MINUTES); } // ---------------------------------------------------------------------------- // INTERFACE METHODS // ---------------------------------------------------------------------------- @Override public void updateConf(HStoreConf hstore_conf) { if (hstore_conf.site.profiling && this.profiler == null) { this.profiler = new HStoreSiteProfiler(); } // Push the updates to all of our PartitionExecutors for (PartitionExecutor executor : this.executors) { if (executor == null) continue; executor.updateConf(hstore_conf); } // FOR // Update all our other boys this.clientInterface.updateConf(hstore_conf); this.objectPools.updateConf(hstore_conf); this.txnQueueManager.updateConf(hstore_conf); } // ---------------------------------------------------------------------------- // ADDITIONAL INITIALIZATION METHODS // ---------------------------------------------------------------------------- public void addPartitionExecutor(int partition, PartitionExecutor executor) { assert(this.shutdown_state != ShutdownState.STARTED); assert(executor != null); this.executors[partition] = executor; } /** * Return a new HStoreCoordinator for this HStoreSite. Note that this * should only be called by HStoreSite.init(), otherwise the * internal state for this HStoreSite will be incorrect. If you want * the HStoreCoordinator at runtime, use HStoreSite.getHStoreCoordinator() * @return */ protected HStoreCoordinator initHStoreCoordinator() { assert(this.shutdown_state != ShutdownState.STARTED); return new HStoreCoordinator(this); } protected void setTransactionIdManagerTimeDelta(long delta) { for (TransactionIdManager t : this.txnIdManagers) { if (t != null) t.setTimeDelta(delta); } // FOR } protected void setThresholds(EstimationThresholds thresholds) { this.thresholds = thresholds; if (debug.val) LOG.debug("Set new EstimationThresholds: " + thresholds); } // ---------------------------------------------------------------------------- // CATALOG METHODS // ---------------------------------------------------------------------------- /** * Return the CatalogContext handle used for this HStoreSite instance * @return */ public CatalogContext getCatalogContext() { return (this.catalogContext); } /** * Return the Site catalog object for this HStoreSite */ public Site getSite() { return (this.catalog_site); } public int getSiteId() { return (this.site_id); } public String getSiteName() { return (this.site_name); } public Host getHost() { return (this.catalog_host); } public int getHostId() { return (this.catalog_host.getId()); } /** * Return the list of partition ids managed by this HStoreSite * TODO: Moved to CatalogContext */ public PartitionSet getLocalPartitionIds() { return (this.local_partitions); } /** * Returns true if the given partition id is managed by this HStoreSite * @param partition * @return */ public boolean isLocalPartition(int partition) { assert(partition >= 0); assert(partition < this.local_partition_offsets.length) : String.format("Invalid partition %d - %s", partition, this.catalogContext.getAllPartitionIds()); return (this.local_partition_offsets[partition] != -1); } /** * Returns true if the given PartitoinSet contains partitions that are all * is managed by this HStoreSite * @param partitions * @return */ public boolean isLocalPartitions(PartitionSet partitions) { for (int p : partitions.values()) { if (this.local_partition_offsets[p] == -1) { return (false); } } // FOR return (true); } // ---------------------------------------------------------------------------- // THREAD UTILITY METHODS // ---------------------------------------------------------------------------- protected final Thread.UncaughtExceptionHandler getExceptionHandler() { return (this.exceptionHandler); } /** * Start the MapReduceHelper Thread */ private void startMapReduceHelper() { synchronized (this.mr_helper) { if (this.mr_helper_started) return; if (debug.val) LOG.debug("Starting " + this.mr_helper.getClass().getSimpleName()); Thread t = new Thread(this.mr_helper); t.setDaemon(true); t.setUncaughtExceptionHandler(this.exceptionHandler); t.start(); this.mr_helper_started = true; } // SYNCH } /** * Start threads for processing AdHoc queries */ private void startAdHocHelper() { synchronized (this.asyncCompilerWork_thread) { if (this.adhoc_helper_started) return; if (debug.val) LOG.debug("Starting " + this.asyncCompilerWork_thread.getClass().getSimpleName()); this.asyncCompilerWork_thread.start(); this.adhoc_helper_started = true; } // SYNCH } /** * Get the MapReduce Helper thread */ public MapReduceHelperThread getMapReduceHelper() { return (this.mr_helper); } // ---------------------------------------------------------------------------- // UTILITY METHODS // ---------------------------------------------------------------------------- @Override public long getInstanceId() { return (this.instanceId); } protected void setInstanceId(long instanceId) { if (debug.val) LOG.debug("Setting Cluster InstanceId: " + instanceId); this.instanceId = instanceId; } public HStoreCoordinator getCoordinator() { return (this.hstore_coordinator); } public HStoreConf getHStoreConf() { return (this.hstore_conf); } public HStoreObjectPools getObjectPools() { return (this.objectPools); } public TransactionQueueManager getTransactionQueueManager() { return (this.txnQueueManager); } public AntiCacheManager getAntiCacheManager() { return (this.anticacheManager); } public ClientInterface getClientInterface() { return (this.clientInterface); } public StatsAgent getStatsAgent() { return (this.statsAgent); } public VoltNetwork getVoltNetwork() { return (this.voltNetwork); } public EstimationThresholds getThresholds() { return thresholds; } public HStoreSiteProfiler getProfiler() { return (this.profiler); } public DBBPool getBufferPool() { return (this.buffer_pool); } public CommandLogWriter getCommandLogWriter() { return (this.commandLogger); } protected final Map<Long, AbstractTransaction> getInflightTxns() { return (this.inflight_txns); } protected final Map<Status, Queue<Long>> getDeletableQueues() { return (this.deletable_txns); } protected final String getRejectionMessage() { return (this.REJECTION_MESSAGE); } /** * Convenience method to dump out status of this HStoreSite * @return */ public String statusSnapshot() { return new HStoreSiteStatus(this, hstore_conf).snapshot(true, true, false, false); } public HStoreThreadManager getThreadManager() { return (this.threadManager); } public PartitionEstimator getPartitionEstimator() { return (this.p_estimator); } public AbstractHasher getHasher() { return (this.hasher); } public TransactionInitializer getTransactionInitializer() { return (this.txnInitializer); } public PartitionExecutor getPartitionExecutor(int partition) { PartitionExecutor es = this.executors[partition]; assert(es != null) : String.format("Unexpected null PartitionExecutor for partition #%d on %s", partition, this.getSiteName()); return (es); } public MemoryStats getMemoryStatsSource() { return (this.memoryStats); } public Collection<TransactionPreProcessor> getTransactionPreProcessors() { return (this.preProcessors); } public boolean hasTransactionPreProcessors() { return (this.preProcessors != null && this.preProcessors.isEmpty() == false); } public Collection<TransactionPostProcessor> getTransactionPostProcessors() { return (this.postProcessors); } public boolean hasTransactionPostProcessors() { return (this.postProcessors != null && this.postProcessors.isEmpty() == false); } /** * Get the TransactionIdManager for the given partition * If there are not separate managers per partition, we will just * return the global one for this HStoreSite * @param partition * @return */ public TransactionIdManager getTransactionIdManager(int partition) { if (this.txnIdManagers.length == 1) { return (this.txnIdManagers[0]); } else { return (this.txnIdManagers[partition]); } } @SuppressWarnings("unchecked") public <T extends AbstractTransaction> T getTransaction(Long txn_id) { return ((T)this.inflight_txns.get(txn_id)); } /** * Return a thread-safe FastDeserializer * @return */ private FastDeserializer getIncomingDeserializer() { Thread t = Thread.currentThread(); FastDeserializer fds = this.incomingDeserializers.get(t); if (fds == null) { fds = new FastDeserializer(new byte[0]); this.incomingDeserializers.put(t, fds); } assert(fds != null); return (fds); } /** * Return a thread-safe FastSerializer * @return */ private FastSerializer getOutgoingSerializer() { Thread t = Thread.currentThread(); FastSerializer fs = this.outgoingSerializers.get(t); if (fs == null) { fs = new FastSerializer(this.buffer_pool); this.outgoingSerializers.put(t, fs); } assert(fs != null); return (fs); } // ---------------------------------------------------------------------------- // LOCAL PARTITION OFFSETS // ---------------------------------------------------------------------------- /** * For the given partition id, return its offset in the list of * all the local partition ids managed by this HStoreSite. * This will fail if the given partition is not local to this HStoreSite. * @param partition * @return */ @Deprecated public int getLocalPartitionOffset(int partition) { assert(partition < this.local_partition_offsets.length) : String.format("Unable to get offset of local partition %d %s [hashCode=%d]", partition, Arrays.toString(this.local_partition_offsets), this.hashCode()); return this.local_partition_offsets[partition]; } // ---------------------------------------------------------------------------- // EVENT OBSERVABLES // ---------------------------------------------------------------------------- /** * Get the Observable handle for this HStoreSite that can alert others when the party is * getting started */ public EventObservable<HStoreSite> getReadyObservable() { return (this.ready_observable); } /** * Get the Observable handle for this HStore for when the first non-sysproc * transaction request arrives and we are technically beginning the workload * portion of a benchmark run. */ public EventObservable<HStoreSite> getStartWorkloadObservable() { return (this.startWorkload_observable); } private synchronized void notifyStartWorkload() { if (this.startWorkload == false) { this.startWorkload = true; this.startWorkload_observable.notifyObservers(this); } } /** * Get the EventObservable handle for this HStoreSite that can alert * others when we have gotten a message to prepare to shutdown * @return */ public EventObservable<Object> getPrepareShutdownObservable() { return (this.prepare_observable); } /** * Get the EventObservable handle for this HStoreSite that can alert * others when the party is ending * @return */ public EventObservable<Object> getShutdownObservable() { return (this.shutdown_observable); } /** * Launch all of the threads needed by this HStoreSite. This is a blocking call */ @Override public void run() { if (this.ready) { throw new RuntimeException("Trying to start " + this.getSiteName() + " more than once"); } this.init(); try { this.clientInterface.startAcceptingConnections(); } catch (Exception ex) { throw new RuntimeException(ex); } this.shutdown_state = ShutdownState.STARTED; // if (hstore_conf.site.network_profiling) { // this.profiler.network_idle_time.start(); // } this.ready = true; this.ready_observable.notifyObservers(this); // IMPORTANT: This message must always be printed in order for the BenchmarkController // to know that we're ready! That's why we have to use System.out instead of LOG String msg = String.format("%s : Site=%s / Address=%s:%d / Partitions=%s", HStoreConstants.SITE_READY_MSG, this.getSiteName(), this.catalog_site.getHost().getIpaddr(), CollectionUtil.first(CatalogUtil.getExecutionSitePorts(this.catalog_site)), this.local_partitions); System.out.println(msg); System.out.flush(); // We will join on our HStoreCoordinator thread. When that goes // down then we know that the whole party is over try { this.hstore_coordinator.getListenerThread().join(); } catch (InterruptedException ex) { throw new RuntimeException(ex); } finally { RingBufferAppender appender = RingBufferAppender.getRingBufferAppender(LOG); if (appender != null) { int width = 100; System.err.println(StringUtil.header(appender.getClass().getSimpleName(), "=", width)); for (String log : appender.getLogMessages()) { System.err.println(log.trim()); } System.err.println(StringUtil.repeat("=", width)); System.err.flush(); } } } /** * Returns true if this HStoreSite is fully initialized and running * This will be set to false if the system is shutting down */ public boolean isRunning() { return (this.ready); } // ---------------------------------------------------------------------------- // SHUTDOWN STUFF // ---------------------------------------------------------------------------- @Override public void prepareShutdown(boolean error) { this.shutdown_state = ShutdownState.PREPARE_SHUTDOWN; if (this.hstore_coordinator != null) this.hstore_coordinator.prepareShutdown(false); try { this.txnQueueManager.prepareShutdown(error); } catch (Throwable ex) { LOG.error("Unexpected error when preparing " + this.txnQueueManager.getClass().getSimpleName() + " for shutdown", ex); } this.clientInterface.prepareShutdown(error); if (this.preProcessors != null) { for (TransactionPreProcessor tpp : this.preProcessors) { tpp.prepareShutdown(false); } // FOR } if (this.postProcessors != null) { for (TransactionPostProcessor tpp : this.postProcessors) { tpp.prepareShutdown(false); } // FOR } if (this.mr_helper != null) { this.mr_helper.prepareShutdown(error); } if (this.commandLogger != null) { this.commandLogger.prepareShutdown(error); } if (this.anticacheManager != null) { this.anticacheManager.prepareShutdown(error); } for (TransactionCleaner t : this.txnCleaners) { t.prepareShutdown(error); } // FOR if (this.adhoc_helper_started) { if (this.asyncCompilerWork_thread != null) this.asyncCompilerWork_thread.prepareShutdown(error); } for (int p : this.local_partitions.values()) { if (this.executors[p] != null) this.executors[p].prepareShutdown(error); } // FOR // Tell anybody that wants to know that we're going down if (trace.val) LOG.trace(String.format("Notifying %d observers that we're preparing shutting down", this.prepare_observable.countObservers())); this.prepare_observable.notifyObservers(error); // *********************************** DEBUG *********************************** Logger root = Logger.getRootLogger(); // if (error && RingBufferAppender.getRingBufferAppender(LOG) != null) { // root.info("Flushing RingBufferAppender logs"); // for (Appender appender : CollectionUtil.iterable(root.getAllAppenders(), Appender.class)) { // LOG.addAppender(appender); // } // FOR // } if (debug.val) root.debug("Preparing to shutdown. Flushing all logs"); LoggerUtil.flushAllLogs(); if (this.deletable_last.isEmpty() == false) { StringBuilder sb = new StringBuilder(); int i = 0; for (String txn : this.deletable_last) { sb.append(String.format(" [%02d] %s\n", i++, txn)); // sb.append(String.format(" [%02d]\n%s\n", i++, StringUtil.prefix(txn, " | "))); } LOG.info("Last Deleted Transactions:\n" + sb + "\n\n"); } // sb = new StringBuilder(); // i = 0; // for (Long txn : this.deletable_txns[Status.OK.ordinal()]) { // sb.append(String.format(" [%02d] %s\n", i++, this.inflight_txns.get(txn).debug())); // } // LOG.info("Waiting to be Deleted Transactions:\n" + sb); } /** * Perform shutdown operations for this HStoreSiteNode */ @Override public synchronized void shutdown(){ if (this.shutdown_state == ShutdownState.SHUTDOWN) { // if (debug.val) LOG.warn("Already told to shutdown... Ignoring"); return; } if (this.shutdown_state != ShutdownState.PREPARE_SHUTDOWN) this.prepareShutdown(false); this.shutdown_state = ShutdownState.SHUTDOWN; if (debug.val) LOG.debug("Shutting down everything at " + this.getSiteName()); // Stop the monitor thread if (this.status_monitor != null) this.status_monitor.shutdown(); // Kill the queue manager this.txnQueueManager.shutdown(); if (this.mr_helper_started && this.mr_helper != null) { this.mr_helper.shutdown(); } if (this.commandLogger != null) { this.commandLogger.shutdown(); } if (this.anticacheManager != null) { this.anticacheManager.shutdown(); } for (TransactionCleaner t : this.txnCleaners) { t.shutdown(); } // FOR // this.threadManager.getPeriodicWorkExecutor().shutdown(); // Stop AdHoc threads if (this.adhoc_helper_started) { if (this.asyncCompilerWork_thread != null) this.asyncCompilerWork_thread.shutdown(); } if (this.preProcessors != null) { for (TransactionPreProcessor tpp : this.preProcessors) { tpp.shutdown(); } // FOR } if (this.postProcessors != null) { for (TransactionPostProcessor tpp : this.postProcessors) { tpp.shutdown(); } // FOR } // Tell anybody that wants to know that we're going down if (trace.val) LOG.trace("Notifying " + this.shutdown_observable.countObservers() + " observers that we're shutting down"); this.shutdown_observable.notifyObservers(); // Tell our local boys to go down too for (int p : this.local_partitions.values()) { if (this.executors[p] != null) this.executors[p].shutdown(); } // FOR if (this.hstore_coordinator != null) { this.hstore_coordinator.shutdown(); } if (this.voltNetwork != null) { try { this.voltNetwork.shutdown(); } catch (InterruptedException ex) { throw new RuntimeException(ex); } this.clientInterface.shutdown(); } LOG.info(String.format("Completed shutdown process at %s [hashCode=%d]", this.getSiteName(), this.hashCode())); } /** * Returns true if HStoreSite is in the process of shutting down * @return */ @Override public boolean isShuttingDown() { return (this.shutdown_state == ShutdownState.SHUTDOWN); } // ---------------------------------------------------------------------------- // INCOMING INVOCATION HANDLER METHODS // ---------------------------------------------------------------------------- protected void invocationQueue(ByteBuffer buffer, ClientInputHandler handler, Connection c) { int messageSize = buffer.capacity(); RpcCallback<ClientResponseImpl> callback = new ClientResponseCallback(this.clientInterface, c, messageSize); this.clientInterface.increaseBackpressure(messageSize); if (this.preProcessorQueue != null) { this.preProcessorQueue.add(Pair.of(buffer, callback)); } else { this.invocationProcess(buffer, callback); } } /** * This is legacy method needed for using Evan's VoltProcedureListener. */ @Override @Deprecated public void invocationQueue(ByteBuffer buffer, final RpcCallback<byte[]> clientCallback) { // XXX: This is a big hack. We should just deal with the ClientResponseImpl directly RpcCallback<ClientResponseImpl> wrapperCallback = new RpcCallback<ClientResponseImpl>() { @Override public void run(ClientResponseImpl parameter) { if (trace.val) LOG.trace("Serializing ClientResponse to byte array:\n" + parameter); FastSerializer fs = new FastSerializer(); try { parameter.writeExternal(fs); clientCallback.run(fs.getBBContainer().b.array()); } catch (IOException ex) { throw new RuntimeException(ex); } finally { fs.clear(); } } }; if (this.preProcessorQueue != null) { this.preProcessorQueue.add(Pair.of(buffer, wrapperCallback)); } else { this.invocationProcess(buffer, wrapperCallback); } } /** * This is the main method that takes in a ByteBuffer request from the client and queues * it up for execution. The clientCallback expects to get back a ClientResponse generated * after the txn is executed. * @param buffer * @param clientCallback */ public void invocationProcess(ByteBuffer buffer, RpcCallback<ClientResponseImpl> clientCallback) { // if (hstore_conf.site.network_profiling || hstore_conf.site.txn_profiling) { // long timestamp = ProfileMeasurement.getTime(); // if (hstore_conf.site.network_profiling) { // ProfileMeasurement.swap(timestamp, this.profiler.network_idle_time, this.profiler.network_processing_time); // } // } long timestamp = -1; if (hstore_conf.global.nanosecond_latencies) { timestamp = System.nanoTime(); } else { timestamp = System.currentTimeMillis(); EstTimeUpdater.update(timestamp); } // Extract the stuff we need to figure out whether this guy belongs at our site // We don't need to create a StoredProcedureInvocation anymore in order to // extract out the data that we need in this request final FastDeserializer incomingDeserializer = this.getIncomingDeserializer(); incomingDeserializer.setBuffer(buffer); final long client_handle = StoredProcedureInvocation.getClientHandle(buffer); final int procId = StoredProcedureInvocation.getProcedureId(buffer); int base_partition = StoredProcedureInvocation.getBasePartition(buffer); if (trace.val) LOG.trace(String.format("Raw Request: clientHandle=%d / procId=%d / basePartition=%d", client_handle, procId, base_partition)); // Optimization: We can get the Procedure catalog handle from its procId Procedure catalog_proc = catalogContext.getProcedureById(procId); // Otherwise, we have to get the procedure name and do a look up with that. if (catalog_proc == null) { String procName = StoredProcedureInvocation.getProcedureName(incomingDeserializer); catalog_proc = this.catalogContext.procedures.getIgnoreCase(procName); if (catalog_proc == null) { String msg = "Unknown procedure '" + procName + "'"; this.responseError(client_handle, Status.ABORT_UNEXPECTED, msg, clientCallback, timestamp); return; } } boolean sysproc = catalog_proc.getSystemproc(); // ------------------------------- // PARAMETERSET INITIALIZATION // ------------------------------- // Extract just the ParameterSet from the StoredProcedureInvocation // We will deserialize the rest of it later ParameterSet procParams = new ParameterSet(); try { StoredProcedureInvocation.seekToParameterSet(buffer); incomingDeserializer.setBuffer(buffer); procParams.readExternal(incomingDeserializer); } catch (Exception ex) { throw new RuntimeException(ex); } assert(procParams != null) : "The parameters object is null for new txn from client #" + client_handle; if (debug.val) LOG.debug(String.format("Received new stored procedure invocation request for %s [handle=%d]", catalog_proc.getName(), client_handle)); // System Procedure Check // If this method returns true, then we want to halt processing the // request any further and immediately return if (sysproc && this.processSysProc(client_handle, catalog_proc, procParams, clientCallback)) { return; } // If this is the first non-sysproc transaction that we've seen, then // we will notify anybody that is waiting for this event. This is used to clear // out any counters or profiling information that got recorded when we were loading data if (this.startWorkload == false && sysproc == false) { this.notifyStartWorkload(); } // ------------------------------- // BASE PARTITION // ------------------------------- // The base partition is where this txn's Java stored procedure will run on if (base_partition == HStoreConstants.NULL_PARTITION_ID) { base_partition = this.txnInitializer.calculateBasePartition(client_handle, catalog_proc, procParams, base_partition); } // Profiling Updates if (hstore_conf.site.txn_counters) TransactionCounter.RECEIVED.inc(catalog_proc); if (hstore_conf.site.profiling && base_partition != HStoreConstants.NULL_PARTITION_ID) { synchronized (profiler.network_incoming_partitions) { profiler.network_incoming_partitions.put(base_partition); } // SYNCH } // ------------------------------- // REDIRECT TXN TO PROPER BASE PARTITION // ------------------------------- if (this.isLocalPartition(base_partition) == false) { // If the base_partition isn't local, then we need to ship it off to // the right HStoreSite this.transactionRedirect(catalog_proc, buffer, base_partition, clientCallback); return; } // 2012-12-24 - We always want the network threads to do the initialization if (trace.val) LOG.trace("Initializing transaction request using network processing thread"); LocalTransaction ts = this.txnInitializer.createLocalTransaction( buffer, timestamp, client_handle, base_partition, catalog_proc, procParams, clientCallback); this.transactionQueue(ts); if (trace.val) LOG.trace(String.format("Finished initial processing of new txn.")); // if (hstore_conf.site.network_profiling) { // ProfileMeasurement.swap(this.profiler.network_processing_time, this.profiler.network_idle_time); // } } /** * Special handling for certain incoming sysproc requests. These are just for * specialized sysprocs where we need to do some pre-processing that is separate * from how the regular sysproc txns are executed. * @param catalog_proc * @param clientCallback * @param request * @return True if this request was handled and the caller does not need to do anything further */ private boolean processSysProc(long client_handle, Procedure catalog_proc, ParameterSet params, RpcCallback<ClientResponseImpl> clientCallback) { // ------------------------------- // SHUTDOWN // TODO: Execute as a regular sysproc transaction // ------------------------------- if (catalog_proc.getName().equalsIgnoreCase("@Shutdown")) { ClientResponseImpl cresponse = new ClientResponseImpl( -1, client_handle, -1, Status.OK, HStoreConstants.EMPTY_RESULT, ""); this.responseSend(cresponse, clientCallback, EstTime.currentTimeMillis(), 0); // Non-blocking.... Exception error = new Exception("Shutdown command received at " + this.getSiteName()); this.hstore_coordinator.shutdownCluster(error); return (true); } // ------------------------------- // QUIESCE // ------------------------------- // else if (catalog_proc.getName().equals("@Quiesce")) { // // Tell the queue manager ahead of time to wipe out everything! // this.txnQueueManager.clearQueues(); // return (false); // } // ------------------------------- // EXECUTOR STATUS // ------------------------------- else if (catalog_proc.getName().equalsIgnoreCase("@ExecutorStatus")) { if (this.status_monitor != null) { this.status_monitor.printStatus(); RingBufferAppender appender = RingBufferAppender.getRingBufferAppender(LOG); if (appender != null) appender.dump(System.err); } ClientResponseImpl cresponse = new ClientResponseImpl( -1, client_handle, -1, Status.OK, HStoreConstants.EMPTY_RESULT, ""); this.responseSend(cresponse, clientCallback, EstTime.currentTimeMillis(), 0); return (true); } // ------------------------------- // ADHOC // ------------------------------- else if (catalog_proc.getName().equalsIgnoreCase("@AdHoc")) { String msg = null; // Is this feature disabled? if (hstore_conf.site.exec_adhoc_sql == false) { msg = "AdHoc queries are disabled"; } // Check that variable 'request' in this func. is same as // 'task' in ClientInterface.handleRead() else if (params.size() != 1) { msg = "AdHoc system procedure requires exactly one parameter, " + "the SQL statement to execute."; } if (msg != null) { this.responseError(client_handle, Status.ABORT_GRACEFUL, msg, clientCallback, EstTime.currentTimeMillis()); return (true); } // Check if we need to start our threads now if (this.adhoc_helper_started == false) { this.startAdHocHelper(); } // Create a LocalTransaction handle that will carry into the // the adhoc compiler. Since we don't know what this thing will do, we have // to assume that it needs to touch all partitions. int idx = (int)(Math.abs(client_handle) % this.local_partitions.size()); int base_partition = this.local_partitions.values()[idx]; LocalTransaction ts = this.txnInitializer.createLocalTransaction(null, EstTime.currentTimeMillis(), client_handle, base_partition, catalog_proc, params, clientCallback); String sql = (String)params.toArray()[0]; this.asyncCompilerWork_thread.planSQL(ts, sql); return (true); } return (false); } // ---------------------------------------------------------------------------- // TRANSACTION OPERATION METHODS // ---------------------------------------------------------------------------- /** * Queue a new transaction for initialization and execution. * If it is a single-partition txn, then it will be queued at its base * partition's PartitionExecutor queue. If it is distributed transaction, * then it will need to first acquire the locks for all of the partitions * that it wants to access. * @param ts */ public void transactionQueue(LocalTransaction ts) { assert(ts.isInitialized()) : "Uninitialized transaction handle [" + ts + "]"; // Make sure that we start the MapReduceHelperThread if (this.mr_helper_started == false && ts.isMapReduce()) { assert(this.mr_helper != null); this.startMapReduceHelper(); } if (debug.val) LOG.debug(String.format("%s - Dispatching %s transaction to execute at partition %d [handle=%d]", ts, (ts.isPredictSinglePartition() ? "single-partition" : "distributed"), ts.getBasePartition(), ts.getClientHandle())); if (ts.isPredictSinglePartition()) { this.transactionInit(ts); } else { LocalInitQueueCallback initCallback = (LocalInitQueueCallback)ts.getInitCallback(); this.hstore_coordinator.transactionInit(ts, initCallback); } } /** * Queue the given transaction to be initialized in the local TransactionQueueManager. * This is a non-blocking call. * @param ts */ public void transactionInit(AbstractTransaction ts) { assert(ts.isInitialized()) : "Uninitialized transaction handle [" + ts + "]"; if (hstore_conf.site.txn_profiling && ts instanceof LocalTransaction) { LocalTransaction localTxn = (LocalTransaction)ts; if (localTxn.profiler != null) localTxn.profiler.startInitQueue(); } this.txnQueueManager.queueTransactionInit(ts); } /** * Pass a message that sets the current distributed txn at the target partition * @param ts * @param partition */ public void transactionSetPartitionLock(AbstractTransaction ts, int partition) { assert(ts.isInitialized()) : "Uninitialized transaction handle [" + ts + "]"; assert(this.isLocalPartition(partition)) : String.format("Trying to queue %s for %s at non-local partition %d", SetDistributedTxnMessage.class.getSimpleName(), ts, partition); this.executors[partition].queueSetPartitionLock(ts); } /** * Queue the transaction to start executing on its base partition. * This function can block a transaction executing on that partition * <B>IMPORTANT:</B> The transaction could be deleted after calling this if it is rejected * @param ts */ public void transactionStart(LocalTransaction ts) { if (debug.val) LOG.debug(String.format("Starting %s %s on partition %d%s", (ts.isPredictSinglePartition() ? "single-partition" : "distributed"), ts, ts.getBasePartition(), (ts.isPredictSinglePartition() ? "" : " [partitions=" + ts.getPredictTouchedPartitions() + "]"))); assert(ts.getPredictTouchedPartitions().isEmpty() == false) : "No predicted partitions for " + ts + "\n" + ts.debug(); assert(this.executors[ts.getBasePartition()] != null) : "Unable to start " + ts + " - No PartitionExecutor exists for partition #" + ts.getBasePartition() + " at HStoreSite " + this.site_id; if (hstore_conf.site.txn_profiling && ts.profiler != null) ts.profiler.startQueueExec(); final boolean success = this.executors[ts.getBasePartition()].queueStartTransaction(ts); if (success == false) { // Depending on what we need to do for this type txn, we will send // either an ABORT_THROTTLED or an ABORT_REJECT in our response // An ABORT_THROTTLED means that the client will back-off of a bit // before sending another txn request, where as an ABORT_REJECT means // that it will just try immediately Status status = Status.ABORT_REJECT; if (debug.val) LOG.debug(String.format("%s - Hit with a %s response from partition %d " + "[queueSize=%d]", ts, status, ts.getBasePartition(), this.executors[ts.getBasePartition()].getDebugContext().getWorkQueueSize())); boolean singlePartitioned = ts.isPredictSinglePartition(); if (singlePartitioned == false) { LocalFinishCallback finish_callback = ts.getFinishCallback(); finish_callback.init(ts, status); this.hstore_coordinator.transactionFinish(ts, status, finish_callback); } // We will want to delete this transaction after we reject it if it is a single-partition txn // Otherwise we will let the normal distributed transaction process clean things up this.transactionReject(ts, status); if (singlePartitioned) this.queueDeleteTransaction(ts.getTransactionId(), status); } } /** * Execute a WorkFragment on a particular PartitionExecutor * @param request * @param clientCallback */ public void transactionWork(AbstractTransaction ts, WorkFragment fragment) { if (debug.val) LOG.debug(String.format("%s - Queuing %s on partition %d [prefetch=%s]", ts, fragment.getClass().getSimpleName(), fragment.getPartitionId(), fragment.getPrefetch())); assert(this.isLocalPartition(fragment.getPartitionId())) : "Trying to queue work for " + ts + " at non-local partition " + fragment.getPartitionId(); if (hstore_conf.site.specexec_enable && ts instanceof RemoteTransaction && fragment.hasFutureStatements()) { QueryEstimate query_estimate = fragment.getFutureStatements(); RemoteTransaction remote_ts = (RemoteTransaction)ts; RemoteEstimatorState t_state = (RemoteEstimatorState)remote_ts.getEstimatorState(); if (t_state == null) { t_state = this.remoteTxnEstimator.startTransaction(ts.getTransactionId(), ts.getBasePartition(), ts.getProcedure(), null); remote_ts.setEstimatorState(t_state); this.remoteTxnEstimator.processQueryEstimate(t_state, query_estimate, fragment.getPartitionId()); } } this.executors[fragment.getPartitionId()].queueWork(ts, fragment); } /** * This method is the first part of two phase commit for a transaction. * If speculative execution is enabled, then we'll notify each the PartitionExecutors * for the listed partitions that it is done. This will cause all the * that are blocked on this transaction to be released immediately and queued * If the second PartitionSet in the arguments is not null, it will be updated with * the partitionIds that we called PREPARE on for this transaction * @param txn_id * @param partitions * @param updated */ public void transactionPrepare(AbstractTransaction ts, PartitionSet partitions) { if (debug.val) LOG.debug(String.format("2PC:PREPARE %s [partitions=%s]", ts, partitions)); PartitionCountingCallback<? extends AbstractTransaction> callback = ts.getPrepareCallback(); assert(callback.isInitialized()); for (int partition : this.local_partitions.values()) { if (partitions.contains(partition) == false) continue; // If this txn is already prepared at this partition, then we // can skip it if (ts.isMarkedPrepared(partition)) { callback.run(partition); } else { // TODO: If this txn is read-only, then we should invoke finish right here // Because this txn didn't change anything at this partition, we should // release all of its locks and immediately allow the partition to execute // transactions without speculative execution. We sort of already do that // because we will allow spec exec read-only txns to commit immediately // but it would reduce the number of messages that the base partition needs // to wait for when it does the 2PC:FINISH // Berstein's book says that most systems don't actually do this because a txn may // need to execute triggers... but since we don't have any triggers we can do it! // More Info: https://github.com/apavlo/h-store/issues/31 // If speculative execution is enabled, then we'll turn it on at the PartitionExecutor // for this partition this.executors[partition].queuePrepare(ts); } } // FOR } /** * This method is used to finish a distributed transaction. * The PartitionExecutor will either commit or abort the transaction at the specified partitions * This is a non-blocking call that doesn't wait to know that the txn was finished successfully at * each PartitionExecutor. * @param txn_id * @param status * @param partitions */ public void transactionFinish(Long txn_id, Status status, PartitionSet partitions) { if (debug.val) LOG.debug(String.format("2PC:FINISH Txn #%d [status=%s, partitions=%s]", txn_id, status, partitions)); // If we don't have a AbstractTransaction handle, then we know that we never did anything // for this transaction and we can just ignore this finish request. AbstractTransaction ts = this.inflight_txns.get(txn_id); if (ts == null) { if (debug.val) LOG.warn(String.format("No transaction information exists for #%d." + "Ignoring finish request", txn_id)); return; } // Set the status in case something goes awry and we just want // to check whether this transaction is suppose to be aborted. // XXX: Why is this needed? ts.setStatus(status); // We only need to do this for distributed transactions, because all single-partition // transactions will commit/abort immediately if (ts.isPredictSinglePartition() == false) { // PartitionCountingCallback<AbstractTransaction> callback = null; for (int partition : this.local_partitions.values()) { if (partitions.contains(partition) == false) continue; // 2013-01-11 // We can check to see whether the txn was ever released at the partition. // If it wasn't then we know that we don't need to queue a finish message // This is to allow the PartitionExecutor to spend more time processing other // more useful stuff. // if (ts.isMarkedReleased(partition)) { if (trace.val) LOG.trace(String.format("%s - Queuing transaction to get finished on partition %d", ts, partition)); try { this.executors[partition].queueFinish(ts, status); } catch (Throwable ex) { LOG.error(String.format("Unexpected error when trying to finish %s\nHashCode: %d / Status: %s / Partitions: %s", ts, ts.hashCode(), status, partitions)); throw new RuntimeException(ex); } // } // else { // if (callback == null) callback = ts.getFinishCallback(); // if (trace.val) // LOG.trace(String.format("%s - Decrementing %s directly for partition %d", // ts, callback.getClass().getSimpleName(), partition)); // callback.run(partition); // } } // FOR } } // ---------------------------------------------------------------------------- // FAILED TRANSACTIONS (REQUEUE / REJECT / RESTART) // ---------------------------------------------------------------------------- /** * Send the transaction request to another node for execution. We will create * a TransactionRedirectCallback that will automatically send the ClientResponse * generated from the remote node for this txn back to the client * @param catalog_proc * @param serializedRequest * @param base_partition * @param clientCallback */ public void transactionRedirect(Procedure catalog_proc, ByteBuffer serializedRequest, int base_partition, RpcCallback<ClientResponseImpl> clientCallback) { if (debug.val) LOG.debug(String.format("Forwarding %s request to partition %d", catalog_proc.getName(), base_partition)); // Make a wrapper for the original callback so that when the result comes back frm the remote partition // we will just forward it back to the client. How sweet is that?? RedirectCallback callback = null; try { callback = (RedirectCallback)objectPools.CALLBACKS_TXN_REDIRECT_REQUEST.borrowObject(); callback.init(clientCallback); } catch (Exception ex) { throw new RuntimeException("Failed to get TransactionRedirectCallback", ex); } // Mark this request as having been redirected // XXX: This sucks because we have to copy the bytes, which will then // get copied again when we have to serialize it out to a ByteString serializedRequest.rewind(); ByteBuffer copy = ByteBuffer.allocate(serializedRequest.capacity()); copy.put(serializedRequest); StoredProcedureInvocation.setBasePartition(base_partition, copy); this.hstore_coordinator.transactionRedirect(copy.array(), callback, base_partition); if (hstore_conf.site.txn_counters) TransactionCounter.REDIRECTED.inc(catalog_proc); } /** * A non-blocking method to requeue an aborted transaction using the * TransactionQueueManager. This allows a PartitionExecutor to tell us that * they can't execute some transaction and we'll let the queue manager's * thread take care of it for us. * This will eventually call HStoreSite.transactionRestart() * @param ts * @param status */ public void transactionRequeue(LocalTransaction ts, Status status) { assert(ts != null); assert(status != Status.OK) : "Unexpected requeue status " + status + " for " + ts; ts.setStatus(status); this.txnQueueManager.restartTransaction(ts, status); } /** * Rejects a transaction and returns an empty result back to the client * @param ts */ public void transactionReject(LocalTransaction ts, Status status) { assert(ts != null) : "Null LocalTransaction handle [status=" + status + "]"; assert(ts.isInitialized()) : "Uninitialized transaction: " + ts; if (debug.val) LOG.debug(String.format("%s - Rejecting transaction with status %s [clientHandle=%d]", ts, status, ts.getClientHandle())); String msg = this.REJECTION_MESSAGE; // + " - [0]"; ts.setStatus(status); ClientResponseImpl cresponse = new ClientResponseImpl(); cresponse.init(ts, status, HStoreConstants.EMPTY_RESULT, msg); this.responseSend(ts, cresponse); if (hstore_conf.site.txn_counters) { if (status == Status.ABORT_REJECT) { TransactionCounter.REJECTED.inc(ts.getProcedure()); } else { assert(false) : "Unexpected rejection status for " + ts + ": " + status; } } } /** * Restart the given transaction with a brand new transaction handle. * This method will perform the following operations: * (1) Restart the transaction as new multi-partitioned transaction * (2) Mark the original transaction as aborted so that is rolled back * * <B>IMPORTANT:</B> If the return status of the transaction is ABORT_REJECT, then * you will probably need to delete the transaction handle. * <B>IMPORTANT:</B> This is a blocking call and should not be invoked by the PartitionExecutor * * @param status Final status of this transaction * @param ts * @return Returns the final status of this transaction */ public Status transactionRestart(LocalTransaction orig_ts, Status status) { assert(orig_ts != null) : "Null LocalTransaction handle [status=" + status + "]"; assert(orig_ts.isInitialized()) : "Uninitialized transaction??"; if (debug.val) LOG.debug(String.format("%s got hit with a %s! Going to clean-up our mess and re-execute " + "[restarts=%d]", orig_ts , status, orig_ts.getRestartCounter())); int base_partition = orig_ts.getBasePartition(); SerializableException orig_error = orig_ts.getPendingError(); //LOG.info("In transactionRestart()"); // If this txn has been restarted too many times, then we'll just give up // and reject it outright int restart_limit = (orig_ts.isSysProc() ? hstore_conf.site.txn_restart_limit_sysproc : hstore_conf.site.txn_restart_limit); if (orig_ts.getRestartCounter() > restart_limit) { if (orig_ts.isSysProc()) { String msg = String.format("%s has been restarted %d times! Rejecting...", orig_ts, orig_ts.getRestartCounter()); throw new RuntimeException(msg); } else { this.transactionReject(orig_ts, Status.ABORT_REJECT); return (Status.ABORT_REJECT); } } // ------------------------------- // REDIRECTION // ------------------------------- if (hstore_conf.site.exec_db2_redirects && status != Status.ABORT_RESTART && status != Status.ABORT_SPECULATIVE && status != Status.ABORT_EVICTEDACCESS) { // Figure out whether this transaction should be redirected based on what partitions it // tried to touch before it was aborted FastIntHistogram touched = orig_ts.getTouchedPartitions(); Collection<Integer> most_touched = touched.getMaxCountValues(); assert(most_touched != null) : "Failed to get most touched partition for " + orig_ts + "\n" + touched; // XXX: We should probably decrement the base partition by one // so that we only consider where they actually executed queries if (debug.val) LOG.debug(String.format("Touched partitions for mispredicted %s\n%s", orig_ts, touched)); int redirect_partition = HStoreConstants.NULL_PARTITION_ID; if (most_touched.size() == 1) { redirect_partition = CollectionUtil.first(most_touched); } // If the original base partition is in our most touched set, then // we'll prefer to use that else if (most_touched.isEmpty() == false) { if (most_touched.contains(base_partition)) { redirect_partition = base_partition; } else { redirect_partition = CollectionUtil.random(most_touched); } } else { redirect_partition = base_partition; } assert(redirect_partition != HStoreConstants.NULL_PARTITION_ID) : "Redirect partition is null!\n" + orig_ts.debug(); if (debug.val) { LOG.debug("Redirect Partition: " + redirect_partition + " -> " + (this.isLocalPartition(redirect_partition) == false)); LOG.debug("Local Partitions: " + this.local_partitions); } // If the txn wants to execute on another node, then we'll send them off *only* if this txn wasn't // already redirected at least once. If this txn was already redirected, then it's going to just // execute on the same partition, but this time as a multi-partition txn that locks all partitions. // That's what you get for messing up!! if (this.isLocalPartition(redirect_partition) == false && orig_ts.getRestartCounter() == 0) { if (debug.val) LOG.debug(String.format("%s - Redirecting to partition %d because of misprediction", orig_ts, redirect_partition)); Procedure catalog_proc = orig_ts.getProcedure(); StoredProcedureInvocation spi = new StoredProcedureInvocation(orig_ts.getClientHandle(), catalog_proc.getId(), catalog_proc.getName(), orig_ts.getProcedureParameters().toArray()); spi.setBasePartition(redirect_partition); spi.setRestartCounter(orig_ts.getRestartCounter()+1); FastSerializer out = this.getOutgoingSerializer(); try { out.writeObject(spi); } catch (IOException ex) { String msg = "Failed to serialize StoredProcedureInvocation to redirect txn"; throw new ServerFaultException(msg, ex, orig_ts.getTransactionId()); } RedirectCallback callback; try { callback = (RedirectCallback)objectPools.CALLBACKS_TXN_REDIRECT_REQUEST.borrowObject(); callback.init(orig_ts.getClientCallback()); } catch (Exception ex) { String msg = "Failed to get TransactionRedirectCallback"; throw new ServerFaultException(msg, ex, orig_ts.getTransactionId()); } this.hstore_coordinator.transactionRedirect(out.getBytes(), callback, redirect_partition); out.clear(); if (hstore_conf.site.txn_counters) TransactionCounter.REDIRECTED.inc(orig_ts.getProcedure()); return (Status.ABORT_RESTART); // Allow local redirect } else if (orig_ts.getRestartCounter() <= 1) { if (redirect_partition != base_partition && this.isLocalPartition(redirect_partition)) { if (debug.val) LOG.debug(String.format("%s - Redirecting to local partition %d [restartCtr=%d]%s", orig_ts, redirect_partition, orig_ts.getRestartCounter(), (trace.val ? "\n"+touched : ""))); base_partition = redirect_partition; } } else { if (debug.val) LOG.debug(String.format("%s - Mispredicted txn has already been aborted once before. " + "Restarting as all-partition txn [restartCtr=%d, redirectPartition=%d]\n%s", orig_ts, orig_ts.getRestartCounter(), redirect_partition, touched)); touched.put(this.local_partitions); } } // ------------------------------- // LOCAL RE-EXECUTION // ------------------------------- // Figure out what partitions they tried to touch so that we can make sure to lock // those when the txn is restarted boolean malloc = false; PartitionSet predict_touchedPartitions = null; if (status == Status.ABORT_RESTART || status == Status.ABORT_EVICTEDACCESS || status == Status.ABORT_SPECULATIVE) { predict_touchedPartitions = new PartitionSet(orig_ts.getPredictTouchedPartitions()); malloc = true; } else if (orig_ts.getRestartCounter() <= 2) { // FIXME // HACK: Ignore ConcurrentModificationException // This can occur if we are trying to requeue the transactions but there are still // pieces of it floating around at this site that modify the TouchedPartitions histogram predict_touchedPartitions = new PartitionSet(); malloc = true; Collection<Integer> orig_touchedPartitions = orig_ts.getTouchedPartitions().values(); while (true) { try { predict_touchedPartitions.addAll(orig_touchedPartitions); } catch (ConcurrentModificationException ex) { continue; } break; } // WHILE } else { if (debug.val) LOG.warn(String.format("Restarting %s as a dtxn using all partitions\n%s", orig_ts, orig_ts.debug())); predict_touchedPartitions = this.catalogContext.getAllPartitionIds(); } // ------------------------------- // MISPREDICTION // ------------------------------- if (status == Status.ABORT_MISPREDICT && orig_error instanceof MispredictionException) { MispredictionException ex = (MispredictionException)orig_error; Collection<Integer> partitions = ex.getPartitions().values(); assert(partitions.isEmpty() == false) : "Unexpected empty MispredictionException PartitionSet for " + orig_ts; if (predict_touchedPartitions.containsAll(partitions) == false) { if (malloc == false) { // XXX: Since the MispredictionException isn't re-used, we can // probably reuse the PartitionSet predict_touchedPartitions = new PartitionSet(predict_touchedPartitions); malloc = true; } predict_touchedPartitions.addAll(partitions); } if (debug.val) LOG.trace(orig_ts + " Mispredicted Partitions: " + partitions); } if (predict_touchedPartitions.contains(base_partition) == false) { if (malloc == false) { predict_touchedPartitions = new PartitionSet(predict_touchedPartitions); malloc = true; } predict_touchedPartitions.add(base_partition); } if (predict_touchedPartitions.isEmpty()) { if (debug.val) LOG.warn(String.format("Restarting %s as a dtxn using all partitions\n%s", orig_ts, orig_ts.debug())); predict_touchedPartitions = this.catalogContext.getAllPartitionIds(); } // ------------------------------- // NEW TXN INITIALIZATION // ------------------------------- boolean predict_readOnly = orig_ts.getProcedure().getReadonly(); // FIXME boolean predict_abortable = true; // FIXME LocalTransaction new_ts = this.txnInitializer.createLocalTransaction( orig_ts, base_partition, predict_touchedPartitions, predict_readOnly, predict_abortable); assert(new_ts != null); // ------------------------------- // ANTI-CACHING REQUEUE // ------------------------------- if (status == Status.ABORT_EVICTEDACCESS && orig_error instanceof EvictedTupleAccessException) { if (this.anticacheManager == null) { String message = "Got eviction notice but anti-caching is not enabled"; LOG.warn(message); throw new ServerFaultException(message, orig_error, orig_ts.getTransactionId()); } EvictedTupleAccessException error = (EvictedTupleAccessException)orig_error; short block_ids[] = error.getBlockIds(); int tuple_offsets[] = error.getTupleOffsets(); Table evicted_table = error.getTable(this.catalogContext.database); LOG.debug(String.format("Added aborted txn to %s queue. Unevicting %d blocks from %s (%d).", AntiCacheManager.class.getSimpleName(), block_ids.length, evicted_table.getName(), evicted_table.getRelativeIndex())); this.anticacheManager.queue(new_ts, base_partition, evicted_table, block_ids, tuple_offsets); } // ------------------------------- // REGULAR TXN REQUEUE // ------------------------------- else { if (debug.val) { LOG.debug(String.format("Re-executing %s as new %s-partition %s on partition %d " + "[restarts=%d, partitions=%s]%s", orig_ts, (predict_touchedPartitions.size() == 1 ? "single" : "multi"), new_ts, base_partition, new_ts.getRestartCounter(), predict_touchedPartitions, (trace.val ? "\n"+orig_ts.debug() : ""))); if (trace.val && status == Status.ABORT_MISPREDICT) LOG.trace(String.format("%s Mispredicted partitions: %s", new_ts, orig_ts.getTouchedPartitions().values())); } this.transactionQueue(new_ts); } return (Status.ABORT_RESTART); } // ---------------------------------------------------------------------------- // CLIENT RESPONSE PROCESSING METHODS // ---------------------------------------------------------------------------- /** * Send back the given ClientResponse to the actual client waiting for it * At this point the transaction should been properly committed or aborted at * the PartitionExecutor, including if it was mispredicted. * This method may not actually send the ClientResponse right away if command-logging * is enabled. Instead it will be queued up and held until we know that the txn's information * was successfully flushed to disk. * * <B>Note:</B> The ClientResponse's status cannot be ABORT_MISPREDICT or ABORT_EVICTEDACCESS. * @param ts * @param cresponse */ public void responseSend(LocalTransaction ts, ClientResponseImpl cresponse) { Status status = cresponse.getStatus(); assert(cresponse != null) : "Missing ClientResponse for " + ts; assert(cresponse.getClientHandle() != -1) : "The client handle for " + ts + " was not set properly"; assert(status != Status.ABORT_MISPREDICT && status != Status.ABORT_EVICTEDACCESS) : "Trying to send back a client response for " + ts + " but the status is " + status; if (hstore_conf.site.txn_profiling && ts.profiler != null) ts.profiler.startPostClient(); boolean sendResponse = true; // We have to send this txn to the CommandLog if all of the following are true: // (1) We have a CommandLogWriter // (2) The txn completed successfully // (3) It is not a sysproc if (this.commandLogger != null && status == Status.OK && ts.isSysProc() == false) { sendResponse = this.commandLogger.appendToLog(ts, cresponse); } if (sendResponse) { // NO GROUP COMMIT -- SEND OUT AND COMPLETE // NO COMMAND LOGGING OR TXN ABORTED -- SEND OUT AND COMPLETE if (hstore_conf.site.exec_postprocessing_threads) { if (trace.val) LOG.trace(String.format("%s - Sending ClientResponse to post-processing thread [status=%s]", ts, cresponse.getStatus())); this.responseQueue(ts, cresponse); } else { this.responseSend(cresponse, ts.getClientCallback(), ts.getInitiateTime(), ts.getRestartCounter()); } } else if (debug.val) { LOG.debug(String.format("%s - Holding the ClientResponse until logged to disk", ts)); } if (hstore_conf.site.txn_profiling && ts.profiler != null) ts.profiler.stopPostClient(); } /** * Instead of having the PartitionExecutor send the ClientResponse directly back * to the client, this method will queue it up at one of the TransactionPostProcessors. * @param ts * @param cresponse */ private void responseQueue(LocalTransaction ts, ClientResponseImpl cresponse) { assert(hstore_conf.site.exec_postprocessing_threads); if (debug.val) LOG.debug(String.format("Adding ClientResponse for %s from partition %d to processing queue [status=%s, size=%d]", ts, ts.getBasePartition(), cresponse.getStatus(), this.postProcessorQueue.size())); this.postProcessorQueue.add(new Object[]{ cresponse, ts.getClientCallback(), ts.getInitiateTime(), ts.getRestartCounter() }); } /** * Use the TransactionPostProcessors to dispatch the ClientResponse back over the network * @param cresponse * @param clientCallback * @param initiateTime * @param restartCounter */ public void responseQueue(ClientResponseImpl cresponse, RpcCallback<ClientResponseImpl> clientCallback, long initiateTime, int restartCounter) { this.postProcessorQueue.add(new Object[]{ cresponse, clientCallback, initiateTime, restartCounter }); } /** * Convenience method for sending an error ClientResponse back to the client * @param client_handle * @param status * @param message * @param clientCallback * @param initiateTime */ public void responseError(long client_handle, Status status, String message, RpcCallback<ClientResponseImpl> clientCallback, long initiateTime) { ClientResponseImpl cresponse = new ClientResponseImpl( -1, client_handle, -1, status, HStoreConstants.EMPTY_RESULT, message); this.responseSend(cresponse, clientCallback, initiateTime, 0); } /** * This is the only place that we will invoke the original Client callback * and send back the results. This should not be called directly by anything * but the HStoreSite or the CommandLogWriter * @param ts * @param cresponse * @param logTxn */ public void responseSend(ClientResponseImpl cresponse, RpcCallback<ClientResponseImpl> clientCallback, long initiateTime, int restartCounter) { Status status = cresponse.getStatus(); // If the txn committed/aborted, then we can send the response directly back to the // client here. Note that we don't even need to call HStoreSite.finishTransaction() // since that doesn't do anything that we haven't already done! if (debug.val) { String extra = ""; if (status == Status.ABORT_UNEXPECTED && cresponse.getException() != null) { extra = "\n" + StringUtil.join("\n", cresponse.getException().getStackTrace()); } if (trace.val && status == Status.OK && cresponse.getResults().length > 0) { extra += "\n" + cresponse.getResults()[0]; } LOG.debug(String.format("Txn %s - Sending back ClientResponse [handle=%d, status=%s]%s", (cresponse.getTransactionId() == -1 ? "<NONE>" : "#"+cresponse.getTransactionId()), cresponse.getClientHandle(), status, extra)); } long now = -1; if (hstore_conf.global.nanosecond_latencies) { now = System.nanoTime(); } else { now = System.currentTimeMillis(); EstTimeUpdater.update(now); } cresponse.setClusterRoundtrip((int)(now - initiateTime)); cresponse.setRestartCounter(restartCounter); try { clientCallback.run(cresponse); } catch (ClientConnectionLostException ex) { // There is nothing else we can really do here. We'll clean up // the transaction just as normal and report the error // in our logs if they have debugging turned on if (trace.val) LOG.warn("Failed to send back ClientResponse for txn #" + cresponse.getTransactionId(), ex); } } // ---------------------------------------------------------------------------- // DELETE TRANSACTION METHODS // ---------------------------------------------------------------------------- /** * Queue a completed txn for final cleanup and bookkeeping. This will be deleted * by the HStoreSite's periodic work thread. It is ok to queue up the same txn twice * <B>Note:</B> If you call this, you can never access anything in this txn again. * @param txn_id * @param status The final status for the txn */ public void queueDeleteTransaction(Long txn_id, Status status) { assert(txn_id != null) : "Unexpected null transaction id"; if (debug.val) LOG.debug(String.format("Queueing txn #%d for deletion [status=%s]", txn_id, status)); // Update Transaction profiler // We want to call this before we queue it so that the post-finish time is more accurate if (hstore_conf.site.txn_profiling) { AbstractTransaction ts = this.inflight_txns.get(txn_id); // XXX: Should we include totals for mispredicted txns? if (ts != null && status != Status.ABORT_MISPREDICT && ts instanceof LocalTransaction) { LocalTransaction local_ts = (LocalTransaction)ts; if (local_ts.profiler != null && local_ts.profiler.isDisabled() == false) { local_ts.profiler.stopTransaction(); if (this.txnProfilerStats != null) { this.txnProfilerStats.addTxnProfile(local_ts.getProcedure(), local_ts.profiler); } if (this.status_monitor != null) { this.status_monitor.addTxnProfile(local_ts.getProcedure(), local_ts.profiler); } } } } // Queue it up for deletion! There is no return for the txn from this! try { this.deletable_txns.get(status).offer(txn_id); } catch (NullPointerException ex) { LOG.warn("STATUS = " + status); LOG.warn("TXN_ID = " + txn_id); throw new RuntimeException(ex); } } /** * Clean-up all of the state information about a RemoteTransaction that is finished * <B>NOTE:</B> You should not be calling this directly. Use queueDeleteTransaction() instead! * @param ts * @param status */ protected void deleteRemoteTransaction(RemoteTransaction ts, Status status) { // Nothing else to do for RemoteTransactions other than to just // return the object back into the pool final Long txn_id = ts.getTransactionId(); AbstractTransaction rm = this.inflight_txns.remove(txn_id); if (debug.val) LOG.debug(String.format("Deleted %s [%s / inflightRemoval:%s]", ts, status, (rm != null))); EstimatorState t_state = ts.getEstimatorState(); if (t_state != null) { this.remoteTxnEstimator.destroyEstimatorState(t_state); } if (hstore_conf.site.pool_txn_enable) { if (debug.val) { LOG.warn(String.format("%s - Returning %s to ObjectPool [hashCode=%d]", ts, ts.getClass().getSimpleName(), ts.hashCode())); this.deletable_last.add(String.format("%s :: %s", ts, status)); } this.objectPools.getRemoteTransactionPool(ts.getBasePartition()).returnObject(ts); } return; } /** * Clean-up all of the state information about a LocalTransaction that is finished * <B>NOTE:</B> You should not be calling this directly. Use queueDeleteTransaction() instead! * @param ts * @param status */ protected void deleteLocalTransaction(LocalTransaction ts, final Status status) { final Long txn_id = ts.getTransactionId(); final int base_partition = ts.getBasePartition(); final Procedure catalog_proc = ts.getProcedure(); final boolean singlePartitioned = ts.isPredictSinglePartition(); if (debug.val) { LOG.debug(String.format("About to delete %s [%s]", ts, status)); if (trace.val) LOG.trace(ts + " - State before delete:\n" + ts.debug()); } assert(ts.checkDeletableFlag()) : String.format("Trying to delete %s before it was marked as ready!", ts); // Clean-up any extra information that we may have for the txn TransactionEstimator t_estimator = null; EstimatorState t_state = ts.getEstimatorState(); if (t_state != null) { t_estimator = this.executors[base_partition].getTransactionEstimator(); assert(t_estimator != null); } try { switch (status) { case OK: if (t_estimator != null) { if (trace.val) LOG.trace("Telling the TransactionEstimator to COMMIT " + ts); t_estimator.commit(t_state); } // We always need to keep track of how many txns we process // in order to check whether we are hung or not if (hstore_conf.site.txn_counters || hstore_conf.site.status_kill_if_hung) { TransactionCounter.COMPLETED.inc(catalog_proc); } break; case ABORT_USER: if (t_estimator != null) { if (trace.val) LOG.trace("Telling the TransactionEstimator to ABORT " + ts); t_estimator.abort(t_state, status); } if (hstore_conf.site.txn_counters) TransactionCounter.ABORTED.inc(catalog_proc); break; case ABORT_MISPREDICT: case ABORT_RESTART: case ABORT_EVICTEDACCESS: case ABORT_SPECULATIVE: if (t_estimator != null) { if (trace.val) LOG.trace("Telling the TransactionEstimator to IGNORE " + ts); t_estimator.abort(t_state, status); } if (hstore_conf.site.txn_counters) { if (status == Status.ABORT_EVICTEDACCESS) { TransactionCounter.EVICTEDACCESS.inc(catalog_proc); } else if (status == Status.ABORT_SPECULATIVE) { TransactionCounter.ABORT_SPECULATIVE.inc(catalog_proc); } else if (status == Status.ABORT_MISPREDICT) { TransactionCounter.MISPREDICTED.inc(catalog_proc); } else { TransactionCounter.RESTARTED.inc(catalog_proc); } } break; case ABORT_REJECT: if (hstore_conf.site.txn_counters) TransactionCounter.REJECTED.inc(catalog_proc); break; case ABORT_UNEXPECTED: if (hstore_conf.site.txn_counters) TransactionCounter.ABORT_UNEXPECTED.inc(catalog_proc); break; case ABORT_GRACEFUL: if (hstore_conf.site.txn_counters) TransactionCounter.ABORT_GRACEFUL.inc(catalog_proc); break; default: LOG.warn(String.format("Unexpected status %s for %s", status, ts)); } // SWITCH } catch (Throwable ex) { LOG.error(String.format("Unexpected error when cleaning up %s transaction %s", status, ts), ex); // Pass... } finally { if (t_state != null && t_estimator != null) { assert(txn_id == t_state.getTransactionId()) : String.format("Unexpected mismatch txnId in %s [%d != %d]", t_state.getClass().getSimpleName(), txn_id, t_state.getTransactionId()); t_estimator.destroyEstimatorState(t_state); } } // Update additional transaction profiling counters if (hstore_conf.site.txn_counters) { // Speculative Execution Counters if (ts.isSpeculative() && status != Status.ABORT_SPECULATIVE) { TransactionCounter.SPECULATIVE.inc(catalog_proc); switch (ts.getSpeculativeType()) { case IDLE: TransactionCounter.SPECULATIVE_IDLE.inc(catalog_proc); break; case SP1_LOCAL: TransactionCounter.SPECULATIVE_SP1.inc(catalog_proc); break; case SP2_REMOTE_BEFORE: TransactionCounter.SPECULATIVE_SP2_BEFORE.inc(catalog_proc); break; case SP2_REMOTE_AFTER: TransactionCounter.SPECULATIVE_SP2_AFTER.inc(catalog_proc); break; case SP3_LOCAL: TransactionCounter.SPECULATIVE_SP3_LOCAL.inc(catalog_proc); break; case SP3_REMOTE: TransactionCounter.SPECULATIVE_SP3_REMOTE.inc(catalog_proc); break; } // SWITCH } if (ts.isSysProc()) { TransactionCounter.SYSPROCS.inc(catalog_proc); } else if (status != Status.ABORT_MISPREDICT && status != Status.ABORT_REJECT && status != Status.ABORT_EVICTEDACCESS && status != Status.ABORT_SPECULATIVE) { (singlePartitioned ? TransactionCounter.SINGLE_PARTITION : TransactionCounter.MULTI_PARTITION).inc(catalog_proc); // Only count no-undo buffers for completed transactions if (ts.isExecNoUndoBuffer(base_partition)) TransactionCounter.NO_UNDO.inc(catalog_proc); } } // SANITY CHECK if (hstore_conf.site.exec_validate_work) { for (int p : this.local_partitions.values()) { assert(ts.equals(this.executors[p].getDebugContext().getCurrentDtxn()) == false) : String.format("About to finish %s but it is still the current DTXN at partition %d", ts, p); } // FOR } AbstractTransaction rm = this.inflight_txns.remove(txn_id); assert(rm == null || rm == ts) : String.format("%s != %s", ts, rm); if (trace.val) LOG.trace(String.format("Deleted %s [%s / inflightRemoval:%s]", ts, status, (rm != null))); assert(ts.isInitialized()) : "Trying to return uninitialized txn #" + txn_id; if (hstore_conf.site.pool_txn_enable) { if (debug.val) { LOG.warn(String.format("%s - Returning %s to ObjectPool [hashCode=%d]", ts, ts.getClass().getSimpleName(), ts.hashCode())); this.deletable_last.add(String.format("%s :: %s", ts, status)); } if (this.mr_helper_started == true && ts.isMapReduce()) { this.objectPools.getMapReduceTransactionPool(base_partition).returnObject((MapReduceTransaction)ts); } else { this.objectPools.getLocalTransactionPool(base_partition).returnObject(ts); } } } // ---------------------------------------------------------------------------- // UTILITY WORK // ---------------------------------------------------------------------------- /** * Added for @AdHoc processes, periodically checks for AdHoc queries waiting to be compiled. * */ private void processPeriodicWork() { // if (trace.val) LOG.trace("Checking for PeriodicWork..."); // We want to do this here just so that the time is always moving forward. EstTimeUpdater.update(System.currentTimeMillis()); if (this.clientInterface != null) { this.clientInterface.checkForDeadConnections(EstTime.currentTimeMillis()); } // poll planner queue if (this.asyncCompilerWork_thread != null) { checkForFinishedCompilerWork(); } // Don't delete anything if we're shutting down // This is so that we can see the state of things right before we stopped if (this.isShuttingDown()) { if (trace.val) LOG.warn(this.getSiteName() + " is shutting down. Suspending transaction handle cleanup"); return; } return; } /** * Added for @AdHoc processes * */ private void checkForFinishedCompilerWork() { // if (trace.val) LOG.trace("Checking for finished compiled work."); AsyncCompilerResult result = null; while ((result = asyncCompilerWork_thread.getPlannedStmt()) != null) { if (debug.val) LOG.debug("AsyncCompilerResult\n" + result); // ---------------------------------- // BUSTED! // ---------------------------------- if (result.errorMsg != null) { if (debug.val) LOG.error("Unexpected AsyncCompiler Error:\n" + result.errorMsg); ClientResponseImpl errorResponse = new ClientResponseImpl(-1, result.clientHandle, this.local_partitions.get(), Status.ABORT_UNEXPECTED, HStoreConstants.EMPTY_RESULT, result.errorMsg); this.responseSend(result.ts, errorResponse); // We can just delete the LocalTransaction handle directly boolean deletable = result.ts.isDeletable(); assert(deletable); this.deleteLocalTransaction(result.ts, Status.ABORT_UNEXPECTED); } // ---------------------------------- // AdHocPlannedStmt // ---------------------------------- else if (result instanceof AdHocPlannedStmt) { AdHocPlannedStmt plannedStmt = (AdHocPlannedStmt) result; // Modify the StoredProcedureInvocation ParameterSet params = result.ts.getProcedureParameters(); assert(params != null) : "Unexpected null ParameterSet"; params.setParameters( plannedStmt.aggregatorFragment, plannedStmt.collectorFragment, plannedStmt.sql, plannedStmt.isReplicatedTableDML ? 1 : 0 ); // initiate the transaction int base_partition = result.ts.getBasePartition(); Long txn_id = this.txnInitializer.registerTransaction(result.ts, base_partition); result.ts.setTransactionId(txn_id); if (debug.val) LOG.debug("Queuing AdHoc transaction: " + result.ts); this.transactionQueue(result.ts); } // ---------------------------------- // Unexpected // ---------------------------------- else { throw new RuntimeException( "Should not be able to get here (HStoreSite.checkForFinishedCompilerWork())"); } } // WHILE } // ---------------------------------------------------------------------------- // DEBUG METHODS // ---------------------------------------------------------------------------- public class Debug implements DebugContext { /** * Get the total number of transactions inflight for all partitions */ public int getInflightTxnCount() { return (inflight_txns.size()); } public int getDeletableTxnCount() { int total = 0; for (Queue<Long> q : deletable_txns.values()) { total += q.size(); } return (total); } public Collection<String> getLastDeletedTxns() { return (deletable_last); } public void resetStartWorkload() { synchronized (HStoreSite.this) { HStoreSite.this.startWorkload = false; } // SYNCH } /** * Get the collection of inflight Transaction state handles * THIS SHOULD ONLY BE USED FOR TESTING! * @return */ public Collection<AbstractTransaction> getInflightTransactions() { return (inflight_txns.values()); } public int getQueuedResponseCount() { return (postProcessorQueue.size()); } public HStoreSiteProfiler getProfiler() { return (profiler); } } private HStoreSite.Debug cachedDebugContext; public HStoreSite.Debug getDebugContext() { if (this.cachedDebugContext == null) { // We don't care if we're thread-safe here... this.cachedDebugContext = new HStoreSite.Debug(); } return this.cachedDebugContext; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
d5cb50ecaf1df0f5217bce50a835290c1d0d86d5
a4a85acf22280a2b0fcbe5827763dc1f348e815c
/app/src/main/java/leonardo2204/com/br/flowtests/flow/dispatcher/Changer.java
6bb57cb1a9295416b3c196a9106c1a7e5c9639f2
[ "MIT" ]
permissive
leonardo2204/Flow1.0.0-alphaExample
66cec0481660bf4ccdbc182dd58b170a28eb4f3c
944d24fb80b3b6a12764744a8cf953acf739864a
refs/heads/master
2021-01-10T08:40:10.736922
2016-03-21T07:05:59
2016-03-21T07:06:00
53,288,089
9
0
null
null
null
null
UTF-8
Java
false
false
4,738
java
package leonardo2204.com.br.flowtests.flow.dispatcher; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.app.Activity; import android.content.Context; import android.support.annotation.LayoutRes; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import java.util.LinkedHashMap; import java.util.Locale; import java.util.Map; import flow.Direction; import flow.KeyChanger; import flow.State; import flow.TraversalCallback; import leonardo2204.com.br.flowtests.Layout; import leonardo2204.com.br.flowtests.R; import leonardo2204.com.br.flowtests.flow.FlowUtils; /** * Created by Leonardo on 08/03/2016. */ public class Changer implements KeyChanger { private static Map<Class,Integer> LAYOUT_CACHE = new LinkedHashMap<>(); private final Activity activity; public Changer(Activity activity) { this.activity = activity; } @Override public void changeKey(@Nullable State outgoingState, State incomingState, final Direction direction, Map<Object, Context> incomingContexts, final TraversalCallback callback) { final ViewGroup frame = (ViewGroup) activity.findViewById(R.id.content); View fromView = null; if(incomingState != null){ if(frame.getChildCount() > 0){ fromView = frame.getChildAt(0); incomingState.save(frame.getChildAt(0)); } } Context context = incomingContexts.get(incomingState.getKey()); @LayoutRes final int layout = getLayout(incomingState.getKey()); //MortarScope scope = MortarScope.getScope(context.getApplicationContext()); //Context newContext = scope.findChild(incomingState.getKey().getClass().getName()).createContext(context); final View incomingView = LayoutInflater.from(context).inflate(layout,frame,false); if(outgoingState != null) outgoingState.restore(incomingView); if(fromView == null || direction == Direction.REPLACE) { frame.removeAllViews(); frame.addView(incomingView); callback.onTraversalCompleted(); } else { frame.addView(incomingView); final View fromViewFinal = fromView; FlowUtils.waitForMeasure(incomingView, new FlowUtils.OnMeasuredCallback() { @Override public void onMeasured(View view, int width, int height) { runAnimation(frame, fromViewFinal, incomingView, direction, new TraversalCallback() { @Override public void onTraversalCompleted() { frame.removeView(fromViewFinal); callback.onTraversalCompleted(); } }); } }); } } private int getLayout(Object screen) { Class layoutScreen = screen.getClass(); Integer layoutId = LAYOUT_CACHE.get(layoutScreen); if (layoutId != null) return layoutId; Layout layout = (Layout) layoutScreen.getAnnotation(Layout.class); if(layout == null) throw new RuntimeException(String.format(Locale.getDefault(),"Must annotate Screen with @Layout annotation on class %s",layoutScreen.getClass().getSimpleName())); layoutId = layout.value(); LAYOUT_CACHE.put(layoutScreen, layoutId); return layoutId; } private Animator createSegue(View from, View to, Direction direction) { boolean backward = direction == Direction.BACKWARD; int fromTranslation = backward ? from.getWidth() : -from.getWidth(); int toTranslation = backward ? -to.getWidth() : to.getWidth(); AnimatorSet set = new AnimatorSet(); set.play(ObjectAnimator.ofFloat(from, View.TRANSLATION_X, fromTranslation)); set.play(ObjectAnimator.ofFloat(to, View.TRANSLATION_X, toTranslation, 0)); return set; } private void runAnimation(final ViewGroup container, final View from, final View to, Direction direction, final TraversalCallback callback) { Animator animator = createSegue(from, to, direction); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { container.removeView(from); callback.onTraversalCompleted(); } }); animator.start(); } }
[ "leonardo@busk.com" ]
leonardo@busk.com
3f561735c32142ad5eef95cd70fa86d7b70935e8
fa83dd7a3a6166c395bb117fbac5d79116054769
/cas/cas-server/cas-server-3.4.12/cas-server-support-generic/src/test/java/org/jasig/cas/adaptors/generic/AcceptUsersAuthenticationHandlerTests.java
27e9797f1b7316a88a5a13906c304ceacc656add
[]
no_license
mikeccy/mikeccy-demo
d2198840a6c70acc1c293a8e50d0d32e0402863d
920a15b4a3f62fa2385ead453c6b5a4f7cb8cbed
refs/heads/master
2016-09-03T06:32:44.486255
2012-06-26T21:31:07
2012-06-26T21:31:07
4,787,562
0
1
null
null
null
null
UTF-8
Java
false
false
4,299
java
/* * Copyright 2004 The JA-SIG Collaborative. All rights reserved. See license * distributed with this file and available online at * http://www.ja-sig.org/products/cas/overview/license/ */ package org.jasig.cas.adaptors.generic; import java.net.MalformedURLException; import java.net.URL; import java.util.HashMap; import java.util.Map; import org.jasig.cas.adaptors.generic.AcceptUsersAuthenticationHandler; import org.jasig.cas.authentication.handler.AuthenticationException; import org.jasig.cas.authentication.principal.HttpBasedServiceCredentials; import org.jasig.cas.authentication.principal.UsernamePasswordCredentials; import junit.framework.TestCase; /** * @author Scott Battaglia * @version $Revision$ $Date$ */ public class AcceptUsersAuthenticationHandlerTests extends TestCase { final private Map<String, String> users; final private AcceptUsersAuthenticationHandler authenticationHandler; public AcceptUsersAuthenticationHandlerTests() throws Exception { this.users = new HashMap<String, String>(); this.users.put("scott", "rutgers"); this.users.put("dima", "javarules"); this.users.put("bill", "thisisAwesoME"); this.users.put("brian", "t�st"); this.authenticationHandler = new AcceptUsersAuthenticationHandler(); this.authenticationHandler.setUsers(this.users); } public void testSupportsSpecialCharacters() throws Exception { final UsernamePasswordCredentials c = new UsernamePasswordCredentials(); c.setUsername("brian"); c.setPassword("t�st"); assertTrue(this.authenticationHandler.authenticate(c)); } public void testSupportsProperUserCredentials() throws Exception { final UsernamePasswordCredentials c = new UsernamePasswordCredentials(); c.setUsername("scott"); c.setPassword("rutgers"); this.authenticationHandler.authenticate(c); } public void testDoesntSupportBadUserCredentials() { try { assertFalse(this.authenticationHandler .supports(new HttpBasedServiceCredentials(new URL( "http://www.rutgers.edu")))); } catch (MalformedURLException e) { fail("Could not resolve URL."); } } public void testAuthenticatesUserInMap() { final UsernamePasswordCredentials c = new UsernamePasswordCredentials(); c.setUsername("scott"); c.setPassword("rutgers"); try { assertTrue(this.authenticationHandler.authenticate(c)); } catch (AuthenticationException e) { fail("AuthenticationException caught but it should not have been thrown."); } } public void testFailsUserNotInMap() { final UsernamePasswordCredentials c = new UsernamePasswordCredentials(); c.setUsername("fds"); c.setPassword("rutgers"); try { assertFalse(this.authenticationHandler.authenticate(c)); } catch (AuthenticationException e) { // this is okay because it means the test failed. } } public void testFailsNullUserName() { final UsernamePasswordCredentials c = new UsernamePasswordCredentials(); c.setUsername(null); c.setPassword("user"); try { assertFalse(this.authenticationHandler.authenticate(c)); } catch (AuthenticationException e) { // this is okay because it means the test failed. } } public void testFailsNullUserNameAndPassword() { final UsernamePasswordCredentials c = new UsernamePasswordCredentials(); c.setUsername(null); c.setPassword(null); try { assertFalse(this.authenticationHandler.authenticate(c)); } catch (AuthenticationException e) { // this is okay because it means the test failed. } } public void testFailsNullPassword() { final UsernamePasswordCredentials c = new UsernamePasswordCredentials(); c.setUsername("scott"); c.setPassword(null); try { assertFalse(this.authenticationHandler.authenticate(c)); } catch (AuthenticationException e) { // this is okay because it means the test failed. } } }
[ "mikeccy@gmail.com" ]
mikeccy@gmail.com
db2a97db916de921d02cb1897c21cbbb78a7e33d
6c40d751d6620f31b2644022410a0a4766175a4c
/src/main/java/Game/AbstractGame.java
0c59f2447d84b3fbc3327565120c88aa25cfbc90
[]
no_license
ashklyarovjr/TheGame
7116079a10c5104df3f0cd6ef7bb275ed8295cca
79378e7d2e918cd208fb6cd6364ff7f64161dc29
refs/heads/master
2021-01-25T10:15:34.006755
2015-05-21T14:46:26
2015-05-21T14:46:26
35,618,167
0
0
null
null
null
null
UTF-8
Java
false
false
2,909
java
package Game; import Entities.Computer; import Entities.Player; import Entities.User; import Parsers.AbstractParser; import org.apache.log4j.Logger; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; public abstract class AbstractGame implements AbstractGameInterface { private static final Logger LOGGER_INFO = Logger.getLogger(AbstractGame.class); private static final Logger LOGGER_ERR = Logger.getLogger(AbstractGame.class); public BufferedReader getReader() { return reader; } public static List<Player> getPlayers() { return players; } public static void setPlayers(List<Player> players) { AbstractGame.players = players; } static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); static List<Player> players; protected static List<Player> start() { setPlayers(new LinkedList<>()); LOGGER_INFO.info("Start call"); int users; int comps; try { //Requesting number of Users and Computers that we need to initialize LOGGER_INFO.info("Number of users request"); System.out.println("Set quantity of users(1 by default): "); users = Integer.parseInt(reader.readLine()); LOGGER_INFO.info("Number of AIs request"); System.out.println("Set quantity of computers(1 by default): "); comps = Integer.parseInt(reader.readLine()); //Setting default values, if necessary if (users == 0) { LOGGER_INFO.info("Users = 1"); users = 1; } if (comps == 0) { LOGGER_INFO.info("AIs = 1"); comps = 1; } //Initializing array of players to put into play() method players = new ArrayList<>(); LOGGER_INFO.info("Players array init"); //Initializing players in the array for (int i = 0; i < users + comps; i++) { if (i < users) players.add(userInit(reader)); else players.add(new Computer("AI" + i)); } } catch (IOException | NumberFormatException e) { LOGGER_ERR.error("Incorrect input value: " + e + "; start() recall"); System.out.println("Incorrect input value, try again!"); //Recursive call in case of exception start(); } LOGGER_INFO.info("Start method end"); return players; } protected static User userInit(BufferedReader reader) throws IOException { System.out.println("Enter user name: "); LOGGER_INFO.info("Single User init"); return new User(reader.readLine()); } }
[ "anton.shklyarov@gmail.com" ]
anton.shklyarov@gmail.com
b7e9833099a0617247d576d05fdf141eff7bcb25
05c0989ea974ab9ae1f62736cbf0ce6a8ca0169f
/gatein/src/main/java/de/knallisworld/poc/gatein/WorkerImpl.java
dcf242cc0a9bb0621fe74ddb11e39fd5fe15559a
[]
no_license
knalli/poc-sprint-int-resolve-type-error
5b29a4cd3a605b4a45fc843680243639de0f47e8
36186de113c2a9fe1d77e8a7bf2491444d672346
refs/heads/master
2021-04-01T16:32:41.123400
2020-03-26T17:04:08
2020-03-26T17:04:08
248,200,714
0
0
null
null
null
null
UTF-8
Java
false
false
426
java
package de.knallisworld.poc.gatein; import lombok.extern.slf4j.Slf4j; @Slf4j public class WorkerImpl implements Worker { @Override public GateinMessage handle(final GateinMessage message) { log.info("Got message {}...", message); final var reply = new GateinMessage(); reply.setValue("REPLY: " + message.getValue()); log.info("Sending reply {}", reply); return reply; } }
[ "knallisworld@googlemail.com" ]
knallisworld@googlemail.com
ca600f174ab5834b8eae5ac9051ed45fd468b58c
7b23b9de81fe0b2ced18ebaad3bed8bf3be32922
/netty/src/main/java/com/yang/netty/heartbeat/MyServerHandler.java
8628b8e2bf1093ceeca08f6a4010201b3e80c53b
[]
no_license
yang0123456789/netty-study-code
ef48e8df1e4eb017fd1897d187c2fe836269f4d8
71e799d2cf16fac891a23b81b8b69c16beab8696
refs/heads/main
2023-07-14T13:46:14.064393
2021-08-17T01:23:43
2021-08-17T01:23:43
396,560,683
0
0
null
2021-08-16T02:12:13
2021-08-16T01:17:34
Java
UTF-8
Java
false
false
1,390
java
package com.yang.netty.heartbeat; /** * @author chilcyWind * @Description * @Author Yang * @Date 2021/8/16 * @Version 1.0 **/ import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.handler.timeout.IdleStateEvent; public class MyServerHandler extends ChannelInboundHandlerAdapter { /** * * @param ctx 上下文 * @param evt 事件 * @throws Exception */ @Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { if(evt instanceof IdleStateEvent) { //将 evt 向下转型 IdleStateEvent IdleStateEvent event = (IdleStateEvent) evt; String eventType = null; switch (event.state()) { case READER_IDLE: eventType = "读空闲"; break; case WRITER_IDLE: eventType = "写空闲"; break; case ALL_IDLE: eventType = "读写空闲"; break; } System.out.println(ctx.channel().remoteAddress() + "--超时时间--" + eventType); System.out.println("服务器做相应处理.."); //如果发生空闲,我们关闭通道 // ctx.channel().close(); } } }
[ "378525908@qq.com" ]
378525908@qq.com
b10e105d6305f58e92fac2c8c416d3bc72c97a35
50c40687a4db0adfafa353942d796262db8679aa
/app/src/main/java/com/ekorydes/bscs6thc010420lab/SignInAct.java
dc269892b8d9c72db0cdace851864901340ae3be
[]
no_license
CodingWithSaani/BSCS6thC010420Lab
e48fcc92e16cc2d37827f5136880a39468825834
150ad9221d9b8b13b1aca07de472157b5fed7577
refs/heads/master
2021-05-20T03:20:59.919866
2020-04-01T12:09:18
2020-04-01T12:09:18
252,164,246
0
0
null
null
null
null
UTF-8
Java
false
false
4,405
java
package com.ekorydes.bscs6thc010420lab; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBar; import android.widget.Toast; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; public class SignInAct extends AppCompatActivity { private EditText emailET,passwordET; private Button signInUserBtn; private ProgressBar objectProgressBar; private FirebaseAuth objectFirebaseAuth; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sign_in); connectXMLToJava(); objectFirebaseAuth=FirebaseAuth.getInstance(); } private void connectXMLToJava() { try { emailET=findViewById(R.id.userEmailET); passwordET=findViewById(R.id.userPasswordET); signInUserBtn=findViewById(R.id.signInUser); objectProgressBar=findViewById(R.id.signInUserProgressBar); signInUserBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { signInUser(); } }); } catch (Exception e) { Toast.makeText(this, "connectXMLToJava:"+e.getMessage(), Toast.LENGTH_SHORT).show(); } } private void signInUser() { try { if(!emailET.getText().toString().isEmpty() && !passwordET.getText().toString().isEmpty()) { if(objectFirebaseAuth!=null) { if(objectFirebaseAuth.getCurrentUser()!=null) { objectFirebaseAuth.signOut(); Toast.makeText(this, "Sign Out Successfully", Toast.LENGTH_SHORT).show(); } else { objectProgressBar.setVisibility(View.VISIBLE); signInUserBtn.setEnabled(false); objectFirebaseAuth.signInWithEmailAndPassword(emailET.getText().toString(), passwordET.getText().toString()) .addOnSuccessListener(new OnSuccessListener<AuthResult>() { @Override public void onSuccess(AuthResult authResult) { Toast.makeText(SignInAct.this, "User sign in successfully", Toast.LENGTH_SHORT).show(); startActivity(new Intent(SignInAct.this,MainContentPage.class)); finish(); } }) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { objectProgressBar.setVisibility(View.INVISIBLE); signInUserBtn.setEnabled(true); Toast.makeText(SignInAct.this, "Fails to sign in user:"+ e.getMessage(), Toast.LENGTH_SHORT).show(); } }); } } } else if(emailET.getText().toString().isEmpty()) { Toast.makeText(this, "Please enter the email", Toast.LENGTH_SHORT).show(); emailET.requestFocus(); } else if(passwordET.getText().toString().isEmpty()) { Toast.makeText(this, "Please enter the password", Toast.LENGTH_SHORT).show(); passwordET.requestFocus(); } } catch (Exception e) { Toast.makeText(this, "signInUser:"+e.getMessage(), Toast.LENGTH_SHORT).show(); } } }
[ "russul09#" ]
russul09#
ecc0bd0fc86d461c3d1f7365cc1c8f0b97148f42
967e4a4fa33751b07f896352383b9c86e7fc0cf3
/newspro/src/main/java/org/mine/aop/ValidationByAop.java
d438a0f31b019a74eddd867c70bbbe041242addd
[]
no_license
Gwntl/spring-web
a717af1656f8209ea8ec6f8a62200b8cc77d46e6
127c9c83865cbb75e124b733a282b3b6d17fe1a5
refs/heads/master
2022-12-22T02:33:19.273883
2022-11-19T16:52:33
2022-11-19T16:52:33
201,454,639
0
0
null
2022-12-16T11:35:02
2019-08-09T11:28:14
HTML
UTF-8
Java
false
false
3,173
java
package org.mine.aop; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.reflect.MethodSignature; import org.mine.aplt.customAnnotation.NotEmpty; import org.mine.aplt.customAnnotation.NotNull; import org.mine.aplt.customAnnotation.ParamValue; import org.springframework.core.LocalVariableTableParameterNameDiscoverer; import org.springframework.stereotype.Component; import java.lang.annotation.Annotation; import java.lang.reflect.Method; /** * @author wntl * @version v1.0 * @Description: * @ClassName: ValidationByAop * @date 2020/11/2319:41 */ @Aspect @Component public class ValidationByAop { public static final LocalVariableTableParameterNameDiscoverer pnd = new LocalVariableTableParameterNameDiscoverer(); @Pointcut("@annotation(org.mine.aplt.customAnnotation.ParamValidation)") public void paramValidation(){} @Pointcut("@annotation(org.mine.aplt.customAnnotation.NotNull)") public void notNull() {} @Pointcut("@annotation(org.mine.aplt.customAnnotation.NotEmpty)") public void notEmpty() {} @Before("paramValidation() || notNull() || notEmpty()") public void before(JoinPoint point) { System.out.println("coming............."); // 获取参数注解 MethodSignature signature = (MethodSignature)point.getSignature(); System.out.println("method return type: " + signature.getReturnType()); Method method = signature.getMethod(); System.out.println("method : " + method.getName()); Annotation[][] annotations = method.getParameterAnnotations(); // 获取方法参数名 String[] pns = pnd.getParameterNames(method); // 获取入参 Object[] args = point.getArgs(); for (int i = 0; i < annotations.length; i++) { Object arg = args[i]; String paramName = pns[i]; Annotation[] as = annotations[i]; for (Annotation a : as) { parseAnnotation(a, arg, paramName); } } } public void parseAnnotation(Annotation a, Object arg, String paramName) { if (a != null && a.annotationType().equals(NotNull.class) && arg == null) { System.out.println(paramName + "入参[" + arg + "]不能为null"); } else if (a != null && a.annotationType().equals(NotEmpty.class)) { if (arg == null || (arg.getClass().equals(String.class) && ((String)arg).length() <= 0)) { System.out.println(paramName + "入参[" + arg + "]不能为空"); } } else if (a != null && a.annotationType().equals(ParamValue.class)) { if (arg == null) { if (arg.getClass().equals(String.class)) { System.out.println(paramName + "入参[" + arg + "]类型错误."); } else if (arg.getClass().equals(Double.class)) { } else if (arg.getClass().equals(Long.class)) { } else if (arg.getClass().equals(Integer.class)) { } } } } }
[ "1536183348@qq.com" ]
1536183348@qq.com
6f7496d7fc91fc91e236b48f848894b2f5cbd234
e4f8e7a9c5bb28d2b3dfc7ea995a24b53ee821ee
/moto-crm-model/src/main/java/pl/altkom/moto/crm/dao/hibernate/AddressDAOImpl.java
5f07beddbb90f4a728956747432cd966b26e7a7a
[]
no_license
alapierre/altkom_hibernate
9e1af2402c23002c1bea9271f23415299e37eff3
43e7e233b7c30b6be82e57cb0733bbe1402b9360
refs/heads/master
2021-01-19T21:25:33.387770
2014-10-24T13:29:30
2014-10-24T13:29:30
25,583,736
0
0
null
2020-10-13T17:19:22
2014-10-22T13:46:03
Java
UTF-8
Java
false
false
872
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 pl.altkom.moto.crm.dao.hibernate; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import pl.altkom.moto.crm.model.Address; public class AddressDAOImpl implements AddressDAO { @Autowired private SessionFactory sessionFactory; protected Session getSession() { sessionFactory.openSession(); return sessionFactory.getCurrentSession(); } @Override public Address findOne(long id) { return (Address) getSession().load(Address.class, id); } @Override public void save(Address entity) { getSession().saveOrUpdate(entity); } }
[ "gswit@mail" ]
gswit@mail
9f793d26e87c6e7e323de76a50f1bf264efd472d
2d27a31946f730cf2ed0bf9f00cdb07bdab91b24
/src/main/java/com/springbatch/springbatchexample1/model/User.java
dc133b7859db5b0839d698ad01ea884f6014f764
[]
no_license
guru449/springbatchnew
34a583cf95f9bd048cb5418bef21f13506df595c
06f160e4e5c715a8a02cf59d1ce44e1959fc36a6
refs/heads/master
2021-01-04T20:40:52.325823
2020-02-15T16:50:42
2020-02-15T16:50:42
240,752,000
0
0
null
null
null
null
UTF-8
Java
false
false
1,561
java
package com.springbatch.springbatchexample1.model; import javax.persistence.Entity; import javax.persistence.Id; import java.util.Date; @Entity public class User { @Id private Integer id; private String name; private String dept; private Integer salary; private Date time; public User(Integer id, String name, String dept, Integer salary, Date time) { this.id = id; this.name = name; this.dept = dept; this.salary = salary; this.time = time; } public User() { } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDept() { return dept; } public void setDept(String dept) { this.dept = dept; } public Integer getSalary() { return salary; } public void setSalary(Integer salary) { this.salary = salary; } @Override public String toString() { final StringBuffer sb = new StringBuffer("User{"); sb.append("id=").append(id); sb.append(", name='").append(name).append("'"); sb.append(", dept='").append(dept).append('\''); sb.append(", salary=").append(salary); sb.append('}'); return sb.toString(); } public Date getTime() { return time; } public void setTime(Date time) { this.time = time; } }
[ "ar-gurucharan.r@rakuten.com" ]
ar-gurucharan.r@rakuten.com
fabdf705a2f506d90f5fd3e231b4e4afcc70dba3
6ba21069b587e3bfe8e794d046e1fe2f85aebb65
/safecoldj/src/main/java/com/bankledger/safecoldj/utils/Base64.java
b020382f932e1e3f94c53f2739033994e6803471
[]
no_license
ulwfcyvi791837060/safegem-cold-wallet
704c783debc9c0b48fe716e437f71cbdd3f89f08
86d7729b4de0a29a077b918d528cae61be0dc088
refs/heads/master
2022-02-27T15:55:03.324818
2019-09-17T02:09:24
2019-09-17T02:09:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
29,432
java
/* * Copyright (C) 2010 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.bankledger.safecoldj.utils; import java.io.UnsupportedEncodingException; /** * Utilities for encoding and decoding the Base64 representation of * binary data. See RFCs <a * href="http://www.ietf.org/rfc/rfc2045.txt">2045</a> and <a * href="http://www.ietf.org/rfc/rfc3548.txt">3548</a>. */ public class Base64 { /** * Default values for encoder/decoder flags. */ public static final int DEFAULT = 0; /** * Encoder flag bit to omit the padding '=' characters at the end * of the output (if any). */ public static final int NO_PADDING = 1; /** * Encoder flag bit to omit all line terminators (i.e., the output * will be on one long line). */ public static final int NO_WRAP = 2; /** * Encoder flag bit to indicate lines should be terminated with a * CRLF pair instead of just an LF. Has no effect if {@code * NO_WRAP} is specified as well. */ public static final int CRLF = 4; /** * Encoder/decoder flag bit to indicate using the "URL and * filename safe" variant of Base64 (see RFC 3548 section 4) where * {@code -} and {@code _} are used in place of {@code +} and * {@code /}. */ public static final int URL_SAFE = 8; /** * Flag to pass to {@link Base64OutputStream} to indicate that it * should not close the output stream it is wrapping when it * itself is closed. */ public static final int NO_CLOSE = 16; // -------------------------------------------------------- // shared code // -------------------------------------------------------- /* package */ static abstract class Coder { public byte[] output; public int op; /** * Encode/decode another block of input data. this.output is * provided by the caller, and must be big enough to hold all * the coded data. On exit, this.opwill be set to the length * of the coded data. * * @param finish true if this is the final call to process for * this object. Will finalize the coder state and * include any final bytes in the output. * @return true if the input so far is good; false if some * error has been detected in the input stream.. */ public abstract boolean process(byte[] input, int offset, int len, boolean finish); /** * @return the maximum number of bytes a call to process() * could produce for the given number of input bytes. This may * be an overestimate. */ public abstract int maxOutputSize(int len); } // -------------------------------------------------------- // decoding // -------------------------------------------------------- /** * Decode the Base64-encoded data in input and return the data in * a new byte array. * <p/> * <p>The padding '=' characters at the end are considered optional, but * if any are present, there must be the correct number of them. * * @param str the input String to decode, which is converted to * bytes using the default charset * @param flags controls certain features of the decoded output. * Pass {@code DEFAULT} to decode standard Base64. * @throws IllegalArgumentException if the input contains * incorrect padding */ public static byte[] decode(String str, int flags) { return decode(str.getBytes(), flags); } /** * Decode the Base64-encoded data in input and return the data in * a new byte array. * <p/> * <p>The padding '=' characters at the end are considered optional, but * if any are present, there must be the correct number of them. * * @param input the input array to decode * @param flags controls certain features of the decoded output. * Pass {@code DEFAULT} to decode standard Base64. * @throws IllegalArgumentException if the input contains * incorrect padding */ public static byte[] decode(byte[] input, int flags) { return decode(input, 0, input.length, flags); } /** * Decode the Base64-encoded data in input and return the data in * a new byte array. * <p/> * <p>The padding '=' characters at the end are considered optional, but * if any are present, there must be the correct number of them. * * @param input the data to decode * @param offset the position within the input array at which to start * @param len the number of bytes of input to decode * @param flags controls certain features of the decoded output. * Pass {@code DEFAULT} to decode standard Base64. * @throws IllegalArgumentException if the input contains * incorrect padding */ public static byte[] decode(byte[] input, int offset, int len, int flags) { // Allocate space for the most data the input could represent. // (It could contain less if it contains whitespace, etc.) Decoder decoder = new Decoder(flags, new byte[len * 3 / 4]); if (!decoder.process(input, offset, len, true)) { throw new IllegalArgumentException("bad base-64"); } // Maybe we got lucky and allocated exactly enough output space. if (decoder.op == decoder.output.length) { return decoder.output; } // Need to shorten the array, so allocate a new one of the // right size and copy. byte[] temp = new byte[decoder.op]; System.arraycopy(decoder.output, 0, temp, 0, decoder.op); return temp; } /* package */ static class Decoder extends Coder { /** * Lookup table for turning bytes into their position in the * Base64 alphabet. */ private static final int DECODE[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -2, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }; /** * Decode lookup table for the "web safe" variant (RFC 3548 * sec. 4) where - and _ replace + and /. */ private static final int DECODE_WEBSAFE[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -2, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, 63, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }; /** * Non-data values in the DECODE arrays. */ private static final int SKIP = -1; private static final int EQUALS = -2; /** * States 0-3 are reading through the next input tuple. * State 4 is having read one '=' and expecting exactly * one more. * State 5 is expecting no more data or padding characters * in the input. * State 6 is the error state; an error has been detected * in the input and no future input can "fix" it. */ private int state; // state number (0 to 6) private int value; final private int[] alphabet; public Decoder(int flags, byte[] output) { this.output = output; alphabet = ((flags & URL_SAFE) == 0) ? DECODE : DECODE_WEBSAFE; state = 0; value = 0; } /** * @return an overestimate for the number of bytes {@code * len} bytes could decode to. */ public int maxOutputSize(int len) { return len * 3 / 4 + 10; } /** * Decode another block of input data. * * @return true if the state machine is still healthy. false if * bad base-64 data has been detected in the input stream. */ public boolean process(byte[] input, int offset, int len, boolean finish) { if (this.state == 6) return false; int p = offset; len += offset; // Using local variables makes the decoder about 12% // faster than if we manipulate the member variables in // the loop. (Even alphabet makes a measurable // difference, which is somewhat surprising to me since // the member variable is final.) int state = this.state; int value = this.value; int op = 0; final byte[] output = this.output; final int[] alphabet = this.alphabet; while (p < len) { // Try the fast path: we're starting a new tuple and the // next four bytes of the input stream are all data // bytes. This corresponds to going through states // 0-1-2-3-0. We expect to use this method for most of // the data. // // If any of the next four bytes of input are non-data // (whitespace, etc.), value will end up negative. (All // the non-data values in decode are small negative // numbers, so shifting any of them up and or'ing them // together will result in a value with its top bit set.) // // You can remove this whole block and the output should // be the same, just slower. if (state == 0) { while (p + 4 <= len && (value = ((alphabet[input[p] & 0xff] << 18) | (alphabet[input[p + 1] & 0xff] << 12) | (alphabet[input[p + 2] & 0xff] << 6) | (alphabet[input[p + 3] & 0xff]))) >= 0) { output[op + 2] = (byte) value; output[op + 1] = (byte) (value >> 8); output[op] = (byte) (value >> 16); op += 3; p += 4; } if (p >= len) break; } // The fast path isn't available -- either we've read a // partial tuple, or the next four input bytes aren't all // data, or whatever. Fall back to the slower state // machine implementation. int d = alphabet[input[p++] & 0xff]; switch (state) { case 0: if (d >= 0) { value = d; ++state; } else if (d != SKIP) { this.state = 6; return false; } break; case 1: if (d >= 0) { value = (value << 6) | d; ++state; } else if (d != SKIP) { this.state = 6; return false; } break; case 2: if (d >= 0) { value = (value << 6) | d; ++state; } else if (d == EQUALS) { // Emit the last (partial) output tuple; // expect exactly one more padding character. output[op++] = (byte) (value >> 4); state = 4; } else if (d != SKIP) { this.state = 6; return false; } break; case 3: if (d >= 0) { // Emit the output triple and return to state 0. value = (value << 6) | d; output[op + 2] = (byte) value; output[op + 1] = (byte) (value >> 8); output[op] = (byte) (value >> 16); op += 3; state = 0; } else if (d == EQUALS) { // Emit the last (partial) output tuple; // expect no further data or padding characters. output[op + 1] = (byte) (value >> 2); output[op] = (byte) (value >> 10); op += 2; state = 5; } else if (d != SKIP) { this.state = 6; return false; } break; case 4: if (d == EQUALS) { ++state; } else if (d != SKIP) { this.state = 6; return false; } break; case 5: if (d != SKIP) { this.state = 6; return false; } break; } } if (!finish) { // We're out of input, but a future call could provide // more. this.state = state; this.value = value; this.op = op; return true; } // Done reading input. Now figure out where we are left in // the state machine and finish up. switch (state) { case 0: // Output length is a multiple of three. Fine. break; case 1: // Read one extra input byte, which isn't enough to // make another output byte. Illegal. this.state = 6; return false; case 2: // Read two extra input bytes, enough to emit 1 more // output byte. Fine. output[op++] = (byte) (value >> 4); break; case 3: // Read three extra input bytes, enough to emit 2 more // output bytes. Fine. output[op++] = (byte) (value >> 10); output[op++] = (byte) (value >> 2); break; case 4: // Read one padding '=' when we expected 2. Illegal. this.state = 6; return false; case 5: // Read all the padding '='s we expected and no more. // Fine. break; } this.state = state; this.op = op; return true; } } // -------------------------------------------------------- // encoding // -------------------------------------------------------- /** * Base64-encode the given data and return a newly allocated * String with the result. * * @param input the data to encode * @param flags controls certain features of the encoded output. * Passing {@code DEFAULT} results in output that * adheres to RFC 2045. */ public static String encodeToString(byte[] input, int flags) { try { return new String(encode(input, flags), "US-ASCII"); } catch (UnsupportedEncodingException e) { // US-ASCII is guaranteed to be available. throw new AssertionError(e); } } /** * Base64-encode the given data and return a newly allocated * String with the result. * * @param input the data to encode * @param offset the position within the input array at which to * start * @param len the number of bytes of input to encode * @param flags controls certain features of the encoded output. * Passing {@code DEFAULT} results in output that * adheres to RFC 2045. */ public static String encodeToString(byte[] input, int offset, int len, int flags) { try { return new String(encode(input, offset, len, flags), "US-ASCII"); } catch (UnsupportedEncodingException e) { // US-ASCII is guaranteed to be available. throw new AssertionError(e); } } /** * Base64-encode the given data and return a newly allocated * byte[] with the result. * * @param input the data to encode * @param flags controls certain features of the encoded output. * Passing {@code DEFAULT} results in output that * adheres to RFC 2045. */ public static byte[] encode(byte[] input, int flags) { return encode(input, 0, input.length, flags); } /** * Base64-encode the given data and return a newly allocated * byte[] with the result. * * @param input the data to encode * @param offset the position within the input array at which to * start * @param len the number of bytes of input to encode * @param flags controls certain features of the encoded output. * Passing {@code DEFAULT} results in output that * adheres to RFC 2045. */ public static byte[] encode(byte[] input, int offset, int len, int flags) { Encoder encoder = new Encoder(flags, null); // Compute the exact length of the array we will produce. int output_len = len / 3 * 4; // Account for the tail of the data and the padding bytes, if any. if (encoder.do_padding) { if (len % 3 > 0) { output_len += 4; } } else { switch (len % 3) { case 0: break; case 1: output_len += 2; break; case 2: output_len += 3; break; } } // Account for the newlines, if any. if (encoder.do_newline && len > 0) { output_len += (((len - 1) / (3 * Encoder.LINE_GROUPS)) + 1) * (encoder.do_cr ? 2 : 1); } encoder.output = new byte[output_len]; encoder.process(input, offset, len, true); assert encoder.op == output_len; return encoder.output; } /* package */ static class Encoder extends Coder { /** * Emit a new line every this many output tuples. Corresponds to * a 76-character line length (the maximum allowable according to * <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>). */ public static final int LINE_GROUPS = 19; /** * Lookup table for turning Base64 alphabet positions (6 bits) * into output bytes. */ private static final byte ENCODE[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', }; /** * Lookup table for turning Base64 alphabet positions (6 bits) * into output bytes. */ private static final byte ENCODE_WEBSAFE[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_', }; final private byte[] tail; /* package */ int tailLen; private int count; final public boolean do_padding; final public boolean do_newline; final public boolean do_cr; final private byte[] alphabet; public Encoder(int flags, byte[] output) { this.output = output; do_padding = (flags & NO_PADDING) == 0; do_newline = (flags & NO_WRAP) == 0; do_cr = (flags & CRLF) != 0; alphabet = ((flags & URL_SAFE) == 0) ? ENCODE : ENCODE_WEBSAFE; tail = new byte[2]; tailLen = 0; count = do_newline ? LINE_GROUPS : -1; } /** * @return an overestimate for the number of bytes {@code * len} bytes could encode to. */ public int maxOutputSize(int len) { return len * 8 / 5 + 10; } public boolean process(byte[] input, int offset, int len, boolean finish) { // Using local variables makes the encoder about 9% faster. final byte[] alphabet = this.alphabet; final byte[] output = this.output; int op = 0; int count = this.count; int p = offset; len += offset; int v = -1; // First we need to concatenate the tail of the previous call // with any input bytes available now and see if we can empty // the tail. switch (tailLen) { case 0: // There was no tail. break; case 1: if (p + 2 <= len) { // A 1-byte tail with at least 2 bytes of // input available now. v = ((tail[0] & 0xff) << 16) | ((input[p++] & 0xff) << 8) | (input[p++] & 0xff); tailLen = 0; } ; break; case 2: if (p + 1 <= len) { // A 2-byte tail with at least 1 byte of input. v = ((tail[0] & 0xff) << 16) | ((tail[1] & 0xff) << 8) | (input[p++] & 0xff); tailLen = 0; } break; } if (v != -1) { output[op++] = alphabet[(v >> 18) & 0x3f]; output[op++] = alphabet[(v >> 12) & 0x3f]; output[op++] = alphabet[(v >> 6) & 0x3f]; output[op++] = alphabet[v & 0x3f]; if (--count == 0) { if (do_cr) output[op++] = '\r'; output[op++] = '\n'; count = LINE_GROUPS; } } // At this point either there is no tail, or there are fewer // than 3 bytes of input available. // The main loop, turning 3 input bytes into 4 output bytes on // each iteration. while (p + 3 <= len) { v = ((input[p] & 0xff) << 16) | ((input[p + 1] & 0xff) << 8) | (input[p + 2] & 0xff); output[op] = alphabet[(v >> 18) & 0x3f]; output[op + 1] = alphabet[(v >> 12) & 0x3f]; output[op + 2] = alphabet[(v >> 6) & 0x3f]; output[op + 3] = alphabet[v & 0x3f]; p += 3; op += 4; if (--count == 0) { if (do_cr) output[op++] = '\r'; output[op++] = '\n'; count = LINE_GROUPS; } } if (finish) { // Finish up the tail of the input. Note that we need to // consume any bytes in tail before any bytes // remaining in input; there should be at most two bytes // total. if (p - tailLen == len - 1) { int t = 0; v = ((tailLen > 0 ? tail[t++] : input[p++]) & 0xff) << 4; tailLen -= t; output[op++] = alphabet[(v >> 6) & 0x3f]; output[op++] = alphabet[v & 0x3f]; if (do_padding) { output[op++] = '='; output[op++] = '='; } if (do_newline) { if (do_cr) output[op++] = '\r'; output[op++] = '\n'; } } else if (p - tailLen == len - 2) { int t = 0; v = (((tailLen > 1 ? tail[t++] : input[p++]) & 0xff) << 10) | (((tailLen > 0 ? tail[t++] : input[p++]) & 0xff) << 2); tailLen -= t; output[op++] = alphabet[(v >> 12) & 0x3f]; output[op++] = alphabet[(v >> 6) & 0x3f]; output[op++] = alphabet[v & 0x3f]; if (do_padding) { output[op++] = '='; } if (do_newline) { if (do_cr) output[op++] = '\r'; output[op++] = '\n'; } } else if (do_newline && op > 0 && count != LINE_GROUPS) { if (do_cr) output[op++] = '\r'; output[op++] = '\n'; } assert tailLen == 0; assert p == len; } else { // Save the leftovers in tail to be consumed on the next // call to encodeInternal. if (p == len - 1) { tail[tailLen++] = input[p]; } else if (p == len - 2) { tail[tailLen++] = input[p]; tail[tailLen++] = input[p + 1]; } } this.op = op; this.count = count; return true; } } private Base64() { } // don't instantiate }
[ "615810037@qq.com" ]
615810037@qq.com
0590ca91aeacd6198f8b7ad665ec745254457c12
2dc7e6c88af1762aaa49a12247e2fc067ba7c422
/app/src/main/java/com/zgdj/djframe/model/TestModel.java
c5b8fe0977c091ca9a365b3b36590ac6b5a31aee
[]
no_license
jhj24/MyFrame
dd5fde33141b09f74001098d36e3f69e99f16f4c
a205c60b74ee4b133cc270090c954e514184d415
refs/heads/master
2020-06-28T11:21:20.812088
2019-11-06T06:56:04
2019-11-06T06:56:04
200,218,653
0
0
null
null
null
null
UTF-8
Java
false
false
625
java
package com.zgdj.djframe.model; import java.io.Serializable; /** * description: * author: Created by ShuaiQi_Zhang on 2018/5/3 * version: */ public class TestModel implements Serializable { private int id; private String name; private int pid; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getPid() { return pid; } public void setPid(int pid) { this.pid = pid; } }
[ "1406929846@qq.com" ]
1406929846@qq.com
e7d2a0769507eb789ee71711ea375b421329d5dc
cb5e302cbbb3da0d6d6b0011768cd7466efa6183
/src/com/umeng/analytics/game/e.java
64326835d5f7ccb57d533d4726ee3dd38a4e000f
[]
no_license
marcusrogerio/miband-1
e6cdcfce00d7186e25e184ca4c258a72b0aba097
b3498784582eb30eb2b06c3d054bcf80b04138d0
refs/heads/master
2021-05-06T23:33:01.192152
2014-08-30T11:42:00
2014-08-30T11:42:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
659
java
package com.umeng.analytics.game; import com.umeng.analytics.f; import java.util.HashMap; final class e extends f { e(d paramd, String paramString) { } public final void a() { d.a(this.a).a(this.b); HashMap localHashMap = new HashMap(); localHashMap.put("level", this.b); localHashMap.put("status", Integer.valueOf(0)); if (d.a(this.a).b != null) localHashMap.put("user_level", d.a(this.a).b); d.b(this.a).a(d.c(this.a), "level", localHashMap); } } /* Location: C:\Users\Fernando\Desktop\Mibandesv2.3\classes-dex2jar.jar * Qualified Name: com.umeng.analytics.game.e * JD-Core Version: 0.6.2 */
[ "kilfer.zgz@gmail.com" ]
kilfer.zgz@gmail.com
78c3b80e8b8cee07d3f90d23b7da5d7930c520c5
065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be
/eclipseswt_cluster/59823/tar_1.java
8a0dbed27bed945f5b08ba05200ec0822685a20b
[]
no_license
martinezmatias/GenPat-data-C3
63cfe27efee2946831139747e6c20cf952f1d6f6
b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4
refs/heads/master
2022-04-25T17:59:03.905613
2020-04-15T14:41:34
2020-04-15T14:41:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
39,788
java
package org.eclipse.swt.widgets; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.win32.*; import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; /** * Instances of this class provide the appearance and * behavior of <code>Shells</code>, but are not top * level shells or dialogs. Class <code>Shell</code> * shares a significant amount of code with this class, * and is a subclass. * <p> * Instances are always displayed in one of the maximized, * minimized or normal states: * <ul> * <li> * When an instance is marked as <em>maximized</em>, the * window manager will typically resize it to fill the * entire visible area of the display, and the instance * is usually put in a state where it can not be resized * (even if it has style <code>RESIZE</code>) until it is * no longer maximized. * </li><li> * When an instance is in the <em>normal</em> state (neither * maximized or minimized), its appearance is controlled by * the style constants which were specified when it was created * and the restrictions of the window manager (see below). * </li><li> * When an instance has been marked as <em>minimized</em>, * its contents (client area) will usually not be visible, * and depending on the window manager, it may be * "iconified" (that is, replaced on the desktop by a small * simplified representation of itself), relocated to a * distinguished area of the screen, or hidden. Combinations * of these changes are also possible. * </li> * </ul> * </p> * Note: The styles supported by this class must be treated * as <em>HINT</em>s, since the window manager for the * desktop on which the instance is visible has ultimate * control over the appearance and behavior of decorations. * For example, some window managers only support resizable * windows and will always assume the RESIZE style, even if * it is not set. * <dl> * <dt><b>Styles:</b></dt> * <dd>BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE</dd> * <dt><b>Events:</b></dt> * <dd>(none)</dd> * </dl> * Class <code>SWT</code> provides two "convenience constants" * for the most commonly required style combinations: * <dl> * <dt><code>SHELL_TRIM</code></dt> * <dd> * the result of combining the constants which are required * to produce a typical application top level shell: (that * is, <code>CLOSE | TITLE | MIN | MAX | RESIZE</code>) * </dd> * <dt><code>DIALOG_TRIM</code></dt> * <dd> * the result of combining the constants which are required * to produce a typical application dialog shell: (that * is, <code>TITLE | CLOSE | BORDER</code>) * </dd> * </dl> * <p> * IMPORTANT: This class is intended to be subclassed <em>only</em> * within the SWT implementation. * </p> * * @see #getMinimized * @see #getMaximized * @see Shell * @see SWT */ public class Decorations extends Canvas { Image image; Menu menuBar; Menu [] menus; MenuItem [] items; Control savedFocus; Button defaultButton, saveDefault; int swFlags, hAccel, nAccel; int hwndCB; /* * The start value for WM_COMMAND id's. * Windows reserves the values 0..100. */ static final int ID_START = 100; /** * Prevents uninitialized instances from being created outside the package. */ Decorations () { } /** * Constructs a new instance of this class given its parent * and a style value describing its behavior and appearance. * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * for all SWT widget classes should include a comment which * describes the style constants which are applicable to the class. * </p> * * @param parent a composite control which will be the parent of the new instance (cannot be null) * @param style the style of control to construct * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li> * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li> * </ul> * * @see SWT * @see Widget#checkSubclass * @see Widget#getStyle */ public Decorations (Composite parent, int style) { super (parent, checkStyle (style)); } void add (Menu menu) { if (menus == null) menus = new Menu [4]; for (int i=0; i<menus.length; i++) { if (menus [i] == null) { menus [i] = menu; return; } } Menu [] newMenus = new Menu [menus.length + 4]; newMenus [menus.length] = menu; System.arraycopy (menus, 0, newMenus, 0, menus.length); menus = newMenus; } void add (MenuItem item) { if (items == null) items = new MenuItem [12]; for (int i=0; i<items.length; i++) { if (items [i] == null) { item.id = i + ID_START; items [i] = item; return; } } item.id = items.length + ID_START; MenuItem [] newItems = new MenuItem [items.length + 12]; newItems [items.length] = item; System.arraycopy (items, 0, newItems, 0, items.length); items = newItems; } void bringToTop () { /* * This code is intentionally commented. On some platforms, * the ON_TOP style creates a shell that will stay on top * of every other shell on the desktop. Using SetWindowPos () * with HWND_TOP caused problems on Windows so this code is * commented out until this functionality is specified and * the problems are fixed. */ // if ((style & SWT.ON_TOP) != 0) { // int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE; // OS.SetWindowPos (handle, OS.HWND_TOP, 0, 0, 0, 0, flags); // } else { OS.BringWindowToTop (handle); // } } static int checkStyle (int style) { if (!OS.IsWinCE) { if ((style & (SWT.MENU | SWT.MIN | SWT.MAX | SWT.CLOSE)) != 0) { style |= SWT.TITLE; } } /* * If either WS_MINIMIZEBOX or WS_MAXIMIZEBOX are set, * we must also set WS_SYSMENU or the buttons will not * appear. */ if ((style & (SWT.MIN | SWT.MAX)) != 0) style |= SWT.CLOSE; /* * Both WS_SYSMENU and WS_CAPTION must be set in order * to for the system menu to appear. */ if ((style & SWT.CLOSE) != 0) style |= SWT.TITLE; /* * Bug in Windows. The WS_CAPTION style must be * set when the window is resizable or it does not * draw properly. */ /* * This code is intentionally commented. It seems * that this problem originally in Windows 3.11, * has been fixed in later versions. Because the * exact nature of the drawing problem is unknown, * keep the commented code around in case it comes * back. */ // if ((style & SWT.RESIZE) != 0) style |= SWT.TITLE; return style; } protected void checkSubclass () { if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS); } Control computeTabGroup () { return this; } Control computeTabRoot () { return this; } public Rectangle computeTrim (int x, int y, int width, int height) { checkWidget (); /* Get the size of the trimmings */ RECT rect = new RECT (); OS.SetRect (rect, x, y, x + width, y + height); int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); boolean hasMenu = OS.IsWinCE ? false : OS.GetMenu (handle) != 0; OS.AdjustWindowRectEx (rect, bits, hasMenu, OS.GetWindowLong (handle, OS.GWL_EXSTYLE)); /* Get the size of the scroll bars */ if (horizontalBar != null) rect.bottom += OS.GetSystemMetrics (OS.SM_CYHSCROLL); if (verticalBar != null) rect.right += OS.GetSystemMetrics (OS.SM_CXVSCROLL); /* Get the height of the menu bar */ if (hasMenu) { RECT testRect = new RECT (); OS.SetRect (testRect, 0, 0, rect.right - rect.left, rect.bottom - rect.top); OS.SendMessage (handle, OS.WM_NCCALCSIZE, 0, testRect); while ((testRect.bottom - testRect.top) < height) { rect.top -= OS.GetSystemMetrics (OS.SM_CYMENU) - OS.GetSystemMetrics (OS.SM_CYBORDER); OS.SetRect(testRect, 0, 0, rect.right - rect.left, rect.bottom - rect.top); OS.SendMessage (handle, OS.WM_NCCALCSIZE, 0, testRect); } } return new Rectangle (rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); } void createAcceleratorTable () { hAccel = nAccel = 0; int maxAccel = 0; if (menuBar == null || items == null) { if (!OS.IsWinCE) return; maxAccel = 1; } else { maxAccel = OS.IsWinCE ? items.length + 1 : items.length; } int size = ACCEL.sizeof; ACCEL accel = new ACCEL (); byte [] buffer1 = new byte [size]; byte [] buffer2 = new byte [maxAccel * size]; if (menuBar != null && items != null) { for (int i=0; i<items.length; i++) { MenuItem item = items [i]; if (item != null && item.accelerator != 0) { Menu parent = item.parent; while (parent != null && parent != menuBar) { parent = parent.getParentMenu (); } if (parent == menuBar) { item.fillAccel (accel); OS.MoveMemory (buffer1, accel, size); System.arraycopy (buffer1, 0, buffer2, nAccel * size, size); nAccel++; } } } } if (OS.IsWinCE) { /* * Note on WinCE PPC. Close the shell when user taps CTRL-Q. * IDOK represents the "Done Button" which also closes the shell. */ accel.fVirt = OS.FVIRTKEY | OS.FCONTROL; accel.key = 'Q'; accel.cmd = OS.IDOK; OS.MoveMemory (buffer1, accel, size); System.arraycopy (buffer1, 0, buffer2, nAccel * size, size); nAccel++; } if (nAccel != 0) hAccel = OS.CreateAcceleratorTable (buffer2, nAccel); } void createHandle () { super.createHandle (); if (parent == null) return; setParent (); setSystemMenu (); } void createWidget () { super.createWidget (); swFlags = OS.SW_SHOWNOACTIVATE; hAccel = -1; } void destroyAcceleratorTable () { if (hAccel != 0 && hAccel != -1) OS.DestroyAcceleratorTable (hAccel); hAccel = -1; } Menu findMenu (int hMenu) { if (menus == null) return null; for (int i=0; i<menus.length; i++) { Menu menu = menus [i]; if ((menu != null) && (hMenu == menu.handle)) return menu; } return null; } MenuItem findMenuItem (int id) { if (items == null) return null; id = id - ID_START; if (0 <= id && id < items.length) return items [id]; return null; } public Rectangle getBounds () { checkWidget (); if (!OS.IsWinCE) { if (OS.IsIconic (handle)) { WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT (); lpwndpl.length = WINDOWPLACEMENT.sizeof; OS.GetWindowPlacement (handle, lpwndpl); int width = lpwndpl.right - lpwndpl.left; int height = lpwndpl.bottom - lpwndpl.top; return new Rectangle (lpwndpl.left, lpwndpl.top, width, height); } } return super.getBounds (); } public Rectangle getClientArea () { checkWidget (); /* * Note: The CommandBar is part of the client area, * not the trim. Applications don't expect this so * subtract the height of the CommandBar. */ if (OS.IsWinCE) { Rectangle rect = super.getClientArea (); if (hwndCB != 0) { int height = OS.CommandBar_Height (hwndCB); rect.y += height; rect.height -= height; } return rect; } if (OS.IsIconic (handle)) { RECT rect = new RECT (); WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT (); lpwndpl.length = WINDOWPLACEMENT.sizeof; OS.GetWindowPlacement (handle, lpwndpl); int width = lpwndpl.right - lpwndpl.left; int height = lpwndpl.bottom - lpwndpl.top; OS.SetRect (rect, 0, 0, width, height); OS.SendMessage (handle, OS.WM_NCCALCSIZE, 0, rect); return new Rectangle (0, 0, rect.right, rect.bottom); } return super.getClientArea (); } /** * Returns the receiver's default button if one had * previously been set, otherwise returns null. * * @return the default button or null * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see #setDefaultButton */ public Button getDefaultButton () { checkWidget (); return defaultButton; } /** * Returns the receiver's image if it had previously been * set using <code>setImage()</code>. The image is typically * displayed by the window manager when the instance is * marked as iconified, and may also be displayed somewhere * in the trim when the instance is in normal or maximized * states. * <p> * Note: This method will return null if called before * <code>setImage()</code> is called. It does not provide * access to a window manager provided, "default" image * even if one exists. * </p> * * @return the image * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public Image getImage () { checkWidget (); return image; } public Point getLocation () { checkWidget (); if (!OS.IsWinCE) { if (OS.IsIconic (handle)) { WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT (); lpwndpl.length = WINDOWPLACEMENT.sizeof; OS.GetWindowPlacement (handle, lpwndpl); return new Point (lpwndpl.left, lpwndpl.top); } } return super.getLocation (); } /** * Returns <code>true</code> if the receiver is currently * maximized, and false otherwise. * <p> * * @return the maximized state * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see #setMaximized */ public boolean getMaximized () { checkWidget (); if (OS.IsWinCE) return false; if (OS.IsWindowVisible (handle)) return OS.IsZoomed (handle); return swFlags == OS.SW_SHOWMAXIMIZED; } /** * Returns the receiver's menu bar if one had previously * been set, otherwise returns null. * * @return the menu bar or null * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public Menu getMenuBar () { checkWidget (); return menuBar; } /** * Returns <code>true</code> if the receiver is currently * minimized, and false otherwise. * <p> * * @return the minimized state * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see #setMinimized */ public boolean getMinimized () { checkWidget (); if (OS.IsWinCE) return false; if (OS.IsWindowVisible (handle)) return OS.IsIconic (handle); return swFlags == OS.SW_SHOWMINNOACTIVE; } String getNameText () { return getText (); } public Point getSize () { checkWidget (); if (!OS.IsWinCE) { if (OS.IsIconic (handle)) { WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT (); lpwndpl.length = WINDOWPLACEMENT.sizeof; OS.GetWindowPlacement (handle, lpwndpl); int width = lpwndpl.right - lpwndpl.left; int height = lpwndpl.bottom - lpwndpl.top; return new Point (width, height); } } RECT rect = new RECT (); OS.GetWindowRect (handle, rect); int width = rect.right - rect.left; int height = rect.bottom - rect.top; return new Point (width, height); } /** * Returns the receiver's text, which is the string that the * window manager will typically display as the receiver's * <em>title</em>. If the text has not previously been set, * returns an empty string. * * @return the text * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public String getText () { checkWidget (); int length = OS.GetWindowTextLength (handle); if (length == 0) return ""; /* Use the character encoding for the default locale */ TCHAR buffer = new TCHAR (0, length + 1); OS.GetWindowText (handle, buffer, length + 1); return buffer.toString (0, length); } boolean isTabGroup () { /* * */ return true; } Decorations menuShell () { return this; } boolean moveMenu (int hMenuSrc, int hMenuDest) { boolean success = true; TCHAR lpNewItem = new TCHAR (0, "", true); int index = 0, cch = 128; int byteCount = cch * TCHAR.sizeof; int hHeap = OS.GetProcessHeap (); int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); MENUITEMINFO lpmii = new MENUITEMINFO (); lpmii.cbSize = MENUITEMINFO.sizeof; lpmii.fMask = OS.MIIM_STATE | OS.MIIM_ID | OS.MIIM_TYPE | OS.MIIM_DATA | OS.MIIM_SUBMENU; lpmii.dwTypeData = pszText; lpmii.cch = cch; while (OS.GetMenuItemInfo (hMenuSrc, 0, true, lpmii)) { int uFlags = OS.MF_BYPOSITION | OS.MF_ENABLED; int uIDNewItem = lpmii.wID; if (lpmii.hSubMenu != 0) { uFlags |= OS.MF_POPUP; uIDNewItem = lpmii.hSubMenu; } success = OS.InsertMenu (hMenuDest, index, uFlags, uIDNewItem, lpNewItem); if (!success) break; /* Set application data and text info */ lpmii.fMask = OS.MIIM_DATA | OS.MIIM_TYPE; success = OS.SetMenuItemInfo (hMenuDest, index, true, lpmii); if (!success) break; lpmii.fMask = OS.MIIM_STATE | OS.MIIM_ID | OS.MIIM_TYPE | OS.MIIM_DATA | OS.MIIM_SUBMENU; if ((lpmii.fState & (OS.MFS_DISABLED | OS.MFS_GRAYED)) != 0) { OS.EnableMenuItem (hMenuDest, index, OS.MF_BYPOSITION | OS.MF_GRAYED); } if ((lpmii.fState & OS.MFS_CHECKED) != 0) { OS.CheckMenuItem (hMenuDest, index, OS.MF_BYPOSITION | OS.MF_CHECKED); } OS.RemoveMenu (hMenuSrc, 0, OS.MF_BYPOSITION); index++; lpmii.cch = cch; } if (pszText != 0) OS.HeapFree (hHeap, 0, pszText); return success; } void releaseWidget () { if (menuBar != null) { menuBar.releaseWidget (); menuBar.releaseHandle (); } menuBar = null; if (menus != null) { for (int i=0; i<menus.length; i++) { Menu menu = menus [i]; if (menu != null && !menu.isDisposed ()) { menu.dispose (); } } } menus = null; super.releaseWidget (); if (image != null) { int hOld = OS.SendMessage (handle, OS.WM_GETICON, OS.ICON_BIG, 0); if (hOld != 0 && image.handle != hOld) OS.DestroyIcon (hOld); } items = null; image = null; savedFocus = null; defaultButton = saveDefault = null; if (hAccel != 0 && hAccel != -1) OS.DestroyAcceleratorTable (hAccel); hAccel = -1; hwndCB = 0; } void remove (Menu menu) { if (menus == null) return; for (int i=0; i<menus.length; i++) { if (menus [i] == menu) { menus [i] = null; return; } } } void remove (MenuItem item) { if (items == null) return; items [item.id - ID_START] = null; item.id = -1; } boolean restoreFocus () { if (savedFocus != null && savedFocus.isDisposed ()) savedFocus = null; if (savedFocus == null) return false; return savedFocus.forceFocus (); } void saveFocus () { Control control = getDisplay ().getFocusControl (); if (control != null) setSavedFocus (control); } void setBounds (int x, int y, int width, int height, int flags) { if (!OS.IsWinCE) { if (OS.IsIconic (handle)) { WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT (); lpwndpl.length = WINDOWPLACEMENT.sizeof; OS.GetWindowPlacement (handle, lpwndpl); lpwndpl.showCmd = 0; if ((flags & OS.SWP_NOMOVE) == 0) { lpwndpl.left = x; lpwndpl.top = y; } if ((flags & OS.SWP_NOSIZE) == 0) { lpwndpl.right = x + width; lpwndpl.bottom = y + height; } OS.SetWindowPlacement (handle, lpwndpl); return; } } super.setBounds (x, y, width, height, flags); } /** * If the argument is not null, sets the receiver's default * button to the argument, and if the argument is null, sets * the receiver's default button to the first button which * was set as the receiver's default button (called the * <em>saved default button</em>). If no default button had * previously been set, or the saved default button was * disposed, the receiver's default button will be set to * null. * * @param the new default button * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_ARGUMENT - if the button has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void setDefaultButton (Button button) { checkWidget (); setDefaultButton (button, true); } void setDefaultButton (Button button, boolean save) { if (button == null) { if (defaultButton == saveDefault) return; } else { if (button.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT); if ((button.style & SWT.PUSH) == 0) return; if (button == defaultButton) return; } if (defaultButton != null) { if (!defaultButton.isDisposed ()) defaultButton.setDefault (false); } if ((defaultButton = button) == null) defaultButton = saveDefault; if (defaultButton != null) { if (!defaultButton.isDisposed ()) defaultButton.setDefault (true); } if (save || saveDefault == null) saveDefault = defaultButton; if (saveDefault != null && saveDefault.isDisposed ()) saveDefault = null; } public boolean setFocus () { checkWidget (); if (this instanceof Shell) return super.setFocus (); /* * Bug in Windows. Setting the focus to a child of the * receiver interferes with moving and resizing of the * parent shell. The fix (for now) is to always set the * focus to the shell. */ int hwndFocus = OS.SetFocus (getShell ().handle); return hwndFocus == OS.GetFocus (); } /** * Sets the receiver's image to the argument, which may * be null. The image is typically displayed by the window * manager when the instance is marked as iconified, and * may also be displayed somewhere in the trim when the * instance is in normal or maximized states. * * @param image the new image (or null) * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void setImage (Image image) { checkWidget (); int hIcon = 0; if (image != null) { if (image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT); switch (image.type) { case SWT.BITMAP: int hOld = OS.SendMessage (handle, OS.WM_GETICON, OS.ICON_BIG, 0); if (hOld != 0 && image != null) { int hImage = this.image.handle; if (hImage != hOld) OS.DestroyIcon (hOld); } /* Copy the bitmap in case it's a DIB */ int hBitmap = image.handle; BITMAP bm = new BITMAP (); OS.GetObject (hBitmap, BITMAP.sizeof, bm); byte [] lpvBits = new byte [(bm.bmWidth + 15) / 16 * 2 * bm.bmHeight]; int hMask = OS.CreateBitmap (bm.bmWidth, bm.bmHeight, 1, 1, lpvBits); int hDC = OS.GetDC (handle); int hdcMem = OS.CreateCompatibleDC (hDC); int hColor = OS.CreateCompatibleBitmap (hDC, bm.bmWidth, bm.bmHeight); OS.SelectObject (hdcMem, hColor); int hdcBmp = OS.CreateCompatibleDC (hDC); OS.SelectObject (hdcBmp, hBitmap); OS.BitBlt (hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, hdcBmp, 0, 0, OS.SRCCOPY); ICONINFO info = new ICONINFO (); info.fIcon = true; info.hbmMask = hMask; info.hbmColor = hColor; hIcon = OS.CreateIconIndirect (info); OS.DeleteObject (hMask); OS.DeleteObject(hColor); OS.DeleteDC (hdcBmp); OS.DeleteDC (hdcMem); OS.ReleaseDC (handle, hDC); break; case SWT.ICON: hIcon = image.handle; break; default: return; } } this.image = image; OS.SendMessage (handle, OS.WM_SETICON, OS.ICON_BIG, hIcon); /* * Bug in Windows. When WM_SETICON is used to remove an * icon from the window trimmings for a window with the * extended style bits WS_EX_DLGMODALFRAME, the window * trimmings do not redraw to hide the previous icon. * The fix is to force a redraw. */ if (!OS.IsWinCE) { if (hIcon == 0 && (style & SWT.BORDER) != 0) { int flags = OS.RDW_FRAME | OS.RDW_INVALIDATE; OS.RedrawWindow (handle, null, 0, flags); } } } /** * Sets the maximized state of the receiver. * If the argument is <code>true</code> causes the receiver * to switch to the maximized state, and if the argument is * <code>false</code> and the receiver was previously maximized, * causes the receiver to switch back to either the minimized * or normal states. * <p> * Note: The result of intermixing calls to<code>setMaximized(true)</code> * and <code>setMinimized(true)</code> will vary by platform. Typically, * the behavior will match the platform user's expectations, but not * always. This should be avoided if possible. * </p> * * @param the new maximized state * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see #setMinimized */ public void setMaximized (boolean maximized) { checkWidget (); if (OS.IsWinCE) { /* * Note: WinCE does not support SW_SHOWMAXIMIZED and SW_RESTORE. The * workaround is to resize the window to fit the parent client area. * PocketPC windows typically don't have a caption when they are * maximized. They usually have one when they are not occupying all the * space. We implement this behavior by default - it can be overriden by * setting SWT.TITLE or SWT.NO_TRIM. */ if (maximized) { if ((style & SWT.TITLE) == 0) { /* remove caption when maximized */ int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); bits &= ~OS.WS_CAPTION; OS.SetWindowLong (handle, OS.GWL_STYLE, bits); } int flags = OS.SWP_NOZORDER | OS.SWP_DRAWFRAME | OS.SWP_NOACTIVATE; RECT rect = new RECT (); OS.SystemParametersInfo (OS.SPI_GETWORKAREA, 0, rect, 0); int width = rect.right - rect.left, height = rect.bottom - rect.top; OS.SetWindowPos (handle, 0, rect.left, rect.top, width, height, flags); } else { if ((style & SWT.NO_TRIM) == 0) { /* insert caption when no longer maximized */ int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); bits |= OS.WS_CAPTION; OS.SetWindowLong (handle, OS.GWL_STYLE, bits); int flags = OS.SWP_NOMOVE | OS.SWP_NOSIZE | OS.SWP_NOZORDER | OS.SWP_DRAWFRAME; OS.SetWindowPos (handle, 0, 0, 0, 0, 0, flags); } } } else { swFlags = OS.SW_RESTORE; if (maximized) swFlags = OS.SW_SHOWMAXIMIZED; if (!OS.IsWindowVisible (handle)) return; if (maximized == OS.IsZoomed (handle)) return; OS.ShowWindow (handle, swFlags); OS.UpdateWindow (handle); } } /** * Sets the receiver's menu bar to the argument, which * may be null. * * @param menu the new menu bar * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li> * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ /** * Sets the receiver's menu bar to the argument, which * may be null. * * @param menu the new menu bar * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li> * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void setMenuBar (Menu menu) { checkWidget (); if (menuBar == menu) return; if (menu != null) { if (menu.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT); if ((menu.style & SWT.BAR) == 0) error (SWT.ERROR_MENU_NOT_BAR); if (menu.parent != this) error (SWT.ERROR_INVALID_PARENT); } if (OS.IsWinCE) { boolean resize = menuBar != menu; if (menuBar != null) { /* * Because CommandBar_Destroy destroys the menu bar, it * is necessary to move the current items into a new menu * before it is called. */ int hMenu = OS.CreateMenu (); if (!moveMenu (menuBar.handle, hMenu)) { error (SWT.ERROR_CANNOT_SET_MENU); } menuBar.handle = hMenu; if (hwndCB != 0) OS.CommandBar_Destroy (hwndCB); hwndCB = 0; } menuBar = menu; if (menuBar != null) { hwndCB = OS.CommandBar_Create (OS.GetModuleHandle (null), handle, 1); OS.CommandBar_InsertMenubarEx (hwndCB, 0, menuBar.handle, 0); } if (resize) { sendEvent (SWT.Resize); layout (false); } } else { menuBar = menu; int hMenu = 0; if (menuBar != null) hMenu = menuBar.handle; OS.SetMenu (handle, hMenu); } destroyAcceleratorTable (); } /** * Sets the minimized stated of the receiver. * If the argument is <code>true</code> causes the receiver * to switch to the minimized state, and if the argument is * <code>false</code> and the receiver was previously minimized, * causes the receiver to switch back to either the maximized * or normal states. * <p> * Note: The result of intermixing calls to<code>setMaximized(true)</code> * and <code>setMinimized(true)</code> will vary by platform. Typically, * the behavior will match the platform user's expectations, but not * always. This should be avoided if possible. * </p> * * @param the new maximized state * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * * @see #setMaximized */ public void setMinimized (boolean minimized) { checkWidget (); if (OS.IsWinCE) return; swFlags = OS.SW_RESTORE; if (minimized) swFlags = OS.SW_SHOWMINNOACTIVE; if (!OS.IsWindowVisible (handle)) return; if (minimized == OS.IsIconic (handle)) return; OS.ShowWindow (handle, swFlags); OS.UpdateWindow (handle); } void setParent () { /* * In order for an MDI child window to support * a menu bar, setParent () is needed to reset * the parent. Otherwise, the MDI child window * will appear as a separate shell. This is an * undocumented and possibly dangerous Windows * feature. */ Display display = getDisplay (); int hwndParent = parent.handle; display.lockActiveWindow = true; OS.SetParent (handle, hwndParent); if (!OS.IsWindowVisible (hwndParent)) { OS.ShowWindow (handle, OS.SW_SHOWNA); } display.lockActiveWindow = false; } void setSavedFocus (Control control) { if (this == control) { savedFocus = null; return; } if (this != control.menuShell ()) return; savedFocus = control; } void setSystemMenu () { if (OS.IsWinCE) return; int hMenu = OS.GetSystemMenu (handle, false); if (hMenu == 0) return; int oldCount = OS.GetMenuItemCount (hMenu); if ((style & SWT.RESIZE) == 0) { OS.DeleteMenu (hMenu, OS.SC_SIZE, OS.MF_BYCOMMAND); } if ((style & SWT.MIN) == 0) { OS.DeleteMenu (hMenu, OS.SC_MINIMIZE, OS.MF_BYCOMMAND); } if ((style & SWT.MAX) == 0) { OS.DeleteMenu (hMenu, OS.SC_MAXIMIZE, OS.MF_BYCOMMAND); } if ((style & (SWT.MIN | SWT.MAX)) == 0) { OS.DeleteMenu (hMenu, OS.SC_RESTORE, OS.MF_BYCOMMAND); } int newCount = OS.GetMenuItemCount (hMenu); if ((style & SWT.CLOSE) == 0 || newCount != oldCount) { OS.DeleteMenu (hMenu, OS.SC_TASKLIST, OS.MF_BYCOMMAND); MENUITEMINFO info = new MENUITEMINFO (); info.cbSize = MENUITEMINFO.sizeof; info.fMask = OS.MIIM_ID; int index = 0; while (index < newCount) { if (OS.GetMenuItemInfo (hMenu, index, true, info)) { if (info.wID == OS.SC_CLOSE) break; } index++; } if (index != newCount) { OS.DeleteMenu (hMenu, index - 1, OS.MF_BYPOSITION); if ((style & SWT.CLOSE) == 0) { OS.DeleteMenu (hMenu, OS.SC_CLOSE, OS.MF_BYCOMMAND); } } } } /** * Sets the receiver's text, which is the string that the * window manager will typically display as the receiver's * <em>title</em>, to the argument, which may not be null. * * @param text the new text * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void setText (String string) { checkWidget (); if (string == null) error (SWT.ERROR_NULL_ARGUMENT); /* Use the character encoding for the default locale */ TCHAR buffer = new TCHAR (0, string, true); OS.SetWindowText (handle, buffer); } public void setVisible (boolean visible) { checkWidget (); if (visible == OS.IsWindowVisible (handle)) return; if (visible) { /* * It is possible (but unlikely), that application * code could have disposed the widget in the show * event. If this happens, just return. */ sendEvent (SWT.Show); if (isDisposed ()) return; if (OS.IsWinCE) { OS.CommandBar_DrawMenuBar (hwndCB, 0); } else { OS.DrawMenuBar (handle); } OS.ShowWindow (handle, swFlags); OS.UpdateWindow (handle); } else { if (!OS.IsWinCE) { if (OS.IsIconic (handle)) { swFlags = OS.SW_SHOWMINNOACTIVE; } else { if (OS.IsZoomed (handle)) { swFlags = OS.SW_SHOWMAXIMIZED; } else { if (handle == OS.GetActiveWindow ()) { swFlags = OS.SW_RESTORE; } else { swFlags = OS.SW_SHOWNOACTIVATE; } } } } OS.ShowWindow (handle, OS.SW_HIDE); sendEvent (SWT.Hide); } } boolean translateAccelerator (MSG msg) { if (!isEnabled ()) return false; if (hAccel == -1) createAcceleratorTable (); if (hAccel == 0) return false; return OS.TranslateAccelerator (handle, hAccel, msg) != 0; } boolean traverseItem (boolean next) { return false; } int widgetExtStyle () { int bits = 0; if (OS.IsWinCE) { if ((style & SWT.CLOSE) != 0) bits |= OS.WS_EX_CAPTIONOKBTN; } if ((style & SWT.TOOL) != 0) bits |= OS.WS_EX_TOOLWINDOW; if ((style & SWT.RESIZE) != 0) return bits; if ((style & SWT.BORDER) != 0) bits |= OS.WS_EX_DLGMODALFRAME; return bits; } int widgetStyle () { /* * Set WS_POPUP and clear WS_VISIBLE and WS_TABSTOP. * NOTE: WS_TABSTOP is the same as WS_MAXIMIZEBOX so * it cannot be used to do tabbing with decorations. */ int bits = super.widgetStyle () | OS.WS_POPUP; bits &= ~(OS.WS_VISIBLE | OS.WS_TABSTOP); /* Set the title bits and no-trim bits */ bits &= ~OS.WS_BORDER; if ((style & SWT.NO_TRIM) != 0) return bits; if ((style & SWT.TITLE) != 0) bits |= OS.WS_CAPTION; /* Set the min and max button bits */ if ((style & SWT.MIN) != 0) bits |= OS.WS_MINIMIZEBOX; if ((style & SWT.MAX) != 0) bits |= OS.WS_MAXIMIZEBOX; /* Set the resize, dialog border or border bits */ if ((style & SWT.RESIZE) != 0) { bits |= OS.WS_THICKFRAME; } else { if ((style & SWT.BORDER) == 0) bits |= OS.WS_BORDER; } /* Set the system menu and close box bits */ if (!OS.IsWinCE) { if ((style & SWT.CLOSE) != 0) bits |= OS.WS_SYSMENU; } return bits; } int windowProc (int msg, int wParam, int lParam) { switch (msg) { case OS.WM_APP: case OS.WM_APP+1: if (hAccel == -1) createAcceleratorTable (); return msg == OS.WM_APP ? nAccel : hAccel; } return super.windowProc (msg, wParam, lParam); } LRESULT WM_ACTIVATE (int wParam, int lParam) { LRESULT result = super.WM_ACTIVATE (wParam, lParam); if (result != null) return result; if ((wParam & 0xFFFF) == 0) { /* * It is possible (but unlikely), that application * code could have disposed the widget in the deactivate * event. If this happens, end the processing of the * Windows message by returning zero as the result of * the window proc. */ Shell shell = getShell (); shell.setActiveControl (null); if (isDisposed ()) return LRESULT.ZERO; sendEvent (SWT.Deactivate); if (isDisposed ()) return LRESULT.ZERO; saveFocus (); } else { /* * It is possible (but unlikely), that application * code could have disposed the widget in the activate * event. If this happens, end the processing of the * Windows message by returning zero as the result of * the window proc. */ sendEvent (SWT.Activate); if (isDisposed ()) return LRESULT.ZERO; if (restoreFocus ()) return LRESULT.ZERO; } return result; } LRESULT WM_CLOSE (int wParam, int lParam) { LRESULT result = super.WM_CLOSE (wParam, lParam); if (result != null) return result; Event event = new Event (); sendEvent (SWT.Close, event); // the widget could be disposed at this point if (event.doit && !isDisposed ()) dispose (); return LRESULT.ZERO; } LRESULT WM_KILLFOCUS (int wParam, int lParam) { LRESULT result = super.WM_KILLFOCUS (wParam, lParam); saveFocus (); return result; } LRESULT WM_NCACTIVATE (int wParam, int lParam) { LRESULT result = super.WM_NCACTIVATE (wParam, lParam); if (result != null) return result; if (wParam == 0) { Display display = getDisplay (); if (display.lockActiveWindow) return LRESULT.ZERO; } return result; } LRESULT WM_QUERYOPEN (int wParam, int lParam) { LRESULT result = super.WM_QUERYOPEN (wParam, lParam); if (result != null) return result; sendEvent (SWT.Deiconify); // widget could be disposed at this point return result; } LRESULT WM_SETFOCUS (int wParam, int lParam) { LRESULT result = super.WM_SETFOCUS (wParam, lParam); restoreFocus (); return result; } LRESULT WM_SIZE (int wParam, int lParam) { LRESULT result = super.WM_SIZE (wParam, lParam); /* * It is possible (but unlikely), that application * code could have disposed the widget in the resize * event. If this happens, end the processing of the * Windows message by returning the result of the * WM_SIZE message. */ if (isDisposed ()) return result; if (wParam == OS.SIZE_MINIMIZED) { sendEvent (SWT.Iconify); // widget could be disposed at this point } return result; } LRESULT WM_WINDOWPOSCHANGING (int wParam, int lParam) { LRESULT result = super.WM_WINDOWPOSCHANGING (wParam,lParam); if (result != null) return result; Display display = getDisplay (); if (display.lockActiveWindow) { WINDOWPOS lpwp = new WINDOWPOS (); OS.MoveMemory (lpwp, lParam, WINDOWPOS.sizeof); lpwp.flags |= OS.SWP_NOZORDER; OS.MoveMemory (lParam, lpwp, WINDOWPOS.sizeof); } return result; } }
[ "375833274@qq.com" ]
375833274@qq.com
0f0c6eb8149d1c705fdf66cee0f31bda97f4b3c4
d4eae735f5359a8479c37f0cfdc1fd09eb50653c
/src/P03/text/SignOpearatorExample.java
8de549bdba05d8882c17353f57db1b667dd03f64
[]
no_license
soobin-0513/java20210325
76752ce735e099bbc13cfaa8315a8a1f4529cb03
b31cbbba0fc7750652d652b9b92ede5acc0b72d7
refs/heads/master
2023-05-01T03:32:11.522917
2021-05-24T10:20:15
2021-05-24T10:20:15
351,269,325
0
0
null
null
null
null
UTF-8
Java
false
false
417
java
package P03.text; public class SignOpearatorExample { public static void main(String[] args) { int x = -100; int result1 = +x; int result2 = -x; System.out.println("result1="+result1); System.out.println("result2="+result2); short s =100; // short result3= -s; 강제형변환해줘야함 short result3 = (short)- s; // int result3 = -s; System.out.println("result3="+result3); } }
[ "rxb0513@gmail.com" ]
rxb0513@gmail.com
c705200fb9bd319d22ab92b3f6f7f891a7ca79fe
86b897d13e30cb3292a4ced60f7f4c03153d4d76
/ffms/ffms-ticket/src/main/java/com/hm/ticket/package-info.java
07945824bbae2fc6a7d469af67e983a0b0ae9f26
[]
no_license
duke129/ffms_server
b15fc2e2f243390a44b8f59baca2a9b04817a894
cbdd8838d78d0bcc45a7ae0f8164305d8b969c6b
refs/heads/master
2020-03-18T21:38:37.923435
2018-08-03T09:39:10
2018-08-03T09:39:10
135,291,990
1
0
null
null
null
null
UTF-8
Java
false
false
62
java
/** * */ /** * @author kiran * */ package com.hm.ticket;
[ "srinivaskiran.malla@happiestminds.com" ]
srinivaskiran.malla@happiestminds.com
d64c2e0764903868bdd0f21ee0e4471077ec5223
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/24/24_39d4f651eb71b47dcec8477e11d771e39e861a83/processedQueries/24_39d4f651eb71b47dcec8477e11d771e39e861a83_processedQueries_s.java
ac5ef53958ca6634a6e60a0273401d182160a89b
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
2,538
java
package net.ednovak.nearby; import java.util.ArrayList; import android.app.ListActivity; import android.content.ActivityNotFoundException; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemLongClickListener; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; public class processedQueries extends ListActivity { private static ArrayList<String> data = new ArrayList<String>(); // Should be called when activity is newly opened @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_processed_queries); Log.d("processed", "Anything at all"); Intent i = getIntent(); String lat = i.getStringExtra("lat"); String lon = i.getStringExtra("lon"); String name = i.getStringExtra("name"); ListView list = (ListView)findViewById(android.R.id.list); //data.add(name + ": " + lat + ", " + lon); data.add(0, name + ": " + lat + ", " + lon); ArrayAdapter<String> AA = new ArrayAdapter<String>(this, R.layout.smallfont, data); list.setAdapter(AA); // Short click to open with browser list.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View v, int pos, long id){ String s = ((TextView) v).getText().toString(); s = s.split(":")[1]; //http://maps.google.com/?f=q&q=37.2700,+-76.7116 String url = "http://maps.google.com/?f=q&q=" + s; Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); } }); // Long click to open with maps app list.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View v, int pos, long id){ String s = ((TextView) v).getText().toString(); s = s.split(":")[1]; String url = "geo:" + s; Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); try{ startActivity(i); } catch (ActivityNotFoundException e){ Toast.makeText(getApplicationContext(), "You don't have a maps app!", Toast.LENGTH_SHORT).show(); } return true; } }); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
3874d507bbebb4d35a518d8bbcb2e4ad36fadcd8
3ff34fdbb75a0c8525f52a7dcc936a4b90049b3a
/AutomationSessions/src/automationFramework/Countingsimilarelements.java
735e74bb9ef397aead68bff5ba3738a616b3dac6
[]
no_license
Ashakabali/SeleniumPrograms
845fcf182e339579f4b947fbe19e1642866d64c7
305b0db9580fb66c8657da2988c8904f934e3ba7
refs/heads/master
2022-11-28T18:04:42.474662
2020-08-06T05:16:30
2020-08-06T05:16:30
284,942,018
0
0
null
null
null
null
UTF-8
Java
false
false
778
java
package automationFramework; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class Countingsimilarelements { public static void main(String[] args) { // TODO Auto-generated method stub System.setProperty("webdriver.chrome.driver", "D://Automation//Essentials//chromedriver_win32//chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("https://en.wikipedia.org/wiki/A._P._J._Abdul_Kalam"); driver.manage().window().maximize(); int linkcount= driver.findElements(By.tagName("a")).size(); System.out.println(linkcount); int immagecount = driver.findElements(By.tagName("img")).size(); System.out.println(immagecount); } }
[ "Asha k@192.168.1.4" ]
Asha k@192.168.1.4
ed8f125645e792f1a945f32f07c8719330e65814
2ff10f86474e15071a947223ee5a5dad9182b85f
/src/main/java/com/in28minutes/business/TodoBusinessImpl.java
2a455c11e886d6173052892a7bbc3355695ef0ac
[]
no_license
VinodhThiagarajan1309/mission-2018-mockito
28e02cafc019f7670785d671de3a84a81b1b24c7
650b79a1d987e6f91563b087954b264741615b14
refs/heads/master
2021-05-10T20:04:30.242022
2018-10-11T00:47:58
2018-10-11T00:47:58
118,174,212
0
0
null
null
null
null
UTF-8
Java
false
false
878
java
package com.in28minutes.business; import java.util.ArrayList; import java.util.List; import com.in28minutes.data.api.TodoService; import com.in28minutes.data.api.TodoServiceImpl; public class TodoBusinessImpl { private TodoService todoService; TodoBusinessImpl(TodoService todoService) { this.todoService = todoService; } public List<String> retrieveTodosRelatedToSpring(String user) { List<String> filteredTodos = new ArrayList<String>(); List<String> allTodos = todoService.retrieveTodos(user); for (String todo : allTodos) { if (todo.contains("Spring")) { filteredTodos.add(todo); } } return filteredTodos; } public void deleteTodosNotRelatedToSpring(String user) { List<String> allTodos = todoService.retrieveTodos(user); for (String todo : allTodos) { if (!todo.contains("Spring")) { todoService.deleteTodos(todo); } } } }
[ "vthiagarajan@homeaway.com" ]
vthiagarajan@homeaway.com
e607c19cd09e46bdca1807503b5fc34a356c015e
d7c5121237c705b5847e374974b39f47fae13e10
/airspan.netspan/src/main/java/Netspan/NBI_15_2/Software/ErrorCodes.java
341496f9898f88c9e83003b980b3b4830c7a27a0
[]
no_license
AirspanNetworks/SWITModules
8ae768e0b864fa57dcb17168d015f6585d4455aa
7089a4b6456621a3abd601cc4592d4b52a948b57
refs/heads/master
2022-11-24T11:20:29.041478
2020-08-09T07:20:03
2020-08-09T07:20:03
184,545,627
1
0
null
2022-11-16T12:35:12
2019-05-02T08:21:55
Java
UTF-8
Java
false
false
1,530
java
package Netspan.NBI_15_2.Software; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for ErrorCodes. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="ErrorCodes"&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt; * &lt;enumeration value="OK"/&gt; * &lt;enumeration value="NotAuthorized"/&gt; * &lt;enumeration value="NotLicensed"/&gt; * &lt;enumeration value="InvalidParameters"/&gt; * &lt;enumeration value="Error"/&gt; * &lt;/restriction&gt; * &lt;/simpleType&gt; * </pre> * */ @XmlType(name = "ErrorCodes") @XmlEnum public enum ErrorCodes { OK("OK"), @XmlEnumValue("NotAuthorized") NOT_AUTHORIZED("NotAuthorized"), @XmlEnumValue("NotLicensed") NOT_LICENSED("NotLicensed"), @XmlEnumValue("InvalidParameters") INVALID_PARAMETERS("InvalidParameters"), @XmlEnumValue("Error") ERROR("Error"); private final String value; ErrorCodes(String v) { value = v; } public String value() { return value; } public static ErrorCodes fromValue(String v) { for (ErrorCodes c: ErrorCodes.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); } }
[ "dshalom@airspan.com" ]
dshalom@airspan.com
172c1e602e8c37d19e8588144485093913536c4d
6042c12e271e4968ee73b04ff5a7e5b3c2b2cc4b
/src/by/htp/rentalfile/entity/Equipment.java
8baccc63956aa2cae1605e27bb8a0ff33acf9a37
[]
no_license
ardilla1991/rentalfile
cfb7eb5ccc29f107861e19d853a99423f4b449c3
ca5d96f7a506bd3eb73da91e36caa76f9ba4bb62
refs/heads/master
2021-01-19T20:45:35.608384
2017-04-17T20:12:48
2017-04-17T20:12:48
88,546,316
0
0
null
null
null
null
UTF-8
Java
false
false
1,225
java
package by.htp.rentalfile.entity; public abstract class Equipment { private int id; private double price; private double weight; private double width; private double height; private CategoryEq category; // for child or for adult public Equipment(int id, double price, double weight, double width, double height, CategoryEq category) { this.id = id; this.price = price; this.weight = weight; this.width = width; this.height = height; this.category = category; } public int getId() { return id; } public void setId(int id) { this.id = id; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public double getWeight() { return weight; } public void setWeight(double weight) { this.weight = weight; } public double getWidth() { return width; } public void setWidth(double width) { this.width = width; } public double getHeight() { return height; } public void setHeight(double height) { this.height = height; } @Override public String toString() { return "Equipment [price=" + price + ", weight=" + weight + ", width=" + width + ", height=" + height + ", category=" + category + "]\n"; } }
[ "git_user" ]
git_user
90d9a38629d76fb42d246bb4d3307004c54b0a8d
0769263cbce8846478d892f57e2aefe096283d26
/src/test/java/com/demoblaze/step_definitions/purchaseStepDefs.java
e9bba244a0a860df74a78b980d4343f3ab5d5794
[]
no_license
yildizucar/Adidas_Cucumber_JAVA
b0fa0e267a0b85474893f01ea50c55f49b27017e
36a0f147da7ecfd243307183793add8cba4a2e7a
refs/heads/master
2023-06-29T02:37:56.495683
2021-07-15T19:12:47
2021-07-15T19:12:47
386,213,917
0
0
null
null
null
null
UTF-8
Java
false
false
2,413
java
package com.demoblaze.step_definitions; import com.demoblaze.pages.AdidasPage; import com.demoblaze.utulities.BrowserUtils; import com.demoblaze.utulities.ConfigurationReader; import com.demoblaze.utulities.Driver; import io.cucumber.java.bs.A; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; import org.junit.Assert; public class purchaseStepDefs { AdidasPage adidasPage = new AdidasPage(); int expectedPurhaseAMount = 0; String orderID; int purchaseAmount; @Given("User is on the Home Page") public void user_is_on_the_home_page() { Driver.getDriver().get(ConfigurationReader.getProperty("url")); } @When("User adds {string} from {string}") public void user_adds_from(String product, String category) { expectedPurhaseAMount+=adidasPage.productAdder(category,product); System.out.println("expectedPurhaseAMount = " + expectedPurhaseAMount); } @When("User removes {string} from cart") public void user_removes_from_cart(String product) { expectedPurhaseAMount-=adidasPage.productRemover(product); System.out.println("expectedPurhaseAMount = " + expectedPurhaseAMount); } @When("User places order and captures and logs purchase ID and Amount") public void user_places_order_and_captures_and_logs_purchase_id_and_amount() { adidasPage.cart.click(); adidasPage.placeButton.click(); adidasPage.fillForm(); adidasPage.purchaseButton.click(); String confirmation = adidasPage.confirmation.getText(); System.out.println("confirmation = " + confirmation); String[] confirmationArray = confirmation.split("\n"); orderID = confirmationArray[0]; System.out.println("orderID = " + orderID); purchaseAmount = Integer.parseInt(confirmationArray[1].split(" ")[1]); } @Then("User verifies purchase amount equals expected") public void user_verifies_purchase_amount_equals_expected() { int actualAmount = purchaseAmount; System.out.println("actualAmount = " + actualAmount); System.out.println("expectedOrderAmmount = " + expectedPurhaseAMount); Assert.assertEquals(expectedPurhaseAMount,actualAmount); BrowserUtils.sleep(1); adidasPage.OK.click(); BrowserUtils.sleep(1); Driver.closeDriver(); } }
[ "yildizucr@gmail.com" ]
yildizucr@gmail.com
5647e8bc1d42aedbe2c41d89088c9f30aeb97276
b35cec54d2853760b0535a999932b396c4181fd0
/src/main/java/mtas/codec/util/collector/MtasDataLongAdvanced.java
88bf29846f6bc6a80d18a1e5dfa1cf97d1a1827b
[ "Apache-2.0" ]
permissive
matthijsbrouwer/mtas
cfc394199bec34500c505c9c111349e37bdc9769
d7016512fa75853789d9aa1470ae6971b856210d
refs/heads/master
2020-04-12T06:31:20.255093
2018-04-28T06:57:09
2018-04-28T06:57:09
63,045,873
1
0
null
null
null
null
UTF-8
Java
false
false
10,993
java
package mtas.codec.util.collector; import java.io.IOException; import java.util.Collections; import java.util.SortedSet; import org.apache.commons.lang.ArrayUtils; import mtas.codec.util.CodecUtil; /** * The Class MtasDataLongAdvanced. */ public class MtasDataLongAdvanced extends MtasDataAdvanced<Long, Double> { /** The Constant serialVersionUID. */ private static final long serialVersionUID = 1L; /** * Instantiates a new mtas data long advanced. * * @param collectorType the collector type * @param statsItems the stats items * @param sortType the sort type * @param sortDirection the sort direction * @param start the start * @param number the number * @param subCollectorTypes the sub collector types * @param subDataTypes the sub data types * @param subStatsTypes the sub stats types * @param subStatsItems the sub stats items * @param subSortTypes the sub sort types * @param subSortDirections the sub sort directions * @param subStart the sub start * @param subNumber the sub number * @param segmentRegistration the segment registration * @param boundary the boundary * @throws IOException Signals that an I/O exception has occurred. */ public MtasDataLongAdvanced(String collectorType, SortedSet<String> statsItems, String sortType, String sortDirection, Integer start, Integer number, String[] subCollectorTypes, String[] subDataTypes, String[] subStatsTypes, SortedSet<String>[] subStatsItems, String[] subSortTypes, String[] subSortDirections, Integer[] subStart, Integer[] subNumber, String segmentRegistration, String boundary) throws IOException { super(collectorType, CodecUtil.DATA_TYPE_LONG, statsItems, sortType, sortDirection, start, number, subCollectorTypes, subDataTypes, subStatsTypes, subStatsItems, subSortTypes, subSortDirections, subStart, subNumber, new MtasDataLongOperations(), segmentRegistration, boundary); } /* * (non-Javadoc) * * @see mtas.codec.util.DataCollector.MtasDataCollector#getItem(int) */ @Override protected final MtasDataItemLongAdvanced getItem(int i) { if (i >= 0 && i < size) { return new MtasDataItemLongAdvanced(advancedValueSumList[i], advancedValueSumOfLogsList[i], advancedValueSumOfSquaresList[i], advancedValueMinList[i], advancedValueMaxList[i], advancedValueNList[i], hasSub() ? subCollectorListNextLevel[i] : null, getStatsItems(), sortType, sortDirection, errorNumber[i], errorList[i], sourceNumberList[i]); } else { return null; } } /* * (non-Javadoc) * * @see mtas.codec.util.DataCollector.MtasDataCollector#add(long, long) */ @Override public MtasDataCollector<?, ?> add(long valueSum, long valueN) throws IOException { throw new IOException("not supported"); } /* * (non-Javadoc) * * @see mtas.codec.util.DataCollector.MtasDataCollector#add(long[], int) */ @Override public MtasDataCollector<?, ?> add(long[] values, int number) throws IOException { MtasDataCollector<?, ?> dataCollector = add(false); setValue(newCurrentPosition, ArrayUtils.toObject(values), number, newCurrentExisting); return dataCollector; } /* * (non-Javadoc) * * @see mtas.codec.util.DataCollector.MtasDataCollector#add(double, long) */ @Override public MtasDataCollector<?, ?> add(double valueSum, long valueN) throws IOException { throw new IOException("not supported"); } /* * (non-Javadoc) * * @see mtas.codec.util.DataCollector.MtasDataCollector#add(double[], int) */ @Override public MtasDataCollector<?, ?> add(double[] values, int number) throws IOException { MtasDataCollector<?, ?> dataCollector = add(false); Long[] newValues = new Long[number]; for (int i = 0; i < values.length; i++) newValues[i] = Double.valueOf(values[i]).longValue(); setValue(newCurrentPosition, newValues, number, newCurrentExisting); return dataCollector; } /* * (non-Javadoc) * * @see * mtas.codec.util.DataCollector.MtasDataCollector#add(java.lang.String[], * long, long) */ @Override public MtasDataCollector<?, ?> add(String key, long valueSum, long valueN) throws IOException { throw new IOException("not supported"); } /* * (non-Javadoc) * * @see * mtas.codec.util.DataCollector.MtasDataCollector#add(java.lang.String[], * long[], int) */ @Override public MtasDataCollector<?, ?> add(String key, long[] values, int number) throws IOException { if (key != null) { MtasDataCollector<?, ?> subCollector = add(key, false); setValue(newCurrentPosition, ArrayUtils.toObject(values), number, newCurrentExisting); return subCollector; } else { return null; } } /* * (non-Javadoc) * * @see * mtas.codec.util.DataCollector.MtasDataCollector#add(java.lang.String[], * double, long) */ @Override public MtasDataCollector<?, ?> add(String key, double valueSum, long valueN) throws IOException { throw new IOException("not supported"); } /* * (non-Javadoc) * * @see * mtas.codec.util.DataCollector.MtasDataCollector#add(java.lang.String[], * double[], int) */ @Override public MtasDataCollector<?, ?> add(String key, double[] values, int number) throws IOException { if (key != null) { Long[] newValues = new Long[number]; for (int i = 0; i < values.length; i++) newValues[i] = Double.valueOf(values[i]).longValue(); MtasDataCollector<?, ?> subCollector = add(key, false); setValue(newCurrentPosition, newValues, number, newCurrentExisting); return subCollector; } else { return null; } } /* * (non-Javadoc) * * @see * mtas.codec.util.DataCollector.MtasDataCollector#compareForComputingSegment( * java.lang.Number, java.lang.Number) */ @Override protected boolean compareWithBoundary(Long value, Long boundary) throws IOException { if (segmentRegistration.equals(SEGMENT_SORT_ASC) || segmentRegistration.equals(SEGMENT_BOUNDARY_ASC)) { return value <= boundary; } else if (segmentRegistration.equals(SEGMENT_SORT_DESC) || segmentRegistration.equals(SEGMENT_BOUNDARY_DESC)) { return value >= boundary; } else { throw new IOException( "can't compare for segmentRegistration " + segmentRegistration); } } /* * (non-Javadoc) * * @see * mtas.codec.util.DataCollector.MtasDataCollector#minimumForComputingSegment( * java.lang.Number, java.lang.Number) */ @Override protected Long lastForComputingSegment(Long value, Long boundary) throws IOException { if (segmentRegistration.equals(SEGMENT_SORT_ASC) || segmentRegistration.equals(SEGMENT_BOUNDARY_ASC)) { return Math.max(value, boundary); } else if (segmentRegistration.equals(SEGMENT_SORT_DESC) || segmentRegistration.equals(SEGMENT_BOUNDARY_DESC)) { return Math.min(value, boundary); } else { throw new IOException( "can't compute last for segmentRegistration " + segmentRegistration); } } /* * (non-Javadoc) * * @see * mtas.codec.util.DataCollector.MtasDataCollector#minimumForComputingSegment( * ) */ @Override protected Long lastForComputingSegment() throws IOException { if (segmentRegistration.equals(SEGMENT_SORT_ASC) || segmentRegistration.equals(SEGMENT_BOUNDARY_ASC)) { return Collections.max(segmentValueTopList); } else if (segmentRegistration.equals(SEGMENT_SORT_DESC) || segmentRegistration.equals(SEGMENT_BOUNDARY_DESC)) { return Collections.min(segmentValueTopList); } else { throw new IOException( "can't compute last for segmentRegistration " + segmentRegistration); } } /* * (non-Javadoc) * * @see * mtas.codec.util.DataCollector.MtasDataCollector#boundaryForComputingSegment * () */ @Override protected Long boundaryForSegmentComputing(String segmentName) throws IOException { if (segmentRegistration.equals(SEGMENT_SORT_ASC) || segmentRegistration.equals(SEGMENT_SORT_DESC)) { Long boundary = boundaryForSegment(segmentName); if (boundary == null) { return null; } else { if (segmentRegistration.equals(SEGMENT_SORT_DESC)) { long correctionBoundary = 0; for (String otherSegmentName : segmentValueTopListLast.keySet()) { if (!otherSegmentName.equals(segmentName)) { Long otherBoundary = segmentValuesBoundary.get(otherSegmentName); if (otherBoundary != null) { correctionBoundary += Math.max(0, otherBoundary - boundary); } } } return boundary + correctionBoundary; } else { return boundary; } } } else { throw new IOException("can't compute boundary for segmentRegistration " + segmentRegistration); } } /* * (non-Javadoc) * * @see mtas.codec.util.DataCollector.MtasDataCollector#boundaryForSegment() */ @Override protected Long boundaryForSegment(String segmentName) throws IOException { if (segmentRegistration.equals(SEGMENT_SORT_ASC) || segmentRegistration.equals(SEGMENT_SORT_DESC)) { Long thisLast = segmentValueTopListLast.get(segmentName); if (thisLast == null) { return null; } else if (segmentRegistration.equals(SEGMENT_SORT_ASC)) { return thisLast * segmentNumber; } else { return Math.floorDiv(thisLast, segmentNumber); } } else { throw new IOException("can't compute boundary for segmentRegistration " + segmentRegistration); } } /* * (non-Javadoc) * * @see * mtas.codec.util.collector.MtasDataCollector#stringToBoundary(java.lang. * String, java.lang.Integer) */ @Override protected Long stringToBoundary(String boundary, Integer segmentNumber) throws IOException { if (segmentRegistration.equals(SEGMENT_BOUNDARY_ASC) || segmentRegistration.equals(SEGMENT_BOUNDARY_DESC)) { if (segmentNumber == null) { return Long.valueOf(boundary); } else { return Math.floorDiv(Long.parseLong(boundary), segmentNumber); } } else { throw new IOException( "not available for segmentRegistration " + segmentRegistration); } } /* * (non-Javadoc) * * @see * mtas.codec.util.collector.MtasDataCollector#validateSegmentBoundary(java. * lang.Object) */ @Override public boolean validateSegmentBoundary(Object o) throws IOException { if (o instanceof Long) { return validateWithSegmentBoundary((Long) o); } else { throw new IOException("incorrect type"); } } }
[ "matthijs@brouwer.info" ]
matthijs@brouwer.info
4cfa834f60ce690b29c19a3590bd70b13c4b1184
369270a14e669687b5b506b35895ef385dad11ab
/javafx.base/javafx/util/converter/ByteStringConverter.java
899088ee4c3dbaf1f79ab3adcccb53fbfd8ce737
[]
no_license
zcc888/Java9Source
39254262bd6751203c2002d9fc020da533f78731
7776908d8053678b0b987101a50d68995c65b431
refs/heads/master
2021-09-10T05:49:56.469417
2018-03-20T06:26:03
2018-03-20T06:26:03
125,970,208
3
3
null
null
null
null
UTF-8
Java
false
false
1,102
java
/* * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package javafx.util.converter; import javafx.util.StringConverter; /** * <p>{@link StringConverter} implementation for {@link Byte} * (and byte primitive) values.</p> * @since JavaFX 2.1 */ public class ByteStringConverter extends StringConverter<Byte> { /** {@inheritDoc} */ @Override public Byte fromString(String value) { // If the specified value is null or zero-length, return null if (value == null) { return null; } value = value.trim(); if (value.length() < 1) { return null; } return Byte.valueOf(value); } /** {@inheritDoc} */ @Override public String toString(Byte value) { // If the specified value is null, return a zero-length String if (value == null) { return ""; } return Byte.toString(value.byteValue()); } }
[ "841617433@qq.com" ]
841617433@qq.com
2510d97291298df39a0ab9935eb73f32c4068778
e6bd10ab3c51f893fc2c0f14c313fe5f4614909b
/src/com/jcools/GoStop/User.java
72a12cc88ac6824df1a77aeb9d833544a6faa762
[]
no_license
jcoolstory/jgostop
f4dce0679378cd245ddadaf53c62921f64b68d75
15f5aec597b8bbfbebf19592bbf58e8df2915d5c
refs/heads/master
2020-05-17T04:07:01.555250
2014-12-21T08:30:15
2014-12-21T08:30:15
34,394,904
1
1
null
null
null
null
UTF-8
Java
false
false
2,212
java
package com.jcools.GoStop; import java.awt.Point; import java.awt.Rectangle; import java.util.HashMap; import java.util.Random; class User extends User_O { public User(String str) { super(str); // TODO Auto-generated constructor stub } public int getPointtoIndex(Point point) { for (int i = 0 ; i < 10 ; i++) { Rectangle rect = (Rectangle) cardsRect.get(i); if (rect.contains(point)) { return i; } } return -1; } public int ask(int seletc) { return -1; } @SuppressWarnings("unchecked") public void setTakeCardPoint(int x, int y) { // TODO Auto-generated method stub int width = 40; int height = 60; cardsRect.add(new Rectangle(x,y,width,height)); cardsRect.add(new Rectangle(x + width,y,width,height)); cardsRect.add(new Rectangle(x + width*2,y,width,height)); cardsRect.add(new Rectangle(x + width*3,y,width,height)); cardsRect.add(new Rectangle(x + width*4,y,width,height)); cardsRect.add(new Rectangle(x,y+height,width,height)); cardsRect.add(new Rectangle(x + width,y+height,width,height)); cardsRect.add(new Rectangle(x + width*2,y+height,width,height)); cardsRect.add(new Rectangle(x + width*3,y+height,width,height)); cardsRect.add(new Rectangle(x + width*4,y+height,width,height)); } @SuppressWarnings("unchecked") @Override public int setHasCardPoint(int x, int y) { // TODO Auto-generated method stub Point GWANG = new Point(10,0); Point YEOLGGOT = new Point(100,0); Point TTI = new Point(250,0); Point PEE = new Point(400,0); GWANG.translate(x, y); YEOLGGOT.translate(x, y); TTI.translate(x, y); PEE.translate(x, y); hasCardMap.put(Card.GWANG,GWANG); hasCardMap.put(Card.YEOLGGOT,YEOLGGOT); hasCardMap.put(Card.TTI, TTI); hasCardMap.put(Card.PEE, PEE); return 0; } @Override public int setHasCardPoint(HashMap map) { // TODO Auto-generated method stub return 0; } } class Com_User extends User { public Com_User(String str) { super(str); // TODO Auto-generated constructor stub } public int ask(int select) { Random r = new Random(); return r.nextInt(select); } }
[ "webadmin@38cf96a6-39b0-456b-b5b8-b5fd5798d8b1" ]
webadmin@38cf96a6-39b0-456b-b5b8-b5fd5798d8b1
a26225b07665bcd3261e8359a68ae1af0464f7c2
03f2358616bf13a15869ae692d58c74202441d82
/src/cn/abble/jblog/pojo/CategoryExample.java
77201615e1fb34c7e2607313110a4245d4cb79b8
[]
no_license
ant2288/jBlog
027c623af1801202440b5ff9dfdafe74d02cec43
e355ea59283b8716870322f809490d3d82c7ed3c
refs/heads/master
2021-08-24T10:53:10.819296
2017-12-09T09:59:46
2017-12-09T09:59:46
112,316,419
0
0
null
null
null
null
UTF-8
Java
false
false
9,257
java
package cn.abble.jblog.pojo; import java.util.ArrayList; import java.util.List; public class CategoryExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public CategoryExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andCidIsNull() { addCriterion("cid is null"); return (Criteria) this; } public Criteria andCidIsNotNull() { addCriterion("cid is not null"); return (Criteria) this; } public Criteria andCidEqualTo(Integer value) { addCriterion("cid =", value, "cid"); return (Criteria) this; } public Criteria andCidNotEqualTo(Integer value) { addCriterion("cid <>", value, "cid"); return (Criteria) this; } public Criteria andCidGreaterThan(Integer value) { addCriterion("cid >", value, "cid"); return (Criteria) this; } public Criteria andCidGreaterThanOrEqualTo(Integer value) { addCriterion("cid >=", value, "cid"); return (Criteria) this; } public Criteria andCidLessThan(Integer value) { addCriterion("cid <", value, "cid"); return (Criteria) this; } public Criteria andCidLessThanOrEqualTo(Integer value) { addCriterion("cid <=", value, "cid"); return (Criteria) this; } public Criteria andCidIn(List<Integer> values) { addCriterion("cid in", values, "cid"); return (Criteria) this; } public Criteria andCidNotIn(List<Integer> values) { addCriterion("cid not in", values, "cid"); return (Criteria) this; } public Criteria andCidBetween(Integer value1, Integer value2) { addCriterion("cid between", value1, value2, "cid"); return (Criteria) this; } public Criteria andCidNotBetween(Integer value1, Integer value2) { addCriterion("cid not between", value1, value2, "cid"); return (Criteria) this; } public Criteria andCnameIsNull() { addCriterion("cname is null"); return (Criteria) this; } public Criteria andCnameIsNotNull() { addCriterion("cname is not null"); return (Criteria) this; } public Criteria andCnameEqualTo(String value) { addCriterion("cname =", value, "cname"); return (Criteria) this; } public Criteria andCnameNotEqualTo(String value) { addCriterion("cname <>", value, "cname"); return (Criteria) this; } public Criteria andCnameGreaterThan(String value) { addCriterion("cname >", value, "cname"); return (Criteria) this; } public Criteria andCnameGreaterThanOrEqualTo(String value) { addCriterion("cname >=", value, "cname"); return (Criteria) this; } public Criteria andCnameLessThan(String value) { addCriterion("cname <", value, "cname"); return (Criteria) this; } public Criteria andCnameLessThanOrEqualTo(String value) { addCriterion("cname <=", value, "cname"); return (Criteria) this; } public Criteria andCnameLike(String value) { addCriterion("cname like", value, "cname"); return (Criteria) this; } public Criteria andCnameNotLike(String value) { addCriterion("cname not like", value, "cname"); return (Criteria) this; } public Criteria andCnameIn(List<String> values) { addCriterion("cname in", values, "cname"); return (Criteria) this; } public Criteria andCnameNotIn(List<String> values) { addCriterion("cname not in", values, "cname"); return (Criteria) this; } public Criteria andCnameBetween(String value1, String value2) { addCriterion("cname between", value1, value2, "cname"); return (Criteria) this; } public Criteria andCnameNotBetween(String value1, String value2) { addCriterion("cname not between", value1, value2, "cname"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
[ "1248207321@qq.com" ]
1248207321@qq.com
c6be20759825d7e34fe335b722497b76150de7b8
394cbb5e920c4b84705e45c1bd4faeaaac4c3191
/tpJava/TP03- V2/src/mainex2.java
5251b69e8fbc5cf09ad8b3605e459bccda8d4d21
[]
no_license
SandjayaIV/Java
a80a1fbcc46dd2643309c80a3bd09a85d1956b8e
03d2cf6ea623d3bf21fef5bf76c66548c17dffeb
refs/heads/master
2020-07-28T19:44:19.441084
2020-01-14T08:31:24
2020-01-14T08:31:24
209,515,356
0
0
null
null
null
null
UTF-8
Java
false
false
501
java
package ex2; public class mainex2 { public static void main(String[] args) { Lettre lettre = new Lettre(true); double prix = lettre.getPrix(); System.out.println("prix ="+prix); Colis colis = new Colis(5); int v = colis.getUnite_de_volume(); System.out.println("volume colis = "+v); Sac sac = new Sac(); sac.add(lettre); sac.add(colis); sac.getPrix(); sac.clearSac(); sac.isEmptySac(); } }
[ "stanislasvallet@live.com" ]
stanislasvallet@live.com
5504535229cdea387c094b11123a215e3dff5300
8013e7cce645d7b81367ecaa60205868669197ac
/bloom-core/src/main/java/service/DeleteItemService.java
846d7b203cf64eb8e7d5f114c1f6b759c2f897bf
[ "MIT" ]
permissive
swardeo/bloom-services
f833dca39b87f6317b84370ce1face76ecfcb8e6
40e07b32b7595ba29e6b7af04c28b43963f9f9b7
refs/heads/master
2023-08-27T04:06:18.046766
2021-10-31T18:32:12
2021-10-31T18:35:38
320,226,074
0
0
MIT
2021-10-31T18:35:39
2020-12-10T09:44:01
Java
UTF-8
Java
false
false
795
java
package service; import static software.amazon.awssdk.services.dynamodb.model.AttributeValue.builder; import java.util.Map; import model.Subject; import model.Type; import model.request.NameRequest; import software.amazon.awssdk.services.dynamodb.model.AttributeValue; public class DeleteItemService { private final DynamoService service; public DeleteItemService(DynamoService service) { this.service = service; } public void delete(Subject subject, Type type, NameRequest request) { Map<String, AttributeValue> key = Map.of( "PK", builder().s("USER#" + subject.getSubject()).build(), "SK", builder().s(type.getType() + "#" + request.getName()).build()); service.delete(key); } }
[ "43907088+swardeo@users.noreply.github.com" ]
43907088+swardeo@users.noreply.github.com
88c6a9091dca33a9271ef54db31334c83e598254
ae5c7859291555c82bfda74a2f642b602ac2cda7
/java-proxy-sample/src/main/java/jp/mwsoft/sample/java/proxy/HttpClientDefaultProxyV4.java
d26ab8cacd09db72538e3ec91974b31958d8506e
[]
no_license
idobatter/sample
dfc91100b93d14346adf4cf1f95dda3cb07628bb
5d914e2884b802c1d81c16ce13fa6d9dea0043fc
refs/heads/master
2021-01-15T22:13:52.829142
2012-08-20T16:49:09
2012-08-20T16:49:09
5,624,114
1
0
null
null
null
null
UTF-8
Java
false
false
2,511
java
package jp.mwsoft.sample.java.proxy; import java.net.ProxySelector; import org.apache.http.HttpHost; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.conn.params.ConnRoutePNames; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.conn.ProxySelectorRoutePlanner; import org.apache.http.util.EntityUtils; public class HttpClientDefaultProxyV4 { public static void main(String[] args) throws Exception { // プロキシの情報を設定 System.setProperty("proxySet", "true"); System.setProperty("proxyHost", "192.168.1.33"); System.setProperty("proxyPort", "8080"); DefaultHttpClient client = new DefaultHttpClient(); // デフォルトのProxySelectorを利用するよう設定 ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner(client.getConnectionManager() .getSchemeRegistry(), ProxySelector.getDefault()); client.setRoutePlanner(routePlanner); // リクエスト実行 HttpResponse response1 = client.execute(new HttpGet("http://www.yahoo.co.jp/")); System.out.println(response1.getStatusLine().getStatusCode()); // 接続閉じる EntityUtils.consume(response1.getEntity()); // 結果を見分けやすいよう3秒待機 Thread.sleep(3000); // setParameterで別のプロキシを指定してみる client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, new HttpHost("192.168.1.36", 8080)); // リクエスト実行 HttpResponse response2 = client.execute(new HttpGet("http://www.google.co.jp/")); System.out.println(response2.getStatusLine().getStatusCode()); /* * 上記のコードを実行した際のパケットキャプチャ * * ====================================================================== * 192.168.1.34 -> 192.168.1.33 HTTP GET http://www.yahoo.co.jp/ * HTTP/1.1192.168.1.33 -> 192.168.1.34 HTTP HTTP/1.1 200 OK (text/html) * 192.168.1.34 -> 192.168.1.33 HTTP GET http://www.google.co.jp/ * HTTP/1.1192.168.1.33 -> 192.168.1.34 HTTP HTTP/1.1 200 OK (text/html) * == * ==================================================================== * 192.168.1.33と192.168.1.36がプロキシ 192.168.1.34がプログラムを実行したマシン * * setRoutePlannerで指定した後にsetParameterで新しいプロキシを私邸しても無視された * 逆にsetParameter後にsetRoutePlannerで新しいプロキシを私邸した場合は、反映される */ } }
[ "masato@usagi.(none)" ]
masato@usagi.(none)
e24fe7542b0fccb8d29177e10970be646d4c5052
cd1982c47fe5f31bce2c0d72451f8f079e829e6e
/src/com/compass/hk/hot/Frame_hot_gallery_pic.java
7ddccf7bc7efa28d9dd85b55ee26bf62c3a81582
[]
no_license
ljppff1/ljppff_land
a3c370f2b49879803d366be67968b341c857fb82
b3a0f4d1b714bc5834133a7281d337fc38839c38
refs/heads/master
2016-09-06T14:04:52.219388
2015-09-18T04:21:25
2015-09-18T04:21:25
38,738,023
0
0
null
null
null
null
GB18030
Java
false
false
3,989
java
package com.compass.hk.hot; import java.io.IOException; import java.net.URL; import com.webdesign688.compass.R; import com.compass.hk.util.Bean; import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer; import android.annotation.SuppressLint; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; public class Frame_hot_gallery_pic extends Fragment implements OnClickListener { private String mPicUrl; protected ImageLoader imageLoader = ImageLoader.getInstance(); DisplayImageOptions options; private String mPicName; private Drawable mDrawable; private View mLayout; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mLayout = inflater.inflate(R.layout.frame_viewpage, null); ImageView mImageView= (ImageView) mLayout.findViewById(R.id.image_viewpage); mImageView.setOnClickListener(this); Log.e("MyFrame", mPicUrl); //UIL initImageLoaderOptions(); imageLoader.displayImage(mPicUrl, mImageView, options); // new DownloadImageTask().execute(mPicUrl) ; return mLayout ; } @SuppressLint("NewApi") class DownloadImageTask extends AsyncTask<String, Void, Drawable> { protected Drawable doInBackground(String... urls) { return loadImageFromNetwork(urls[0]); } protected void onPostExecute(Drawable result) { mDrawable=result; mLayout.findViewById(R.id.tv_gallery_referbigpic).setVisibility(View.VISIBLE); } } private Drawable loadImageFromNetwork(String imageUrl) { Drawable drawable = null; try { // 可以在这里通过文件名来判断,是否本地有此图片 drawable = Drawable.createFromStream( new URL(imageUrl).openStream(), "image.jpg"); } catch (IOException e) { Log.d("test", e.getMessage()); } if (drawable == null) { Log.e("test", "null drawable"); } else { Log.e("test", "not null drawable"); } return drawable ; } //UIL private void initImageLoaderOptions() { options = new DisplayImageOptions.Builder() .showStubImage(R.drawable.ic_empty) .showImageForEmptyUri(R.drawable.ic_empty) .cacheInMemory() .cacheOnDisc().displayer(new FadeInBitmapDisplayer(2000)) .bitmapConfig(Bitmap.Config.RGB_565).build(); } public void setUrl(String string) { this.mPicUrl=string; } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.image_viewpage: Intent intent=new Intent(getActivity(),Gallery_Pic_Activity.class); if ("".equals(mPicName)||mPicName==null) { } else { intent.putExtra("pic", mPicName); intent.putExtra("url", mPicUrl); } startActivity(intent); break; default: break; } } public void setPicName(String photoName) { // TODO Auto-generated method stub mPicName=photoName; } }
[ "liujun@tianlongdeMac-mini.local" ]
liujun@tianlongdeMac-mini.local
bb22a4c608ef94d3ac69cd96fd6e00036c8c9de7
7987b61bf062accb5d70a014c7e4b6d69ac0644a
/src/com/gamanne/ri3d/client/vncwiewer/ReloginPanel.java
b8b45a79fa940aaba81f4596325e849f9873ae8a
[]
no_license
JoaquinFernandez/RI3DClient
95eccb6bb1a6462d72a7c5e2cbe07f89d263d368
4a5fb9222d7e0510391dbd98c1e5e00d5ce677ae
refs/heads/master
2020-04-19T16:04:15.905441
2013-08-05T01:55:12
2013-08-05T01:55:12
31,480,209
0
0
null
null
null
null
UTF-8
Java
false
false
1,817
java
package com.gamanne.ri3d.client.vncwiewer; // Copyright (C) 2002 Cendio Systems. All Rights Reserved. // Copyright (C) 2002 Constantin Kaplinsky. All Rights Reserved. // // This 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 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this software; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. // // // ReloginPanel class implements panel with a button for logging in again, // after fatal errors or disconnect // import java.awt.*; import java.awt.event.*; import java.applet.*; // // The panel which implements the Relogin button // public class ReloginPanel extends Panel implements ActionListener { Button reloginButton; Button closeButton; VncViewer viewer; // // Constructor. // public ReloginPanel(VncViewer v) { viewer = v; setLayout(new FlowLayout(FlowLayout.CENTER)); reloginButton = new Button("Login again"); add(reloginButton); reloginButton.addActionListener(this); if (viewer.inSeparateFrame) { closeButton = new Button("Close window"); add(closeButton); closeButton.addActionListener(this); } } // // This method is called when a button is pressed. // public synchronized void actionPerformed(ActionEvent evt) { } }
[ "joaquinfndz@gmail.com" ]
joaquinfndz@gmail.com
2390263a38a71262e3ba47850519a66eb07cd533
f11eb3e2d28072ad5e21edaae3a404cce2a18649
/src/day10_stringManipulations/C3_stringManupulation03.java
a33e567f7cec0be16f78cdd776f62e8755a252da
[]
no_license
evren54/java2021summerprojecttr
c7c7c3e884f3727ee91dcd595a49108f110c0f0a
b415675f058cca759778c6189e043675a1034353
refs/heads/master
2023-07-18T06:06:06.726876
2021-08-29T05:26:29
2021-08-29T05:26:29
400,971,091
0
0
null
null
null
null
ISO-8859-9
Java
false
false
1,454
java
package day10_stringManipulations; import java.util.Scanner; public class C3_stringManupulation03 { public static void main(String[] args) { // TODO Auto-generated method stub // '' char "" String ama indexOf() acisindan farklari yok String str = "java ogrenmek ne guzel"; System.out.println(str.indexOf("e"));// 8 System.out.println(str.indexOf(' '));// 4 System.out.println(str.indexOf("mek"));// 10 System.out.println(str.indexOf(""));// 0 System.out.println(str.indexOf("J"));// -1 System.out.println(str.indexOf("m", 10));// index olarak 10 dahıl sonrasında m arar // Kullanicidan bir String isteyin // girdigi String "Java" iceriyorsa "Aferin" Yazdirin // icermiyorsa daha cok calisman lazim yazdirin // buyuk - kucuk harf onemsiz olsun Scanner scan = new Scanner(System.in); System.out.println("lutfen bir cumle gırınız"); String cumle = scan.nextLine().toLowerCase(); // // cumle.indexOf("java") // cumlede java varsa index donecek, yoksa -1 // donecek // 1.yol if (cumle.indexOf("java") == -1) { System.out.println("daha cok calısman lazım"); } else { System.out.println("aferın"); } // 2.yol if (cumle.indexOf("java") != -1) { System.out.println("Aferin"); } else { System.out.println("daha cok calisman lazim"); } //3.yol System.out.println(cumle.indexOf("java") == -1 ? "Daha cok calisman lazim." : "Aferin."); scan.close(); } }
[ "evrenozdemir1730001@gmail.com" ]
evrenozdemir1730001@gmail.com
50cdd6e137ce83a9754e5ae40376c0714f1266ff
aba8e431744cab7177a1005f40b93fd65f9c480a
/src/aadharcard/conn.java
fdb9badc500b7dfe5860b742bd2102103b4bfa9a
[]
no_license
ankitsuwalka/aadhar-card
c06da846c603ebbb83a49dc1cd4cfeb2590f5c04
42f31771f87c95e50f6fe03ed41c38f1db5f467f
refs/heads/main
2023-04-10T11:20:33.859860
2021-04-29T13:24:20
2021-04-29T13:24:20
362,806,510
0
0
null
null
null
null
UTF-8
Java
false
false
585
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 aadharcard; import java.sql.*; /** * * @author Ankit suwalka */ public class conn { Connection conn1; conn() { try { Class.forName("com.mysql.jdbc.Driver"); conn1 = DriverManager.getConnection("jdbc:mysql://localhost:3306/aadharcard","root",""); } catch(Exception e) { System.out.println(e); } } }
[ "monusuwalka99@gmail.com" ]
monusuwalka99@gmail.com
26feff6b87598505ea308dce39e3ffe0d7afbfd4
d1d8271e3bb74b019446da16dc8f30e4532b683f
/L19-canvas-drawing/app/src/main/java/net/junsun/l19_canvas_drawing/MainActivity.java
101d7ac3154598802ef3e093df4c401bddd8d4b8
[]
no_license
jyang22/android-samples
c9ad27e8f67648efff503e19f371fe0f85c2cf09
a53de7ce2e8e67d0d616736f4c118fb398a4c9a1
refs/heads/master
2021-01-16T20:46:33.338532
2016-03-02T06:41:07
2016-03-02T06:41:07
50,323,034
1
0
null
2016-01-25T03:18:45
2016-01-25T03:18:45
null
UTF-8
Java
false
false
2,736
java
package net.junsun.l19_canvas_drawing; import android.content.res.AssetManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.PorterDuff; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.Toast; import java.io.IOException; import java.io.InputStream; public class MainActivity extends AppCompatActivity { Paint paint; Bitmap bitmap; Canvas canvas; ImageView imageView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); imageView = (ImageView) findViewById(R.id.imageView); paint = new Paint(); paint.setColor(Color.RED); paint.setTextSize(60); bitmap = Bitmap.createBitmap(600, 630, Bitmap.Config.RGB_565); canvas = new Canvas(bitmap); canvas.drawText("empty canvas", 100, 300, paint); imageView.setImageBitmap(bitmap); imageView.setScaleType(ImageView.ScaleType.CENTER); ((Button)findViewById(R.id.button)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadPicture(); } }); ((Button)findViewById(R.id.button2)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { drawSomething(); } }); ((Button)findViewById(R.id.button3)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR); imageView.invalidate(); } }); } private void loadPicture() { AssetManager assetManager = getApplicationContext().getAssets(); InputStream istr; try { istr = assetManager.open("pig.jpg"); bitmap = BitmapFactory.decodeStream(istr); } catch (IOException e) { e.printStackTrace(); return; } canvas.drawBitmap(bitmap, 0f, 0f, null); imageView.invalidate(); } private void drawSomething() { paint.setStyle(Paint.Style.FILL); canvas.drawRect(400, 500, 600, 600, paint); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(5); canvas.drawCircle(250, 150, 120, paint); imageView.invalidate(); } }
[ "jsun@junsun.net" ]
jsun@junsun.net
55cb83946929051db5fe96b27c7eca9584ea70ea
1d41dc179aa0cd9f392aee9305dea22758da8fd6
/tableview/src/main/java/com/evrencoskun/tableview/adapter/recyclerview/CellRecyclerViewAdapter.java
03c35682c2888acf2322112d009d23da6de8fc91
[]
no_license
bbf-developer/Beta01
ede0f580092925259e0aada247dc78945680274d
306b52ab8f41dd224509017bb667580260c01368
refs/heads/master
2021-04-29T15:44:49.658094
2018-03-20T21:50:34
2018-03-20T21:50:34
121,802,737
0
1
null
null
null
null
UTF-8
Java
false
false
7,698
java
package com.evrencoskun.tableview.adapter.recyclerview; import android.content.Context; import android.support.v7.util.DiffUtil; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import com.evrencoskun.tableview.ITableView; import com.evrencoskun.tableview.adapter.ITableAdapter; import com.evrencoskun.tableview.adapter.recyclerview.holder.AbstractViewHolder; import com.evrencoskun.tableview.adapter.recyclerview.holder.AbstractViewHolder.SelectionState; import com.evrencoskun.tableview.handler.SelectionHandler; import com.evrencoskun.tableview.layoutmanager.ColumnLayoutManager; import com.evrencoskun.tableview.listener.itemclick.CellRecyclerViewItemClickListener; import com.evrencoskun.tableview.listener.scroll.HorizontalRecyclerViewListener; import java.util.ArrayList; import java.util.List; /** * Created by evrencoskun on 10/06/2017. */ public class CellRecyclerViewAdapter<C> extends AbstractRecyclerViewAdapter<C> { private static final String LOG_TAG = CellRecyclerViewAdapter.class.getSimpleName(); private List<RecyclerView.Adapter> m_jAdapterList; private ITableAdapter m_iTableAdapter; private HorizontalRecyclerViewListener m_iHorizontalListener; // This is for testing purpose private int m_nRecyclerViewId = 0; public CellRecyclerViewAdapter(Context context, List<C> p_jItemList, ITableAdapter p_iTableAdapter) { super(context, p_jItemList); this.m_iTableAdapter = p_iTableAdapter; // Initialize the array m_jAdapterList = new ArrayList<>(); } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // Get TableView ITableView iTableView = m_iTableAdapter.getTableView(); // Create a RecyclerView as a Row of the CellRecyclerView final CellRecyclerView jRecyclerView = new CellRecyclerView(m_jContext); if (iTableView.isShowHorizontalSeparators()) { // Add divider jRecyclerView.addItemDecoration(iTableView.getHorizontalItemDecoration()); } if (iTableView != null) { // To get better performance for fixed size TableView jRecyclerView.setHasFixedSize(iTableView.hasFixedWidth()); // set touch m_iHorizontalListener to scroll synchronously if (m_iHorizontalListener == null) { m_iHorizontalListener = iTableView.getHorizontalRecyclerViewListener(); } jRecyclerView.addOnItemTouchListener(m_iHorizontalListener); // Add Item click listener for cell views jRecyclerView.addOnItemTouchListener(new CellRecyclerViewItemClickListener (jRecyclerView, iTableView)); // Set the Column layout manager that helps the fit width of the cell and column header // and it also helps to locate the scroll position of the horizontal recyclerView // which is row recyclerView ColumnLayoutManager layoutManager = new ColumnLayoutManager(m_jContext, iTableView, jRecyclerView); jRecyclerView.setLayoutManager(layoutManager); // This is for testing purpose to find out which recyclerView is displayed. jRecyclerView.setId(m_nRecyclerViewId); m_nRecyclerViewId++; } return new CellRowViewHolder(jRecyclerView); } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int p_nYPosition) { if (!(holder instanceof CellRowViewHolder)) { return; } CellRowViewHolder viewHolder = (CellRowViewHolder) holder; // Set adapter to the RecyclerView List<C> rowList = (List<C>) m_jItemList.get(p_nYPosition); CellRowRecyclerViewAdapter viewAdapter = new CellRowRecyclerViewAdapter(m_jContext, rowList, m_iTableAdapter, p_nYPosition); viewHolder.m_jRecyclerView.setAdapter(viewAdapter); // Add the adapter to the list m_jAdapterList.add(viewAdapter); } @Override public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) { super.onViewAttachedToWindow(holder); // The below code helps to display a new attached recyclerView on exact scrolled position. CellRowViewHolder viewHolder = (CellRowViewHolder) holder; ((ColumnLayoutManager) viewHolder.m_jRecyclerView.getLayoutManager()) .scrollToPositionWithOffset(m_iHorizontalListener.getScrollPosition(), m_iHorizontalListener.getScrollPositionOffset()); SelectionHandler selectionHandler = m_iTableAdapter.getTableView().getSelectionHandler(); if (selectionHandler.isAnyColumnSelected()) { AbstractViewHolder cellViewHolder = (AbstractViewHolder) ((CellRowViewHolder) holder) .m_jRecyclerView.findViewHolderForAdapterPosition(selectionHandler .getSelectedColumnPosition()); if (cellViewHolder != null) { // Control to ignore selection color if (!m_iTableAdapter.getTableView().isIgnoreSelectionColors()) { cellViewHolder.setBackgroundColor(m_iTableAdapter.getTableView() .getSelectedColor()); } cellViewHolder.setSelected(SelectionState.SELECTED); } } else if (selectionHandler.isRowSelected(holder.getAdapterPosition())) { viewHolder.m_jRecyclerView.setSelected(SelectionState.SELECTED, m_iTableAdapter .getTableView().getSelectedColor(), m_iTableAdapter.getTableView() .isIgnoreSelectionColors()); } } @Override public void onViewDetachedFromWindow(RecyclerView.ViewHolder holder) { super.onViewDetachedFromWindow(holder); // Clear selection status of the view holder ((CellRowViewHolder) holder).m_jRecyclerView.setSelected(SelectionState.UNSELECTED, m_iTableAdapter.getTableView().getUnSelectedColor(), m_iTableAdapter.getTableView ().isIgnoreSelectionColors()); } @Override public void onViewRecycled(RecyclerView.ViewHolder holder) { super.onViewRecycled(holder); CellRowViewHolder viewHolder = (CellRowViewHolder) holder; // ScrolledX should be cleared at that time. Because we need to prepare each // recyclerView // at onViewAttachedToWindow process. viewHolder.m_jRecyclerView.clearScrolledX(); } static class CellRowViewHolder extends RecyclerView.ViewHolder { final CellRecyclerView m_jRecyclerView; CellRowViewHolder(View itemView) { super(itemView); m_jRecyclerView = (CellRecyclerView) itemView; } } public void notifyCellDataSetChanged() { if (m_jAdapterList != null) { if (m_jAdapterList.isEmpty()) { notifyDataSetChanged(); } else { for (RecyclerView.Adapter adapter : m_jAdapterList) { adapter.notifyDataSetChanged(); } } } } public List<RecyclerView.Adapter> getCellRowAdapterList() { return m_jAdapterList; } public void dispatchUpdatesTo(DiffUtil.DiffResult p_jResults) { for (int i = 0; i < m_jAdapterList.size(); i++) { RecyclerView.Adapter cellRowAdapter = m_jAdapterList.get(i); p_jResults.dispatchUpdatesTo(cellRowAdapter); } p_jResults.dispatchUpdatesTo(this); } }
[ "arriagada.ascencio@gmail.com" ]
arriagada.ascencio@gmail.com
a93801142c939d9988a74fff2c82df44be49307f
9fdde83922107714a7fe433b303f98faaacab7c3
/src/Payment/PayPalPaymentDE.java
0f1ea5f24cff59c18602649cfb8a2cf8ffdbb97c
[]
no_license
gobeitleuph/SWA_2
ce5a99009bc5f6684b4eb72457bd146a494800a6
e176892d5c80f17a00d80f8b30f262da14df841d
refs/heads/master
2023-08-12T20:38:52.571645
2021-09-15T21:33:46
2021-09-15T21:33:46
399,558,977
0
0
null
null
null
null
UTF-8
Java
false
false
1,207
java
package Payment; import Statistics.Visitor; import java.time.LocalDateTime; import Statistics.PaymentVisitor; import Statistics.Visitor; import java.time.LocalDateTime; public class PayPalPaymentDE extends Payment{ public int PayPalCounter; protected Account Receiver; protected Account Sender; // public int getPayPalCounter() { // return PayPalCounter; // } // // private int PayPalCounter = 0; public PayPalPaymentDE(Account pSender, Account pReceiver, int pValue) { this.Sender = pSender; this.Receiver = pReceiver; this.Value = pValue; } @Override public void accept(Visitor visitor) { visitor.visit(this); } @Override public boolean Commit() { this.Date = LocalDateTime.now(); Sender.Saldo = Sender.Saldo - Value; Receiver.Saldo = Receiver.Saldo + Value; System.out.println("Bezahlung wurde mit Paypal am " + getDate() + " ausgeführt."); System.out.println("Neuer Kontostand: " + Sender.getSaldo() + "€"); return true; } }
[ "64547252+gobeitleuph@users.noreply.github.com" ]
64547252+gobeitleuph@users.noreply.github.com
97a36ee0bdc655132256f27aae1a561f38ffec3a
2c7fb1627d251951d7c7841c2713273c6974538a
/src/hibernate/DAO/UserDAO.java
f509baa482055e191c6afb7267d438bbc6569271
[]
no_license
vitos999ven/JavaWeb-Application
a010dea48695a85c2779c143be69cfa52fd9422e
d6979513a284083e69a63fa018cc0bd4c8f1a1dd
refs/heads/master
2021-01-10T01:33:20.678941
2015-05-22T13:49:09
2015-05-22T13:49:09
36,071,574
0
0
null
null
null
null
UTF-8
Java
false
false
431
java
package hibernate.DAO; import hibernate.logic.User; import java.sql.SQLException; import java.util.List; public interface UserDAO { public void addUser(User user) throws SQLException; public User getUser(String login) throws SQLException; public void updateUser(User user) throws SQLException; public List<User> getAllUsers() throws SQLException; public void deleteUser(String login) throws SQLException; }
[ "vitos999ven@gmail.com" ]
vitos999ven@gmail.com
45c059d00978f67ff849dd86317669193f3dd94e
85fe140538e7708f4b0b2f84c639f3fc7b796c80
/K-Means/src/Graphics/Graphics.java
8bf8350bb484b04e44dd4a823c40acb23015ee81
[]
no_license
CasualCoder91/SDM1
fe4f31989f131c6e3318513a91809993ddf84f3f
f83d4e49eebe116af0303a9ff67ea4a55a568cf7
refs/heads/master
2021-05-31T18:06:22.577962
2016-03-30T16:53:27
2016-03-30T16:53:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,237
java
package Graphics; import org.math.plot.*; import Generator.*; import java.awt.Color; import java.util.ArrayList; import java.util.List; import javax.swing.JFrame; public class Graphics { private double[] x; private double[] y; private double[] tempX = new double[1]; private double[] tempY = new double[1]; private Plot2DPanel plot = new Plot2DPanel(); public Graphics() { } public void CreateGraphicWithDataPoints(List<Cluster> Input, int X, int Y, String S) { Plot2DPanel plotD = new Plot2DPanel(); Color color[] = {Color.BLUE, Color.CYAN, Color.PINK, Color.RED, Color.BLACK, Color.LIGHT_GRAY, Color.MAGENTA, Color.ORANGE, Color.DARK_GRAY,Color.GRAY}; // add a line plot to the PlotPanel for(int j = 0; j < Input.size(); j++) { x = null; y = null; x = new double[DataGenerator.getInstance().getNum_DataPoints()]; y = new double[DataGenerator.getInstance().getNum_DataPoints()]; tempX = null; tempY = null; tempX = new double[1]; tempY = new double[1]; for(int i = 0; i < Input.get(j).getNum_DataPoints(); i++) { x[i] = Input.get(j).DataInCluster().get(i).getData()[X-1]; y[i] = Input.get(j).DataInCluster().get(i).getData()[Y-1]; } tempX[0] = Input.get(j).get_Centroid().getData()[X-1]; tempY[0] = Input.get(j).get_Centroid().getData()[Y-1]; plotD.addScatterPlot("Means", Color.GREEN,tempX, tempY ); plotD.addScatterPlot("Data", color[j%11],x, y ); } // put the PlotPanel in a JFrame, as a JPanel JFrame frame = new JFrame(S); frame.setSize(600, 600); frame.setContentPane(plotD); frame.setVisible(true); } public void CreateGraphicWithArrays(List<Double> values, Color r, String S) { double[] length = new double[values.size()]; double[] val = new double[values.size()]; for(int i = 0; i < values.size(); i++) { val[i] = values.get(i); length[i] = i+1; } plot.addLinePlot(S, r,length, val); plot.setAxisLabel(0, "Iteration steps"); plot.setAxisLabel(1, "Objective Function"); plot.addLegend("NORTH"); } public void ExecuteGraphic() { JFrame frame = new JFrame("Objective Function"); frame.setSize(600, 600); frame.setContentPane(plot); frame.setVisible(true); } }
[ "benedikt_auer@hotmail.com" ]
benedikt_auer@hotmail.com
f93ccbdee96d965558ecab30712aba0eaa909823
2509ec9ca0461e270f73805074c6a04a0652e55a
/JavaWorkSpace/PokerProjectForCopy/src/pokerPackage/Hand.java
81cd9dcee1f5ad5dd52a44877999e681900348bf
[]
no_license
LimeyJohnson/RandomProjects
f7f6957dbd6b0d153f8a8202c00d3bfec203d6ed
03c4eed7557371dcbf12ef21fb5ca497f4197e66
refs/heads/master
2021-01-10T20:50:25.043846
2015-10-28T15:16:04
2015-10-28T15:16:12
3,251,052
1
0
null
null
null
null
UTF-8
Java
false
false
3,637
java
package pokerPackage; import java.util.*; public class Hand { int[] ID1 = {0,0,0,0,0,0,0}; int[] flags = {0,0}; boolean[] first = {true,true,true,true,true}; int a = 0, b = 0; // loop helpers int[] nums = {0,0,0,0,0,0,0,0,0,0,0,0,0}; int[] suits = {0,0,0,0}; public int HandID = 0; double[] DR = {0,0,0,0,0,0,0,0,0,0,0,0,0,0}; public Hand(){} public void firstCards(int a, int b){ ID1[5] = a; ID1[6] = b; nums[a/4]++; suits[a%4]++; nums[b/4]++; suits[b%4]++; } public void addCard(int card, int pos){ if(!first[pos]){ nums[ID1[pos]/4]--; suits[ID1[pos]%4]--; } else first[pos] = false; ID1[pos] = card; nums[card/4]++; suits[card%4]++; } public void calculateHand(){ HandID = 1; Boolean Straight = false, Flush = false, TwoPair = false; if(isPR()){ HandID = 2; if(isTP()){ HandID = 3; TwoPair = true; } if(isTK()){ HandID = 4; if(TwoPair){if(isFH())HandID = 7;} if(isFK())HandID = 8; } } else{ HandID = 1; } if(isST()){ HandID = 5; Straight = true; } if(isFL()){ HandID = 6; Flush = true; } if(Straight&&Flush){ //If Running seven cards, you must check to make sure the Straight is a Flush if(isSF())HandID = 9; } DR[HandID+4]++; } // Based on numbers in ascending order public boolean isSF(){ Vector<Integer> ID2 = new Vector<Integer>(); for(int move:ID1)ID2.add(move); Collections.sort(ID2); for(int numb: ID2){ if(numb<36){ if(ID2.contains(numb+4)&&ID2.contains(numb+8)&&ID2.contains(numb+12)&&ID2.contains(numb+16)){ flags[0] = numb/4; return true; } } else if(numb<40){ if(ID2.contains(numb+4)&&ID2.contains(numb+8)&&ID2.contains(numb+12)&&ID2.contains(numb-36)){ flags[0] = numb/4; return true; } } } return false; } public boolean isFK(){ for(a = 0; a<13;a++){ if(nums[a]>=4){ flags[0] = a; return true; } } return false; } public boolean isFH(){ for(a = 0; a<13;a++){ b = nums[a]; if(b>=3){ for(int d = 0; d<13; d++){ int c = nums[d]; if(c>=2&&a!=d){ flags[0] = a; flags[1] = d; return true; } } } } return false; } public boolean isFL(){ for(a = 0; a<4;a++){ b = suits[a]; if(b>=5){ flags[0] = a; return true; } } return false; } public boolean isST(){ for(b = 0; b<=9;b++){ if(nums[b]>0){ if(b<=8){ if(nums[b+1]>0&&nums[b+2]>0&&nums[b+3]>0&&nums[b+4]>0){ flags[0] = b; return true; } } else if(b==9){ if(nums[b+1]>0&&nums[b+2]>0&&nums[b+3]>0&&nums[0]>0){ flags[0] = b; return true; } } } } return false; } public boolean isTK(){ for(a = 0; a<13;a++){ b = nums[a]; if(b>=3){ flags[0] = a; return true; } } return false; } public boolean isTP(){ for(a = 0; a<13;a++){ if(nums[a]>=2){ for(int c = a+1; c<13; c++){ if(nums[c]>=2){ flags[0] = a; flags[1] = c; return true; } } return false; } } return false; } public boolean isPR(){ for(a = 0; a<13;a++){ if(nums[a]>=2){ flags[0] = a; return true; } //NEEDS TO BE FIXED } return false; } public void printHand(){ System.out.println("Number of cards: "+ID1.length); for(int x = 0; x<5; x++){ // if(B[x]>=0)System.out.print(getCard(B[x])+getSuit(B[x])+"("+B[x]+"),"); } } public String getCard(int x){ String suits[] = {"d","s","h","c"}; String nums[] = {"A","K","Q","J","T","9","8","7","6","5","4","3","2"}; return nums[x/4]+suits[x%4]; } }
[ "LimeyJohnson@gmail.com" ]
LimeyJohnson@gmail.com
513f510424724b94d3cba72b567a79926579353b
2f911f3772e0f023978296a709b95953cb26db6b
/TwitterClientWithFragments/src/com/codepath/apps/basic/twitter/ComposeActivity.java
c9569905185290f4d366577c7bab7afceeb47889
[]
no_license
charanya-v/android-course
ea1e0f243c1f2d2e904847a5a753e00fdcbff438
ab9d9af2b2418c2e691e1790577f160920a2a789
refs/heads/master
2020-03-30T05:47:06.398653
2014-07-08T08:51:52
2014-07-08T08:51:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,363
java
package com.codepath.apps.basic.twitter; import org.json.JSONObject; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.View; import android.widget.EditText; import com.loopj.android.http.JsonHttpResponseHandler; public class ComposeActivity extends Activity { private TwitterClient client; private EditText etTweet; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_compose); etTweet = (EditText) findViewById(R.id.etTweet); client = TwitterApplication.getRestClient(); } public void onPost(View v) { String tweetText = etTweet.getText().toString(); client.composeTweet(tweetText, new JsonHttpResponseHandler() { @Override public void onSuccess(JSONObject jsonTweet) { Intent i = new Intent(); i.putExtra("jsonTweet", jsonTweet.toString()); setResult(RESULT_OK, i); finish(); Log.d("DEBUG", jsonTweet.toString()); } }); } public void onCancel(View v) { setResult(RESULT_CANCELED, null); finish(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.post_tweet, menu); return true; } }
[ "srichara@yahoo-inc.com" ]
srichara@yahoo-inc.com
b4b71ec7fd371065680d03cdf66fd67a0c2bb04e
5162db46ef778be5f35cea3c94e76ef973bcd1a9
/framework/src/main/java/org/jfunfx/jsconstruction/components/TriggerEventEnum.java
1f3fa05651872d41d14623cbab7412a80153bc71
[]
no_license
dlisin/jfunfx
fdf03ed78f49c667958eb12e2b67210bf912ddf4
54a7e06ca964202fe25cd41d986131e0c16d952e
refs/heads/master
2016-08-03T22:44:43.864943
2009-08-14T09:23:41
2009-08-14T09:23:41
32,256,381
0
0
null
null
null
null
UTF-8
Java
false
false
346
java
package org.jfunfx.jsconstruction.components; /** * date: 28.07.2009 * * @author dlisin * @version 1.0 */ public enum TriggerEventEnum { MOUSE(1), KEYBOARD(2); private int value; TriggerEventEnum(int value) { this.value = value; } public int getValue() { return value; } }
[ "DmitryLisin@8ec159ce-778a-11de-a94e-f9a6307510a4" ]
DmitryLisin@8ec159ce-778a-11de-a94e-f9a6307510a4
ea4db215ca3e4cf51535a891acf7cbc51a7f1bc2
4706392e19ad2f14e9d010761cec8f0978cdd9d2
/app/internal/rpc/pojo/Transaction.java
f62f4784f8a0558d21644986d4fd8cca81960823
[ "Apache-2.0" ]
permissive
hyb1234hi/bitcoin-payments-provider
f9ab2c7f5b2bfdc0e9260a2205ce29dfdf9413eb
9735e9ee16eb78479f4ebdc65dfe2bc85a0d403f
refs/heads/master
2020-04-08T15:39:10.514678
2015-05-20T04:23:25
2015-05-20T04:23:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,172
java
package internal.rpc.pojo; import java.math.BigDecimal; import java.util.List; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; @JsonInclude(Include.ALWAYS) @JsonIgnoreProperties(ignoreUnknown=true) public class Transaction { private String txid; private BigDecimal fee; private BigDecimal amount; private long blockindex; private long confirmations; private long time; private long timereceived; private long block; private String hex; private String blockhash; private String otheraccount; private String comment; private String to; private long blocktime; private List<String> walletconflicts; private List<TransactionDetails> details; public String getOtheraccount() { return otheraccount; } public Transaction setOtheraccount(String otheraccount) { this.otheraccount = otheraccount; return this; } public String getComment() { return comment; } public Transaction setComment(String comment) { this.comment = comment; return this; } public BigDecimal getFee() { return fee; } public Transaction setFee(BigDecimal fee) { this.fee = fee; return this; } public BigDecimal getAmount() { return amount; } public Transaction setAmount(BigDecimal amount) { this.amount = amount; return this; } public long getBlockindex() { return blockindex; } public List<String> getWalletconflicts() { return walletconflicts; } public Transaction setWalletconflicts(List<String> walletconflicts) { this.walletconflicts = walletconflicts; return this; } public Transaction setBlockindex(long blockindex) { this.blockindex = blockindex; return this; } public String getCategory() { if(details == null || details.size() == 0) return null; String categoryString = null; for(TransactionDetails d : details){ if(categoryString == null) categoryString = d.getCategory(); else if(!categoryString.equals(d.getCategory())) return null; } return categoryString; } public long getConfirmations() { return confirmations; } public Transaction setConfirmations(long confirmations) { this.confirmations = confirmations; return this; } public String getAddress() { if(details == null || details.size() == 0) return null; String addrString = null; for(TransactionDetails d : details){ if(addrString == null) addrString = d.getAddress(); else if(!addrString.equals(d.getAddress())) return null; } return addrString; } public String getAccount() { if(details == null || details.size() == 0) return null; String accountString = null; for(TransactionDetails d : details){ if(accountString == null) accountString = d.getAccount(); else if(!accountString.equals(d.getAccount())) return null; } return accountString; } public String getTxid() { return txid; } public Transaction setTxid(String txid) { this.txid = txid; return this; } public long getBlock() { return block; } public Transaction setBlock(long block) { this.block = block; return this; } public String getHex() { return hex; } public Transaction setHex(String hex) { this.hex = hex; return this; } public String getBlockhash() { return blockhash; } public Transaction setBlockhash(String blockhash) { this.blockhash = blockhash; return this; } public List<TransactionDetails> getDetails() { return details; } public Transaction setDetails(List<TransactionDetails> details) { this.details = details; return this; } public long getTime() { return time; } public Transaction setTime(long time) { this.time = time; return this; } public long getTimereceived() { return timereceived; } public Transaction setTimereceived(long timereceived) { this.timereceived = timereceived; return this; } public long getBlocktime() { return blocktime; } public Transaction setBlocktime(long blocktime) { this.blocktime = blocktime; return this; } public String getTo() { return to; } public Transaction setTo(String to) { this.to = to; return this; } }
[ "selcik2@illinois.edu" ]
selcik2@illinois.edu
307670367d79522ec18b21fc30c5f532336bd950
02e97a4b968f361d28ab3094510eec4c09b4325e
/lesson2/src/main/java/com/bxw/lesson2/bootstrap/MyPropertySourceLocator.java
60e185ed2a9d287f77d854073d23a72d74a9994f
[]
no_license
wangxbo/spring_cloud_learning
5056feef02d9ef78dcbd7c9e5ccd0425a003353e
5535017ce8b77262ac21244787b129b35e010d81
refs/heads/master
2021-05-02T05:45:16.161915
2018-03-07T11:49:21
2018-03-07T11:49:21
120,847,476
0
0
null
null
null
null
UTF-8
Java
false
false
1,276
java
package com.bxw.lesson2.bootstrap; import org.springframework.cloud.bootstrap.config.PropertySourceLocator; import org.springframework.core.env.*; import java.util.HashMap; import java.util.Map; /** * 自定义 {@link org.springframework.boot.env.PropertySourceLoader} 实现 * Created by wxb on 2018/2/9. */ public class MyPropertySourceLocator implements PropertySourceLocator{ @Override public PropertySource<?> locate(Environment environment) { if(environment instanceof ConfigurableEnvironment){ ConfigurableEnvironment configurableEnvironment = ConfigurableEnvironment.class.cast(environment); //获取PropertySources MutablePropertySources propertySources = configurableEnvironment.getPropertySources(); //定义新的propertySource ,放置首位 propertySources.addFirst(createPropertySource()); } return null; } private PropertySource createPropertySource(){ Map<String, Object> source = new HashMap<>(); source.put("spring.application.name", "bxw spring_cloud"); //设置名称和来源 PropertySource propertySource = new MapPropertySource("over-bootstrap-property-source", source); return propertySource; } }
[ "wangxb@lcjh.com" ]
wangxb@lcjh.com
ab76123f01b546d783d9ec7c185355e2d0302e77
82f85a5fd93f823e70b553440c3f7c19ec0ca964
/InstargramMenuTest/app/src/main/java/com/example/instargrammenutest/Fragment5.java
897bae8d200cdfac24e037420648ffdf8d5bcb68
[]
no_license
xim3739/Android
9199e75bf32ea0d214775f9b2caa321a30cc453d
aa0f21400dbcb145f9deabaa5771a5eaa0ae566d
refs/heads/master
2020-08-29T21:16:00.201310
2019-12-09T00:40:21
2019-12-09T00:40:21
218,175,433
0
0
null
null
null
null
UTF-8
Java
false
false
604
java
package com.example.instargrammenutest; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; public class Fragment5 extends Fragment { private View view; @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { view = inflater.inflate(R.layout.fragment5, container, false); return view; } }
[ "tlawogus11106@gmail.com" ]
tlawogus11106@gmail.com
8501ecc446e26a6c24fd67c470afefee04e5e2c7
4c41fb5adc9e1e80c10a515a26fdc2459ccac062
/src/main/java/collectioins/java/Map_Hash_Map.java
ed625386da4b9a68cd985f36f03e41924892644f
[]
no_license
Karthikcbe21987/Karthikcbe21987
fcfbb1c89dddb9a604e0a2971fbe7e5019e001ff
04a56dc589d33f2cddabdc12081530d7d581d337
refs/heads/master
2023-03-24T10:47:23.021501
2021-03-23T23:35:54
2021-03-23T23:35:54
350,889,669
0
0
null
null
null
null
UTF-8
Java
false
false
493
java
package collectioins.java; import java.util.*; public class Map_Hash_Map { public static void main (String args[]) { HashMap<Integer,String> hs=new HashMap <Integer,String>(); hs.put(1, "Mango"); hs.put(2, "Orange"); hs.put(3,"Grapes"); hs.put(4, "Banana"); hs.put(2, "WATERMELON"); for(Map.Entry m:hs.entrySet()) { System.out.println(m.getKey() +" "+m.getValue()); } System.out.println(hs.get(4)); //System.out.println(hs.getClass()); } }
[ "Karthik@Karthik-PC" ]
Karthik@Karthik-PC
5a847558bd8e80ee505490a5d784c3e995123570
d916e7732f456c77a1ea2053e7ed8abe4d0714a6
/examples/src/test/java/tech/anima/tinytypes/examples/DropwizardBootstrapTest.java
794876caaf8b2b7ef58c3bbbeb63699f8a3dba53
[ "MIT" ]
permissive
caligin/tinytypes
04e067becd3e679e4b2c3085dd9b2707be3041db
146e7d0344addff52139ae9f12bb106000333fa9
refs/heads/main
2023-04-29T22:28:09.376014
2023-01-26T23:43:44
2023-01-26T23:43:44
42,624,467
12
1
MIT
2023-04-24T18:56:50
2015-09-17T01:11:45
Java
UTF-8
Java
false
false
3,229
java
package tech.anima.tinytypes.examples; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import io.dropwizard.Application; import io.dropwizard.Configuration; import io.dropwizard.setup.Bootstrap; import io.dropwizard.setup.Environment; import org.junit.Assert; import org.junit.Test; import tech.anima.tinytypes.Samples; import tech.anima.tinytypes.jackson.TinyTypesModule; public class DropwizardBootstrapTest { @Test public void canLoadYamlDWConfigFileWithTinyTypes() throws Exception { new TestApplication().run(new String[]{"server", ClassLoader.getSystemClassLoader().getResource("tts.yml").getPath().toString()}); } public static class TestApplication extends Application<ConfigurationWithTinyTypes> { @Override public void initialize(Bootstrap<ConfigurationWithTinyTypes> bootstrap) { bootstrap.getObjectMapper().registerModule(new TinyTypesModule()); } @Override public void run(ConfigurationWithTinyTypes configuration, Environment environment) throws Exception { Assert.assertEquals("1", configuration.stringValue.value); Assert.assertEquals(true, configuration.booleanValue.value); Assert.assertEquals(1, configuration.byteValue.value); Assert.assertEquals(1, configuration.shortValue.value); Assert.assertEquals(1, configuration.integerValue.value); Assert.assertEquals(1, configuration.longValue.value); } } public static class ConfigurationWithTinyTypes extends Configuration { private final Samples.Str stringValue; private final Samples.Boolean booleanValue; private final Samples.Byte byteValue; private final Samples.Short shortValue; private final Samples.Integer integerValue; private final Samples.Long longValue; @JsonCreator public ConfigurationWithTinyTypes( @JsonProperty("stringValue") Samples.Str stringValue, @JsonProperty("booleanValue") Samples.Boolean booleanValue, @JsonProperty("byteValue") Samples.Byte byteValue, @JsonProperty("shortValue") Samples.Short shortValue, @JsonProperty("integerValue") Samples.Integer integerValue, @JsonProperty("longValue") Samples.Long longValue) { this.stringValue = stringValue; this.booleanValue = booleanValue; this.byteValue = byteValue; this.shortValue = shortValue; this.integerValue = integerValue; this.longValue = longValue; } public Samples.Str getStringValue() { return stringValue; } public Samples.Boolean getBooleanValue() { return booleanValue; } public Samples.Byte getByteValue() { return byteValue; } public Samples.Short getShortValue() { return shortValue; } public Samples.Integer getIntegerValue() { return integerValue; } public Samples.Long getLongValue() { return longValue; } } }
[ "caligin35@gmail.com" ]
caligin35@gmail.com
5f27c84986273778a5b09075e8e21a88d30c801a
d24be948a925c438e227b1aa389dc0895939a0a2
/New Project/src/com/miscelinous/Amainclass.java
94a340f62c62a41d5dc4a0f9017463c1152a6a6a
[]
no_license
sudarshankumart/newrepository
21e3d63d8d34fe7036e5344c36dc362555a5a715
7acc7060c5671ce33a7338b87588f2ee34cca454
refs/heads/master
2020-09-03T09:32:08.037908
2019-11-20T18:26:16
2019-11-20T18:26:16
219,436,262
0
0
null
null
null
null
UTF-8
Java
false
false
339
java
package com.miscelinous; public class Amainclass { public static void main(String[] args) { A.objectcreation().intitialization(10,12.0,false).display(); A.objectcreation().intitialization(25,44.0,true).display(); A obj1= A.objectcreation(); obj1.intitialization(10,20.0,false); obj1.display(); } }
[ "57182743+sudarshankumart@users.noreply.github.com" ]
57182743+sudarshankumart@users.noreply.github.com
c421471cab3e0578b4beab3770dfc6e0f2152cdb
ecb49bd2c28022d34f9a43ee429a0134f1a51365
/src/main/java/com/jun/spring/InitializingBean.java
a4f9ac37887050070cfd31f7cc9288f1e1238c29
[]
no_license
junTtrust/spring-createbean
789d34098352fddcf7c3fe5229a3d22ad295c730
b41e75675d66d7c608c4bb0c40ac6ba8a43fe133
refs/heads/master
2023-08-16T17:45:07.986035
2021-10-02T09:10:49
2021-10-02T09:10:49
412,740,058
0
0
null
null
null
null
UTF-8
Java
false
false
149
java
package com.jun.spring; /** * @Author: yijunjun * @Date: 2021/10/2 14:43 */ public interface InitializingBean { void afterPropertiesSet(); }
[ "25388011977@qq.com" ]
25388011977@qq.com
28e312eedf426db05971ecc57ebcf0673dd49ce6
0d69bfd4e8856a95911a1359e876e0f02fa9540d
/app/src/main/java/com/cong/eventcreater/model/InsertEvent.java
bc982ee2134889e4ae2d3cd364958fd71b4e7701
[]
no_license
TimThrill/EventCreater
183b4068419d9f54a8410a64c52deb9f537ee0ab
4a163d03ce7bcc4d6f2bb661e94fc7c3db6dda5e
refs/heads/master
2021-01-23T05:15:02.458555
2017-03-27T04:28:00
2017-03-27T04:28:00
86,291,356
0
0
null
null
null
null
UTF-8
Java
false
false
1,521
java
package com.cong.eventcreater.model; import android.content.ContentValues; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.os.AsyncTask; import com.cong.eventcreater.model.Database; import com.cong.eventcreater.model.Event; import com.cong.eventcreater.model.EventDbHelper; import java.util.HashMap; import java.util.Map; /** * Created by admin on 17/09/2016. */ public class InsertEvent extends AsyncTask<Event, Void, Void> { private Context context; public InsertEvent(Context context) { this.context = context; } @Override protected Void doInBackground(Event... params) { Event event = params[0]; EventDbHelper eventDbHelper = new EventDbHelper(this.context, null); SQLiteDatabase db = eventDbHelper.getWritableDatabase(); ContentValues values = Database.getEventContentValues(event); db.insert(EventDbHelper.tblEventName, null, values); HashMap<Integer, Person> attendees = event.getAttendees(); for(Map.Entry<Integer, Person> attendee : attendees.entrySet()) { ContentValues attendeeValue = new ContentValues(); attendeeValue.put(EventDbHelper.tblAttendee.EVENT_ID, event.getId()); attendeeValue.put(EventDbHelper.tblAttendee.ATTENDEE, attendee.getKey()); db.insert(EventDbHelper.tblAttendeeName, null, attendeeValue); } // Release the db object db.releaseReference(); return null; } }
[ "macong1989@gmail.com" ]
macong1989@gmail.com
8e83b3eba58bcc8662cb738acf168da084b836de
d516276cdfc222ec7bf38837e7bc12341993dd9c
/patterns-codebeispiele/de.bht.fpa.examples.statepattern/src/de/bht/fpa/statepattern/v3/CoffeeMachine.java
ff33667c88aa041e01152ee4cc99f1eb27570828
[]
no_license
gnomcheck/BHT-FPA
ef2e3448c4832d26fb2f94447e524eb593a008bd
37769199aab93a0aa09a9b2836674231ac54dafe
refs/heads/master
2021-01-18T12:32:46.401696
2013-05-24T20:20:53
2013-05-24T20:20:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,308
java
package de.bht.fpa.statepattern.v3; import de.bht.fpa.statepattern.v3.states.BeverageSelectedState; import de.bht.fpa.statepattern.v3.states.ChipInsertedState; import de.bht.fpa.statepattern.v3.states.ICoffeMachineState; import de.bht.fpa.statepattern.v3.states.NoChipState; public class CoffeeMachine { private final ICoffeMachineState noChipState = new NoChipState(this); private final ICoffeMachineState chipInsertedState = new ChipInsertedState(this); private final ICoffeMachineState beverageSelectedState = new BeverageSelectedState(this); private ICoffeMachineState state = noChipState; public CoffeeMachine() { System.out.println("\nWillkommen."); } public String insertChip() { return state.insertChip(); } public String ecjectChip() { return state.ecjectChip(); } public String selectBeverage() { return state.selectBeverage(); } public String dispenseBeverage() { return state.dispenseBeverage(); } public void setState(ICoffeMachineState state) { this.state = state; } public ICoffeMachineState getNoChipState() { return noChipState; } public ICoffeMachineState getChipInsertedState() { return chipInsertedState; } public ICoffeMachineState getBeverageSelectedState() { return beverageSelectedState; } }
[ "siamak.h@gmx.de" ]
siamak.h@gmx.de
e8b7ebd759b4e38634356b64aed3b37786f0beef
846e71955c9b593498cfad5b872caf3bb258cffc
/src/main/java/com/expect/admin/web/controller/custom/RoleController.java
402404743b38f9b389c5ee16a36c393083153752
[]
no_license
qqyycom/spring-boot-admin
e7c0231534782e533d1e18f47a46dc3480d9cda7
e14b576dacd077089e59f0bd8d43180e64d955e0
refs/heads/master
2020-04-11T21:19:03.248615
2017-03-17T15:20:31
2017-03-17T15:20:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,621
java
package com.expect.admin.web.controller.custom; import java.util.ArrayList; import java.util.List; import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.expect.admin.contants.DataTableLocal; import com.expect.admin.service.convertor.custom.RoleConvertor; import com.expect.admin.service.impl.custom.RoleService; import com.expect.admin.service.vo.component.html.CheckboxsVo; import com.expect.admin.service.vo.component.html.JsTreeVo; import com.expect.admin.service.vo.component.html.datatable.DataTableRowVo; import com.expect.admin.service.vo.custom.RoleVo; import com.expect.admin.web.interceptor.PageEnter; import com.expect.custom.service.vo.component.ResultVo; import com.expect.custom.web.exception.AjaxRequest; import com.expect.custom.web.exception.AjaxRequestException; /** * 角色管理Controller */ @Controller @RequestMapping("/admin/role") public class RoleController { private final String viewName = "admin/system/custom/role/"; @Autowired private RoleService roleService; /** * 角色-管理页面 */ @PageEnter @RequestMapping("/managePage") public ModelAndView managePage() { List<DataTableRowVo> dtrvs = roleService.getRoleDtrsv(); DataTableLocal.set(dtrvs); return new ModelAndView(viewName + "manage"); } /** * 角色-功能配置页面 */ @PageEnter @RequestMapping("/configurationPage") public ModelAndView configurationPage() { List<RoleVo> roles = roleService.getRoles(); ModelAndView modelAndView = new ModelAndView(viewName + "configuration"); modelAndView.addObject("roles", roles); return modelAndView; } /** * 角色-表单页面 */ @RequestMapping(value = "/formPage", method = RequestMethod.GET) public ModelAndView departmentFormPage(String id) { RoleVo role = roleService.getRoleById(id); ModelAndView modelAndView = new ModelAndView(viewName + "form/form"); modelAndView.addObject("role", role); return modelAndView; } /** * 获取对应角色的功能tree */ @RequestMapping("/getFunctionTree") @ResponseBody @AjaxRequest public List<JsTreeVo> getFunctionTree(String roleId) throws AjaxRequestException { return roleService.getFunctionTreeByRoleId(roleId); } /** * 获取对应角色的功能tree */ @RequestMapping("/getOwnFunctionTree") @ResponseBody @AjaxRequest public List<JsTreeVo> getOwnFunctionTree(String roleId) throws AjaxRequestException { return roleService.getOwnFunctionTreeByRoleId(roleId); } /** * 角色-保存 */ @RequestMapping(value = "/save", method = RequestMethod.POST) @ResponseBody @AjaxRequest public DataTableRowVo save(RoleVo role) throws AjaxRequestException { return roleService.save(role); } /** * 角色-更新 */ @RequestMapping(value = "/update", method = RequestMethod.POST) @ResponseBody @AjaxRequest public DataTableRowVo update(RoleVo role) throws AjaxRequestException { return roleService.update(role); } /** * 角色-删除 */ @RequestMapping(value = "/delete", method = RequestMethod.POST) @ResponseBody @AjaxRequest public ResultVo delete(String id) throws AjaxRequestException { return roleService.delete(id); } /** * 角色-批量删除 */ @RequestMapping(value = "/deleteBatch", method = RequestMethod.POST) @ResponseBody @AjaxRequest public ResultVo deleteBatch(String ids) throws AjaxRequestException { return roleService.deleteBatch(ids); } /** * 修改角色功能 */ @RequestMapping(value = "/updateRoleFunctions", method = RequestMethod.POST) @ResponseBody @AjaxRequest public ResultVo updateRoleFunctions(String roleId, String functionIds) throws AjaxRequestException { return roleService.updateRoleFunctions(roleId, functionIds); } /** * 获取roleCheckbox的html */ @RequestMapping(value = "/getRoleCheckboxHtml", method = RequestMethod.POST) @ResponseBody @AjaxRequest public CheckboxsVo getRoleCheckboxHtml(String userId) throws AjaxRequestException { List<RoleVo> roles = roleService.getRoles(); List<RoleVo> userRoles = roleService.getRolesByUserId(userId); List<String> ids = new ArrayList<>(); if (!CollectionUtils.isEmpty(userRoles)) { for (RoleVo role : userRoles) { ids.add(role.getId()); } } CheckboxsVo cbv = RoleConvertor.convertCbv(roles, ids); return cbv; } }
[ "qubo11@qq.com" ]
qubo11@qq.com
627b5b12799a3571d559be45652ccbf269522b43
2933de9c73a892e734a605dd241b58f9640be40e
/app/src/main/java/com/surecn/moat/tools/CFPSMaker.java
a63b26d56f34adf2f78962f0ad773b9ff452d8a2
[]
no_license
surecn/FamilyMoive
000fa56dff1c77f3da3f1565a774d106737a6fc5
b3abdb6e24522632f94020c74582126a237e6b4b
refs/heads/master
2022-12-24T06:16:47.915067
2020-10-10T09:01:02
2020-10-10T09:01:02
302,804,318
0
2
null
null
null
null
UTF-8
Java
false
false
2,486
java
package com.surecn.moat.tools; import java.text.DecimalFormat; /** * */ /** * <p>Title: LoonFramework</p> * <p>Description:</p> * <p>Copyright: Copyright (c) 2007</p> * <p>Company: LoonFramework</p> * @author chenpeng * @email ceponline@yahoo.com.cn * @version 0.1 * */ public class CFPSMaker { /** * 设定动画运行多少帧后统计一次帧数 */ public static final int FPS = 8; /** * 换算为运行周期 * 单位: ns(纳秒) */ public static final long PERIOD = (long) (1.0 / FPS * 1000000000); /** * FPS最大间隔时间,换算为1s = 10^9ns * 单位: ns */ public static long FPS_MAX_INTERVAL = 1000000000L; /** * 实际的FPS数值 */ private double nowFPS = 0.0; /** * FPS累计用间距时间 * in ns */ private long interval = 0L; private long time; /** * 运行桢累计 */ private long frameCount = 0; /** * 格式化小数位数 */ private DecimalFormat df = new DecimalFormat("0.0"); /** * 制造FPS数据 * */ public void makeFPS() { frameCount++; interval += PERIOD; //当实际间隔符合时间时。 if (interval >= FPS_MAX_INTERVAL) { //nanoTime()返回最准确的可用系统计时器的当前值,以毫微秒为单位 long timeNow = System.nanoTime(); // 获得到目前为止的时间距离 long realTime = timeNow - time; // 单位: ns //换算为实际的fps数值 nowFPS = ((double) frameCount / realTime) * FPS_MAX_INTERVAL; //变更数值 frameCount = 0L; interval = 0L; time = timeNow; } } public long getFrameCount() { return frameCount; } public void setFrameCount(long frameCount) { this.frameCount = frameCount; } public long getInterval() { return interval; } public void setInterval(long interval) { this.interval = interval; } public double getNowFPS() { return nowFPS; } public void setNowFPS(double nowFPS) { this.nowFPS = nowFPS; } public long getTime() { return time; } public void setTime(long time) { this.time = time; } public String getFPS() { return df.format(nowFPS); } }
[ "surecn@163.com" ]
surecn@163.com