blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 7
332
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
50
| license_type
stringclasses 2
values | repo_name
stringlengths 7
115
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 557
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
684M
⌀ | star_events_count
int64 0
77.7k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 17
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 82
values | src_encoding
stringclasses 28
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 7
5.41M
| extension
stringclasses 11
values | content
stringlengths 7
5.41M
| authors
listlengths 1
1
| author
stringlengths 0
161
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
af9cac658f06b5516ed70e22fa5d626921c0427c
|
c8fa31f280f0c4370487074ba481bf3068b2be9c
|
/src/com/entropik/wallet/QrBarActivity.java
|
5560b5de1520c6f918e34c22c0318bdc4f97c757
|
[] |
no_license
|
D4nielus/FinApps2014_Team16
|
64c5bb6d5f26143631204ef11eba8e83697ed055
|
6fd9d245efffcc34d5b21e155d6701ca7be22461
|
refs/heads/master
| 2021-03-12T19:38:09.015347 | 2014-10-25T13:08:38 | 2014-10-25T13:08:38 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,109 |
java
|
package com.entropik.wallet;
import java.io.IOException;
import java.io.InputStream;
import com.entropik.wereabletest.SelectMoneyActivity;
import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ImageView;
public class QrBarActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_qr_bar);
ImageView myImageContact = (ImageView) findViewById(R.id.imageViewQr);
// get input stream
Context context = QrBarActivity.this.getApplicationContext();
InputStream ims = null;
try {
ims = context.getAssets().open("Contacts/qr_img.png");
} catch (IOException e) {
e.printStackTrace();
}
// load image as Drawable
Drawable d = Drawable.createFromStream(ims, null);
// set image to ImageView
myImageContact.setImageDrawable(d);
}
}
|
[
"[email protected]"
] | |
535554a8cece5c0c7aee21a46aa61754fd947206
|
ed3cb95dcc590e98d09117ea0b4768df18e8f99e
|
/project_1_3/src/b/d/c/i/Calc_1_3_13283.java
|
fa45238c3718bea262ec05bdee43e295b5715a1b
|
[] |
no_license
|
chalstrick/bigRepo1
|
ac7fd5785d475b3c38f1328e370ba9a85a751cff
|
dad1852eef66fcec200df10083959c674fdcc55d
|
refs/heads/master
| 2016-08-11T17:59:16.079541 | 2015-12-18T14:26:49 | 2015-12-18T14:26:49 | 48,244,030 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 134 |
java
|
package b.d.c.i;
public class Calc_1_3_13283 {
/** @return the sum of a and b */
public int add(int a, int b) {
return a+b;
}
}
|
[
"[email protected]"
] | |
fc78ae91b86c2eb212e47c0a588066f3d6548372
|
fd84ad5364865eb7ae4374b84373f330741e1c31
|
/src/main/java/types/inGame/HideParticle.java
|
dfaf28f31ddda0680699e66a8f3f1285ab81e29e
|
[] |
no_license
|
Demitto/HideMOD
|
74ad246557ac1e1c93ad842565165ca5da2109ed
|
56a6fd586cb40063b9db252f78e0fe34df054609
|
refs/heads/master
| 2020-04-15T04:47:44.228627 | 2019-01-07T07:54:44 | 2019-01-07T07:54:44 | 164,396,763 | 1 | 0 | null | 2019-01-07T07:49:03 | 2019-01-07T07:49:02 | null |
UTF-8
|
Java
| false | false | 1,025 |
java
|
package types.inGame;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.util.EnumParticleTypes;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class HideParticle {
public static void spawnParticle(double x,double y,double z){
EntityFX fx = Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(2, x, y, z, 0D, 0D, 0D, new int[0]);
}
public static EntityFX spawnExplosionEffect(double x,double y,double z,float range){
return null;
}
public static EntityFX getParticleEntity(String name,int x,int y,int z,int[] data){
name = name.toLowerCase();
int ParticleID = 0;
for(EnumParticleTypes type : EnumParticleTypes.values()){
if(name.contains(type.getParticleName().toLowerCase().replace("_", ""))){
ParticleID = type.getParticleID();
}
}
return Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(ParticleID, x, y, z, 0D, 0D, 0D, data);
}
}
|
[
""
] | |
7577aca573882383ec411ef91864f9ac36b317a1
|
96679ce10997ba9b5337cbb99293e0f75ad9e45c
|
/src/ml/sample/Event.java
|
29447388244917d3217951472a48ca7edb246a2a
|
[] |
no_license
|
Weym/aih_150
|
5437546a76b1357bbd9b833a0074408dbb2e316e
|
4c175bb222524b57491b1ec4422a79ee75956817
|
refs/heads/master
| 2021-01-15T10:46:22.719480 | 2011-11-21T18:37:29 | 2011-11-21T18:37:29 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,247 |
java
|
package ml.sample;
import shared.Copyable;
/**
* An Event represents the element used to generate Sample objects. Using
* language from statistics largely for entertainment value.
*
* @author ksmall
*/
public class Event<T extends Copyable<T>> implements Copyable<Event<T>> {
/** weight assigned to this particular Event */
public double weight;
/** distributional weight assigned to this Event (often generated from weight) */
public double probability;
/** the actual outcome if this Event is selected */
public T outcome;
/**
* The primary Event constructor
*
* @param outcome the outcome returned if Event is selected
* @param weight the weight associated with this event
* @param isProbability {@code true} if the weight is a probability
*/
public Event(T outcome, double weight, boolean isProbability) {
this.outcome = outcome;
this.weight = weight;
if (isProbability)
this.probability = this.weight;
else
this.probability = 0.0;
}
/**
* Event constructor which assumes that the input weight is not derived from
* a distribution.
*
* @param outcome the outcome returned is Event is selected
* @param weight the weight associated with this Event
*/
public Event(T outcome, double weight) {
this(outcome, weight, false);
}
/**
* Event constructor which assumes that the Events are from a uniform distribution
*
* @param outcome the outcome returned is Event is selected
*/
public Event(T outcome) {
this(outcome, 1.0);
}
/**
* Returns a String representation of this Event instance
*
* @return the {@code String} representation of this {@code Event}
*/
public String toString() {
return new String("EVENT[" + outcome + "] w:" + weight + " p:" + probability);
}
public Event<T> copy() {
Event<T> result = new Event<T>(this.outcome, this.weight);
result.probability = this.probability;
return result;
}
public Event<T> deepCopy() {
Event<T> result = null;
if (this.outcome instanceof shared.Copyable<?>) {
result = new Event<T>(this.outcome.deepCopy(), this.weight);
result.probability = this.probability;
}
else
throw new UnsupportedOperationException("Event outcome cannot deepCopy");
return result;
}
}
|
[
"[email protected]"
] | |
97278b15b9e575ceb9b221bb546087a7edc0fd9b
|
f8b41287cfb2ff083d759b9cdbe1bb077c58a1ab
|
/src/main/java/com/example/demo/services/imp/GCSStorageService.java
|
3e6540c8387a0b69ff07d5e8bb43795b7b6aa8cd
|
[] |
no_license
|
UTTAM2311/GCE-Demo
|
9080c6188d2e3f4d0074ff688660987980b6e8b7
|
e1a2fdb958b0189c3ad1bbe429c6a7f6ade255f0
|
refs/heads/master
| 2020-04-05T03:17:33.598035 | 2018-11-14T07:49:54 | 2018-11-14T07:49:54 | 156,508,823 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,659 |
java
|
package com.example.demo.services.imp;
import com.example.demo.services.StorageService;
import com.google.cloud.ReadChannel;
import com.google.cloud.storage.Acl;
import com.google.cloud.storage.BlobId;
import com.google.cloud.storage.BlobInfo;
import com.google.cloud.storage.Storage;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.InputStream;
import java.nio.channels.Channels;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@Service
public class GCSStorageService implements StorageService {
@Autowired
private Storage storage;
@Value("${application.uploadService.bucketName}")
private String bucketName;
@Override
public String upload(InputStream stream, String fileName) {
BlobInfo blobInfo = storage.create(
BlobInfo.newBuilder(bucketName, fileName).setAcl(new ArrayList<>(Collections.singletonList(Acl.of(Acl.User.ofAllUsers(), Acl.Role.READER)))).build(), stream);
// return the public download link
blobInfo.toBuilder().build().getBlobId();
return blobInfo.getMediaLink();
}
@Override
public InputStream download(String fileName) {
BlobId blobId = BlobId.of(bucketName, fileName);
ReadChannel reader = storage.get(blobId).reader();
return Channels.newInputStream(reader);
}
}
|
[
"[email protected]"
] | |
66b9c1ab2b3d483f5a5f83d3314f5f003cd7d060
|
c9424256999ef9a74de23b7598121c361341ba02
|
/app/src/main/java/com/obpoo/gfsfabricsoftware/CommonArticleGroup/MVP/commonArticleGroup/cmnArtView.java
|
7c9908aed3f10cad7bc5bb0d84593c2fc9cdb546
|
[] |
no_license
|
anilobpoo/GFSADMIN_AWS
|
d25fdf462811d4b2e4c80eda44b956dbf809b60a
|
b6708995c0082848602076f9dd2187deb16af27f
|
refs/heads/master
| 2020-06-09T12:51:32.203195 | 2019-07-24T12:47:25 | 2019-07-24T12:47:25 | 193,440,468 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 527 |
java
|
package com.obpoo.gfsfabricsoftware.CommonArticleGroup.MVP.commonArticleGroup;
import com.obpoo.gfsfabricsoftware.CommonArticleGroup.DataModel.cmnArticleGroupModel.cmnArticlePOJO;
import com.obpoo.gfsfabricsoftware.CommonArticleGroup.DataModel.deleteCmnArt.cmnArtdeletePOJO;
import com.obpoo.gfsfabricsoftware.mvp.BaseView;
/**
* Created by PHD on 11/19/2018.
*/
public interface cmnArtView extends BaseView {
void onShowCmnArtGroup(cmnArticlePOJO response);
void ondeleteCmnArtGroup(cmnArtdeletePOJO response);
}
|
[
"[email protected]"
] | |
37ec013e292e20b9e41d9ca654138f4a9578469a
|
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/10/10_7cae25eaaa1eb2d73b82e821d34338019892725f/TaskEditFragment/10_7cae25eaaa1eb2d73b82e821d34338019892725f_TaskEditFragment_t.java
|
311939614ecb210fc3ee3ba5cc78d20ebcfa32c0
|
[] |
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 | 48,245 |
java
|
/*
* ASTRID: Android's Simple Task Recording Dashboard
*
* Copyright (c) 2009 Tim Su
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package com.todoroo.astrid.activity;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.ContentValues;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.speech.RecognizerIntent;
import android.support.v4.app.Fragment;
import android.support.v4.app.SupportActivity;
import android.support.v4.view.Menu;
import android.support.v4.view.MenuItem;
import android.support.v4.view.ViewPager;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MenuInflater;
import android.view.View;
import android.view.View.MeasureSpec;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewParent;
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.Toast;
import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.service.ExceptionService;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.EditPeopleControlSet;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.gcal.GCalControlSet;
import com.todoroo.astrid.helper.TaskEditControlSet;
import com.todoroo.astrid.notes.EditNoteActivity;
import com.todoroo.astrid.opencrx.OpencrxControlSet;
import com.todoroo.astrid.opencrx.OpencrxCoreUtils;
import com.todoroo.astrid.producteev.ProducteevControlSet;
import com.todoroo.astrid.producteev.ProducteevUtilities;
import com.todoroo.astrid.reminders.Notifications;
import com.todoroo.astrid.repeats.RepeatControlSet;
import com.todoroo.astrid.service.AddOnService;
import com.todoroo.astrid.service.MetadataService;
import com.todoroo.astrid.service.StatisticsConstants;
import com.todoroo.astrid.service.StatisticsService;
import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.service.ThemeService;
import com.todoroo.astrid.tags.TagsControlSet;
import com.todoroo.astrid.taskrabbit.TaskRabbitControlSet;
import com.todoroo.astrid.timers.TimerActionControlSet;
import com.todoroo.astrid.timers.TimerControlSet;
import com.todoroo.astrid.ui.DateChangedAlerts;
import com.todoroo.astrid.ui.DeadlineControlSet;
import com.todoroo.astrid.ui.EditNotesControlSet;
import com.todoroo.astrid.ui.EditTitleControlSet;
import com.todoroo.astrid.ui.HideUntilControlSet;
import com.todoroo.astrid.ui.ImportanceControlSet;
import com.todoroo.astrid.ui.NestableScrollView;
import com.todoroo.astrid.ui.NestableViewPager;
import com.todoroo.astrid.ui.ReminderControlSet;
import com.todoroo.astrid.ui.TaskEditMoreControls;
import com.todoroo.astrid.ui.WebServicesView;
import com.todoroo.astrid.utility.Flags;
import com.todoroo.astrid.voice.VoiceInputAssistant;
import com.viewpagerindicator.TabPageIndicator;
/**
* This activity is responsible for creating new tasks and editing existing
* ones. It saves a task when it is paused (screen rotated, back button pressed)
* as long as the task has a title.
*
* @author timsu
*
*/
public final class TaskEditFragment extends Fragment implements
ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
public static final String TAG_TASKEDIT_FRAGMENT = "taskedit_fragment"; //$NON-NLS-1$
// --- bundle tokens
/**
* Task ID
*/
public static final String TOKEN_ID = "id"; //$NON-NLS-1$
/**
* Content Values to set
*/
public static final String TOKEN_VALUES = "v"; //$NON-NLS-1$
/**
* Task in progress (during orientation change)
*/
private static final String TASK_IN_PROGRESS = "task_in_progress"; //$NON-NLS-1$
/**
* Task remote id (during orientation change)
*/
private static final String TASK_REMOTE_ID = "task_remote_id"; //$NON-NLS-1$
/**
* Tab to start on
*/
public static final String TOKEN_TAB = "tab"; //$NON-NLS-1$
// --- request codes
public static final int REQUEST_LOG_IN = 0;
private static final int REQUEST_VOICE_RECOG = 10;
// --- menu codes
private static final int MENU_SAVE_ID = R.string.TEA_menu_save;
private static final int MENU_DISCARD_ID = R.string.TEA_menu_discard;
private static final int MENU_DELETE_ID = R.string.TEA_menu_delete;
private static final int MENU_COMMENTS_REFRESH_ID = R.string.TEA_menu_comments;
// --- result codes
public static final int RESULT_CODE_SAVED = Activity.RESULT_FIRST_USER;
public static final int RESULT_CODE_DISCARDED = Activity.RESULT_FIRST_USER + 1;
public static final int RESULT_CODE_DELETED = Activity.RESULT_FIRST_USER + 2;
public static final String OVERRIDE_FINISH_ANIM = "finishAnim"; //$NON-NLS-1$
public static final String TOKEN_TASK_WAS_ASSIGNED = "task_assigned"; //$NON-NLS-1$
public static final String TOKEN_ASSIGNED_TO = "task_assigned_to"; //$NON-NLS-1$
public static final String TOKEN_TAGS_CHANGED = "tags_changed"; //$NON-NLS-1$
public static final String TOKEN_NEW_REPEATING_TASK = "new_repeating"; //$NON-NLS-1$
// --- services
public static final int TAB_VIEW_UPDATES = 0;
public static final int TAB_VIEW_MORE = 1;
public static final int TAB_VIEW_WEB_SERVICES = 2;
@Autowired
private ExceptionService exceptionService;
@Autowired
private TaskService taskService;
@Autowired
private MetadataService metadataService;
@Autowired
private AddOnService addOnService;
@Autowired
private ActFmPreferenceService actFmPreferenceService;
// --- UI components
private ImageButton voiceAddNoteButton;
private EditPeopleControlSet peopleControlSet = null;
private TaskRabbitControlSet taskRabbitControl = null;
private EditNotesControlSet notesControlSet = null;
private HideUntilControlSet hideUntilControls = null;
private TagsControlSet tagsControlSet = null;
private TimerActionControlSet timerAction;
private EditText title;
private TaskEditMoreControls moreControls;
private EditNoteActivity editNotes;
private NestableViewPager mPager;
private TaskEditViewPager mAdapter;
private TabPageIndicator mIndicator;
private final Runnable refreshActivity = new Runnable() {
@Override
public void run() {
// Change state here
setPagerHeightForPosition(TAB_VIEW_UPDATES);
}
};
private final List<TaskEditControlSet> controls = Collections.synchronizedList(new ArrayList<TaskEditControlSet>());
// --- other instance variables
/** true if editing started with a new task */
private boolean isNewTask = false;
/** task model */
Task model = null;
/** whether task should be saved when this activity exits */
private boolean shouldSaveState = true;
/** voice assistant for notes-creation */
private VoiceInputAssistant voiceNoteAssistant;
private EditText notesEditText;
private Dialog whenDialog;
private boolean overrideFinishAnim;
// --- fragment handling variables
OnTaskEditDetailsClickedListener mListener;
private long remoteId = 0;
private WebServicesView webServices = null;
public static final int TAB_STYLE_NONE = 0;
public static final int TAB_STYLE_ACTIVITY = 1;
public static final int TAB_STYLE_ACTIVITY_WEB = 2;
public static final int TAB_STYLE_WEB = 3;
private int tabStyle = TAB_STYLE_NONE;
/*
* ======================================================================
* ======================================================= initialization
* ======================================================================
*/
/**
* Container Activity must implement this interface and we ensure that it
* does during the onAttach() callback
*/
public interface OnTaskEditDetailsClickedListener {
public void onTaskEditDetailsClicked(int category, int position);
}
@Override
public void onAttach(SupportActivity activity) {
super.onAttach(activity);
// Check that the container activity has implemented the callback
// interface
try {
mListener = (OnTaskEditDetailsClickedListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString()
+ " must implement OnTaskEditDetailsClickedListener"); //$NON-NLS-1$
}
}
public TaskEditFragment() {
DependencyInjectionService.getInstance().inject(this);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// if we were editing a task already, restore it
if (savedInstanceState != null
&& savedInstanceState.containsKey(TASK_IN_PROGRESS)) {
Task task = savedInstanceState.getParcelable(TASK_IN_PROGRESS);
if (task != null) {
model = task;
}
if (savedInstanceState.containsKey(TASK_REMOTE_ID)) {
remoteId = savedInstanceState.getLong(TASK_REMOTE_ID);
}
}
getActivity().setResult(Activity.RESULT_OK);
}
/*
* ======================================================================
* ==================================================== UI initialization
* ======================================================================
*/
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View v = inflater.inflate(R.layout.task_edit_activity, container, false);
return v;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
AstridActivity activity = (AstridActivity) getActivity();
if (activity instanceof TaskListActivity && activity.fragmentLayout == AstridActivity.LAYOUT_DOUBLE) {
getView().findViewById(R.id.save_and_cancel).setVisibility(View.VISIBLE);
getView().findViewById(R.id.save).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
saveButtonClick();
}
});
getView().findViewById(R.id.cancel).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
discardButtonClick();
}
});
}
setUpUIComponents();
adjustInfoPopovers();
Preferences.setBoolean(R.string.p_showed_tap_task_help, true);
overrideFinishAnim = false;
if (activity != null) {
if (activity.getIntent() != null)
overrideFinishAnim = activity.getIntent().getBooleanExtra(
OVERRIDE_FINISH_ANIM, true);
}
}
private void loadMoreContainer() {
View moreTab = (View) getView().findViewById(R.id.more_container);
View commentsBar = (View) getView().findViewById(R.id.updatesFooter);
long idParam = getActivity().getIntent().getLongExtra(TOKEN_ID, -1L);
boolean hasTitle = !TextUtils.isEmpty(model.getValue(Task.TITLE));
if(hasTitle)
tabStyle = TAB_STYLE_ACTIVITY_WEB;
else
tabStyle = TAB_STYLE_ACTIVITY;
if (editNotes == null) {
editNotes = new EditNoteActivity(this, getView(),
idParam);
editNotes.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
editNotes.addListener(this);
if (timerAction != null) {
timerAction.addListener(editNotes);
}
}
else {
editNotes.loadViewForTaskID(idParam);
}
editNotes.addListener(this);
Handler refreshHandler = new Handler();
refreshHandler.postDelayed(refreshActivity, 1000);
if(hasTitle) {
if(webServices == null) {
webServices = new WebServicesView(getActivity());
webServices.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
webServices.setPadding(10, 5, 10, 10);
webServices.taskRabbitControl = taskRabbitControl;
webServices.setTask(model);
} else {
webServices.refresh();
}
}
mAdapter = new TaskEditViewPager(getActivity(), tabStyle);
mAdapter.parent = this;
mPager = (NestableViewPager) getView().findViewById(R.id.pager);
mPager.setAdapter(mAdapter);
mIndicator = (TabPageIndicator) getView().findViewById(
R.id.indicator);
mIndicator.setViewPager(mPager);
mIndicator.setOnPageChangeListener(this);
if (moreControls.getParent() != null && moreControls.getParent() != mPager) {
((ViewGroup) moreControls.getParent()).removeView(moreControls);
}
commentsBar.setVisibility(View.VISIBLE);
moreTab.setVisibility(View.VISIBLE);
}
private void setCurrentTab(int position) {
if(mIndicator == null)
return;
mIndicator.setCurrentItem(position);
mPager.setCurrentItem(position);
}
/** Initialize UI components */
private void setUpUIComponents() {
LinearLayout basicControls = (LinearLayout) getView().findViewById(
R.id.basic_controls);
LinearLayout titleControls = (LinearLayout) getView().findViewById(
R.id.title_controls);
LinearLayout whenDialogView = (LinearLayout) LayoutInflater.from(
getActivity()).inflate(R.layout.task_edit_when_controls, null);
moreControls = (TaskEditMoreControls) LayoutInflater.from(getActivity()).inflate(
R.layout.task_edit_more_controls, null);
constructWhenDialog(whenDialogView);
HashMap<String, TaskEditControlSet> controlSetMap = new HashMap<String, TaskEditControlSet>();
// populate control set
EditTitleControlSet editTitle = new EditTitleControlSet(getActivity(),
R.layout.control_set_title, Task.TITLE, R.id.title);
title = (EditText) editTitle.getView().findViewById(R.id.title);
controls.add(editTitle);
titleControls.addView(editTitle.getDisplayView(), 0, new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 1.0f));
timerAction = new TimerActionControlSet(
getActivity(), getView());
controls.add(timerAction);
tagsControlSet = new TagsControlSet(getActivity(),
R.layout.control_set_tags,
R.layout.control_set_default_display, R.string.TEA_tags_label_long);
controls.add(tagsControlSet);
controlSetMap.put(getString(R.string.TEA_ctrl_lists_pref),
tagsControlSet);
// EditPeopleControlSet relies on the "tags" transitory created by the
// TagsControlSet, so we put the tags control before the people control
// EditPeopleControlSet also relies on taskRabbitControl set being added
// that way it can tell if it needs to show task rabbit in the spinner
peopleControlSet = new EditPeopleControlSet(getActivity(), this,
R.layout.control_set_assigned,
R.layout.control_set_default_display,
R.string.actfm_EPA_assign_label_long, REQUEST_LOG_IN);
if(Locale.getDefault().getCountry().equals("US")) { //$NON-NLS-1$
taskRabbitControl = new TaskRabbitControlSet(this, R.layout.control_set_default_display);
controls.add(taskRabbitControl);
peopleControlSet.addListener(taskRabbitControl);
}
controls.add(peopleControlSet);
controlSetMap.put(getString(R.string.TEA_ctrl_who_pref),
peopleControlSet);
RepeatControlSet repeatControls = new RepeatControlSet(getActivity(),
R.layout.control_set_repeat,
R.layout.control_set_repeat_display, R.string.repeat_enabled);
GCalControlSet gcalControl = new GCalControlSet(getActivity(),
R.layout.control_set_gcal, R.layout.control_set_gcal_display,
R.string.gcal_TEA_addToCalendar_label);
// The deadline control set contains the repeat controls and the
// calendar controls.
// NOTE: we add the gcalControl and repeatControl to the list AFTER the
// deadline control, because
// otherwise the correct date may not be written to the calendar event.
// Order matters!
DeadlineControlSet deadlineControl = new DeadlineControlSet(
getActivity(), R.layout.control_set_deadline,
R.layout.control_set_default_display, repeatControls,
repeatControls.getDisplayView(), gcalControl.getDisplayView());
controlSetMap.put(getString(R.string.TEA_ctrl_when_pref),
deadlineControl);
controls.add(deadlineControl);
controls.add(repeatControls);
repeatControls.addListener(editTitle);
controls.add(gcalControl);
ImportanceControlSet importanceControl = new ImportanceControlSet(
getActivity(), R.layout.control_set_importance);
controls.add(importanceControl);
importanceControl.addListener(editTitle);
controlSetMap.put(getString(R.string.TEA_ctrl_importance_pref),
importanceControl);
notesControlSet = new EditNotesControlSet(getActivity(),
R.layout.control_set_notes, R.layout.control_set_notes_display);
notesEditText = (EditText) notesControlSet.getView().findViewById(
R.id.notes);
controls.add(notesControlSet);
controlSetMap.put(getString(R.string.TEA_ctrl_notes_pref),
notesControlSet);
ReminderControlSet reminderControl = new ReminderControlSet(
getActivity(), R.layout.control_set_reminders,
R.layout.control_set_default_display);
controls.add(reminderControl);
controlSetMap.put(getString(R.string.TEA_ctrl_reminders_pref),
reminderControl);
hideUntilControls = new HideUntilControlSet(getActivity(),
R.layout.control_set_hide,
R.layout.control_set_default_display,
R.string.hide_until_prompt);
controls.add(hideUntilControls);
reminderControl.addViewToBody(hideUntilControls.getDisplayView());
// TODO: Fix the fact that hideUntil doesn't update accordingly with date changes when lazy loaded. Until then, don't lazy load.
hideUntilControls.getView();
TimerControlSet timerControl = new TimerControlSet(getActivity(),
R.layout.control_set_timers,
R.layout.control_set_default_display,
R.string.TEA_timer_controls);
timerAction.addListener(timerControl);
controls.add(timerControl);
controlSetMap.put(getString(R.string.TEA_ctrl_timer_pref), timerControl);
try {
if (ProducteevUtilities.INSTANCE.isLoggedIn()) {
ProducteevControlSet producteevControl = new ProducteevControlSet(
getActivity(), R.layout.control_set_producteev,
R.layout.control_set_default_display,
R.string.producteev_TEA_control_set_display);
controls.add(producteevControl);
basicControls.addView(producteevControl.getDisplayView());
notesEditText.setHint(R.string.producteev_TEA_notes);
}
} catch (Exception e) {
Log.e("astrid-error", "loading-control-set", e); //$NON-NLS-1$ //$NON-NLS-2$
}
try {
if (OpencrxCoreUtils.INSTANCE.isLoggedIn()) {
OpencrxControlSet ocrxControl = new OpencrxControlSet(
getActivity(), R.layout.control_set_opencrx,
R.layout.control_set_opencrx_display,
R.string.opencrx_TEA_opencrx_title);
controls.add(ocrxControl);
basicControls.addView(ocrxControl.getDisplayView());
notesEditText.setHint(R.string.opencrx_TEA_notes);
}
} catch (Exception e) {
Log.e("astrid-error", "loading-control-set", e); //$NON-NLS-1$ //$NON-NLS-2$
}
String[] itemOrder;
String orderPreference = Preferences.getStringValue(BeastModePreferences.BEAST_MODE_ORDER_PREF);
if (orderPreference != null)
itemOrder = orderPreference.split(BeastModePreferences.BEAST_MODE_PREF_ITEM_SEPARATOR);
else
itemOrder = getResources().getStringArray(
R.array.TEA_control_sets_prefs);
String moreSectionTrigger = getString(R.string.TEA_ctrl_more_pref);
String shareViewDescriptor = getString(R.string.TEA_ctrl_share_pref);
LinearLayout section = basicControls;
for (int i = 0; i < itemOrder.length; i++) {
String item = itemOrder[i];
if (item.equals(moreSectionTrigger)) {
section = moreControls;
if (taskRabbitControl != null) {
taskRabbitControl.getDisplayView().setVisibility(View.GONE);
section.addView(taskRabbitControl.getDisplayView());
}
} else {
View control_set = null;
TaskEditControlSet curr = controlSetMap.get(item);
if (item.equals(shareViewDescriptor))
control_set = peopleControlSet.getSharedWithRow();
else if (curr != null)
control_set = (LinearLayout) curr.getDisplayView();
if (control_set != null) {
if ((i + 1 >= itemOrder.length || itemOrder[i + 1].equals(moreSectionTrigger))) {
removeTeaSeparator(control_set);
}
section.addView(control_set);
}
}
}
// Load task data in background
new TaskEditBackgroundLoader().start();
}
private void removeTeaSeparator(View view) {
View teaSeparator = view.findViewById(R.id.TEA_Separator);
if (teaSeparator != null) {
teaSeparator.setVisibility(View.GONE);
}
}
private void constructWhenDialog(View whenDialogView) {
int theme = ThemeService.getEditDialogTheme();
whenDialog = new Dialog(getActivity(), theme);
Button dismissDialogButton = (Button) whenDialogView.findViewById(R.id.when_dismiss);
dismissDialogButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DialogUtilities.dismissDialog(getActivity(), whenDialog);
}
});
DisplayMetrics metrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
whenDialog.setTitle(R.string.TEA_when_dialog_title);
whenDialog.addContentView(whenDialogView, new LayoutParams(
metrics.widthPixels - (int) (30 * metrics.density),
LayoutParams.WRAP_CONTENT));
}
/**
* Initialize task edit page in the background
*
* @author Tim Su <[email protected]>
*
*/
private class TaskEditBackgroundLoader extends Thread {
public void onUiThread() {
// prepare and set listener for voice-button
if (getActivity() != null) {
if (addOnService.hasPowerPack()) {
voiceAddNoteButton = (ImageButton) notesControlSet.getView().findViewById(
R.id.voiceAddNoteButton);
voiceAddNoteButton.setVisibility(View.VISIBLE);
int prompt = R.string.voice_edit_note_prompt;
voiceNoteAssistant = new VoiceInputAssistant(TaskEditFragment.this,
voiceAddNoteButton, notesEditText, REQUEST_VOICE_RECOG);
voiceNoteAssistant.setAppend(true);
voiceNoteAssistant.setLanguageModel(RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
voiceNoteAssistant.configureMicrophoneButton(prompt);
}
// re-read all
synchronized (controls) {
for (TaskEditControlSet controlSet : controls)
controlSet.readFromTask(model);
if (isNewTask) {
hideUntilControls.setDefaults();
}
}
loadMoreContainer();
}
}
@Override
public void run() {
AndroidUtilities.sleepDeep(500L);
Activity activity = getActivity();
if (activity == null)
return;
activity.runOnUiThread(new Runnable() {
public void run() {
onUiThread();
}
});
}
}
/*
* ======================================================================
* =============================================== model reading / saving
* ======================================================================
*/
/**
* Loads action item from the given intent
*
* @param intent
*/
@SuppressWarnings("nls")
protected void loadItem(Intent intent) {
if (model != null) {
// came from bundle
setIsNewTask(model.getValue(Task.TITLE).length() == 0);
return;
}
long idParam = intent.getLongExtra(TOKEN_ID, -1L);
if (idParam > -1L) {
model = taskService.fetchById(idParam, Task.PROPERTIES);
if (model != null && model.containsNonNullValue(Task.REMOTE_ID)) {
remoteId = model.getValue(Task.REMOTE_ID);
model.clearValue(Task.REMOTE_ID); // Having this can screw up autosync
}
}
// not found by id or was never passed an id
if (model == null) {
String valuesAsString = intent.getStringExtra(TOKEN_VALUES);
ContentValues values = null;
try {
if (valuesAsString != null)
values = AndroidUtilities.contentValuesFromSerializedString(valuesAsString);
} catch (Exception e) {
// oops, can't serialize
}
model = TaskService.createWithValues(values, null,
taskService, metadataService);
getActivity().getIntent().putExtra(TOKEN_ID, model.getId());
}
if (model.getValue(Task.TITLE).length() == 0) {
StatisticsService.reportEvent(StatisticsConstants.CREATE_TASK);
setIsNewTask(true);
// set deletion date until task gets a title
model.setValue(Task.DELETION_DATE, DateUtilities.now());
} else {
StatisticsService.reportEvent(StatisticsConstants.EDIT_TASK);
}
if (model == null) {
exceptionService.reportError("task-edit-no-task",
new NullPointerException("model"));
getActivity().onBackPressed();
return;
}
// clear notification
Notifications.cancelNotifications(model.getId());
}
private void setIsNewTask(boolean isNewTask) {
this.isNewTask = isNewTask;
if (isNewTask) {
Activity activity = getActivity();
if (activity instanceof TaskEditActivity) {
((TaskEditActivity) activity).updateTitle(isNewTask);
}
}
}
/** Convenience method to populate fields after setting model to null */
public void repopulateFromScratch(Intent intent) {
model = null;
remoteId = 0;
populateFields(intent);
if (webServices != null) {
webServices.setTask(model);
webServices.reset();
}
}
/** Populate UI component values from the model */
public void populateFields(Intent intent) {
loadItem(intent);
synchronized (controls) {
for (TaskEditControlSet controlSet : controls)
controlSet.readFromTask(model);
}
}
/** Populate UI component values from the model */
private void populateFields() {
populateFields(getActivity().getIntent());
}
/** Save task model from values in UI components */
public void save(boolean onPause) {
if (title == null)
return;
if (title.getText().length() > 0)
model.setValue(Task.DELETION_DATE, 0L);
if (title.getText().length() == 0)
return;
StringBuilder toast = new StringBuilder();
synchronized (controls) {
for (TaskEditControlSet controlSet : controls) {
String toastText = controlSet.writeToModel(model);
if (toastText != null)
toast.append('\n').append(toastText);
}
}
String processedToast = addDueTimeToToast(toast.toString());
boolean cancelFinish = peopleControlSet != null
&& !peopleControlSet.saveSharingSettings(processedToast) && !onPause;
boolean tagsChanged = Flags.check(Flags.TAGS_CHANGED);
model.putTransitory("task-edit-save", true); //$NON-NLS-1$
taskService.save(model);
if (!onPause && !cancelFinish) {
boolean taskEditActivity = (getActivity() instanceof TaskEditActivity);
boolean isAssignedToMe = peopleControlSet.isAssignedToMe();
boolean showRepeatAlert = model.getTransitory(TaskService.TRANS_REPEAT_CHANGED) != null
&& !TextUtils.isEmpty(model.getValue(Task.RECURRENCE));
String assignedTo = peopleControlSet.getAssignedToString();
if (taskEditActivity) {
Intent data = new Intent();
if (!isAssignedToMe) {
data.putExtra(TOKEN_TASK_WAS_ASSIGNED, true);
data.putExtra(TOKEN_ASSIGNED_TO,
assignedTo);
}
if (showRepeatAlert) {
data.putExtra(TOKEN_NEW_REPEATING_TASK, model);
}
data.putExtra(TOKEN_TAGS_CHANGED, tagsChanged);
getActivity().setResult(Activity.RESULT_OK, data);
} else {
// Notify task list fragment in multi-column case
// since the activity isn't actually finishing
TaskListActivity tla = (TaskListActivity) getActivity();
if (!isAssignedToMe)
tla.switchToAssignedFilter(assignedTo);
else if (showRepeatAlert)
DateChangedAlerts.showRepeatChangedDialog(tla, model);
if (tagsChanged)
tla.tagsChanged();
tla.refreshTaskList();
}
shouldSaveState = false;
getActivity().onBackPressed();
}
}
public boolean onKeyDown(int keyCode) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (title.getText().length() == 0 || !peopleControlSet.hasLoadedUI())
discardButtonClick();
else
saveButtonClick();
return true;
}
return false;
}
@Override
public void onDetach() {
super.onDetach();
// abandon editing and delete the newly created task if
// no title was entered
if (overrideFinishAnim) {
AndroidUtilities.callOverridePendingTransition(getActivity(),
R.anim.slide_right_in, R.anim.slide_right_out);
}
if (title.getText().length() == 0 && isNewTask
&& model != null && model.isSaved()) {
taskService.delete(model);
}
}
/*
* ======================================================================
* ======================================================= event handlers
* ======================================================================
*/
protected void saveButtonClick() {
save(false);
}
/**
* Displays a Toast reporting that the selected task has been saved and, if
* it has a due date, that is due in 'x' amount of time, to 1 time-unit of
* precision
*
* @param additionalMessage
*/
private String addDueTimeToToast(String additionalMessage) {
int stringResource;
long due = model.getValue(Task.DUE_DATE);
String toastMessage;
if (due != 0) {
stringResource = R.string.TEA_onTaskSave_due;
CharSequence formattedDate = DateUtilities.getRelativeDay(
getActivity(), due);
toastMessage = getString(stringResource, formattedDate);
} else {
toastMessage = getString(R.string.TEA_onTaskSave_notDue);
}
return toastMessage + additionalMessage;
}
protected void discardButtonClick() {
shouldSaveState = false;
// abandon editing in this case
if (title.getText().length() == 0
|| TextUtils.isEmpty(model.getValue(Task.TITLE))) {
if (isNewTask)
taskService.delete(model);
}
showCancelToast();
getActivity().onBackPressed();
}
/**
* Show toast for task edit canceling
*/
private void showCancelToast() {
Toast.makeText(getActivity(), R.string.TEA_onTaskCancel,
Toast.LENGTH_SHORT).show();
}
protected void deleteButtonClick() {
new AlertDialog.Builder(getActivity()).setTitle(
R.string.DLG_confirm_title).setMessage(
R.string.DLG_delete_this_task_question).setIcon(
android.R.drawable.ic_dialog_alert).setPositiveButton(
android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
taskService.delete(model);
shouldSaveState = false;
showDeleteToast();
getActivity().setResult(Activity.RESULT_OK);
getActivity().onBackPressed();
}
}).setNegativeButton(android.R.string.cancel, null).show();
}
/**
* Show toast for task edit deleting
*/
private void showDeleteToast() {
Toast.makeText(getActivity(), R.string.TEA_onTaskDelete,
Toast.LENGTH_SHORT).show();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case MENU_SAVE_ID:
saveButtonClick();
return true;
case MENU_DISCARD_ID:
discardButtonClick();
return true;
case MENU_DELETE_ID:
deleteButtonClick();
return true;
case MENU_COMMENTS_REFRESH_ID: {
editNotes.refreshData(true, null);
return true;
}
case android.R.id.home:
if (title.getText().length() == 0)
discardButtonClick();
else
saveButtonClick();
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
MenuItem item;
AstridActivity activity = (AstridActivity) getActivity();
if (activity instanceof TaskListActivity && activity.fragmentLayout != AstridActivity.LAYOUT_DOUBLE || activity instanceof TaskEditActivity) {
item = menu.add(Menu.NONE, MENU_DISCARD_ID, 0, R.string.TEA_menu_discard);
item.setIcon(android.R.drawable.ic_menu_close_clear_cancel);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
item = menu.add(Menu.NONE, MENU_SAVE_ID, 0, R.string.TEA_menu_save);
item.setIcon(android.R.drawable.ic_menu_save);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
}
item = menu.add(Menu.NONE, MENU_DELETE_ID, 0, R.string.TEA_menu_delete);
item.setIcon(android.R.drawable.ic_menu_delete);
if (((AstridActivity) getActivity()).getFragmentLayout() != AstridActivity.LAYOUT_SINGLE)
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
}
@Override
public void onPrepareOptionsMenu (Menu menu) {
if(actFmPreferenceService.isLoggedIn() && remoteId > 0 && menu.findItem(MENU_COMMENTS_REFRESH_ID) == null) {
MenuItem item = menu.add(Menu.NONE, MENU_COMMENTS_REFRESH_ID, Menu.NONE,
R.string.ENA_refresh_comments);
item.setIcon(R.drawable.icn_menu_refresh_dark);
}
super.onPrepareOptionsMenu(menu);
}
@Override
public void onPause() {
super.onPause();
StatisticsService.sessionPause();
if (shouldSaveState)
save(true);
}
@Override
public void onResume() {
super.onResume();
StatisticsService.sessionStart(getActivity());
populateFields();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (taskRabbitControl != null && taskRabbitControl.activityResult(requestCode, resultCode, data)) {
return;
}
else if (editNotes != null && editNotes.activityResult(requestCode, resultCode, data)) {
return;
}
else if (requestCode == REQUEST_VOICE_RECOG
&& resultCode == Activity.RESULT_OK) {
// handle the result of voice recognition, put it into the
// appropiate textfield
voiceNoteAssistant.handleActivityResult(requestCode, resultCode,
data);
// write the voicenote into the model, or it will be deleted by
// onResume.populateFields
// (due to the activity-change)
notesControlSet.writeToModel(model);
}
// respond to sharing logoin
peopleControlSet.onActivityResult(requestCode, resultCode, data);
super.onActivityResult(requestCode, resultCode, data);
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
// stick our task into the outState
outState.putParcelable(TASK_IN_PROGRESS, model);
outState.putLong(TASK_REMOTE_ID, remoteId);
}
@Override
public void onStart() {
super.onStart();
}
@Override
public void onStop() {
super.onStop();
StatisticsService.sessionStop(getActivity());
}
private void adjustInfoPopovers() {
Preferences.setBoolean(R.string.p_showed_tap_task_help, true);
if (!Preferences.isSet(getString(R.string.p_showed_lists_help)))
Preferences.setBoolean(R.string.p_showed_lists_help, false);
}
/*
* ======================================================================
* ========================================== UI component helper classes
* ======================================================================
*/
@SuppressWarnings("nls")
public int getTabForPosition(int position) {
if ((tabStyle == TAB_STYLE_WEB && position == 0) ||
(tabStyle != TAB_STYLE_WEB && position == 1))
return TAB_VIEW_MORE;
else if (tabStyle != TAB_STYLE_WEB && position == 0)
return TAB_VIEW_UPDATES;
else if((tabStyle == TAB_STYLE_WEB && position == 1) ||
(tabStyle == TAB_STYLE_ACTIVITY_WEB && position == 2))
return TAB_VIEW_WEB_SERVICES;
throw new RuntimeException("Error - requested position " + position
+ ", tab style " + tabStyle);
}
/**
* Returns the correct view for TaskEditViewPager
*
* @param position
* in the horizontal scroll view
*/
public View getPageView(int position) {
switch(getTabForPosition(position)) {
case TAB_VIEW_MORE:
moreControls.setLayoutParams(mPager.getLayoutParams());
setViewHeightBasedOnChildren(moreControls);
return moreControls;
case TAB_VIEW_UPDATES:
return editNotes;
case TAB_VIEW_WEB_SERVICES:
return webServices;
}
return null;
}
private void setPagerHeightForPosition(int position) {
int height = 0;
View view = null;
switch(getTabForPosition(position)) {
case TAB_VIEW_MORE:
view = moreControls;
break;
case TAB_VIEW_UPDATES:
view = editNotes;
break;
case TAB_VIEW_WEB_SERVICES:
view = webServices;
}
if (view == null || mPager == null) return;
int desiredWidth = MeasureSpec.makeMeasureSpec(view.getWidth(),
MeasureSpec.AT_MOST);
view.measure(desiredWidth, MeasureSpec.UNSPECIFIED);
height = Math.max(view.getMeasuredHeight(), height);
LayoutParams pagerParams = mPager.getLayoutParams();
if (position == 0 && height < pagerParams.height)
return;
if (height > 0 && height != pagerParams.height) {
pagerParams.height = height;
mPager.setLayoutParams(pagerParams);
}
}
public static void setViewHeightBasedOnChildren(LinearLayout view) {
int totalHeight = 0;
int desiredWidth = MeasureSpec.makeMeasureSpec(view.getWidth(),
MeasureSpec.AT_MOST);
for (int i = 0; i < view.getChildCount(); i++) {
View listItem = view.getChildAt(i);
listItem.measure(desiredWidth, MeasureSpec.UNSPECIFIED);
totalHeight += listItem.getMeasuredHeight();
}
ViewGroup.LayoutParams params = view.getLayoutParams();
if(params == null)
return;
params.height = totalHeight;
view.setLayoutParams(params);
view.requestLayout();
}
// Tab Page listener when page/tab changes
@Override
public void onPageScrolled(int position, float positionOffset,
int positionOffsetPixels) {
return;
}
@Override
public void onPageSelected(final int position) {
final Runnable onPageSelected = new Runnable() {
@Override
public void run() {
setPagerHeightForPosition(position);
NestableScrollView scrollView = (NestableScrollView)getView().findViewById(R.id.edit_scroll);
if((tabStyle == TAB_STYLE_WEB && position == 1) ||
(tabStyle == TAB_STYLE_ACTIVITY_WEB && position == 2))
scrollView.
setScrollabelViews(webServices.getScrollableViews());
else
scrollView.setScrollabelViews(null);
}
};
if(getTabForPosition(position) == TAB_VIEW_WEB_SERVICES)
webServices.onPageSelected(new Runnable() {
@Override
public void run() {
onPageSelected.run();
}
});
else
onPageSelected.run();
}
@Override
public void onPageScrollStateChanged(int state) {
return;
}
// EditNoteActivity Listener when there are new updates/comments
@Override
public void updatesChanged() {
setCurrentTab(TAB_VIEW_UPDATES);
this.setPagerHeightForPosition(TAB_VIEW_UPDATES);
}
// EditNoteActivity Lisener when there are new updates/comments
@Override
public void commentAdded() {
this.scrollToView(editNotes);
}
// Scroll to view in edit task
public void scrollToView(View v) {
View child = v;
ScrollView scrollView = (ScrollView) getView().findViewById(R.id.edit_scroll);
int top = v.getTop();
while (!child.equals(scrollView) ) {
top += child.getTop();
ViewParent parentView = child.getParent();
if (parentView != null && View.class.isInstance(parentView)) {
child = (View) parentView;
}
else {
break;
}
}
scrollView.smoothScrollTo(0, top);
}
}
|
[
"[email protected]"
] | |
7370b08a976c3c741d836c56c6b7cf18d2bf1ee7
|
f1c7b36707f3c645df8aa867cca973c57dd051b8
|
/practica3/src/test/java/com/alvaroagea/elk/practica3/ControllerTest.java
|
31fdf0b29fb5004d2a44b31c3e2c6d123b554aed
|
[
"MIT"
] |
permissive
|
aagea/elk-bootcamp-esp
|
841bba079f9c10e7c881d2895843701fdd755763
|
149957e5861df8a6039ab1d384bc8f064d77e3e0
|
refs/heads/master
| 2022-02-02T05:55:08.815980 | 2022-01-22T14:37:29 | 2022-01-22T14:37:29 | 154,993,476 | 2 | 4 |
MIT
| 2022-01-15T09:50:44 | 2018-10-27T17:55:33 |
Java
|
UTF-8
|
Java
| false | false | 1,786 |
java
|
package com.alvaroagea.elk.practica3;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.IOException;
import java.time.Instant;
import java.util.List;
public class ControllerTest {
private static int NUM_ITERATION =10;
private static Controller controller = new Practica3Controller();
@BeforeClass
public static void tearUp() throws IOException, InterruptedException {
controller.init();
Message msg1 = new Message(Instant.now(), "aagea", "esto es una prueba");
Message msg2 = new Message(Instant.now(), "pepe", "cambiemos de tema");
controller.index(msg1);
controller.index(msg2);
controller.flush();
for (int i = 0; i < NUM_ITERATION && controller.count() != 2; i++) {
Thread.sleep(1000);
}
}
@AfterClass
public static void tearDown() throws IOException {
controller.reset();
controller.close();
}
@Test
public void createIndexTwoTimes() throws IOException {
controller.init();
}
@Test
public void termTest() throws IOException {
List<Message> messages = controller.searchAuthor("aagea");
Assert.assertNotNull(messages);
Assert.assertEquals(1, messages.size());
}
@Test
public void wildcardTest() throws IOException {
List<Message> messages = controller.searchAuthor("pe*");
Assert.assertNotNull(messages);
Assert.assertEquals(1, messages.size());
}
@Test
public void matchTest() throws IOException {
List<Message> messages = controller.searchMessage("prueba");
Assert.assertNotNull(messages);
Assert.assertEquals(1, messages.size());
}
}
|
[
"[email protected]"
] | |
1718b970f67a79f0437e06a530367ad6ea9d4b9f
|
062fa4f7f890198a53ad03ee849c10b4a0cc8826
|
/classes-dex2jar_source_from_jdcore/android/support/v7/widget/w.java
|
a3faaa0e5e207801b81221283431f9fea2e0aad1
|
[] |
no_license
|
Biu-G/combostuck
|
e721e24015379f6bfa4f4222ff49a5826e5b1991
|
57fed26a45e238f36ba056b3960ff05f882eb55f
|
refs/heads/master
| 2020-07-03T21:30:07.489769 | 2019-11-06T17:27:47 | 2019-11-06T17:27:47 | 202,056,117 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 7,891 |
java
|
package android.support.v7.widget;
import android.content.res.AssetFileDescriptor;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.Resources.NotFoundException;
import android.content.res.Resources.Theme;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.graphics.Movie;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.RequiresApi;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import java.io.IOException;
import java.io.InputStream;
import org.xmlpull.v1.XmlPullParserException;
class w
extends Resources
{
private final Resources a;
public w(Resources paramResources)
{
super(paramResources.getAssets(), paramResources.getDisplayMetrics(), paramResources.getConfiguration());
a = paramResources;
}
public XmlResourceParser getAnimation(int paramInt)
throws Resources.NotFoundException
{
return a.getAnimation(paramInt);
}
public boolean getBoolean(int paramInt)
throws Resources.NotFoundException
{
return a.getBoolean(paramInt);
}
public int getColor(int paramInt)
throws Resources.NotFoundException
{
return a.getColor(paramInt);
}
public ColorStateList getColorStateList(int paramInt)
throws Resources.NotFoundException
{
return a.getColorStateList(paramInt);
}
public Configuration getConfiguration()
{
return a.getConfiguration();
}
public float getDimension(int paramInt)
throws Resources.NotFoundException
{
return a.getDimension(paramInt);
}
public int getDimensionPixelOffset(int paramInt)
throws Resources.NotFoundException
{
return a.getDimensionPixelOffset(paramInt);
}
public int getDimensionPixelSize(int paramInt)
throws Resources.NotFoundException
{
return a.getDimensionPixelSize(paramInt);
}
public DisplayMetrics getDisplayMetrics()
{
return a.getDisplayMetrics();
}
public Drawable getDrawable(int paramInt)
throws Resources.NotFoundException
{
return a.getDrawable(paramInt);
}
@RequiresApi(21)
public Drawable getDrawable(int paramInt, Resources.Theme paramTheme)
throws Resources.NotFoundException
{
return a.getDrawable(paramInt, paramTheme);
}
@RequiresApi(15)
public Drawable getDrawableForDensity(int paramInt1, int paramInt2)
throws Resources.NotFoundException
{
return a.getDrawableForDensity(paramInt1, paramInt2);
}
@RequiresApi(21)
public Drawable getDrawableForDensity(int paramInt1, int paramInt2, Resources.Theme paramTheme)
{
return a.getDrawableForDensity(paramInt1, paramInt2, paramTheme);
}
public float getFraction(int paramInt1, int paramInt2, int paramInt3)
{
return a.getFraction(paramInt1, paramInt2, paramInt3);
}
public int getIdentifier(String paramString1, String paramString2, String paramString3)
{
return a.getIdentifier(paramString1, paramString2, paramString3);
}
public int[] getIntArray(int paramInt)
throws Resources.NotFoundException
{
return a.getIntArray(paramInt);
}
public int getInteger(int paramInt)
throws Resources.NotFoundException
{
return a.getInteger(paramInt);
}
public XmlResourceParser getLayout(int paramInt)
throws Resources.NotFoundException
{
return a.getLayout(paramInt);
}
public Movie getMovie(int paramInt)
throws Resources.NotFoundException
{
return a.getMovie(paramInt);
}
public String getQuantityString(int paramInt1, int paramInt2)
throws Resources.NotFoundException
{
return a.getQuantityString(paramInt1, paramInt2);
}
public String getQuantityString(int paramInt1, int paramInt2, Object... paramVarArgs)
throws Resources.NotFoundException
{
return a.getQuantityString(paramInt1, paramInt2, paramVarArgs);
}
public CharSequence getQuantityText(int paramInt1, int paramInt2)
throws Resources.NotFoundException
{
return a.getQuantityText(paramInt1, paramInt2);
}
public String getResourceEntryName(int paramInt)
throws Resources.NotFoundException
{
return a.getResourceEntryName(paramInt);
}
public String getResourceName(int paramInt)
throws Resources.NotFoundException
{
return a.getResourceName(paramInt);
}
public String getResourcePackageName(int paramInt)
throws Resources.NotFoundException
{
return a.getResourcePackageName(paramInt);
}
public String getResourceTypeName(int paramInt)
throws Resources.NotFoundException
{
return a.getResourceTypeName(paramInt);
}
public String getString(int paramInt)
throws Resources.NotFoundException
{
return a.getString(paramInt);
}
public String getString(int paramInt, Object... paramVarArgs)
throws Resources.NotFoundException
{
return a.getString(paramInt, paramVarArgs);
}
public String[] getStringArray(int paramInt)
throws Resources.NotFoundException
{
return a.getStringArray(paramInt);
}
public CharSequence getText(int paramInt)
throws Resources.NotFoundException
{
return a.getText(paramInt);
}
public CharSequence getText(int paramInt, CharSequence paramCharSequence)
{
return a.getText(paramInt, paramCharSequence);
}
public CharSequence[] getTextArray(int paramInt)
throws Resources.NotFoundException
{
return a.getTextArray(paramInt);
}
public void getValue(int paramInt, TypedValue paramTypedValue, boolean paramBoolean)
throws Resources.NotFoundException
{
a.getValue(paramInt, paramTypedValue, paramBoolean);
}
public void getValue(String paramString, TypedValue paramTypedValue, boolean paramBoolean)
throws Resources.NotFoundException
{
a.getValue(paramString, paramTypedValue, paramBoolean);
}
@RequiresApi(15)
public void getValueForDensity(int paramInt1, int paramInt2, TypedValue paramTypedValue, boolean paramBoolean)
throws Resources.NotFoundException
{
a.getValueForDensity(paramInt1, paramInt2, paramTypedValue, paramBoolean);
}
public XmlResourceParser getXml(int paramInt)
throws Resources.NotFoundException
{
return a.getXml(paramInt);
}
public TypedArray obtainAttributes(AttributeSet paramAttributeSet, int[] paramArrayOfInt)
{
return a.obtainAttributes(paramAttributeSet, paramArrayOfInt);
}
public TypedArray obtainTypedArray(int paramInt)
throws Resources.NotFoundException
{
return a.obtainTypedArray(paramInt);
}
public InputStream openRawResource(int paramInt)
throws Resources.NotFoundException
{
return a.openRawResource(paramInt);
}
public InputStream openRawResource(int paramInt, TypedValue paramTypedValue)
throws Resources.NotFoundException
{
return a.openRawResource(paramInt, paramTypedValue);
}
public AssetFileDescriptor openRawResourceFd(int paramInt)
throws Resources.NotFoundException
{
return a.openRawResourceFd(paramInt);
}
public void parseBundleExtra(String paramString, AttributeSet paramAttributeSet, Bundle paramBundle)
throws XmlPullParserException
{
a.parseBundleExtra(paramString, paramAttributeSet, paramBundle);
}
public void parseBundleExtras(XmlResourceParser paramXmlResourceParser, Bundle paramBundle)
throws XmlPullParserException, IOException
{
a.parseBundleExtras(paramXmlResourceParser, paramBundle);
}
public void updateConfiguration(Configuration paramConfiguration, DisplayMetrics paramDisplayMetrics)
{
super.updateConfiguration(paramConfiguration, paramDisplayMetrics);
if (a != null) {
a.updateConfiguration(paramConfiguration, paramDisplayMetrics);
}
}
}
|
[
"[email protected]"
] | |
0071bf15061c197780345055528665063d4c97e2
|
97202903406ad405a8b119b07512323ad78de60a
|
/SPRING CORE/src/main/java/com/ustglobal/springcore/config/ComponenetScanConfiguration.java
|
998a7088fddba90cdf26474500f539f3d8b1b2ef
|
[] |
no_license
|
jison555/USTGlobal-16Sep19-JISON-JAMES
|
e6e87172cece7f56c876f15c92300e9901db4e86
|
10a034ca6869841e1fdf3319403cc26a3e7cf00c
|
refs/heads/master
| 2023-01-09T00:08:29.877982 | 2019-12-21T13:51:29 | 2019-12-21T13:51:29 | 215,541,974 | 0 | 0 | null | 2023-01-07T13:04:17 | 2019-10-16T12:24:06 |
CSS
|
UTF-8
|
Java
| false | false | 288 |
java
|
package com.ustglobal.springcore.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan(basePackages = "com.ustglobal.springcore.di")
public class ComponenetScanConfiguration {
}
|
[
"[email protected]"
] | |
07ae87a9fee525ea4050dd772c79abb4a401bb7b
|
ac2544cbd0103d73dd90af46f5740765e55e7ee5
|
/shop_product/src/main/java/com/product/service/ProductServiceImpl.java
|
b08ed31197a0053ba19509d7f452ed0aa0690df9
|
[] |
no_license
|
artem-kurilko/ShopManagement
|
37a4dd99c51e62d848fa28d9714a76e35ccd4c4d
|
402e26e5d892a2b980d486dcd391bb7e9a1b9c5f
|
refs/heads/master
| 2020-12-27T10:00:18.189162 | 2020-07-02T07:08:46 | 2020-07-02T07:08:46 | 237,682,039 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,058 |
java
|
package com.product.service;
import com.product.model.Product;
import com.product.repository.CategoryIdRepository;
import com.product.repository.ProductRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigInteger;
import java.util.List;
/**
* Implementation of {@link ProductService} interface
*/
@Service
public class ProductServiceImpl implements ProductService {
@Autowired
ProductRepository productRepository;
@Autowired
CategoryIdRepository categoryIdRepository;
@Override
public Product getById(BigInteger _id) {
return productRepository.findOne(_id);
}
@Override
public void save(Product product) {
productRepository.save(product);
}
@Override
public List<Product> getAll(){
return productRepository.findAll();
}
@Override
public List<Long> getAllCategoryIds() {
return categoryIdRepository.findAllId();
}
}
|
[
"[email protected]"
] | |
06c7a20b9848806f73dbde805abd7d8e25f3b518
|
8604ea6d95047b4276af06e0d455e20af16a6f88
|
/weblayer/browser/java/org/chromium/weblayer_private/BrowserControlsContainerView.java
|
f79d90b9a99a0226cb4f8d30ddb8c52df953e6a9
|
[
"BSD-3-Clause"
] |
permissive
|
arottigni-te/chromium
|
210210fd3b7cea134bb9c341f71d53c9d5f6cdcc
|
af953eefa9e19603dc76b81491a2325a09f4ba2f
|
refs/heads/master
| 2023-01-06T08:23:13.456199 | 2020-05-05T07:01:09 | 2020-05-05T07:01:09 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 16,914 |
java
|
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.weblayer_private;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Rect;
import android.view.View;
import android.view.ViewParent;
import android.widget.FrameLayout;
import org.chromium.base.MathUtils;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.base.annotations.NativeMethods;
import org.chromium.content_public.browser.WebContents;
import org.chromium.ui.base.EventOffsetHandler;
import org.chromium.ui.resources.dynamics.ViewResourceAdapter;
/**
* BrowserControlsContainerView is responsible for positioning and sizing a view from the client
* that is anchored to the top or bottom of a Browser. BrowserControlsContainerView, uses
* ViewResourceAdapter that is kept in sync with the contents of the view. ViewResourceAdapter is
* used to keep a bitmap in sync with the contents of the view. The bitmap is placed in a cc::Layer
* and the layer is shown while scrolling. ViewResourceAdapter is always kept in sync, as to do
* otherwise results in a noticeable delay between when the scroll starts the content is available.
*
* There are many parts involved in orchestrating scrolling. The key things to know are:
* . BrowserControlsContainerView (in native code) keeps a cc::Layer that shows a bitmap rendered by
* the view. The bitmap is updated anytime the view changes. This is done as otherwise there is a
* noticeable delay between when the scroll starts and the bitmap is available.
* . When scrolling, the cc::Layer for the WebContents and BrowserControlsContainerView is moved.
* . The size of the WebContents is only changed after the user releases a touch point. Otherwise
* the scrollbar bounces around.
* . WebContentsDelegate::DoBrowserControlsShrinkRendererSize() only changes when the WebContents
* size change.
* . WebContentsGestureStateTracker is responsible for determining when a scroll/touch is underway.
* . ContentViewRenderView.Delegate is used to adjust the size of the webcontents when the
* controls are fully visible (and a scroll is not underway).
*
* The flow of this code is roughly:
* . WebContentsGestureStateTracker generally detects a touch first
* . TabImpl is notified and caches state.
* . onTop/BottomControlsChanged() is called. This triggers hiding the real view and calling to
* native code to move the cc::Layers.
* . the move continues.
* . when the move completes and both WebContentsGestureStateTracker and
* BrowserControlsContainerView no longer believe a move/gesture/scroll is underway the size of the
* WebContents is adjusted (if necessary).
*/
@JNINamespace("weblayer")
class BrowserControlsContainerView extends FrameLayout {
// ID used with ViewResourceAdapter.
private static final int TOP_CONTROLS_ID = 1001;
private static final int BOTTOM_CONTROLS_ID = 1002;
private static final long SYSTEM_UI_VIEWPORT_UPDATE_DELAY_MS = 500;
private final boolean mIsTop;
private long mNativeBrowserControlsContainerView;
private ViewResourceAdapter mViewResourceAdapter;
// Last width/height of mView as sent to the native side.
private int mLastWidth;
private int mLastHeight;
// view from the client.
private View mView;
private ContentViewRenderView mContentViewRenderView;
private WebContents mWebContents;
// Only created when hosting top-controls.
private EventOffsetHandler mEventOffsetHandler;
// Amount page content is offset along the y-axis. This is always 0 for bottom controls (because
// bottom controls don't offset content). For top controls, a value of 0 means no offset, and
// positive values indicate a portion of the top-control is shown. This value never goes
// negative.
private int mContentOffset;
// Amount the control is offset along the y-axis from it's fully shown position. For
// top-controls, the value ranges from 0 (completely shown) to -height (completely hidden). For
// bottom-controls, the value ranges from 0 (completely shown) to height (completely hidden).
private int mControlsOffset;
// Set to true if |mView| is hidden because the user has scrolled or triggered some action such
// that mView is not visible. While |mView| is not visible if this is true, the bitmap from
// |mView| may be partially visible.
private boolean mInScroll;
private boolean mIsFullscreen;
// Used to delay processing fullscreen requests.
private Runnable mSystemUiFullscreenResizeRunnable;
private final Listener mListener;
public interface Listener {
/**
* Called when the browser-controls are either completely showing, or completely hiding.
*/
public void onBrowserControlsCompletelyShownOrHidden();
}
// Used to delay updating the image for the layer.
private final Runnable mRefreshResourceIdRunnable = () -> {
if (mView == null) return;
BrowserControlsContainerViewJni.get().updateControlsResource(
mNativeBrowserControlsContainerView);
};
BrowserControlsContainerView(Context context, ContentViewRenderView contentViewRenderView,
Listener listener, boolean isTop) {
super(context);
mIsTop = isTop;
mContentViewRenderView = contentViewRenderView;
mNativeBrowserControlsContainerView =
BrowserControlsContainerViewJni.get().createBrowserControlsContainerView(
this, contentViewRenderView.getNativeHandle());
mListener = listener;
}
public void setWebContents(WebContents webContents) {
mWebContents = webContents;
BrowserControlsContainerViewJni.get().setWebContents(
mNativeBrowserControlsContainerView, webContents);
if (mWebContents == null) return;
if (mSystemUiFullscreenResizeRunnable != null) {
removeCallbacks(mSystemUiFullscreenResizeRunnable);
}
processFullscreenChanged(mWebContents.isFullscreenForCurrentTab());
}
public void destroy() {
clearViewAndDestroyResources();
BrowserControlsContainerViewJni.get().deleteBrowserControlsContainerView(
mNativeBrowserControlsContainerView);
if (mSystemUiFullscreenResizeRunnable != null) {
removeCallbacks(mSystemUiFullscreenResizeRunnable);
mSystemUiFullscreenResizeRunnable = null;
}
}
public long getNativeHandle() {
return mNativeBrowserControlsContainerView;
}
public EventOffsetHandler getEventOffsetHandler() {
assert mIsTop;
if (mEventOffsetHandler == null) {
mEventOffsetHandler =
new EventOffsetHandler(new EventOffsetHandler.EventOffsetHandlerDelegate() {
@Override
public float getTop() {
return mContentOffset;
}
@Override
public void setCurrentTouchEventOffsets(float top) {
if (mWebContents != null) {
mWebContents.getEventForwarder().setCurrentTouchEventOffsets(
0, top);
}
}
});
}
return mEventOffsetHandler;
}
/**
* Returns the amount of vertical space to take away from the contents.
*/
public int getContentHeightDelta() {
if (mView == null) return 0;
return mIsTop ? mContentOffset : getHeight() - mControlsOffset;
}
/**
* Returns true if the browser control is visible to the user.
*/
public boolean isControlVisible() {
// Don't check the visibility of the View itself as it's hidden while scrolling.
return mView != null && Math.abs(mControlsOffset) != getHeight();
}
/**
* Returns true if the controls are completely shown or completely hidden. A return value
* of false indicates the controls are being moved.
*/
public boolean isCompletelyShownOrHidden() {
return mControlsOffset == 0 || Math.abs(mControlsOffset) == getHeight();
}
/**
* Sets the view from the client.
*/
public void setView(View view) {
if (mView == view) return;
clearViewAndDestroyResources();
mView = view;
if (mView == null) {
setControlsOffset(0, 0);
return;
}
addView(view,
new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.UNSPECIFIED_GRAVITY));
if (getWidth() > 0 && getHeight() > 0) {
view.layout(0, 0, getWidth(), getHeight());
createAdapterAndLayer();
}
if (mIsFullscreen) hideControls();
}
/**
* Does cleanup necessary when mView is to be removed.
* In general prefer calling setView(). This is really an implementation detail of setView()
* and destroy().
*/
private void clearViewAndDestroyResources() {
if (mView == null) return;
if (mView.getParent() == this) removeView(mView);
// TODO: need some sort of destroy to drop reference.
mViewResourceAdapter = null;
BrowserControlsContainerViewJni.get().deleteControlsLayer(
mNativeBrowserControlsContainerView);
mContentViewRenderView.getResourceManager().getDynamicResourceLoader().unregisterResource(
getResourceId());
mView = null;
}
public View getView() {
return mView;
}
/**
* Called from ViewAndroidDelegate, see it for details.
*/
public void onOffsetsChanged(int controlsOffsetY, int contentOffsetY) {
if (mView == null) return;
if (mIsFullscreen) return;
if (controlsOffsetY == 0) {
finishScroll(contentOffsetY);
return;
}
if (!mInScroll) prepareForScroll();
setControlsOffset(controlsOffsetY, contentOffsetY);
}
@SuppressLint("NewApi") // Used on O+, invalidateChildInParent used for previous versions.
@Override
public void onDescendantInvalidated(View child, View target) {
super.onDescendantInvalidated(child, target);
invalidateViewResourceAdapter();
}
@Override
public ViewParent invalidateChildInParent(int[] location, Rect dirty) {
invalidateViewResourceAdapter();
return super.invalidateChildInParent(location, dirty);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
if (mView == null) return;
int width = right - left;
int height = bottom - top;
if (height != mLastHeight || width != mLastWidth) {
mLastWidth = width;
mLastHeight = height;
if (mLastWidth > 0 && mLastHeight > 0) {
if (mViewResourceAdapter == null) {
createAdapterAndLayer();
} else {
BrowserControlsContainerViewJni.get().setControlsSize(
mNativeBrowserControlsContainerView, mLastWidth, mLastHeight);
}
}
}
}
/**
* Triggers copying the contents of mView to the offscreen buffer.
*/
private void invalidateViewResourceAdapter() {
if (mViewResourceAdapter == null || mView.getVisibility() != View.VISIBLE) return;
mViewResourceAdapter.invalidate(null);
removeCallbacks(mRefreshResourceIdRunnable);
postOnAnimation(mRefreshResourceIdRunnable);
}
/**
* Creates mViewResourceAdapter and the layer showing a copy of mView.
*/
private void createAdapterAndLayer() {
assert mViewResourceAdapter == null;
assert mView != null;
mViewResourceAdapter = new ViewResourceAdapter(mView);
mContentViewRenderView.getResourceManager().getDynamicResourceLoader().registerResource(
getResourceId(), mViewResourceAdapter);
// It's important that the layer is created immediately and always kept in sync with the
// View. Creating the layer only when needed results in a noticeable delay between when
// the layer is created and actually shown. Chrome for Android does the same thing.
BrowserControlsContainerViewJni.get().createControlsLayer(
mNativeBrowserControlsContainerView, getResourceId());
mLastWidth = getWidth();
mLastHeight = getHeight();
BrowserControlsContainerViewJni.get().setControlsSize(
mNativeBrowserControlsContainerView, mLastWidth, mLastHeight);
if (mIsFullscreen) {
setFullscreenControlsOffset();
} else {
setControlsOffset(0, mLastHeight);
}
}
private void finishScroll(int contentOffsetY) {
mInScroll = false;
setControlsOffset(0, contentOffsetY);
mContentViewRenderView.postOnAnimation(() -> showControls());
}
private void setControlsOffset(int controlsOffsetY, int contentOffsetY) {
// This function is called asynchronously from the gpu, and may be out of sync with the
// current values.
if (mIsTop) {
mControlsOffset = MathUtils.clamp(controlsOffsetY, -getHeight(), 0);
} else {
mControlsOffset = MathUtils.clamp(controlsOffsetY, 0, getHeight());
}
mContentOffset = MathUtils.clamp(contentOffsetY, 0, getHeight());
if (isCompletelyShownOrHidden()) {
mListener.onBrowserControlsCompletelyShownOrHidden();
}
if (mIsTop) {
BrowserControlsContainerViewJni.get().setTopControlsOffset(
mNativeBrowserControlsContainerView, mControlsOffset, mContentOffset);
} else {
BrowserControlsContainerViewJni.get().setBottomControlsOffset(
mNativeBrowserControlsContainerView, mControlsOffset);
}
}
private void prepareForScroll() {
mInScroll = true;
mContentViewRenderView.postOnAnimation(() -> hideControls());
}
private void hideControls() {
if (mView != null) mView.setVisibility(View.INVISIBLE);
}
private void showControls() {
if (mView != null) mView.setVisibility(View.VISIBLE);
}
@CalledByNative
private void didToggleFullscreenModeForTab(final boolean isFullscreen) {
// Delay hiding until after the animation. This comes from Chrome code.
if (mSystemUiFullscreenResizeRunnable != null) {
removeCallbacks(mSystemUiFullscreenResizeRunnable);
}
mSystemUiFullscreenResizeRunnable = () -> processFullscreenChanged(isFullscreen);
long delay = isFullscreen ? SYSTEM_UI_VIEWPORT_UPDATE_DELAY_MS : 0;
postDelayed(mSystemUiFullscreenResizeRunnable, delay);
}
private void processFullscreenChanged(boolean isFullscreen) {
mSystemUiFullscreenResizeRunnable = null;
if (mIsFullscreen == isFullscreen) return;
mIsFullscreen = isFullscreen;
if (mIsFullscreen) {
hideControls();
setFullscreenControlsOffset();
} else {
showControls();
setControlsOffset(0, mIsTop ? mLastHeight : 0);
}
}
private void setFullscreenControlsOffset() {
assert mIsFullscreen;
setControlsOffset(mIsTop ? -mLastHeight : mLastHeight, 0);
}
private int getResourceId() {
return mIsTop ? TOP_CONTROLS_ID : BOTTOM_CONTROLS_ID;
}
@NativeMethods
interface Natives {
long createBrowserControlsContainerView(
BrowserControlsContainerView view, long nativeContentViewRenderView);
void deleteBrowserControlsContainerView(long nativeBrowserControlsContainerView);
void createControlsLayer(long nativeBrowserControlsContainerView, int id);
void deleteControlsLayer(long nativeBrowserControlsContainerView);
void setTopControlsOffset(
long nativeBrowserControlsContainerView, int controlsOffsetY, int contentOffsetY);
void setBottomControlsOffset(long nativeBrowserControlsContainerView, int controlsOffsetY);
void setControlsSize(long nativeBrowserControlsContainerView, int width, int height);
void updateControlsResource(long nativeBrowserControlsContainerView);
void setWebContents(long nativeBrowserControlsContainerView, WebContents webContents);
}
}
|
[
"[email protected]"
] | |
08c69fb55f1d204a54b1973fd8804a0fac20ea2f
|
a842bbccbdd815cd62df3d2c774a9dc8d19fec53
|
/Tic-Tac-Toe.java
|
b69bf71a3779f46aec78781864dbc2ff1d14498d
|
[] |
no_license
|
Nirmit1910/Tic-Tac-Toe
|
a6d6796bba1703e36a7455501311ce4f3fbbb430
|
96c3cff0b135d2a3259db9dbea59573455a8d587
|
refs/heads/main
| 2023-07-17T22:02:04.219975 | 2021-09-04T13:37:26 | 2021-09-04T13:37:26 | 403,064,688 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,301 |
java
|
import java.util.*;
public class Main {
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
String s=sc.nextLine();
s=s.trim();
System.out.println("---------");
int p=0,c1=0,c2=0,c3=0;
for(int i=1;i<=3;i++)
{
System.out.print ("| ");
String k= s.substring(p,p+3);
for(int j=0;j<3;j++)
{
System.out.print(k.charAt(j)+" ");
}
System.out.println("|");
p=p+3;
}
p=0;
System.out.println("---------");
//Counting x and o
for(int i=0;i<s.length();i++)
{
if(s.charAt(i)=='X')
c1++;
else if(s.charAt(i)=='O')
c2++;
else
c3++;
}
int d =c1-c2;
d=Math.abs(d);
//Game starts
boolean k1 =false ,k2 =false;
if(s.charAt(0) == 'X' && s.charAt(1)=='X' && s.charAt(2)=='X')
k1=true;
else if(s.charAt(0) == 'X' && s.charAt(4)=='X' && s.charAt(8)=='X')
k1=true;
else if(s.charAt(0) == 'X' && s.charAt(3)=='X' && s.charAt(6)=='X')
k1=true;
else if(s.charAt(1) == 'X' && s.charAt(4)=='X' && s.charAt(7)=='X')
k1=true;
else if(s.charAt(2) == 'X' && s.charAt(5)=='X' && s.charAt(8)=='X')
k1=true;
else if(s.charAt(2) == 'X' && s.charAt(4)=='X' && s.charAt(6)=='X')
k1=true;
else if(s.charAt(5) == 'X' && s.charAt(4)=='X' && s.charAt(3)=='X')
k1=true;
else if(s.charAt(6) == 'X' && s.charAt(7)=='X' && s.charAt(8)=='X')
k1=true;
if(s.charAt(0) == 'O' && s.charAt(1)=='O' && s.charAt(2)=='O')
k2=true;
else if(s.charAt(0) == 'O' && s.charAt(4)=='O' && s.charAt(8)=='O')
k2=true;
else if(s.charAt(0) == 'O' && s.charAt(3)=='O' && s.charAt(6)=='O')
k2=true;
else if(s.charAt(1) == 'O' && s.charAt(4)=='O' && s.charAt(7)=='O')
k2=true;
else if(s.charAt(2) == 'O' && s.charAt(5)=='O' && s.charAt(8)=='O')
k2=true;
else if(s.charAt(2) == 'O' && s.charAt(4)=='O' && s.charAt(6)=='O')
k2=true;
else if(s.charAt(5) == 'O' && s.charAt(4)=='O' && s.charAt(3)=='O')
k2=true;
else if(s.charAt(6) == 'O' && s.charAt(7)=='O' && s.charAt(8)=='O')
k2=true;
if( k1==false && k2==false && c3>0 && d<2)
System.out.print("Game not finished");
else if( k1==true && k2==true && c3==0)
System.out.print("Draw");
else if( k1==false && k2==false && c3==0)
System.out.print("Draw");
else if(k1==true && k2==false)
System.out.print("X wins");
else if(k1==false && k2==true)
System.out.print("O wins");
else if( k1==true && k2==true && c3>0 )
System.out.print("Impossible");
else if( k1==true && k2==true && d>=2 && c3>0 )
System.out.print("Impossible");
else if( k1==false && k2==false && d>=2 && c3>0 )
System.out.print("Impossible");
}
}
/*XOOOOXXXX
---------
| X O O |
| O O X |
| X X X |
---------
X wins*/
|
[
"[email protected]"
] | |
920bba23f339a24483aecd17412c7968af8fb422
|
8e21f087028c8d566bb7c3b4ea067b8e918a95ec
|
/src/main/java/ch/sql/informix/SqlInformix.java
|
e17d6520e7885dd33398aa47b532367caa300a08
|
[] |
no_license
|
jimmyhsianghsu/informix
|
b08f21dc94003c2a2f81ab17f4cce5eb7d7b2992
|
405dce582df46c6456845fc2bf96e1bb69fccb5d
|
refs/heads/master
| 2021-01-17T13:42:03.483218 | 2016-06-22T08:48:04 | 2016-06-22T08:48:04 | 54,099,288 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,559 |
java
|
package ch.sql.informix;
public interface SqlInformix {
String driver = "com.informix.jdbc.IfxDriver";
String sqlTables = "select tabname from systables where locklevel matches '[PR]' order by tabname";
String sqlColumns = "select t.tabname,m.colname,ch_pk(t.tabname,m.colname) as pk,ch_fk(t.tabname,m.colname) as fk,ch_ptab(t.tabname,m.colname) as ptab,ch_pcol(t.tabname,m.colname) as pcol,m.colno,case m.coltype when 0 then 'CHAR' when 1 then 'SMALLINT' when 2 then 'INTEGER' when 3 then 'FLOAT' when 4 then 'SMALLFLOAT' when 5 then 'DECIMAL' when 6 then 'SERIA' when 7 then 'DATE' when 8 then 'MONEY' when 9 then 'NULL' when 10 then 'DATETIME' when 11 then 'BYTE' when 12 then 'TEXT' when 13 then 'VARCHAR' when 14 then 'INTERVAL' when 15 then 'NCHAR' when 16 then 'NVARCHAR' when 17 then 'INT8' when 18 then 'SERIAL8' when 19 then 'SET' when 20 then 'MULTISET' when 21 then 'LIST' when 22 then 'Unnamed ROW' when 40 then 'Variable-length opaque type' when 4118 then 'Named ROW' else to_char(m.coltype) end as type,m.collength from syscolumns m left outer join systables t on t.tabid=m.tabid where t.tabname=? order by colno,pk desc,fk desc,m.colno";
String getTables();
String getColumns(String tab);
String getRows(String tab, int page, int rows);
String getRowsFilter(String tab, String col, String val, int page, int rows);
String getQuery(String sql, int page, int rows);
String getQueryFilter(String sql, String col, String val, int page, int rows);
String sqlExecute(String sql);
}
|
[
"[email protected]"
] | |
f5a0cfde0ebcff2d4b0e2b6c28368400056ed6d4
|
a72e39aba384bf05bb17c91e9b278f16b981accc
|
/src/java/com/CMS/demo/entity/Users.java
|
bc26cf74a32d3f24b1a53a8eeb1a0d0f93c7a5b0
|
[] |
no_license
|
JasonRenBang/Cafeteria-Management-System
|
f7dc30c416a094f112d567fdb59ce9ab30cf91b4
|
6e2eb54a76155b4d18de67972757e0c37317cca7
|
refs/heads/main
| 2023-03-30T07:26:19.797431 | 2021-03-31T07:29:54 | 2021-03-31T07:29:54 | 353,260,565 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,664 |
java
|
package com.mealplan.demo.entity;
public class Users {
private int user_id;
private String username;
private String user_password;
private int security_level;
public int getUser_id() {
return user_id;
}
public void setUser_id(int user_id) {
this.user_id = user_id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getUser_password() {
return user_password;
}
public void setUser_password(String user_password) {
this.user_password = user_password;
}
public int getSecurity_level() {
return security_level;
}
public void setSecurity_level(int security_level) {
this.security_level = security_level;
}
public Users() {
user_id = 0;
username = null;
user_password = null;
security_level = 1;
}
public Users(int user_id, String username, String user_password, int security_level) {
this.user_id = user_id;
this.username = username;
this.user_password = user_password;
this.security_level = security_level;
}
@Override
public String toString() {
return user_id+": "+username+": "+ user_password+": "+security_level;
}
public boolean checkPassword(String pass) {
boolean check = false;
if(this.user_password.equals(pass)) {
check = true;
return check;
}
else
return check;
}
}
|
[
"[email protected]"
] | |
1ea530b1c0df6bf9fc11266ebcd7b3e307f4618d
|
223f748798472765cf69a22af401af87bf585a14
|
/测试/src/多线程/AccessConflict.java
|
726f48483c6639ca5fe12ece41b03dd2a5175aae
|
[] |
no_license
|
lazy-mapping/mysql
|
e4cbf3a990832ee0ffe13c79696850bdc82245e3
|
eac031eda91fbb7343c5302c4d47c3918daf5f9e
|
refs/heads/master
| 2020-07-27T23:47:34.108123 | 2019-09-21T02:36:26 | 2019-09-21T02:36:26 | 209,247,498 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 801 |
java
|
package 多线程;
class DataClass{
private int data=0;
public synchronized void increase() {
int nd=data;
try {
Thread.sleep(100);
}catch(Exception e) {System.out.print("异常!");}
data=nd+1;
}
public int getData() {
return data;
}
}
class NThread extends Thread{
DataClass d;
NThread(DataClass d){
this.d=d;
}
boolean alive=true;
public void run() {
for(int i=0; i<100;i++) {
d.increase();
}
alive=false;
}
}
public class AccessConflict {
public static void main(String[] args) {
DataClass d=new DataClass();
NThread t1=new NThread(d);
NThread t2=new NThread(d);
t1.start();
t2.start();
while(t1.alive||t2.alive);
System.out.println("data="+d.getData());/*访问冲突,没有获得数据*/
}
}
|
[
"[email protected]"
] | |
2ef5dab155c2564eaec338eaed012ff4f5888889
|
9186ed673d998368c715bd95accd02cda4880342
|
/j2cl-tests/src/test/java/org/gwtproject/event/dom/client/DomEventJ2clTest.java
|
900688c487cb9a4fd0c1b7d075aa20612420c2c6
|
[
"Apache-2.0"
] |
permissive
|
TDesjardins/gwt-event-dom
|
82056f5fa6582f8cb853705416953dec2c8fb468
|
d86b8762218335ee0f56308d6d95a969df872e86
|
refs/heads/master
| 2020-11-30T16:39:48.863625 | 2019-10-17T20:09:07 | 2019-10-17T20:09:07 | 230,444,381 | 0 | 0 |
Apache-2.0
| 2019-12-27T12:57:58 | 2019-12-27T12:57:58 | null |
UTF-8
|
Java
| false | false | 8,124 |
java
|
/*
* Copyright 2018 The GWT Project Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
/*
* Copyright 2018 The GWT Project Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.gwtproject.event.dom.client;
import static junit.framework.TestCase.assertTrue;
import com.google.j2cl.junit.apt.J2clTestInput;
import org.gwtproject.event.legacy.shared.EventHandler;
import org.gwtproject.event.shared.HandlerRegistration;
import org.gwtproject.event.shared.SimpleEventBus;
import org.junit.Test;
/** Events test. */
@J2clTestInput(DomEventJ2clTest.class)
public class DomEventJ2clTest extends AbstractHandlerBaseJ2cl {
@Test
public void testKeyEvents() {
final Flag flag = new Flag();
eventbus = new SimpleEventBus();
HandlerRegistration downRegistration =
eventbus.addHandler(KeyDownEvent.getType(), event -> flag.flag = true);
HandlerRegistration upRegistration =
eventbus.addHandler(KeyUpEvent.getType(), event -> flag.flag = true);
HandlerRegistration pressRegistration =
eventbus.addHandler(KeyPressEvent.getType(), event -> flag.flag = true);
checkFire(new KeyDownEvent(), downRegistration, flag, "onKeyDown");
checkFire(new KeyUpEvent(), upRegistration, flag, "onKeyUp");
checkFire(new KeyPressEvent(), pressRegistration, flag, "onKeyPressed");
}
@Test
public void testMouseEvents() {
final Flag flag = new Flag();
eventbus = new SimpleEventBus();
HandlerRegistration downRegistration =
eventbus.addHandler(
MouseDownEvent.getType(),
new MouseDownHandler() {
@Override
public void onMouseDown(MouseDownEvent event) {
flag.flag = true;
}
});
HandlerRegistration upRegistration =
eventbus.addHandler(
MouseUpEvent.getType(),
new MouseUpHandler() {
@Override
public void onMouseUp(MouseUpEvent event) {
flag.flag = true;
}
});
HandlerRegistration clickRegistration =
eventbus.addHandler(ClickEvent.getType(), (ClickHandler) event -> flag.flag = true);
HandlerRegistration dblclickRegistration =
eventbus.addHandler(
DoubleClickEvent.getType(), (DoubleClickHandler) event -> flag.flag = true);
HandlerRegistration outRegistration =
eventbus.addHandler(
MouseOutEvent.getType(),
new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
flag.flag = true;
}
});
HandlerRegistration overRegistration =
eventbus.addHandler(
MouseOverEvent.getType(),
new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
flag.flag = true;
}
});
HandlerRegistration moveRegistration =
eventbus.addHandler(
MouseMoveEvent.getType(),
new MouseMoveHandler() {
@Override
public void onMouseMove(MouseMoveEvent event) {
flag.flag = true;
}
});
HandlerRegistration wheelRegistration =
eventbus.addHandler(
MouseWheelEvent.getType(),
new MouseWheelHandler() {
@Override
public void onMouseWheel(MouseWheelEvent event) {
flag.flag = true;
}
});
checkFire(new MouseDownEvent(), downRegistration, flag, "onMouseDown");
checkFire(new MouseUpEvent(), upRegistration, flag, "onMouseUp");
checkFire(new MouseOutEvent(), outRegistration, flag, "onMouseOut");
checkFire(new MouseOverEvent(), overRegistration, flag, "onMouseOver");
checkFire(new MouseMoveEvent(), moveRegistration, flag, "onMouseMove");
checkFire(new MouseWheelEvent(), wheelRegistration, flag, "onMouseWheel");
checkFire(new ClickEvent(), clickRegistration, flag, "onClick");
checkFire(new DoubleClickEvent(), dblclickRegistration, flag, "onDoubleClick");
}
// TODO: Once we have the button widget migrated, we can add these tests!
// @Test
// public void testMouseEventCoordinates() {
// Button b = new Button();
// RootPanel.get().add(b);
//
// final Flag flag = new Flag();
// b.addMouseDownHandler(new MouseDownHandler() {
// @Override
// public void onMouseDown(MouseDownEvent event) {
// assertEquals("", 16, event.getX());
// assertEquals("", 8, event.getY());
// flag.flag = true;
// }
// });
//
// int x = b.getAbsoluteLeft() + 16;
// int y = b.getAbsoluteTop() + 8;
// NativeEvent event = Document.get().createMouseDownEvent(0, x, y, x, y,
// false, false, false, false, 1);
// b.getElement().dispatchEvent(event);
//
// assertTrue("Never received expected mouse-down event", flag.flag);
// }
//
// TODO: Once we have the button widget migrated, we can add these tests!
// public void testMultipleDomEventTypesPerEventName() {
// Button b = new Button();
// RootPanel.get().add(b);
//
// final Flag first = new Flag();
// b.addClickHandler(new ClickHandler() {
// @Override
// public void onClick(ClickEvent event) {
// first.flag = true;
// }
// });
//
// final Flag second = new Flag();
// b.addDomHandler(new CustomClickHandler() {
// @Override
// public void onClick(CustomClickEvent event) {
// second.flag = true;
// }
// }, CustomClickEvent.getType());
//
// NativeEvent event = Document.get().createClickEvent(0, 0, 0, 0, 0, false, false, false,
// false);
// b.getElement().dispatchEvent(event);
//
// assertTrue("Never received expected click event", first.flag);
// assertTrue("Never received expected click event", second.flag);
// }
private void checkFire(
DomEvent<?> event, HandlerRegistration registration, Flag flag, String eventName) {
flag.flag = false;
eventbus.fireEvent(event);
assertTrue(eventName + " didn't fire.", flag.flag);
flag.flag = false;
registration.removeHandler();
// event.reset(null);
eventbus.fireEvent(event);
assertTrue(eventName + " fired when it shouldn't have.", !flag.flag);
}
private SimpleEventBus eventbus;
interface CustomClickHandler extends EventHandler {
void onClick(CustomClickEvent evt);
}
static class Flag {
public boolean flag = false;
}
static class CustomClickEvent extends MouseEvent<CustomClickHandler> {
public static final Type<CustomClickHandler> TYPE = new Type<>("click", new CustomClickEvent());
public static Type<CustomClickHandler> getType() {
return TYPE;
}
@Override
public Type<CustomClickHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(CustomClickHandler handler) {
handler.onClick(this);
}
}
}
|
[
"[email protected]"
] | |
74c86abec4854bf96354cb0c7bf7aa2b139756a4
|
197ccb0c86dc69d6bd4974203277fdb3deacc8f1
|
/services/clinicalobs/src/com/restwiz/clinicalobs/TesttimeId.java
|
a18d89cb2f2ea6c9691e2991b0328e0cc89a1995
|
[] |
no_license
|
chamikaraJ/RestWiz
|
ea3077b0a5bf2c0676c3dfc68d8e7e13ec89cb31
|
d8fb8be6e0b9c42039d16d0480de8ef38a8fb139
|
refs/heads/master
| 2020-04-25T20:06:25.733952 | 2019-02-28T04:53:11 | 2019-02-28T04:53:11 | 173,043,324 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,357 |
java
|
/*Copyright (c) 2015-2016 medicalwizard.com.au All Rights Reserved.
This software is the confidential and proprietary information of medicalwizard.com.au You shall not disclose such Confidential Information and shall use it only in accordance
with the terms of the source code license agreement you entered into with medicalwizard.com.au*/
package com.restwiz.clinicalobs;
/*This is a Studio Managed File. DO NOT EDIT THIS FILE. Your changes may be reverted by Studio.*/
import java.io.Serializable;
import java.sql.Time;
import java.util.Objects;
public class TesttimeId implements Serializable {
private Time time;
private String name;
public Time getTime() {
return this.time;
}
public void setTime(Time time) {
this.time = time;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Testtime)) return false;
final Testtime testtime = (Testtime) o;
return Objects.equals(getTime(), testtime.getTime()) &&
Objects.equals(getName(), testtime.getName());
}
@Override
public int hashCode() {
return Objects.hash(getTime(),
getName());
}
}
|
[
"[email protected]"
] | |
8b29d2b49032cf7f071d13bfa8dd89480135ec1d
|
4aa90348abcb2119011728dc067afd501f275374
|
/app/src/main/java/com/tencent/mm/plugin/hp/b/g$2.java
|
386aea32a9589f56bd2338b6d265a7a87d17b518
|
[] |
no_license
|
jambestwick/HackWechat
|
0d4ceb2d79ccddb45004ca667e9a6a984a80f0f6
|
6a34899c8bfd50d19e5a5ec36a58218598172a6b
|
refs/heads/master
| 2022-01-27T12:48:43.446804 | 2021-12-29T10:36:30 | 2021-12-29T10:36:30 | 249,366,791 | 0 | 0 | null | 2020-03-23T07:48:32 | 2020-03-23T07:48:32 | null |
UTF-8
|
Java
| false | false | 2,013 |
java
|
package com.tencent.mm.plugin.hp.b;
import com.tencent.mm.a.g;
import com.tencent.mm.compatible.util.e;
import com.tencent.mm.plugin.hp.a.b;
import com.tencent.mm.pluginsdk.h.p;
import com.tencent.mm.sdk.platformtools.ac;
import com.tencent.mm.sdk.platformtools.bh;
import com.tencent.mm.sdk.platformtools.x;
class g$2 implements Runnable {
final /* synthetic */ String[] gIP;
final /* synthetic */ g nAQ;
g$2(g gVar, String[] strArr) {
this.nAQ = gVar;
this.gIP = strArr;
}
public final void run() {
int i;
String str = e.bnF + "/Download/2017-07-28_19-43-39.apk";
String str2 = e.bnF + "/Download/39-50-diff.apk";
String str3 = e.bnF + "/Download/new_50.apk";
String str4 = "ab099f75f740be5d88e178d662a36779";
if (this.gIP.length >= 3 && !bh.ov(this.gIP[2])) {
str = this.gIP[2];
}
if (this.gIP.length >= 4 && !bh.ov(this.gIP[3])) {
str2 = this.gIP[3];
}
if (this.gIP.length >= 5 && !bh.ov(this.gIP[4])) {
str3 = this.gIP[4];
}
if (this.gIP.length >= 6 && !bh.ov(this.gIP[5])) {
str4 = this.gIP[5];
}
if (com.tencent.mm.a.e.bO(str3)) {
i = 0;
} else {
long currentTimeMillis = System.currentTimeMillis();
i = b.b(str, str2, str3, str4);
x.i("MicroMsg.Tinker.TinkerBootsCommand", "merge apk use :%d retCode:%d", new Object[]{Long.valueOf((System.currentTimeMillis() - currentTimeMillis) / 1000), Integer.valueOf(i)});
}
if (i == 0) {
x.i("MicroMsg.Tinker.TinkerBootsCommand", "show dialog for install");
x.i("MicroMsg.Tinker.TinkerBootsCommand", "New Apk md5:%s", new Object[]{g.bV(str3)});
p.ba(ac.getContext(), str3);
x.i("MicroMsg.Tinker.TinkerBootsCommand", "md5 is equal.");
return;
}
x.i("MicroMsg.Tinker.TinkerBootsCommand", "merge apk failed.");
}
}
|
[
"[email protected]"
] | |
72ffabff39455b5f03f1292ba582777c879f17af
|
0e7f18f5c03553dac7edfb02945e4083a90cd854
|
/target/classes/jooqgen/.../src/main/java/com/br/sp/posgresdocker/model/jooq/pg_catalog/routines/LsegPerp.java
|
0b65d878e9590e7bfc1d7892175e520c2404db13
|
[] |
no_license
|
brunomathidios/PostgresqlWithDocker
|
13604ecb5506b947a994cbb376407ab67ba7985f
|
6b421c5f487f381eb79007fa8ec53da32977bed1
|
refs/heads/master
| 2020-03-22T00:54:07.750044 | 2018-07-02T22:20:17 | 2018-07-02T22:20:17 | 139,271,591 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | true | 2,765 |
java
|
/*
* This file is generated by jOOQ.
*/
package com.br.sp.posgresdocker.model.jooq.pg_catalog.routines;
import com.br.sp.posgresdocker.model.jooq.pg_catalog.PgCatalog;
import javax.annotation.Generated;
import org.jooq.Field;
import org.jooq.Parameter;
import org.jooq.impl.AbstractRoutine;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.11.2"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class LsegPerp extends AbstractRoutine<Boolean> {
private static final long serialVersionUID = 862275730;
/**
* The parameter <code>pg_catalog.lseg_perp.RETURN_VALUE</code>.
*/
public static final Parameter<Boolean> RETURN_VALUE = createParameter("RETURN_VALUE", org.jooq.impl.SQLDataType.BOOLEAN, false, false);
/**
* @deprecated Unknown data type. Please define an explicit {@link org.jooq.Binding} to specify how this type should be handled. Deprecation can be turned off using <deprecationOnUnknownTypes/> in your code generator configuration.
*/
@java.lang.Deprecated
public static final Parameter<Object> _1 = createParameter("_1", org.jooq.impl.DefaultDataType.getDefaultDataType("\"pg_catalog\".\"lseg\""), false, true);
/**
* @deprecated Unknown data type. Please define an explicit {@link org.jooq.Binding} to specify how this type should be handled. Deprecation can be turned off using <deprecationOnUnknownTypes/> in your code generator configuration.
*/
@java.lang.Deprecated
public static final Parameter<Object> _2 = createParameter("_2", org.jooq.impl.DefaultDataType.getDefaultDataType("\"pg_catalog\".\"lseg\""), false, true);
/**
* Create a new routine call instance
*/
public LsegPerp() {
super("lseg_perp", PgCatalog.PG_CATALOG, org.jooq.impl.SQLDataType.BOOLEAN);
setReturnParameter(RETURN_VALUE);
addInParameter(_1);
addInParameter(_2);
}
/**
* Set the <code>_1</code> parameter IN value to the routine
*/
public void set__1(Object value) {
setValue(_1, value);
}
/**
* Set the <code>_1</code> parameter to the function to be used with a {@link org.jooq.Select} statement
*/
public void set__1(Field<Object> field) {
setField(_1, field);
}
/**
* Set the <code>_2</code> parameter IN value to the routine
*/
public void set__2(Object value) {
setValue(_2, value);
}
/**
* Set the <code>_2</code> parameter to the function to be used with a {@link org.jooq.Select} statement
*/
public void set__2(Field<Object> field) {
setField(_2, field);
}
}
|
[
"[email protected]"
] | |
3ca964c77b35f4fc7f917316e37ce85464b05b8e
|
7807db8b4645339b60ab5e5c22dbf891ee0080e3
|
/store-web/src/br/com/storeweb/model/Estado.java
|
5e140d4ae9ef6d652df63b9f62a55d02988d26d2
|
[] |
no_license
|
eversonsantos/esystem
|
43ccf37d09a0e3f12c7550c4c0905542a0903c46
|
c3994f88ecda8ca1f181f3e1882947877777d0e7
|
refs/heads/master
| 2020-05-21T13:30:34.587128 | 2018-07-18T18:18:34 | 2018-07-18T18:18:34 | 61,842,075 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 980 |
java
|
package br.com.storeweb.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity(name = "tbl_estado")
public class Estado extends EntityDefault{
@Id
@GeneratedValue( strategy = GenerationType.AUTO)
@Column( name = "cd_uf")
private Long cd_uf;
@Column( name = "nm_uf")
private String nm_uf;
@Column(name = "sg_uf")
private String sg_uf;
public Estado() {
}
public Estado(Long cd_uf, String nm_uf, String sg_uf) {
this.cd_uf = cd_uf;
this.nm_uf = nm_uf;
this.sg_uf = sg_uf;
}
public Long getCd_uf() {
return cd_uf;
}
public void setCd_uf(Long cd_uf) {
this.cd_uf = cd_uf;
}
public String getNm_uf() {
return nm_uf;
}
public void setNm_uf(String nm_uf) {
this.nm_uf = nm_uf;
}
public String getSg_uf() {
return sg_uf;
}
public void setSg_uf(String sg_uf) {
this.sg_uf = sg_uf;
}
}
|
[
"[email protected]"
] | |
c9217784e6efa6ccd65b43384d399c5817be6af6
|
0396306b86d1d132814a7071f00aeca8df409895
|
/src/main/java/org/GodMode/TestManager/service/impl/UserServiceImpl.java
|
265bc4fc512738da0c2db1e4761d833a798b7c5e
|
[] |
no_license
|
GodMode-DataArt2016/TestManager
|
349ebf2ef7d8d77713a49b1c37dfa1bbcda2407d
|
58465009586abc70c54743f0df4d55bea80934ce
|
refs/heads/master
| 2020-12-31T04:42:32.123448 | 2016-05-10T19:37:18 | 2016-05-10T19:37:18 | 57,233,645 | 2 | 4 | null | 2016-05-10T19:34:34 | 2016-04-27T17:43:59 |
Java
|
UTF-8
|
Java
| false | false | 712 |
java
|
package org.GodMode.TestManager.service.impl;
import org.GodMode.TestManager.entities.Users;
import org.GodMode.TestManager.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
public class UserServiceImpl implements UserService {
@Autowired
UserServiceImpl userServiceDao;
public List<Users> findAll() {
return userServiceDao.findAll();
}
public Users find(Long id) {
return userServiceDao.find(id);
}
public void saveOrUpdate(Users entry) {
userServiceDao.saveOrUpdate(entry);
}
public void delete(Users entry) {
userServiceDao.delete(entry);
}
}
|
[
"[email protected]"
] | |
150551d697cc272aa3e5f090cbea9408544a608d
|
6affb37022f430c0cabde6c8b2631ac8ca27ef0f
|
/src/main/java/com/dominiccobo/fyp/context/models/git/GitRemoteURL.java
|
2130fdad856d1fd70c5508645b5cfe1713c2a411
|
[] |
no_license
|
dominiccobo-fyp/context-api
|
b0677192a2a598855fa24071c547c0952f10f47a
|
b15d388ee7b8a85ea7a224b313bb33a361dd41f1
|
refs/heads/master
| 2020-12-04T03:44:23.700934 | 2020-02-05T14:33:00 | 2020-02-05T14:33:00 | 231,595,637 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 331 |
java
|
package com.dominiccobo.fyp.context.models.git;
import com.fasterxml.jackson.annotation.JsonCreator;
public class GitRemoteURL {
private String url;
@JsonCreator
private GitRemoteURL() {}
public GitRemoteURL(String url) {
this.url = url;
}
public String getUrl() {
return url;
}
}
|
[
"[email protected]"
] | |
547deff238d214f1ce12ae56284523d47ab98826
|
ae81ff35438835db86301ec24c3c0bab18e21e3d
|
/Domotix4/src/eu/pochet/domotix/NotificationHelper.java
|
4c38a3705119533d678924449b70993ce35a2bba
|
[] |
no_license
|
rpochet/Domotix
|
f55336b526e1f28341c625e59ee4bcd13688663e
|
9ecb8f267a6a824dca4255dac954e74ca926b963
|
refs/heads/master
| 2021-01-18T21:56:56.412482 | 2019-06-04T22:19:55 | 2019-06-04T22:19:55 | 17,287,954 | 0 | 0 | null | 2015-02-11T20:36:44 | 2014-02-28T14:08:34 |
JavaScript
|
UTF-8
|
Java
| false | false | 998 |
java
|
package eu.pochet.domotix;
import android.content.Context;
import android.content.SharedPreferences;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.SystemClock;
import android.os.Vibrator;
import android.preference.PreferenceManager;
public class NotificationHelper {
public static void notify(Context context) {
SharedPreferences sharedpreferences = PreferenceManager
.getDefaultSharedPreferences(context);
if (sharedpreferences.getBoolean("notification", false)) {
if (sharedpreferences.getString("notification.sound", null) != null) {
Ringtone ringtone = RingtoneManager.getRingtone(context, Uri
.parse(sharedpreferences
.getString("notification.sound", null)));
ringtone.play();
SystemClock.sleep(500L);
ringtone.stop();
}
if (sharedpreferences.getBoolean("notification.vibrate", false)) {
((Vibrator) context.getSystemService("vibrator")).vibrate(300L);
}
}
}
}
|
[
"[email protected]"
] | |
78ec5b927697ff4c6bbb485ce5fddb4b97f6c684
|
35ca1144aaa0405079b59c2fcbcd726f2472246d
|
/src/main/java/us/fok/lenzenslijper/models/jooq/routines/_DropRasterConstraintSpatiallyUnique.java
|
dab4bb08ce9fbfcf519a74c14758ae5fcf11a054
|
[
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"BSD-2-Clause"
] |
permissive
|
fokus-llc/lenzenslijper
|
a1e152fdb0a808f97496e7b09b609b7101a1e956
|
861d741a739c976c96b2821d0b5361c8aae99f69
|
refs/heads/master
| 2021-01-16T00:22:18.583402 | 2014-10-28T02:39:16 | 2014-10-28T02:39:16 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,265 |
java
|
/**
* This class is generated by jOOQ
*/
package us.fok.lenzenslijper.models.jooq.routines;
/**
* This class is generated by jOOQ.
*/
@javax.annotation.Generated(value = { "http://www.jooq.org", "3.3.0" },
comments = "This class is generated by jOOQ")
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class _DropRasterConstraintSpatiallyUnique extends org.jooq.impl.AbstractRoutine<java.lang.Boolean> {
private static final long serialVersionUID = -400134201;
/**
* The parameter <code>public._drop_raster_constraint_spatially_unique.RETURN_VALUE</code>.
*/
public static final org.jooq.Parameter<java.lang.Boolean> RETURN_VALUE = createParameter("RETURN_VALUE", org.jooq.impl.SQLDataType.BOOLEAN);
/**
* The parameter <code>public._drop_raster_constraint_spatially_unique.rastschema</code>.
*/
public static final org.jooq.Parameter<java.lang.String> RASTSCHEMA = createParameter("rastschema", org.jooq.impl.SQLDataType.VARCHAR);
/**
* The parameter <code>public._drop_raster_constraint_spatially_unique.rasttable</code>.
*/
public static final org.jooq.Parameter<java.lang.String> RASTTABLE = createParameter("rasttable", org.jooq.impl.SQLDataType.VARCHAR);
/**
* The parameter <code>public._drop_raster_constraint_spatially_unique.rastcolumn</code>.
*/
public static final org.jooq.Parameter<java.lang.String> RASTCOLUMN = createParameter("rastcolumn", org.jooq.impl.SQLDataType.VARCHAR);
/**
* Create a new routine call instance
*/
public _DropRasterConstraintSpatiallyUnique() {
super("_drop_raster_constraint_spatially_unique", us.fok.lenzenslijper.models.jooq.Public.PUBLIC, org.jooq.impl.SQLDataType.BOOLEAN);
setReturnParameter(RETURN_VALUE);
addInParameter(RASTSCHEMA);
addInParameter(RASTTABLE);
addInParameter(RASTCOLUMN);
}
/**
* Set the <code>rastschema</code> parameter IN value to the routine
*/
public void setRastschema(java.lang.String value) {
setValue(us.fok.lenzenslijper.models.jooq.routines._DropRasterConstraintSpatiallyUnique.RASTSCHEMA, value);
}
/**
* Set the <code>rastschema</code> parameter to the function to be used with a {@link org.jooq.Select} statement
*/
public void setRastschema(org.jooq.Field<java.lang.String> field) {
setField(RASTSCHEMA, field);
}
/**
* Set the <code>rasttable</code> parameter IN value to the routine
*/
public void setRasttable(java.lang.String value) {
setValue(us.fok.lenzenslijper.models.jooq.routines._DropRasterConstraintSpatiallyUnique.RASTTABLE, value);
}
/**
* Set the <code>rasttable</code> parameter to the function to be used with a {@link org.jooq.Select} statement
*/
public void setRasttable(org.jooq.Field<java.lang.String> field) {
setField(RASTTABLE, field);
}
/**
* Set the <code>rastcolumn</code> parameter IN value to the routine
*/
public void setRastcolumn(java.lang.String value) {
setValue(us.fok.lenzenslijper.models.jooq.routines._DropRasterConstraintSpatiallyUnique.RASTCOLUMN, value);
}
/**
* Set the <code>rastcolumn</code> parameter to the function to be used with a {@link org.jooq.Select} statement
*/
public void setRastcolumn(org.jooq.Field<java.lang.String> field) {
setField(RASTCOLUMN, field);
}
}
|
[
"[email protected]"
] | |
2d8db02039fb87258684174657f748cca3ec98c6
|
f92a53fda355eca8b93ce48f63e2f679215213e2
|
/src/solutions/ConcatenatedWords.java
|
88ec06153628d5cecfa2f18d95c8f512672908e3
|
[] |
no_license
|
ellinx/LC-java
|
1e6a542c8095f941e99003a3077e97710f492e94
|
5cc1ad99edb74b33598ee64021aa351f0dbcffc4
|
refs/heads/master
| 2021-06-03T05:19:44.211023 | 2020-08-16T19:50:07 | 2020-08-16T19:50:07 | 132,704,766 | 0 | 1 | null | 2019-05-15T03:25:23 | 2018-05-09T05:13:13 |
Java
|
UTF-8
|
Java
| false | false | 2,246 |
java
|
package solutions;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
Given a list of words (without duplicates),
please write a program that returns all concatenated words in the given list of words.
A concatenated word is defined as a string that is
comprised entirely of at least two shorter words in the given array.
Example:
Input: ["cat","cats","catsdogcats","dog","dogcatsdog","hippopotamuses","rat","ratcatdogcat"]
Output: ["catsdogcats","dogcatsdog","ratcatdogcat"]
Explanation: "catsdogcats" can be concatenated by "cats", "dog" and "cats";
"dogcatsdog" can be concatenated by "dog", "cats" and "dog";
"ratcatdogcat" can be concatenated by "rat", "cat", "dog" and "cat".
Note:
1. The number of elements of the given array will not exceed 10,000
2. The length sum of elements in the given array will not exceed 600,000.
3. All the input string will only include lower case letters.
4. The returned elements order does not matter.
*/
public class ConcatenatedWords {
public List<String> findAllConcatenatedWordsInADict(String[] words) {
List<String> ret = new ArrayList<>();
Set<String> wordSet = new HashSet<>();
Map<String,Boolean> mm = new HashMap<>();
for (String word:words) {
wordSet.add(word);
}
for (String word:words) {
if (check(word, 0, wordSet, mm)) {
ret.add(word);
}
}
return ret;
}
private boolean check(String word, int start, Set<String> wordSet, Map<String,Boolean> mm) {
String cur = word.substring(start);
if (start>0) {
if (wordSet.contains(cur)) {
return true;
}
}
if (mm.containsKey(cur)) {
mm.get(cur);
}
for (int i=start+1;i<word.length();i++) {
String w1 = word.substring(start,i);
if (!wordSet.contains(w1)) {
continue;
}
if (check(word, i, wordSet, mm)) {
mm.put(word, true);
return true;
}
}
mm.put(word, false);
return false;
}
}
|
[
"[email protected]"
] | |
6f25b05f2a3d98fce15fecd1ff626ba8470ba464
|
afd3a2aff126c345536d1b9ff1c2e19aa8aed139
|
/source/branches/prototype-v2/at.rc.tacos.platform.model/src/at/rc/tacos/platform/model/RosterEntry.java
|
b064dcf64c5ea979be485a1f4c43e8d8267c5fb7
|
[] |
no_license
|
mheiss/rc-tacos
|
5705e6e8aabe0b98b2626af0a6a9598dd5a7a41d
|
df7e1dbef5287d46ee2fc9c3f76f0f7f0ffeb08b
|
refs/heads/master
| 2021-01-09T05:27:45.141578 | 2017-02-02T22:15:58 | 2017-02-02T22:15:58 | 80,772,164 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 10,948 |
java
|
package at.rc.tacos.platform.model;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import at.rc.tacos.platform.util.MyUtils;
/**
* Represents one roster entry
*
* @author b.thek
*/
public class RosterEntry extends Lockable {
private int rosterId;
private Location station;
private StaffMember staffMember;
private long plannedStartOfWork;
private long plannedEndOfWork;
private long realStartOfWork;
private long realEndOfWork;
private ServiceType serviceType;
private Job job;
private String createdByUser;
private String rosterNotes;
private boolean standby;
/**
* Default class constructor
*/
public RosterEntry() {
rosterId = -1;
}
/**
* Constructor for a minimal roster entry object
*
* @param staffMember
* the person for this service
* @param serviceType
* the employee status
* @param job
* of this person only for this roster entry
* @param station
* the place to work
* @param plannedStartOfWork
* the planned time to start the service
* @param plannedEndOfWork
* the planned end of the service
*/
public RosterEntry(StaffMember staffMember, ServiceType serviceType, Job job, Location station, long plannedStartOfWork, long plannedEndOfWork) {
setStaffMember(staffMember);
setPlannedEndOfWork(plannedEndOfWork);
setPlannedStartOfWork(plannedStartOfWork);
setStation(station);
setJob(job);
setServicetype(serviceType);
}
/**
* @param staffMember
* the staff member for this entry
* @param plannedStartOfWork
* the planned star of work
* @param plannedEndOfWork
* the planned end of work
* @param realStartOfWork
* the real start of work
* @param realEndOfWork
* the real end of work
* @param station
* the roster station of
* @param job
* of this entry
* @param serviceType
* the service type of this entry
* @param rosterNotes
* the notes for this roster
* @param standby
* flag to show that the staff member is at home
*/
public RosterEntry(StaffMember staffMember, long plannedStartOfWork, long plannedEndOfWork, long realStartOfWork, long realEndOfWork, ServiceType serviceType, Job job, Location station, String rosterNotes, boolean standby) {
setStaffMember(staffMember);
setPlannedEndOfWork(plannedEndOfWork);
setPlannedStartOfWork(plannedStartOfWork);
setRealStartOfWork(realStartOfWork);
setRealEndOfWork(realEndOfWork);
setStation(station);
setJob(job);
setServicetype(serviceType);
setRosterNotes(rosterNotes);
setStandby(standby);
}
/**
* Returns the human readable string for this <code>RosterEntry</code>
* instance.
*
* @return the build string
*/
@Override
public String toString() {
ToStringBuilder builder = new ToStringBuilder(this);
builder.append("id", rosterId);
builder.append("staff", staffMember);
builder.append("standby", standby);
builder.append("OS", station);
builder.append("Verwendung", job);
builder.append("DV", serviceType);
builder.append("notes", rosterNotes);
builder.append("plannedStart", MyUtils.timestampToString(plannedStartOfWork, MyUtils.timeAndDateFormat));
builder.append("plannedEnd", MyUtils.timestampToString(plannedEndOfWork, MyUtils.timeAndDateFormat));
builder.append("signedIn", MyUtils.timestampToString(realStartOfWork, MyUtils.timeAndDateFormat));
builder.append("signedOut", MyUtils.timestampToString(realEndOfWork, MyUtils.timeAndDateFormat));
return builder.toString();
}
/**
* Returns the generated hashCode of this <code>RosterEntry</code> instance.
* <p>
* The hashCode is based uppon the {@link RosterEntry#getRosterId()}
* </p>
*
* @return the generated hash code
*/
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder(43, 53);
builder.append(rosterId);
return builder.toHashCode();
}
/**
* Returns wheter or not this <code>RosterEntry</code> instance is equal to
* the compared object.
* <p>
* The compared fields are {@link RosterEntry#getRosterId()}
* </p>
*
* @return true if the instance is the same otherwise false.
*/
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (obj == this) {
return true;
}
if (obj.getClass() != getClass()) {
return false;
}
RosterEntry rosterEntry = (RosterEntry) obj;
EqualsBuilder builder = new EqualsBuilder();
builder.append(rosterId, rosterEntry.rosterId);
return builder.isEquals();
}
/**
* Returns wheter or not this entry has notes
*
* @return true if there are notes
*/
public boolean hasNotes() {
if (rosterNotes == null)
return false;
if (rosterNotes.trim().isEmpty()) {
return false;
}
// we have notes :)
return true;
}
// LOCKABLE IMPLEMENTATION
@Override
public int getLockedId() {
return rosterId;
}
@Override
public Class<?> getLockedClass() {
return RosterEntry.class;
}
// GETTERS AND SETTERS
/**
* Returns the identification string of this member
*
* @return the rosterId
*/
public int getRosterId() {
return rosterId;
}
/**
* Sets the identification string of this member
*
* @param rosterId
* the rosterId to set
* @throws IllegalArgumentException
* if the id is negative
*/
public void setRosterId(int rosterId) {
this.rosterId = rosterId;
}
/**
* Returns the member of this entry
*
* @return the staff member
*/
public StaffMember getStaffMember() {
return staffMember;
}
/**
* Sets the member of this entry
*
* @param staffMember
* the staff member to set
*/
public void setStaffMember(StaffMember staffMember) {
this.staffMember = staffMember;
}
/**
* Returns the planned end of work for this roster entry.<br>
*
* @return the plannedEndOfWork
*/
public long getPlannedEndOfWork() {
return plannedEndOfWork;
}
/**
* Sets the planned end of work for this entry.<br>
*
* @param plannedEndOfWork
* the time and date of the planned end of work
*/
public void setPlannedEndOfWork(long plannedEndOfWork) {
this.plannedEndOfWork = plannedEndOfWork;
}
/**
* Returns the planned start of work in milliseconds.
*
* @return the planned start of work.
*/
public long getPlannedStartOfWork() {
return plannedStartOfWork;
}
/**
* Sets the planned start of work for this roster entry.
*
* @param plannedStartOfWork
* the plannedStartOfWork to set
*/
public void setPlannedStartOfWork(long plannedStartOfWork) {
this.plannedStartOfWork = plannedStartOfWork;
}
/**
* Returns the check in time of this roster entry. This time represents the
* real start time of the roster entry.
*
* @return the realStartOfWork
*/
public long getRealStartOfWork() {
return realStartOfWork;
}
/**
* Sets the check-in time for this roster entry
*
* @param realStartOfWork
* the realStartOfWork to set
* @throws IllegalArgumentException
* if the given value is not a valid date
*/
public void setRealStartOfWork(long realStartOfWork) {
this.realStartOfWork = realStartOfWork;
}
/**
* Returns the check-out time for this member. This time represents the real
* start time of the meber.
*
* @return the realEndOfWork
*/
public long getRealEndOfWork() {
return realEndOfWork;
}
/**
* Sets the check-out time for this roster entry.
*
* @param realEndOfWork
* the realEndOfWork to set
* @throws IllegalArgumentException
* if the given value is not a valid date
*/
public void setRealEndOfWork(long realEndOfWork) {
this.realEndOfWork = realEndOfWork;
}
/**
* Returns the station where the staff member is working for this roster
* entry.
*
* @return the station of the duty
*/
public Location getStation() {
return station;
}
/**
* Sets the station for this staff member
*
* @param station
* the station to set
*/
public void setStation(Location station) {
this.station = station;
}
/**
* Returns the job of this staff member.<br>
*
* @return the job of the roster entry.
*/
public Job getJob() {
return job;
}
/**
* Sets the job for this staff member.
*
* @param job
* the job to set
*/
public void setJob(Job job) {
this.job = job;
}
/**
* Returns the service type of this staff member.<br>
*
* @return the service type
*/
public ServiceType getServicetype() {
return serviceType;
}
/**
* Sets the service type for this staff member
*
* @param serviceType
* the service type to set
*/
public void setServicetype(ServiceType serviceType) {
this.serviceType = serviceType;
}
/**
* Returns the notes for this roster entry.
*
* @return the rosterNotes
*/
public String getRosterNotes() {
return rosterNotes;
}
/**
* Sets the notes for this roster entry.
*
* @param rosterNotes
* the rosterNotes to set
*/
public void setRosterNotes(String rosterNotes) {
this.rosterNotes = rosterNotes;
}
/**
* Returns whether or not the member is currently at home and in standby. <br>
* The staff member is at home and must be called.
*
* @return the status of the staff member
*/
public boolean getStandby() {
return standby;
}
/**
* Sets whether or not this staff member is in standby
*
* @param standby
* the standby to set
*/
public void setStandby(boolean standby) {
this.standby = standby;
}
/**
* Returns whether or not the roster entry is split up onto more or one day.<br>
* The start day and the end day is not the same.
*
* @return true if the start and end day is not the same
*/
public boolean isSplitEntry() {
return !MyUtils.isEqualDate(plannedStartOfWork, plannedEndOfWork);
}
/**
* Returns the name of the user who created the roster entry.
*
* @return the username of the creator.
*/
public String getCreatedByUsername() {
return createdByUser;
}
/**
* Sets the name of the staff member who created the entry.
*
* @param createdByUser
* the username of the creator
*/
public void setCreatedByUsername(String createdByUser) {
this.createdByUser = createdByUser;
}
}
|
[
"[email protected]"
] | |
299172913cfb78a0b8aa036a52d5f7b56bfe5e1a
|
18d975ae85d67549aaff89dc5e9f34e27c6f34b4
|
/src/main/java/com/era/views/abstracttablesmodel/SucursalsAbstractTableModel.java
|
220d0c9ad00ae984094cd8e340889a8fe161bc04
|
[] |
no_license
|
davidtadeovargas/era_views
|
303b6f14621c439e46816b8269a3afc64101c384
|
e53dca6f0e62ebc217c35709ddb707ca52945202
|
refs/heads/master
| 2023-01-12T01:31:23.201880 | 2020-11-18T07:02:34 | 2020-11-18T07:02:34 | 245,113,301 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 633 |
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.era.views.abstracttablesmodel;
import com.era.models.Sucursal;
import com.era.views.tables.headers.ColumnTable;
import java.util.List;
import javax.swing.JTable;
/**
*
* @author PC
*/
public class SucursalsAbstractTableModel extends BaseAbstractTableModel {
public SucursalsAbstractTableModel(final JTable jTable, List<Sucursal> deliveries, List<ColumnTable> header) {
super(jTable,deliveries,header);
}
}
|
[
"[email protected]"
] | |
35f5309513fe32ca039b17c6ff55a9f349cd0dcf
|
f6217482eaf93ba3d37b05823ea86705023426f6
|
/dataCollectDemo/src/foundation/dataService/base/DataHelper.java
|
37b7aa3148c4b5969b4f0c59b77e3fce43c7e736
|
[] |
no_license
|
hyh122/MyGitHub
|
aa7d1c03d2acb5110eb060bffda966910e2b0c39
|
30e1b99979ea379916c16c9c472056779ca4966f
|
refs/heads/master
| 2020-05-17T10:51:04.932022 | 2014-10-31T06:54:00 | 2014-10-31T06:54:00 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,143 |
java
|
package foundation.dataService.base;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import com.example.datacollectdemo.R;
import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;
import com.j256.ormlite.support.ConnectionSource;
import com.j256.ormlite.table.DatabaseTableConfig;
import com.j256.ormlite.table.DatabaseTableConfigLoader;
import com.j256.ormlite.table.TableUtils;
/**
*
* @author 福建师范大学软件学院 陈贝、刘大刚
*
*/
public class DataHelper extends OrmLiteSqliteOpenHelper {
private static final int DATABASE_VERSION = 1;
private Context context;
public DataHelper(Context context,String dataFileName) {
super(context, dataFileName, null, DATABASE_VERSION,
R.raw.ormlite_config);
this.context = context;
}
@Override
public void onCreate(SQLiteDatabase db, ConnectionSource connectionSource) {
// create database
this.createTable(db, connectionSource);
}
@Override
public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource,
int arg2, int arg3) {
// update database
this.updateTable(db, connectionSource);
}
@Override
public void onOpen(SQLiteDatabase db) {
super.onOpen(db);
Log.d("DataHelper", "database is opened");
}
@Override
public void close() {
super.close();
Log.d("DataHelper", "database is closed");
}
private void createTable(SQLiteDatabase db,ConnectionSource connectionSource) {
try {
Log.d("DataHelper", "create database");
InputStream is = this.context.getResources().openRawResource(
R.raw.ormlite_config);
InputStreamReader isr = new InputStreamReader(is);
BufferedReader reader = new BufferedReader(isr, 4096);
List<DatabaseTableConfig<?>> tableConfigs = DatabaseTableConfigLoader
.loadDatabaseConfigFromReader(reader);
for (DatabaseTableConfig<?> databaseTableConfig : tableConfigs) {
TableUtils.createTableIfNotExists(connectionSource,
databaseTableConfig);
}
is.close();
isr.close();
reader.close();
} catch (Exception e) {
Log.e(DataHelper.class.getName(), "创建数据库失败" + e.getCause());
e.printStackTrace();
}
}
private void updateTable(SQLiteDatabase db, ConnectionSource connectionSource) {
try {
Log.d("DataHelper", "Update Database");
InputStream is = this.context.getResources().openRawResource(
R.raw.ormlite_config);
InputStreamReader isr = new InputStreamReader(is);
BufferedReader reader = new BufferedReader(isr, 4096);
List<DatabaseTableConfig<?>> tableConfigs = DatabaseTableConfigLoader
.loadDatabaseConfigFromReader(reader);
for (DatabaseTableConfig<?> databaseTableConfig : tableConfigs) {
TableUtils.dropTable(connectionSource, databaseTableConfig,
true);
}
is.close();
isr.close();
reader.close();
onCreate(db, connectionSource);
} catch (Exception e) {
Log.e(DataHelper.class.getName(), "更新数据库失败" + e.getMessage());
e.printStackTrace();
}
}
}
|
[
"[email protected]"
] | |
c08f9d1e1601f897fb5aad4bb426ae36ccab1f89
|
7c2f5bdf6199ee25afafbc8bc2eb77541976d00e
|
/Game/src/main/java/io/riguron/game/map/vote/GameMapVoting.java
|
9694f2183f6f34805ef3928f5264da2b9cffbb15
|
[
"MIT"
] |
permissive
|
Stijn-van-Nieulande/MinecraftNetwork
|
0995d2fad0f7e1150dff0394c2568d9e8f6d1dca
|
7ed43098a5ba7574e2fb19509e363c3cf124fc0b
|
refs/heads/master
| 2022-04-03T17:48:42.635003 | 2020-01-22T05:22:49 | 2020-01-22T05:22:49 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,318 |
java
|
package io.riguron.game.map.vote;
import lombok.RequiredArgsConstructor;
import io.riguron.game.map.GameMap;
import io.riguron.game.map.GameMaps;
import io.riguron.game.map.vote.result.MapVotingResult;
import io.riguron.game.map.vote.result.SuccessfulVoteResult;
import io.riguron.game.map.vote.result.UnknownMapResult;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
@RequiredArgsConstructor
public class GameMapVoting {
private final GameMaps gameMaps;
private Map<GameMap, Integer> votes = new HashMap<>();
private boolean open;
public MapVotingResult vote(String mapName) {
return gameMaps.getMap(mapName)
.map(this::successfulVoting)
.orElseGet(() -> new UnknownMapResult(mapName));
}
public Optional<GameMap> getVotingWinner() {
return votes.entrySet().stream()
.max(Map.Entry.comparingByValue())
.flatMap(gameMapIntegerEntry -> Optional.of(gameMapIntegerEntry.getKey()));
}
private MapVotingResult successfulVoting(GameMap gameMap) {
return new SuccessfulVoteResult(votes.merge(gameMap, 1, Integer::sum), gameMap.getName());
}
public void close() {
this.open = false;
}
public boolean isOpen() {
return this.open;
}
}
|
[
"[email protected]"
] | |
17e147c1c70830a58e58e0dd35765e24028b3aa8
|
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/11/11_06422007ce8bebdbf185d3d4a6228f5bbc3b5818/TicTac/11_06422007ce8bebdbf185d3d4a6228f5bbc3b5818_TicTac_s.java
|
c958351c33a6b56be76941a7f9f65f5768b373e3
|
[] |
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,645 |
java
|
/**
* @author MpoMp
* @version 0.2
* @since 14-12-2011
*
* Tic-Tac-Toe game
*/
import acm.program.*;
/** Notes and tasks:
* -acm package used for parsing and printing
*
* TODO: remove acm dependence, update to ver 1.x
* TODO: check for useful exception handling
* TODO: add table lines display
*/
public class TicTac extends Program
{
public void run()
{
String ttt[][] = new String[3][3]; //the tic-tac-toe table and variables
final String x = "X";
final String o = "O";
boolean win = false;
byte empt = 9; //empty positions left
int l, r; //l, r variables for reading the user input
//Table initialized
for (byte i=0; i<3; i++)
for (byte j=0; j<3; j++)
ttt[i][j] = "-";
display(ttt); //Table display
//Two initial turns for each player
//No winning moves available yet
for (byte i=1; i<=2; i++)
{
do
{
l = readInt("X player: Give a LINE number: ");
r = readInt("X player: Give a ROW number: ");
} while ((r < 1 || r > 3) || (l < 1 || l > 3) || (ttt[l][r].compareToIgnoreCase("-") != 0))
ttt[l-1][r-1] = x;
empt--;
display(ttt); //Table display
do
{
l = readInt("O player: Give a LINE number: ");
r = readInt("O player: Give a ROW number: ");
} while ((r < 1 || r > 3) || (l < 1 || l > 3) || (ttt[l][r].compareToIgnoreCase("-") != 0))
ttt[l-1][r-1] = o;
empt--;
display(ttt); //Table display
}
//Winning moves available
//Checking for victory after each move
do
{
do
{
l = readInt("X player: Give a LINE number: ");
r = readInt("X player: Give a ROW number: ");
} while ((r < 1 || r > 3) || (l < 1 || l > 3) || (ttt[l][r].compareToIgnoreCase("-") != 0))
ttt[l-1][r-1] = x;
empt--;
display(ttt); //Table display
win = check(ttt, x, l-1, r-1);
if (win || empt == 0) break; //While X plays first, he will also be the last to play if the game ends up to a draw
do
{
l = readInt("O player: Give a LINE number: ");
r = readInt("O player: Give a ROW number: ");
} while ((r < 1 || r > 3) || (l < 1 || l > 3) || (ttt[l][r].compareToIgnoreCase("-") != 0))
ttt[l-1][r-1] = o;
empt--;
display(ttt); //Table display
win = check(ttt, o, l-1, r-1);
}while(!win);
if (empt == 0 && win == false)
println("\nDraw");
}
//"check" function checks if the last move is a winning move
//variable "lm" holds the last move symbol
private boolean check(String t[][], String lm, int l, int r)
{
boolean ret = false;
//check if the row where the last move was made is complete
if ((t[0][r].compareToIgnoreCase(t[1][r]) == 0 && (t[0][r].compareToIgnoreCase(t[2][r]) == 0 )))
{
ret = true;
}
//check if the line where the last move was made is complete
else if ((t[l][0].compareToIgnoreCase(t[l][1]) == 0 && (t[l][0].compareToIgnoreCase(t[l][2]) == 0 )))
{
ret = true;
}
//check the first diagonal
else if ((t[0][0].compareToIgnoreCase(t[1][1]) == 0 && (t[0][0].compareToIgnoreCase(t[2][2]) == 0)))
{
ret = true;
}
//check the second diagonal
else if ((t[2][0].compareToIgnoreCase(t[1][1]) == 0 && (t[2][0].compareToIgnoreCase(t[0][2]) == 0 )))
{
ret = true;
}
if(ret)
println("Player " + lm + " wins!");
return ret;
}
//displays the table
private void display(String t[][])
{
println("\n");
for (byte i=0; i<3; i++)
{
println("\n");
for (byte j=0; j<3; j++)
print(" " + t[i][j]);
}
println("\n");
}
}
|
[
"[email protected]"
] | |
0b422a9a4303ff56cbc377c7f28509148cc8ac46
|
d6b7af998d4fc6a758b9df6f6948a84786bba249
|
/ch05/MethodMission3.java
|
66aeffd7a3ad656a422345549fb97a6863fc3e36
|
[] |
no_license
|
heckevil/java
|
1190a486208d97ca2e1709d42fb355c7db77ceb5
|
c3617340ce5c153d348f430fbe94dcb90b07e65a
|
refs/heads/main
| 2023-04-15T04:45:37.095895 | 2021-04-09T07:07:12 | 2021-04-09T07:07:12 | 350,905,487 | 0 | 0 | null | null | null | null |
UHC
|
Java
| false | false | 725 |
java
|
package ch05;
public class MethodMission3 {
public static void main(String[] args) {
// TODO Auto-generated method stub
// int rNum = getRandomNum(); // 0~9
// System.out.println("rNum : " + rNum);
// rNum = getRandomNum();
// int rNum = getRandomNum(aaaa); // 0~19
// int rNum = getRandomNum(aaaa); // 0~4
// System.out.println(rNum);
//
int rNum = getRandomNum(10,20);// 10~20
System.out.println(rNum);
}
public static int getRandomNum(int num1, int num2) { // 이름은 상관없고 타입이 주요하다
int i = 0,z = 0;
if(num1 > num2) {
i = num1;
z = num2;
} else {
i = num2;
z = num1;
}
return (int) (Math.random() * (i - z +1)+z);
}
}
|
[
"[email protected]"
] | |
12b1495a389869db7dba1f7e4b6495817d18496a
|
d03c9174ec03b400687f0f7d40450267efa2b8aa
|
/src/main/java/com/data/query/constraints/ExistsConstraint.java
|
c232e5122f8a7afef0a53504875ce8847cf47c45
|
[] |
no_license
|
mlickei/reading-app
|
ed2b86208fb3ddd88722eb59467c09736932d0ec
|
026662d905231bb9bcca202ac173f086017faa95
|
refs/heads/master
| 2020-05-25T00:18:52.874308 | 2017-05-18T02:00:43 | 2017-05-18T02:00:43 | 84,892,757 | 2 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 694 |
java
|
package com.data.query.constraints;
/**
* Created by Matthew on 5/3/2017.
*/
public class ExistsConstraint implements IConstraint {
private String condition;
private Object value;
private boolean doesExist;
public ExistsConstraint(String condition, Object value, boolean doesExist) {
this.condition = condition;
this.value = value;
this.doesExist = doesExist;
}
@Override
public String getConstraintQueryString() {
StringBuilder sb = new StringBuilder();
if(!doesExist) {
sb.append("NOT ");
}
sb.append("EXISTS( ");
sb.append(condition);
sb.append(" )");
return sb.toString();
}
@Override
public Object getConstraintValue() {
return this.value;
}
}
|
[
"[email protected]"
] | |
7a4112b33821ac9f273ff00dd576b4cebfc45566
|
66d9056cfa9e48dbd1e74b90a1b99266e39d53c3
|
/src/main/java/ssm/com/zhang/sys/domain/Organization.java
|
1302354f384624288c2df132d89ef8840e901941
|
[] |
no_license
|
zhanggd1989/web-ssm
|
ae71b5569dbea317099ba22331fec59b62de1968
|
f60dc91c06ceb1316977aef8dcf21ba638b32abb
|
refs/heads/master
| 2021-01-16T17:39:23.694118 | 2017-12-11T08:33:57 | 2017-12-11T08:33:57 | 100,012,351 | 3 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,822 |
java
|
package ssm.com.zhang.sys.domain;
import java.util.Date;
public class Organization {
private Integer id;
private String name;
private String sequence;
private String icon;
private String type;
private String address;
private Integer pid;
private String pName;
private String status;
private String delFlag;
private String createUserId;
private Date createDate;
private String updateUserId;
private Date updateDate;
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 == null ? null : name.trim();
}
public String getSequence() {
return sequence;
}
public void setSequence(String sequence) {
this.sequence = sequence == null ? null : sequence.trim();
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon == null ? null : icon.trim();
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type == null ? null : type.trim();
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address == null ? null : address.trim();
}
public Integer getPid() {
return pid;
}
public void setPid(Integer pid) {
this.pid = pid;
}
public String getpName() {
return pName;
}
public void setpName(String pName) {
this.pName = pName;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag == null ? null : delFlag.trim();
}
public String getCreateUserId() {
return createUserId;
}
public void setCreateUserId(String createUserId) {
this.createUserId = createUserId == null ? null : createUserId.trim();
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public String getUpdateUserId() {
return updateUserId;
}
public void setUpdateUserId(String updateUserId) {
this.updateUserId = updateUserId == null ? null : updateUserId.trim();
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
}
|
[
"[email protected]"
] | |
93646c74a087f610a64c52493c87f234cc1d65bb
|
0242bf3cee69f6ab4429779e1cdeda83e25d4633
|
/src/main/java/com/kang/sys/mapper/ScheduleJobMapper.java
|
a1508bc98e2ed1ee51fc59aee7691abcf8196152
|
[] |
no_license
|
admins-2017/springboot-all-quickbuild
|
da9beb44f5322fbdc461732d3e8501f715ad6661
|
0969175ddc274291f944efa81d0167be31b1fc23
|
refs/heads/master
| 2022-07-02T01:08:46.429682 | 2020-05-05T04:30:22 | 2020-05-05T04:30:22 | 232,237,989 | 1 | 0 | null | 2022-06-21T02:35:20 | 2020-01-07T03:51:51 |
Java
|
UTF-8
|
Java
| false | false | 281 |
java
|
package com.kang.sys.mapper;
import com.kang.sys.entity.ScheduleJob;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author jobob
* @since 2019-11-11
*/
public interface ScheduleJobMapper extends BaseMapper<ScheduleJob> {
}
|
[
"[email protected]"
] | |
b49b6e4e94394c417fcd4af60609182219a8366d
|
b16531a3cec89c767e8abad735a3ff6a0b5ab592
|
/src/main/java/org/alan/mars/curator/MarsNodeListener.java
|
26c500a486347f97bea97cf6c01f7e5aae5c2dab
|
[] |
no_license
|
ymw520369/mars-core
|
5f0c06923f002ca5c916c8a2945614099df2f966
|
259c34ccf2dcf90825aad8b9c1224c58b9d0c0ae
|
refs/heads/master
| 2021-01-18T18:12:13.208587 | 2017-08-21T17:40:10 | 2017-08-21T17:40:10 | 100,516,589 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 502 |
java
|
/*
* Copyright (c) 2017. Chengdu Qianxing Technology Co.,LTD.
* All Rights Reserved.
*/
package org.alan.mars.curator;
/**
* 节点监听器
* <p>
* Created on 2017/4/13.
*
* @author Alan
* @since 1.0
*/
public interface MarsNodeListener {
enum NodeChangeType {
NODE_ADD, NODE_REMOVE, DATA_CHANGE
}
/**
* 节点状态改变
*
* @param nodeChangeType
* @param marsNode
*/
void nodeChange(NodeChangeType nodeChangeType, MarsNode marsNode);
}
|
[
"[email protected]"
] | |
1893f32591ac893d29024c5af3a54cdf498b4951
|
ccf105e7e3fc88a44cbac434a76058a0a1372af5
|
/src/com/smv/service/mailer/db/dao/SubjectTemplateKeyValuePairDAO.java
|
b5143cf0f002277ca91ece5efb9d26017b5c2092
|
[] |
no_license
|
timiblossom/ShareMyVision
|
a21db5f449ab6fe46a96b5dbd77ee9e297118649
|
025b70e261ed26bf72828248217932a417a90cdf
|
refs/heads/master
| 2021-05-16T02:40:13.887672 | 2019-04-08T20:30:53 | 2019-04-08T20:30:53 | 8,025,764 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,669 |
java
|
/**
*
*/
package com.smv.service.mailer.db.dao;
import java.util.List;
import org.apache.log4j.Logger;
import org.hibernate.Query;
import com.smv.service.mailer.db.MailerHibernateSessionFactory;
import com.smv.service.mailer.db.dbobject.SubjectTemplateKeyValuePairDO;
import com.smv.util.db.AbstractDO;
import com.smv.util.db.AbstractVersionedDatedDO;
import com.smv.util.db.SmvHibernateSession;
/**
* @author TriNguyen
*
*/
public class SubjectTemplateKeyValuePairDAO extends MailerBaseDAO {
private static final Logger LOGGER = Logger.getLogger(SubjectTemplateKeyValuePairDAO.class);
/**
* @param clientDO
*/
public SubjectTemplateKeyValuePairDAO(AbstractVersionedDatedDO clientDO) {
super(clientDO);
}
public SubjectTemplateKeyValuePairDO getSubjectTemplateKeyValuePairDO() {
return (SubjectTemplateKeyValuePairDO) iClientDO;
}
@Override
public AbstractDO merge(AbstractDO obj1, AbstractDO obj2) {
SubjectTemplateKeyValuePairDO clientDO = (SubjectTemplateKeyValuePairDO) obj1;
SubjectTemplateKeyValuePairDO serverDO = (SubjectTemplateKeyValuePairDO) super.merge(obj1, obj2);
// Mapping from client <-> server objects
if (clientDO.getName() != null) {
serverDO.setName(clientDO.getName());
}
if (clientDO.getDescription() != null) {
serverDO.setDescription(clientDO.getDescription());
}
if (clientDO.getSubjectTemplateId() != null) {
serverDO.setSubjectTemplateId(clientDO.getSubjectTemplateId());
}
if (clientDO.getKeyPair() != null) {
serverDO.setKeyPair(clientDO.getKeyPair());
}
if (clientDO.getDefaultValuePair() != null) {
serverDO.setDefaultValuePair(clientDO.getDefaultValuePair());
}
return serverDO;
}
public static List<SubjectTemplateKeyValuePairDO> getAllSubjectTemplateKeyValuePairs() {
SmvHibernateSession session = MailerHibernateSessionFactory.getInstance().getSession();
List<SubjectTemplateKeyValuePairDO> result = null;
try {
session.beginTransaction();
Query query = session.getNamedQuery("allSubjectTemplateKeyValuePairs");
result = (List<SubjectTemplateKeyValuePairDO>) query.list();
session.smvCommitTransaction();
} catch (Exception e) {
LOGGER.error(e);
if(session != null) session.smvRollback();
return null;
}
return result;
}
public static SubjectTemplateKeyValuePairDO getSubjectTemplateKeyValuePairById(Long id) {
SmvHibernateSession session = MailerHibernateSessionFactory.getInstance().getSession();
SubjectTemplateKeyValuePairDO retVal = null;
try {
session.beginTransaction();
retVal = (SubjectTemplateKeyValuePairDO) session.get(SubjectTemplateKeyValuePairDO.class, id);
session.smvCommitTransaction();
}
catch(Exception he)
{
LOGGER.error(he);
if(session != null) session.smvRollback();
return null;
}
return retVal;
}
public static List<SubjectTemplateKeyValuePairDO> getSubjectTemplateKeyValuePairByName(String name) {
SmvHibernateSession session = MailerHibernateSessionFactory.getInstance().getSession();
List<SubjectTemplateKeyValuePairDO> retVal = null;
try {
session.beginTransaction();
Query query = session.getNamedQuery("lookupSubjectTemplateKeyValuePairByName");
query.setString(0, name);
Object result = query.list();
if(result != null) {
retVal = (List<SubjectTemplateKeyValuePairDO>) result;
}
session.smvCommitTransaction();
} catch (Exception e) {
LOGGER.error(e);
if(session != null) session.smvRollback();
}
return retVal;
}
}
|
[
"[email protected]"
] | |
4657a9cefbd837fb18d9fa794f408f9d9d4f0f8a
|
b5c485493f675bcc19dcadfecf9e775b7bb700ed
|
/jee-utility-server-representation/src/test/java/org/cyk/utility/server/business/impl/ChildBusinessImpl.java
|
d425292ca40be40ccfd2c2be60020480da18ac9a
|
[] |
no_license
|
devlopper/org.cyk.utility
|
148a1aafccfc4af23a941585cae61229630b96ec
|
14ec3ba5cfe0fa14f0e2b1439ef0f728c52ec775
|
refs/heads/master
| 2023-03-05T23:45:40.165701 | 2021-04-03T16:34:06 | 2021-04-03T16:34:06 | 16,252,993 | 1 | 0 | null | 2022-10-12T20:09:48 | 2014-01-26T12:52:24 |
Java
|
UTF-8
|
Java
| false | false | 595 |
java
|
package org.cyk.utility.server.business.impl;
import java.io.Serializable;
import javax.enterprise.context.ApplicationScoped;
import org.cyk.utility.server.business.AbstractBusinessEntityImpl;
import org.cyk.utility.server.business.api.ChildBusiness;
import org.cyk.utility.server.persistence.api.ChildPersistence;
import org.cyk.utility.server.persistence.entities.Child;
@ApplicationScoped
public class ChildBusinessImpl extends AbstractBusinessEntityImpl<Child,ChildPersistence> implements ChildBusiness,Serializable {
private static final long serialVersionUID = 1L;
}
|
[
"[email protected]"
] | |
a4a8ec3ad6b26cd352d7be30ed5eca47e7136dd7
|
aa8f9eb5766d3b86f4b97eedab5f07da24b90335
|
/app/src/main/java/com/addie/timesapp/ui/UsagePermissionSlide.java
|
00d73d7655558dbee9558873a4028e93cc232fdb
|
[
"MIT"
] |
permissive
|
00aj99/TimesApp
|
e8591eb76f36cd4c033739dadd28190952a17bca
|
6802076c59c3a2c6e2fd19cb8ff17a46d631dd3b
|
refs/heads/master
| 2021-01-04T23:10:30.555015 | 2020-02-11T09:58:25 | 2020-02-11T09:58:25 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,185 |
java
|
/*
* MIT License
*
* Copyright (c) 2018 aSoft
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.addie.timesapp.ui;
import android.annotation.TargetApi;
import android.app.AppOpsManager;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;
import com.addie.timesapp.R;
public class UsagePermissionSlide extends Fragment {
private static final String ARG_LAYOUT_RES_ID = "layoutResId";
private int layoutResId;
private SharedPreferences preferences;
private Context mContext;
public static UsagePermissionSlide newInstance(int layoutResId) {
UsagePermissionSlide usagePermissionSlide = new UsagePermissionSlide();
Bundle args = new Bundle();
args.putInt(ARG_LAYOUT_RES_ID, layoutResId);
usagePermissionSlide.setArguments(args);
return usagePermissionSlide;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null && getArguments().containsKey(ARG_LAYOUT_RES_ID)) {
layoutResId = getArguments().getInt(ARG_LAYOUT_RES_ID);
}
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mContext = getActivity();
preferences = PreferenceManager.getDefaultSharedPreferences(mContext);
Button mPermissionButton = (Button) getView().findViewById(R.id.btn_usage_permission);
mPermissionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
grantPermissionClicked();
}
});
}
@Override
public void onResume() {
super.onResume();
ImageView mCheckImageView =(ImageView) getView().findViewById(R.id.iv_usage_permission_slide_check_state);
if (hasUsageStatsPermission(mContext)){
mCheckImageView.setImageResource(R.drawable.ic_check_green_24dp);
}
else{
mCheckImageView.setImageResource(R.drawable.ic_clear_red_24dp);
}
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
return inflater.inflate(layoutResId, container, false);
}
/**
* Handles the button click to launch activity or not
*/
private void grantPermissionClicked() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
&& !hasUsageStatsPermission(mContext)) {
requestUsageStatsPermission();
} else {
Toast.makeText(mContext, "Permission already granted!", Toast.LENGTH_SHORT).show();
}
}
/**
* Launches activity in settings to grant permission
*/
void requestUsageStatsPermission() {
startActivity(new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS, Uri.parse("package:" + mContext.getPackageName())));
}
/**
* Checks if permission is granted or not
* @param context
* @return
*/
@TargetApi(Build.VERSION_CODES.KITKAT)
boolean hasUsageStatsPermission(Context context) {
AppOpsManager appOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
int mode = appOps.checkOpNoThrow("android:get_usage_stats",
android.os.Process.myUid(), context.getPackageName());
boolean granted = mode == AppOpsManager.MODE_ALLOWED;
preferences.edit().putBoolean(getString(R.string.usage_permission_pref), granted).apply();
return granted;
}
}
|
[
"[email protected]"
] | |
65b9cd9af37c94def4dbb567a7b68d4793d6f699
|
528fefaf685c0be974bcdf5e633ca0c936e50a65
|
/POO_UCAM/src/InterfazSerializable/Emp.java
|
565e466ead62a88f04cb265d025db6014cffd805
|
[] |
no_license
|
satfail/JavaUcamWorkspace
|
2890ec521fc1315da59b292214b27143c765244a
|
b85a0ef5e5ed504bc4e4db7f39e5bbcdd67f4578
|
refs/heads/master
| 2020-12-28T08:40:26.255984 | 2020-02-07T12:05:33 | 2020-02-07T12:05:33 | 238,249,590 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 621 |
java
|
package InterfazSerializable;
//Java code for serialization and deserialization
//of a Java object
import java.io.*;
class Emp implements Serializable {
transient int a;
static int b;
String name;
int age;
// Default constructor
public Emp(String name, int age, int a, int b)
{
this.name = name;
this.age = age;
this.a = a;
this.b = b;
}
public static void printdata(Emp object1)
{
System.out.println("name = " + object1.name);
System.out.println("age = " + object1.age);
System.out.println("a = " + object1.a);
System.out.println("b = " + object1.b);
}
}
|
[
"[email protected]"
] | |
67b8b7ba0258b80c2d81506b8ad0b806968636d2
|
b420b9489f379df18462c65162f4ecf4cb987591
|
/source/shardcon-core/src/main/java/net/thumbtack/helper/MonitoringHandler.java
|
09decb13b65095950715736b1c4d9dbae9fbe817
|
[] |
no_license
|
aremnev/publican
|
0a16b7a30894e55b945978f1cc37d9df8ff45513
|
fe323b0d4610b5a1b5c5abfc0cb4f9da84b8b8b8
|
refs/heads/master
| 2016-09-06T05:23:02.315838 | 2013-12-19T08:08:53 | 2013-12-19T08:08:53 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,445 |
java
|
package net.thumbtack.helper;
import org.apache.commons.lang3.ClassUtils;
import org.javasimon.SimonManager;
import org.javasimon.Split;
import org.javasimon.Stopwatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import static net.thumbtack.helper.Util.loggable;
/**
* Handler that monitors all invocations and logs all results when execution time exceeds given threshold.
*/
public class MonitoringHandler implements InvocationHandler {
/**
* The prefix for Simon stopwatches. Stopwatches names are made by template:
* prefix + short class name + method name
*/
public static final String STOPWATCH_PREFIX = "mon.";
private static final int NANOS_TO_MILLIS_FACTOR = 1000 * 1000;
private static final Logger logger = LoggerFactory.getLogger("MonitoringHandler");
private static final String ERROR_TEMPLATE = "Error of execution. Object: {}. Method: {}.{}, with args: {}.";
private static final String SLOW_TEMPLATE = "Time: {} ms. Object: {}. Method: {}.{}, with args: {}. Result: {}";
private Object impl;
private int threshold;
/**
* Constructor.
* @param impl The implementation of interface
* @param threshold The threshold for logging of slow invocations
*/
public MonitoringHandler(Object impl, int threshold) {
this.impl = impl;
this.threshold = threshold;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
Object result;
Stopwatch stopwatch = SimonManager.getStopwatch(
STOPWATCH_PREFIX + ClassUtils.getShortClassName(impl.getClass()) + "." + method.getName());
Split split = stopwatch.start();
try {
result = method.invoke(impl, args);
} catch (Throwable t) {
logger.error(
ERROR_TEMPLATE,
ClassUtils.getShortClassName(impl.getClass()), method.getName(), loggable(args)
);
throw t.getCause();
}
long total = split.stop() / NANOS_TO_MILLIS_FACTOR;
if (total > threshold) {
logger.warn(
SLOW_TEMPLATE,
total, ClassUtils.getShortClassName(impl.getClass()), method.getName(), loggable(args), loggable(result)
);
}
return result;
}
}
|
[
"[email protected]"
] | |
859d11fe268bf7642950dae325b27d6d3bec64b6
|
9009bff8e0837a48765e3aabbb63b8de8425d3d4
|
/src/main/java/com/codeclan/example/CourseBooking/Repositories/CustomerRepositories/CustomerRepository.java
|
fbcfd0bdaa566cb038f249ee613bf08a9c245dd1
|
[] |
no_license
|
CodyAbb/course_booking_lab
|
446d9c65a77342a3d3543f97afe5936c71a86bb0
|
8a267bf305c8b592acc640ffe8f350fa99a2c7ba
|
refs/heads/master
| 2021-01-30T08:45:44.265679 | 2020-02-27T14:52:22 | 2020-02-27T14:52:22 | 243,495,729 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 769 |
java
|
package com.codeclan.example.CourseBooking.Repositories.CustomerRepositories;
import com.codeclan.example.CourseBooking.Models.Course;
import com.codeclan.example.CourseBooking.Models.Customer;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import java.util.List;
@RepositoryRestResource
public interface CustomerRepository extends JpaRepository<Customer, Long> {
List<Customer> findByBookingsCourseNameIgnoreCase(String courseName);
List<Customer> findByTownIgnoreCaseAndBookingsCourseNameIgnoreCase(String town, String courseName);
List<Customer> findByAgeGreaterThanAndTownIgnoreCaseAndBookingsCourseNameIgnoreCase(int age, String town, String courseName);
}
|
[
"[email protected]"
] | |
1762fc889316342cb8b748975d339835ba7fbcc0
|
12a99ab3fe76e5c7c05609c0e76d1855bd051bbb
|
/src/main/java/com/alipay/api/response/AlipayCommerceTransportVehicleownerCampaignauditQueryResponse.java
|
28d5557783d5a3dba5ceb4251b0ffcaa8658f3fa
|
[
"Apache-2.0"
] |
permissive
|
WindLee05-17/alipay-sdk-java-all
|
ce2415cfab2416d2e0ae67c625b6a000231a8cfc
|
19ccb203268316b346ead9c36ff8aa5f1eac6c77
|
refs/heads/master
| 2022-11-30T18:42:42.077288 | 2020-08-17T05:57:47 | 2020-08-17T05:57:47 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 670 |
java
|
package com.alipay.api.response;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: alipay.commerce.transport.vehicleowner.campaignaudit.query response.
*
* @author auto create
* @since 1.0, 2020-01-10 17:35:00
*/
public class AlipayCommerceTransportVehicleownerCampaignauditQueryResponse extends AlipayResponse {
private static final long serialVersionUID = 6774237953239587749L;
/**
* 状态
*/
@ApiField("status")
private String status;
public void setStatus(String status) {
this.status = status;
}
public String getStatus( ) {
return this.status;
}
}
|
[
"[email protected]"
] | |
09e633c7921c615e5296089e87561b6f46163bc2
|
1935a96064ae6fc7970bc5ff025206151ef5a9e3
|
/src/main/java/com/kwetter/service/UserService.java
|
847e7a5559ff50920c12d78a9632e39a3e910fe8
|
[
"MIT"
] |
permissive
|
liweihu1/Kwetteren-in-bad
|
b280d0ca2cc76864aecdf9e245afc744ad9a4307
|
9e1f42d599f7d832a284251964ede13e70826b0f
|
refs/heads/master
| 2022-12-06T08:05:37.099347 | 2020-10-17T13:23:39 | 2020-10-17T13:23:39 | 169,091,815 | 0 | 0 |
MIT
| 2022-11-24T08:34:04 | 2019-02-04T14:36:10 |
Java
|
UTF-8
|
Java
| false | false | 3,800 |
java
|
package com.kwetter.service;
import com.kwetter.dao.interfaces.UserDAO;
import com.kwetter.domain.Role;
import com.kwetter.domain.User;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.enterprise.inject.Default;
import java.util.List;
import java.util.UUID;
@Stateless
public class UserService {
@EJB(beanName = "UserDAOJPAImpl")
private UserDAO userDAO;
public User getUserByUsername(String username) {
return userDAO.findByUsername(username);
}
public User getUserById(UUID id){
return userDAO.findById(id);
}
public List<User> getAllUsers(){
return userDAO.getAllUsers();
}
public User createUser(User user){
return this.userDAO.add(user);
}
public User updateUser(User user) {
return this.userDAO.update(user);
}
public User changeUsername(String username, UUID id){
if (userDAO.checkUsernameAvailable(username)){
User user = userDAO.findById(id);
if (user != null){
user.setUsername(username);
return userDAO.update(user);
}
}
return null;
}
public User deleteUserById(UUID id){
User userToDelete = userDAO.findById(id);
userDAO.delete(userToDelete);
return userToDelete;
}
public User followUserWithId(UUID userId, UUID followId){
User curUser = userDAO.findById(userId);
User userToFollow = userDAO.findById(followId);
return followUser(curUser, userToFollow);
}
public User followUserWithUsername(UUID userId, String username){
User curUser = userDAO.findById(userId);
User followUser = userDAO.findByUsername(username);
return followUser(curUser, followUser);
}
public User addRolesToUser(UUID userId, List<Role> roles){
User user = userDAO.findById(userId);
for(Role r : roles) {
if (!user.getRoles().contains(r)){
user.getRoles().add(r);
}
}
userDAO.update(user);
return user;
}
public User unFollowUserWithUsername(UUID userId, String username){
User curUser = userDAO.findById(userId);
User followUser = userDAO.findByUsername(username);
return stopFollowingUser(curUser, followUser);
}
public User unFollowUserWithId(UUID userId, UUID followId){
User curUser = userDAO.findById(userId);
User followUser = userDAO.findById(followId);
return stopFollowingUser(curUser, followUser);
}
public List<User> getFollowersForUserWithId(UUID id){
return userDAO.getFollowersForUserWithId(id);
}
public List<User> getFollowingForUserWithId(UUID id){
return userDAO.getFollowingForUserWithId(id);
}
private User stopFollowingUser(User follower, User following){
try {
follower.getFollowing().remove(following);
following.getFollowers().remove(follower);
userDAO.update(follower);
userDAO.update(following);
return follower;
} catch (Exception e){
return null;
}
}
private User followUser(User follower, User following){
try {
if (following != follower && !follower.getFollowing().contains(following)) {
follower.getFollowing().add(following);
following.getFollowers().add(follower);
userDAO.update(follower);
userDAO.update(following);
return follower;
}
return null;
} catch (Exception e){
return null;
}
}
}
|
[
"[email protected]"
] | |
d31b00d869d68a28bc1356051cebb3733ad3b255
|
6089a3485d33c60c8b1ba54de162867f73ce3477
|
/bigdata-spark/src/main/java/pers/nebo/sparkcore/transformation/CountByKey.java
|
93cb200236238f9a31c39579b0de12515db46c9c
|
[] |
no_license
|
wanderwq/bigdata-study
|
d987b3b3b096b63da81e6cccb0e967cb7b59d82f
|
c1f20d6a38bac9101335fc534402e73fba42f3d7
|
refs/heads/master
| 2022-12-29T09:15:00.660092 | 2020-04-13T16:31:29 | 2020-04-13T16:31:29 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,214 |
java
|
package pers.nebo.sparkcore.transformation;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.JavaSparkContext;
import scala.Tuple2;
import java.util.Arrays;
import java.util.Map;
import java.util.Set;
/**
* @ author fnb
* @ email [email protected]
* @ date 2019/11/25
* @ des :
*/
public class CountByKey {
public static void main(String[] args) {
SparkConf conf = new SparkConf();
conf.setMaster("local");
conf.setAppName("test");
JavaSparkContext sc = new JavaSparkContext(conf);
//转为 k v 使用 parallelizePairs
JavaPairRDD<String, Integer> rdd1 = sc.parallelizePairs(Arrays.asList(
new Tuple2<String, Integer>("zhangsan", 10),
new Tuple2<String, Integer>("zhangsan", 100),
new Tuple2<String, Integer>("lisi", 20),
new Tuple2<String, Integer>("lisi", 20),
new Tuple2<String, Integer>("wangwu", 300)
));
Map<Tuple2<String, Integer>, Long> map = rdd1.countByValue();
Set<Map.Entry<Tuple2<String, Integer>, Long>> set = map.entrySet();
for(Map.Entry<Tuple2<String, Integer>, Long> entry : set){
Tuple2<String, Integer> key = entry.getKey();
Long value = entry.getValue();
System.out.println("key = "+key+",value = "+value);
}
// Map<String, Long> map = rdd1.countByKey();
// Set<Map.Entry<String, Long>> set = map.entrySet();
// for(Map.Entry<String, Long> entry : set){
// String key = entry.getKey();
// Long value = entry.getValue();
// System.out.println("key = "+key+",value = "+value);
// }
// JavaRDD<Integer> rdd1 = sc.parallelize(Arrays.asList(1, 2, 3, 4, 5));
// Integer reduce = rdd1.reduce(new Function2<Integer, Integer, Integer>() {
// @Override
// public Integer call(Integer v1, Integer v2) throws Exception {
// return v1 + v2;
// }
// });
// System.out.println(reduce);
/**
* reduce
* countByKey
* countByValue
*/
}
}
|
[
"[email protected]"
] | |
bf15fe0ec5b1b979370527190658657f56867a56
|
be2b6b3873c8a778a627d83fd104afd1d281287b
|
/video/src/main/java/com/hzwl/videoview/model/DataOfPage.java
|
9e02124a27c164b1f1d1809eae23001d9bfbc556
|
[] |
no_license
|
wxianing/Meist
|
269e8e6a014560593b1ca9bf89000220f24079dc
|
c5cee4244dc70f7e5f4ec308b8f0aca067dd4a61
|
refs/heads/master
| 2020-12-25T15:18:46.583182 | 2016-07-18T01:38:48 | 2016-07-18T01:38:48 | 61,422,561 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 818 |
java
|
package com.hzwl.videoview.model;
import com.google.gson.JsonElement;
/**
* Created by Cmad on 2015/3/6.
*/
public class DataOfPage {
/**
* 页数
*/
private int PageIndex;
/**
* 所有学员总数
*/
private int RecordCount;
/**
* 当前页数据列表
*/
private JsonElement DataList;
public int getPageIndex() {
return PageIndex;
}
public void setPageIndex(int pageIndex) {
PageIndex = pageIndex;
}
public int getRecordCount() {
return RecordCount;
}
public void setRecordCount(int recordCount) {
RecordCount = recordCount;
}
public JsonElement getDataList() {
return DataList;
}
public void setDataList(JsonElement dataList) {
DataList = dataList;
}
}
|
[
"[email protected]"
] | |
69ad427e08be24142c7c9a8c6342256ea6434b9c
|
a29b379a819ada70037e892f203fe823f133e6e0
|
/src/main/java/edu/co/sergio/mundo/vo/Obras.java
|
f2fa73f88cb0394244078f074d975972ddd16ad6
|
[] |
no_license
|
JulDaz/QuizGaleria
|
00b52d4a1418818f63962f4d0f0e840afa1cad0a
|
d818e3310774dd689216f3bcb565eb5266d6acbd
|
refs/heads/master
| 2020-12-30T15:07:47.492634 | 2017-05-12T15:54:30 | 2017-05-12T15:54:30 | 91,103,312 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 788 |
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 edu.co.sergio.mundo.vo;
/**
*
* @author JulDa
*/
public class Obras {
private String nombre;
private int valor;
private int val;
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public int getValor() {
return valor;
}
public void setValor(int valor) {
this.valor = valor;
}
public int getVal() {
return val;
}
public void setVal(int val) {
this.val = val;
}
}
|
[
"JulDa@DESKTOP-0G4AACD"
] |
JulDa@DESKTOP-0G4AACD
|
6b8be9ff5d062ed55f837cd4b59405fd1f38b426
|
56d1959c555ec71b19e662cbb7a9ef818011f41b
|
/src/main/java/fr/synapsegaming/statistiques/service/StatSpecialization.java
|
d343b009cb18013c336ad9def5943048b549da85
|
[] |
no_license
|
Godevin/SchoolJ2ee
|
5bb5258440f060d58945329063f24f8274c087b9
|
0b5ea7a609963e94ab34e661150aeb3cc73b727c
|
refs/heads/master
| 2021-01-10T16:42:55.086218 | 2015-11-29T17:16:52 | 2015-11-29T17:16:52 | 44,675,377 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 876 |
java
|
package fr.synapsegaming.statistiques.service;
import fr.synapsegaming.user.entity.Specialization;
import java.util.Comparator;
public class StatSpecialization implements Comparator<StatSpecialization> {
private int occurences;
private Specialization specialization;
public int getOccurences() {
return occurences;
}
public void setOccurences(int occurences) { this.occurences = occurences; }
public Specialization getSpecialization() {
return specialization;
}
public void setSpecialization(Specialization specialization) {
this.specialization = specialization;
}
@Override
public int compare(StatSpecialization o1, StatSpecialization o2) {
Integer occurence1 = o1.getOccurences();
Integer occurence2 = o2.getOccurences();
return occurence1.compareTo(occurence2);
}
}
|
[
"[email protected]"
] | |
d06d2c9e0cabd9c2facb30bca5ffc37c9fb2da03
|
8151336c81ee6ef6dcb41930620b4627cfec3b56
|
/app/src/main/java/com/xinfu/attorneyuser/bean/response/ResponseContractDetailsBean.java
|
8f5b282406b0006ec54105f9372ff28a475731fe
|
[] |
no_license
|
fuqingming/AttorneyUser
|
348df07bdc45dc723453e43f0bd73ed090507d77
|
0fb1d442c9b85cfd7a6e13748e1b9fc561059883
|
refs/heads/master
| 2020-03-23T23:41:58.430414 | 2018-07-28T21:23:27 | 2018-07-28T21:23:27 | 140,843,057 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,835 |
java
|
package com.xinfu.attorneyuser.bean.response;
import com.xinfu.attorneyuser.bean.base.ContractBean;
import java.util.ArrayList;
/**
* Created by vip on 2018/5/2.
*/
public class ResponseContractDetailsBean {
private Batch batch;
private ArrayList<ContractBean> hots;
public Batch getBatch() {
return batch;
}
public void setBatch(Batch batch) {
this.batch = batch;
}
public ArrayList<ContractBean> getHots() {
return hots;
}
public void setHots(ArrayList<ContractBean> hots) {
this.hots = hots;
}
public class Batch
{
private String id;
private String mainImage;
private String title;
private String subTitle;
private String price;
private String marketPrice;
private String taskId;
private String sellCount;
private String task;
private String filePath;
private String hasBuy;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getMainImage() {
return mainImage;
}
public void setMainImage(String mainImage) {
this.mainImage = mainImage;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getSubTitle() {
return subTitle;
}
public void setSubTitle(String subTitle) {
this.subTitle = subTitle;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public String getMarketPrice() {
return marketPrice;
}
public void setMarketPrice(String marketPrice) {
this.marketPrice = marketPrice;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getSellCount() {
return sellCount;
}
public void setSellCount(String sellCount) {
this.sellCount = sellCount;
}
public String getTask() {
return task;
}
public void setTask(String task) {
this.task = task;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getHasBuy() {
return hasBuy;
}
public void setHasBuy(String hasBuy) {
this.hasBuy = hasBuy;
}
}
}
|
[
"[email protected]"
] | |
ac4a74b665ebb4999d4263225ab14479625a638b
|
21886a6c2a5bd694a0e3514fdda4876d4443bf1d
|
/src/in/manish/rtneuro/myslider/ColorMenuFragment.java
|
7420042c50507a5d341f1d95a9cd5217906e996e
|
[] |
no_license
|
manish999/HomeScreen
|
ad2384ad951b692c216bd10f0939bdf144692b87
|
f51b8fc6dad6fd3ba92d4bbb4982e0e508f795e5
|
refs/heads/master
| 2020-03-27T03:49:42.621115 | 2013-10-31T11:23:57 | 2013-10-31T11:23:57 | 13,855,168 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 8,944 |
java
|
package in.manish.rtneuro.myslider;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ExpandableListView;
import android.widget.ExpandableListView.OnChildClickListener;
import android.widget.ExpandableListView.OnGroupClickListener;
import android.widget.ImageView;
import android.widget.TextView;
import com.actionbarsherlock.app.SherlockFragment;
import in.manish.rtneuro.R;
import in.manish.rtneuro.util.AppLog;
import java.util.ArrayList;
/**
* This calss is used to implement the Menu bar as listfragment.
* @author Manish Pathak
*
*/
public class ColorMenuFragment extends SherlockFragment {
private int[] slider_menu_icon = new int[]{R.drawable.ic_launcher,
R.drawable.ic_launcher,
R.drawable.ic_launcher,
R.drawable.ic_launcher};
private String[] slider_menu_text = new String[]{"Add User Icon",
"Add Alert Notification",
"Add Visual Display",
"Add Text Display"};
private ArrayList<Profile> profilesList = new ArrayList<Profile>();
private ArrayList<Account> accountList = new ArrayList<Account>();
private ExpandableListAdapter adapter;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.account_exp_list, null);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
String[] colors = new String[]{"mnaish", "pathak"};//getResources().getStringArray(R.array.color_names);
// ArrayAdapter<String> ad = new ArrayAdapter<String>(getActivity(),R.layout.list_sliding_menu,colors);
// setListAdapter(ad);
// ArrayAdapter<String> colorAdapter = new ArrayAdapter<String>(getActivity(),
// android.R.layout.simple_list_item_1, android.R.id.text1, colors);
// setListAdapter(colorAdapter);
init();
// SampleAdapter adapter = new SampleAdapter(getActivity());
// for (int i = 0; i < 4; i++) {
// adapter.add(new SampleItem(slider_menu_text[i], slider_menu_icon[i]));
// }
// setListAdapter(adapter);
}
private class SampleItem {
public String tag;
public int iconRes;
public SampleItem(String tag, int iconRes) {
this.tag = tag;
this.iconRes = iconRes;
}
}
public class SampleAdapter extends ArrayAdapter<SampleItem> {
ArrayList<SampleItem> listItem;
public SampleAdapter(Context context) {
super(context, 0);
}
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.row, null);
}
ImageView icon = (ImageView) convertView.findViewById(R.id.row_icon);
icon.setImageResource(getItem(position).iconRes);
TextView title = (TextView) convertView.findViewById(R.id.row_title);
title.setText(getItem(position).tag);
return convertView;
}
public void setList (ArrayList<SampleItem> list) {
}
}
// @Override
// public void onListItemClick(ListView lv, View v, int position, long id) {
// Fragment newContent = null;
// Bundle bundle = new Bundle();
// //pop all fragments from backstack on click sliding menu
// getActivity().getSupportFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
// switch (position) {
// case 0:
// newContent = new ColorFragment(android.R.color.black);
// // newContent = new ColorFragment(R.color.red);
// break;
//// case 1:
//// newContent = new FragmentSectionList();
//// // bundle.putString(Constants.TAB_TYPE, whichTab);
//// // bundle.putString(Constants.PROFILE, profile);
//// // bundle.putString(key, value);
//// // newContent.setArguments(args);
//// break;
//// case 2:
//// //direct call fragment.
//// newContent = FragmentAdwordsImpression.newInstance();
//// // View pager with header slide
////// newContent = new SampleTitlesStyledLayout();
//// break;
//// case 3:
////
//// break;
//// case 4:
//// newContent = new ColorFragment(android.R.color.black);
//// break;
// }
// if (newContent != null)
// switchFragment(newContent);
// }
// the meat of switching the above fragment
private void switchMenuContent(Fragment fragment) {
if (getActivity() == null)
return;
if (getActivity() instanceof FragmentChangeActivity) {
FragmentChangeActivity fca = (FragmentChangeActivity) getActivity();
fca.switchMenuFragment(fragment);
}
}
public void init() {
ExpandableListView listView = (ExpandableListView) getActivity().findViewById(R.id.listView);
listView.setOnChildClickListener(new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
ExpandableListAdapter ad = (ExpandableListAdapter) parent.getExpandableListAdapter();
Profile profile =(Profile) ad.getChild(groupPosition, childPosition);
// AppSettings.setPreference(AccountListActivity.this, null, AppSettings.ACCOUNT_TOKEN, profile.getAccountToken());
// AppSettings.setPreference(AccountListActivity.this, null, AppSettings.PROFILE_ID, profile.getProfileID());
// Intent localIntent = new Intent(AccountListActivity.this, FragmentChangeActivity.class);
// localIntent.putExtra(Constants.CALLING_ACTIVITY_TYPE, Constants.CALLING_ACTIVITY_ACCOUNTLISTACTIVITY);
// localIntent.putExtra(Constants.PROFILE, profile);
// localIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// startActivity(localIntent);
// AccountListActivity.this.finish();
AppLog.logToast(getActivity(), "Child clicked");
return false;
}
});
listView.setOnGroupClickListener(new OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
ExpandableListAdapter ad = (ExpandableListAdapter) parent.getExpandableListAdapter();
String acName = (String) ad.getGroup(groupPosition);
Fragment newContent = null;
Bundle bundle = new Bundle();
//pop all fragments from backstack on click sliding menu
getActivity().getSupportFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
switch (groupPosition) {
case 0:
newContent = FragmentHomeMenuUser.newInstance();
break;
case 1:
newContent = FragmentHomeMenuAlert.newInstance();
// bundle.putString(Constants.TAB_TYPE, whichTab);
// bundle.putString(Constants.PROFILE, profile);
// bundle.putString(key, value);
// newContent.setArguments(args);
break;
case 2:
//direct call fragment.
newContent = FragmentHomeMenuVisual.newInstance();
// View pager with header slide
// newContent = new SampleTitlesStyledLayout();
break;
case 3:
newContent = FragmentHomeMenuText.newInstance();
break;
case 4:
newContent = FragmentHomeMenuText.newInstance();
break;
}
if (newContent != null)
switchMenuContent(newContent);
return false;
}
// if(groupPosition == 0) {
// switchFragment(fragment)
// } else if(groupPosition == 1) {
// //add alert icon
// } else if(groupPosition == 2) {
// // add visual icon
// }else if(groupPosition == 3) {
// // add text icon
// }
//
//// AppSettings.setPreference(AccountListActivity.this, null, AppSettings.ACCOUNT_NAME, acName);
// AppLog.d("List", "Group clicked");
// return false;
// }
});
// Initialize the adapter with blank groups and children
// We will be adding children on a thread, and then update the ListView
adapter = new ExpandableListAdapter(getActivity(), new ArrayList<String>(),
new ArrayList<Account>());
Profile profile = new Profile();
// profile.setProfileName("a");
// profilesList.add(profile);
// profile = new Profile();
// profile.setProfileName("b");
// profilesList.add(profile);
// profile = new Profile();
// profile.setProfileName("c");
// profilesList.add(profile);
// profilesList.add(profile);
Account account = new Account();
account.setAccountName("Add User Icon");
account.setProfiles(profilesList);
accountList.add(account);
account = new Account();
account.setAccountName("Add Alert Notification");
account.setProfiles(profilesList);
accountList.add(account);
account = new Account();
account.setAccountName("Add Visual Display");
account.setProfiles(profilesList);
accountList.add(account);
account = new Account();
account.setAccountName("Add Text Display");
account.setProfiles(profilesList);
accountList.add(account);
adapter.addItem(accountList);
// Set this blank adapter to the list view
listView.setAdapter(adapter);
// setHeader((R.string.profiles), false, false, false);
}
}
|
[
"[email protected]"
] | |
28cb3d6a1b23f5a0e4362a9031d87604d3395ec8
|
faff8423d3eb531c431a817c2aa24e288b52e1c7
|
/seriousgame/src/swingEditor/.svn/text-base/SchemaGraphComponent.java.svn-base
|
63f65738252c578cb30950fde5c3dfac6c3eee3d
|
[] |
no_license
|
adilHamiani/SeriousGame
|
448847ed63a95867609471160780a89fdf2c5b78
|
07752e34899032f96af78d4733958ecde7566755
|
refs/heads/master
| 2020-12-04T11:47:06.536356 | 2016-08-23T19:15:15 | 2016-08-23T19:15:15 | 66,393,247 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,008 |
package swingEditor;
import java.awt.Component;
import javax.swing.JTable;
import javax.swing.JViewport;
import com.mxgraph.swing.mxGraphComponent;
import com.mxgraph.util.mxPoint;
import com.mxgraph.util.mxUtils;
import com.mxgraph.view.mxCellState;
import com.mxgraph.view.mxGraph;
import com.mxgraph.view.mxGraphView;
public class SchemaGraphComponent extends mxGraphComponent
{
/**
*
*/
private static final long serialVersionUID = -1152655782652932774L;
/**
*
* @param graph
*/
public SchemaGraphComponent(mxGraph graph)
{
super(graph);
mxGraphView graphView = new mxGraphView(graph)
{
/**
*
*/
public void updateFloatingTerminalPoint(mxCellState edge,
mxCellState start, mxCellState end, boolean isSource)
{
int col = getColumn(edge, isSource);
if (col >= 0)
{
double y = getColumnLocation(edge, start, col);
boolean left = start.getX() > end.getX();
if (isSource)
{
double diff = Math.abs(start.getCenterX()
- end.getCenterX())
- start.getWidth() / 2 - end.getWidth() / 2;
if (diff < 40)
{
left = !left;
}
}
double x = (left) ? start.getX() : start.getX()
+ start.getWidth();
double x2 = (left) ? start.getX() - 20 : start.getX()
+ start.getWidth() + 20;
int index2 = (isSource) ? 1
: edge.getAbsolutePointCount() - 1;
edge.getAbsolutePoints().add(index2, new mxPoint(x2, y));
int index = (isSource) ? 0
: edge.getAbsolutePointCount() - 1;
edge.setAbsolutePoint(index, new mxPoint(x, y));
}
else
{
super.updateFloatingTerminalPoint(edge, start, end,
isSource);
}
}
};
graph.setView(graphView);
}
/**
*
* @param edge
* @param isSource
* @return the column number the edge is attached to
*/
public int getColumn(mxCellState state, boolean isSource)
{
if (state != null)
{
if (isSource)
{
return mxUtils.getInt(state.getStyle(), "sourceRow", -1);
}
else
{
return mxUtils.getInt(state.getStyle(), "targetRow", -1);
}
}
return -1;
}
/**
*
*/
public int getColumnLocation(mxCellState edge, mxCellState terminal,
int column)
{
Component[] c = components.get(terminal.getCell());
int y = 0;
if (c != null)
{
for (int i = 0; i < c.length; i++)
{
if (c[i] instanceof JTableRenderer)
{
JTableRenderer vertex = (JTableRenderer) c[i];
JTable table = vertex.table;
JViewport viewport = (JViewport) table.getParent();
double dy = -viewport.getViewPosition().getY();
y = (int) Math.max(terminal.getY() + 22, terminal.getY()
+ Math.min(terminal.getHeight() - 20, 30 + dy
+ column * 16));
}
}
}
return y;
}
/**
*
*/
public Component[] createComponents(mxCellState state)
{
if (getGraph().getModel().isVertex(state.getCell()))
{
return new Component[] { new JTableRenderer(state.getCell(), this) };
}
return null;
}
}
|
[
"[email protected]"
] | ||
fddbe6dc704f0a0741f05bf0e3b26de95b379369
|
58c5c9b8edfeed4255a7598530e989991288c3fb
|
/anar-presentation/src/main/java/af/gov/anar/pista/infrastructure/dto/ErrorResponseDTO.java
|
f9c1df99f3b8eeb7c510d724c8bb336cd338edda
|
[] |
no_license
|
Anar-Framework/anar-clean-architecture
|
475b2fd643c3b724a17f81a5719892662bcdd601
|
69bcf5325235e6118e0f98d47257ae8387255bc5
|
refs/heads/master
| 2022-11-23T23:00:44.095101 | 2020-07-23T06:12:55 | 2020-07-23T06:12:55 | 281,862,679 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 339 |
java
|
package af.gov.anar.pista.infrastructure.dto;
import java.util.Map;
import lombok.Getter;
import lombok.Setter;
/**
* The DTO Class ErrorResponseDTO.
*/
@Getter
@Setter
public class ErrorResponseDTO {
private String code;
private String message;
private Map<String, Object> otherAttributes;
private String infoType;
}
|
[
"[email protected]"
] | |
6ba07c02ff42a6612eb4600d8012aed9a365bfd5
|
c8f841e7f3841de2f303af39560af4beaaa6112c
|
/企业项目/后端/youeryuan/src/main/java/com/isoft/youeryuan/service/impl/NoticeServiceImpl.java
|
3b356879591b4ee4cd966d9d4d9adfaf4e7a9378
|
[] |
no_license
|
Evlove0/youeryuan
|
4cbb364445c57f06d90b8f5514b388d78529a6bd
|
dfb2b66d4ab623ce7f2ecc5bcce15134f1eaccc5
|
refs/heads/master
| 2020-07-31T05:14:28.729849 | 2019-09-24T02:44:29 | 2019-09-24T02:44:29 | 210,495,696 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,942 |
java
|
package com.isoft.youeryuan.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.isoft.youeryuan.bean.Page;
import com.isoft.youeryuan.dao.NoticeDao;
import com.isoft.youeryuan.entity.Notice;
import com.isoft.youeryuan.service.NoticeService;
import com.isoft.youeryuan.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
@Service
@Transactional
public class NoticeServiceImpl implements NoticeService {
@Autowired
NoticeDao noticeDao;
@Override
public boolean addNotice(String title, String content) {
if (null==title||null==content||StringUtil.isEmpty(title)||StringUtil.isEmpty(content))
return false;
return noticeDao.addNotice(title,content)>0?true:false;
}
/*
@Override
public boolean deleteNotice(Integer id) {
if (null == id||id<1)
return false;
return noticeDao.deleteNotice(id)>0?true:false;
}
*/
@Override
public boolean deleteNotice(String id) {
if (null == id||StringUtil.isEmpty(id))
return false;
return noticeDao.deleteNotice(id)>0?true:false;
}
@Override
public boolean updateNotice(Integer id, String title, String content) {
if (null == id||id<1||null==title||null==content||StringUtil.isEmpty(title)||StringUtil.isEmpty(content))
return false;
return noticeDao.updateNotice(id,title,content)>0?true:false;
}
@Override
public List<Notice> selectAll() {
return null;
}
@Override
public Page<Notice> selectByTitleAndTime(Integer page , Integer pageSize , String title, String startTime, String endTime) {
System.out.println(page + "," + pageSize+ "," + title+ "," + startTime+ "," + endTime);
if(null == page || page < 0) {
page = 1 ;
}
if(null == pageSize || pageSize < 1) {
pageSize = 10 ;
}
if(StringUtil.isEmpty(title)) {
title = null ;
}
if(StringUtil.isEmpty(startTime)) {
startTime = null ;
}
if(StringUtil.isEmpty(endTime)) {
endTime = null ;
}
HashMap map = new HashMap();
map.put("titleKey",title);
map.put("startTimt",startTime);
map.put("endTime",endTime);
map.put("offset",(page-1) * pageSize);
map.put("rowCount",pageSize);
List<Notice> data = noticeDao.selectByTitleAndTime(map) ;
int count = noticeDao.selectCount(title,startTime,endTime) ;
int pageCount = (int)(Math.ceil(count*1.0 / pageSize));
return new Page<Notice>(data , page , pageSize , pageCount ,count) ;
}
/* @Override
public int selectCount(String title, String startTIme, String endTime) {
return 0;
}*/
}
|
[
"[email protected]"
] | |
e71e2e7ef4680d90e5c4fe4388198d26e48636e4
|
179c73b03daf7982c9cee70b515df851f2795f56
|
/src/main/java/com/sjsu/request/RequestDecorator.java
|
5f6abb59b6e7ef4defecd9f36479ccafddc709ef
|
[] |
no_license
|
ab24/LetsGo-Carpool-Design-patterns-202-
|
fd59e64681ee65cc4ea161d67dbc25ece8b1a9c3
|
a3498f5182844c79c85cd50070d5135bd9d6bf1c
|
refs/heads/master
| 2021-01-23T03:44:26.812942 | 2017-03-25T00:20:59 | 2017-03-25T00:20:59 | 86,120,990 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 281 |
java
|
package com.sjsu.request;
import com.sjsu.scheduler.SchedulingAlgorithm;
public abstract class RequestDecorator extends Request {
protected Request request;
public RequestDecorator(SchedulingAlgorithm schedulingAlgorithm) {
super(schedulingAlgorithm);
}
}
|
[
"[email protected]"
] | |
9e468f04fc8c45e5fe9179755f497d5297108959
|
0b5a7120a11b29f27151a628d64c99a9a494736d
|
/erp_my/src/org/erp/auth/resource/service/impl/ResourceServiceImpl.java
|
4f8184de06b1385392e0a0bb305d0481b3381311
|
[] |
no_license
|
xu03101431/ERP
|
59a2ca768670e29c730d197a14d93a2b34cae65a
|
0b66186d76ffa5c28a9af05c926b0c3a331c5b47
|
refs/heads/master
| 2021-01-19T09:51:56.003506 | 2014-12-17T11:45:20 | 2014-12-17T11:45:20 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,538 |
java
|
package org.erp.auth.resource.service.impl;
import java.util.List;
import org.erp.auth.resource.dao.dao.ResourceDao;
import org.erp.auth.resource.entity.ResourceModel;
import org.erp.auth.resource.service.service.ResourceService;
import org.erp.util.base.BaseModel;
import org.erp.util.exception.AppException;
public class ResourceServiceImpl implements ResourceService
{
private ResourceDao resourceDao;
@Override
public List<ResourceModel> findAll(BaseModel bsm, int currPage,
int pageSize) {
return resourceDao.findAll(bsm,currPage,pageSize);
}
public ResourceDao getResourceDao() {
return resourceDao;
}
public void setResourceDao(ResourceDao resourceDao) {
this.resourceDao = resourceDao;
}
@Override
public int rowCount(BaseModel dct) {
return resourceDao.rowCount(dct);
}
@Override
public void save(ResourceModel model) {
resourceDao.save(model);
}
@Override
public ResourceModel findById(Long uuid) {
return resourceDao.findById(uuid);
}
@Override
public void update(ResourceModel model) {
resourceDao.update(model);
}
@Override
public void delete(ResourceModel entity) {
resourceDao.delete(entity);
}
@Override
public List<ResourceModel> findAll() {
return resourceDao.findAll();
}
public void save(ResourceModel model, Long[] uuids) {
}
public void update(ResourceModel model, Long[] uuids) {
}
@Override
public List<ResourceModel> findByEmpId(Long uuid) {
return resourceDao.findByEmpId(uuid);
}
}
|
[
"[email protected]"
] | |
5c29613107eaf6a8c4bac11bd2fad48e67e82bc3
|
202448080c546709addcdfec1bb0647dff23f5b6
|
/DiagonalStar/src/academy/learnprogramming/Main.java
|
675dd703f0911fb3f59c0693425404e7aeee8d04
|
[] |
no_license
|
lana-20/JavaProgramming
|
d443f0036092fc63a847b18ba404b898215c2b97
|
1edd0589f468180a9365db4a735b5e57b19734ec
|
refs/heads/main
| 2023-07-06T11:35:07.653562 | 2021-08-12T06:41:45 | 2021-08-12T06:41:45 | 377,281,162 | 0 | 0 | null | 2021-06-28T18:41:47 | 2021-06-15T20:05:54 |
Java
|
UTF-8
|
Java
| false | false | 1,961 |
java
|
package academy.learnprogramming;
public class Main {
public static void main(String[] args) {
}
public static void printSquareStar(int number) {
if (number < 5) System.out.println("Invalid Value");
else {
for (int row = 0; row < number; row++) {
for (int column = 0; column < number; column++) {
if (row == 0 || row == number - 1 || column == 0 || column == number - 1 || column == row || column == number - 1 - row)
System.out.print("*");
else System.out.print(" ");
}
System.out.println("");
}
}
}
// Below captioned is the refactored code explaining how the * is displayed, using numbers 1-5 for clearer representation of the output
// public static void printSquareStar (int number) {
// if (number < 5) System.out.println("Invalid Value");
// else {
// for (int row = 0; row < number; row++) {
// for (int column = 0; column < number; column++) {
// if (row==0 || row==number) System.out.print("1"); // top and bottom rows
// else if (column==0) System.out.print("2"); // left column
// else if (column==number-1) System.out.print("3"); // right column
// else if (column==row) System.out.print("4"); // diagonal down to right
// else if (column==number-1-row) System.out.println("5"); //diagonal down to left
// // alternative to lines 29-33 // if (row==0 || row=number-1 || column==0 || column==number-1 || column==row || column==number-1-row) System.out.print("*");
// else System.out.print(" "); // empty space between numbers
// }
// }
// System.out.println(""); // puts a return to the row
// }
// }
}
|
[
"[email protected]"
] | |
ba1cabe50a814cf16bc0cb67a9f65ff0a9671c81
|
72bcb960ae41d4a343d1f33d88aa5ae535df11ec
|
/NPMilstone2/src/com/cse/np/sc/ClientSocket.java
|
6a48247a296ae17fb98b79fb01fdf0343afdb04b
|
[] |
no_license
|
DongningLi/networkProgramming
|
cabe24fa7f736e341da435c91a302b9b97cc50fc
|
dcf1fcf60128353c082e0a3e9edcd2a3665c9960
|
refs/heads/master
| 2021-01-23T06:49:36.511767 | 2017-04-30T05:21:12 | 2017-04-30T05:21:12 | 86,402,549 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 489 |
java
|
package com.cse.np.sc;
import com.cse.np.util.Constant;
import com.cse.np.util.ModifyCommand;
/**
* The Class ClientSocket.
*
* @author Dongning Li
*
*/
public class ClientSocket {
ModifyCommand mdfcInstance = new ModifyCommand();
public String modifyInput(String gossip) {
String encryptionMsg = mdfcInstance.getEncryption(gossip);
String localT = Constant.LOCAL_TIME;
String str = "GOSSIP:" + encryptionMsg + ":" + localT + ":" + gossip + "%";
return str;
}
}
|
[
"[email protected]"
] | |
f39a09236811c00da16b593d34cfb97b1471b689
|
b2b8fac233920fdebd06d1601c3c670490c0da59
|
/java/nepxion-swing/src/com/nepxion/swing/selector/radiobutton/JMultiRadioButtonSelectorBar.java
|
e270c1a42fd8ecb9667ff7a280c832dacab6ad21
|
[
"Apache-2.0"
] |
permissive
|
DmytroRybka/nepxion
|
5af80829bdcf1d738bccbf14a4707fae5b9ce28e
|
36412c4a59d40bb4a9a7208224e53f2e4e4c55eb
|
refs/heads/master
| 2020-04-16T03:37:57.532332 | 2013-05-29T02:56:01 | 2013-05-29T02:56:01 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,671 |
java
|
package com.nepxion.swing.selector.radiobutton;
/**
* <p>Title: Nepxion Swing</p>
* <p>Description: Nepxion Swing Repository</p>
* <p>Copyright: Copyright (c) 2010</p>
* <p>Company: Nepxion</p>
* @author Neptune
* @email [email protected]
* @version 1.0
*/
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import javax.swing.Box;
import javax.swing.JPanel;
import com.nepxion.swing.button.ButtonManager;
import com.nepxion.swing.button.JClassicButton;
import com.nepxion.swing.icon.IconFactory;
import com.nepxion.swing.locale.SwingLocale;
import com.nepxion.swing.selector.button.ISelectorMenuButton;
import com.nepxion.swing.selector.button.JBasicSelectorMenuButton;
import com.nepxion.swing.selector.button.JClassicSelectorMenuButton;
import com.nepxion.swing.textfield.JBasicTextField;
public class JMultiRadioButtonSelectorBar
extends JPanel
{
private JBasicTextField textField;
private ISelectorMenuButton menuButton;
private JMultiRadioButtonListPanel radioButtonListPanel;
public JMultiRadioButtonSelectorBar(List allElementNodes)
{
this(allElementNodes, false);
}
public JMultiRadioButtonSelectorBar(List allElementNodes, boolean isClassicStyle)
{
textField = new JBasicTextField();
textField.setEditable(false);
radioButtonListPanel = new JMultiRadioButtonListPanel(allElementNodes);
radioButtonListPanel.setPreferredSize(new Dimension(300, 300));
if (isClassicStyle)
{
menuButton = new JClassicSelectorMenuButton(IconFactory.getSwingIcon("property.png"), SwingLocale.getString("selection"))
{
public boolean confirm()
{
return JMultiRadioButtonSelectorBar.this.confirm();
}
public boolean cancel()
{
return true;
}
};
}
else
{
menuButton = new JBasicSelectorMenuButton(IconFactory.getSwingIcon("property.png"), SwingLocale.getString("selection"))
{
public boolean confirm()
{
return JMultiRadioButtonSelectorBar.this.confirm();
}
public boolean cancel()
{
return true;
}
};
}
menuButton.setContentPane(radioButtonListPanel);
JPanel buttonContainer = menuButton.getOptionButtonPanel().getContainer();
JClassicButton refreshButton = new JClassicButton(SwingLocale.getString("refresh"), IconFactory.getSwingIcon("stereo/refresh_16.png"), SwingLocale.getString("refresh"));
refreshButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
refresh();
}
}
);
buttonContainer.add(refreshButton, 0);
buttonContainer.add(Box.createHorizontalStrut(5), 1);
setLayout(new BorderLayout());
add(textField, BorderLayout.CENTER);
add((Component) menuButton, BorderLayout.EAST);
ButtonManager.updateUI(this, new Dimension(26, 26));
}
public void refresh()
{
}
public boolean confirm()
{
return true;
}
public JBasicTextField getTextField()
{
return textField;
}
public ISelectorMenuButton getMenuButton()
{
return menuButton;
}
public JMultiRadioButtonListPanel getRadioButtonListPanel()
{
return radioButtonListPanel;
}
public void setEnabled(boolean enabled)
{
textField.setEditable(enabled);
((Component) menuButton).setEnabled(enabled);
}
public Object getValue()
{
return textField.getText();
}
public void setValue(Object value)
{
textField.setText(value != null ? value.toString() : "");
}
}
|
[
"HaoJun.Ren@4900acfa-993c-71f3-3719-b31e1bbe1dc8"
] |
HaoJun.Ren@4900acfa-993c-71f3-3719-b31e1bbe1dc8
|
c0fc67bf381ae023333af6c7808f6cf657602e4b
|
ca4b6b73ea6d7a036d7fa67a6f56091ac17fcc62
|
/src/main/java/com/zql/hadooplearning/chapter3/FileCopyWithProgress.java
|
fd3b0b678667124e04479b850726e746f750082b
|
[] |
no_license
|
bbzhanshi999/hadoop_learning
|
32dfd433e6df6079b8373db5eaeb8988d3faa5c6
|
e2b81c46746b1056f8ccc8d30edbbfc47de48d64
|
refs/heads/master
| 2020-12-03T07:54:34.613889 | 2017-08-10T08:25:42 | 2017-08-10T08:25:42 | 95,638,938 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,132 |
java
|
package com.zql.hadooplearning.chapter3;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IOUtils;
import org.apache.hadoop.util.Progressable;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URI;
/**
* Created by Administrator on 2017/7/19.
*/
public class FileCopyWithProgress {
public static void main(String[] args) throws IOException {
String localSrc = args[0];
String uri = args[1];
BufferedInputStream in = new BufferedInputStream(new FileInputStream(localSrc));
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(URI.create(uri),conf);
FSDataOutputStream out = fs.create(new Path(uri), new Progressable() {
public void progress() {
System.out.println('.');
}
});
IOUtils.copyBytes(in,out,4096,false);
IOUtils.closeStream(in);
IOUtils.closeStream(out);
}
}
|
[
"[email protected]"
] | |
04f395adb4e8f1b2bb38e2bf9cdeed2cb9a78796
|
173b28f8eb705471ebc04b9726e73bcfe29f1c05
|
/src/Test.java
|
4551f8ee6c40964c532350db7debd1303082e711
|
[] |
no_license
|
quentinkb/testJEE
|
2f5ee3cdfb20859fa5379b34916ae539ccfd4d9f
|
9fbc40bc7b5402bd3c9995959e6b639c2a09c190
|
refs/heads/master
| 2021-05-02T10:02:35.137253 | 2018-02-08T16:45:35 | 2018-02-08T16:45:35 | 120,788,926 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 939 |
java
|
import com.qtn.beans.Genius;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
public class Test extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {
String message = "Bonjour, je m'appelle quentin";
String param = request.getParameter("auteur");
request.setAttribute("test",message);
request.setAttribute("auteur",param);
Genius premierBean = new Genius();
premierBean.setName("Ethan");
premierBean.setAge(18);
premierBean.setGenius(true);
request.setAttribute("genius",premierBean);
this.getServletContext().getRequestDispatcher("/WEB-INF/test.jsp").forward( request, response);
}
}
|
[
"[email protected]"
] | |
a18eb066cc9deae31a8ad0ceac998ced6e243beb
|
2bddeb55c51104b1033652f3a9ff098d165854e7
|
/sys-gateway/src/main/java/com/deltaqin/sys/config/NewRedisConfig.java
|
6ac6730adbf7aa01f1503e250d8ca6a7b05a679c
|
[
"Apache-2.0"
] |
permissive
|
delta-qin/data-heterogeneous-system
|
9c2f0ab7b0afa192e7abc56c9a18ce0bdecec101
|
ae3b65cfea9cb270cecb8b7421292eef07602e7f
|
refs/heads/main
| 2023-06-14T08:59:14.577806 | 2021-07-13T03:37:02 | 2021-07-13T03:37:02 | 385,463,622 | 7 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 215 |
java
|
package com.deltaqin.sys.config;
import com.deltaqin.sys.common.config.RedisConfig;
import org.springframework.context.annotation.Configuration;
@Configuration
public class NewRedisConfig extends RedisConfig {
}
|
[
"[email protected]"
] | |
3898c21582948ca72479da09fe060cfa773d722f
|
e4e67af58368ef9ff09c8f26be0af41b868faeef
|
/src/main/java/com/drishticon/cabassignmentservice/util/UUIDGenerator.java
|
c5666c3bbd2053e347f1633e634b9f6f1db7092e
|
[] |
no_license
|
RuzilSharifullin/cab-assignment-service
|
ebed2952ccbc1607439d39a2deab92b30c78b31f
|
489727ba2764efe14b001c5c7e74a0541d991161
|
refs/heads/master
| 2023-06-16T17:23:01.874600 | 2021-07-16T19:42:10 | 2021-07-16T19:42:10 | 381,557,350 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 449 |
java
|
package com.drishticon.cabassignmentservice.util;
import com.fasterxml.uuid.Generators;
import com.fasterxml.uuid.NoArgGenerator;
import java.util.UUID;
public class UUIDGenerator {
static {
timeBasedGenerator = Generators.timeBasedGenerator();
}
private static NoArgGenerator timeBasedGenerator;
private UUIDGenerator() {
}
public static UUID generate() {
return timeBasedGenerator.generate();
}
}
|
[
"[email protected]"
] | |
85e7d2bfcf966955fed184437f828a9f5368c06a
|
672714037a95b2d97a7d3cd7a9089df08429aee9
|
/store/src/main/java/org/productstore/common/pojo/BSResult.java
|
3d7cdbd9967d979381a7e7c3fa25343941ac0bc6
|
[] |
no_license
|
Darcywm/Resume
|
f45f8cb522fd10b9a5071b2f46e95e54e6123b9c
|
e4733ffe48ef1f18ffa8dcb02e1211e7597ebc0a
|
refs/heads/master
| 2022-09-12T08:59:59.774823 | 2019-08-11T11:42:28 | 2019-08-11T11:42:28 | 84,173,766 | 0 | 0 | null | 2022-09-01T23:08:43 | 2017-03-07T08:23:48 |
Java
|
UTF-8
|
Java
| false | false | 1,011 |
java
|
package org.productstore.common.pojo;
public class BSResult<T> {
private Integer code;
private String message;
private T data;
public BSResult() {
}
public BSResult(T data) {
this(200,"OK",data);
}
public BSResult(Integer code, String message, T data) {
this.code = code;
this.message = message;
this.data = data;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
@Override
public String toString() {
return "BSResult{" +
"code=" + code +
", message='" + message + '\'' +
", data=" + data +
'}';
}
}
|
[
"[email protected]"
] | |
63c6dcbe5b84d728cdb6e80e66c94fbe4b8d8b2b
|
e29f1068765b30a0c0a0fea05dc7896d2c083a7a
|
/core/src/main/java/org/bitcoinj/script/ScriptBuilder.java
|
eca6969410b2e939d73e38bc30b68f9ec6d23eed
|
[
"Apache-2.0"
] |
permissive
|
softplush/bitcoinsvj
|
3553cab487bb284be23e35eb71cc3039670df7d5
|
84f7001b655a6a42ac7cde35b280e6475e1b49d8
|
refs/heads/master
| 2022-04-17T07:23:10.334087 | 2020-04-11T08:53:13 | 2020-04-11T08:53:13 | 254,821,168 | 3 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 19,024 |
java
|
/*
* Copyright 2013 Google Inc.
* Copyright 2018 Nicola Atzei
* Copyright 2019 Andreas Schildbach
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.bitcoinj.script;
import org.bitcoinj.core.*;
import org.bitcoinj.crypto.TransactionSignature;
import org.bitcoinj.script.Script.ScriptType;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Stack;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;
import static org.bitcoinj.script.ScriptOpCodes.*;
/**
* <p>Tools for the construction of commonly used script types. You don't normally need this as it's hidden behind
* convenience methods on {@link Transaction}, but they are useful when working with the
* protocol at a lower level.</p>
*/
public class ScriptBuilder {
private List<ScriptChunk> chunks;
/** Creates a fresh ScriptBuilder with an empty program. */
public ScriptBuilder() {
chunks = new LinkedList<>();
}
/** Creates a fresh ScriptBuilder with the given program as the starting point. */
public ScriptBuilder(Script template) {
chunks = new ArrayList<>(template.getChunks());
}
/** Adds the given chunk to the end of the program */
public ScriptBuilder addChunk(ScriptChunk chunk) {
return addChunk(chunks.size(), chunk);
}
/** Adds the given chunk at the given index in the program */
public ScriptBuilder addChunk(int index, ScriptChunk chunk) {
chunks.add(index, chunk);
return this;
}
/** Adds the given opcode to the end of the program. */
public ScriptBuilder op(int opcode) {
return op(chunks.size(), opcode);
}
/** Adds the given opcode to the given index in the program */
public ScriptBuilder op(int index, int opcode) {
checkArgument(opcode > OP_PUSHDATA4);
return addChunk(index, new ScriptChunk(opcode, null));
}
/** Adds a copy of the given byte array as a data element (i.e. PUSHDATA) at the end of the program. */
public ScriptBuilder data(byte[] data) {
if (data.length == 0)
return smallNum(0);
else
return data(chunks.size(), data);
}
/** Adds a copy of the given byte array as a data element (i.e. PUSHDATA) at the given index in the program. */
public ScriptBuilder data(int index, byte[] data) {
// implements BIP62
byte[] copy = Arrays.copyOf(data, data.length);
int opcode;
if (data.length == 0) {
opcode = OP_0;
} else if (data.length == 1) {
byte b = data[0];
if (b >= 1 && b <= 16)
opcode = Script.encodeToOpN(b);
else
opcode = 1;
} else if (data.length < OP_PUSHDATA1) {
opcode = data.length;
} else if (data.length < 256) {
opcode = OP_PUSHDATA1;
} else if (data.length < 65536) {
opcode = OP_PUSHDATA2;
} else {
throw new RuntimeException("Unimplemented");
}
return addChunk(index, new ScriptChunk(opcode, copy));
}
/**
* Adds the given number to the end of the program. Automatically uses
* shortest encoding possible.
*/
public ScriptBuilder number(long num) {
return number(chunks.size(), num);
}
/**
* Adds the given number to the given index in the program. Automatically
* uses shortest encoding possible.
*/
public ScriptBuilder number(int index, long num) {
if (num == -1) {
return op(index, OP_1NEGATE);
} else if (num >= 0 && num <= 16) {
return smallNum(index, (int) num);
} else {
return bigNum(index, num);
}
}
/**
* Adds the given number as a OP_N opcode to the end of the program.
* Only handles values 0-16 inclusive.
*
* @see #number(long)
*/
public ScriptBuilder smallNum(int num) {
return smallNum(chunks.size(), num);
}
/** Adds the given number as a push data chunk.
* This is intended to use for negative numbers or values greater than 16, and although
* it will accept numbers in the range 0-16 inclusive, the encoding would be
* considered non-standard.
*
* @see #number(long)
*/
protected ScriptBuilder bigNum(long num) {
return bigNum(chunks.size(), num);
}
/**
* Adds the given number as a OP_N opcode to the given index in the program.
* Only handles values 0-16 inclusive.
*
* @see #number(long)
*/
public ScriptBuilder smallNum(int index, int num) {
checkArgument(num >= 0, "Cannot encode negative numbers with smallNum");
checkArgument(num <= 16, "Cannot encode numbers larger than 16 with smallNum");
return addChunk(index, new ScriptChunk(Script.encodeToOpN(num), null));
}
/**
* Adds the given number as a push data chunk to the given index in the program.
* This is intended to use for negative numbers or values greater than 16, and although
* it will accept numbers in the range 0-16 inclusive, the encoding would be
* considered non-standard.
*
* @see #number(long)
*/
protected ScriptBuilder bigNum(int index, long num) {
final byte[] data;
if (num == 0) {
data = new byte[0];
} else {
Stack<Byte> result = new Stack<>();
final boolean neg = num < 0;
long absvalue = Math.abs(num);
while (absvalue != 0) {
result.push((byte) (absvalue & 0xff));
absvalue >>= 8;
}
if ((result.peek() & 0x80) != 0) {
// The most significant byte is >= 0x80, so push an extra byte that
// contains just the sign of the value.
result.push((byte) (neg ? 0x80 : 0));
} else if (neg) {
// The most significant byte is < 0x80 and the value is negative,
// set the sign bit so it is subtracted and interpreted as a
// negative when converting back to an integral.
result.push((byte) (result.pop() | 0x80));
}
data = new byte[result.size()];
for (int byteIdx = 0; byteIdx < data.length; byteIdx++) {
data[byteIdx] = result.get(byteIdx);
}
}
// At most the encoded value could take up to 8 bytes, so we don't need
// to use OP_PUSHDATA opcodes
return addChunk(index, new ScriptChunk(data.length, data));
}
/**
* Adds true to the end of the program.
* @return this
*/
public ScriptBuilder opTrue() {
return number(1); // it push OP_1/OP_TRUE
}
/**
* Adds true to the given index in the program.
* @param index at which insert true
* @return this
*/
public ScriptBuilder opTrue(int index) {
return number(index, 1); // push OP_1/OP_TRUE
}
/**
* Adds false to the end of the program.
* @return this
*/
public ScriptBuilder opFalse() {
return number(0); // push OP_0/OP_FALSE
}
/**
* Adds false to the given index in the program.
* @param index at which insert true
* @return this
*/
public ScriptBuilder opFalse(int index) {
return number(index, 0); // push OP_0/OP_FALSE
}
/** Creates a new immutable Script based on the state of the builder. */
public Script build() {
return new Script(chunks);
}
/** Creates an empty script. */
public static Script createEmpty() {
return new ScriptBuilder().build();
}
/** Creates a scriptPubKey that encodes payment to the given address. */
public static Script createOutputScript(Address to) {
if (to instanceof LegacyAddress) {
ScriptType scriptType = to.getOutputScriptType();
if (scriptType == ScriptType.P2PKH)
return createP2PKHOutputScript(to.getHash());
else if (scriptType == ScriptType.P2SH)
return createP2SHOutputScript(to.getHash());
else
throw new IllegalStateException("Cannot handle " + scriptType);
} else {
throw new IllegalStateException("Cannot handle " + to);
}
}
/**
* Creates a scriptSig that can redeem a P2PKH output.
* If given signature is null, incomplete scriptSig will be created with OP_0 instead of signature
*/
public static Script createInputScript(@Nullable TransactionSignature signature, ECKey pubKey) {
byte[] pubkeyBytes = pubKey.getPubKey();
byte[] sigBytes = signature != null ? signature.encodeToBitcoin() : new byte[]{};
return new ScriptBuilder().data(sigBytes).data(pubkeyBytes).build();
}
/**
* Creates a scriptSig that can redeem a P2PK output.
* If given signature is null, incomplete scriptSig will be created with OP_0 instead of signature
*/
public static Script createInputScript(@Nullable TransactionSignature signature) {
byte[] sigBytes = signature != null ? signature.encodeToBitcoin() : new byte[]{};
return new ScriptBuilder().data(sigBytes).build();
}
/** Creates a program that requires at least N of the given keys to sign, using OP_CHECKMULTISIG. */
public static Script createMultiSigOutputScript(int threshold, List<ECKey> pubkeys) {
checkArgument(threshold > 0);
checkArgument(threshold <= pubkeys.size());
checkArgument(pubkeys.size() <= 16); // That's the max we can represent with a single opcode.
ScriptBuilder builder = new ScriptBuilder();
builder.smallNum(threshold);
for (ECKey key : pubkeys) {
builder.data(key.getPubKey());
}
builder.smallNum(pubkeys.size());
builder.op(OP_CHECKMULTISIG);
return builder.build();
}
/** Create a program that satisfies an OP_CHECKMULTISIG program. */
public static Script createMultiSigInputScript(List<TransactionSignature> signatures) {
List<byte[]> sigs = new ArrayList<>(signatures.size());
for (TransactionSignature signature : signatures) {
sigs.add(signature.encodeToBitcoin());
}
return createMultiSigInputScriptBytes(sigs, null);
}
/** Create a program that satisfies an OP_CHECKMULTISIG program. */
public static Script createMultiSigInputScript(TransactionSignature... signatures) {
return createMultiSigInputScript(Arrays.asList(signatures));
}
/** Create a program that satisfies an OP_CHECKMULTISIG program, using pre-encoded signatures. */
public static Script createMultiSigInputScriptBytes(List<byte[]> signatures) {
return createMultiSigInputScriptBytes(signatures, null);
}
/**
* Create a program that satisfies a P2SH OP_CHECKMULTISIG program.
* If given signature list is null, incomplete scriptSig will be created with OP_0 instead of signatures
*/
public static Script createP2SHMultiSigInputScript(@Nullable List<TransactionSignature> signatures,
Script multisigProgram) {
List<byte[]> sigs = new ArrayList<>();
if (signatures == null) {
// create correct number of empty signatures
int numSigs = multisigProgram.getNumberOfSignaturesRequiredToSpend();
for (int i = 0; i < numSigs; i++)
sigs.add(new byte[]{});
} else {
for (TransactionSignature signature : signatures) {
sigs.add(signature.encodeToBitcoin());
}
}
return createMultiSigInputScriptBytes(sigs, multisigProgram.getProgram());
}
/**
* Create a program that satisfies an OP_CHECKMULTISIG program, using pre-encoded signatures.
* Optionally, appends the script program bytes if spending a P2SH output.
*/
public static Script createMultiSigInputScriptBytes(List<byte[]> signatures, @Nullable byte[] multisigProgramBytes) {
checkArgument(signatures.size() <= 16);
ScriptBuilder builder = new ScriptBuilder();
builder.smallNum(0); // Work around a bug in CHECKMULTISIG that is now a required part of the protocol.
for (byte[] signature : signatures)
builder.data(signature);
if (multisigProgramBytes!= null)
builder.data(multisigProgramBytes);
return builder.build();
}
/**
* Returns a copy of the given scriptSig with the signature inserted in the given position.
*
* This function assumes that any missing sigs have OP_0 placeholders. If given scriptSig already has all the signatures
* in place, IllegalArgumentException will be thrown.
*
* @param targetIndex where to insert the signature
* @param sigsPrefixCount how many items to copy verbatim (e.g. initial OP_0 for multisig)
* @param sigsSuffixCount how many items to copy verbatim at end (e.g. redeemScript for P2SH)
*/
public static Script updateScriptWithSignature(Script scriptSig, byte[] signature, int targetIndex,
int sigsPrefixCount, int sigsSuffixCount) {
ScriptBuilder builder = new ScriptBuilder();
List<ScriptChunk> inputChunks = scriptSig.getChunks();
int totalChunks = inputChunks.size();
// Check if we have a place to insert, otherwise just return given scriptSig unchanged.
// We assume here that OP_0 placeholders always go after the sigs, so
// to find if we have sigs missing, we can just check the chunk in latest sig position
boolean hasMissingSigs = inputChunks.get(totalChunks - sigsSuffixCount - 1).equalsOpCode(OP_0);
checkArgument(hasMissingSigs, "ScriptSig is already filled with signatures");
// copy the prefix
for (ScriptChunk chunk: inputChunks.subList(0, sigsPrefixCount))
builder.addChunk(chunk);
// copy the sigs
int pos = 0;
boolean inserted = false;
for (ScriptChunk chunk: inputChunks.subList(sigsPrefixCount, totalChunks - sigsSuffixCount)) {
if (pos == targetIndex) {
inserted = true;
builder.data(signature);
pos++;
}
if (!chunk.equalsOpCode(OP_0)) {
builder.addChunk(chunk);
pos++;
}
}
// add OP_0's if needed, since we skipped them in the previous loop
while (pos < totalChunks - sigsPrefixCount - sigsSuffixCount) {
if (pos == targetIndex) {
inserted = true;
builder.data(signature);
}
else {
builder.addChunk(new ScriptChunk(OP_0, null));
}
pos++;
}
// copy the suffix
for (ScriptChunk chunk: inputChunks.subList(totalChunks - sigsSuffixCount, totalChunks))
builder.addChunk(chunk);
checkState(inserted);
return builder.build();
}
/** Creates a scriptPubKey that encodes payment to the given raw public key. */
public static Script createP2PKOutputScript(byte[] pubKey) {
return new ScriptBuilder().data(pubKey).op(OP_CHECKSIG).build();
}
/** Creates a scriptPubKey that encodes payment to the given raw public key. */
public static Script createP2PKOutputScript(ECKey pubKey) {
return createP2PKOutputScript(pubKey.getPubKey());
}
/**
* Creates a scriptPubKey that sends to the given public key hash.
*/
public static Script createP2PKHOutputScript(byte[] hash) {
checkArgument(hash.length == LegacyAddress.LENGTH);
ScriptBuilder builder = new ScriptBuilder();
builder.op(OP_DUP);
builder.op(OP_HASH160);
builder.data(hash);
builder.op(OP_EQUALVERIFY);
builder.op(OP_CHECKSIG);
return builder.build();
}
/**
* Creates a scriptPubKey that sends to the given public key.
*/
public static Script createP2PKHOutputScript(ECKey key) {
checkArgument(key.isCompressed());
return createP2PKHOutputScript(key.getPubKeyHash());
}
/**
* Creates a scriptPubKey that sends to the given script hash. Read
* <a href="https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki">BIP 16</a> to learn more about this
* kind of script.
*/
public static Script createP2SHOutputScript(byte[] hash) {
checkArgument(hash.length == 20);
return new ScriptBuilder().op(OP_HASH160).data(hash).op(OP_EQUAL).build();
}
/**
* Creates a scriptPubKey for the given redeem script.
*/
public static Script createP2SHOutputScript(Script redeemScript) {
byte[] hash = Utils.sha256hash160(redeemScript.getProgram());
return ScriptBuilder.createP2SHOutputScript(hash);
}
/**
* Creates a P2SH output script with given public keys and threshold. Given public keys will be placed in
* redeem script in the lexicographical sorting order.
*/
public static Script createP2SHOutputScript(int threshold, List<ECKey> pubkeys) {
Script redeemScript = createRedeemScript(threshold, pubkeys);
return createP2SHOutputScript(redeemScript);
}
/**
* Creates redeem script with given public keys and threshold. Given public keys will be placed in
* redeem script in the lexicographical sorting order.
*/
public static Script createRedeemScript(int threshold, List<ECKey> pubkeys) {
pubkeys = new ArrayList<>(pubkeys);
Collections.sort(pubkeys, ECKey.PUBKEY_COMPARATOR);
return ScriptBuilder.createMultiSigOutputScript(threshold, pubkeys);
}
/**
* Creates a script of the form OP_RETURN [data]. This feature allows you to attach a small piece of data (like
* a hash of something stored elsewhere) to a zero valued output which can never be spent and thus does not pollute
* the ledger.
*/
public static Script createOpReturnScript(byte[] data) {
checkArgument(data.length <= 80);
return new ScriptBuilder().op(OP_RETURN).data(data).build();
}
}
|
[
"softplush [at] protonmail.com"
] |
softplush [at] protonmail.com
|
bc84953ee6a302e1c154a0b260aeae5073156d08
|
a7cb75073c644675664a69c8d42070f422d63638
|
/src/cn/itcast/web/util/servlet/registration/RegistrationGetMyYuyueList.java
|
f2c2f3835caf30965feda2064879db380cea8494
|
[] |
no_license
|
master-wang/java-Hospital
|
2b240411cde34d1bf94bc117fb96befaab73f02d
|
b25eff68bfc90073c4478a1180cb73b0bc98cfb9
|
refs/heads/master
| 2020-06-04T05:56:18.314035 | 2019-06-14T07:29:12 | 2019-06-14T07:29:12 | 191,896,644 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,607 |
java
|
package cn.itcast.web.util.servlet.registration;
import cn.itcast.web.util.dao.GragistionDao;
import cn.itcast.web.util.dao.UserDao;
import cn.itcast.web.util.dao.impl.GragistionDaoimpl;
import cn.itcast.web.util.dao.impl.UserDaoimpl;
import cn.itcast.web.util.domain.User;
import com.fasterxml.jackson.databind.ObjectMapper;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@WebServlet("/registrationGetMyYuyueList")
public class RegistrationGetMyYuyueList extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
this.doPost(req,resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
resp.setContentType("application/json;charset=utf-8");
String uu_id = req.getParameter("uu_id");
GragistionDao dao = new GragistionDaoimpl();
List list = dao.GetMyYuyueList(Integer.parseInt(uu_id));
Map<String,Object> mapa = new HashMap<String, Object>();
mapa.put("stadus","ok");
mapa.put("msg","获取我的预约列表");
mapa.put("list",list);
ObjectMapper mapper = new ObjectMapper();
mapper.writeValue(resp.getWriter(),mapa);
}
}
|
[
"[email protected]"
] | |
58ae602abe09746bd3f07bff638c6c0250e38173
|
a70f29c80820d47f3425ff87bdaef94086726ce3
|
/app/src/main/java/com/example/taptargetprompt/MainActivity.java
|
be04c0fa549d0a00208874a155d5931a958f694b
|
[] |
no_license
|
GopichandBandi-5522/TapTargetPrompt
|
32d04f64c7cfd04aa882ff0b4ec06ddbacb570b4
|
9c4553d8ca6135fb659bc2bc7ef39cc5f7d4a436
|
refs/heads/master
| 2023-03-18T06:31:34.317574 | 2021-02-28T18:17:25 | 2021-02-28T18:17:25 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,727 |
java
|
package com.example.taptargetprompt;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.widget.Button;
import com.getkeepsafe.taptargetview.TapTarget;
import com.getkeepsafe.taptargetview.TapTargetView;
public class MainActivity extends AppCompatActivity {
Button secondActivity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
secondActivity = findViewById(R.id.secondActivity);
TapTargetView.showFor(this,
TapTarget.forView(secondActivity,"This is A Button","You will be redirected to sescond activity")
.outerCircleColor(R.color.teal_200)
.outerCircleAlpha(0.96f)
.targetCircleColor(R.color.white)
.titleTextSize(20)
.titleTextColor(R.color.white)
.descriptionTextSize(10)
.descriptionTextColor(R.color.black)
.textColor(R.color.black)
.textTypeface(Typeface.SANS_SERIF)
.dimColor(R.color.black)
.drawShadow(true)
.cancelable(false)
.tintTarget(true)
.transparentTarget(true)
.targetRadius(60),
new TapTargetView.Listener(){
@Override
public void onTargetClick(TapTargetView view) {
super.onTargetClick(view);
Intent i = new Intent(MainActivity.this, com.example.taptargetprompt.secondActivity.class);
startActivity(i);
finish();
}
});
}
}
|
[
"[email protected]"
] | |
0f78dd1e27da15e8e3f1584576daebef93dc56e9
|
991feaa525ead7f6c3ebb63624fcc016c8328014
|
/4、源代码/wdr/src/main/java/com/gpd/wdr/controller/ManagerPagesController.java
|
c086e78061a7c86ee54525eaad10ef81935e51d1
|
[] |
no_license
|
HelloWord-Java/WDR
|
618aec0fa98805c19e9fc5ee1556bd9a9e39eac7
|
cdac99534c5e4ca18490fceec7c51254bc5456f5
|
refs/heads/master
| 2022-12-26T10:09:39.879347 | 2019-10-17T06:42:14 | 2019-10-17T06:42:14 | 215,718,620 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 339 |
java
|
package com.gpd.wdr.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* @author Administrator
*/
@Controller
public class ManagerPagesController {
@RequestMapping("/managerPages")
private String toManager(){
return "managerPages";
}
}
|
[
"[email protected]"
] | |
2cd8485d8ed9ac4fe9118ddd8a862e7038256202
|
4b8b4dd5fe936c5a87d9e6281f5cc609dd286027
|
/src/main/java/org/liukai/DesignPatterns/Behavioral/Observer/AbstractSubject.java
|
fd7cb84e2c4aa12b044e179db376986b5f5b28aa
|
[] |
no_license
|
kai8406/DesignPatterns
|
0426e01c282aa34c0de605392f2e538054d3179b
|
ff3f7c98af9ad379d2356f23943b632dfc016d02
|
refs/heads/master
| 2021-01-25T07:40:04.410168 | 2013-04-26T02:39:58 | 2013-04-26T02:39:58 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,019 |
java
|
package org.liukai.DesignPatterns.Behavioral.Observer;
import java.util.ArrayList;
/**
* 抽象的被观察者,是所有Observer的观察抽象主题
*
* @author liukai
*
*/
public abstract class AbstractSubject {
private ArrayList<Observer> allObservers = new ArrayList<Observer>();
// 添加一个观察者,即添加一个QQ好友
public void addObserver(Observer o) {
this.allObservers.add(o);
}
// 添加一群观察者,即加入一个QQ群
public void addAll(ArrayList<Observer> observers) {
this.allObservers.addAll(observers);
}
// 删除一个观察者,即删除一个QQ好友
public void deleteObserver(Observer o) {
this.allObservers.remove(o);
}
// 删除一群好友,即退出一个QQ群
public void deleteAll() {
this.allObservers = null;
}
// 当我上线时,通知所有QQ好友,即所有Observer
public void notifyObservers(String name) {
for (Observer o : this.allObservers) {
o.update(name);
}
}
}
|
[
"[email protected]"
] | |
aa53ecb831a93edb64cdeab2b420a6250ae73ee6
|
cbb93179f505b394adfbeb0d197e7597bae56635
|
/Builder/src/br/com/hcode/builder/builders/CarBuilder.java
|
de6f5c4e3bf6c590756d2e60486285ac4a7dab98
|
[] |
no_license
|
imerik1/CleanCodeExamples
|
48828e724f630511fb540b2ece48230e4e3df168
|
9c0b0d4dc180026b0e142e426659dbe53294612a
|
refs/heads/main
| 2023-04-09T16:28:22.732505 | 2021-04-15T17:36:45 | 2021-04-15T17:36:45 | 358,315,052 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,017 |
java
|
package br.com.hcode.builder.builders;
import br.com.hcode.builder.cars.Car;
import br.com.hcode.builder.components.CarType;
import br.com.hcode.builder.components.Engine;
import br.com.hcode.builder.components.Transmission;
public class CarBuilder implements IBuilder {
private CarType carType;
private int seats;
private Transmission transmission;
private Engine engine;
private String color;
@Override
public void setCarType(CarType carType) {
this.carType = carType;
}
@Override
public void setSeats(int seats) {
this.seats = seats;
}
@Override
public void setTransmission(Transmission transmission) {
this.transmission = transmission;
}
@Override
public void setEngine(Engine engine) {
this.engine = engine;
}
@Override
public void setColor(String color) {
this.color = color;
}
public Car getresult(){
return new Car(carType, seats, engine, transmission, color);
}
}
|
[
"[email protected]"
] | |
5920e7439cc82a40eaa3066b66678c4a7ff19215
|
01d6d2d4fc6fa254d112d8e248e32ffce1ac3a65
|
/app/src/main/java/com/instance/ceg/appViews/NoSwipeViewPager.java
|
7f6b791b5c3be22ec5aa8397d231ff0af2ed9db6
|
[] |
no_license
|
itsgeniuS/Instance---CEG
|
f878d59163bcc6dbb9df25cab120cf5d23ccbca1
|
a37531c778d3901d368068233598f721fa3c87ef
|
refs/heads/master
| 2022-04-06T16:17:45.630239 | 2020-03-09T19:29:44 | 2020-03-09T19:29:44 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,757 |
java
|
package com.instance.ceg.appViews;
import android.content.Context;
import androidx.viewpager.widget.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Scroller;
import java.lang.reflect.Field;
public class NoSwipeViewPager extends ViewPager {
public NoSwipeViewPager(Context context) {
super(context);
setUpScroller();
}
public NoSwipeViewPager(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
setUpScroller();
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return false;
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
return false;
}
@Override
protected boolean canScroll(View view, boolean checkV, int dx, int x, int y) {
return view != this || !(view instanceof ViewPager);
}
private void setUpScroller() {
try {
Class<?> viewPager = ViewPager.class;
Field scroller = viewPager.getDeclaredField("mScroller");
scroller.setAccessible(true);
scroller.set(this, new MyScroller(getContext()));
} catch (Exception e) {
e.printStackTrace();
}
}
public class MyScroller extends Scroller {
MyScroller(Context context) {
super(context);
}
@Override
public void startScroll(int startX, int startY, int dx, int dy) {
super.startScroll(startX, startY, dx, dy);
}
@Override
public void startScroll(int startX, int startY, int dx, int dy, int duration) {
super.startScroll(startX, startY, dx, dy, duration);
}
}
}
|
[
"[email protected]"
] | |
04770f064dae8ed9624dd7420bf17ab958839f98
|
84c8b918106cb1680b38b8d171bcc656f1c864a9
|
/jOOQ-test/examples/org/jooq/examples/mysql/sakila/tables/SalesByStore.java
|
dbdcfcf9d9159cc4576032edb0850ae650a51328
|
[
"Apache-2.0",
"BSD-3-Clause"
] |
permissive
|
ecruciani/jOOQ
|
dc7ea7445305d92be2141d1248d28bba95e766ad
|
649954e76c06aef5e1db7e39ea4943e8c1d28567
|
refs/heads/master
| 2021-01-17T21:50:32.952999 | 2013-02-04T19:45:49 | 2013-02-04T19:45:49 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,293 |
java
|
/**
* This class is generated by jOOQ
*/
package org.jooq.examples.mysql.sakila.tables;
/**
* This class is generated by jOOQ.
*
* VIEW
*/
@java.lang.SuppressWarnings("all")
public class SalesByStore extends org.jooq.impl.TableImpl<org.jooq.examples.mysql.sakila.tables.records.SalesByStoreRecord> {
private static final long serialVersionUID = 1221491828;
/**
* The singleton instance of <code>sakila.sales_by_store</code>
*/
public static final org.jooq.examples.mysql.sakila.tables.SalesByStore SALES_BY_STORE = new org.jooq.examples.mysql.sakila.tables.SalesByStore();
/**
* The class holding records for this type
*/
@Override
public java.lang.Class<org.jooq.examples.mysql.sakila.tables.records.SalesByStoreRecord> getRecordType() {
return org.jooq.examples.mysql.sakila.tables.records.SalesByStoreRecord.class;
}
/**
* The column <code>sakila.sales_by_store.store</code>.
*/
public final org.jooq.TableField<org.jooq.examples.mysql.sakila.tables.records.SalesByStoreRecord, java.lang.String> STORE = createField("store", org.jooq.impl.SQLDataType.VARCHAR, this);
/**
* The column <code>sakila.sales_by_store.manager</code>.
*/
public final org.jooq.TableField<org.jooq.examples.mysql.sakila.tables.records.SalesByStoreRecord, java.lang.String> MANAGER = createField("manager", org.jooq.impl.SQLDataType.VARCHAR, this);
/**
* The column <code>sakila.sales_by_store.total_sales</code>.
*/
public final org.jooq.TableField<org.jooq.examples.mysql.sakila.tables.records.SalesByStoreRecord, java.math.BigDecimal> TOTAL_SALES = createField("total_sales", org.jooq.impl.SQLDataType.DECIMAL, this);
/**
* Create a <code>sakila.sales_by_store</code> table reference
*/
public SalesByStore() {
super("sales_by_store", org.jooq.examples.mysql.sakila.Sakila.SAKILA);
}
/**
* Create an aliased <code>sakila.sales_by_store</code> table reference
*/
public SalesByStore(java.lang.String alias) {
super(alias, org.jooq.examples.mysql.sakila.Sakila.SAKILA, org.jooq.examples.mysql.sakila.tables.SalesByStore.SALES_BY_STORE);
}
/**
* {@inheritDoc}
*/
@Override
public org.jooq.examples.mysql.sakila.tables.SalesByStore as(java.lang.String alias) {
return new org.jooq.examples.mysql.sakila.tables.SalesByStore(alias);
}
}
|
[
"[email protected]"
] | |
42b258dbc7314046c925206e3e0f0579e0408eef
|
74b47b895b2f739612371f871c7f940502e7165b
|
/aws-java-sdk-s3control/src/main/java/com/amazonaws/services/s3control/model/transform/CreateMultiRegionAccessPointResultStaxUnmarshaller.java
|
1d649013cc31545bb0efe14ba9f27dde3fe6be17
|
[
"Apache-2.0"
] |
permissive
|
baganda07/aws-sdk-java
|
fe1958ed679cd95b4c48f971393bf03eb5512799
|
f19bdb30177106b5d6394223a40a382b87adf742
|
refs/heads/master
| 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 |
Apache-2.0
| 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null |
UTF-8
|
Java
| false | false | 2,654 |
java
|
/*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.s3control.model.transform;
import javax.xml.stream.events.XMLEvent;
import javax.annotation.Generated;
import com.amazonaws.services.s3control.model.*;
import com.amazonaws.transform.Unmarshaller;
import com.amazonaws.transform.StaxUnmarshallerContext;
import com.amazonaws.transform.SimpleTypeStaxUnmarshallers.*;
/**
* CreateMultiRegionAccessPointResult StAX Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CreateMultiRegionAccessPointResultStaxUnmarshaller implements Unmarshaller<CreateMultiRegionAccessPointResult, StaxUnmarshallerContext> {
public CreateMultiRegionAccessPointResult unmarshall(StaxUnmarshallerContext context) throws Exception {
CreateMultiRegionAccessPointResult createMultiRegionAccessPointResult = new CreateMultiRegionAccessPointResult();
int originalDepth = context.getCurrentDepth();
int targetDepth = originalDepth + 1;
if (context.isStartOfDocument())
targetDepth += 1;
while (true) {
XMLEvent xmlEvent = context.nextEvent();
if (xmlEvent.isEndDocument())
return createMultiRegionAccessPointResult;
if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
if (context.testExpression("RequestTokenARN", targetDepth)) {
createMultiRegionAccessPointResult.setRequestTokenARN(StringStaxUnmarshaller.getInstance().unmarshall(context));
continue;
}
} else if (xmlEvent.isEndElement()) {
if (context.getCurrentDepth() < originalDepth) {
return createMultiRegionAccessPointResult;
}
}
}
}
private static CreateMultiRegionAccessPointResultStaxUnmarshaller instance;
public static CreateMultiRegionAccessPointResultStaxUnmarshaller getInstance() {
if (instance == null)
instance = new CreateMultiRegionAccessPointResultStaxUnmarshaller();
return instance;
}
}
|
[
""
] | |
e0feea5f580f1e041524b4e6f3f936a2f0b33945
|
4b97885caecabfd363c77bfedd8a37d71585b062
|
/src/com/bemyapp/memocard/util/MVManager.java
|
6fe15dde24af9d569441d7767cf902727d52a9af
|
[] |
no_license
|
SuperHich/MemoryVision
|
e2dfa6d7f2f2351f80910c52738e9d879f30f3d5
|
67e693aee1d11882f99de57137e787f0604fb44b
|
refs/heads/master
| 2021-01-22T23:58:58.279582 | 2014-07-14T00:44:09 | 2014-07-14T00:44:09 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,887 |
java
|
package com.bemyapp.memocard.util;
import java.util.ArrayList;
import java.util.Random;
import com.bemyapp.memocard.R;
import com.bemyapp.memocard.entity.Card;
public class MVManager {
static MVManager myInstance;
public static MVManager getInstance(){
if(myInstance == null)
myInstance = new MVManager();
return myInstance;
}
public MVManager() {
listeCarte.add(new Card(1, R.drawable.as_c));
listeCarte.add(new Card(2, R.drawable.deux_c));
listeCarte.add(new Card(3, R.drawable.trois_c));
listeCarte.add(new Card(4, R.drawable.quatre_c));
listeCarte.add(new Card(5, R.drawable.cinq_c));
listeCarte.add(new Card(6, R.drawable.six_c));
listeCarte.add(new Card(7, R.drawable.sept_c));
listeCarte.add(new Card(8, R.drawable.huit_c));
listeCarte.add(new Card(9, R.drawable.neuf_c));
listeCarte.add(new Card(10, R.drawable.dix_c));
listeCarte.add(new Card(11, R.drawable.valet_c));
listeCarte.add(new Card(12, R.drawable.dame_c));
listeCarte.add(new Card(13, R.drawable.roi_c));
listeCarte.add(new Card(14, R.drawable.as_p));
listeCarte.add(new Card(15, R.drawable.deux_p));
listeCarte.add(new Card(16, R.drawable.trois_p));
listeCarte.add(new Card(17, R.drawable.quatre_p));
listeCarte.add(new Card(18, R.drawable.cinq_p));
listeCarte.add(new Card(19, R.drawable.six_p));
listeCarte.add(new Card(20, R.drawable.huit_p));
listeCarte.add(new Card(21, R.drawable.neuf_p));
listeCarte.add(new Card(22, R.drawable.dix_p));
listeCarte.add(new Card(23, R.drawable.valet_p));
listeCarte.add(new Card(24, R.drawable.dame_p));
listeCarte.add(new Card(25, R.drawable.roi_p));
listeCarte.add(new Card(26, R.drawable.as_co));
listeCarte.add(new Card(27, R.drawable.deux_co));
listeCarte.add(new Card(28, R.drawable.trois_co));
listeCarte.add(new Card(29, R.drawable.quatre_co));
listeCarte.add(new Card(30, R.drawable.cinq_co));
listeCarte.add(new Card(31, R.drawable.six_co));
listeCarte.add(new Card(32, R.drawable.sept_co));
listeCarte.add(new Card(33, R.drawable.huit_co));
listeCarte.add(new Card(34, R.drawable.neuf_co));
listeCarte.add(new Card(35, R.drawable.dix_co));
listeCarte.add(new Card(36, R.drawable.valet_co));
listeCarte.add(new Card(37, R.drawable.dame_co));
listeCarte.add(new Card(38, R.drawable.roi_co));
listeCarte.add(new Card(39, R.drawable.as_t));
listeCarte.add(new Card(40, R.drawable.deux_t));
listeCarte.add(new Card(41, R.drawable.trois_t));
listeCarte.add(new Card(42, R.drawable.quatre_t));
listeCarte.add(new Card(43, R.drawable.cinq_t));
listeCarte.add(new Card(44, R.drawable.six_t));
listeCarte.add(new Card(45, R.drawable.sept_t));
listeCarte.add(new Card(46, R.drawable.huit_t));
listeCarte.add(new Card(47, R.drawable.neuf_t));
listeCarte.add(new Card(48, R.drawable.dix_t));
listeCarte.add(new Card(49, R.drawable.valet_t));
listeCarte.add(new Card(50, R.drawable.dame_t));
listeCarte.add(new Card(51, R.drawable.roi_t));
}
public ArrayList<Card> listeCarte=new ArrayList<Card>();
public ArrayList<Card> getListeCarte() {
return listeCarte;
}
public void setListeCarte(ArrayList<Card> listeCarte) {
this.listeCarte = listeCarte;
}
public ArrayList<Card> getList(int nbr)
{
ArrayList<Card> listReturn = new ArrayList<Card>();
int size=listeCarte.size();
for(int i=0;i<nbr;i++)
{
Random r = new Random();
int valeur = 1 + r.nextInt(size - 1);
try {
Card c = (Card)(listeCarte.get(valeur).clone());
listReturn.add(c);
} catch (CloneNotSupportedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return listReturn;
}
public ArrayList<Card> getDefaultList(int nbr)
{
ArrayList<Card> listReturn=new ArrayList<Card>();
for(int i=0;i<nbr;i++)
{
Card c=new Card(0, R.drawable.renverser);
listReturn.add(c);
}
return listReturn;
}
}
|
[
"[email protected]"
] | |
290a61ad60584604595055f02d4d7cf0729a4dca
|
480452a88088a13258b8af250eec538b79a5f3d8
|
/src/classes/Hacktendo/AttributeSelectorPanel.java
|
ca40eb4ce1e93a51b606946e5cb9542da2af998b
|
[
"ISC"
] |
permissive
|
Demannu/hackwars-classic
|
9946fb376e9ef3a593adce72611bc3f9b1c91ffc
|
76b18debd074aa6e89feb8595a3bee1cb0c1d93e
|
refs/heads/master
| 2021-01-18T13:26:22.788112 | 2015-12-16T05:11:27 | 2015-12-16T05:11:27 | 48,079,389 | 0 | 0 | null | 2015-12-16T01:29:25 | 2015-12-16T01:29:25 | null |
UTF-8
|
Java
| false | false | 5,727 |
java
|
/*
Programmer: Ben Coe.(2007)<br />
This creates a panel that can be used to modify face control points.
*/
package Hacktendo;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.glu.*;
import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCanvas;
import javax.media.opengl.GLEventListener;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import com.sun.opengl.util.GLUT;
import Assignments.*;
import View.*;
import java.text.*;
import java.math.*;
import Browser.*;
import Game.*;
//Stuff borrowed from Hacktendo.
import javax.swing.*;
import java.awt.*;
import java.awt.image.*;
import util.*;
import java.io.*;
import java.awt.geom.*;
import java.awt.event.*;
import java.util.concurrent.Semaphore;
import GUI.Sound;
import javax.imageio.*;
import GUI.ImageLoader;
import GUI.Hacker;
import View.*;
import Assignments.*;
import java.util.*;
import Hacktendo.*;
import Game.MMO.*;
import java.util.Map;
import com.sun.opengl.util.*;
import com.sun.opengl.util.texture.*;
import com.plink.Hack3D.*;
public class AttributeSelectorPanel extends JTabbedPane implements AdjustmentListener{
private JScrollBar Selectors[]=new JScrollBar[9];
private static final String labels[]=new String[]{"Movement X:","Movement Y:","Movement Z:","Scale X:","Scale Y:","Scale Z:","Rotation X:","Rotation Y:","Rotation Z"};
private SpriteFace MySpriteFace=null;
private String Component="";
private float moveX=50.0f;
private float moveY=50.0f;
private float moveZ=50.0f;
private float rotateX=50.0f;
private float rotateY=50.0f;
private float rotateZ=50.0f;
private float scaleX=50.0f;
private float scaleY=50.0f;
private float scaleZ=50.0f;
private boolean root=false;
private AttributeSelectorPanel Parent=null;
private ArrayList Children=new ArrayList();
//Constructor.
public AttributeSelectorPanel(String Component,SpriteFace MySpriteFace,AttributeSelectorPanel Parent){
if(Parent==null){
root=true;
this.Parent=this;
}else
this.Parent=Parent;
this.MySpriteFace=MySpriteFace;
this.Component=Component;
JPanel DefaultPanel=new JPanel();
DefaultPanel.setLayout(new BoxLayout(DefaultPanel,BoxLayout.Y_AXIS));
DefaultPanel.setVisible(true);
for(int i=0;i<Selectors.length;i++){
Selectors[i]=new JScrollBar(JScrollBar.HORIZONTAL,50,1,0,100);
DefaultPanel.add(new JLabel(labels[i]));
DefaultPanel.add(Selectors[i]);
Selectors[i].addAdjustmentListener(this);
}
JScrollPane MyScrollPane=new JScrollPane(DefaultPanel);
MyScrollPane.setVisible(true);
MyScrollPane.setBounds(0,0,200,350);
MyScrollPane.getViewport().add(DefaultPanel);
this.addTab("Default",null,MyScrollPane,"");
if(MySpriteFace.getControlGroups(Component)!=null){
addSubPanel();
}
this.setPreferredSize(new Dimension(150,350));
}
/**
Add a sub-panel to this widget.
*/
public void addSubPanel(){
JPanel AttributeFrame=new JPanel();
AttributeFrame.setLayout(new BoxLayout(AttributeFrame,BoxLayout.Y_AXIS));
JScrollPane ScrollPane=new JScrollPane();
HashMap ControlGroups=MySpriteFace.getControlGroups(Component);
Iterator MyIterator=ControlGroups.entrySet().iterator();
int i=0;
JPanel BigPanel=new JPanel();
BigPanel.setLayout(new BoxLayout(BigPanel,BoxLayout.Y_AXIS));
BigPanel.setVisible(true);
while(MyIterator.hasNext()){
Map.Entry MyEntry=(Map.Entry)MyIterator.next();
AttributeSelectorPanel ASP=new AttributeSelectorPanel(MySpriteFace.getGroupName(MyEntry.getValue()),MySpriteFace,Parent);
Children.add(ASP);
ASP.setVisible(true);
BigPanel.add(new JLabel("<html><h2>"+MySpriteFace.getGroupName(MyEntry.getValue())+"</h2></html>"));
BigPanel.add(ASP);
i++;
}
ScrollPane.getViewport().add(BigPanel);
ScrollPane.setVisible(true);
ScrollPane.setBounds(0,0,200,350);
AttributeFrame.add(ScrollPane);
AttributeFrame.setBounds(0,0,200,350);
AttributeFrame.setVisible(true);
this.addTab("More Options",AttributeFrame);
}
public void applyTransformation(){
if(root)
MySpriteFace.resetComponent(Component);
float tmoveX=(moveX-50.0f)/20.0f;
float tmoveY=(moveY-50.0f)/20.0f;
float tmoveZ=(moveZ-50.0f)/20.0f;
MySpriteFace.move(Component,tmoveX,tmoveY,tmoveZ);
float tscaleX=(scaleX-50.0f)/20.0f+1.0f;
float tscaleY=(scaleY-50.0f)/20.0f+1.0f;
float tscaleZ=(scaleZ-50.0f)/20.0f+1.0f;
MySpriteFace.scale(Component,tscaleX,tscaleY,tscaleZ);
float trotateX=(rotateX-50.0f)*3.6f;
float trotateY=(rotateY-50.0f)*3.6f;
float trotateZ=(rotateZ-50.0f)*3.6f;
MySpriteFace.rotate(Component,trotateX,trotateY,trotateZ);
for(int i=0;i<Children.size();i++){
AttributeSelectorPanel ASP=(AttributeSelectorPanel)Children.get(i);
ASP.applyTransformation();
}
}
//Action listeners.
public void adjustmentValueChanged(AdjustmentEvent ae){
moveX=(float)Selectors[0].getValue();
moveY=(float)Selectors[1].getValue();
moveZ=(float)Selectors[2].getValue();
scaleX=(float)Selectors[3].getValue();
scaleY=(float)Selectors[4].getValue();
scaleZ=(float)Selectors[5].getValue();
rotateX=(float)Selectors[6].getValue();
rotateY=(float)Selectors[7].getValue();
rotateZ=(float)Selectors[8].getValue();
Parent.applyTransformation();
}
//Testing main.
public static void main(String args[]){
/* JFrame MyFrame=new JFrame();
AttributeSelectorPanel ASP=new AttributeSelectorPanel("Hello World:",null);
ASP.setVisible(true);
MyFrame.add(ASP);
MyFrame.pack();
MyFrame.setVisible(true);*/
}
}//END.
|
[
"[email protected]"
] | |
fff01ca5d661c81455d3c88276de00f524f5e4bd
|
b0a2619c31e70015ad8c7bdadca5c9cd4256235b
|
/beer-brewery/src/main/java/com/springframework/habtom/microservice/beerbrewery/web/models/v2/BeerDtov2.java
|
3ca2de73b2d1cf1fb7901a81d52e1b3ba1bc117f
|
[] |
no_license
|
habtom-wmichael/microservices-springcloud-Beer
|
2f07da347af28b9bedb8408abaf764fa7c0d743c
|
ef655645760c59827ec9f35b89eaa03fe79cdaab
|
refs/heads/master
| 2022-11-10T21:48:42.018913 | 2020-07-07T15:53:09 | 2020-07-07T15:53:09 | 276,971,589 | 0 | 0 | null | 2020-07-07T15:53:10 | 2020-07-03T19:16:29 |
Java
|
UTF-8
|
Java
| false | false | 654 |
java
|
package com.springframework.habtom.microservice.beerbrewery.web.models.v2;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import javax.validation.constraints.Size;
import java.util.UUID;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class BeerDtov2 {
@NotNull
private UUID beerId;
@NotBlank
@Size(min = 3, max = 30)
private String beerName;
private BeerStyleEnum beerStyle;
@Positive
private Long upc;
}
|
[
"[email protected]"
] | |
9c5e19d240d70d133b6175de15c9f044f2fee8b2
|
c3de0b004e84d50cd73c01c0460a33984a2a7c93
|
/src/main/java/br/com/sankhya/dao/DaoFactory.java
|
ea23831df6b0c5d6e4260fb3fb665b1462cfc03d
|
[] |
no_license
|
IltonBJSilva/sistema-turistico
|
612544df402a3b17f2e4ae45557b6ba19d2d23ff
|
36c0987bb697258a005baa6862b0e7bf89aa37fc
|
refs/heads/master
| 2022-07-15T20:59:34.067528 | 2019-07-05T20:43:11 | 2019-07-05T20:43:11 | 186,694,058 | 0 | 0 | null | 2022-06-21T01:07:45 | 2019-05-14T20:19:04 |
Java
|
UTF-8
|
Java
| false | false | 831 |
java
|
package br.com.sankhya.dao;
import br.com.sankhya.dao.daoImpl.ClienteDaoImpl;
import br.com.sankhya.dao.daoImpl.ContratoDaoImpl;
import br.com.sankhya.dao.daoImpl.HotelDaoImpl;
import br.com.sankhya.dao.daoImpl.ItemDaoImpl;
import br.com.sankhya.dao.daoImpl.PacoteDaoImpl;
import br.com.sankhya.dao.daoImpl.PasseioDaoImpl;
public class DaoFactory {
public static ContratoDao criarContratoDao() {
return new ContratoDaoImpl();
}
public static HotelDao criarHotelDao() {
return new HotelDaoImpl();
}
public static ItemDao criarItemDao() {
return new ItemDaoImpl();
}
public static PasseioDao criarPasseioDao() {
return new PasseioDaoImpl();
}
public static PacoteDao criarPacoteDao() {
return new PacoteDaoImpl();
}
public static ClienteDao criarClienteDao() {
return new ClienteDaoImpl();
}
}
|
[
"[email protected]"
] | |
a7b81522a4ef2ca7a2fdff68379d9857cdbdeccb
|
1769103d539f1174f4b2de80e9d3c118dad363af
|
/src/forms/Reset.java
|
d3f8f624719c6605be9eed51369bf9d4a37f615c
|
[] |
no_license
|
mooncollin/HTMLRenderingTool
|
deac1dc56ef26681776d6b7b761f619695856c03
|
af1b6070206dc91c85290099bca91b2d1efa2ad6
|
refs/heads/master
| 2020-04-22T01:16:20.809477 | 2019-12-01T06:35:21 | 2019-12-01T06:35:21 | 170,009,341 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 224 |
java
|
package forms;
/**
* This class represents a reset input.
* @author colli
*
*/
public class Reset extends Input
{
/**
* Constructor. Creates an input of type "reset".
*/
public Reset()
{
setType("reset");
}
}
|
[
"[email protected]"
] | |
ce039c6ed460d3eef674e3bc0e73bb7b280b656d
|
b407c6bbbcbaea2d8aab99ef693ae166bf22dafe
|
/src/main/java/com/lx/lucene/index/manager/IndexManager.java
|
d05af8805c7392d0e381d505ce8739ef47d22896
|
[] |
no_license
|
lixin901230/lucene_demo
|
d32254a68d102f11b9e093e5d42f5ecbd808110b
|
d07ea47638754c2a2ecbc38c5405262e7b656826
|
refs/heads/master
| 2020-12-25T17:13:05.034872 | 2017-01-21T07:49:50 | 2017-01-21T07:49:50 | 56,166,026 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 16,312 |
java
|
package com.lx.lucene.index.manager;
import java.io.IOException;
import java.io.StringReader;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.cn.smart.SmartChineseAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.IndexableField;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TrackingIndexWriter;
import org.apache.lucene.search.ControlledRealTimeReopenThread;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.SearcherFactory;
import org.apache.lucene.search.SearcherManager;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.search.highlight.Fragmenter;
import org.apache.lucene.search.highlight.Highlighter;
import org.apache.lucene.search.highlight.QueryScorer;
import org.apache.lucene.search.highlight.SimpleHTMLFormatter;
import org.apache.lucene.search.highlight.SimpleSpanFragmenter;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.store.RAMDirectory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.lx.lucene.index.nrtsearch.NRTSearchManager;
import com.lx.util.CommonUtils;
import com.lx.util.FileUtils;
/**
* <b>本近实时搜索类废弃,关于近实时搜索请参考完整示例类{@link NRTSearchManager}</b></br><br/>
* 索引管理<br/><br/>
* 注:<b> 支持近实时搜索 </b>,
* 即索引更新但未提交写入硬盘只是flush到缓冲区中,也能进行搜索,这样减少commit次数节省资源消耗,并由一定的提交策略提交缓冲区的索引写入硬盘<br/>
* 比{@link LuceneManager}性能更好,因为{@link LuceneManager}类中每次索引操作都会commit提交索引写入硬盘,很耗费资源<br/><br/>
*
* 使用{@link SearcherManager}实现原理:<br/>
* 只有IndexWriter上的commit操作才会导致{@link RAMDirectory}上的数据完全同步到文件。IndexWriter提供了实时获得reader的API,
* 这个调用将导致flush操作,生成新的segment,但不会commit(fsync),从而减少 了IO。新的segment被加入到新生成的reader里。
* 从返回的reader里,可以看到更新。所以,只要每次新的搜索都从IndexWriter获得一个新的reader,就可以搜索到最新的内容。
* 这一操作的开销仅仅是flush,相对commit来说,开销很小。Lucene的index组织方式为一个index目录下的多个segment。
* 新的doc会加入新的segment里,这些新的小segment每隔一段时间就合并起来。因为合并,总的segment数量保持的较小,总体search速度仍然很快。
* 为了防止读写冲突,lucene只创建新的segment,并在任何active的reader不在使用后删除掉老的segment。
* flush是把数据写入到操作系统的缓冲区,只要缓冲区不满,就不会有硬盘操作。
* commit是把所有内存缓冲区的数据写入到硬盘,是完全的硬盘操作。
* 重量级操作。这是因为,Lucene索引中最主要的结构posting通过VINT和delta的格式存储并紧密排列。
* 合并时要对同一个term的posting进行归并排序,是一个读出,合并再生成的过程
*
* @author lx
*/
@Deprecated
public class IndexManager {
private Logger logger = LoggerFactory.getLogger(getClass());
private IndexWriter writer;
private SearcherManager manager;
/*
* 用TrackingIndexWriter类来包装IndexWriter,这样IndexWriter的索引操作委派给TrackingIndexWriter提供的索引添删改API来操作索引,
* 这样可以在IndexWriter未commit提交的情况下也能在ControlledRealTimeReopenThread中及时反应出来索引的变更,
* 这样在索引变更但未提交的情况下, 就能实现近实时搜索(之所以这样处理,因为IndexWriter的commit提交操作非常消耗资源,
* 所以在生产环境中应该想一个比较好的索引更新提交策略;
* 比如:1、定时提交,通过定时任务每隔一段时间后commit一下内存中变更的索引文档;2、定时合并内存索引与硬盘索引)
*/
private TrackingIndexWriter tkWriter;
private ControlledRealTimeReopenThread<IndexSearcher> crtThread;
/**
* 测试
* @param args
*/
public static void main(String[] args) {
IndexManager indexManager = new IndexManager();
String fieldName = "content";
String fieldValue = "橘子";
List<Map<String, Object>> searchResult = indexManager.search(fieldName, fieldValue, true);
System.out.println(searchResult);
}
public IndexManager() {
try {
String indexPath = getIndexDirPath();
Directory directory = FSDirectory.open(Paths.get(indexPath));
Analyzer analyzer = new SmartChineseAnalyzer();
IndexWriterConfig writerConfig = new IndexWriterConfig(analyzer);
writer = new IndexWriter(directory, writerConfig);
manager = new SearcherManager(directory, new SearcherFactory()); //true 表示在内存中删除,false可能删可能不删,设为false性能会更好一些
tkWriter = new TrackingIndexWriter(writer); //为writer 包装了一层
//ControlledRealTimeReopenThread,主要将writer装,每个方法都没有commit 操作。
//内存索引重读线程(即启动SearcherManager的maybeRefresh()线程,继续索引重读)
crtThread = new ControlledRealTimeReopenThread<IndexSearcher>(tkWriter, manager, 5.0, 0.025);
crtThread.setDaemon(true); //设置indexSearcher的守护线程
crtThread.setName("Controlled Real Time Reopen Thread");
crtThread.start();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 对单条记录数据创建索引<br/>
* <b>注意:该map中的元素只能是简单类型</b>
* @param dbRowMap 需要创建索引的数据(该map相当于数据库中查出来的一条记录或一个数据bean)
* @param noAnalyzerFields 不需要进行分词的属性名称(如ID属性不需要进行分词,否则修改、删除时无法根据ID查找需要修改或删除的索引文档)
*/
public void addIndex(Map<String, Object> dbRowMap, String...noAnalyzerFields) {
try {
// 通过TrackingIndexWriter提供的api操作索引
Document doc = getDocument(dbRowMap, noAnalyzerFields);
tkWriter.addDocument(doc);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 对单条记录数据创建索引<br/>
* 依赖{@link CommonUtils#beanToMap(Object)}
* @param object 需要创建索引的数据对象
* @param noAnalyzerFields 不需要进行分词的属性名称(如ID属性不需要进行分词,否则修改、删除时无法根据ID查找需要修改或删除的索引文档)
*/
public void addIndex(Object object, String...noAnalyzerFields) {
Map<String, Object> dbRowMap = CommonUtils.beanToMap(object);
addIndex(dbRowMap, noAnalyzerFields);
}
/**
* 搜索
* @param fieldName 需要修改的索引文档的词条属性名称
* @param fieldValue 需要修改的索引文档的词条属性名称
* @param isHighlight 是否对搜索结果关键字进行高亮显示处理;true:高亮显示;false:不高亮显示
* @return
*/
public List<Map<String, Object>> search(String fieldName, String fieldValue, boolean isHighlight) {
List<Map<String, Object>> resultEntrys = new ArrayList<Map<String, Object>>();
IndexSearcher searcher = null;
try {
manager.maybeRefresh(); //更新看看内存中索引是否有变化如果有一个更新了,其他线程也会更新
searcher = manager.acquire(); //利用acquire 方法获取search,执行此方法前须执行maybeRefresh
Term term = new Term(fieldName, fieldValue);
Query query = new TermQuery(term);
TopDocs topDocs = searcher.search(query, 10);
logger.info(">>>>>>搜索到"+ topDocs.totalHits +"条记录");
List<Document> documents = new ArrayList<Document>();
ScoreDoc[] scoreDocs = topDocs.scoreDocs;
for (ScoreDoc scoreDoc : scoreDocs) {
Document doc = searcher.doc(scoreDoc.doc);
documents.add(doc);
}
if(isHighlight) {
Analyzer analyzer = new SmartChineseAnalyzer();
resultEntrys = handleSearchResultHighlight(documents, query, analyzer);
} else {
resultEntrys = handleSearchResult(documents);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if(searcher != null) {
try {
manager.release(searcher); //释放searcher
} catch (IOException e) {
e.printStackTrace();
}
}
}
return resultEntrys;
}
/**
* 处理搜索到的文档
* @param documents 文档集合
* @return
*/
public List<Map<String, Object>> handleSearchResult(List<Document> documents) throws Exception {
List<Map<String, Object>> resultEntrys = new ArrayList<Map<String, Object>>();
for (Document doc : documents) {
Map<String, Object> resultEntryMap = new HashMap<String, Object>();
List<IndexableField> fields = doc.getFields();
for (IndexableField field : fields) {
String _fieldName = field.name();
String _fieldValue = doc.get(_fieldName);
resultEntryMap.put(_fieldName, _fieldValue);
}
resultEntrys.add(resultEntryMap);
}
return resultEntrys;
}
/**
* 处理搜索到的文档,并对搜索结果进行高亮显示处理
* @param documents 文档集合
* @param query
* @param analyzer 若未传分词器,则默认使用lucene自带的中文分词器{@link SmartChineseAnalyzer}
* @return
* @throws Exception
*/
public List<Map<String, Object>> handleSearchResultHighlight(List<Document> documents, Query query, Analyzer analyzer) throws Exception {
if(analyzer == null) {
analyzer = new SmartChineseAnalyzer();
}
List<Map<String, Object>> resultEntrys = new ArrayList<Map<String, Object>>();
for (Document doc : documents) {
Map<String, Object> resultEntryMap = new HashMap<String, Object>();
List<IndexableField> fields = doc.getFields();
for (IndexableField field : fields) {
String _fieldName = field.name();
String _fieldValue = doc.get(_fieldName);
String highlighterResult = highlightFormat(_fieldName, _fieldValue, query, analyzer);
if(highlighterResult != null) {
resultEntryMap.put(_fieldName, highlighterResult);
} else {
resultEntryMap.put(_fieldName, _fieldValue);
}
}
resultEntrys.add(resultEntryMap);
}
return resultEntrys;
}
/**
* 高亮处理<br/>
* 搜索结果中的搜索关键字进行高亮显示处理
* @param field 取值时的属性名称
* @param content 根据field取出的值内容
* @param query 搜索时使用的查询对象
* @param analyzer 分词器
* @return
* @throws Exception
*/
public static String highlightFormat(String field, String content, Query query, Analyzer analyzer) throws Exception {
QueryScorer queryScorer = new QueryScorer(query, field);
Fragmenter fragmenter = new SimpleSpanFragmenter(queryScorer);
SimpleHTMLFormatter simpleHTMLFormatter = new SimpleHTMLFormatter("<span style=\"color:red;\">", "</span>");
Highlighter highlighter = new Highlighter(simpleHTMLFormatter, queryScorer);
highlighter.setTextFragmenter(fragmenter);
TokenStream tokenStream = analyzer.tokenStream(field, new StringReader(content));
String highlighterResult = highlighter.getBestFragment(tokenStream, content);
return highlighterResult;
}
/**
* 根据数据库记录集合创建索引文档对象
* @param dbRow 一个
* @param noAnalyzerFields 不需要进行分词的属性名称
* @return
*/
public Document getDocument(Map<String, Object> dbRow, String...noAnalyzerFields) {
List<Map<String, Object>> dbRows = new ArrayList<Map<String, Object>>();
dbRows.add(dbRow);
List<Document> documents = getDocuments(dbRows, noAnalyzerFields);
Document doc = documents.get(0);
return doc;
}
/**
* 根据数据库记录集合创建索引文档对象
* @param dbRows 一个含Map类型元素的List集合,每个Map对应数据库一条记录,map中的买个元素对应数据库中的一个字段(或对象的一个属性)
* @param noAnalyzerFields 不需要进行分词的属性名称
* @return
*/
public List<Document> getDocuments(List<Map<String, Object>> dbRows, String...noAnalyzerFields) {
List<Document> docs = new ArrayList<Document>();
for (Map<String, Object> rowMap : dbRows) {
Document doc = new Document();
Set<String> keys = rowMap.keySet();
for (String key : keys) {
Field field = null;
Object value = rowMap.get(key);
if (value != null) {
field = getField(key, value, noAnalyzerFields);
}
if(field != null) {
doc.add(field);
}
}
docs.add(doc);
}
return docs;
}
/**
* 创建域
* @param key 域名称
* @param value 域值
* @param noAnalyzerFields 不需要进行分词的属性名称
* @return
*/
public Field getField(String key, Object value, String...noAnalyzerFields) {
Field field = null;
FieldType type = new FieldType();
if(noAnalyzerFields != null && noAnalyzerFields.length > 0) {
for (String _field : noAnalyzerFields) {
if(_field.equalsIgnoreCase(key)) {
type.setTokenized(false);
}
}
}
type.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);
type.setStored(true);
field = new Field(key, value.toString(), type);
/*if (value instanceof java.lang.Character) {
field = new TextField(key, value.toString(), Field.Store.YES);
} else if (value instanceof java.lang.Boolean) {
field = new StringField(key, value.toString(), Field.Store.YES);
} else if (value instanceof java.lang.Integer) {
field = new IntField(key, (Integer) value, Field.Store.YES);
} else if (value instanceof java.lang.Long) {
field = new LongField(key, (Long) value, Field.Store.YES);
} else if (value instanceof java.util.Date) {
field = new LongField(key, ((java.util.Date) value).getTime(), Field.Store.YES);
} else if (value instanceof java.sql.Date) {
field = new LongField(key, ((java.sql.Date) value).getTime(), Field.Store.YES);
} else if (value instanceof java.lang.String) {
field = new TextField(key, value.toString(), Field.Store.YES);
} else if (value instanceof java.lang.Double) {
field = new DoubleField(key, (Double) value, Field.Store.YES);
} else if (value instanceof java.lang.Byte) {
//field = new DoubleField(key, (Byte) value, Field.Store.YES);
} else if (value instanceof java.lang.Float) {
field = new FloatField(key, (Float) value, Field.Store.YES);
} else if (value instanceof java.lang.Short) {
field = new IntField(key, (Short) value, Field.Store.YES);
} else {
field = new StringField(key, value.toString(), Field.Store.YES);
}*/
return field;
}
/**
* 获取索引存储路径
* @return
*/
public static String getIndexDirPath() {
String webappPath = FileUtils.getWebappPath();
webappPath = webappPath.endsWith("/") ? webappPath : webappPath + "/";
String indexDirPath = webappPath + "luceneData/luceneIndex"; //索引存放路径
return indexDirPath; //索引存放路径;
}
}
|
[
"[email protected]"
] | |
42e059888ed0cc85b15bdf93bc2489ed2bfa4b54
|
c92ea80b42c1d3c3d2fa6ad0ce99112331c7e264
|
/app/src/main/java/ru/taaasty/ui/post/PhotoSourceManager.java
|
dc26b0b0ea9109b2faf5e2ac46300e8a392c2fbf
|
[] |
no_license
|
genueee/taaasty-android
|
2c7c9e85553fb20b8e81bbbcc40fdadbdbdc48c6
|
7a8a8e0657352e939e7b72fe849c85546add603f
|
refs/heads/master
| 2021-01-11T06:09:11.888599 | 2016-05-23T10:32:17 | 2016-05-23T10:32:17 | 21,242,627 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 18,926 |
java
|
package ru.taaasty.ui.post;
import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import com.adobe.creativesdk.aviary.AdobeImageIntent;
import java.io.File;
import ru.taaasty.BuildConfig;
import ru.taaasty.Constants;
import ru.taaasty.R;
import ru.taaasty.utils.AnalyticsHelper;
import ru.taaasty.utils.ImageUtils;
import ru.taaasty.utils.MessageHelper;
public class PhotoSourceManager {
public static final int START_ACTIVITY_FOR_RESULT_REQUIRED_IDS = 5;
public static final int PERMISSION_REQUEST_REQUIRED_IDS = 5;
private static final int REQUEST_PICK_PHOTO = 0;
private static final int REQUEST_MAKE_PHOTO = 1;
private static final int REQUEST_FEATHER_PHOTO = 2;
private static final boolean REMOVE_ORIGINAL_AFTER_EDIT = true;
private static final int PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE_MAKE_PHOTO = 0;
private static final int PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE_FEATHER_PHOTO = 1;
private static final String KEY_MAKE_PHOTO_DST_URI = "ru.taaasty.ui.post.PhotoSourceManager.KEY_MAKE_PHOTO_DST_URI";
private static final String KEY_FEATHER_PHOTO_URI = "ru.taaasty.ui.post.PhotoSourceManager.KEY_FEATHER_PHOTO_URI";
private static final String KEY_IMAGE_EDITOR_EXTRAS_ORIGINAL_URI = "ru.taaasty.ui.post.PhotoSourceManager.KEY_IMAGE_EDITOR_EXTRAS_ORIGINAL_URI";
private static final String KEY_IMAGE_EDITOR_DISPATCH_ORIGINAL_URI_ON_FAIL = "ru.taaasty.ui.post.PhotoSourceManager.KEY_IMAGE_EDITOR_DISPATCH_ORIGINAL_URI_ON_FAIL";
private static final String TAG = "PhotoSourceManager";
private static final boolean DBG = BuildConfig.DEBUG;
@Nullable
private final Fragment mFragment;
@Nullable
private final Activity mActivity;
private final String mUniqPrefix;
private final int mStartActivityForResultBase;
private final int mRequestPermissionBase;
@Nullable
private final View mSnackbarRootView;
private final Callbacks mCallbacks;
// URI, который передан в MediaStore.EXRA_OUTPUT_PATH при вызове приложения камеры.
@Nullable
private Uri mMakePhotoDstUri;
// URI фотографии, для которой запрошено редактирование. Только для сохранения если вдруг
// приложение будет перезапущено во время запроса необходимых разрешений
@Nullable
private Uri mFeatherPhotoUri;
public interface Callbacks {
void onNewImageUriReceived(Uri uri);
}
public PhotoSourceManager(Fragment fragment, String uniqPrefix, Callbacks callbacks) {
this(fragment, uniqPrefix, Activity.RESULT_FIRST_USER+100, 35683, null, callbacks);
}
public PhotoSourceManager(Object fragmentOrActivity,
@Nullable String uniqPrefix,
int startActivityFoResultBase,
int permissionRequestBase,
@Nullable View snackbarRootView,
Callbacks callbacks) {
if (fragmentOrActivity instanceof Fragment) {
mFragment = (Fragment)fragmentOrActivity;
mActivity = null;
} else if (fragmentOrActivity instanceof Activity) {
mFragment = null;
mActivity = (Activity)fragmentOrActivity;
} else {
throw new IllegalArgumentException("Should be Fragment or Activity");
}
mCallbacks = callbacks;
mUniqPrefix = uniqPrefix == null ? "" : uniqPrefix;
mStartActivityForResultBase = startActivityFoResultBase;
mSnackbarRootView = snackbarRootView;
mRequestPermissionBase = permissionRequestBase;
}
public void onCreate(Bundle savedInstanceState) {
if (savedInstanceState != null) {
mFeatherPhotoUri = savedInstanceState.getParcelable(mUniqPrefix + KEY_FEATHER_PHOTO_URI);
mMakePhotoDstUri = savedInstanceState.getParcelable(mUniqPrefix + KEY_MAKE_PHOTO_DST_URI);
}
}
public boolean onActivityResult(int requestCode, int resultCode, Intent data) {
Uri newUri;
switch (requestCode - mStartActivityForResultBase) {
case REQUEST_PICK_PHOTO: // Выбрали фотографию из галереи
if (resultCode == Activity.RESULT_OK) {
newUri = data.getData();
if (DBG) Log.v(TAG, "Image picked. Uri: " + newUri);
if (hasExternalStoragePermission()) {
startFeatherPhotoAfterPermissionGranted(newUri, true);
} else {
dispatchNewImageUriReceived(newUri);
}
}
return true;
case REQUEST_MAKE_PHOTO: // Сфотографировались
if (resultCode == Activity.RESULT_OK) {
newUri = mMakePhotoDstUri;
mMakePhotoDstUri = null;
if (DBG) Log.v(TAG, "Take picture complete uri: " + newUri);
ImageUtils.galleryUpdatePic(getContext(), newUri);
if (hasExternalStoragePermission()) {
startFeatherPhotoAfterPermissionGranted(newUri, true);
} else {
// Мы не можем попасть сюда без разрешений, мы должны были их получить до фотографирования.
// Разве что, у нас их отобрали во время процесса
if (DBG) {
Log.e(TAG, "Has photo but no permissions", new IllegalStateException());
}
dispatchNewImageUriReceived(newUri);
}
}
break;
case REQUEST_FEATHER_PHOTO: // отредактировали фотографию
boolean changed = false;
Uri originalUri = null;
boolean dispatchOriginalUriOnFail = false;
if (data != null && data.getExtras() != null) {
Bundle extra = data.getExtras();
changed = extra.getBoolean(AdobeImageIntent.EXTRA_OUT_BITMAP_CHANGED);
Bundle myExtras = extra.getBundle(AdobeImageIntent.EXTRA_IN_EXTRAS);
if (myExtras != null) {
originalUri = myExtras.getParcelable(mUniqPrefix + KEY_IMAGE_EDITOR_EXTRAS_ORIGINAL_URI);
dispatchOriginalUriOnFail = myExtras.getBoolean(mUniqPrefix + KEY_IMAGE_EDITOR_DISPATCH_ORIGINAL_URI_ON_FAIL);
}
}
if (resultCode == Activity.RESULT_OK) {
newUri = data.getData();
if (newUri.toString().startsWith("/")) {
newUri = Uri.fromFile(new File(newUri.toString())); // Мозгоблядство от aviary
}
if (changed) {
// Пользователь внес какие-то изменения и нажал "готово"
dispatchNewImageUriReceived(newUri);
if (!ru.taaasty.utils.Objects.equals(newUri, originalUri)) {
if (newUri != null) ImageUtils.galleryUpdatePic(getContext(), newUri);
if (ImageUtils.isUriInPicturesDirectory(getContext(), originalUri) && REMOVE_ORIGINAL_AFTER_EDIT) {
if (deleteFileNoThrow(originalUri)) {
ImageUtils.galleryUpdatePic(getContext(), originalUri);
if (DBG) Log.i(TAG, "File removed after edit: " + originalUri);
}
}
}
} else {
// Пользователь нажал "готово", но при этом в исходное изображение не внес никаких изменений
// Если мы редактируем фотку после выбора из галереи или фотографирования,
// то возвращаем урл, полученный там.
if (dispatchOriginalUriOnFail) {
dispatchNewImageUriReceived(originalUri);
// Файл, созданный aviary, нам не понадобится
if (deleteFileNoThrow(newUri)) {
ImageUtils.galleryUpdatePic(getContext(), newUri);
if (DBG) Log.i(TAG, "File removed after edit: " + newUri);
}
} else {
// Если мы редактируем имеющуюся фотку, то ничего никуда не возвращаем
}
}
if (DBG) Log.v(TAG, "Feather photo complete. Original URI: " + originalUri +
" new image uri: " + newUri + " bitmap changed: " + changed);
} else if (resultCode == Activity.RESULT_CANCELED) {
// Пользователь отменил редактирование
if (DBG) {
Log.v(TAG, "edit RESULT_CANCELED.");
// TODO удалять фотографию?
}
}
return true;
}
return false;
}
public boolean onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
switch (requestCode - mRequestPermissionBase) {
case PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE_MAKE_PHOTO:
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
startMakePhotoAfterPermissionGranted();
AnalyticsHelper.getInstance().sendEvent(Constants.ANALYTICS_CATEGORY_PERMISSIONS, "GRANTED", "WRITE_EXTERNAL_STORAGE");
} else {
showNoExternalPhotoPermissionSnackbar(v -> startMakePhoto());
AnalyticsHelper.getInstance().sendEvent(Constants.ANALYTICS_CATEGORY_PERMISSIONS, "DENIED", "WRITE_EXTERNAL_STORAGE");
}
return true;
case PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE_FEATHER_PHOTO:
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
startFeatherPhotoAfterPermissionGranted(mFeatherPhotoUri, false);
AnalyticsHelper.getInstance().sendEvent(Constants.ANALYTICS_CATEGORY_PERMISSIONS, "GRANTED", "WRITE_EXTERNAL_STORAGE");
} else {
showNoExternalPhotoPermissionSnackbar(v -> startFeatherPhoto(mFeatherPhotoUri));
AnalyticsHelper.getInstance().sendEvent(Constants.ANALYTICS_CATEGORY_PERMISSIONS, "DENIED", "WRITE_EXTERNAL_STORAGE");
}
return true;
}
return false;
}
public void onSaveInstanceState(Bundle outState) {
if (mMakePhotoDstUri != null)
outState.putParcelable(mUniqPrefix + KEY_MAKE_PHOTO_DST_URI, mMakePhotoDstUri);
if (mFeatherPhotoUri != null)
outState.putParcelable(mUniqPrefix + KEY_FEATHER_PHOTO_URI, mFeatherPhotoUri);
}
/**
* Выбор фотографии из галереи.
* После выбора открывается редактор
*/
public void startPickPhoto() {
Intent photoPickerIntent = ImageUtils.createPickImageActivityIntent();
startActivityForResult(photoPickerIntent, REQUEST_PICK_PHOTO);
}
/**
* Фотографирование.
* По окончании запускается редактор
*/
public void startMakePhoto() {
if (!hasExternalStoragePermission()) {
requestExternalStoragePermission(PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE_MAKE_PHOTO);
} else {
startMakePhotoAfterPermissionGranted();
}
}
/**
* Редактирование фотографии
* @param imageUri URI фотографии, которую редактируем
*/
public void startFeatherPhoto(Uri imageUri) {
mFeatherPhotoUri = imageUri;
if (!hasExternalStoragePermission()) {
requestExternalStoragePermission(PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE_FEATHER_PHOTO);
} else {
startFeatherPhotoAfterPermissionGranted(imageUri, false);
}
}
private Context getContext() {
return mFragment != null ? mFragment.getContext() : mActivity;
}
private void startActivityForResult(Intent intent, int requestCode) {
if (mFragment != null) {
mFragment.startActivityForResult(intent, requestCode + mStartActivityForResultBase);
} else {
assert mActivity != null;
mActivity.startActivityForResult(intent, requestCode + mStartActivityForResultBase);
}
}
private void requestExternalStoragePermission(int requestCode) {
if (mFragment != null) {
mFragment.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
requestCode + mRequestPermissionBase);
} else {
assert mActivity != null;
ActivityCompat.requestPermissions(mActivity, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
requestCode + mRequestPermissionBase);
}
}
private boolean hasExternalStoragePermission() {
return (ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED);
}
private void startMakePhotoAfterPermissionGranted() {
try {
Intent takePictureIntent;
takePictureIntent = ImageUtils.createMakePhotoIntent(getContext(), false);
mMakePhotoDstUri = takePictureIntent.getParcelableExtra(MediaStore.EXTRA_OUTPUT);
startActivityForResult(takePictureIntent, REQUEST_MAKE_PHOTO);
} catch (ImageUtils.MakePhotoException e) {
MessageHelper.showError(getContext(), getContext().getText(e.errorResourceId), e);
} catch (SecurityException e) {
// Реально возможно, не параноя.
MessageHelper.showError(getContext(), getContext().getText(R.string.error_no_photo_dir_permission), e);
}
}
private void dispatchNewImageUriReceived(Uri uri) {
if (DBG) Log.d(TAG, "dispatchNewImageUriReceived() called with: " + "uri = [" + uri + "]");
mCallbacks.onNewImageUriReceived(uri);
}
/**
* Редактирование фотографии. Считаем, что у нас есть все разрешения
* @param imageUri URI изображения, которое надо отредактировать
* @param dispatchUriOnFail если true, то в случае ошибки или отмены imageUri
* возвращен как новый URL.
* Используется после фотографирования/выбора из галереи: "у нас уже
* есть новоре изображение, мы пытаемся его отредактировать, но если у
* нас ничего не выходит - возвращаем то, что есть"
*/
private void startFeatherPhotoAfterPermissionGranted(Uri imageUri, boolean dispatchUriOnFail) {
boolean failed = false;
try {
Bundle extras = new Bundle(1);
extras.putParcelable(mUniqPrefix + KEY_IMAGE_EDITOR_EXTRAS_ORIGINAL_URI, imageUri);
extras.putBoolean(mUniqPrefix + KEY_IMAGE_EDITOR_DISPATCH_ORIGINAL_URI_ON_FAIL, dispatchUriOnFail);
Intent newIntent = ImageUtils.createFeatherPhotoIntent(getContext(), imageUri, extras);
startActivityForResult( newIntent, REQUEST_FEATHER_PHOTO);
} catch (ImageUtils.MakePhotoException e) {
Toast.makeText(getContext(), e.errorResourceId, Toast.LENGTH_LONG).show();
failed = true;
} catch (SecurityException e) {
MessageHelper.showError(getContext(), getContext().getText(R.string.error_no_photo_dir_permission), e);
failed = true;
}
if (failed && dispatchUriOnFail) dispatchNewImageUriReceived(imageUri);
}
private void showNoExternalPhotoPermissionSnackbar(View.OnClickListener retryClickedAction) {
View rootView;
boolean showRetryButton = false;
if (mSnackbarRootView != null) {
rootView = mSnackbarRootView;
} else if (mFragment != null) {
rootView = mFragment.getView();
} else {
rootView = null;
}
if (mFragment != null) {
showRetryButton = mFragment.shouldShowRequestPermissionRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE);
} else {
assert mActivity != null;
showRetryButton = ActivityCompat.shouldShowRequestPermissionRationale(mActivity, Manifest.permission.WRITE_EXTERNAL_STORAGE);
}
if (rootView == null) return;
Snackbar snackbar = Snackbar.make(rootView, R.string.error_external_photo_dir_permission_required, Snackbar.LENGTH_LONG);
if (showRetryButton) {
snackbar.setAction(R.string.grant_access_to_external_photo_dir_button, retryClickedAction);
}
snackbar.show();
}
private static boolean deleteFileNoThrow(Uri uri) {
try {
return (new File(uri.getPath())).delete();
} catch (Throwable e) {
if (DBG) Log.e(TAG, "File.delete() error", e);
return false;
}
}
}
|
[
"[email protected]"
] | |
53fe46dc24ec2b05a83b9e85600577376d4a63a2
|
79d083b2b5c4456aaaeb00c430aeb1dff5dd2d85
|
/src/main/java/com/github/unidbg/file/BaseFileSystem.java
|
83513f4532c3f179317392f4008ce6452a46f28c
|
[
"Apache-2.0"
] |
permissive
|
JimmyJones97/emulator
|
4d7a760fdfde87cc25c884562b5f51a066857b52
|
57583aa0cf76a21297f4d49d1e712b56c49b2678
|
refs/heads/master
| 2020-05-19T00:35:39.484049 | 2020-03-03T18:45:43 | 2020-03-03T18:45:43 | 184,738,738 | 0 | 0 |
Apache-2.0
| 2020-03-03T18:45:44 | 2019-05-03T10:40:03 |
Java
|
UTF-8
|
Java
| false | false | 4,403 |
java
|
package com.github.unidbg.file;
import com.github.unidbg.Emulator;
import com.github.unidbg.unix.IO;
import com.github.unidbg.unix.UnixEmulator;
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.io.File;
import java.io.IOException;
public abstract class BaseFileSystem<T extends NewFileIO> implements FileSystem<T> {
private static final Log log = LogFactory.getLog(BaseFileSystem.class);
protected final Emulator<T> emulator;
protected final File rootDir;
public BaseFileSystem(Emulator<T> emulator, File rootDir) {
this.emulator = emulator;
this.rootDir = rootDir;
try {
initialize(this.rootDir);
} catch (IOException e) {
throw new IllegalStateException("initialize file system failed", e);
}
}
protected void initialize(File rootDir) throws IOException {
FileUtils.forceMkdir(new File(rootDir, "tmp"));
}
@Override
public FileResult<T> open(String pathname, int oflags) {
if (IO.STDIN.equals(pathname)) {
return FileResult.success(createStdin(oflags));
}
if (IO.STDOUT.equals(pathname) || IO.STDERR.equals(pathname)) {
try {
File stdio = new File(rootDir, pathname + ".txt");
if (!stdio.exists() && !stdio.createNewFile()) {
throw new IOException("create new file failed: " + stdio);
}
return FileResult.success(createStdout(oflags, stdio, pathname));
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
File file = new File(rootDir, pathname);
return createFileIO(file, oflags, pathname);
}
protected abstract T createStdout(int oflags, File stdio, String pathname);
protected abstract T createStdin(int oflags);
private FileResult<T> createFileIO(File file, int oflags, String path) {
boolean directory = hasDirectory(oflags);
if (file.isFile() && directory) {
return FileResult.failed(UnixEmulator.ENOTDIR);
}
boolean create = hasCreat(oflags);
if (file.exists()) {
if (create && hasExcl(oflags)) {
return FileResult.failed(UnixEmulator.EEXIST);
}
return FileResult.success(file.isDirectory() ? createDirectoryFileIO(file, oflags, path) : createSimpleFileIO(file, oflags, path));
}
if (!create || !file.getParentFile().exists()) {
return FileResult.failed(UnixEmulator.ENOENT);
}
try {
if (directory) {
if (!file.mkdir()) {
throw new IllegalStateException("mkdir failed: " + file);
}
return FileResult.success(createDirectoryFileIO(file, oflags, path));
} else {
if (!file.createNewFile()) {
throw new IllegalStateException("createNewFile failed: " + file);
}
return FileResult.success(createSimpleFileIO(file, oflags, path));
}
} catch (IOException e) {
throw new IllegalStateException("createNewFile failed: " + file, e);
}
}
@Override
public boolean mkdir(String path) {
File dir = new File(rootDir, path);
if (dir.exists()) {
return false;
} else {
return dir.mkdirs();
}
}
protected abstract boolean hasCreat(int oflags);
protected abstract boolean hasDirectory(int oflags);
@SuppressWarnings("unused")
protected abstract boolean hasAppend(int oflags);
protected abstract boolean hasExcl(int oflags);
@Override
public void unlink(String path) {
File file = new File(rootDir, path);
FileUtils.deleteQuietly(file);
if (log.isDebugEnabled()) {
log.debug("unlink path=" + path + ", file=" + file);
}
}
@Override
public File getRootDir() {
return rootDir;
}
@Override
public File createWorkDir() {
File workDir = new File(rootDir, DEFAULT_WORK_DIR);
if (!workDir.exists() && !workDir.mkdirs()) {
throw new IllegalStateException("mkdirs failed: " + workDir);
}
return workDir;
}
}
|
[
"[email protected]"
] | |
d74051458a7c57e4e559e24d368662eb33cbec42
|
af60eaf0817dd280beb83a2df27796967df1f178
|
/modules-mobile-impl/src/main/java/cn/booktable/modules/component/mobile/MobileViewPageComponent.java
|
02463235b5b02a8efd16a068cf6f4fd074f1ed9f
|
[] |
no_license
|
ljincheng/jcode
|
39f599da6b8f91471cbbfc0e647c975cbbf1cc9d
|
9a24c3663665eafa6cb53aec0774377857184dc1
|
refs/heads/main
| 2023-01-11T22:54:14.835697 | 2020-11-20T03:42:06 | 2020-11-20T03:42:06 | 314,225,569 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,447 |
java
|
package cn.booktable.modules.component.mobile;
import java.util.List;
import java.util.Map;
import cn.booktable.core.page.PageDo;
import cn.booktable.modules.entity.mobile.MobileViewPageDo;
/**
* 移动视图页面
* @author ljc
* @version v1.0
*/
public interface MobileViewPageComponent {
/**
* 添加移动视图页面
* @param mobileViewPageDo
* @return
*/
public Integer insertMobileViewPage(MobileViewPageDo mobileViewPageDo);
/**
* 获取移动视图页面列表
* @param selectItem
* @return
*/
public List<MobileViewPageDo> queryMobileViewPageList(Map<String,Object> selectItem);
/**
* 获取移动视图页面分页列表
* @param pageIndex 起始页
* @param pageSize 每页记录数
* @param selectItem 过滤条件
* @return
*/
public PageDo<MobileViewPageDo> queryMobileViewPageListPage(Long pageIndex,Integer pageSize,Map<String,Object> selectItem);
/**
* 根据id修改移动视图页面
* @param mobileViewPageDo
* @return
*/
public Integer updateMobileViewPageById(MobileViewPageDo mobileViewPageDo);
/**
* 根据id删除移动视图页面
* @param id
* @return
*/
public Integer deleteMobileViewPageById(Long id);
/**
* 根据id查找移动视图页面
* @param id
* @return
*/
public MobileViewPageDo findMobileViewPageById(Long id);
}
|
[
"[email protected]"
] | |
6bb4d823c63b4b041b4b900deef68140b20b84e6
|
eba784b814c1e5f04407cb613943872ecc4efebd
|
/samples/eventsapp/src/main/java/com.linkedin.android.eventsapp/MainActivity.java
|
b2022c2d330775ba18dd9d6a37f6e2f9a3989d90
|
[
"Apache-2.0"
] |
permissive
|
neurospeech/unofficial-linkedin-sdk-android
|
3ef787a1f4bc7cf30532d8dca027584cac378fd0
|
2ea36af773d19705bf92e3b26b488dd94f65e1d9
|
refs/heads/master
| 2020-09-15T20:07:42.748913 | 2016-08-19T08:48:23 | 2016-08-19T08:48:23 | 66,067,355 | 5 | 2 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,243 |
java
|
/*
Copyright 2015 LinkedIn Corp.
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.linkedin.android.eventsapp;
import android.app.ActionBar;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;
import com.linkedin.android.eventsapp.Event;
import com.linkedin.android.eventsapp.EventFragment;
import com.linkedin.android.eventsapp.EventsManager;
import com.linkedin.android.eventsapp.Person;
import com.linkedin.platform.LISessionManager;
import java.util.*;
import java.text.*;
public class MainActivity extends FragmentActivity {
public static final String TAG = MainActivity.class.getCanonicalName();
private ViewPager pager;
private com.linkedin.android.eventsapp.EventTabsAdapter mEventTabsAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
pager = new ViewPager(this);
pager.setId(R.id.pager);
pager.setOffscreenPageLimit(5);
setContentView(pager);
final ActionBar bar = getActionBar();
View viewActionBar = getLayoutInflater().inflate(R.layout.layout_action_bar, null);
TextView textviewTitle = (TextView) viewActionBar.findViewById(R.id.actionbar_textview);
ActionBar.LayoutParams params = new ActionBar.LayoutParams(
ActionBar.LayoutParams.WRAP_CONTENT,
ActionBar.LayoutParams.MATCH_PARENT,
Gravity.CENTER);
textviewTitle.setText("UPCOMING EVENTS");
bar.setCustomView(viewActionBar, params);
bar.setDisplayShowCustomEnabled(true);
bar.setDisplayShowTitleEnabled(false);
bar.setIcon(new ColorDrawable(Color.TRANSPARENT));
bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#F15153")));
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
mEventTabsAdapter = new com.linkedin.android.eventsapp.EventTabsAdapter(this, pager);
SimpleDateFormat ft = new SimpleDateFormat ("E dd MMM");
ArrayList<Event> events = EventsManager.getInstance(this).getEvents();
for (Event event : events) {
String eventDay = ft.format(new Date(event.getEventDate()));
mEventTabsAdapter.addTab(bar.newTab().setText(eventDay), EventFragment.class, event);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
LISessionManager.getInstance(getApplicationContext()).onActivityResult(this, requestCode, resultCode, data);
}
}
|
[
"[email protected]"
] | |
45c5903f430ad637bbd0b04ab322909c77a9de59
|
0bfda0f91f4ec3f9eda84fa3070287a627e4fe29
|
/src/ru/geekbrains/ads/lesson2/SortedArrayImpl.java
|
c74dd13fadd41176bc380ba8612dca5377f4f870
|
[] |
no_license
|
Senpai07/algoritm-data-struct
|
3538b742283da27ff6ca535fc4c014adca4ced10
|
b45a000ceed305f247287a59d1a2046071d88b2d
|
refs/heads/master
| 2023-01-24T03:49:35.731940 | 2020-11-29T16:07:51 | 2020-11-29T16:07:51 | 307,807,067 | 0 | 0 | null | 2020-11-29T16:04:37 | 2020-10-27T19:30:41 |
Java
|
UTF-8
|
Java
| false | false | 1,364 |
java
|
package ru.geekbrains.ads.lesson2;
public class SortedArrayImpl<E extends Comparable<? super E>> extends ArrayImpl<E> {
@SuppressWarnings("unchecked")
public SortedArrayImpl(int initialCapacity) {
this.data = (E[]) new Comparable[initialCapacity];
}
public SortedArrayImpl() {
}
// O(logN)
@Override
public int indexOf(E value) {
int low = 0;
int high = size() - 1;
while (low <= high) {
int mid = (low + high) / 2;
if (get(mid).equals(value)) {
return mid;
}
else if (value.compareTo(get(mid)) > 0) {
low = mid + 1;
}
else {
high = mid - 1;
}
}
return -1;
}
// O(n)
@Override
public void add(E value) {
checkAndGrow();
int index = size();
for (int i = 0; i < size(); i++) {
if (get(i).compareTo(value) > 0) {
index = i;
break;
}
}
if (index == size()) {
data[size++] = value;
}
else {
doInsert(value, index);
}
}
@Override
public void insert(E value, int index) {
throw new UnsupportedOperationException("Invalid operation for sorted array!");
}
}
|
[
"[email protected]"
] | |
01d20d03c43100ce8519f84618241bc964d7ce6c
|
27dfa1f29aef60e2d896488175f3fe17383e911f
|
/odev3/src/odev3/User.java
|
9283d9b07b7fd5465371e80ce17344731a8208e1
|
[] |
no_license
|
emresahin52/JAVA_DERSLERI
|
cf7907ca218c4b906eeb26b9c80141512e0e4f7d
|
e7a4891c42c79ea3c9dce257c37ce4d2d656eb62
|
refs/heads/main
| 2023-04-17T19:28:10.992932 | 2021-05-01T13:52:30 | 2021-05-01T13:52:30 | 362,544,902 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 791 |
java
|
package odev3;
public class User {
int id;
String firstName;
String lastName;
String eMail;
public User () {
}
public User(int id, String firstName, String lastName, String email) {
super();
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
this.eMail = email;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String geteMail() {
return eMail;
}
public void seteMail(String eMail) {
this.eMail = eMail;
}
}
|
[
"[email protected]"
] | |
2c4edef799aec1903ff2bd7f00093e075a0adc83
|
34fc7604bf99d0bfc1529ab3c093155cdf4d16c8
|
/src/main/java/es/urjc/mctwp/service/blogic/TaskUtils.java
|
6e03ecd2e293df10a77b133438a642c9814d7542
|
[] |
no_license
|
malaguna/mctwp
|
94cdaf04642796eeefe604c682c67b1f92f2c8f9
|
fe69915aa0f809e83135226370194ef93564a221
|
refs/heads/master
| 2021-01-01T17:47:14.678076 | 2013-07-12T16:13:16 | 2013-07-12T16:13:16 | 34,713,262 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,394 |
java
|
//Copyright 2008, 2009, 2010 Miguel Ángel Laguna Lobato
//
//This file is part of Multiclinical Trial Web-PACS.
//
//Multiclinical Trial Web-PACS 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.
//
//Multiclinical Trial Web-PACS 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 Multiclinical Trial Web-PACS. If not, see
//<http://www.gnu.org/licenses/>.
package es.urjc.mctwp.service.blogic;
import java.util.List;
import java.util.Set;
import es.urjc.mctwp.dao.GenericDAO;
import es.urjc.mctwp.dao.ProcessDefDAO;
import es.urjc.mctwp.dao.ProtocolableDAO;
import es.urjc.mctwp.dao.TaskDAO;
import es.urjc.mctwp.dao.UserDAO;
import es.urjc.mctwp.modelo.ImageData;
import es.urjc.mctwp.modelo.Protocolable;
import es.urjc.mctwp.modelo.Task;
import es.urjc.mctwp.modelo.TaskLog;
import es.urjc.mctwp.modelo.User;
import es.urjc.mctwp.modelo.ProcessDef;
public class TaskUtils extends AbstractBLogic{
private ProtocolableDAO protocolableDao = null;
private ProcessDefDAO processDefDao = null;
private UserDAO userDao = null;
private TaskDAO taskDao = null;
public ProcessDefDAO getProcessDefDao() {
return processDefDao;
}
public void setProcessDefDao(ProcessDefDAO processDao) {
this.processDefDao = processDao;
}
public void setProtocolableDao(ProtocolableDAO protocolableDao) {
this.protocolableDao = protocolableDao;
}
public ProtocolableDAO getProtocolableDao() {
return protocolableDao;
}
public UserDAO getUserDao() {
return userDao;
}
public void setUserDao(UserDAO userDao) {
this.userDao = userDao;
}
public TaskDAO getTaskDao() {
return taskDao;
}
public void setTaskDao(TaskDAO taskDao) {
this.taskDao = taskDao;
}
/**
* Creates a task manually, the user selected the source, the processDef, the owner and
* the time to do.
*
* @param task
* @param ownerId
* @param processId
* @param source
*/
public void createTask(Task task, Integer ownerId, Integer processId, Protocolable source){
ProcessDef process = null;
//Retrieve associated objects
source = protocolableDao.findById(source.getCode());
process = processDefDao.findById(processId);
//Create task
task.setOwner(userDao.findById(ownerId));
task.setProcess(process);
task.setSource(source);
//Associate to source's images
Set<ImageData> auxSet = source.getAllImages();
if(auxSet != null)
for(ImageData image : auxSet){
//There is no convenience method for this n:m relationship
task.addImage(image);
image.addTask(task);
}
taskDao.persist(task);
}
/**
* It saves a task and log (taskLog) the change made
*
* @param t
*/
public void saveTask(Task task, User author, Integer newOwnerId, String comment){
if(task != null){
Task taux = taskDao.findById(task.getCode());
User newOwner = userDao.findById(newOwnerId);
author = userDao.findById(author.getCode());
//For every possible change, we make a log
TaskLog tl = new TaskLog();
tl.setAuthor(author);
if( (comment == null) || (comment.isEmpty()) )
comment = null;
tl.setComment(comment);
//Check owner change
if(!taux.getOwner().equals(newOwner)){
tl.setField(TaskLog.TLF_OWNER);
tl.setValue(newOwner.getFullName());
taux.setOwner(newOwner);
//Check date change
}else if(!taux.getEndDate().equals(task.getEndDate())){
tl.setField(TaskLog.TLF_DATE);
tl.setValue(task.getEndDate().toString());
taux.setEndDate(task.getEndDate());
//Check status change
}else if(!taux.getStatus().equalsIgnoreCase(task.getStatus())){
tl.setField(TaskLog.TLF_STATUS);
tl.setValue(task.getStatus());
taux.setStatus(task.getStatus());
//Only a comment is done
}else {
tl.setField(TaskLog.TLF_COMMENT);
}
taux.addLog(tl);
taskDao.persist(taux);
}
}
/**
* Reassign a list of tasks to a new user
*
* @param tasks
* @param owner
*/
public void reassignTasks(List<Integer> tasks, User author, Integer newOwnerId, String comment){
if( (tasks != null) && (!tasks.isEmpty()) ){
User newOwner = userDao.findById(newOwnerId);
userDao.reattach(author, GenericDAO.DIRTY_IGNORE);;
for(Integer ti : tasks){
Task t = taskDao.findById(ti);
TaskLog tl = new TaskLog();
tl.setAuthor(author);
tl.setField(TaskLog.TLF_OWNER);
tl.setValue(newOwner.getFullName());
tl.setComment(comment);
t.setOwner(newOwner);
t.addLog(tl);
taskDao.persist(t);
}
}
}
public void doneTasks(List<Integer> tasks, User author) {
if( (tasks != null) && (!tasks.isEmpty()) ){
userDao.reattach(author, GenericDAO.DIRTY_IGNORE);;
for(Integer ti : tasks){
Task t = taskDao.findById(ti);
TaskLog tl = new TaskLog();
tl.setAuthor(author);
tl.setField(TaskLog.TLF_STATUS);
tl.setValue(Task.CLOSED);
t.setStatus(Task.CLOSED);
t.addLog(tl);
taskDao.persist(t);
}
}
}
}
|
[
"malaguna@08bf6a96-f3ea-11de-91ba-91c70a792394"
] |
malaguna@08bf6a96-f3ea-11de-91ba-91c70a792394
|
59d0fce1ecee74a87118cc6526aabaa645bfb81a
|
f8deaa58df02fdf32e3ca5ab6678ce6340d36005
|
/src/main/java/com/gem/sistema/web/bean/Reporte112MB.java
|
de5819891c6469c3858614a0a90767a2c3c9fe55
|
[] |
no_license
|
pedro-nava/gem
|
143ca18662a345a7e9bca931ee197a76fbcac3d5
|
ae94f88004747cd5c9606f91707bca8ce0d88c25
|
refs/heads/master
| 2020-04-21T10:40:10.297216 | 2019-02-07T18:17:31 | 2019-02-07T18:17:31 | 158,597,865 | 1 | 0 | null | 2018-12-26T23:15:54 | 2018-11-21T19:40:30 |
Java
|
UTF-8
|
Java
| false | false | 20,199 |
java
|
package com.gem.sistema.web.bean;
import static com.gem.sistema.util.UtilFront.generateNotificationFront;
import static com.roonin.utils.UtilDate.getLastDay;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;
import org.apache.commons.collections4.CollectionUtils;
import org.primefaces.context.RequestContext;
import org.primefaces.model.StreamedContent;
import org.springframework.data.domain.Sort;
import com.gem.sistema.business.domain.Conctb;
import com.gem.sistema.business.domain.Firmas;
import com.gem.sistema.business.domain.Pm0411;
import com.gem.sistema.business.repository.catalogs.ConctbRepository;
import com.gem.sistema.business.repository.catalogs.FirmasRepository;
import com.gem.sistema.business.repository.catalogs.Pm0411Repository;
import com.gem.sistema.business.repository.catalogs.TcMesRepository;
import com.gem.sistema.business.service.catalogos.Pm0411Service;
import com.gem.sistema.business.service.reportador.ReportValidationException;
// TODO: Auto-generated Javadoc
/**
* The Class Reporte112MB.
*/
@ManagedBean(name = "reporte112MB")
@ViewScoped
public class Reporte112MB extends BaseDirectReport {
/** The firmas. */
private Firmas firmas;
/** The conctb. */
private Conctb conctb;
/** The trimestre. */
private String trimestre;
/** The list trimestre. */
private List<String> listTrimestre;
/** The pm 0411. */
private Pm0411 pm0411;
/** The list pm 0411. */
private List<Pm0411> listPm0411;
/** The con trim. */
private String conTrim;
/** The combo tri. */
private List<Pm0411> comboTri;
/** The b lbl trimestre. */
private boolean bLblTrimestre = Boolean.TRUE;
/** The b combo tri. */
private boolean bComboTri = Boolean.FALSE;
/** The b lbl. */
private boolean bLbl = Boolean.TRUE;
/** The b txt. */
private boolean bTxt = Boolean.FALSE;
/** The b V save. */
private boolean bVSave = Boolean.FALSE;
/** The b V modificar. */
private boolean bVModificar = Boolean.TRUE;
/** The b btn moficar. */
private boolean bBtnMoficar = Boolean.TRUE;
/** The b modificar. */
private boolean bModificar = Boolean.FALSE;
/** The b borrar. */
private boolean bBorrar = Boolean.TRUE;
/** The b add. */
private boolean bAdd = Boolean.FALSE;
/** The b report. */
private boolean bReport = Boolean.FALSE;
/** The pm 0411 service. */
@ManagedProperty("#{pm0411Service}")
private Pm0411Service pm0411Service;
/** The pm 0411 repository. */
@ManagedProperty("#{pm0411Repository}")
private Pm0411Repository pm0411Repository;
/** The conctb repository. */
@ManagedProperty("#{conctbRepository}")
private ConctbRepository conctbRepository;
/** The firmas repository. */
@ManagedProperty("#{firmasRepository}")
private FirmasRepository firmasRepository;
/** The tc mes repository. */
@ManagedProperty("#{tcMesRepository}")
private TcMesRepository tcMesRepository;
/**
* Checks if is b report.
*
* @return true, if is b report
*/
public boolean isbReport() {
return bReport;
}
/**
* Sets the b report.
*
* @param bReport the new b report
*/
public void setbReport(boolean bReport) {
this.bReport = bReport;
}
/**
* Gets the firmas.
*
* @return the firmas
*/
public Firmas getFirmas() {
return firmas;
}
/**
* Sets the firmas.
*
* @param firmas the new firmas
*/
public void setFirmas(Firmas firmas) {
this.firmas = firmas;
}
/**
* Gets the conctb.
*
* @return the conctb
*/
public Conctb getConctb() {
return conctb;
}
/**
* Sets the conctb.
*
* @param conctb the new conctb
*/
public void setConctb(Conctb conctb) {
this.conctb = conctb;
}
/**
* Gets the conctb repository.
*
* @return the conctb repository
*/
public ConctbRepository getConctbRepository() {
return conctbRepository;
}
/**
* Sets the conctb repository.
*
* @param conctbRepository the new conctb repository
*/
public void setConctbRepository(ConctbRepository conctbRepository) {
this.conctbRepository = conctbRepository;
}
/**
* Gets the firmas repository.
*
* @return the firmas repository
*/
public FirmasRepository getFirmasRepository() {
return firmasRepository;
}
/**
* Sets the firmas repository.
*
* @param firmasRepository the new firmas repository
*/
public void setFirmasRepository(FirmasRepository firmasRepository) {
this.firmasRepository = firmasRepository;
}
/**
* Gets the tc mes repository.
*
* @return the tc mes repository
*/
public TcMesRepository getTcMesRepository() {
return tcMesRepository;
}
/**
* Sets the tc mes repository.
*
* @param tcMesRepository the new tc mes repository
*/
public void setTcMesRepository(TcMesRepository tcMesRepository) {
this.tcMesRepository = tcMesRepository;
}
/**
* Gets the trimestre.
*
* @return the trimestre
*/
public String getTrimestre() {
return trimestre;
}
/**
* Sets the trimestre.
*
* @param trimestre the new trimestre
*/
public void setTrimestre(String trimestre) {
this.trimestre = trimestre;
}
/**
* Gets the list trimestre.
*
* @return the list trimestre
*/
public List<String> getListTrimestre() {
return listTrimestre;
}
/**
* Sets the list trimestre.
*
* @param listTrimestre the new list trimestre
*/
public void setListTrimestre(List<String> listTrimestre) {
this.listTrimestre = listTrimestre;
}
/**
* Gets the pm 0411.
*
* @return the pm 0411
*/
public Pm0411 getPm0411() {
return pm0411;
}
/**
* Sets the pm 0411.
*
* @param pm0411 the new pm 0411
*/
public void setPm0411(Pm0411 pm0411) {
this.pm0411 = pm0411;
}
/**
* Gets the list pm 0411.
*
* @return the list pm 0411
*/
public List<Pm0411> getlistPm0411() {
return listPm0411;
}
/**
* Sets the list pm 0411.
*
* @param listPm0411 the new list pm 0411
*/
public void setlistPm0411(List<Pm0411> listPm0411) {
this.listPm0411 = listPm0411;
}
/**
* Gets the pm 0411 service.
*
* @return the pm 0411 service
*/
public Pm0411Service getPm0411Service() {
return pm0411Service;
}
/**
* Sets the pm 0411 service.
*
* @param pm0411Service the new pm 0411 service
*/
public void setPm0411Service(Pm0411Service pm0411Service) {
this.pm0411Service = pm0411Service;
}
/**
* Checks if is b lbl trimestre.
*
* @return true, if is b lbl trimestre
*/
public boolean isbLblTrimestre() {
return bLblTrimestre;
}
/**
* Sets the b lbl trimestre.
*
* @param bLblTrimestre the new b lbl trimestre
*/
public void setbLblTrimestre(boolean bLblTrimestre) {
this.bLblTrimestre = bLblTrimestre;
}
/**
* Checks if is b combo tri.
*
* @return true, if is b combo tri
*/
public boolean isbComboTri() {
return bComboTri;
}
/**
* Sets the b combo tri.
*
* @param bComboTri the new b combo tri
*/
public void setbComboTri(boolean bComboTri) {
this.bComboTri = bComboTri;
}
/**
* Checks if is b lbl.
*
* @return true, if is b lbl
*/
public boolean isbLbl() {
return bLbl;
}
/**
* Sets the b lbl.
*
* @param bLbl the new b lbl
*/
public void setbLbl(boolean bLbl) {
this.bLbl = bLbl;
}
/**
* Checks if is b txt.
*
* @return true, if is b txt
*/
public boolean isbTxt() {
return bTxt;
}
/**
* Sets the b txt.
*
* @param bTxt the new b txt
*/
public void setbTxt(boolean bTxt) {
this.bTxt = bTxt;
}
/**
* Checks if is b V save.
*
* @return true, if is b V save
*/
public boolean isbVSave() {
return bVSave;
}
/**
* Sets the b V save.
*
* @param bVSave the new b V save
*/
public void setbVSave(boolean bVSave) {
this.bVSave = bVSave;
}
/**
* Checks if is b V modificar.
*
* @return true, if is b V modificar
*/
public boolean isbVModificar() {
return bVModificar;
}
/**
* Sets the b V modificar.
*
* @param bVModificar the new b V modificar
*/
public void setbVModificar(boolean bVModificar) {
this.bVModificar = bVModificar;
}
/**
* Checks if is b btn moficar.
*
* @return true, if is b btn moficar
*/
public boolean isbBtnMoficar() {
return bBtnMoficar;
}
/**
* Sets the b btn moficar.
*
* @param bBtnMoficar the new b btn moficar
*/
public void setbBtnMoficar(boolean bBtnMoficar) {
this.bBtnMoficar = bBtnMoficar;
}
/**
* Checks if is b modificar.
*
* @return true, if is b modificar
*/
public boolean isbModificar() {
return bModificar;
}
/**
* Sets the b modificar.
*
* @param bModificar the new b modificar
*/
public void setbModificar(boolean bModificar) {
this.bModificar = bModificar;
}
/**
* Checks if is b borrar.
*
* @return true, if is b borrar
*/
public boolean isbBorrar() {
return bBorrar;
}
/**
* Sets the b borrar.
*
* @param bBorrar the new b borrar
*/
public void setbBorrar(boolean bBorrar) {
this.bBorrar = bBorrar;
}
/**
* Checks if is b add.
*
* @return true, if is b add
*/
public boolean isbAdd() {
return bAdd;
}
/**
* Sets the b add.
*
* @param bAdd the new b add
*/
public void setbAdd(boolean bAdd) {
this.bAdd = bAdd;
}
/**
* Gets the pm 0411 repository.
*
* @return the pm 0411 repository
*/
public Pm0411Repository getPm0411Repository() {
return pm0411Repository;
}
/**
* Sets the pm 0411 repository.
*
* @param pm0411Repository the new pm 0411 repository
*/
public void setPm0411Repository(Pm0411Repository pm0411Repository) {
this.pm0411Repository = pm0411Repository;
}
/**
* Inits the.
*/
@PostConstruct
public void init() {
bLblTrimestre = Boolean.TRUE;
bComboTri = Boolean.FALSE;
bLbl = Boolean.TRUE;
bTxt = Boolean.FALSE;
bVSave = Boolean.FALSE;
bVModificar = Boolean.TRUE;
bBtnMoficar = Boolean.FALSE;
bModificar = Boolean.FALSE;
bBorrar = Boolean.FALSE;
bAdd = Boolean.FALSE;
listPm0411 = pm0411Service.orderByTrimestreAsc(this.getUserDetails().getIdSector());
if (null == listPm0411.get(0).getUserid()) {
bLblTrimestre = Boolean.TRUE;
bComboTri = Boolean.FALSE;
bLbl = Boolean.TRUE;
bBorrar = Boolean.TRUE;
bTxt = Boolean.FALSE;
bVSave = Boolean.FALSE;
bVModificar = Boolean.TRUE;
bBtnMoficar = Boolean.TRUE;
bModificar = Boolean.FALSE;
bBorrar = Boolean.TRUE;
bAdd = Boolean.FALSE;
}
listTrimestre = new ArrayList<String>();
for (int i = 1; i <= 4; i++)
listTrimestre.add("0" + i);
trimestre = listTrimestre.get(0);
comboTri = pm0411Service.orderByTrimestreAsc(this.getUserDetails().getIdSector());
conTrim = comboTri.get(0).getTrimestre().toString();
bReport = Boolean.FALSE;
if (comboTri.get(0).getTrimestre() == 0){
bReport = Boolean.TRUE;
}
if(listPm0411.size() == 4 ) {
bComboTri = Boolean.FALSE;
bLbl = Boolean.TRUE;
bTxt = Boolean.FALSE;
bVSave = Boolean.FALSE;
bVModificar = Boolean.TRUE;
bBtnMoficar = Boolean.FALSE;
bModificar = Boolean.FALSE;
bBorrar = Boolean.FALSE;
bAdd = Boolean.TRUE;
}
jasperReporteName = "reporte112";
endFilename = jasperReporteName + ".pdf";
}
/**
* Gets the months.
*
* @param trim the trim
* @return the months
*/
public String getMonths(Integer trim) {
if (trim == 1) {
return "01,03";
} else if (trim == 2) {
return "04,06";
} else if (trim == 3) {
return "07,09";
} else {
return "10,12";
}
}
/* (non-Javadoc)
* @see com.gem.sistema.web.bean.BaseDirectReport#getParametersReports()
*/
@Override
public Map<String, Object> getParametersReports() throws ReportValidationException {
Map<String, Object> parameters = new java.util.HashMap<String, Object>();
firmas = firmasRepository.findAllByIdsector(this.getUserDetails().getIdSector());
conctb = conctbRepository.findByIdsector(getUserDetails().getIdSector());
String[] mesArray = this.getMonths(Integer.valueOf(conTrim)).split(",");
String fecha = "DEL 1° DE " + tcMesRepository.findByMes(mesArray[0]).getDescripcion() + " AL "
+ getLastDay(Integer.valueOf(mesArray[1])) + " DE "
+ tcMesRepository.findByMes(mesArray[1]).getDescripcion() + " DE " + conctb.getAnoemp();
parameters.put("TRIMESTRE", Integer.valueOf(conTrim));
parameters.put("SECTOR", this.getUserDetails().getIdSector());
parameters.put("imagen", this.getUserDetails().getPathImgCab1());
parameters.put("fecha", fecha);
parameters.put("nombreMunicipio", firmas.getCampo1());
parameters.put("clave", conctb.getClave());
parameters.put("N4", firmas.getN4());
parameters.put("L4", firmas.getL4());
parameters.put("N5", firmas.getN5());
parameters.put("L5", firmas.getL5());
return parameters;
}
/* (non-Javadoc)
* @see com.gem.sistema.web.bean.BaseDirectReport#generaReporteSimple(int)
*/
@Override
public StreamedContent generaReporteSimple(int type) throws ReportValidationException {
// TODO Auto-generated method stub
return null;
}
/**
* Gets the con trim.
*
* @return the con trim
*/
public String getConTrim() {
return conTrim;
}
/**
* Sets the con trim.
*
* @param conTrim the new con trim
*/
public void setConTrim(String conTrim) {
this.conTrim = conTrim;
}
/**
* Gets the combo tri.
*
* @return the combo tri
*/
public List<Pm0411> getComboTri() {
return comboTri;
}
/**
* Sets the combo tri.
*
* @param comboTri the new combo tri
*/
public void setComboTri(List<Pm0411> comboTri) {
this.comboTri = comboTri;
}
/**
* Adds the.
*
* @param index the index
*/
public void add(Integer index) {
bLblTrimestre = Boolean.FALSE;
bComboTri = Boolean.TRUE;
bLbl = Boolean.FALSE;
bTxt = Boolean.TRUE;
bVSave = Boolean.TRUE;
bVModificar = Boolean.FALSE;
bBtnMoficar = Boolean.FALSE;
bModificar = Boolean.FALSE;
bBorrar = Boolean.TRUE;
bAdd = Boolean.TRUE;
listPm0411.add(0, pm0411Service.add());
RequestContext.getCurrentInstance().execute("PF('pm0411Wdg').paginator.setPage(0);");
if (null == listPm0411.get(1).getUserid())
listPm0411.remove(1);
}
/**
* Save.
*
* @param index the index
*/
public void save(Integer index) {
pm0411 = this.entitySave(index);
if(null == pm0411.getDc())
pm0411.setDc(0);
if(null == pm0411.getDi())
pm0411.setDi(0);
if(null == pm0411.getObsdc())
pm0411.setObsdc("");
if(null == pm0411.getObsdi())
pm0411.setObsdi("");
if (bModificar) {
pm0411Repository.save(pm0411);
listPm0411 = pm0411Service.calculationAccumulated(pm0411.getIdsector());
generateNotificationFront(FacesMessage.SEVERITY_INFO, "Info!", "Se modificaron los datos correctamente");
bReport = Boolean.FALSE;
bLblTrimestre = Boolean.TRUE;
bComboTri = Boolean.FALSE;
bLbl = Boolean.TRUE;
bTxt = Boolean.FALSE;
bVSave = Boolean.FALSE;
bVModificar = Boolean.TRUE;
bBtnMoficar = Boolean.FALSE;
bModificar = Boolean.FALSE;
bBorrar = Boolean.FALSE;
bAdd = Boolean.FALSE;
} else {
listPm0411.set(index, pm0411);
listPm0411 = pm0411Service.save(index, listPm0411);
if(listPm0411.get(index).isgBuardar() == Boolean.TRUE) {
bReport = Boolean.FALSE;
bLblTrimestre = Boolean.TRUE;
bComboTri = Boolean.FALSE;
bLbl = Boolean.TRUE;
bTxt = Boolean.FALSE;
bVSave = Boolean.FALSE;
bVModificar = Boolean.TRUE;
bBtnMoficar = Boolean.FALSE;
bModificar = Boolean.FALSE;
bBorrar = Boolean.FALSE;
bAdd = Boolean.FALSE;
}
}
if(listPm0411.size() == 4 && listPm0411.get(index).isgBuardar() == Boolean.TRUE) {
bComboTri = Boolean.FALSE;
bLbl = Boolean.TRUE;
bTxt = Boolean.FALSE;
bVSave = Boolean.FALSE;
bVModificar = Boolean.TRUE;
bBtnMoficar = Boolean.FALSE;
bModificar = Boolean.FALSE;
bBorrar = Boolean.FALSE;
bAdd = Boolean.TRUE;
}
comboTri = pm0411Service.orderByTrimestreAsc(this.getUserDetails().getIdSector());
}
/**
* Delete.
*
* @param index the index
*/
public void delete(Integer index) {
listPm0411 = pm0411Service.delete(index, listPm0411);
comboTri = pm0411Service.orderByTrimestreAsc(this.getUserDetails().getIdSector());
bVSave = Boolean.FALSE;
bVModificar = Boolean.TRUE;
bBtnMoficar = Boolean.FALSE;
bAdd = Boolean.FALSE;
bReport = Boolean.FALSE;
bBorrar = Boolean.FALSE;
listPm0411 = pm0411Repository.findAllByIdsector(this.getUserDetails().getIdSector(), this.orderByAsc());
if(CollectionUtils.isEmpty(listPm0411)) {
bBorrar = Boolean.FALSE;
bVModificar = Boolean.TRUE;
bBtnMoficar = Boolean.TRUE;
bReport = Boolean.FALSE;
bBorrar = Boolean.FALSE;
listPm0411.add(this.pm0411Service.add());
}
}
/**
* Clean.
*
* @param index the index
*/
public void clean(Integer index) {
if (bModificar) {
pm0411 = pm0411Repository.findAllBytrimestreAndIdsector(listPm0411.get(index).getTrimestre(),
this.getUserDetails().getIdSector());
listPm0411.add(index, pm0411);
} else
listPm0411 = pm0411Service.clean(index, listPm0411);
}
/**
* Modify.
*
* @param index the index
*/
public void modify(Integer index) {
bLblTrimestre = Boolean.TRUE;
bComboTri = Boolean.FALSE;
bLbl = Boolean.FALSE;
bTxt = Boolean.TRUE;
bVSave = Boolean.TRUE;
bVModificar = Boolean.FALSE;
bBtnMoficar = Boolean.FALSE;
bModificar = Boolean.TRUE;
bBorrar = Boolean.TRUE;
bAdd = Boolean.TRUE;
}
/**
* Cancel.
*
* @param index the index
*/
public void cancel(Integer index) {
bLblTrimestre = Boolean.TRUE;
bComboTri = Boolean.FALSE;
bLbl = Boolean.TRUE;
bTxt = Boolean.FALSE;
bVSave = Boolean.FALSE;
bVModificar = Boolean.TRUE;
bBtnMoficar = Boolean.FALSE;
bAdd = Boolean.FALSE;
listPm0411 = pm0411Service.orderByTrimestreAsc(this.getUserDetails().getIdSector());
if (null == listPm0411.get(0).getUserid()) {
bVModificar = Boolean.TRUE;
bBtnMoficar = Boolean.TRUE;
bLbl = Boolean.TRUE;
bTxt = Boolean.FALSE;
bBorrar = Boolean.TRUE;
bAdd = Boolean.FALSE;
}
bReport = Boolean.FALSE;
if (comboTri.get(0).getTrimestre() == 0){
bReport = Boolean.TRUE;
}
if(listPm0411.size() == 4 ) {
bComboTri = Boolean.FALSE;
bLbl = Boolean.TRUE;
bTxt = Boolean.FALSE;
bVSave = Boolean.FALSE;
bVModificar = Boolean.TRUE;
bBtnMoficar = Boolean.FALSE;
bModificar = Boolean.FALSE;
bBorrar = Boolean.FALSE;
bAdd = Boolean.TRUE;
}
generateNotificationFront(FacesMessage.SEVERITY_INFO, "Info!", "Edicion cancelada");
}
/**
* Entity save.
*
* @param index the index
* @return the pm 0411
*/
public Pm0411 entitySave(Integer index) {
pm0411 = listPm0411.get(index);
pm0411.setUserid(this.getUserDetails().getUsername());
pm0411.setIdRef(0L);
pm0411.setIdsector(this.getUserDetails().getIdSector());
pm0411.setFeccap(Calendar.getInstance().getTime());
pm0411.setCapturo(this.getUserDetails().getUsername());
pm0411.setTrimestre(bModificar == true ? pm0411.getTrimestre() : Integer.valueOf(trimestre));
return pm0411;
}
/**
* Order by asc.
*
* @return the sort
*/
public Sort orderByAsc(){
return new Sort(Sort.Direction.ASC, "trimestre");
}
}
|
[
"[email protected]"
] | |
b000b0babb24952d0859354eccaab8b463d2e027
|
2aec438a1a9cff7724979cdefbddbd52046f365d
|
/src/main/java/algorithm/example/hackerrank/LuckBalance.java
|
dcc0074a793c7b2c7e3099e8b97c36f63d2f9627
|
[] |
no_license
|
souljungkim/algorithm_study
|
02671a45fca553dcd6e2acc11ab50c2dcd199dac
|
6914e5e76a152935a3a99951bc98d9d4a674085b
|
refs/heads/master
| 2022-04-09T11:11:38.320896 | 2020-03-17T12:23:11 | 2020-03-17T12:23:11 | 241,793,186 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,474 |
java
|
package algorithm.example.hackerrank;
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
public class LuckBalance {
// Complete the luckBalance function below.
static int luckBalance(int k, int[][] c) {
/** Method A **/
// ArrayList<Integer> imp = new ArrayList<>();
//
// if (imp.size() > 0){
// Collections.sort(imp, Collections.reverseOrder());
// for (int i=0; i<k; i++){
// if (i > imp.size() -1)
// break;
// luck += imp.get(i);
// }
//
// for (int i=k; i<imp.size(); i++){
// luck -= imp.get(i);
// }
// }
// return luck;
/** Method B **/
PriorityQueue<Integer> imp = new PriorityQueue<>(Collections.reverseOrder());
int luck = 0;
for (int row=0; row<c.length; row++){
if (c[row][1] == 0)
luck += c[row][0];
else
imp.add(c[row][0]);
}
boolean decreaseLuck = false;
while (!imp.isEmpty()){
if (k == 0)
decreaseLuck = true;
if (decreaseLuck == true)
luck -= imp.poll();
else
luck += imp.poll();
k--;
}
return luck;
}
private static final Scanner scanner = new Scanner(System.in);
public static void main(String[] args) throws IOException {
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));
String[] nk = scanner.nextLine().split(" ");
int n = Integer.parseInt(nk[0]);
int k = Integer.parseInt(nk[1]);
int[][] contests = new int[n][2];
for (int i = 0; i < n; i++) {
String[] contestsRowItems = scanner.nextLine().split(" ");
scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");
for (int j = 0; j < 2; j++) {
int contestsItem = Integer.parseInt(contestsRowItems[j]);
contests[i][j] = contestsItem;
}
}
int result = luckBalance(k, contests);
bufferedWriter.write(String.valueOf(result));
bufferedWriter.newLine();
bufferedWriter.close();
scanner.close();
}
}
|
[
"[email protected]"
] | |
5e2b63cdef8cfba5ad8dd0afc882b7d3756b4344
|
a54bb73655149773e2a884e7bff518c902a3a5b2
|
/java-core/src/com/source/com/sun/org/apache/xml/internal/serialize/IndentPrinter.java
|
4955ce911479819bb32019edff4fb9cc127705b3
|
[] |
no_license
|
fredomli/java-standard
|
071823b680555039f1284ce55a2909397392c989
|
c6e296c8d8e4a8626faa69bf0732e0ac4b3bb360
|
refs/heads/main
| 2023-08-29T22:43:53.023691 | 2021-11-05T15:31:14 | 2021-11-05T15:31:14 | 390,624,004 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 12,044 |
java
|
/*
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.sun.org.apache.xml.internal.serialize;
import java.io.Writer;
import java.io.StringWriter;
import java.io.IOException;
/**
* Extends {@link Printer} and adds support for indentation and line
* wrapping.
*
* @author <a href="mailto:[email protected]">Assaf Arkin</a>
*
* @deprecated As of Xerces 2.9.0, Xerces DOM L3 Serializer implementation
* is replaced by that of Xalan. Main class
* {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced
* by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}.
*/
public class IndentPrinter
extends Printer
{
/**
* Holds the currently accumulating text line. This buffer will constantly
* be reused by deleting its contents instead of reallocating it.
*/
private StringBuffer _line;
/**
* Holds the currently accumulating text that follows {@link #_line}.
* When the end of the part is identified by a call to {@link #printSpace}
* or {@link #breakLine}, this part is added to the accumulated line.
*/
private StringBuffer _text;
/**
* Counts how many white spaces come between the accumulated line and the
* current accumulated text. Multiple spaces at the end of the a line
* will not be printed.
*/
private int _spaces;
/**
* Holds the indentation for the current line that is now accumulating in
* memory and will be sent for printing shortly.
*/
private int _thisIndent;
/**
* Holds the indentation for the next line to be printed. After this line is
* printed, {@link #_nextIndent} is assigned to {@link #_thisIndent}.
*/
private int _nextIndent;
public IndentPrinter( Writer writer, OutputFormat format)
{
super( writer, format );
// Initialize everything for a first/second run.
_line = new StringBuffer( 80 );
_text = new StringBuffer( 20 );
_spaces = 0;
_thisIndent = _nextIndent = 0;
}
/**
* Called by any of the DTD handlers to enter DTD mode.
* Once entered, all output will be accumulated in a string
* that can be printed as part of the document's DTD.
* This method may be called any number of time but will only
* have affect the first time it's called. To exist DTD state
* and get the accumulated DTD, call {@link #leaveDTD}.
*/
public void enterDTD()
{
// Can only enter DTD state once. Once we're out of DTD
// state, can no longer re-enter it.
if ( _dtdWriter == null ) {
_line.append( _text );
_text = new StringBuffer( 20 );
flushLine( false );
_dtdWriter = new StringWriter();
_docWriter = _writer;
_writer = _dtdWriter;
}
}
/**
* Called by the root element to leave DTD mode and if any
* DTD parts were printer, will return a string with their
* textual content.
*/
public String leaveDTD()
{
// Only works if we're going out of DTD mode.
if ( _writer == _dtdWriter ) {
_line.append( _text );
_text = new StringBuffer( 20 );
flushLine( false );
_writer = _docWriter;
return _dtdWriter.toString();
} else
return null;
}
/**
* Called to print additional text. Each time this method is called
* it accumulates more text. When a space is printed ({@link
* #printSpace}) all the accumulated text becomes one part and is
* added to the accumulate line. When a line is long enough, it can
* be broken at its text boundary.
*
* @param text The text to print
*/
public void printText( String text )
{
_text.append( text );
}
public void printText( StringBuffer text )
{
_text.append( text.toString() );
}
public void printText( char ch )
{
_text.append( ch );
}
public void printText( char[] chars, int start, int length )
{
_text.append( chars, start, length );
}
/**
* Called to print a single space between text parts that may be
* broken into separate lines. Must not be called to print a space
* when preserving spaces. The text accumulated so far with {@link
* #printText} will be added to the accumulated line, and a space
* separator will be counted. If the line accumulated so far is
* long enough, it will be printed.
*/
public void printSpace()
{
// The line consists of the text accumulated in _line,
// followed by one or more spaces as counted by _spaces,
// followed by more space accumulated in _text:
// - Text is printed and accumulated into _text.
// - A space is printed, so _text is added to _line and
// a space is counted.
// - More text is printed and accumulated into _text.
// - A space is printed, the previous spaces are added
// to _line, the _text is added to _line, and a new
// space is counted.
// If text was accumulated with printText(), then the space
// means we have to move that text into the line and
// start accumulating new text with printText().
if ( _text.length() > 0 ) {
// If the text breaks a line bounary, wrap to the next line.
// The printed line size consists of the indentation we're going
// to use next, the accumulated line so far, some spaces and the
// accumulated text so far.
if ( _format.getLineWidth() > 0 &&
_thisIndent + _line.length() + _spaces + _text.length() > _format.getLineWidth() ) {
flushLine( false );
try {
// Print line and new line, then zero the line contents.
_writer.write( _format.getLineSeparator() );
} catch ( IOException except ) {
// We don't throw an exception, but hold it
// until the end of the document.
if ( _exception == null )
_exception = except;
}
}
// Add as many spaces as we accumulaed before.
// At the end of this loop, _spaces is zero.
while ( _spaces > 0 ) {
_line.append( ' ' );
--_spaces;
}
_line.append( _text );
_text = new StringBuffer( 20 );
}
// Starting a new word: accumulate the text between the line
// and this new word; not a new word: just add another space.
++_spaces;
}
/**
* Called to print a line consisting of the text accumulated so
* far. This is equivalent to calling {@link #printSpace} but
* forcing the line to print and starting a new line ({@link
* #printSpace} will only start a new line if the current line
* is long enough).
*/
public void breakLine()
{
breakLine( false );
}
public void breakLine( boolean preserveSpace )
{
// Equivalent to calling printSpace and forcing a flushLine.
if ( _text.length() > 0 ) {
while ( _spaces > 0 ) {
_line.append( ' ' );
--_spaces;
}
_line.append( _text );
_text = new StringBuffer( 20 );
}
flushLine( preserveSpace );
try {
// Print line and new line, then zero the line contents.
_writer.write( _format.getLineSeparator() );
} catch ( IOException except ) {
// We don't throw an exception, but hold it
// until the end of the document.
if ( _exception == null )
_exception = except;
}
}
/**
* Flushes the line accumulated so far to the writer and get ready
* to accumulate the next line. This method is called by {@link
* #printText} and {@link #printSpace} when the accumulated line plus
* accumulated text are two long to fit on a given line. At the end of
* this method _line is empty and _spaces is zero.
*/
public void flushLine( boolean preserveSpace )
{
int indent;
if ( _line.length() > 0 ) {
try {
if ( _format.getIndenting() && ! preserveSpace ) {
// Make sure the indentation does not blow us away.
indent = _thisIndent;
if ( ( 2 * indent ) > _format.getLineWidth() && _format.getLineWidth() > 0 )
indent = _format.getLineWidth() / 2;
// Print the indentation as spaces and set the current
// indentation to the next expected indentation.
while ( indent > 0 ) {
_writer.write( ' ' );
--indent;
}
}
_thisIndent = _nextIndent;
// There is no need to print the spaces at the end of the line,
// they are simply stripped and replaced with a single line
// separator.
_spaces = 0;
_writer.write( _line.toString() );
_line = new StringBuffer( 40 );
} catch ( IOException except ) {
// We don't throw an exception, but hold it
// until the end of the document.
if ( _exception == null )
_exception = except;
}
}
}
/**
* Flush the output stream. Must be called when done printing
* the document, otherwise some text might be buffered.
*/
public void flush()
{
if ( _line.length() > 0 || _text.length() > 0 )
breakLine();
try {
_writer.flush();
} catch ( IOException except ) {
// We don't throw an exception, but hold it
// until the end of the document.
if ( _exception == null )
_exception = except;
}
}
/**
* Increment the indentation for the next line.
*/
public void indent()
{
_nextIndent += _format.getIndent();
}
/**
* Decrement the indentation for the next line.
*/
public void unindent()
{
_nextIndent -= _format.getIndent();
if ( _nextIndent < 0 )
_nextIndent = 0;
// If there is no current line and we're de-identing then
// this indentation level is actually the next level.
if ( ( _line.length() + _spaces + _text.length() ) == 0 )
_thisIndent = _nextIndent;
}
public int getNextIndent()
{
return _nextIndent;
}
public void setNextIndent( int indent )
{
_nextIndent = indent;
}
public void setThisIndent( int indent )
{
_thisIndent = indent;
}
}
|
[
"[email protected]"
] | |
85adcf221959ad2fe3ada15263b45e2fc666cb7f
|
f1befa54cdedab30603c157ea3700e223c40ce45
|
/app/src/main/java/com/example/tracking_app_project/model/Route.java
|
b4a71c934d47d299ce2f7266466d8575ea719506
|
[] |
no_license
|
CorentinMgz/Tracking_app
|
5b1600462ae114dd82bd3cfe757de543fda958cf
|
cae9494a2ed6b4186d678255ed27e0c0a298483b
|
refs/heads/master
| 2023-06-12T07:21:13.112075 | 2021-06-21T04:49:55 | 2021-06-21T04:49:55 | 378,807,026 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,898 |
java
|
package com.example.tracking_app_project.model;
public class Route {
private int id;
private String routeName;
private int distance;
private int duration;
private double averageSpeed;
private int waypointQuantity;
public Route(int id, String routeName, int distance, int duration, double averageSpeed, int waypointQuantity) {
this.id = id;
this.routeName = routeName;
this.distance = distance;
this.duration = duration;
this.averageSpeed = averageSpeed;
this.waypointQuantity = waypointQuantity;
}
public Route() {
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getRouteName() {
return routeName;
}
public void setRouteName(String routeName) {
this.routeName = routeName;
}
public int getDistance() {
return distance;
}
public void setDistance(int distance) {
this.distance = distance;
}
public int getDuration() {
return duration;
}
public void setDuration(int duration) {
this.duration = duration;
}
public double getAverageSpeed() {
return averageSpeed;
}
public void setAverageSpeed(double averageSpeed) {
this.averageSpeed = averageSpeed;
}
public int getWaypointQuantity() {
return waypointQuantity;
}
public void setWaypointQuantity(int waypointQuantity) {
this.waypointQuantity = waypointQuantity;
}
@Override
public String toString() {
return "Route{" +
"routeName='" + routeName + '\'' +
", distance=" + distance +
", duration=" + duration +
", averageSpeed=" + averageSpeed +
", waypointQuantity=" + waypointQuantity +
'}';
}
}
|
[
"[email protected]"
] | |
22fe52fa857d89e87220639efb7dc9451bae1ee5
|
c3f2f311d045bbda42333f284e7c886ea97b0136
|
/src/main/java/sorialopez/carlos/Jugador.java
|
5e71bd8eecf2cc0c21250f1f9891df439ac5d4b9
|
[] |
no_license
|
EduardoCM/EjerciciosClaseDos
|
5e53b121cb8ebd807dcda7dfa69b31dc6db6642c
|
b4bd764030b071a5bb6e824c280aa157fa4296e9
|
refs/heads/master
| 2021-01-22T01:11:14.538377 | 2017-09-02T21:09:58 | 2017-09-02T21:09:58 | 102,207,095 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,671 |
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 sorialopez.carlos;
/**
*
* @author carlos
*/
public class Jugador {
// Al menos 4 tipos de datos
public String nombre;
public String posicion;
public int numero;
public double sueldo;
public int numeroPartidos;
//Metodos (1 void, 1 return, Acepte Parametros)
public void registrarJugador(){
System.out.println("Registrando al jugador: " + nombre + " con el numero: " +numero );
}
public void bajaJugador(int numero){
System.out.println("Dando de baja al jugador: " + nombre + " con el numero: " +numero );
}
public Jugador buscarJugador(int numero){
System.out.println("Buscando al jugador: " + numero);
return new Jugador();
}
public void actualizarPartidos(Jugador jugador, int partidos){
jugador.numeroPartidos = jugador.numeroPartidos + partidos;
System.out.println("Actualizando el numero de partidos al jugador: " + jugador.nombre);
System.out.println("Numer de Partidos jugados de " + jugador.nombre + ": "+ jugador.numeroPartidos);
}
public void mostrarDatosJugador(){
System.out.println("===== Informacion Jugador ==========");
System.out.println("Nombre: " + nombre);
System.out.println("Numero: " + numero);
System.out.println("Posicion: " + posicion);
System.out.println("Sueldo: " + sueldo);
System.out.println("Partidos jugados: " + numeroPartidos);
}
}
|
[
"[email protected]"
] | |
29908fe1fb4014c8c9be1147788de21abc2c7da9
|
14a66332dda1aaa33e3d1abb7f6a0fc76a5b5db0
|
/src/main/java/com/tangibleinterfaces/datamanage/domain/Category.java
|
279cd8e341abfb0cf22b61e8f45d662b19bed6a6
|
[] |
no_license
|
mluquec/tuic-estia
|
aefc9dbd3405de912982f271507b5794242946ea
|
6641bdae8ed0ee15456c1d69e4ae43f301fe5eb3
|
refs/heads/master
| 2021-01-20T09:49:48.291423 | 2017-08-28T06:30:06 | 2017-08-28T06:30:06 | 101,610,488 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,045 |
java
|
package com.tangibleinterfaces.datamanage.domain;
import java.util.List;
import org.springframework.data.annotation.Id;
public class Category {
@Id
private String name;
private String description;
private Category father;
private String[] characteristics;
public Category(){}
@Override
public String toString() {
return "{" +
"name='" + name + '\'' +
", description='" + description + '\'' +
'}';
}
public String[] getCharacteristics()
{
return characteristics;
}
public String getName() {
return name;
}
public Category getFather() {
return father;
}
public String getDescription() {
return description;
}
public void setName(String name) {
this.name = name;
}
public void setFather(Category father) {
this.father = father;
}
public void setDescription(String description) {
this.description = description;
}
public void setCharacteristics(String[] characteristic)
{
this.characteristics =characteristic;
}
}
|
[
"[email protected]"
] | |
85ec2ab206f391568612fdaead3d585f8678e154
|
13235a6098dccfb7aaca0ab5c836438700678b4a
|
/src/com/epm/acmi/struts/action/SecondaryDocExepAction.java
|
56494b1b89474738ab1371b3c10dd632716efb7c
|
[] |
no_license
|
BuffaloBorn/acmicc
|
f7a6123d5c345122e90e4fb79af0c33928d25aa4
|
8fcad8797658ccf991f4ea75cb9c6302bd42e700
|
refs/heads/master
| 2021-01-01T06:02:39.089599 | 2017-07-16T12:40:39 | 2017-07-16T12:40:39 | 97,339,400 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 9,962 |
java
|
package com.epm.acmi.struts.action;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;
import com.Optika.message.ModifyIndexResponse;
import com.Optika.message.SavedSearchPrompt;
import com.Optika.message.SavedSearchResult;
import com.Optika.message.SavedSearchResultsArray;
import com.Optika.message.UserDefinedField;
import com.cc.acmi.common.Forwards;
import com.cc.acmi.common.Messages;
import com.cc.acmi.common.User;
import com.cc.framework.adapter.struts.ActionContext;
import com.cc.framework.common.SortOrder;
import com.cc.framework.http.HttpUtil;
import com.cc.framework.ui.control.ControlActionContext;
import com.cc.framework.ui.control.SimpleListControl;
import com.epm.acmi.struts.Constants;
import com.epm.acmi.struts.form.dsp.DisplayDocument;
import com.epm.acmi.struts.form.dsp.DisplayDocumentList;
import com.epm.acmi.struts.form.dsp.StellentClient;
import com.epm.acmi.util.ACMICache;
import com.epm.acmi.util.LocalProperties;
import com.epm.acmi.util.StellentUpdateAudit;
import com.epm.stellent.StellentAdapterFactory;
import com.epm.stellent.adapter.StellentAdapter;
/**
* DocException handles requests from document exception page.
*
* @author Jay Hombal
*/
public class SecondaryDocExepAction extends MainTabPageBaseAction {
private static Logger log = Logger.getLogger(SecondaryDocExepAction.class);
/**
* Constructor
*/
public SecondaryDocExepAction() {
super();
}
/**
* Return tab page Id
*/
public String getTabPageId() {
return TABPAGE3;
}
/**
* This method is called by Controller Servlet. This method is specific to Common Controls API
*
* @param ctx
* ActionContext
* @throws java.lang.Exception
*/
public void doExecute(ActionContext ctx) throws IOException, ServletException {
ctx.forwardToAction("/main/actpend?ctrl=maintabset&action=TabClick¶m=tab2");
}
/**
* Fill's and refresh's the ListControl from the Database
*
* @param ctx
* ControlActionContext
* @throws java.lang.Exception
*/
private void refreshList(ActionContext ctx) throws Exception {
log.debug("Begin refreshList()");
User user = (User) ctx.session().getAttribute(Constants.loggedUser);
String AAID = StellentClient.loginByUserNonRedundant(user);
log.debug("AAID " + AAID);
DisplayDocumentList ddl = StellentClient.getDisplayDocumentList(Constants.expGFID, AAID);
StellentClient.logout(AAID);
// secondly create the ListControl and populate it
// with the Data to display
SimpleListControl docList = new SimpleListControl();
docList.setDataModel(ddl);
ctx.session().setAttribute("expdoclist", docList);
log.debug("End refreshList()");
}
/**
* This Method is called if the Sort-Icon in a Column is clicked
*
* @param ctx
* ControlActionContext
* @param column
* Column to sort
* @param direction
* Direction (ASC, DESC)
*/
public void expdoclist_onSort(ControlActionContext ctx, String column, SortOrder direction) throws Exception {
log.debug("Begin expdoclist_onSort");
DisplayDocumentList ddl = (DisplayDocumentList) ctx.control().getDataModel();
ddl.sortByColumn(column, direction);
ctx.control().execute(ctx, column, direction);
log.debug("End expdoclist_onSort");
}
/**
* This Method is called if the Sort-Icon in a Column is clicked
*
* @param ctx
* ControlActionContext
*/
public void expdoclist_onViewdoc(ControlActionContext ctx) throws Exception {
log.debug("Begin expdoclist_onViewdoc");
String LUCID = ctx.request().getParameter("LUCID");
try {
if (LUCID != null) {
SimpleListControl slc = (SimpleListControl) ctx.session().getAttribute("expdoclist");
DisplayDocumentList ddl = (DisplayDocumentList) slc.getDataModel();
int size = ddl.size();
for (int i = 0; i < size; i++) {
String lucId = ddl.getUniqueKey(i);
if (lucId.equals(LUCID)) {
StringBuffer sb = new StringBuffer();
DisplayDocument dd = (DisplayDocument) ddl.getElementAt(i);
sb.append("http://dev7000/ibpmweb/default.asp?ToolName=AWVWR&Viewer=Image");
sb.append("&LUCID=" + LUCID);
sb.append("&MIMETYPE=image/tiff");
sb.append("&SSPROVIDERID=" + dd.getSSPROVIDERID());
sb.append("&TABLENAME=" + dd.getTABLENAME());
sb.append("&ROWIDENTIFIER=" + dd.getROWIDENTIFIER());
sb.append("&INDEXPROVIDER=" + dd.getINDEXPROVIDER());
sb.append("&EOF=1");
String encodedURL = HttpUtil.urlEncode(sb.toString());
ctx.response().sendRedirect(encodedURL);
}
}
}
} catch (Throwable ex) {
ctx.addGlobalError(Messages.ERROR_INIT_FORMBEAN, ex.getClass().getName() + " " + ex.getMessage());
ctx.forwardByName(Forwards.BACK);
throw new Exception(ex);
}
log.debug("End expdoclist_onViewdoc");
}
/**
* This Method is called if the Refresh-Button is clicked
*
* @param ctx
* ControlActionContext
*/
public void expdoclist_onRefresh(ControlActionContext ctx) throws Exception {
try {
this.refreshList(ctx);
} catch (Throwable t) {
log.error(t);
ctx.addGlobalError(Messages.ERROR_DATABASE_QUERY);
throw new Exception(t);
}
}
// ----------------------------------------------
// TabSet-Callback Methods
// ----------------------------------------------
/**
* This Method is called, when the Tabpage is clicked
*
* @param ctx
* The ControlActionContext
* @param seltab
* The selected TabPage
*/
public void maintabset_onTabClick(ControlActionContext ctx, String seltab) throws Exception {
refreshList(ctx);
ctx.control().execute(ctx, seltab);
}
/**
* This Method is called when the Edit-Column is clicked. In our Example we want to edit the Userdata. Therefor we
* call the UserEditAction
*
* @param ctx
* ControlActionContext
* @param key
* UniqueKey, as it was created in the Datamodel (e.g. the Primarykey)
* @throws Exception
*/
public void expdoclist_onEdit(ControlActionContext ctx, String key) throws Exception {
ctx.forwardByName(Forwards.EDIT, key);
}
/**
* This Method is called when the Edit-Column is clicked. In our Example we want to edit the Userdata. Therefor we
* call the UserEditAction
*
* @param ctx
* ControlActionContext
* @param key
* UniqueKey, as it was created in the Datamodel (e.g. the Primarykey)
* @throws Exception
*/
public void expdoclist_onDelete(ControlActionContext ctx, String key) throws Exception {
String AAID = null;
try {
String lucId = key;
//User user = (User) ctx.session().getAttribute(Constants.loggedUser);
AAID = StellentClient.login();
HttpSession session = ctx.session();
SimpleListControl slc = (SimpleListControl) session.getAttribute("expdoclist");
DisplayDocumentList ddml = (DisplayDocumentList) slc.getDataModel();
SavedSearchPrompt ssps[] = null;
if (ddml != null) {
int size = ddml.size();
DisplayDocument dd = null;
boolean found = false;
// Retrive the document from the session
for (int i = 0; i < size; i++) {
dd = (DisplayDocument) ddml.getElementAt(i);
if (dd.getLUCID().equals(lucId)) {
found = true;
break;
}
}
if (!found || (isEmptyString(lucId) && (isEmptyString(dd.getGFID())) && (isEmptyString(dd.getDocCode()))))
throw new Exception("Cannot proceed with saved search if parameters are either empty or null");
// Create Search Name
String searchName = Constants.allDocsSearchName;
// Retrive Saved Search Prompts
ssps = ACMICache.getSavedSearchPrompts(searchName);
for (int j = 0; j < ssps.length; j++) {
SavedSearchPrompt ssp = ssps[j];
if (ssp.getDisplayText().equals("GFID")) {
ssp.setValue(dd.getGFID());
continue;
}
if (ssp.getDisplayText().equals("DocCode")) {
ssp.setValue(dd.getDocCode());
continue;
}
if (ssp.getDisplayText().equals("RECID")) {
ssp.setValue(lucId);
continue;
}
}
if (ssps != null) {
String acorde2Soap_address = LocalProperties.getProperty("acorde2Soap_address");
StellentAdapter sAdapter = StellentAdapterFactory.getStellentAdapter(acorde2Soap_address);
/**
* Note: Each user when logging into EPM WebApp will obtain a AAID (Authentication Ticket) From ACMI
* web application
*/
SavedSearchResult ssrs[] = sAdapter.executeSavedSearch(searchName, AAID, ssps);
if (ssrs != null) {
SavedSearchResult ssr = ssrs[0];
UserDefinedField udfs[] = ssr.getUserDefinedFieldValues();
for (int i = 0; i < udfs.length; i++) {
UserDefinedField audf = udfs[i];
if (audf.getName().equals("GFID")) {
audf.setValue(Constants.delGFID);
break;
}
}
SavedSearchResultsArray ssra = new SavedSearchResultsArray();
ssr.setUserDefinedFieldValues(udfs);
ssr.setIsSelected(true);
ssrs[0] = ssr;
ssra.setSearchResults(ssrs);
ModifyIndexResponse msr = sAdapter.updateMetaData(AAID, ssra);
StellentUpdateAudit.auditStellentUpdate(((User)ctx.session().getAttribute(Constants.loggedUser)).getUserId(), Constants.delGFID, lucId, StellentUpdateAudit.AUDIT_UPDATE);
log.error(msr.getAcordeError().getErrorMessage());
}
ctx.forwardToAction("main/docexep?ctrl=maintabset&action=TabClick¶m=tab4");
}
}
} catch (Throwable t) {
log.error(Messages.STELLENT_ACCESS_FAILED, t);
ctx.addGlobalError(Messages.STELLENT_ACCESS_FAILED, t.getClass().getName() + " exception thrown with message: " + t.getMessage());
throw new Exception(t);
} finally
{
if (AAID != null)
StellentClient.logout(AAID);
}
}
private static boolean isEmptyString(String str) {
return str == null || str.length() == 0;
}
}
|
[
"[email protected]"
] | |
e6301d95a5439f24cbbf8631dd0bd5c975637b5a
|
5acf48162a1e0dbe5061f10484dcaff3f41917ff
|
/app/src/main/java/com/kwizeen/fooddelivery/app/utils/ImageRequest.java
|
38ac2b2b324752923dd0b60c982bf26782b45660
|
[] |
no_license
|
StarNeit/Android-Kwizeen
|
5238e2c19d34fdb12cdebc9370eb570e3e2e80d6
|
8f059079c73c25dea4bffeb2b61b0a6727314418
|
refs/heads/master
| 2020-07-26T02:15:06.888194 | 2016-11-13T19:43:17 | 2016-11-13T19:43:17 | 73,638,462 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,189 |
java
|
package com.kwizeen.fooddelivery.app.utils;
/**
* Created by PLEASE on 22/01/16.
*/
import android.util.Log;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* class to make Http Request to the web
*/
public class ImageRequest {
private static final String TAG = ImageRequest.class.getSimpleName();
public static String post(String serverUrl,String dataToSend){
try {
URL url = new URL(serverUrl);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
//set timeout of 30 seconds
con.setConnectTimeout(1000 * 30);
con.setReadTimeout(1000 * 30);
//method
con.setRequestMethod("POST");
con.setDoOutput(true);
OutputStream os = con.getOutputStream();
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os,"UTF-8"));
//make request
writer.write(dataToSend);
writer.flush();
writer.close();
os.close();
//get the response
int responseCode = con.getResponseCode();
if(responseCode == HttpURLConnection.HTTP_OK){
//read the response
StringBuilder sb = new StringBuilder();
BufferedReader reader = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String line;
//loop through the response from the server
while ((line = reader.readLine()) != null){
sb.append(line).append("\n");
}
//return the response
return sb.toString();
}else{
Log.e(TAG,"ERROR - Invalid response code from server "+ responseCode);
return null;
}
} catch (IOException e) {
e.printStackTrace();
Log.e(TAG,"ERROR "+e);
return null;
}
}
}
|
[
"[email protected]"
] | |
bc79c900f41696b91cb348b0073e0d4bd399b81c
|
1150f16bf7f7391ed7e3d7e1b67c4897008be532
|
/em/src/main/java/com/exc/street/light/em/config/MybatisPlusConfig.java
|
7e1522295b80927102343b73602701808ddcb80c
|
[] |
no_license
|
dragonxu/street_light_yancheng
|
e0c957214aae2ebbba2470438c16cd1f8bf600ec
|
5d0d4fd4af0eb6b54f7e1ecef9651a3b9208d7f7
|
refs/heads/master
| 2023-01-15T19:36:53.113876 | 2020-11-24T07:37:34 | 2020-11-24T07:37:34 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 796 |
java
|
package com.exc.street.light.em.config;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Mybatis-plus配置类
*
* @author Huang Min
* @date 2019/06/22
*/
@Configuration
public class MybatisPlusConfig {
/**
* Mybatis-Plus SQL执行效率插件【生产环境可以关闭】
*/
@Bean
public PerformanceInterceptor performanceInterceptor() {
return new PerformanceInterceptor();
}
/**
* 分页插件
*/
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
}
|
[
"[email protected]"
] | |
67c2e261006f40c142a781efdce94222d4a0c5c1
|
806f76edfe3b16b437be3eb81639d1a7b1ced0de
|
/src/com/huawei/pluginaf500/ui/C5793b.java
|
b4618404d05056c339bd64b0e1d750c68acc8a3a
|
[] |
no_license
|
magic-coder/huawei-wear-re
|
1bbcabc807e21b2fe8fe9aa9d6402431dfe3fb01
|
935ad32f5348c3d8c8d294ed55a5a2830987da73
|
refs/heads/master
| 2021-04-15T18:30:54.036851 | 2018-03-22T07:16:50 | 2018-03-22T07:16:50 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 872 |
java
|
package com.huawei.pluginaf500.ui;
/* compiled from: AF500BaseActivity */
public enum C5793b {
BT_NONE(0),
BT_CONNECTING(2),
BT_CONNECTTED(3),
BT_ALARM_SYN_FAIL(4),
BT_ALARM_SYN_SUCCESS(5),
BT_SET_SLEEP_SYN_FAIL(6),
BT_SET_SLEEP_SYN_SUCCESS(7),
BT_SET_SPORT_SYN_FAIL(8),
BT_SET_SPORT_SYN_SUCCESS(9),
BC_DISPLAY_STAE(33),
BC_GESTURE_STATE(34),
UPDATE_SETTING_VIEW(35),
DISPLAY_GESTURE_SYN_FAIL(36),
BIND_SERVICE_SUCCESS(41),
UNKNOWN(10086);
private int f19920p;
private C5793b(int i) {
this.f19920p = i;
}
public static C5793b m26878a(int i) {
for (C5793b c5793b : C5793b.values()) {
if (c5793b.f19920p == i) {
return c5793b;
}
}
return UNKNOWN;
}
public int m26879a() {
return this.f19920p;
}
}
|
[
"[email protected]"
] | |
db4d4829c4bad5de8ec9dbea10acd652d5d979c1
|
eaa89345ff97ad212a2115968b4683c776377aea
|
/Antifraud/stage5/test/AntifraudPreviousStagesTest.java
|
b9c7ff8e0824bc4ab5f395a28f29bac8a30ccd4d
|
[] |
no_license
|
hanifmaleki/Anti-Fraud
|
6d4042260f01d2291451208c5ee305f3d9a4c47a
|
f5bc84d9e73363d181afd2f1f3a270084b964a7b
|
refs/heads/main
| 2023-08-23T04:13:38.053625 | 2021-11-02T17:15:56 | 2021-11-02T17:15:56 | 354,927,630 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,530 |
java
|
import antifraud.AntifraudApplication;
import antifraud.model.User;
import data.TestDataProvider;
import org.hyperskill.hstest.dynamic.DynamicTest;
import org.hyperskill.hstest.testcase.CheckResult;
public class AntifraudPreviousStagesTest /*extends util.AntifraudBaseTest*/ {
/*
private final TestDataProvider data = new TestDataProvider();
private final TransactionTestUtil transactionUtil = new TransactionTestUtil(this);
private final CardAndIPTestUtil cardIpUtil = new CardAndIPTestUtil(this);
private final UserTestUtil userUtil = new UserTestUtil(this);
private final TransactionTypeTestUtil typeUtil = new TransactionTypeTestUtil(this);
private final AuthorizationTestUtil authorizationUtil = new AuthorizationTestUtil(this, cardIpUtil, transactionUtil, userUtil, typeUtil, data);
public AntifraudPreviousStagesTest() {
super(AntifraudApplication.class);
}
@DynamicTest
// Check if defaultUser exist
CheckResult test1() {
return runtTestScenario(this::checkIfDefaultAdminAddedByDefault);
}
@DynamicTest
// Test IP rest controller
CheckResult test2() {
return runtTestScenario(this::hashTest);
}
@DynamicTest
// Adding incomplete users and expect 209
CheckResult test3() {
return runtTestScenario(this::checkAuthentication);
}
@DynamicTest
// Delete non-existing user and except 404 NOT_FOUND
CheckResult test4() {
return runtTestScenario(this::checkAuthorisation);
}
private void checkIfDefaultAdminAddedByDefault() {
log("Check if default admin user has already added");
userUtil.getUsersAndExpectSize(0);
}
private void hashTest() {
userUtil.checkHashingPassword(data.user.adminUser1);
userUtil.checkHashingPassword(data.user.basicUser2);
}
// Just try trx query with all types of users
private void checkAuthentication() {
authorizationUtil.checkAuthentication(data.user.adminUser1);
authorizationUtil.checkAuthentication(data.user.supportUser1);
authorizationUtil.checkAuthentication(data.user.basicUser2);
}
private void checkAuthorisation() {
authorizationUtil.checkAuthorizations(data.user.adminUser1);
authorizationUtil.checkAuthorizations(data.user.supportUser1);
authorizationUtil.checkAuthorizations(data.user.basicUser2);
}
@Override
public User getDefaultAdmin() {
return data.user.adminUser0;
}
*/
}
|
[
"[email protected]"
] | |
0ddef69236979587bdeb44330af325f93b822a97
|
f618d873f9bd697df4b6b4b3843a7cb153a85a37
|
/build/generated/source/proto/main/java/com/proto/blog/UpdateBlogRequest.java
|
c6db93aa26ace7700db0090ab2b35997429df50a
|
[] |
no_license
|
andremarques2911/blogs-service-grpc
|
3c5ff91dac21f09eacab0869beda53b90831aa0f
|
dfae992bb0b158a5822f0013296a1d0a1b341a84
|
refs/heads/master
| 2023-08-09T08:41:34.482719 | 2021-09-07T20:26:53 | 2021-09-07T20:26:53 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | true | 19,313 |
java
|
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: blog/blog.proto
package com.proto.blog;
/**
* Protobuf type {@code blog.UpdateBlogRequest}
*/
public final class UpdateBlogRequest extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:blog.UpdateBlogRequest)
UpdateBlogRequestOrBuilder {
private static final long serialVersionUID = 0L;
// Use UpdateBlogRequest.newBuilder() to construct.
private UpdateBlogRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private UpdateBlogRequest() {
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new UpdateBlogRequest();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private UpdateBlogRequest(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
com.proto.blog.Blog.Builder subBuilder = null;
if (blog_ != null) {
subBuilder = blog_.toBuilder();
}
blog_ = input.readMessage(com.proto.blog.Blog.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(blog_);
blog_ = subBuilder.buildPartial();
}
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.proto.blog.BlogOuterClass.internal_static_blog_UpdateBlogRequest_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.proto.blog.BlogOuterClass.internal_static_blog_UpdateBlogRequest_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.proto.blog.UpdateBlogRequest.class, com.proto.blog.UpdateBlogRequest.Builder.class);
}
public static final int BLOG_FIELD_NUMBER = 1;
private com.proto.blog.Blog blog_;
/**
* <code>.blog.Blog blog = 1;</code>
* @return Whether the blog field is set.
*/
@java.lang.Override
public boolean hasBlog() {
return blog_ != null;
}
/**
* <code>.blog.Blog blog = 1;</code>
* @return The blog.
*/
@java.lang.Override
public com.proto.blog.Blog getBlog() {
return blog_ == null ? com.proto.blog.Blog.getDefaultInstance() : blog_;
}
/**
* <code>.blog.Blog blog = 1;</code>
*/
@java.lang.Override
public com.proto.blog.BlogOrBuilder getBlogOrBuilder() {
return getBlog();
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (blog_ != null) {
output.writeMessage(1, getBlog());
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (blog_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, getBlog());
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.proto.blog.UpdateBlogRequest)) {
return super.equals(obj);
}
com.proto.blog.UpdateBlogRequest other = (com.proto.blog.UpdateBlogRequest) obj;
if (hasBlog() != other.hasBlog()) return false;
if (hasBlog()) {
if (!getBlog()
.equals(other.getBlog())) return false;
}
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
if (hasBlog()) {
hash = (37 * hash) + BLOG_FIELD_NUMBER;
hash = (53 * hash) + getBlog().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.proto.blog.UpdateBlogRequest parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.proto.blog.UpdateBlogRequest parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.proto.blog.UpdateBlogRequest parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.proto.blog.UpdateBlogRequest parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.proto.blog.UpdateBlogRequest parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.proto.blog.UpdateBlogRequest parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.proto.blog.UpdateBlogRequest parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.proto.blog.UpdateBlogRequest parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static com.proto.blog.UpdateBlogRequest parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static com.proto.blog.UpdateBlogRequest parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static com.proto.blog.UpdateBlogRequest parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.proto.blog.UpdateBlogRequest parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(com.proto.blog.UpdateBlogRequest prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code blog.UpdateBlogRequest}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:blog.UpdateBlogRequest)
com.proto.blog.UpdateBlogRequestOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.proto.blog.BlogOuterClass.internal_static_blog_UpdateBlogRequest_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.proto.blog.BlogOuterClass.internal_static_blog_UpdateBlogRequest_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.proto.blog.UpdateBlogRequest.class, com.proto.blog.UpdateBlogRequest.Builder.class);
}
// Construct using com.proto.blog.UpdateBlogRequest.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
if (blogBuilder_ == null) {
blog_ = null;
} else {
blog_ = null;
blogBuilder_ = null;
}
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.proto.blog.BlogOuterClass.internal_static_blog_UpdateBlogRequest_descriptor;
}
@java.lang.Override
public com.proto.blog.UpdateBlogRequest getDefaultInstanceForType() {
return com.proto.blog.UpdateBlogRequest.getDefaultInstance();
}
@java.lang.Override
public com.proto.blog.UpdateBlogRequest build() {
com.proto.blog.UpdateBlogRequest result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.proto.blog.UpdateBlogRequest buildPartial() {
com.proto.blog.UpdateBlogRequest result = new com.proto.blog.UpdateBlogRequest(this);
if (blogBuilder_ == null) {
result.blog_ = blog_;
} else {
result.blog_ = blogBuilder_.build();
}
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.proto.blog.UpdateBlogRequest) {
return mergeFrom((com.proto.blog.UpdateBlogRequest)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.proto.blog.UpdateBlogRequest other) {
if (other == com.proto.blog.UpdateBlogRequest.getDefaultInstance()) return this;
if (other.hasBlog()) {
mergeBlog(other.getBlog());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.proto.blog.UpdateBlogRequest parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.proto.blog.UpdateBlogRequest) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private com.proto.blog.Blog blog_;
private com.google.protobuf.SingleFieldBuilderV3<
com.proto.blog.Blog, com.proto.blog.Blog.Builder, com.proto.blog.BlogOrBuilder> blogBuilder_;
/**
* <code>.blog.Blog blog = 1;</code>
* @return Whether the blog field is set.
*/
public boolean hasBlog() {
return blogBuilder_ != null || blog_ != null;
}
/**
* <code>.blog.Blog blog = 1;</code>
* @return The blog.
*/
public com.proto.blog.Blog getBlog() {
if (blogBuilder_ == null) {
return blog_ == null ? com.proto.blog.Blog.getDefaultInstance() : blog_;
} else {
return blogBuilder_.getMessage();
}
}
/**
* <code>.blog.Blog blog = 1;</code>
*/
public Builder setBlog(com.proto.blog.Blog value) {
if (blogBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
blog_ = value;
onChanged();
} else {
blogBuilder_.setMessage(value);
}
return this;
}
/**
* <code>.blog.Blog blog = 1;</code>
*/
public Builder setBlog(
com.proto.blog.Blog.Builder builderForValue) {
if (blogBuilder_ == null) {
blog_ = builderForValue.build();
onChanged();
} else {
blogBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* <code>.blog.Blog blog = 1;</code>
*/
public Builder mergeBlog(com.proto.blog.Blog value) {
if (blogBuilder_ == null) {
if (blog_ != null) {
blog_ =
com.proto.blog.Blog.newBuilder(blog_).mergeFrom(value).buildPartial();
} else {
blog_ = value;
}
onChanged();
} else {
blogBuilder_.mergeFrom(value);
}
return this;
}
/**
* <code>.blog.Blog blog = 1;</code>
*/
public Builder clearBlog() {
if (blogBuilder_ == null) {
blog_ = null;
onChanged();
} else {
blog_ = null;
blogBuilder_ = null;
}
return this;
}
/**
* <code>.blog.Blog blog = 1;</code>
*/
public com.proto.blog.Blog.Builder getBlogBuilder() {
onChanged();
return getBlogFieldBuilder().getBuilder();
}
/**
* <code>.blog.Blog blog = 1;</code>
*/
public com.proto.blog.BlogOrBuilder getBlogOrBuilder() {
if (blogBuilder_ != null) {
return blogBuilder_.getMessageOrBuilder();
} else {
return blog_ == null ?
com.proto.blog.Blog.getDefaultInstance() : blog_;
}
}
/**
* <code>.blog.Blog blog = 1;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
com.proto.blog.Blog, com.proto.blog.Blog.Builder, com.proto.blog.BlogOrBuilder>
getBlogFieldBuilder() {
if (blogBuilder_ == null) {
blogBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
com.proto.blog.Blog, com.proto.blog.Blog.Builder, com.proto.blog.BlogOrBuilder>(
getBlog(),
getParentForChildren(),
isClean());
blog_ = null;
}
return blogBuilder_;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:blog.UpdateBlogRequest)
}
// @@protoc_insertion_point(class_scope:blog.UpdateBlogRequest)
private static final com.proto.blog.UpdateBlogRequest DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.proto.blog.UpdateBlogRequest();
}
public static com.proto.blog.UpdateBlogRequest getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<UpdateBlogRequest>
PARSER = new com.google.protobuf.AbstractParser<UpdateBlogRequest>() {
@java.lang.Override
public UpdateBlogRequest parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new UpdateBlogRequest(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<UpdateBlogRequest> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<UpdateBlogRequest> getParserForType() {
return PARSER;
}
@java.lang.Override
public com.proto.blog.UpdateBlogRequest getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
|
[
"[email protected]"
] | |
9dc7a72fae6bbb8eb6121af1e694fce3cedacfec
|
9270e6b50f80d38e0c01b7e2f8c061a7bb84530d
|
/src/main/java/com/code/generation/v1_3/exception/ManyDefinitionForSameCallableFoundException.java
|
9afe72f8683f3ab663e67474501ab1165257e9fb
|
[] |
no_license
|
pmulsant/BBScript
|
3d2630183989c8ddf91d39d8ed596fa29335656c
|
45c029364d87963c5cb5370d260fa438fa0ccef6
|
refs/heads/master
| 2023-01-19T01:33:01.563608 | 2020-11-24T06:47:19 | 2020-11-24T06:47:19 | 315,541,047 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 380 |
java
|
package com.code.generation.v1_3.exception;
import com.code.generation.RuntimeCustomException;
import com.code.generation.v1_3.elements.strong_type.callables.Callable;
public class ManyDefinitionForSameCallableFoundException extends RuntimeCustomException {
public ManyDefinitionForSameCallableFoundException(Callable callable) {
super(callable.toString());
}
}
|
[
"[email protected]"
] | |
3373d1e00d6b32fa9f742bca653e7e0c7de9fdf5
|
b9217b6be99e691a4246d37c9aaad5264b78d545
|
/src/com/reviewclass1/AnnotationDemo.java
|
ce3cb92945d482d16b5ffdb925710d4ebacb7897
|
[] |
no_license
|
StDrongo/TestNGBasic
|
9e70858ee86d0f2520e0f1833655b7bb58618363
|
efe1380faebcd60bf4d7c7bc564faea5d673898a
|
refs/heads/master
| 2020-12-13T14:44:01.803841 | 2020-01-17T02:38:11 | 2020-01-17T02:38:11 | 234,448,824 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 446 |
java
|
package com.reviewclass1;
import org.testng.annotations.Test;
public class AnnotationDemo {
@Test(priority=1)
public void D() {
System.out.println("Open Browser");
}
@Test(priority=3)
public void A() {
System.out.println("PIM Test case");
}
@Test(priority=2)
public void B() {
System.out.println("Leave Test Case");
}
@Test(priority=4)
public void C() {
System.out.println("close browser");
}
}
|
[
"[email protected]"
] | |
c76ed8af5ed15742491cd8f5214533f04d0c3837
|
1e465fd75fe6167c4b1be1cf268820fb17a1a719
|
/src/main/java/com/esphere/gecko/util/CommonUtils.java
|
9ddb288a9cdcd0848b5fad4a562fdd68313f7614
|
[] |
no_license
|
dswami8801/gecko
|
f1db3656d29baa0e563f0740dc58ce465c5ace14
|
eaa2f33ebbdf6945099feb747961babbed4f7eeb
|
refs/heads/master
| 2022-11-23T09:56:50.315102 | 2019-07-23T03:29:07 | 2019-07-23T03:29:07 | 115,512,129 | 0 | 0 | null | 2022-11-16T11:53:16 | 2017-12-27T10:58:07 |
Java
|
UTF-8
|
Java
| false | false | 63 |
java
|
package com.esphere.gecko.util;
public class CommonUtils {
}
|
[
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.