blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9d7a3c2062f4f3420d9b45b10f8467cd53843242 | baa246d5d13925a40b0b9d9bf8b68ebb7d5b48d3 | /app/src/main/java/wrteam/ecommerce/app/helper/AppController.java | 6587db1e0676251cfb24147aa1367ef81a53d7ba | [] | no_license | Omender123/Ekart | 9a85c4498bcde456926e87a93901b0ed3210e295 | 744323802cd0255a063f6a77284a285024417d2d | refs/heads/master | 2022-12-28T12:33:03.247844 | 2020-10-21T05:21:36 | 2020-10-21T05:21:36 | 305,912,004 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,061 | java | package wrteam.ecommerce.app.helper;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Toast;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.Volley;
import wrteam.ecommerce.app.R;
public class AppController extends Application {
public static final String TAG = AppController.class.getSimpleName();
private RequestQueue mRequestQueue;
private SharedPreferences sharedPref;
private static AppController mInstance;
private com.android.volley.toolbox.ImageLoader mImageLoader;
AppEnvironment appEnvironment;
@Override
public void onCreate() {
super.onCreate();
mInstance = this;
appEnvironment = AppEnvironment.SANDBOX;
sharedPref = this.getSharedPreferences(getString(R.string.app_name), Context.MODE_PRIVATE);
FontsOverride.setDefaultFont(this, "DEFAULT", "lato.ttf");
FontsOverride.setDefaultFont(this, "MONOSPACE", "lato.ttf");
FontsOverride.setDefaultFont(this, "SERIF", "lato.ttf");
FontsOverride.setDefaultFont(this, "SANS_SERIF", "lato.ttf");
//AppSignatureHelper appSignatureHelper = new AppSignatureHelper(this);
//System.out.println("=====Application -> " + appSignatureHelper.getAppSignatures());
}
public AppEnvironment getAppEnvironment() {
return appEnvironment;
}
public void setAppEnvironment(AppEnvironment appEnvironment) {
this.appEnvironment = appEnvironment;
}
public static void setWindowFlag(final int bits, boolean on, Activity context) {
Window win = context.getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
if (on) {
winParams.flags |= bits;
} else {
winParams.flags &= ~bits;
}
win.setAttributes(winParams);
}
public static void TransparentStatus(Activity context) {
if (Build.VERSION.SDK_INT >= 19 && Build.VERSION.SDK_INT < 21) {
setWindowFlag(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, true, context);
}
if (Build.VERSION.SDK_INT >= 19) {
context.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}
if (Build.VERSION.SDK_INT >= 21) {
setWindowFlag(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, false, context);
context.getWindow().setStatusBarColor(Color.TRANSPARENT);
//context.getWindow().setNavigationBarColor(Color.TRANSPARENT);
}
}
public void setData(String id, String value) {
sharedPref.edit().putString(id, value).apply();
}
public String getData(String id) {
return sharedPref.getString(id, "");
}
public String getDeviceToken() {
return sharedPref.getString("DEVICETOKEN", "");
}
public void setDeviceToken(String token) {
sharedPref.edit().putString("DEVICETOKEN", token).apply();
}
public Boolean getISLogin() {
return sharedPref.getBoolean("islogin", false);
}
public void setLogin(Boolean islogin) {
sharedPref.edit().putBoolean("islogin", islogin).apply();
}
public Boolean getIsVarified() {
return sharedPref.getBoolean("isvarified", false);
}
public void setVarified(Boolean isvarified) {
sharedPref.edit().putBoolean("isvarified", isvarified).apply();
}
public com.android.volley.toolbox.ImageLoader getImageLoader() {
getRequestQueue();
if (mImageLoader == null) {
mImageLoader = new ImageLoader(this.mRequestQueue, new BitmapCache());
}
return this.mImageLoader;
}
public static Boolean isConnected(final Activity activity) {
Boolean check = false;
ConnectivityManager ConnectionManager = (ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = ConnectionManager.getActiveNetworkInfo();
LayoutInflater inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (networkInfo != null && networkInfo.isConnected() == true) {
check = true;
} else {
Toast.makeText(activity, "Check Internet Connection..!!", Toast.LENGTH_SHORT).show();
/* new AlertDialog.Builder(activity)
.setView(v)
.setPositiveButton("Refresh", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
isConnected(activity);
}
})
.show();*/
}
return check;
}
public static synchronized AppController getInstance() {
return mInstance;
}
public RequestQueue getRequestQueue() {
if (mRequestQueue == null) {
mRequestQueue = Volley.newRequestQueue(getApplicationContext());
}
return mRequestQueue;
}
public <T> void addToRequestQueue(Request<T> req, String tag) {
// set the default tag if tag is empty
req.setTag(TextUtils.isEmpty(tag) ? TAG : tag);
getRequestQueue().add(req);
}
public <T> void addToRequestQueue(Request<T> req) {
req.setTag(TAG);
getRequestQueue().add(req);
}
public void cancelPendingRequests(Object tag) {
if (mRequestQueue != null) {
mRequestQueue.cancelAll(tag);
}
}
}
| [
"Os7290915329@gmail.com"
] | Os7290915329@gmail.com |
f39b02b6f6deb25d009c1ff62f0995a611bca447 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/8/8_a05e2e69e7de55b61776631688315698f56f358f/MergeOp/8_a05e2e69e7de55b61776631688315698f56f358f_MergeOp_t.java | 265aa9ebe6af543eb78be015f474e16828157bfd | [] | 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 | 31,022 | java | // Copyright (C) 2008 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.git;
import com.google.gerrit.client.data.ApprovalType;
import com.google.gerrit.client.data.ProjectCache;
import com.google.gerrit.client.reviewdb.Account;
import com.google.gerrit.client.reviewdb.ApprovalCategory;
import com.google.gerrit.client.reviewdb.Branch;
import com.google.gerrit.client.reviewdb.Change;
import com.google.gerrit.client.reviewdb.ChangeApproval;
import com.google.gerrit.client.reviewdb.ChangeMessage;
import com.google.gerrit.client.reviewdb.PatchSet;
import com.google.gerrit.client.reviewdb.Project;
import com.google.gerrit.client.reviewdb.ReviewDb;
import com.google.gerrit.client.rpc.Common;
import com.google.gerrit.client.workflow.FunctionState;
import com.google.gerrit.server.ChangeUtil;
import com.google.gerrit.server.GerritServer;
import com.google.gerrit.server.mail.MergeFailSender;
import com.google.gerrit.server.mail.MergedSender;
import com.google.gwtorm.client.OrmException;
import com.google.gwtorm.client.Transaction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spearce.jgit.errors.IncorrectObjectTypeException;
import org.spearce.jgit.errors.MissingObjectException;
import org.spearce.jgit.lib.AnyObjectId;
import org.spearce.jgit.lib.Commit;
import org.spearce.jgit.lib.Constants;
import org.spearce.jgit.lib.ObjectId;
import org.spearce.jgit.lib.PersonIdent;
import org.spearce.jgit.lib.Ref;
import org.spearce.jgit.lib.RefUpdate;
import org.spearce.jgit.lib.Repository;
import org.spearce.jgit.merge.MergeStrategy;
import org.spearce.jgit.merge.Merger;
import org.spearce.jgit.merge.ThreeWayMerger;
import org.spearce.jgit.revwalk.RevCommit;
import org.spearce.jgit.revwalk.RevSort;
import org.spearce.jgit.revwalk.RevWalk;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.mail.MessagingException;
/**
* Merges changes in submission order into a single branch.
* <p>
* Branches are reduced to the minimum number of heads needed to merge
* everything. This allows commits to be entered into the queue in any order
* (such as ancestors before descendants) and only the most recent commit on any
* line of development will be merged. All unmerged commits along a line of
* development must be in the submission queue in order to merge the tip of that
* line.
* <p>
* Conflicts are handled by discarding the entire line of development and
* marking it as conflicting, even if an earlier commit along that same line can
* be merged cleanly.
*/
public class MergeOp {
private static final Logger log = LoggerFactory.getLogger(MergeOp.class);
private static final String R_HEADS_MASTER =
Constants.R_HEADS + Constants.MASTER;
private static final ApprovalCategory.Id CRVW =
new ApprovalCategory.Id("CRVW");
private static final ApprovalCategory.Id VRIF =
new ApprovalCategory.Id("VRIF");
private final GerritServer server;
private final PersonIdent myIdent;
private final Branch.NameKey destBranch;
private Project destProject;
private final List<CodeReviewCommit> toMerge;
private List<Change> submitted;
private final Map<Change.Id, CommitMergeStatus> status;
private final Map<Change.Id, CodeReviewCommit> newCommits;
private ReviewDb schema;
private Repository db;
private RevWalk rw;
private CodeReviewCommit branchTip;
private CodeReviewCommit mergeTip;
private RefUpdate branchUpdate;
public MergeOp(final GerritServer gs, final Branch.NameKey branch) {
server = gs;
myIdent = server.newGerritPersonIdent();
destBranch = branch;
toMerge = new ArrayList<CodeReviewCommit>();
status = new HashMap<Change.Id, CommitMergeStatus>();
newCommits = new HashMap<Change.Id, CodeReviewCommit>();
}
public void merge() throws MergeException {
final ProjectCache.Entry pe =
Common.getProjectCache().get(destBranch.getParentKey());
if (pe == null) {
throw new MergeException("No such project: " + destBranch.getParentKey());
}
destProject = pe.getProject();
try {
schema = Common.getSchemaFactory().open();
} catch (OrmException e) {
throw new MergeException("Cannot open database", e);
}
try {
mergeImpl();
} finally {
schema.close();
schema = null;
}
}
private void mergeImpl() throws MergeException {
openRepository();
openBranch();
listPendingSubmits();
validateChangeList();
mergeTip = branchTip;
switch (destProject.getSubmitType()) {
case CHERRY_PICK:
cherryPickChanges();
break;
case FAST_FORWARD_ONLY:
case MERGE_ALWAYS:
case MERGE_IF_NECESSARY:
default:
reduceToMinimalMerge();
mergeTopics();
markCleanMerges();
break;
}
updateBranch();
updateChangeStatus();
}
private void openRepository() throws MergeException {
final String name = destBranch.getParentKey().get();
try {
db = server.getRepositoryCache().get(name);
} catch (InvalidRepositoryException notGit) {
final String m = "Repository \"" + name + "\" unknown.";
throw new MergeException(m, notGit);
}
rw = new RevWalk(db) {
@Override
protected RevCommit createCommit(final AnyObjectId id) {
return new CodeReviewCommit(id);
}
};
rw.sort(RevSort.TOPO);
rw.sort(RevSort.COMMIT_TIME_DESC, true);
}
private void openBranch() throws MergeException {
try {
branchUpdate = db.updateRef(destBranch.get());
if (branchUpdate.getOldObjectId() != null) {
branchTip =
(CodeReviewCommit) rw.parseCommit(branchUpdate.getOldObjectId());
} else {
branchTip = null;
}
} catch (IOException e) {
throw new MergeException("Cannot open branch", e);
}
}
private void listPendingSubmits() throws MergeException {
try {
submitted = schema.changes().submitted(destBranch).toList();
} catch (OrmException e) {
throw new MergeException("Cannot query the database", e);
}
}
private void validateChangeList() throws MergeException {
final Set<ObjectId> tips = new HashSet<ObjectId>();
for (final Ref r : db.getAllRefs().values()) {
tips.add(r.getObjectId());
}
int commitOrder = 0;
for (final Change chg : submitted) {
if (chg.currentPatchSetId() == null) {
status.put(chg.getId(), CommitMergeStatus.NO_PATCH_SET);
continue;
}
final PatchSet ps;
try {
ps = schema.patchSets().get(chg.currentPatchSetId());
} catch (OrmException e) {
throw new MergeException("Cannot query the database", e);
}
if (ps == null || ps.getRevision() == null
|| ps.getRevision().get() == null) {
status.put(chg.getId(), CommitMergeStatus.NO_PATCH_SET);
continue;
}
final String idstr = ps.getRevision().get();
final ObjectId id;
try {
id = ObjectId.fromString(idstr);
} catch (IllegalArgumentException iae) {
status.put(chg.getId(), CommitMergeStatus.NO_PATCH_SET);
continue;
}
if (!tips.contains(id)) {
// TODO Technically the proper way to do this test is to use a
// RevWalk on "$id --not --all" and test for an empty set. But
// that is way slower than looking for a ref directly pointing
// at the desired tip. We should always have a ref available.
//
// TODO this is actually an error, the branch is gone but we
// want to merge the issue. We can't safely do that if the
// tip is not reachable.
//
status.put(chg.getId(), CommitMergeStatus.REVISION_GONE);
continue;
}
final CodeReviewCommit commit;
try {
commit = (CodeReviewCommit) rw.parseCommit(id);
} catch (IOException e) {
throw new MergeException("Invalid issue commit " + id, e);
}
commit.patchsetId = ps.getId();
commit.originalOrder = commitOrder++;
if (branchTip != null) {
// If this commit is already merged its a bug in the queuing code
// that we got back here. Just mark it complete and move on. Its
// merged and that is all that mattered to the requestor.
//
try {
if (rw.isMergedInto(commit, branchTip)) {
commit.statusCode = CommitMergeStatus.ALREADY_MERGED;
status.put(chg.getId(), commit.statusCode);
continue;
}
} catch (IOException err) {
throw new MergeException("Cannot perform merge base test", err);
}
}
toMerge.add(commit);
}
}
private void reduceToMinimalMerge() throws MergeException {
final Collection<CodeReviewCommit> heads;
try {
heads = new MergeSorter(rw, branchTip).sort(toMerge);
} catch (IOException e) {
throw new MergeException("Branch head sorting failed", e);
}
for (final CodeReviewCommit c : toMerge) {
if (c.statusCode != null) {
status.put(c.patchsetId.getParentKey(), c.statusCode);
}
}
toMerge.clear();
toMerge.addAll(heads);
Collections.sort(toMerge, new Comparator<CodeReviewCommit>() {
public int compare(final CodeReviewCommit a, final CodeReviewCommit b) {
return a.originalOrder - b.originalOrder;
}
});
}
private void mergeTopics() throws MergeException {
// Take the first fast-forward available, if any is available in the set.
//
if (destProject.getSubmitType() != Project.SubmitType.MERGE_ALWAYS) {
for (final Iterator<CodeReviewCommit> i = toMerge.iterator(); i.hasNext();) {
try {
final CodeReviewCommit n = i.next();
if (mergeTip == null || rw.isMergedInto(mergeTip, n)) {
mergeTip = n;
i.remove();
break;
}
} catch (IOException e) {
throw new MergeException("Cannot fast-forward test during merge", e);
}
}
}
// If this project only permits fast-forwards, abort everything else.
//
if (destProject.getSubmitType() == Project.SubmitType.FAST_FORWARD_ONLY) {
while (!toMerge.isEmpty()) {
final CodeReviewCommit n = toMerge.remove(0);
n.statusCode = CommitMergeStatus.PATH_CONFLICT;
status.put(n.patchsetId.getParentKey(), n.statusCode);
}
return;
}
// For every other commit do a pair-wise merge.
//
while (!toMerge.isEmpty()) {
final CodeReviewCommit n = toMerge.remove(0);
final Merger m = MergeStrategy.SIMPLE_TWO_WAY_IN_CORE.newMerger(db);
try {
if (m.merge(new AnyObjectId[] {mergeTip, n})) {
writeMergeCommit(m, n);
} else {
rw.reset();
rw.markStart(n);
rw.markUninteresting(mergeTip);
CodeReviewCommit failed;
while ((failed = (CodeReviewCommit) rw.next()) != null) {
if (failed.patchsetId == null) {
continue;
}
failed.statusCode = CommitMergeStatus.PATH_CONFLICT;
status.put(failed.patchsetId.getParentKey(), failed.statusCode);
}
}
} catch (IOException e) {
throw new MergeException("Cannot merge " + n.name(), e);
}
}
}
private void writeMergeCommit(final Merger m, final CodeReviewCommit n)
throws IOException, MissingObjectException, IncorrectObjectTypeException {
final List<CodeReviewCommit> merged = new ArrayList<CodeReviewCommit>();
rw.reset();
rw.markStart(n);
rw.markUninteresting(mergeTip);
for (final RevCommit c : rw) {
final CodeReviewCommit crc = (CodeReviewCommit) c;
if (crc.patchsetId != null) {
merged.add(crc);
}
}
final StringBuilder msgbuf = new StringBuilder();
if (merged.size() == 1) {
final CodeReviewCommit c = merged.get(0);
final Change.Id changeId = c.patchsetId.getParentKey();
msgbuf.append("Merge change ");
msgbuf.append(changeId);
} else {
final ArrayList<CodeReviewCommit> o;
o = new ArrayList<CodeReviewCommit>(merged);
Collections.sort(o, new Comparator<CodeReviewCommit>() {
public int compare(final CodeReviewCommit a, final CodeReviewCommit b) {
final Change.Id aId = a.patchsetId.getParentKey();
final Change.Id bId = b.patchsetId.getParentKey();
return aId.get() - bId.get();
}
});
msgbuf.append("Merge changes ");
for (final Iterator<CodeReviewCommit> i = o.iterator(); i.hasNext();) {
final Change.Id id = i.next().patchsetId.getParentKey();
msgbuf.append(id);
if (i.hasNext()) {
msgbuf.append(',');
}
}
}
if (!R_HEADS_MASTER.equals(destBranch.get())) {
msgbuf.append(" into ");
msgbuf.append(destBranch.getShortName());
}
msgbuf.append("\n\n* changes:\n");
for (final CodeReviewCommit c : merged) {
msgbuf.append(" ");
msgbuf.append(c.getShortMessage());
msgbuf.append("\n");
}
final Commit mergeCommit = new Commit(db);
mergeCommit.setTreeId(m.getResultTreeId());
mergeCommit.setParentIds(new ObjectId[] {mergeTip, n});
mergeCommit.setAuthor(myIdent);
mergeCommit.setCommitter(mergeCommit.getAuthor());
mergeCommit.setMessage(msgbuf.toString());
final ObjectId id = m.getObjectWriter().writeCommit(mergeCommit);
mergeTip = (CodeReviewCommit) rw.parseCommit(id);
}
private void markCleanMerges() throws MergeException {
if (mergeTip == null) {
// If mergeTip is null here, branchTip was null, indicating a new branch
// at the start of the merge process. We also elected to merge nothing,
// probably due to missing dependencies. Nothing was cleanly merged.
//
return;
}
try {
rw.reset();
rw.sort(RevSort.TOPO);
rw.sort(RevSort.REVERSE, true);
rw.markStart(mergeTip);
if (branchTip != null) {
rw.markUninteresting(branchTip);
} else {
for (final Ref r : db.getAllRefs().values()) {
if (r.getName().startsWith(Constants.R_HEADS)
|| r.getName().startsWith(Constants.R_TAGS)) {
try {
rw.markUninteresting(rw.parseCommit(r.getObjectId()));
} catch (IncorrectObjectTypeException iote) {
// Not a commit? Skip over it.
}
}
}
}
CodeReviewCommit c;
while ((c = (CodeReviewCommit) rw.next()) != null) {
if (c.patchsetId != null) {
c.statusCode = CommitMergeStatus.CLEAN_MERGE;
status.put(c.patchsetId.getParentKey(), c.statusCode);
}
}
} catch (IOException e) {
throw new MergeException("Cannot mark clean merges", e);
}
}
private void cherryPickChanges() throws MergeException {
while (!toMerge.isEmpty()) {
final CodeReviewCommit n = toMerge.remove(0);
final ThreeWayMerger m;
m = MergeStrategy.SIMPLE_TWO_WAY_IN_CORE.newMerger(db);
try {
if (n.getParentCount() != 1) {
// We don't support cherry-picking a merge commit.
//
n.statusCode = CommitMergeStatus.PATH_CONFLICT;
status.put(n.patchsetId.getParentKey(), n.statusCode);
continue;
}
m.setBase(n.getParent(0));
if (m.merge(mergeTip, n)) {
writeCherryPickCommit(m, n);
} else {
n.statusCode = CommitMergeStatus.PATH_CONFLICT;
status.put(n.patchsetId.getParentKey(), n.statusCode);
}
} catch (IOException e) {
throw new MergeException("Cannot merge " + n.name(), e);
}
}
}
private void writeCherryPickCommit(final Merger m, final CodeReviewCommit n)
throws IOException {
final StringBuilder msgbuf = new StringBuilder();
msgbuf.append(n.getFullMessage());
if (msgbuf.length() == 0) {
// WTF, an empty commit message?
msgbuf.append("<no commit message provided>");
}
if (msgbuf.charAt(msgbuf.length() - 1) != '\n') {
// Missing a trailing LF? Correct it (perhaps the editor was broken).
msgbuf.append('\n');
}
if (!msgbuf.toString().matches("^(\n|.)*\n[A-Za-z0-9-]{1,}: [^\n]{1,}\n$")) {
// Doesn't end in a "Signed-off-by: ..." style line? Add another line
// break to start a new paragraph for the reviewed-by tag lines.
//
msgbuf.append('\n');
}
if (server.getCanonicalURL() != null) {
msgbuf.append("Reviewed-on: ");
msgbuf.append(server.getCanonicalURL());
msgbuf.append(n.patchsetId.getParentKey().get());
msgbuf.append('\n');
}
ChangeApproval submitAudit = null;
try {
final List<ChangeApproval> approvalList =
schema.changeApprovals().byChange(n.patchsetId.getParentKey())
.toList();
Collections.sort(approvalList, new Comparator<ChangeApproval>() {
public int compare(final ChangeApproval a, final ChangeApproval b) {
return a.getGranted().compareTo(b.getGranted());
}
});
for (final ChangeApproval a : approvalList) {
if (a.getValue() <= 0) {
// Negative votes aren't counted.
continue;
}
if (ApprovalCategory.SUBMIT.equals(a.getCategoryId())) {
// Submit is treated specially, below (becomes committer)
//
if (submitAudit == null
|| a.getGranted().compareTo(submitAudit.getGranted()) > 0) {
submitAudit = a;
}
continue;
}
final Account acc = Common.getAccountCache().get(a.getAccountId());
if (acc == null) {
// No record of user, WTF?
continue;
}
final StringBuilder identbuf = new StringBuilder();
if (acc.getFullName() != null && acc.getFullName().length() > 0) {
identbuf.append(' ');
identbuf.append(acc.getFullName());
}
if (acc.getPreferredEmail() != null
&& acc.getPreferredEmail().length() > 0) {
identbuf.append(' ');
identbuf.append('<');
identbuf.append(acc.getPreferredEmail());
identbuf.append('>');
}
if (identbuf.length() == 0) {
// Nothing reasonable to describe them by? Ignore them.
continue;
}
final String tag;
if (CRVW.equals(a.getCategoryId())) {
tag = "Reviewed-by";
} else if (VRIF.equals(a.getCategoryId())) {
tag = "Verified-by";
} else {
final ApprovalType at =
Common.getGerritConfig().getApprovalType(a.getCategoryId());
if (at == null) {
// A deprecated/deleted approval type, ignore it.
continue;
}
tag = at.getCategory().getName().replace(' ', '-');
}
msgbuf.append(tag);
msgbuf.append(':');
msgbuf.append(identbuf);
msgbuf.append('\n');
}
} catch (OrmException e) {
log.error("Can't read approval records for " + n.patchsetId, e);
}
Account submitterAcct = null;
if (submitAudit != null) {
submitterAcct = Common.getAccountCache().get(submitAudit.getAccountId());
}
final Commit mergeCommit = new Commit(db);
mergeCommit.setTreeId(m.getResultTreeId());
mergeCommit.setParentIds(new ObjectId[] {mergeTip});
mergeCommit.setAuthor(n.getAuthorIdent());
if (submitterAcct != null) {
String name = submitterAcct.getFullName();
if (name == null || name.length() == 0) {
name = "Anonymous Coward";
}
String email = submitterAcct.getPreferredEmail();
if (email == null || email.length() == 0) {
email = "account-" + submitterAcct.getId().get() + "@localhost";
}
mergeCommit.setCommitter(new PersonIdent(name, email, submitAudit
.getGranted(), myIdent.getTimeZone()));
} else {
mergeCommit.setCommitter(myIdent);
}
mergeCommit.setMessage(msgbuf.toString());
final ObjectId id = m.getObjectWriter().writeCommit(mergeCommit);
mergeTip = (CodeReviewCommit) rw.parseCommit(id);
n.statusCode = CommitMergeStatus.CLEAN_PICK;
status.put(n.patchsetId.getParentKey(), n.statusCode);
newCommits.put(n.patchsetId.getParentKey(), mergeTip);
}
private void updateBranch() throws MergeException {
if (branchTip == null || branchTip != mergeTip) {
branchUpdate.setForceUpdate(false);
branchUpdate.setNewObjectId(mergeTip);
branchUpdate.setRefLogMessage("merged", true);
try {
switch (branchUpdate.update(rw)) {
case NEW:
case FAST_FORWARD:
PushQueue.scheduleUpdate(destBranch.getParentKey(), branchUpdate
.getName());
break;
default:
throw new IOException(branchUpdate.getResult().name());
}
} catch (IOException e) {
throw new MergeException("Cannot update " + branchUpdate.getName(), e);
}
}
}
private void updateChangeStatus() {
for (final Change c : submitted) {
final CommitMergeStatus s = status.get(c.getId());
if (s == null) {
// Shouldn't ever happen, but leave the change alone. We'll pick
// it up on the next pass.
//
continue;
}
switch (s) {
case CLEAN_MERGE: {
final String txt =
"Change has been successfully merged into the git repository.";
setMerged(c, message(c, txt));
break;
}
case CLEAN_PICK: {
final CodeReviewCommit commit = newCommits.get(c.getId());
final String txt =
"Change has been successfully cherry-picked as " + commit.name()
+ ".";
setMerged(c, message(c, txt));
break;
}
case ALREADY_MERGED:
setMerged(c, null);
break;
case PATH_CONFLICT: {
final String txt =
"Your change could not be merged due to a path conflict.\n"
+ "\n"
+ "Please merge (or rebase) the change locally and upload the resolution for review.";
setNew(c, message(c, txt));
break;
}
case MISSING_DEPENDENCY: {
ChangeMessage msg = null;
try {
final String txt =
"Change could not be merged because of a missing dependency. As soon as its dependencies are submitted, the change will be submitted.";
final List<ChangeMessage> msgList =
schema.changeMessages().byChange(c.getId()).toList();
if (msgList.size() > 0) {
final ChangeMessage last = msgList.get(msgList.size() - 1);
if (last.getAuthor() == null && txt.equals(last.getMessage())) {
// The last message was written by us, and it said this
// same message already. Its unlikely anything has changed
// that would cause us to need to repeat ourselves.
//
break;
}
}
msg = message(c, txt);
schema.changeMessages().insert(Collections.singleton(msg));
} catch (OrmException e) {
}
try {
final MergeFailSender cm = new MergeFailSender(server, c);
cm.setFrom(getSubmitter(c));
cm.setReviewDb(schema);
cm.setPatchSet(schema.patchSets().get(c.currentPatchSetId()), schema
.patchSetInfo().get(c.currentPatchSetId()));
cm.setChangeMessage(msg);
cm.send();
} catch (OrmException e) {
log.error("Cannot submit patch set for Change " + c.getId() + " due to a missing dependency.", e);
} catch (MessagingException e) {
log.error("Cannot submit patch set for Change " + c.getId() + " due to a missing dependency.", e);
}
break;
}
default:
setNew(c, message(c, "Unspecified merge failure: " + s.name()));
break;
}
}
}
private ChangeMessage message(final Change c, final String body) {
final String uuid;
try {
uuid = ChangeUtil.messageUUID(schema);
} catch (OrmException e) {
return null;
}
final ChangeMessage m =
new ChangeMessage(new ChangeMessage.Key(c.getId(), uuid), null);
m.setMessage(body);
return m;
}
private Account.Id getSubmitter(Change c) {
ChangeApproval submitter = null;
try {
final List<ChangeApproval> approvals =
schema.changeApprovals().byChange(c.getId()).toList();
for (ChangeApproval a : approvals) {
if (a.getValue() > 0
&& ApprovalCategory.SUBMIT.equals(a.getCategoryId())) {
if (submitter == null
|| a.getGranted().compareTo(submitter.getGranted()) > 0) {
submitter = a;
}
}
}
} catch (OrmException e) {
}
return submitter != null ? submitter.getAccountId() : null;
}
private void setMerged(Change c, ChangeMessage msg) {
final PatchSet.Id merged = c.currentPatchSetId();
ChangeApproval submitter = null;
for (int attempts = 0; attempts < 10; attempts++) {
c.setStatus(Change.Status.MERGED);
ChangeUtil.updated(c);
try {
final Transaction txn = schema.beginTransaction();
// Flatten out all existing approvals based upon the current
// permissions. Once the change is closed the approvals are
// not updated at presentation view time, so we need to make.
// sure they are accurate now. This way if permissions get
// modified in the future, historical records stay accurate.
//
final List<ChangeApproval> approvals =
schema.changeApprovals().byChange(c.getId()).toList();
final FunctionState fs = new FunctionState(c, approvals);
for (ApprovalType at : Common.getGerritConfig().getApprovalTypes()) {
at.getCategory().getFunction().run(at, fs);
}
for (ChangeApproval a : approvals) {
if (a.getValue() > 0
&& ApprovalCategory.SUBMIT.equals(a.getCategoryId())) {
if (submitter == null
|| a.getGranted().compareTo(submitter.getGranted()) > 0) {
submitter = a;
}
}
a.cache(c);
}
schema.changeApprovals().update(approvals, txn);
if (msg != null) {
if (submitter != null && msg.getAuthor() == null) {
msg.setAuthor(submitter.getAccountId());
}
schema.changeMessages().insert(Collections.singleton(msg), txn);
}
schema.changes().update(Collections.singleton(c), txn);
txn.commit();
break;
} catch (OrmException e) {
try {
c = schema.changes().get(c.getId());
if (!merged.equals(c.currentPatchSetId())) {
// Uncool; the patch set changed after we merged it.
// Go back to the patch set that was actually merged.
//
c.setCurrentPatchSet(schema.patchSetInfo().get(merged));
}
} catch (OrmException e2) {
}
}
}
try {
final MergedSender cm = new MergedSender(server, c);
if (submitter != null) {
cm.setFrom(submitter.getAccountId());
}
cm.setReviewDb(schema);
cm.setPatchSet(schema.patchSets().get(c.currentPatchSetId()), schema
.patchSetInfo().get(c.currentPatchSetId()));
cm.send();
} catch (OrmException e) {
log.error("Cannot send email for submitted patch set " + c.getId(), e);
} catch (MessagingException e) {
log.error("Cannot send email for submitted patch set " + c.getId(), e);
}
}
private void setNew(Change c, ChangeMessage msg) {
for (int attempts = 0; attempts < 10; attempts++) {
c.setStatus(Change.Status.NEW);
ChangeUtil.updated(c);
try {
final Transaction txn = schema.beginTransaction();
schema.changes().update(Collections.singleton(c), txn);
if (msg != null) {
schema.changeMessages().insert(Collections.singleton(msg), txn);
}
txn.commit();
break;
} catch (OrmException e) {
try {
c = schema.changes().get(c.getId());
if (c.getStatus().isClosed()) {
// Someone else marked it close while we noticed a failure.
// That's fine, leave it closed.
//
break;
}
} catch (OrmException e2) {
}
}
}
try {
final MergeFailSender cm = new MergeFailSender(server, c);
cm.setFrom(getSubmitter(c));
cm.setReviewDb(schema);
cm.setPatchSet(schema.patchSets().get(c.currentPatchSetId()), schema
.patchSetInfo().get(c.currentPatchSetId()));
cm.setChangeMessage(msg);
cm.send();
} catch (OrmException e) {
log.error("Cannot submit patch set for Change " + c.getId() + " due to a path conflict.", e);
} catch (MessagingException e) {
log.error("Cannot submit patch set for Change " + c.getId() + " due to a path conflict.", e);
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
22bf3c5b052498fe62672b0da89340993b725c35 | 725bcd371a5267e149fcee9c71aa6268b77eef77 | /src/Exercicio/Exercicio.java | 8c98bd29f62c944b2c92d08adeb97a1493a46aee | [] | no_license | Vilela320/Vetores | 99be8a378ab6f2c6773f370ef64fe5abaddbc0dd | 0f475ca744e0a59294c4f7355b2add258602db89 | refs/heads/main | 2023-05-13T14:10:56.479090 | 2021-06-04T21:02:44 | 2021-06-04T21:02:44 | 373,958,508 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 872 | java | package Exercicio;
import java.util.Scanner;
import Exercicio2.Exercicio1;
public class Exercicio {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Exercicio1[] vect = new Exercicio1[10];
System.out.print("How many rooms will be rented? ");
int n = sc.nextInt();
for (int i=1; i<=n; i++) {
System.out.println();
System.out.println("Rent #" + i + ":");
System.out.print("Name: ");
sc.nextLine();
String name = sc.nextLine();
System.out.print("Email: ");
String email = sc.nextLine();
System.out.print("Room: ");
int room = sc.nextInt();
vect[room] = new Exercicio1(name, email);
}
System.out.println();
System.out.println("Busy rooms:");
for (int i=0; i<10; i++) {
if (vect[i] != null) {
System.out.println(i + ": " + vect[i]);
}
}
sc.close();
}
} | [
"Vilela320@outlook.com.br"
] | Vilela320@outlook.com.br |
030b2173137402d832981a8c8ba82e8339364ecf | d5374123f066438cfb79b65a047e5c1098f19967 | /hello/src/api01/Lang/string/CharAtDemo.java | ca27b17bc7ad2a2a4288fd396dc6cae8d46a3369 | [] | no_license | zhclfclfdl/jse | c328e6bb91edb45e88d40ca49277035dfc5b3c9e | 626ff0d01af22e510db78a1f839a70fa125a95e0 | refs/heads/master | 2016-09-06T11:29:06.381952 | 2015-06-03T02:17:36 | 2015-06-03T02:17:36 | 35,396,826 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,319 | java | package api01.Lang.string;
import java.lang.invoke.SwitchPoint;
/*
Date 2015.05.27
Author : 이현석
Desc : java.lang.String
*/
/*
java.lang.String
charAt() : 지정된 위치에 있는 문자를 리턴함. index 는 0 부터 시작
IndexOf() : 주어진 문자가 존재하는지 확인하여 위치를 알려줌. 없으면 -1 qksghks
*/
public class CharAtDemo {
public static void main(String[] args) {
String ssn = "800101-1555555";
/*
ssn.indexOf("-")+1
주민등록번호상의 "." 의 위치를(index) 리턴하는데
'-' 다음 숫자를 리턴하도록 하기위해 +1을 준다.
*/
char isMan = ssn.charAt(ssn.indexOf("-")+1);
/*
char isMan = ssn.charAt(7);
위와 같이 표현해도 무방하다
인덱스 위치값이 0부터 시작한다는 점과
파라미터 숫자값이 인덱스값을 의미한다는 점만
기억하면됨
*/
switch (isMan) {
/*
switch(조건식) 이 들어가며
case 다음 값은 조건식이 가지고 있는 value(값) 을 의미한다.
예제를 보면 isMan 이 1이라면....하면서 진행된다.
*/
case '1': case '3' : System.out.println("남성"); break;
case '2': case '4' : System.out.println("여성"); break;
default: System.out.println("잘못된 주민번호입니다."); break;
}
}
}
| [
"iseunghyun.lee@gmail.com"
] | iseunghyun.lee@gmail.com |
2bc975afa071c51d73eefb2a1e44fc762891708d | 10a689229d6889f86bf6c4ad106caa433379bb49 | /trunk/ihouse/ihouse/src/com/manyi/ihouse/assignee/model/AssigneeModel.java | 4d4407f0451c8e76010fe1dda90fef5cb16f50e1 | [] | no_license | sanrentai/manyi | d9e64224bc18846410c4a986c3f2b4ee229b2a2e | c4c92f4dde1671027ff726ba6bbe6021421cd469 | refs/heads/master | 2020-03-12T19:30:47.242536 | 2015-04-10T08:40:20 | 2015-04-10T08:40:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,012 | java | package com.manyi.ihouse.assignee.model;
public class AssigneeModel {
/**
* ID
*/
private int id;
/**
* 经纪人姓名
*/
private String name;
/**
* 经纪人编号
*/
private String serialNumber;
/**
* 手机号码
*/
private String mobile;
/**
* 备注
*/
private String information;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSerialNumber() {
return serialNumber;
}
public void setSerialNumber(String serialNumber) {
this.serialNumber = serialNumber;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getInformation() {
return information;
}
public void setInformation(String information) {
this.information = information;
}
}
| [
"zhangxiongcai337@gmail.com"
] | zhangxiongcai337@gmail.com |
3b224436bd812c2ee20bfc63fb4ad6d92f18ecf4 | 3bdf97f8225bd427b3eb27973aa9c46f83db4a7d | /app/src/main/java/com/example/firebase/MainActivity.java | ec1bbcc1bcc9c04512b51bebb50cd15d135ad8cb | [] | no_license | Foxmik0007/AndroidFireBase | ee1d1baeac36fca18f2e239c9c0e554904c1b027 | aff7bcc68c8617cc4f5ec3c9bacc538a17a54eee | refs/heads/master | 2023-01-23T21:39:26.426109 | 2020-11-24T18:30:34 | 2020-11-24T18:30:34 | 315,714,616 | 0 | 0 | null | 2020-11-24T18:30:35 | 2020-11-24T18:06:39 | null | UTF-8 | Java | false | false | 6,502 | java | package com.example.firebase;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private EditText nom;
private EditText prenom;
private Button Enter, access, sElse, Connexion;
public static List<Person> people, people2;
private String theRealName;
private TextView number, showSize;
ListView LisViewPeople;
DatabaseReference PersonDataBase;
DatabaseReference CarDataBase;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// CATCHING
PersonDataBase = FirebaseDatabase.getInstance().getReference("People");
CarDataBase = FirebaseDatabase.getInstance().getReference("Car");
nom = (EditText) findViewById(R.id.Name);
prenom = (EditText) findViewById(R.id.Last);
Enter = (Button) findViewById(R.id.Enter);
Connexion = (Button) findViewById(R.id.Connexion);
people = new ArrayList<>();
//$
LisViewPeople = (ListView) findViewById(R.id.People);
access = (Button) findViewById(R.id.Access);
sElse = (Button) findViewById(R.id.sElse);
people.add(new Person("0", "Mika", "Rafaralahy"));
theRealName = nom.getText().toString().trim();
people2 = new ArrayList<>();
number = (TextView)findViewById(R.id.number);
showSize = (TextView)findViewById(R.id.showSize);
//Update();
// Affichage taille du tableau
showSize.setText(Integer.toString(people.size()));
//Entrer des données sur la base de donnée
Enter.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AddPerson();
}
});
//Voir les données sur la base de donnée
access.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(), Liste.class);
startActivityForResult(intent, 0);
}
});
// Test avec autre type de classe
sElse.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String name = "Gallardo";
String marque = "Lamborghini";
String id = PersonDataBase.push().getKey();
Car car = new Car(name, marque, id);
CarDataBase.child(id).setValue(car);
}
});
Connexion.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(), ConnexionActivity.class);
startActivityForResult(intent, 0 );
}
});
}
protected void Update() {
PersonDataBase.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for (DataSnapshot peopleSnapShot : dataSnapshot.getChildren()) {
Person person = peopleSnapShot.getValue(Person.class);
boolean Verify = false;
// Ajout/ Mise à jour de la base de donnée
for (short i = 0; i < people.size(); i++) {
if (person.getName() == people.get(i).getName())
Verify = true;
}
if (!Verify)
people.add(person);
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
@Override
protected void onStart() {
super.onStart();
PersonDataBase.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for (DataSnapshot peopleSnapShot : dataSnapshot.getChildren()) {
Person person = peopleSnapShot.getValue(Person.class);
boolean Verify = false;
// Ajout/ Mise à jour de la base de donnée
for (short i = 0; i < people.size(); i++) {
if (person.getName() == people.get(i).getName())
Verify = true;
}
if (!Verify)
people.add(person);
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
private void AddPerson() {
String name = nom.getText().toString().trim();
String lastName = prenom.getText().toString().trim();
if (!TextUtils.isEmpty(name)) {
String id = PersonDataBase.push().getKey();
Person person = new Person(id, name, lastName);
PersonDataBase.child(id).setValue(person);
Toast.makeText(this, "Complete", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, "You MF", Toast.LENGTH_LONG).show();
}
}
public boolean isHere( /*Person anyone*/ String a, List<Person> list) {
for (short i = 0; i < list.size(); i++) {
if (/*anyone.getName() */a == list.get(i).getName())
return true;
}
return false;
}
public void goToNext(){
Intent intent = new Intent(getApplicationContext(), connexionSample.class);
if (isHere("Anna", people))
startActivityForResult(intent, 0 );
}
}
| [
"mrafa099@uottawa.ca"
] | mrafa099@uottawa.ca |
8255f1ba98171bb12951b19e559f8497b300d5c4 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/12/12_dcaa226dbe799ec07de7e21627bc840d3090343d/LoggingEvent/12_dcaa226dbe799ec07de7e21627bc840d3090343d_LoggingEvent_s.java | cb06257b110889e508927d5797da06e3c3246785 | [] | 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 | 8,556 | java | /*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software
* License version 1.1, a copy of which has been included with this
* distribution in the LICENSE.APL file. */
package org.apache.log4j.spi;
import org.apache.log4j.Category;
import org.apache.log4j.Priority;
import org.apache.log4j.NDC;
import org.apache.log4j.helpers.LogLog;
import java.io.StringWriter;
import java.io.PrintWriter;
import java.lang.reflect.Method;
import java.io.ObjectOutputStream;
import java.io.ObjectInputStream;
import java.util.Hashtable;
// Contributors: Nelson Minar <nelson@monkey.org>
// Wolf Siberski
// Anders Kristensen <akristensen@dynamicsoft.com>
/**
The internal representation of logging events. When an affirmative
decision is made to log then a <code>LoggingEvent</code> instance
is created. This instance is passed around to the different log4j
components.
<p>This class is of concern to those wishing to extend log4j.
@author Ceki Gülcü
@author James P. Cakalic
@since 0.8.2 */
public class LoggingEvent implements java.io.Serializable {
private static long startTime = System.currentTimeMillis();
/** Fully qualified name of the calling category class. */
transient public final String fqnOfCategoryClass;
/** The category of the logging event. The category field is not
serialized for performance reasons.
<p>It is set by the LoggingEvent constructor or set by a remote
entity after deserialization. */
transient public Category category;
/** The category name. */
public final String categoryName;
/** Priority of logging event. Priority cannot be serializable
because it is a flyweight. Due to its special seralization it
cannot be declared final either. */
transient public Priority priority;
/** The nested diagnostic context (NDC) of logging event. */
private String ndc;
/** Have we tried to do an NDC lookup? If we did, there is no need
to do it again. Note that its value is always false when
serialized. Thus, a receiving SocketNode will never use it's own
(incorrect) NDC. See also writeObject method. */
private boolean ndcLookupRequired = true;
/** The application supplied message of logging event. */
transient private Object message;
/** The application supplied message rendered through the log4j
objet rendering mechanism.*/
private String renderedMessage;
/** The name of thread in which this logging event was generated. */
private String threadName;
/** This
variable contains information about this event's throwable
*/
private ThrowableInformation throwableInfo;
/** The number of milliseconds elapsed from 1/1/1970 until logging event
was created. */
public final long timeStamp;
/** Location information for the caller. */
private LocationInfo locationInfo;
// Damn serialization
static final long serialVersionUID = -868428216207166145L;
static final Integer[] PARAM_ARRAY = new Integer[1];
static final String TO_PRIORITY = "toPriority";
static final Class[] TO_PRIORITY_PARAMS = new Class[] {int.class};
static final Hashtable methodCache = new Hashtable(3); // use a tiny table
/**
Instantiate a LoggingEvent from the supplied parameters.
<p>Except {@link #timeStamp} all the other fields of
<code>LoggingEvent</code> are filled when actually needed.
<p>
@param category The category of this event.
@param priority The priority of this event.
@param message The message of this event.
@param throwable The throwable of this event. */
public LoggingEvent(String fqnOfCategoryClass, Category category,
Priority priority, Object message, Throwable throwable) {
this.fqnOfCategoryClass = fqnOfCategoryClass;
this.category = category;
this.categoryName = category.getName();
this.priority = priority;
this.message = message;
if(throwable != null) {
this.throwableInfo = new ThrowableInformation(throwable);
}
timeStamp = System.currentTimeMillis();
}
/**
Set the location information for this logging event. The collected
information is cached for future use.
*/
public
LocationInfo getLocationInformation() {
if(locationInfo == null) {
locationInfo = new LocationInfo(new Throwable(), fqnOfCategoryClass);
}
return locationInfo;
}
/**
Return the message for this logging event.
<p>Before serialization, the returned object is the message
passed by the user to generate the logging event. After
serialization, the returned value equals the String form of the
message possibly after object rendering.
@since 1.1 */
public
Object getMessage() {
if(message != null) {
return message;
} else {
return getRenderedMessage();
}
}
public
String getNDC() {
if(ndcLookupRequired) {
ndcLookupRequired = false;
ndc = NDC.get();
}
return ndc;
}
public
String getRenderedMessage() {
if(renderedMessage == null && message != null) {
if(message instanceof String)
renderedMessage = (String) message;
else {
renderedMessage=
category.getHierarchy().getRendererMap().findAndRender(message);
}
}
return renderedMessage;
}
/**
Returns the time when the application started, in milliseconds
elapsed since 01.01.1970. */
public
static
long getStartTime() {
return startTime;
}
public
String getThreadName() {
if(threadName == null)
threadName = (Thread.currentThread()).getName();
return threadName;
}
/**
Return this event's throwable's string[] representaion.
*/
public
String[] getThrowableStrRep() {
if(throwableInfo == null)
return null;
else
return throwableInfo.getThrowableStrRep();
}
private
void readPriority(ObjectInputStream ois)
throws java.io.IOException, ClassNotFoundException {
int p = ois.readInt();
try {
String className = (String) ois.readObject();
if(className == null) {
priority = Priority.toPriority(p);
} else {
Method m = (Method) methodCache.get(className);
if(m == null) {
Class clazz = Class.forName(className);
m = clazz.getDeclaredMethod(TO_PRIORITY, TO_PRIORITY_PARAMS);
methodCache.put(className, m);
}
PARAM_ARRAY[0] = new Integer(p);
priority = (Priority) m.invoke(null, PARAM_ARRAY);
}
} catch(Exception e) {
LogLog.warn("Priority deserialization failed, reverting to default.", e);
priority = Priority.toPriority(p);
}
}
private void readObject(ObjectInputStream ois)
throws java.io.IOException, ClassNotFoundException {
ois.defaultReadObject();
readPriority(ois);
// Make sure that no location info is available to Layouts
if(locationInfo == null)
locationInfo = new LocationInfo(null, null);
}
private
void writeObject(ObjectOutputStream oos) throws java.io.IOException {
// Aside from returning the current thread name the wgetThreadName
// method sets the threadName variable.
this.getThreadName();
// This sets the renders the message in case it wasn't up to now.
this.getRenderedMessage();
// This call has a side effect of setting this.ndc and
// setting ndcLookupRequired to false if not already false.
this.getNDC();
// This sets the throwable sting representation of the event throwable.
this.getThrowableStrRep();
oos.defaultWriteObject();
// serialize this event's priority
writePriority(oos);
}
private
void writePriority(ObjectOutputStream oos) throws java.io.IOException {
oos.writeInt(priority.toInt());
Class clazz = priority.getClass();
if(clazz == Priority.class) {
oos.writeObject(null);
} else {
// writing directly the Class object would be nicer, except that
// serialized a Class object can not be read back by JDK
// 1.1.x. We have to resort to this hack instead.
oos.writeObject(clazz.getName());
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
988cb668c863323390989de95fb7f73b7b5cfc0e | d4d1d06fc32cd788b48066a7e99e6d1589899c73 | /src/main/java/ivorius/yegamolchattels/client/rendering/ModelWardrobe.java | 9fc3452efb43161b1834ab1859b8d918360a6bd7 | [
"MIT"
] | permissive | Ivorforce/YeGamolChattels | 0fb918ea646a744007224df14ba06ef334248509 | 36aca1700b60d722680feff5e54076977dfd0783 | refs/heads/master | 2023-08-24T05:44:42.719684 | 2022-01-13T23:04:03 | 2022-01-13T23:04:03 | 21,396,460 | 8 | 11 | null | 2015-05-17T13:59:58 | 2014-07-01T17:25:15 | Java | UTF-8 | Java | false | false | 5,276 | java | /***************************************************************************************************
* Copyright (c) 2014, Lukas Tenbrink.
* http://lukas.axxim.net
**************************************************************************************************/
// Date: 29-1-2014 18:13:04
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package ivorius.yegamolchattels.client.rendering;
import ivorius.yegamolchattels.blocks.EntityShelfInfo;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelWardrobe extends ModelBase
{
//fields
ModelRenderer base1;
ModelRenderer right;
ModelRenderer left;
ModelRenderer base2;
ModelRenderer back;
ModelRenderer top;
ModelRenderer drawer1;
ModelRenderer drawer2;
ModelRenderer railingoflove;
ModelRenderer rightdoor;
ModelRenderer leftdoor;
public ModelWardrobe()
{
textureWidth = 128;
textureHeight = 64;
base1 = new ModelRenderer(this, 0, 0);
base1.addBox(-6F, 0F, -2F, 12, 2, 8);
base1.setRotationPoint(0F, 20F, 0F);
base1.setTextureSize(128, 64);
base1.mirror = true;
setRotation(base1, 0F, 0F, 0F);
right = new ModelRenderer(this, 0, 12);
right.addBox(-8F, -8F, -2F, 2, 32, 10);
right.setRotationPoint(0F, 0F, 0F);
right.setTextureSize(128, 64);
right.mirror = true;
setRotation(right, 0F, 0F, 0F);
left = new ModelRenderer(this, 25, 12);
left.addBox(6F, -8F, -2F, 2, 32, 10);
left.setRotationPoint(0F, 0F, 0F);
left.setTextureSize(128, 64);
left.mirror = true;
setRotation(left, 0F, 0F, 0F);
base2 = new ModelRenderer(this, 41, 0);
base2.addBox(-6F, 0F, -2F, 12, 2, 8);
base2.setRotationPoint(0F, 12F, 0F);
base2.setTextureSize(128, 64);
base2.mirror = true;
setRotation(base2, 0F, 0F, 0F);
back = new ModelRenderer(this, 50, 12);
back.addBox(-6F, 0F, 6F, 12, 30, 2);
back.setRotationPoint(0F, -8F, 0F);
back.setTextureSize(128, 64);
back.mirror = true;
setRotation(back, 0F, 0F, 0F);
top = new ModelRenderer(this, 82, 0);
top.addBox(-6F, 0F, -2F, 12, 2, 8);
top.setRotationPoint(0F, -8F, 0F);
top.setTextureSize(128, 64);
top.mirror = true;
setRotation(top, 0F, 0F, 0F);
drawer1 = new ModelRenderer(this, 79, 12);
drawer1.addBox(-6F, 0F, -2F, 12, 3, 8);
drawer1.setRotationPoint(0F, 14F, 0F);
drawer1.setTextureSize(128, 64);
drawer1.mirror = true;
setRotation(drawer1, 0F, 0F, 0F);
drawer2 = new ModelRenderer(this, 79, 24);
drawer2.addBox(-6F, 0F, -2F, 12, 3, 8);
drawer2.setRotationPoint(0F, 17F, 0F);
drawer2.setTextureSize(128, 64);
drawer2.mirror = true;
setRotation(drawer2, 0F, 0F, 0F);
railingoflove = new ModelRenderer(this, 0, 55);
railingoflove.addBox(-6F, -1F, -1F, 12, 2, 2);
railingoflove.setRotationPoint(0F, -4F, 2F);
railingoflove.setTextureSize(128, 64);
railingoflove.mirror = true;
setRotation(railingoflove, 0F, 0F, 0F);
rightdoor = new ModelRenderer(this, 79, 36);
rightdoor.addBox(0F, -6F, 0F, 6, 18, 2);
rightdoor.setRotationPoint(-6F, 0F, -2F);
rightdoor.setTextureSize(128, 64);
rightdoor.mirror = true;
setRotation(rightdoor, 0F, 0F, 0F);
leftdoor = new ModelRenderer(this, 96, 36);
leftdoor.addBox(-6F, -6F, 0F, 6, 18, 2);
leftdoor.setRotationPoint(6F, 0F, -2F);
leftdoor.setTextureSize(128, 64);
leftdoor.mirror = true;
setRotation(leftdoor, 0F, 0F, 0F);
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
base1.render(f5);
right.render(f5);
left.render(f5);
base2.render(f5);
back.render(f5);
top.render(f5);
drawer1.render(f5);
drawer2.render(f5);
railingoflove.render(f5);
rightdoor.render(f5);
leftdoor.render(f5);
}
@Override
public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)
{
super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity);
float[] shelfTriggerVals = ((EntityShelfInfo) par7Entity).triggerVals;
leftdoor.rotateAngleY = -shelfTriggerVals[0] * 3.1415926f * 0.64f;
rightdoor.rotateAngleY = shelfTriggerVals[0] * 3.1415926f * 0.64f;
drawer1.setRotationPoint(-0.001F, 14F - 0.001f, -shelfTriggerVals[1] * 6.0f);
drawer2.setRotationPoint(0.001F, 17F - 0.001f, -shelfTriggerVals[2] * 6.0f);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}
| [
"lukastenbrink@googlemail.com"
] | lukastenbrink@googlemail.com |
e6c4fd0adfc23deb333cdd9c0b56be64c8c0dd9c | 8d45e307761c0886f4b5665a367b06a3fa2f22b4 | /src/main/java/com/ym/print/request/RestRequestSort.java | 4b186ec5bb37c1136a6ee8c76a8965374d40add7 | [] | no_license | 1101480750/print-exception | b94beb9964cb4fd83252dc8ebe2c52943c5e6d0d | 748ea66853e6bda6ab5417ce11afea39bc95b4d2 | refs/heads/master | 2022-06-22T05:26:37.164137 | 2020-01-13T16:04:57 | 2020-01-13T16:04:57 | 233,632,625 | 0 | 0 | null | 2022-06-17T02:49:04 | 2020-01-13T15:50:37 | Java | UTF-8 | Java | false | false | 652 | java | package com.ym.print.request;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.io.Serializable;
/**
* 排序字段
*
* @author YAZUO)WU-TONG
*
*/
@Data
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class RestRequestSort implements Serializable {
/** serialVersionUID */
private static final long serialVersionUID = 5255059459988467968L;
/** 排序字段 */
private String field;
/** 排序类型:desc、asc */
private String type;
/** 构造方法 */
public RestRequestSort() {
super();
}
}
| [
"zhouyaoming@yazuo.com"
] | zhouyaoming@yazuo.com |
2126be75155831f906fc99024a5c48d8122154f4 | 629e42efa87f5539ff8731564a9cbf89190aad4a | /unrefactorInstances/eclipse.jdt.core/65/cloneInstance6.java | 7e6cc3e0901476c779dab42c810318c64d6846df | [] | no_license | soniapku/CREC | a68d0b6b02ed4ef2b120fd0c768045424069e726 | 21d43dd760f453b148134bd526d71f00ad7d3b5e | refs/heads/master | 2020-03-23T04:28:06.058813 | 2018-08-17T13:17:08 | 2018-08-17T13:17:08 | 141,085,296 | 0 | 4 | null | null | null | null | UTF-8 | Java | false | false | 370 | java | public void nonStaticAccessToStaticField(AstNode location, FieldBinding field) {
this.handle(
IProblem.NonStaticAccessToStaticField,
new String[] {new String(field.declaringClass.readableName()), new String(field.name)},
new String[] {new String(field.declaringClass.shortReadableName()), new String(field.name)},
location.sourceStart,
location.sourceEnd);
}
| [
"sonia@pku.edu.cn"
] | sonia@pku.edu.cn |
e62658bb6959f58d1ff4b887070b5740f71b4fcf | eab06b48df2b63005150c10f1afc4d8bec9a3543 | /src/main/java/code/code150/question138/Solution.java | b5655149fc1b404be31c83febe742dce8d2ad663 | [] | no_license | AziCat/leetcode-java | a0ca9db9663e1a86d82ffaa5fe34326ff1a0b441 | 0263ac668717a07ad4245edbb6d34db24b63b343 | refs/heads/master | 2023-04-30T18:19:13.100433 | 2023-04-19T08:04:14 | 2023-04-19T08:04:14 | 217,955,860 | 0 | 0 | null | 2020-10-14T02:48:50 | 2019-10-28T03:04:58 | Java | UTF-8 | Java | false | false | 1,175 | java | package code.code150.question138;
import java.util.HashMap;
import java.util.Map;
/**
* 给定一个链表,每个节点包含一个额外增加的随机指针,该指针可以指向链表中的任何节点或空节点。
* <p>
* 要求返回这个链表的深拷贝。
*
* @author yan
* @version 1.0
* @date 2019/11/28
*/
public class Solution {
static class Node {
public int val;
public Node next;
public Node random;
public Node() {
}
public Node(int _val, Node _next, Node _random) {
val = _val;
next = _next;
random = _random;
}
}
private Map<Node, Node> cache = new HashMap<>();
public Node copyRandomList(Node head) {
if (head == null) {
return null;
} else {
Node copy = cache.get(head);
if (null == copy) {
copy = new Node();
cache.put(head, copy);
copy.val = head.val;
copy.next = copyRandomList(head.next);
copy.random = copyRandomList(head.random);
}
return copy;
}
}
}
| [
"1003980136@qq.com"
] | 1003980136@qq.com |
5fbaa48262dd29b7565c55a613ef0bc15de6d963 | 9082e4b28670e5aad1a1c5eab08167c19e61ddce | /src/plotter/FunctionTypeController.java | 55d71532c38db1aeec8ccad63bdc18047b689199 | [
"MIT"
] | permissive | Babbiorsetto/Plotting | abba067ebfe1dd8fe56fe011701f22e0e70f1ff2 | af55f03323b3af77a7b167adc8b8e51eca840eca | refs/heads/master | 2021-07-14T22:17:50.211381 | 2019-12-13T16:46:43 | 2019-12-13T16:46:43 | 190,574,778 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 563 | java | package plotter;
import function.FunctionFactory;
public class FunctionTypeController implements FunctionTypeChangeListener {
private GraphOptionsView view;
private FunctionModel functionModel;
public FunctionTypeController(GraphOptionsView view, FunctionModel functionModel) {
this.view = view;
view.addFunctionTypeChangeListener(this);
this.functionModel = functionModel;
}
@Override
public void functionTypeChangeHappened(FunctionTypeChangeEvent evt) {
functionModel.setFunction(FunctionFactory.getFunctionByType(evt.getFunction()));
}
}
| [
"aleruby97@hotmail.it"
] | aleruby97@hotmail.it |
a430a447b7e5553f69b85f24f055785a686f3264 | 83a29d9d1324d0768d587c12aab8e278d0e89400 | /app/src/shotTest/java/com/roger/shot/customview/WheelView.java | 5d49ab03c6387125770029b04972446e301e72ef | [] | no_license | liuwenrong/Demo4Roger | b2fc9080c44bad1d9a28a4d9a40262b65e91c928 | a771c64e9d7311191e6469e039692a6eafb1386e | refs/heads/master | 2020-03-16T21:40:16.388847 | 2019-04-24T06:37:54 | 2019-04-24T06:39:20 | 133,009,326 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,046 | java | package com.roger.shot.customview;
import android.content.Context;
import android.support.v4.widget.ViewDragHelper;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import com.roger.demo4roger.R;
/**
* <p>类说明</p>
*
* @author liumeiliya 2017/7/13 13:51
* @version V1.0
* @modificationHistory=========================逻辑或功能性重大变更记录
* @modify by user: {修改人} 2017/7/13
* @modify by reason:{方法名}:{原因}
*/
public class WheelView extends RelativeLayout {
RelativeLayout parentView;
RelativeLayout P;
Context context;
ImageView touchIv;
public WheelView(Context context) {
super(context);
init(context);
this.context = context;
}
public WheelView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
this.context = context;
mDragger = ViewDragHelper.create(P, 1.0f, new ViewDragHelper.Callback() {
@Override
public boolean tryCaptureView(View child, int pointerId) {
Log.i("lmly","tryCaptureView");
if (child.getId() == touchIv.getId()) {
return true;
}
return false;
}
@Override
public int clampViewPositionHorizontal(View child, int left, int dx) {
final int leftBound = getPaddingLeft();
final int rightBound = getWidth() - touchIv.getWidth();
final int newLeft = Math.min(Math.max(left, leftBound), rightBound);
return newLeft;
}
@Override
public int clampViewPositionVertical(View child, int top, int dy) {
final int topBound = getPaddingTop();
final int bottomBound = getHeight() - touchIv.getHeight();
final int newTop = Math.min(Math.max(top, topBound), bottomBound);
return newTop;
}
@Override
public void onViewReleased(View releasedChild, float xvel, float yvel) {
mDragger.settleCapturedViewAt(autoBackViewOriginLeft, autoBackViewOriginTop);
invalidate();
}
});
}
@Override
public void computeScroll() {
if (mDragger.continueSettling(true)) {
invalidate();
}
}
int autoBackViewOriginLeft;
int autoBackViewOriginTop;
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
autoBackViewOriginLeft = touchIv.getLeft();
autoBackViewOriginTop = touchIv.getTop();
}
int width,p_c_x;
int height,p_c_y;
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
public WheelView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
this.context = context;
}
private void init(Context context) {
parentView = (RelativeLayout) LayoutInflater.from(context).inflate(R.layout.wheel_view, this, true);
touchIv = (ImageView) parentView.findViewById(R.id.touchIv);
P = (RelativeLayout) parentView.findViewById(R.id.P);
ViewTreeObserver vto2 = touchIv.getViewTreeObserver();
vto2.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
touchIv.getViewTreeObserver().removeGlobalOnLayoutListener(this);
width=touchIv.getWidth();
height=touchIv.getHeight();
p_c_x= P.getWidth()/2;
p_c_y=P.getHeight()/2;
Log.i("lmly","++++"+ width+" "+height+" "+p_c_x+" "+p_c_y);
}
});
}
private ViewDragHelper mDragger;
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
return mDragger.shouldInterceptTouchEvent(event);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()){
case MotionEvent.ACTION_MOVE:
float x=touchIv.getX();
float y=touchIv.getY();
float cX=x+width/2;
float cY=y+height/2;
float temp1= Math.abs(p_c_x-cX)* Math.abs(p_c_x-cX)+ Math.abs(p_c_y-cY)* Math.abs(p_c_y-cY);
float temp2=(p_c_x-width/2)* (p_c_x-width/2);
if(temp1<temp2){
mDragger.processTouchEvent(event);
}
break;
default:
mDragger.processTouchEvent(event);
break;
}
return true;
}
}
| [
"liuwenrong@yotamobile.com"
] | liuwenrong@yotamobile.com |
208ead218c11d3e2471267d47fbaa741bf2ce1c7 | 3d1e45df732bc260c1efe7d585d57f0a9e5ff930 | /materialup/src/main/java/io/jari/materialup/rest/endpoints/ShowCasesService.java | da4c40e9ce10a1bd94454970bdd60b09b229dc82 | [] | no_license | wangjun/MaterialUp | fadb2076526ec6adbcbe1210c147e86daf2038cf | 20090b7221820616190cc5203d0e702f3d3c3895 | refs/heads/master | 2020-07-11T04:47:55.708330 | 2015-10-09T13:03:24 | 2015-10-09T13:03:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 279 | java | package io.jari.materialup.rest.endpoints;
import io.jari.materialup.rest.models.Showcase;
import retrofit.Call;
import retrofit.http.GET;
/**
* Created by rsicarelli on 9/7/15.
*/
public interface ShowCasesService {
@GET("posts")
Call<Showcase[]> listShowcases();
}
| [
"rodrigo.sicarelli@easytaxi.com.br"
] | rodrigo.sicarelli@easytaxi.com.br |
a1c97ef73672205681a9785a6559dc4c5e9ee0ba | 966ab94751f7ad98055493dc4cbb57f2e4fe3790 | /space3d-core/src/game/systems/MovementSystem.java | a73ebea0da8e9e3dd38b1695573b7611a1c318b9 | [] | no_license | byronh/libgdx-space3d | 81210a746c98296de23edff675e8a72fb2d515e9 | 529519e9a49db63838ff8bbfbdb9c071ff61efb8 | refs/heads/master | 2021-01-19T11:45:12.384672 | 2014-03-18T01:59:55 | 2014-03-18T01:59:55 | 17,394,418 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 979 | java | package game.systems;
import com.badlogic.gdx.utils.Array;
import engine.artemis.ComponentMapper;
import engine.artemis.Entity;
import engine.artemis.Filter;
import engine.artemis.systems.EntitySystem;
import game.components.Movement;
import game.components.Position;
public class MovementSystem extends EntitySystem {
ComponentMapper<Position> pm;
ComponentMapper<Movement> mm;
@SuppressWarnings("unchecked")
public MovementSystem() {
super(Filter.allComponents(Position.class, Movement.class));
}
@Override
public void initialize() {
pm = world.getMapper(Position.class);
mm = world.getMapper(Movement.class);
}
@Override
protected void processEntities(Array<Entity> entities) {
for (Entity e : entities) {
Position position = pm.get(e);
Movement movement = mm.get(e);
movement.velocity.add(movement.acceleration);
position.world.translate(movement.velocity.cpy().scl(world.getDelta()));
}
}
}
| [
"byronh@gmail.com"
] | byronh@gmail.com |
b335a0d373213be225b75e46643919c00775eca9 | da3d7461a5efdb210f61922a865bdfc68e1867d7 | /src/main/java/com/decagonhq/projects/prince/coronavirustracker/CoronavirusTrackerApplication.java | 26d5d83955b2220b569d0a452c4221bbc481e80c | [] | no_license | princeid/corona-virus-tracker | 67ed8157246ad7116ef006e851bc5abf9e141ca2 | c520b7ca38037c080353b03edabfc2d67a64b3b7 | refs/heads/main | 2023-03-03T21:55:34.877497 | 2021-02-18T20:18:23 | 2021-02-18T20:18:23 | 338,847,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 449 | java | package com.decagonhq.projects.prince.coronavirustracker;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableScheduling
public class CoronavirusTrackerApplication {
public static void main(String[] args) {
SpringApplication.run(CoronavirusTrackerApplication.class, args);
}
} | [
"dicksoniprince@gmail.com"
] | dicksoniprince@gmail.com |
260efbde1a12baaf50bc6e572bbf5a92c6688dbb | eeea26b3f42de48acd26649079f476f2e3488c4a | /common/src/main/java/com/abrenoch/hyperiongrabber/common/util/HyperionGrabberOptions.java | c35f654855d44ec0f9ab620b042eab1e5bb70499 | [
"MIT"
] | permissive | abrenoch/hyperion-android-grabber | 1926a0d05f369ff293ec57726752a394d2687d0a | 1f8466c0ecd6b7544bb338068601cbfbef9dd48a | refs/heads/master | 2022-12-10T10:28:44.322590 | 2021-12-19T15:11:47 | 2021-12-19T15:11:47 | 119,703,816 | 161 | 36 | MIT | 2022-12-03T21:50:52 | 2018-01-31T15:16:50 | Java | UTF-8 | Java | false | false | 3,930 | java | package com.abrenoch.hyperiongrabber.common.util;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
public class HyperionGrabberOptions {
private static final boolean DEBUG = false;
private static final String TAG = "HyperionGrabberOptions";
private final int MINIMUM_IMAGE_PACKET_SIZE; // how many bytes the minimal acceptable image quality is
private final int FRAME_RATE;
private final boolean USE_AVERAGE_COLOR;
private final int BLACK_THRESHOLD = 5; // The limit each RGB value must be under to be considered a black pixel [0-255]
public HyperionGrabberOptions(int horizontalLED, int verticalLED, int frameRate, boolean useAvgColor) {
/*
* To determine the minimal acceptable image packet size we take the count of the width & height
* of the LED pixels (that the user is driving via their hyperion server) and multiply them
* together and then by 3 (1 for each color in RGB). This will give us the count of the bytes
* that the minimal acceptable quality should be equal to or greater than.
**/
MINIMUM_IMAGE_PACKET_SIZE = horizontalLED * verticalLED * 3;
FRAME_RATE = frameRate;
USE_AVERAGE_COLOR = useAvgColor;
if (DEBUG) {
Log.d(TAG, "Horizontal LED Count: " + String.valueOf(horizontalLED));
Log.d(TAG, "Vertical LED Count: " + String.valueOf(verticalLED));
Log.d(TAG, "Minimum Image Packet: " + String.valueOf(MINIMUM_IMAGE_PACKET_SIZE));
}
}
public int getFrameRate() { return FRAME_RATE; }
public boolean useAverageColor() { return USE_AVERAGE_COLOR; }
/**
* returns the divisor best suited to be used to meet the minimum image packet size
* Since we only want to scale using whole numbers, we need to find what common divisors
* are available for the given width & height. We will check those divisors to find the smallest
* number (that we can divide our screen dimensions by) that would meet the minimum image
* packet size required to match the count of the LEDs on the destination hyperion server.
* @param width The original width of the device screen
* @param height The original height of the device screen
* @return int The divisor bes suited to scale the screen dimensions by
**/
public int findDivisor(int width, int height) {
List<Integer> divisors = getCommonDivisors(width, height);
if (DEBUG) Log.d(TAG, "Available Divisors: " + divisors.toString());
ListIterator it = divisors.listIterator(divisors.size());
// iterate backwards since the divisors are listed largest to smallest
while (it.hasPrevious()) {
int i = (int) it.previous();
// check if the image packet size for this divisor is >= the minimum image packet size
// like above we multiply the dimensions together and then by 3 for each byte in RGB
if ((width / i) * (height / i) * 3 >= MINIMUM_IMAGE_PACKET_SIZE)
return i;
}
return 1;
}
/**
* gets a list of all the common divisors [large to small] for the given integers.
* @param num1 The first integer to find a whole number divisor for
* @param num2 The second integer to find a whole number divisor for
* @return List A list of the common divisors [large to small] that match the provided integers
**/
private static List<Integer> getCommonDivisors(int num1, int num2) {
List<Integer> list = new ArrayList<>();
int min = Math.min(num1, num2);
for (int i = 1; i <= min / 2; i++)
if (num1 % i == 0 && num2 % i == 0)
list.add(i);
if (num1 % min == 0 && num2 % min == 0) list.add(min);
return list;
}
public int getBlackThreshold() { return BLACK_THRESHOLD; }
}
| [
"nlclothing@gmail.com"
] | nlclothing@gmail.com |
119015928e770cf115b46ed1a6d9d1d9e0bd57de | 7830cea162219022f6422616fae474f4083cf356 | /android/src/se/riol/anes/proximitysensor/ProximitySensorInitFunction.java | 1e6162ce80d4dccafea8840609aabec843ffc203 | [] | no_license | richardolsson/proximity-sensor-ane | 1ea9f509ebd64669a20a1eff69080869fe9f100f | ace96a4aab95149718c871bfbb57a078868e91a4 | refs/heads/master | 2021-01-20T09:32:43.662981 | 2011-11-09T17:20:32 | 2011-11-09T17:20:32 | 2,742,579 | 12 | 2 | null | null | null | null | UTF-8 | Java | false | false | 699 | java | package se.riol.anes.proximitysensor;
import android.app.Activity;
import android.hardware.SensorManager;
import android.util.Log;
import com.adobe.fre.FREContext;
import com.adobe.fre.FREFunction;
import com.adobe.fre.FREObject;
public class ProximitySensorInitFunction implements FREFunction {
public FREObject call(FREContext context, FREObject[] args) {
SensorManager sensorManager;
ProximitySensorContext psContext;
Log.d("se.riol.anes.proximitysensor", "initializing!");
psContext = (ProximitySensorContext)context;
sensorManager = (SensorManager) psContext.getActivity().getSystemService(Activity.SENSOR_SERVICE);
psContext.init(sensorManager);
return null;
}
}
| [
"r@richardolsson.se"
] | r@richardolsson.se |
a914baebfbeab83fd81eeb4b19c8f1f5f7cc561e | 99bf64b7fd481fa4f124592f2dda8ed773edc0cc | /src/main/java/com/store/snacks/SnacksApplication.java | 9d37555aa581d8cb0ff50ce81a427d57af0045a8 | [] | no_license | RunInto/snackstore | ba33409364b9e4ad05800abe85117b557a9e407b | 9d989aa1987e792af6b53e96456c7bcbd314eceb | refs/heads/master | 2022-06-26T13:09:48.734153 | 2019-12-30T14:38:54 | 2019-12-30T14:38:54 | 230,742,805 | 0 | 0 | null | 2022-06-21T02:32:30 | 2019-12-29T11:48:25 | Java | UTF-8 | Java | false | false | 566 | java | package com.store.snacks;
import com.spring4all.swagger.EnableSwagger2Doc;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@MapperScan("com.store.snacks.mapper")
@SpringBootApplication
@ComponentScan("com.store")
@EnableSwagger2Doc
public class SnacksApplication {
public static void main(String[] args) {
SpringApplication.run(SnacksApplication.class, args);
}
}
| [
"15822145962@163.com"
] | 15822145962@163.com |
9192c508eff72643a5d946e51330f7cb1247a9d0 | 17657aa89d30b4ede7f40a19d38675ed6f86787d | /app/src/main/java/com/example/maps_charmi_c0768448/mapsActivity.java | eced6f9fb95f821b476475dcc407c9cc2d180605 | [] | no_license | CharmiPatel25/maps_Charmi_C0768448 | eec14974637968d157788c3a813be48d6d29e856 | ece1f38bc0cfedfe2b68d28a4c5188229d07f7ea | refs/heads/master | 2022-11-18T00:27:51.042055 | 2020-07-13T19:39:36 | 2020-07-13T19:39:36 | 279,057,137 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 18,987 | java | package com.example.maps_charmi_c0768448;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.fragment.app.FragmentActivity;
import android.Manifest;
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.text.TextUtils;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptor;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.Polygon;
import com.google.android.gms.maps.model.PolygonOptions;
import com.google.android.gms.maps.model.Polyline;
import com.google.android.gms.maps.model.PolylineOptions;
import java.io.IOException;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Vector;
public class mapsActivity extends AppCompatActivity implements OnMapReadyCallback, GoogleMap.OnMapClickListener, GoogleMap.OnMapLongClickListener, GoogleMap.OnPolylineClickListener, GoogleMap.OnPolygonClickListener
{
private static final int REQUEST_CODE = 1;
private static final int POLYGON_SIDES = 4;
Polyline line;
Polygon shape;
List<Marker> markersList = new ArrayList<>();
List<Marker> distanceMarkers = new ArrayList<>();
ArrayList<Polyline> polylinesList = new ArrayList<>();
List<Marker> cityMarkers = new ArrayList<>();
ArrayList<Character> letterList = new ArrayList<>();
HashMap<LatLng, Character> markerLabelMap = new HashMap<>();
LocationManager locationManager;
LocationListener locationListener;
private GoogleMap mMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
@Override
public void onMapReady(final GoogleMap googleMap) {
mMap = googleMap;
mMap.setOnMapLongClickListener(this);
mMap.setOnMapClickListener(this);
mMap.setOnPolylineClickListener(this);
mMap.setOnPolygonClickListener(this);
mMap.getUiSettings().setZoomControlsEnabled(true);
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationListener = new LocationListener() {
@Override
public void onLocationChanged(Location location) {
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onProviderDisabled(String provider) {
}
};
if (!hasLocationPermission()) {
requestLocationPermission();
} else {
startUpdateLocations();
LatLng canadaCenterLatLong = new LatLng( 43.651070,-79.347015);
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(canadaCenterLatLong, 5));
}
mMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
@Override
public boolean onMarkerClick(Marker marker) {
System.out.println("marker Clicked"+marker.isInfoWindowShown());
if(marker.isInfoWindowShown()){
marker.hideInfoWindow();
}
else{
marker.showInfoWindow();
}
return true;
}
});
mMap.setOnMarkerDragListener(new GoogleMap.OnMarkerDragListener() {
@Override
public void onMarkerDragStart(Marker marker) {
}
@Override
public void onMarkerDrag(Marker marker) {
}
@Override
public void onMarkerDragEnd(Marker marker) {
if (markersList.size() == POLYGON_SIDES) {
for(Polyline line: polylinesList){
line.remove();
}
polylinesList.clear();
shape.remove();
shape = null;
for(Marker currMarker: distanceMarkers){
currMarker.remove();
}
distanceMarkers.clear();
drawShape();
}
}
});
}
public BitmapDescriptor displayText(String text) {
Paint textPaint = new Paint();
textPaint.setTextSize(48);
float textWidth = textPaint.measureText(text);
float textHeight = textPaint.getTextSize();
int width = (int) (textWidth);
int height = (int) (textHeight);
Bitmap image = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(image);
canvas.translate(0, height);
canvas.drawText(text, 0, 0, textPaint);
return BitmapDescriptorFactory.fromBitmap(image);
}
private void startUpdateLocations() {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return;
}
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000, 0, locationListener);
}
private void requestLocationPermission() {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_CODE);
}
private boolean hasLocationPermission() {
return ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED;
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (REQUEST_CODE == requestCode) {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000, 0, locationListener);
}
}
}
private void setMarker(LatLng latLng){
Geocoder geoCoder = new Geocoder(this);
Address address = null;
try
{
List<Address> matches = geoCoder.getFromLocation(latLng.latitude, latLng.longitude, 1);
address = (matches.isEmpty() ? null : matches.get(0));
}
catch (IOException e)
{
e.printStackTrace();
}
String title = "";
String snippet = "";
ArrayList<String> titleString = new ArrayList<>();
ArrayList<String> snippetString = new ArrayList<>();
if(address != null){
if(address.getSubThoroughfare() != null)
{
titleString.add(address.getSubThoroughfare());
}
if(address.getThoroughfare() != null)
{
titleString.add(address.getThoroughfare());
}
if(address.getPostalCode() != null)
{
titleString.add(address.getPostalCode());
}
if(titleString.isEmpty())
{
titleString.add(" Location not identfied !");
}
if(address.getLocality() != null)
{
snippetString.add(address.getLocality());
}
if(address.getAdminArea() != null)
{
snippetString.add(address.getAdminArea());
}
}
title = TextUtils.join(", ",titleString);
title = (title.equals("") ? " " : title);
snippet = TextUtils.join(", ",snippetString);
MarkerOptions options = new MarkerOptions().position(latLng)
.draggable(true)
.title(title)
.icon(BitmapDescriptorFactory.fromResource(R.drawable.marker))
.snippet(snippet);
if (markersList.size() == POLYGON_SIDES)
{
clearMap();
}
Marker mm = mMap.addMarker(options);
markersList.add(mm);
if (markersList.size() == POLYGON_SIDES) {
drawShape();
}
Character cityLetters = 'A';
Character[] arr = {'A','B','C','D'};
for(Character letter: arr){
if(letterList.contains(letter)){
continue;
}
cityLetters = letter;
break;
}
LatLng labelLatLng = new LatLng(latLng.latitude - 0.55,latLng.longitude);
MarkerOptions optionsCityLabel = new MarkerOptions().position(labelLatLng)
.draggable(false)
.icon(displayText(cityLetters.toString()))
.snippet(snippet);
Marker letterMarker = mMap.addMarker(optionsCityLabel);
cityMarkers.add(letterMarker);
letterList.add(cityLetters);
markerLabelMap.put(letterMarker.getPosition(),cityLetters);
}
private void drawShape (){
PolygonOptions options = new PolygonOptions()
.fillColor(Color.argb(35, 0, 255, 0))
.strokeColor(Color.RED);
LatLng[] markersConvex = new LatLng[POLYGON_SIDES];
for (int i = 0; i < POLYGON_SIDES; i++) {
markersConvex[i] = new LatLng(markersList.get(i).getPosition().latitude,
markersList.get(i).getPosition().longitude);
}
Vector<LatLng> sortedLatLong = PointPlotter.convexHull(markersConvex, POLYGON_SIDES);
Vector<LatLng> sortedLatLong2 = new Vector<>();
int l = 0;
for (int i = 0; i < markersList.size(); i++)
if (markersList.get(i).getPosition().latitude < markersList.get(l).getPosition().latitude)
l = i;
Marker currentMarker = markersList.get(l);
sortedLatLong2.add(currentMarker.getPosition());
while(sortedLatLong2.size() != POLYGON_SIDES){
double minDistance = Double.MAX_VALUE;
Marker nearestMarker = null;
for(Marker marker: markersList){
if(sortedLatLong2.contains(marker.getPosition())){
continue;
}
double curDistance = distance(currentMarker.getPosition().latitude,
currentMarker.getPosition().longitude,
marker.getPosition().latitude,
marker.getPosition().longitude);
if(curDistance < minDistance){
minDistance = curDistance;
nearestMarker = marker;
}
}
if(nearestMarker != null){
sortedLatLong2.add(nearestMarker.getPosition());
currentMarker = nearestMarker;
}
}
System.out.println(sortedLatLong);
options.addAll(sortedLatLong);
shape = mMap.addPolygon(options);
shape.setClickable(true);
LatLng[] polyLinePoints = new LatLng[sortedLatLong.size() + 1];
int index = 0;
for (LatLng x : sortedLatLong) {
polyLinePoints[index] = x;
index++;
if (index == sortedLatLong.size()) {
// at last add initial point
polyLinePoints[index] = sortedLatLong.elementAt(0);
}
}
for(int i =0 ; i<polyLinePoints.length -1 ; i++){
LatLng[] tempArr = {polyLinePoints[i], polyLinePoints[i+1] };
Polyline currentPolyline = mMap.addPolyline(new PolylineOptions()
.clickable(true)
.add(tempArr)
.color(Color.RED));
currentPolyline.setClickable(true);
polylinesList.add(currentPolyline);
}
}
private void clearMap() {
for (Marker marker : markersList) {
marker.remove();
}
markersList.clear();
for(Polyline line: polylinesList){
line.remove();
}
polylinesList.clear();
shape.remove();
shape = null;
for (Marker marker : distanceMarkers) {
marker.remove();
}
distanceMarkers.clear();
for( Marker marker: cityMarkers){
marker.remove();
}
cityMarkers.clear();
letterList.clear();
}
@Override
public void onMapLongClick(LatLng latLng) {
if(markersList.size() == 0){
return;
}
double minDistance = Double.MAX_VALUE;
Marker nearestMarker = null;
for(Marker marker: markersList){
double currDistance = distance(marker.getPosition().latitude,
marker.getPosition().longitude,
latLng.latitude,
latLng.longitude);
if(currDistance < minDistance){
minDistance = currDistance;
nearestMarker = marker;
}
}
if(nearestMarker != null){
final Marker finalNearestMarker = nearestMarker;
AlertDialog.Builder deleteDialog = new AlertDialog.Builder(this);
deleteDialog
.setTitle("Delete Location?")
.setMessage("Are you sure you want to delete the marker?")
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
finalNearestMarker.remove();
markersList.remove(finalNearestMarker);
letterList.remove(markerLabelMap.get(finalNearestMarker.getPosition()));
letterList.clear();
cityMarkers.clear();
markerLabelMap.remove(finalNearestMarker);
markerLabelMap.clear();
for(Polyline polyline: polylinesList){
polyline.remove();
}
polylinesList.clear();
if(shape != null){
shape.remove();
shape = null;
}
for(Marker currMarker: distanceMarkers){
currMarker.remove();
}
distanceMarkers.clear();
}
})
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
finalNearestMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.marker));
}
});
AlertDialog dialog = deleteDialog.create();
dialog.show();
}
}
@Override
public void onMapClick(LatLng latLng) {
setMarker(latLng);
}
private double distance(double lat1, double lon1, double lat2, double lon2) {
double theta = lon1 - lon2;
double dist = Math.sin(deg2rad(lat1))
* Math.sin(deg2rad(lat2))
+ Math.cos(deg2rad(lat1))
* Math.cos(deg2rad(lat2))
* Math.cos(deg2rad(theta));
dist = Math.acos(dist);
dist = rad2deg(dist);
dist = dist * 60 * 1.1515;
return (dist);
}
private double deg2rad(double deg) {
return (deg * Math.PI / 180.0);
}
private double rad2deg(double rad) {
return (rad * 180.0 / Math.PI);
}
@Override
public void onPolygonClick(Polygon polygon) {
LatLngBounds.Builder builder = LatLngBounds.builder();
for(LatLng point: polygon.getPoints()){
builder.include(point);
}
LatLng center = builder.build().getCenter();
MarkerOptions options = new MarkerOptions().position(center)
.draggable(true)
.icon(displayText(getTotalDistance(polylinesList)));
distanceMarkers.add(mMap.addMarker(options));
}
@Override
public void onPolylineClick(Polyline polyline) {
List<LatLng> points = polyline.getPoints();
LatLng firstPoint = points.remove(0);
LatLng secondPoint = points.remove(0);
LatLng center = LatLngBounds.builder().include(firstPoint).include(secondPoint).build().getCenter();
MarkerOptions options = new MarkerOptions().position(center)
.draggable(true)
.icon(displayText(getMarkerDistance(polyline)));
distanceMarkers.add(mMap.addMarker(options));
}
public String getMarkerDistance(Polyline polyline){
List<LatLng> points = polyline.getPoints();
LatLng firstPoint = points.remove(0);
LatLng secondPoint = points.remove(0);
double distance = distance(firstPoint.latitude,firstPoint.longitude,
secondPoint.latitude,secondPoint.longitude);
NumberFormat formatter = new DecimalFormat("#0.0");
return formatter.format(distance) + " KM";
}
public String getTotalDistance(ArrayList<Polyline> polylines){
double totalDistance = 0;
for(Polyline polyline : polylines){
List<LatLng> points = polyline.getPoints();
LatLng firstPoint = points.remove(0);
LatLng secondPoint = points.remove(0);
double distance = distance(firstPoint.latitude,firstPoint.longitude,
secondPoint.latitude,secondPoint.longitude);
totalDistance += distance;
}
NumberFormat formatter = new DecimalFormat("#0.0");
return formatter.format(totalDistance) + " KM";
}
} | [
"c0768448@mylambton.ca"
] | c0768448@mylambton.ca |
07860a56211d3519e33254526278b1695fe0855e | bbcd2ba052daae9c2345ddfd6e28685b9d296469 | /app/src/main/java/com/family/ghost/fam/singleActivitys/PayActivity.java | 932c647e3ae45eacde68a449327c9695e6e2026c | [] | no_license | RasabelGhost/FamilyAndFriends | cac04207bbc76eea20a9d16f8a656495c5eae1ec | e2ffc8bdc328965af9d7da70f5b75f7a350e5d5a | refs/heads/master | 2020-03-19T10:01:02.835451 | 2018-07-20T08:14:41 | 2018-07-20T08:14:42 | 136,335,978 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,494 | java | package com.family.ghost.fam.singleActivitys;
import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import com.family.ghost.fam.R;
import java.util.ArrayList;
import java.util.List;
import com.family.ghost.fam.R;
import de.codecrafters.tableview.TableView;
import de.codecrafters.tableview.toolkit.SimpleTableDataAdapter;
public class PayActivity extends AppCompatActivity {
private static final String[][] DATA_TO_SHOW = { { "This", "is", "a", "test" },
{ "and", "a", "second", "test" } };
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pay);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_pay);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
// TableView tableView = (TableView) findViewById(R.id.tableView);
TableView<String[]> tableView = (TableView<String[]>) findViewById(R.id.tableView);
//tableView.setColumnCount(4);
tableView.setDataAdapter(new SimpleTableDataAdapter(this, DATA_TO_SHOW));
}
}
| [
"abel.bekele9@gmail.com"
] | abel.bekele9@gmail.com |
89c7a10e8c567423daa617df77f9454904b97f45 | 245f5ee9ddeebebf65124964fe52443b4ffcd0fc | /代理题/005/h2/Proxy.java | 739fb3733210e534182a0bf42248685a17071b53 | [] | no_license | eden57/Competition2016Q4 | 9dedbef823104d9b9eafcf8994958f97df94c6a9 | 9df5dcb19c5111f37a85a0ddf83b78fc2c307c94 | refs/heads/master | 2021-06-10T22:24:25.562787 | 2017-02-14T02:24:57 | 2017-02-14T02:24:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,995 | java | package com.test.h2;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class Proxy implements ConnDB{
ConnH2 h2;
public Proxy(ConnH2 h2) {
this.h2 = h2;
}
@Override
public boolean createDB() {
if(!h2.createDB()){
String sql="CREATE DATABASE database_name";
String url = "jdbc:oracle:" + "thin:@127.0.0.1:1521:XE";
String user = "system";
String password = "147";
PreparedStatement pstmt=null;
Connection conn=null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection(url, user, password);
pstmt = conn.prepareStatement(sql);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
try {
if (pstmt != null) {
pstmt.close();
pstmt=null;
}
if(conn!=null){
conn.close();
conn=null;
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
}
return true;
}
@Override
public boolean createTable() {
if(!h2.createTable()){
String sql="CREATE TABLE TBL_VEHICLE_PASS(UID VARCHAR(4),PLATE_NO VARCHAR(4),PASS_TM VARCHAR(4),COLOR VARCHAR(4),CREATE_TM VARCHAR(4),CREATE_BY VARCHAR(4),UPDATE_TM VARCHAR(4),UPDATE_BY VARCHAR(4),VERSION VARCHAR(4))";
String url = "jdbc:oracle:" + "thin:@127.0.0.1:1521:XE";
String user = "system";
String password = "147";
PreparedStatement pstmt=null;
Connection conn=null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection(url, user, password);
pstmt = conn.prepareStatement(sql);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
try {
if (pstmt != null) {
pstmt.close();
pstmt=null;
}
if(conn!=null){
conn.close();
conn=null;
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
}
return true;
}
@Override
public boolean insert() {
if(h2.insert()){
String sql="INSERT INTO TBL_VEHICLE_PASS VALUES('UID',PLATE_NO,PASS_TM,COLOR,CREATE_TM,CREATE_BY,UPDATE_TM,UPDATE_BY,VERSION)";
String url = "jdbc:oracle:" + "thin:@127.0.0.1:1521:XE";
String user = "system";
String password = "147";
PreparedStatement pstmt=null;
Connection conn=null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection(url, user, password);
pstmt = conn.prepareStatement(sql);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
try {
if (pstmt != null) {
pstmt.close();
pstmt=null;
}
if(conn!=null){
conn.close();
conn=null;
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
}
return true;
}
}
| [
"cyqian@gmail.com"
] | cyqian@gmail.com |
c5ac2fb1b7e0e50cdb41d4d19c94deb09bd24bad | 66cac7d48ad19a3d79e2418db73e3e20e0a228c6 | /src/main/java/com/dhcc/scm/blh/weixin/WxUserBlh.java | 56b468720ef72bae18b129e000937cfb406d134d | [] | no_license | dannisliang/scm_weixin | 9538d22ab94aef38154c767647ab12a3703ea216 | 287bf87976f95cfc4e552fe75243da8caf7ebc09 | refs/heads/master | 2021-01-18T17:22:45.778157 | 2015-09-25T04:11:13 | 2015-09-25T04:11:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,121 | java | /**
* 通过模板生成Blh
* template by zxx
*/
package com.dhcc.scm.blh.weixin;
import javax.annotation.Resource;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.WxCpUser;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Component;
import com.dhcc.framework.app.blh.AbstractBaseBlh;
import com.dhcc.framework.app.service.CommonService;
import com.dhcc.framework.transmission.event.BusinessRequest;
import com.dhcc.scm.dto.weixin.WxUserDto;
import com.dhcc.scm.entity.vo.ws.OperateResult;
import com.dhcc.scm.service.weixin.WxUserService;
@Component
public class WxUserBlh extends AbstractBaseBlh {
@Resource
private WxUserService wxUserService;
@Resource
private CommonService commonService;
@Resource
private WxCpService wxCpService;
public WxUserBlh() {
}
/**
* 进入某个列表的入口方法
* 列表方法,也就是查询方法,调用的时候不需要xxxCtrl!list
* 框架 在不调Ctrl时,不指定方法,就默认为它list,在action中通过
* json注解,所dto中的pageModel to json
* @param: res
*
*/
public void list(BusinessRequest res) {
WxUserDto dto = super.getDto(WxUserDto.class, res);
//调用对应的service方法
wxUserService.list(dto);
}
//保存
public void save(BusinessRequest res) {
WxUserDto dto = super.getDto(WxUserDto.class, res);
OperateResult operateResult=new OperateResult();
try {
WxCpUser wxCpUser = new WxCpUser();
wxCpUser.setEmail(dto.getWxUser().getWxUserEmail());
wxCpUser.setWeiXinId(dto.getWxUser().getWxUserWeixinId());
wxCpUser.setName(dto.getWxUser().getWxUserName());
wxCpUser.setMobile(dto.getWxUser().getWxUserTel());
Integer[] depart = new Integer[1];
depart[0]=dto.getWxUser().getWxUserDepartId();
wxCpUser.setDepartIds(depart);
dto.setWxCpUser(wxCpUser);
//调用对应的service方法
if(StringUtils.isBlank(dto.getWxUser().getWxUserId())){
dto.getWxUser().setWxUserId(null);
wxUserService.save(dto);
}else{
wxUserService.update(dto);
}
operateResult.setResultCode("0");
} catch (Exception e) {
e.printStackTrace();
operateResult.setResultCode("-1");
operateResult.setResultContent(e.getMessage());
}finally{
super.writeJSON(operateResult);
}
}
//删除
public void delete(BusinessRequest res) {
WxUserDto dto = super.getDto(WxUserDto.class, res);
//调用对应的service方法
if(org.apache.commons.lang3.StringUtils.isNotBlank(dto.getWxUser().getWxUserId())){
try {
wxUserService.delete(dto);
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* 修改初始化方法
* 也是根据iD查询实体的方法
* 在action加能过注解把这个实体to json
* @param: res
*
*/
public void findById(BusinessRequest res) {
WxUserDto dto = super.getDto(WxUserDto.class, res);
//调用对应的service方法
wxUserService.findById(dto);
}
}
| [
"Administrator@QH-20150110MDGA"
] | Administrator@QH-20150110MDGA |
346daf46e22c704924cc8e189a8042af63833aa3 | ba9192f4aeb635d5c49d80878a04512bc3b645e9 | /src/extends-parent/jetty-all/src/main/java/org/eclipse/jetty/websocket/WebSocketGeneratorRFC6455.java | dedaa735aa3839006058d7ce8345e148ed3bbb49 | [
"Apache-2.0"
] | permissive | ivanDannels/hasor | 789e9183a5878cfc002466c9738c9bd2741fd76a | 3b9f4ae6355c6dad2ea8818750b3e04e90cc3e39 | refs/heads/master | 2020-04-15T10:10:22.453889 | 2013-09-14T10:02:01 | 2013-09-14T10:02:01 | 12,828,661 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,022 | java | //
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.websocket;
import java.io.IOException;
import org.eclipse.jetty.io.Buffer;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.io.EofException;
/* ------------------------------------------------------------ */
/** WebSocketGenerator.
* This class generates websocket packets.
* It is fully synchronized because it is likely that async
* threads will call the addMessage methods while other
* threads are flushing the generator.
*/
public class WebSocketGeneratorRFC6455 implements WebSocketGenerator
{
final private WebSocketBuffers _buffers;
final private EndPoint _endp;
private Buffer _buffer;
private final byte[] _mask=new byte[4];
private int _m;
private boolean _opsent;
private final MaskGen _maskGen;
private boolean _closed;
public WebSocketGeneratorRFC6455(WebSocketBuffers buffers, EndPoint endp)
{
_buffers=buffers;
_endp=endp;
_maskGen=null;
}
public WebSocketGeneratorRFC6455(WebSocketBuffers buffers, EndPoint endp, MaskGen maskGen)
{
_buffers=buffers;
_endp=endp;
_maskGen=maskGen;
}
public synchronized Buffer getBuffer()
{
return _buffer;
}
public synchronized void addFrame(byte flags, byte opcode, byte[] content, int offset, int length) throws IOException
{
// System.err.printf("<< %s %s %s\n",TypeUtil.toHexString(flags),TypeUtil.toHexString(opcode),length);
if (_closed)
throw new EofException("Closed");
if (opcode==WebSocketConnectionRFC6455.OP_CLOSE)
_closed=true;
boolean mask=_maskGen!=null;
if (_buffer==null)
_buffer=mask?_buffers.getBuffer():_buffers.getDirectBuffer();
boolean last=WebSocketConnectionRFC6455.isLastFrame(flags);
int space=mask?14:10;
do
{
opcode = _opsent?WebSocketConnectionRFC6455.OP_CONTINUATION:opcode;
opcode=(byte)(((0xf&flags)<<4)+(0xf&opcode));
_opsent=true;
int payload=length;
if (payload+space>_buffer.capacity())
{
// We must fragement, so clear FIN bit
opcode=(byte)(opcode&0x7F); // Clear the FIN bit
payload=_buffer.capacity()-space;
}
else if (last)
opcode= (byte)(opcode|0x80); // Set the FIN bit
// ensure there is space for header
if (_buffer.space() <= space)
{
flushBuffer();
if (_buffer.space() <= space)
flush();
}
// write the opcode and length
if (payload>0xffff)
{
_buffer.put(new byte[]{
opcode,
mask?(byte)0xff:(byte)0x7f,
(byte)0,
(byte)0,
(byte)0,
(byte)0,
(byte)((payload>>24)&0xff),
(byte)((payload>>16)&0xff),
(byte)((payload>>8)&0xff),
(byte)(payload&0xff)});
}
else if (payload >=0x7e)
{
_buffer.put(new byte[]{
opcode,
mask?(byte)0xfe:(byte)0x7e,
(byte)(payload>>8),
(byte)(payload&0xff)});
}
else
{
_buffer.put(new byte[]{
opcode,
(byte)(mask?(0x80|payload):payload)});
}
// write mask
if (mask)
{
_maskGen.genMask(_mask);
_m=0;
_buffer.put(_mask);
}
// write payload
int remaining = payload;
while (remaining > 0)
{
_buffer.compact();
int chunk = remaining < _buffer.space() ? remaining : _buffer.space();
if (mask)
{
for (int i=0;i<chunk;i++)
_buffer.put((byte)(content[offset+ (payload-remaining)+i]^_mask[+_m++%4]));
}
else
_buffer.put(content, offset + (payload - remaining), chunk);
remaining -= chunk;
if (_buffer.space() > 0)
{
// Gently flush the data, issuing a non-blocking write
flushBuffer();
}
else
{
// Forcibly flush the data, issuing a blocking write
flush();
if (remaining == 0)
{
// Gently flush the data, issuing a non-blocking write
flushBuffer();
}
}
}
offset+=payload;
length-=payload;
}
while (length>0);
_opsent=!last;
if (_buffer!=null && _buffer.length()==0)
{
_buffers.returnBuffer(_buffer);
_buffer=null;
}
}
public synchronized int flushBuffer() throws IOException
{
if (!_endp.isOpen())
throw new EofException();
if (_buffer!=null)
{
int flushed=_buffer.hasContent()?_endp.flush(_buffer):0;
if (_closed&&_buffer.length()==0)
_endp.shutdownOutput();
return flushed;
}
return 0;
}
public synchronized int flush() throws IOException
{
if (_buffer==null)
return 0;
int result = flushBuffer();
if (!_endp.isBlocking())
{
long now = System.currentTimeMillis();
long end=now+_endp.getMaxIdleTime();
while (_buffer.length()>0)
{
boolean ready = _endp.blockWritable(end-now);
if (!ready)
{
now = System.currentTimeMillis();
if (now<end)
continue;
throw new IOException("Write timeout");
}
result += flushBuffer();
}
}
_buffer.compact();
return result;
}
public synchronized boolean isBufferEmpty()
{
return _buffer==null || _buffer.length()==0;
}
public synchronized void returnBuffer()
{
if (_buffer!=null && _buffer.length()==0)
{
_buffers.returnBuffer(_buffer);
_buffer=null;
}
}
@Override
public String toString()
{
// Do NOT use synchronized (this)
// because it's very easy to deadlock when debugging is enabled.
// We do a best effort to print the right toString() and that's it.
Buffer buffer = _buffer;
return String.format("%s@%x closed=%b buffer=%d",
getClass().getSimpleName(),
hashCode(),
_closed,
buffer == null ? -1 : buffer.length());
}
}
| [
"zyc@byshell.org"
] | zyc@byshell.org |
154b60d53e97bf8ba464f6b1bf1d522a19f0cb26 | a27a7e9a50849529a75a869e84fd01f2e9bbd4e4 | /src/main/java/guru/springframework/recipeproject/service/IngredientServiceImpl.java | 4435ec670d1892aba5902906efbfa0f3bf73ca77 | [] | no_license | lucascalsilva/spring-boot-recipe-project | 2960e3fd9f113a6fd3ebcbffde1bf53eb8710b9a | 086c9e3ee6aa2546f56f48d10ada06198f3bc541 | refs/heads/master | 2021-05-18T20:08:15.928341 | 2020-08-29T20:00:25 | 2020-08-29T20:00:25 | 251,396,296 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,310 | java | package guru.springframework.recipeproject.service;
import guru.springframework.recipeproject.commands.IngredientCommand;
import guru.springframework.recipeproject.converters.IngredientCommandToIngredient;
import guru.springframework.recipeproject.converters.IngredientToIngredientCommand;
import guru.springframework.recipeproject.exceptions.NotFoundException;
import guru.springframework.recipeproject.model.Ingredient;
import guru.springframework.recipeproject.repositories.IngredientRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
@Service
@RequiredArgsConstructor
public class IngredientServiceImpl implements IngredientService {
private final IngredientRepository ingredientRepository;
private final IngredientToIngredientCommand ingredientToIngredientCommand;
private final IngredientCommandToIngredient ingredientCommandToIngredient;
@Override
public IngredientCommand findById(Long id) {
return ingredientToIngredientCommand.convert(ingredientRepository.findById(id)
.orElseThrow(() -> new NotFoundException(Ingredient.class, "id", id.toString())));
}
@Override
public IngredientCommand save(IngredientCommand object) {
Ingredient savedIngredient = ingredientRepository.save(ingredientCommandToIngredient.convert(object));
return ingredientToIngredientCommand.convert(savedIngredient);
}
@Override
public void deleteById(Long id) {
ingredientRepository.deleteById(id);
}
@Override
public Set<IngredientCommand> findAll() {
Set<IngredientCommand> ingredients = new HashSet<>();
ingredientRepository.findAll().iterator().forEachRemaining(ingredient -> {
ingredients.add(ingredientToIngredientCommand.convert(ingredient));
});
return ingredients;
}
@Override
public Set<IngredientCommand> findByRecipeId(Long recipeId) {
Set<IngredientCommand> ingredients = new HashSet<>();
ingredientRepository.findByRecipeId(recipeId).iterator().forEachRemaining(ingredient -> {
ingredients.add(ingredientToIngredientCommand.convert(ingredient));
});
return ingredients;
}
}
| [
"lucasc.alm.silva@gmail.com"
] | lucasc.alm.silva@gmail.com |
a2c672c2c0d7b70ae0730e8a38f21f3099d9c7eb | 9dcc6b9e56b588f9a653900efb9c8bd751aaa8dd | /bundles/org.eclipse.ecf.python.protobuf/src/org/eclipse/ecf/python/protobuf/PythonServiceExporter.java | 858d870b3becb2ad77ffbfedd3189376b6d10080 | [
"Apache-2.0",
"Python-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | ECF/Py4j-RemoteServicesProvider | 32c1da61f33c7e61254691dffafeeb77e76c1442 | d171ed6da3786810f0bbd50e8f688164ca4f5d57 | refs/heads/master | 2023-05-26T21:55:05.031970 | 2023-05-20T15:34:31 | 2023-05-20T15:34:31 | 62,237,655 | 12 | 1 | null | 2017-07-07T04:44:40 | 2016-06-29T15:37:53 | Python | UTF-8 | Java | false | false | 980 | java | /*******************************************************************************
* Copyright (c) 2017 Composent, Inc. and others. All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors: Composent, Inc. - initial API and implementation
******************************************************************************/
package org.eclipse.ecf.python.protobuf;
import org.eclipse.ecf.python.protobuf.Exporter.ExportRequest;
import org.eclipse.ecf.python.protobuf.Exporter.ExportResponse;
import org.eclipse.ecf.python.protobuf.Exporter.UnexportRequest;
import org.eclipse.ecf.python.protobuf.Exporter.UnexportResponse;
public interface PythonServiceExporter {
ExportResponse createAndExport(ExportRequest request);
UnexportResponse unexport(UnexportRequest request);
}
| [
"slewis@composent.com"
] | slewis@composent.com |
c6a37efab54f239367de9cdc0bf11c02803fc0a4 | f103e5fe797cdc81358a508ecf1868692ae309c1 | /Git2/src/Git.java | 5fa8a1fd8c001589d6fe05460e2f8a095be17d6e | [] | no_license | Satyam0612/Giteclipse | 3b1386c21a72f809f486eb25c174387ed8306284 | bee12cf6484922d6e87d1231be45ac525cbaae53 | refs/heads/master | 2020-05-29T21:58:48.302329 | 2019-05-30T12:45:04 | 2019-05-30T12:45:04 | 189,397,993 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 62 | java |
public abstract class Git {
abstract void Insurance();
}
| [
"er.satyamshrivastava@gmail.com"
] | er.satyamshrivastava@gmail.com |
b299a9e1439e94504c99a28ded5abd56d0ac4207 | f498015b7cc15c0b30656ea7056bcc2f0a7b137f | /app/src/main/java/com/olaover/inmortaltech/ola/Adapter/MetroAdapter.java | 9fac3607212c437a9b08f3c1af60f76709d84e41 | [] | no_license | guptaamit96/VehicleTracker | ea92fb6e38738bab5b479307899dd67d33cfe09a | c7bfb9a9f92e1f0138f52c65d35cb58857cb785b | refs/heads/master | 2020-04-15T04:39:16.317131 | 2018-07-16T11:06:55 | 2018-07-16T11:06:55 | 164,390,910 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,946 | java | package com.olaover.inmortaltech.ola.Adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.olaover.inmortaltech.ola.R;
import com.olaover.inmortaltech.ola.beans.MetroResponce;
import java.util.ArrayList;
public class MetroAdapter extends RecyclerView.Adapter<MetroAdapter.MyViewHolder> {
ArrayList<MetroResponce> metro_data;
Context context;
public MetroAdapter(Context context, ArrayList<MetroResponce> metro_data) {
this.context = context;
this.metro_data = metro_data;
}
public MetroAdapter() {
}
@Override
public MetroAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemtype = LayoutInflater.from(parent.getContext()).inflate(R.layout.metro_list_layout, parent, false);
return new MetroAdapter.MyViewHolder(itemtype);
}
@Override
public void onBindViewHolder(MetroAdapter.MyViewHolder holder, int position) {
holder.tv_station_name.setText(metro_data.get(position).getStation_name());
holder.tv_km.setText(metro_data.get(position).getKilo_meter());
holder.tv_elavated.setText(metro_data.get(position).getElevated());
}
@Override
public int getItemCount() {
return metro_data.size();
}
public class MyViewHolder extends RecyclerView.ViewHolder {
TextView tv_station_name,tv_km,tv_elavated;
public MyViewHolder(View itemView) {
super(itemView);
tv_station_name = (TextView) itemView.findViewById(R.id.tv_station_name);
tv_km = (TextView) itemView.findViewById(R.id.tv_km);
tv_elavated = (TextView) itemView.findViewById(R.id.tv_elavated);
}
}
}
| [
"you@example.com"
] | you@example.com |
556c8319ed5da859b27c823cce92f3033a11e541 | 09a9a7cfe7ba841e1931dc2e2a598b12abcb0435 | /src/ua/kpi/carrentals/filters/LocaleFilter.java | a595876b67849d80b4f3d25ff6415a2c7eb7fbb3 | [] | no_license | CrocusJava/carrentals-v2 | f0d271d41ad74b240f88211532cd2da6405260be | f5cc53838aeb12ffb46faa0590fea8754d65ca00 | refs/heads/master | 2020-09-12T18:40:04.524280 | 2013-04-03T20:38:39 | 2013-04-03T20:38:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,475 | java | package ua.kpi.carrentals.filters;
import java.io.IOException;
import java.util.Locale;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.jstl.core.Config;
import org.apache.log4j.Logger;
import ua.kpi.carrentals.configuration.LocaleConfig;
/**
* LocaleFilter class is the Filter interface implementation.
* This class set default Locale to all project - US.
*
* @author Tkachuk
* @see LocaleConfig
*/
public class LocaleFilter implements Filter{
private static Logger logger=Logger.getLogger(LocaleFilter.class);
@Override
public void init(FilterConfig filterConfig) throws ServletException {
logger.info("Locale filter set us default - US");
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest servletRequest=(HttpServletRequest)request;
Locale locale = LocaleConfig.getCurrentLocale();
HttpSession session = servletRequest.getSession(true);
Config.set(session, Config.FMT_LOCALE, locale);
if (chain != null) {
chain.doFilter(request, response);
}
}
@Override
public void destroy() {
}
}
| [
"Ruslan.Tkachuk.V@gmail.com"
] | Ruslan.Tkachuk.V@gmail.com |
9ea7d185d74e4a898592c1c72aaaac6358330d82 | 90d563a57497fff40c586b0cbbc5b10e0ac1a5f0 | /src/BinaryTree/LeetCode101/Solution.java | 93e7d13e874456c22b2651f76201ab77941b3925 | [] | no_license | betterGa/Review-DS | 852b6aa3da401e78ca19efc40486cd57089acb2d | 61699bcf4dcbfb4af2ca6cd95d8cb33804512fa0 | refs/heads/master | 2022-04-03T21:00:37.071086 | 2020-02-19T14:55:48 | 2020-02-19T14:55:48 | 209,009,441 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,121 | java | package BinaryTree.LeetCode101;
public class Solution {
class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int x) {
val = x;
}
}
public boolean isSymmetric(TreeNode root) {
/*太憨了 不是这样的。
//递归终止条件
//空树或叶子节点是对称树
if(root==null||(root.left==null&&root.right==null))
return true;
if(isSymmetric(root.left)==true&&isSymmetric(root.right)==true&&root.left.val==root.right.val)
return true;
else if(root.left.left.val==root.right.right.val&&root.left.right.val==root.right.left.val)
return true;
return false;
*/
if(root==null) return true;
else return isSymmetric(root.left,root.right);
}
//递归三部曲:返回值是boolean,传入的参数是左右子树,
// 我们可以得到左右子树和它们的父节点。三个节点。
//如何判断这颗二叉树是否对称二叉树?
//如果左右子树任意一个为null,一定不是。
//如果左右子树值不相等,一定不是。
//可以得到的返回值是左右子树为根的两棵树是否对称二叉树
//如果左右子树都是对称二叉树,那么这棵树一定是对称二叉树。
//但是如果左右子树不都是/都不是对称二叉树,这颗树也可能是对称二叉树的。
//我们传入的是左右子树,得到的是三个节点。
//如果左右子树值已经相等了,那么如果左的左与右的右,和这个“相等的左右子树值”,构成了三个节点。
//同理,左的右与右的左,和这个“相等的左右子树值”,也构成了三个节点。
//如果这两组三个节点都满足对称,这棵树才是对称树。
public boolean isSymmetric(TreeNode left,TreeNode right)
{
if(left==null||right==null) return false;
else if(left.val!=right.val) return false;
return isSymmetric(left.right,right.left)&&isSymmetric(right.right,left.left);
}
}
| [
"2086543608@qq.com"
] | 2086543608@qq.com |
fdef933b59859191275a6cab85d425f0f7cb34a6 | c4981386c53ff55ff0120e2d0fa18196c7998dc5 | /JavaAbstractMachine/src/at/mhofer/jam/data/attributes/RuntimeVisibleParameterAnnotationsAttribute.java | 486c7aaeece14dbe3833e3d6c2b684bba79cdd2f | [] | no_license | mathiashofer/jam | aed2cab4d8673e983aad9d00287658dbbdeff0e4 | 6f153c1640ddf5d2aa847b28fbe8df5ef35bd459 | refs/heads/master | 2021-01-16T18:35:31.069854 | 2015-10-03T10:02:50 | 2015-10-03T10:02:50 | 33,381,557 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 1,297 | java | package at.mhofer.jam.data.attributes;
/**
*
* @author Mathias
*
*/
public class RuntimeVisibleParameterAnnotationsAttribute extends AttributeInfo
{
/**
* The value of the num_parameters item gives the number of formal
* parameters of the method represented by the method_info structure on
* which the annotation occurs.
*
* This duplicates information that could be extracted from the method
* descriptor.
*/
private short numParameters;
/**
* Each entry in the parameter_annotations table represents all of the
* runtime visible annotations on the declaration of a single formal
* parameter. The i'th entry in the table corresponds to the i'th formal
* parameter in the method descriptor (§4.3.3).
*/
private ParameterAnnotationsTableEntry[] parameterAnnotations;
public RuntimeVisibleParameterAnnotationsAttribute(int attributeNameIndex,
long attributeLength, short numParameters,
ParameterAnnotationsTableEntry[] parameterAnnotations)
{
super(attributeNameIndex, attributeLength);
this.numParameters = numParameters;
this.parameterAnnotations = parameterAnnotations;
}
public short getNumParameters()
{
return numParameters;
}
public ParameterAnnotationsTableEntry[] getParameterAnnotations()
{
return parameterAnnotations;
}
}
| [
"e1226806@student.tuwien.ac.at"
] | e1226806@student.tuwien.ac.at |
5a39385556beaccef657ffc371a02cee66a13e97 | 490e7598170fb9af08909adea93a8cac24201d10 | /app/src/test/java/com/example/jinwoo/app01/ExampleUnitTest.java | acc265d6dd60befca9ddfd5329e17f481339c7ca | [] | no_license | yeji9649/final_exam | bd78bf2163fbb279b53b2eb214d0410afc70c742 | 62ea0790bcd5990350a63f8536b281427cd11159 | refs/heads/master | 2021-01-12T10:02:59.693813 | 2016-12-09T07:22:46 | 2016-12-09T07:22:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 402 | java | package com.example.jinwoo.app01;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"supermanjw@naver.com"
] | supermanjw@naver.com |
d9f5f3b0e6720dc186bdac35524f41a1e675763c | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/3/3_6f29df77620630dd9e6eb0beadf6ac9194706b08/reportHTML/3_6f29df77620630dd9e6eb0beadf6ac9194706b08_reportHTML_s.java | 5a2ed14deec089922492ef41a0630ebd4d21df9e | [] | 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 | 8,686 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.sleuthkit.autopsy.report;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardAttribute;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.ContentVisitor;
import org.sleuthkit.datamodel.Directory;
import org.sleuthkit.datamodel.File;
import org.sleuthkit.datamodel.FileSystem;
import org.sleuthkit.datamodel.Image;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.Volume;
/**
*
* @author Alex
*/
public class reportHTML {
//Declare our publically accessible formatted report, this will change everytime they run a report
public StringBuilder formatted_Report = new StringBuilder();
public reportHTML (HashMap<BlackboardArtifact,ArrayList<BlackboardAttribute>> report){
try{
Case currentCase = Case.getCurrentCase(); // get the most updated case
SleuthkitCase skCase = currentCase.getSleuthkitCase();
String caseName = currentCase.getName();
Integer imagecount = currentCase.getImageIDs().length;
Integer filesystemcount = currentCase.getRootObjectsCount();
DateFormat datetimeFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy");
Date date = new Date();
String datetime = datetimeFormat.format(date);
String datenotime = dateFormat.format(date);
//Add html header info
formatted_Report.append("<html><head>Autopsy Report for Case:").append(caseName).append("</head><body><div id=\"main\"><div id=\"content\">");
// Add summary information now
formatted_Report.append("<h1>Report for Case: ").append(caseName).append("</h1>");
formatted_Report.append("<h3>Case Summary</h3><p>XML Report Generated by Autopsy 3 on ").append(datetime).append("<br /><ul>");
formatted_Report.append("<li># of Images: ").append(imagecount).append("</li>");
formatted_Report.append("<li>FileSystems: ").append(filesystemcount).append("</li>");
StringBuilder nodeGen = new StringBuilder("<h3>General Information</h3>");
StringBuilder nodeWebBookmark = new StringBuilder("<h3>Web Bookmarks</h3>");
StringBuilder nodeWebCookie = new StringBuilder("<h3>Web Cookies</h3>");
StringBuilder nodeWebHistory = new StringBuilder("<h3>Web History</h3>");
StringBuilder nodeWebDownload = new StringBuilder("<h3>Web Downloads</h3>");
StringBuilder nodeRecentObjects = new StringBuilder("<h3>Recent Documents</h3>");
StringBuilder nodeTrackPoint = new StringBuilder("<h3>Track Points</h3>");
StringBuilder nodeInstalled = new StringBuilder("<h3>Installed Programs</h3>");
StringBuilder nodeKeyword = new StringBuilder("<h3>Keyword Search Hits</h3>");
StringBuilder nodeHash = new StringBuilder("<h3>Hashset Hits</h3>");
for (Entry<BlackboardArtifact,ArrayList<BlackboardAttribute>> entry : report.entrySet()) {
StringBuilder artifact = new StringBuilder("<p>Artifact");
Long objId = entry.getKey().getObjectID();
Content cont = skCase.getContentById(objId);
Long filesize = cont.getSize();
artifact.append(" ID: " + objId.toString());
artifact.append("<br /> Name: <strong>").append(cont.accept(new NameVisitor())).append("</strong>");
artifact.append("<br />Path: ").append(cont.accept(new PathVisitor()));
artifact.append("<br /> Size: ").append(filesize.toString());
artifact.append("</p><ul style=\"list-style-type: none;\">");
// Get all the attributes for this guy
for (BlackboardAttribute tempatt : entry.getValue())
{
StringBuilder attribute = new StringBuilder("<li style=\"list-style-type: none;\">Type: ").append(tempatt.getAttributeTypeDisplayName()).append("</li>");
attribute.append("<li style=\"list-style-type: none;\">Value: ").append(tempatt.getValueString()).append("</li>");
attribute.append("<li style=\"list-style-type: none;\"> Context: ").append(tempatt.getContext()).append("</li>");
artifact.append(attribute);
}
artifact.append("</ul>");
if(entry.getKey().getArtifactTypeID() == 1){
nodeGen.append(artifact);
}
if(entry.getKey().getArtifactTypeID() == 2){
nodeWebBookmark.append(artifact);
}
if(entry.getKey().getArtifactTypeID() == 3){
nodeWebCookie.append(artifact);
}
if(entry.getKey().getArtifactTypeID() == 4){
nodeWebHistory.append(artifact);
}
if(entry.getKey().getArtifactTypeID() == 5){
nodeWebDownload.append(artifact);
}
if(entry.getKey().getArtifactTypeID() == 6){
nodeRecentObjects.append(artifact);
}
if(entry.getKey().getArtifactTypeID() == 7){
nodeTrackPoint.append(artifact);
}
if(entry.getKey().getArtifactTypeID() == 8){
nodeInstalled.append(artifact);
}
if(entry.getKey().getArtifactTypeID() == 9){
nodeKeyword.append(artifact);
}
if(entry.getKey().getArtifactTypeID() == 10){
nodeHash.append(artifact);
}
//Add them back in order
formatted_Report.append(nodeGen);
formatted_Report.append(nodeWebBookmark);
formatted_Report.append(nodeWebCookie);
formatted_Report.append(nodeWebHistory);
formatted_Report.append(nodeWebDownload);
formatted_Report.append(nodeRecentObjects);
formatted_Report.append(nodeTrackPoint);
formatted_Report.append(nodeInstalled);
formatted_Report.append(nodeKeyword);
formatted_Report.append(nodeHash);
//end of master loop
}
formatted_Report.append("</div></div></body></html>");
}
catch(Exception e)
{
Logger.getLogger(reportHTML.class.getName()).log(Level.INFO, "Exception occurred", e);
}
}
private class NameVisitor extends ContentVisitor.Default<String> {
@Override
protected String defaultVisit(Content cntnt) {
throw new UnsupportedOperationException("Not supported for " + cntnt.toString());
}
@Override
public String visit(Directory dir) {
return dir.getName();
}
@Override
public String visit(Image img) {
return img.getName();
}
@Override
public String visit(File fil) {
return fil.getName();
}
}
private class PathVisitor extends ContentVisitor.Default<String> {
@Override
protected String defaultVisit(Content cntnt) {
throw new UnsupportedOperationException("Not supported for " + cntnt.toString());
}
@Override
public String visit(Directory dir) {
return dir.getParentPath();
}
@Override
public String visit(Image img) {
return img.getName();
}
@Override
public String visit(File fil) {
return fil.getParentPath();
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
ed475415721926234a50d48f577c6c99a131988c | c85452d3ddfc46880d638ec2e4d8602368a7e423 | /src/main/java/co/com/empleados/app/BackendEmpleadosApplication.java | 88666f54b2d76f7d59dffd5a523e147cc2497c26 | [] | no_license | jjvalencial/empleados | 2cb0f56b8b89dc96e27506fb9f1264eca87f433d | 39c37c612e5399945a562dfef635c6ba4dc85b42 | refs/heads/master | 2023-04-25T13:01:32.287650 | 2021-05-18T04:17:56 | 2021-05-18T04:17:56 | 367,504,888 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 333 | java | package co.com.empleados.app;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class BackendEmpleadosApplication {
public static void main(String[] args) {
SpringApplication.run(BackendEmpleadosApplication.class, args);
}
}
| [
"jairo185@gmail.com"
] | jairo185@gmail.com |
4200498c109898326851b741ee82605ede390160 | 5b45c25f5bea07baf0351cc55614b48a307350fc | /movies.suggestion/src/main/java/com/sensedia/movies/suggestion/controller/MovieController.java | 51db45255fb7b1837494f9a9bd66cf7e14b85bb8 | [] | no_license | otavioprado/movie-suggestions | d0531563d237aabdd6f0d5f8f01524455b3c69f8 | 2314f72f3fa7e5ddeb1cc4369429de268a437613 | refs/heads/master | 2020-03-21T04:14:31.090560 | 2018-06-21T02:24:49 | 2018-06-21T02:24:49 | 138,098,456 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 986 | java | package com.sensedia.movies.suggestion.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.omertron.themoviedbapi.MovieDbException;
import com.sensedia.movies.suggestion.model.movies.MovieSuggestion;
import com.sensedia.movies.suggestion.service.MovieSuggestionService;
@RestController
public class MovieController {
@Autowired
private MovieSuggestionService movieService;
@RequestMapping(value = "/movie/suggestions", method = RequestMethod.GET)
public List<MovieSuggestion> getMovieSuggestions(@RequestParam(name = "temperatureInCelsius") Integer temperatureInCelsius)
throws MovieDbException {
return movieService.getMovieSuggestions(temperatureInCelsius);
}
}
| [
"otaviofelipedoprado@gmail.com"
] | otaviofelipedoprado@gmail.com |
1ed59367eee471a3ccbb5f04153a1e1f7afdc289 | 58f14db401b489079e079c45436e15c7532eea9b | /sep3sim3forJava11/src/sep3/model/operation/RorOperation.java | 21807b5d3fd721bb6581b2b2b4bd4774f7ca5419 | [] | no_license | okitsune157/MachineLang-lecture- | bc61d379425cb184f693c0f8622c3e4471a90621 | 69ed1f57b4500ec566deea3b52a552cd3c842809 | refs/heads/master | 2023-07-17T14:53:13.726580 | 2021-09-02T13:29:53 | 2021-09-02T13:29:53 | 402,430,245 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 959 | java | package sep3.model.operation;
import sep3.model.CPU;
//import java.lang.Integer;
public class RorOperation extends Operation{
private CPU cpu;
RorOperation(CPU cpu) { super(cpu); this.cpu = cpu; }
public void operate() {
// AバスもBバスも使わない?
useABus(true);
useBBus(false);
// Aバスの値を左論理シフト
int i = cpu.getABus().getValue();
int o = Integer.rotateLeft(i,1);
// PSWの更新
int p = psw_NZ(o);
// オーバーフローするのは、iの符号ビットが、oの符号ビットと異なる場合
if (bit(o, 0x10000)) { p |= CPU.PSW_C; }
cpu.getRegister(CPU.REG_PSW).setValue(p);
// キャリーがあったら捨てて、Sバスの値をToオペランドに書き込む
cpu.getSBus().setValue(o & 0xFFFF);//&ってORだっけ?<-ANDだった!
writeBack(true);
}
}
| [
"myuuuuym@gmail.com"
] | myuuuuym@gmail.com |
8b3982752b5798c999338747a0f4adad370fde5c | 231bcbd7375067d8457ddb287ef09f9de6870fb0 | /src/com/easemob/chatuidemo/activity/LoginActivity.java | 8a9a3fb0da621d3fa5d37e4ebd71c2a4fdd79d9a | [] | no_license | wyxy2005/BlackBoard | 93c9500435e8fff071e7b5e2a6d1f86406321e56 | ea42995b9c0599ef5128caac52f81e231ded7c90 | refs/heads/master | 2021-05-29T19:58:52.455381 | 2015-11-13T09:17:14 | 2015-11-13T09:17:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,693 | java | /**
* Copyright (C) 2013-2014 EaseMob Technologies. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.easemob.chatuidemo.activity;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import com.bairuitech.blackboard.R;
import com.bairuitech.blackboard.activity.RegisterActivity;
import com.easemob.EMCallBack;
import com.easemob.applib.controller.HXSDKHelper;
import com.easemob.chat.EMChatManager;
import com.easemob.chat.EMGroupManager;
import com.easemob.chatuidemo.Constant;
import com.easemob.chatuidemo.DemoApplication;
import com.easemob.chatuidemo.DemoHXSDKHelper;
import com.easemob.chatuidemo.db.UserDao;
import com.easemob.chatuidemo.domain.User;
import com.easemob.chatuidemo.utils.CommonUtils;
/**
* 登陆页面
*
*/
public class LoginActivity extends BaseActivity {
private static final String TAG = "LoginActivity";
public static final int REQUEST_CODE_SETNICK = 1;
private EditText usernameEditText;
private EditText passwordEditText;
private boolean progressShow;
private boolean autoLogin = false;
private String currentUsername;
private String currentPassword;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 如果用户名密码都有,直接进入主页面
if (DemoHXSDKHelper.getInstance().isLogined()) {
autoLogin = true;
startActivity(new Intent(LoginActivity.this, MainActivity.class));
return;
}
setContentView(R.layout.activity_login);
usernameEditText = (EditText) findViewById(R.id.username);
passwordEditText = (EditText) findViewById(R.id.password);
// 如果用户名改变,清空密码
usernameEditText.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
passwordEditText.setText(null);
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void afterTextChanged(Editable s) {
}
});
if (DemoApplication.getInstance().getUserName() != null) {
usernameEditText.setText(DemoApplication.getInstance().getUserName());
}
}
/**
* 登录
*
* @param view
*/
public void login(View view) {
if (!CommonUtils.isNetWorkConnected(this)) {
Toast.makeText(this, R.string.network_isnot_available, Toast.LENGTH_SHORT).show();
return;
}
currentUsername = usernameEditText.getText().toString().trim();
currentPassword = passwordEditText.getText().toString().trim();
if (TextUtils.isEmpty(currentUsername)) {
Toast.makeText(this, R.string.User_name_cannot_be_empty, Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(currentPassword)) {
Toast.makeText(this, R.string.Password_cannot_be_empty, Toast.LENGTH_SHORT).show();
return;
}
progressShow = true;
final ProgressDialog pd = new ProgressDialog(LoginActivity.this);
pd.setCanceledOnTouchOutside(false);
pd.setOnCancelListener(new OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
progressShow = false;
}
});
pd.setMessage(getString(R.string.Is_landing));
pd.show();
final long start = System.currentTimeMillis();
// 调用sdk登陆方法登陆聊天服务器
EMChatManager.getInstance().login(currentUsername, currentPassword, new EMCallBack() {
@Override
public void onSuccess() {
if (!progressShow) {
return;
}
// 登陆成功,保存用户名密码
DemoApplication.getInstance().setUserName(currentUsername);
DemoApplication.getInstance().setPassword(currentPassword);
try {
// ** 第一次登录或者之前logout后再登录,加载所有本地群和回话
// ** manually load all local groups and
EMGroupManager.getInstance().loadAllGroups();
EMChatManager.getInstance().loadAllConversations();
// 处理好友和群组
initializeContacts();
} catch (Exception e) {
e.printStackTrace();
// 取好友或者群聊失败,不让进入主页面
runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
DemoHXSDKHelper.getInstance().logout(true,null);
Toast.makeText(getApplicationContext(), R.string.login_failure_failed, 1).show();
}
});
return;
}
// 更新当前用户的nickname 此方法的作用是在ios离线推送时能够显示用户nick
boolean updatenick = EMChatManager.getInstance().updateCurrentUserNick(
DemoApplication.currentUserNick.trim());
if (!updatenick) {
Log.e("LoginActivity", "update current user nick fail");
}
if (!LoginActivity.this.isFinishing() && pd.isShowing()) {
pd.dismiss();
}
// 进入主页面
Intent intent = new Intent(LoginActivity.this,
MainActivity.class);
startActivity(intent);
finish();
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(final int code, final String message) {
if (!progressShow) {
return;
}
runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
Toast.makeText(getApplicationContext(), getString(R.string.Login_failed) + message,
Toast.LENGTH_SHORT).show();
}
});
}
});
}
private void initializeContacts() {
Map<String, User> userlist = new HashMap<String, User>();
// 添加user"申请与通知"
User newFriends = new User();
newFriends.setUsername(Constant.NEW_FRIENDS_USERNAME);
String strChat = getResources().getString(
R.string.Application_and_notify);
newFriends.setNick(strChat);
userlist.put(Constant.NEW_FRIENDS_USERNAME, newFriends);
// 添加"群聊"
User groupUser = new User();
String strGroup = getResources().getString(R.string.group_chat);
groupUser.setUsername(Constant.GROUP_USERNAME);
groupUser.setNick(strGroup);
groupUser.setHeader("");
userlist.put(Constant.GROUP_USERNAME, groupUser);
// 添加"Robot"
User robotUser = new User();
String strRobot = getResources().getString(R.string.robot_chat);
robotUser.setUsername(Constant.CHAT_ROBOT);
robotUser.setNick(strRobot);
robotUser.setHeader("");
userlist.put(Constant.CHAT_ROBOT, robotUser);
// 存入内存
((DemoHXSDKHelper)HXSDKHelper.getInstance()).setContactList(userlist);
// 存入db
UserDao dao = new UserDao(LoginActivity.this);
List<User> users = new ArrayList<User>(userlist.values());
dao.saveContactList(users);
}
/**
* 注册
*
* @param view
*/
public void register(View view) {
startActivityForResult(new Intent(this, RegisterActivity.class), 0);
}
@Override
protected void onResume() {
super.onResume();
if (autoLogin) {
return;
}
}
}
| [
"19995945@qq.com"
] | 19995945@qq.com |
8548d70ab113ead00fe6be8756440ab99b9ccb80 | 37d9cb637892adc1060cc2d6a656831f37ce2a1e | /telegram-message-analysis-bot/src/main/java/com/neoshell/telegram/messageanalysisbot/HTMLFormatter.java | 473630375c95711fadb8a1b92a0899ceaefde48a | [] | no_license | neoshell/TelegramMessageAnalysisBot | 83e11fc0cc4cb9265de71b266959a19f9339ed52 | eb790ce11299ecece016712eb7e1261dbc02cfa1 | refs/heads/master | 2022-03-04T22:47:10.217814 | 2022-02-26T00:18:59 | 2022-02-26T00:18:59 | 114,452,835 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 679 | java | package com.neoshell.telegram.messageanalysisbot;
public class HTMLFormatter {
public static String bold(String str) {
return "<b>" + str + "</b>";
}
public static String italic(String str) {
return "<i>" + str + "</i>";
}
public static String inlineURL(String text, String url) {
return "<a href=\"" + url + "\">" + text + "</a>";
}
public static String mentionUser(String text, long userId) {
return "<a href=\"tg://user?id=" + userId + "\">" + text + "</a>";
}
public static String code(String str) {
return "<code>" + str + "</code>";
}
public static String codeBlock(String str) {
return "<pre>" + str + "</pre>";
}
}
| [
"contact.neoshell@gmail.com"
] | contact.neoshell@gmail.com |
6c737a457fcc9baec4cee3de156b005d7e3bcb03 | 91f7d855ebaf0d384a60ce78c309c71a989b7006 | /src/test/java/kln/reactor/collection/ringbuffer/ArrayBlockingCounsumer.java | cc7abca549d2182e94ee2cebcd7faa12681b0fb8 | [] | no_license | KulanS/reactor-core | 6d3d17068aa92d339f2fbcaad53cb0b5ca644b2e | c75b7718d79fc7915cf3f95d7ad11c8861550539 | refs/heads/master | 2023-08-12T16:59:59.600385 | 2021-10-18T20:17:11 | 2021-10-18T20:17:11 | 388,063,467 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 556 | java | package kln.reactor.collection.ringbuffer;
import java.util.concurrent.BlockingQueue;
public class ArrayBlockingCounsumer implements Runnable{
BlockingQueue<StockPrice> queue;
public ArrayBlockingCounsumer(BlockingQueue<StockPrice> queue) {
this.queue = queue;
}
@Override
public void run() {
try {
while (true) {
if (!queue.isEmpty()) {
StockPrice price = queue.poll();
System.out.println("C1:->" + price);
}else {
Thread.sleep(1);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"kulan_s@epiclanka.net"
] | kulan_s@epiclanka.net |
dce9cbebcbe5fe37b730675887c2eea1f653ae2c | ff90cb1e2d41244050f16393ed1a5d6270cfba64 | /src/com/designpatterns/behavioral/interpreter/OperationContext.java | 1e474317e2f1a0d72a0e96f92b2fa9f2318d51bc | [] | no_license | alikemaltasci/DesignPatterns | c87a5e85861b7ab9d5ef8e348d594b963cf94142 | e414cb5e33b160af6ebbbc06873e1c9b6df82c54 | refs/heads/master | 2020-05-23T07:49:23.537740 | 2017-01-31T08:16:01 | 2017-01-31T08:16:01 | 80,448,228 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 426 | java | package com.designpatterns.behavioral.interpreter;
public class OperationContext {
public int add(int operand1, int operand2){
return (operand1 + operand2);
}
public int subtract(int operand1, int operand2){
return (operand1 - operand2);
}
public int divide(int operand1, int operand2){
return (operand1 / operand2);
}
public int multiply(int operand1, int operand2){
return (operand1 * operand2);
}
}
| [
"alikemaltasci@yahooo.com"
] | alikemaltasci@yahooo.com |
e5d8e964a1a3c2a24f6a2a893f56e1b8e4a22338 | 9f7a049d7a827716dd68acbdb3c5cdb90d82ed60 | /Lesson10-Hydration-Reminder/T10.05-Exercise-ChargingBroadcastReceiver/app/src/main/java/com/example/android/background/sync/ReminderTasks.java | ec71706f23b15df11d01d49bf7346d6736b32621 | [
"Apache-2.0"
] | permissive | Madonahs/ud851-Exercises | b2d85e1e3263786a653058323b8c12eee8ab3412 | 4e4d8f378f2ce4eb50abdd4ef52a87fc67284530 | refs/heads/student | 2020-03-24T23:52:23.267138 | 2018-09-15T02:56:03 | 2018-09-15T02:56:03 | 143,158,189 | 4 | 1 | Apache-2.0 | 2018-09-15T02:56:04 | 2018-08-01T13:14:31 | Java | UTF-8 | Java | false | false | 1,920 | java | /*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.android.background.sync;
import android.content.Context;
import com.example.android.background.utilities.NotificationUtils;
import com.example.android.background.utilities.PreferenceUtilities;
public class ReminderTasks {
public static final String ACTION_INCREMENT_WATER_COUNT = "increment-water-count";
public static final String ACTION_DISMISS_NOTIFICATION = "dismiss-notification";
static final String ACTION_CHARGING_REMINDER = "charging-reminder";
public static void executeTask(Context context, String action) {
if (ACTION_INCREMENT_WATER_COUNT.equals(action)) {
incrementWaterCount(context);
} else if (ACTION_DISMISS_NOTIFICATION.equals(action)) {
NotificationUtils.clearAllNotifications(context);
} else if (ACTION_CHARGING_REMINDER.equals(action)) {
issueChargingReminder(context);
}
}
private static void incrementWaterCount(Context context) {
PreferenceUtilities.incrementWaterCount(context);
NotificationUtils.clearAllNotifications(context);
}
private static void issueChargingReminder(Context context) {
PreferenceUtilities.incrementChargingReminderCount(context);
NotificationUtils.remindUserBecauseCharging(context);
}
} | [
"asser@udacity.com"
] | asser@udacity.com |
b8abcaeae34b92cba5d45d96dd0f66fc79eff193 | 3719ce60d99ef540600bb475eb303e21f2d5b7b9 | /core-base/src/test/java/org/imanity/frameworktest/CacheableTest.java | daf4f54e3279b3f208e903409bb61ad92411d4b3 | [
"MIT"
] | permissive | CyberFlameGO/fairy | 3704ea6ef2359c53e147b97427b0ff7634011d65 | a86b4011a3f11e3bb4e7d8bf3ab8a3ad6ffadd03 | refs/heads/master | 2023-08-12T20:06:38.456921 | 2021-09-01T10:38:39 | 2021-09-01T10:38:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,773 | java | /*
* MIT License
*
* Copyright (c) 2021 Imanity
*
* 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 org.imanity.frameworktest;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.fairy.CacheEvict;
import org.fairy.CachePut;
import org.fairy.Cacheable;
import org.fairy.cache.EnableOwnCacheManager;
import org.junit.Test;
import org.springframework.util.Assert;
import java.security.SecureRandom;
import java.util.Random;
import java.util.StringJoiner;
import java.util.concurrent.TimeUnit;
public class CacheableTest {
private static final Random RANDOM = new SecureRandom();
@Test
public void cacheSimpleCall() {
Foo foo = new Foo(1L);
String first = foo.get().toString();
MatcherAssert.assertThat(first, CoreMatchers.equalTo(foo.get().toString()));
foo.flush();
MatcherAssert.assertThat(
foo.get().toString(),
CoreMatchers.not(CoreMatchers.equalTo(first))
);
}
@Test
public void cachesSimpleStaticCall() throws Exception {
final String first = Foo.staticGet();
MatcherAssert.assertThat(
first,
CoreMatchers.equalTo(Foo.staticGet())
);
Foo.staticFlush();
MatcherAssert.assertThat(
Foo.staticGet(),
CoreMatchers.not(CoreMatchers.equalTo(first))
);
}
@Test
public void flushAndEnsureNonNull() {
Imanity imanity = new Imanity();
for (int i = 0; i < 100000; i++) {
final String hi = imanity.test("hi");
Assert.notNull(hi, "The result is null!");
imanity.clear();
}
}
@Test
public void evictAndEnsureNonNull() {
Imanity imanity = new Imanity();
for (int i = 0; i < 100000; i++) {
final String hi = imanity.test("hi");
Assert.notNull(hi, "The result is null!");
imanity.evict("hi");
}
}
@Test
public void flushesWithStaticTrigger() throws Exception {
final Bar bar = new Bar();
MatcherAssert.assertThat(
bar.get(),
CoreMatchers.equalTo(bar.get())
);
}
@Test
public void testKey() throws Exception {
Imanity imanity = new Imanity();
int id = 2;
long first = imanity.test(id);
MatcherAssert.assertThat(first, CoreMatchers.equalTo(imanity.test(id)));
long second = imanity.test(5);
MatcherAssert.assertThat(first, CoreMatchers.not(second));
imanity.evict(id);
long third = imanity.test(id);
MatcherAssert.assertThat(first, CoreMatchers.not(third));
long dummyObjectA = imanity.test(new ImanityDummy(id));
long dummyObjectB = imanity.test(new ImanityDummy(id));
MatcherAssert.assertThat(dummyObjectA, CoreMatchers.equalTo(dummyObjectB));
imanity.evict(id);
MatcherAssert.assertThat(dummyObjectA, CoreMatchers.not(imanity.test(new ImanityDummy(id))));
id = 3;
long testPut = RANDOM.nextLong();
imanity.put(id, testPut);
MatcherAssert.assertThat(testPut, CoreMatchers.equalTo(testPut));
}
@Test(expected = IllegalArgumentException.class)
public void testNullParameter() throws Exception {
Imanity imanity = new Imanity();
imanity.test((String) null);
}
@EnableOwnCacheManager
private static final class Imanity {
@Cacheable(key = "'test-' + #args[0]")
public long test(int id) {
return RANDOM.nextLong();
}
@Cacheable(key = "'test-' + #args[0].getId()")
public long test(ImanityDummy dummy) {
return RANDOM.nextLong();
}
@Cacheable(key = "'test-' + #args[0]")
public String test() {
return "hi";
}
@Cacheable(key = "'test-' + #args[0]")
public String test(String text) {
return "lol";
}
@CacheEvict(value = "'test-' + #args[0]")
public void evict(int id) {
}
@CacheEvict(value = "'test-' + #args[0]")
public void evict(String id) {
}
@CachePut(value = "'test-' + #args[0]")
public long put(int id, long value) {
return value;
}
@Cacheable.ClearBefore
public void clear() {
}
}
public static final class ImanityDummy {
public int getId() {
return id;
}
private int id;
public ImanityDummy(int id) {
this.id = id;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ImanityDummy that = (ImanityDummy) o;
return id == that.id;
}
@Override
public int hashCode() {
return id;
}
@Override
public String toString() {
return new StringJoiner(", ", ImanityDummy.class.getSimpleName() + "[", "]")
.add("id=" + id)
.toString();
}
}
private static final class Foo {
private final transient long number;
Foo(final long num) {
this.number = num;
}
@Override
public int hashCode() {
return this.get().hashCode();
}
@Override
public boolean equals(final Object obj) {
return obj == this;
}
@Override
@Cacheable(forever = true)
public String toString() {
return Long.toString(this.number);
}
@Cacheable(lifetime = 1, unit = TimeUnit.SECONDS)
public Foo get() {
return new Foo(CacheableTest.RANDOM.nextLong());
}
@Cacheable(lifetime = 1, unit = TimeUnit.SECONDS)
public Foo never() {
try {
TimeUnit.HOURS.sleep(1L);
} catch (final InterruptedException ex) {
throw new IllegalStateException(ex);
}
return this;
}
@Cacheable.ClearBefore
public void flush() {
// nothing to do
}
@Cacheable(lifetime = 1, unit = TimeUnit.SECONDS)
public static String staticGet() {
return Long.toString(CacheableTest.RANDOM.nextLong());
}
@Cacheable.ClearBefore
public static void staticFlush() {
// nothing to do
}
}
public static final class Bar {
@Cacheable
public long get() {
return CacheableTest.RANDOM.nextLong();
}
}
}
| [
"lee20040919@gmail.com"
] | lee20040919@gmail.com |
d527fb8250893582c0deee8c7d9dec63c621dda8 | ee0ddf0854f1092c3d6dccabeafaeec2840eacfc | /app/src/main/java/com/xmx/searchpoi/Tools/FragmentBase/BaseFragment.java | cae932e6df82749184680f4b4db52789efe0459d | [] | no_license | The---onE/SearchPOIA | 73a64de322d19cc8db58343bfa1816db76162ec9 | 0a2c9e42d84a52e11a95fa11e4e8663e2fe3277f | refs/heads/master | 2021-01-12T01:51:34.235622 | 2017-01-13T13:05:21 | 2017-01-13T13:05:21 | 78,438,638 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 874 | java | package com.xmx.searchpoi.Tools.FragmentBase;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by The_onE on 2016/7/4.
*/
public abstract class BaseFragment extends BFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = getContentView(inflater, container);
initView(view);
setListener(view);
processLogic(view, savedInstanceState);
return view;
}
protected abstract View getContentView(LayoutInflater inflater, ViewGroup container);
protected abstract void initView(View view);
protected abstract void setListener(View view);
protected abstract void processLogic(View view, Bundle savedInstanceState);
}
| [
"834489218@qq.com"
] | 834489218@qq.com |
7d8e4f135cbf76fe8138d279039fb7334ee5e44a | 2be000098b192546e2c052f68f9cb8b2ed6db21c | /src/main/java/com/qin/springbooteasyexcel/util/excel/ExcelException.java | 9e9d826451fa75c64a600eb58e70d1e5a112232b | [
"Apache-2.0"
] | permissive | zhflemon/springboot-easyexcel | b943d1f2bc68c372cb2ff335bacbebec8f494071 | 567ab1221e572ff275c22a95179f9e35da755a3b | refs/heads/master | 2021-05-18T11:14:30.276284 | 2019-12-04T05:27:26 | 2019-12-04T05:27:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 336 | java | package com.qin.springbooteasyexcel.util.excel;
/**
* Created with IntelliJ IDEA
*
* @Author yuanhaoyue swithaoy@gmail.com
* @Description Excel 解析 Exception
* @Date 2018-06-06
* @Time 15:56
*/
public class ExcelException extends RuntimeException {
public ExcelException(String message) {
super(message);
}
}
| [
"mm739023340@qq.com"
] | mm739023340@qq.com |
97e9213d14616496384563323e9dabc0cfe72e2a | 4cff4f30ade18b7fc6aca820da73fc559e624ab5 | /app/src/main/java/be/ucll/electroman_jeroen/UserEntity.java | 1291e3f10dbdc7665e25cac43ba6dad921df24cd | [] | no_license | r0431179/ElectroMan_Jeroen_Van_den_Rul | 54f3a991d8c641865c024354c9426badcf9d4130 | d1357ef53b03f82fee33d086895a26f1ae9ab1e1 | refs/heads/master | 2023-04-23T18:07:52.454752 | 2021-04-25T08:34:13 | 2021-04-25T08:34:13 | 361,374,851 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,576 | java | package be.ucll.electroman_jeroen;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
import androidx.room.TypeConverters;
import java.io.Serializable;
import java.util.List;
@Entity(tableName = "users")
public class UserEntity{
@PrimaryKey(autoGenerate = true)
Integer id;
@ColumnInfo(name = "username")
String username;
@ColumnInfo(name = "password")
String password;
@ColumnInfo(name = "firstname")
String firstname;
@ColumnInfo(name = "lastname")
String lastname;
public UserEntity() {
}
public UserEntity(String username, String password, String firstname, String lastname) {
this.username = username;
this.password = password;
this.firstname = firstname;
this.lastname = lastname;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
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;
}
}
| [
"73129410+r0431179@users.noreply.github.com"
] | 73129410+r0431179@users.noreply.github.com |
f15e3d7276ef51b76cb4a23d2a56f2474c6b0853 | b6f05e13fe7040ab59deaddab23bc4e0c2b525a4 | /fiji-commons/fiji-commons-monitoring/src/main/java/com/moz/fiji/commons/monitoring/MetricUtils.java | 0a90501712065c5ffff1c7865d97f1aaff157cdb | [
"Apache-2.0"
] | permissive | seomoz/fiji | a621b6d6db3a7731414f6ea7d2bc6fc5ee2d59ec | bed3b7d20770ab2c490b55f278cb4397937f61b6 | refs/heads/master | 2021-01-18T08:56:48.848846 | 2016-07-19T20:30:17 | 2016-07-19T20:30:17 | 53,540,389 | 1 | 0 | null | 2016-07-06T20:52:33 | 2016-03-09T23:47:08 | HTML | UTF-8 | Java | false | false | 7,324 | java | /**
* (c) Copyright 2014 WibiData, Inc.
*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* 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.moz.fiji.commons.monitoring;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.Map.Entry;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import com.codahale.metrics.ConsoleReporter;
import com.codahale.metrics.Histogram;
import com.codahale.metrics.Metric;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.MetricSet;
import com.codahale.metrics.jvm.GarbageCollectorMetricSet;
import com.codahale.metrics.jvm.MemoryUsageGaugeSet;
import com.codahale.metrics.jvm.ThreadStatesGaugeSet;
import com.codahale.metrics.riemann.Riemann;
import com.codahale.metrics.riemann.RiemannReporter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.moz.fiji.commons.SocketAddressUtils;
/**
* Provides utility methods for working with the Dropwizard Metrics library.
*/
public final class MetricUtils {
private static final Logger LOG = LoggerFactory.getLogger(MetricUtils.class);
/**
* Create a new metric registry pre-registered with JVM metrics.
*
* @return A new metric registry with pre-registered JVM metrics.
*/
public static MetricRegistry createMetricRegistry() {
final MetricRegistry registry = new MetricRegistry();
registerAll(registry, "jvm.gc", new GarbageCollectorMetricSet());
registerAll(registry, "jvm.mem", new MemoryUsageGaugeSet());
registerAll(registry, "jvm.thread", new ThreadStatesGaugeSet());
registerAll(registry, "jvm.cpu", CpuMetricSet.create());
registerAll(registry, "jvm.fd", FdMetricSet.create());
return registry;
}
/**
* Create a new {@link Histogram} backed by the latency utils package. This histogram should
* not be used with a registry that has more than a single scheduled reporter.
*
* @return A new Histogram backed by the latency utils package.
*/
public static Histogram createLatencyUtilsHistogram() {
return new Histogram(LatencyUtilsReservoir.create());
}
/**
* Create a new {@link Histogram} backed by the HDR histogram package. The histogram supports
* recording values in the given range with the given amount of precision. The precision is
* expressed in the number of significant decimal digits preserved.
*
* @param lowestDiscernableValue Smallest recorded value discernible from 0.
* @param highestTrackableValue Highest trackable value.
* @param numberOfSignificantValueDigits Number of significant decimal digits.
* @return A Histogram backed by the HDR histogram package.
*/
public static Histogram createHdrHistogram(
final long lowestDiscernableValue,
final long highestTrackableValue,
final int numberOfSignificantValueDigits
) {
return new Histogram(
HdrHistogramReservoir.create(
lowestDiscernableValue,
highestTrackableValue,
numberOfSignificantValueDigits));
}
/**
* Register a Riemann reporter with the provided metrics registry.
*
* @param riemannAddress The address of the Riemann service.
* @param registry The metric registry to report to Riemann.
* @param localAddress The address of the local process host.
* @param prefix A prefix to add to reported metrics.
* @param intervalPeriod The update period.
* @param intervalUnit The unit of time of the update period.
* @return The reporter.
* @throws IOException On unrecoverable I/O exception.
*/
public static RiemannReporter registerRiemannMetricReporter(
final InetSocketAddress riemannAddress,
final MetricRegistry registry,
final InetSocketAddress localAddress,
final String prefix,
final long intervalPeriod,
final TimeUnit intervalUnit
) throws IOException {
final InetSocketAddress publicAddress = SocketAddressUtils.localToPublic(localAddress);
// Get the hostname of this machine. Graphite uses '.' as a separator, so all instances in the
// hostname are replaced with '_'.
final String localhost =
publicAddress.getHostName().replace('.', '_') + ":" + publicAddress.getPort();
final RiemannReporter reporter = RiemannReporter
.forRegistry(registry)
.localHost(localhost)
.prefixedWith(prefix)
.withTtl(60.0f)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.useSeparator(".")
.build(new Riemann(riemannAddress.getHostString(), riemannAddress.getPort()));
reporter.start(intervalPeriod, intervalUnit);
return reporter;
}
/**
* Register a console reporter with the provided metrics registry.
*
* @param registry The metric registry to report to the console.
* @param intervalPeriod The update period.
* @param intervalUnit The unit of time of the update period.
* @return The reporter.
*/
public static ConsoleReporter registerConsoleReporter(
final MetricRegistry registry,
final long intervalPeriod,
final TimeUnit intervalUnit
) {
final ConsoleReporter reporter = ConsoleReporter
.forRegistry(registry)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.build();
reporter.start(intervalPeriod, intervalUnit);
return reporter;
}
/**
* Add metrics to the given registry that track the given executor's thread and task counts.
*
* @param executor The executor to instrument.
* @param registry The metric registry.
* @param prefix The metric name prefix.
*/
public static void instrumentExecutor(
final ThreadPoolExecutor executor,
final MetricRegistry registry,
final String prefix
) {
registerAll(registry, prefix, ExecutorMetricSet.create(executor));
}
/**
* Register the given metric set with the registry, with a prefix added to the name of each
* metric. {@link MetricRegistry} has this method, but it is private.
*
* @param registry The registry.
* @param prefix The prefix to add to each metric name.
* @param metrics The metrics.
*/
public static void registerAll(
final MetricRegistry registry,
final String prefix,
final MetricSet metrics
) {
for (final Entry<String, Metric> entry : metrics.getMetrics().entrySet()) {
if (entry.getValue() instanceof MetricSet) {
registerAll(registry, MetricRegistry.name(prefix, entry.getKey()), metrics);
} else {
registry.register(MetricRegistry.name(prefix, entry.getKey()), entry.getValue());
}
}
}
/** Private constructor for utility class. */
private MetricUtils() {
}
}
| [
"vagrant@mozlinks"
] | vagrant@mozlinks |
2a1b043849b89d99fe9692ddfeaca692ee34a5d4 | f31d4fd81ed75710d6eb563e5eb7efd913903380 | /src/com/jiadong/dao/UserDaoImpl.java | 18c020e49f58a7bad6c7518f4813286311ef57cb | [] | no_license | JohnMai1994/StudentManageSystem | e60505d047de2f9e7a493c1fab767d1d18b63e30 | 13c7505c52191aa8e20f9bf8c55296ca43ce4354 | refs/heads/master | 2022-12-03T00:25:08.368864 | 2020-08-24T05:35:57 | 2020-08-24T05:35:57 | 289,425,768 | 0 | 0 | null | 2020-08-24T05:35:58 | 2020-08-22T05:29:38 | CSS | UTF-8 | Java | false | false | 1,825 | java | package com.jiadong.dao;
import com.jiadong.bean.User;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;
import org.apache.commons.dbutils.handlers.BeanListHandler;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
public class UserDaoImpl implements UserDao{
public UserDaoImpl() {
}
@Override
public User login(Connection connection, User user) {
try {
QueryRunner runner = new QueryRunner();
BeanHandler<User> handler = new BeanHandler<>(User.class);
System.out.println(user);
String sql = "Select userName, password from db_user where userName = ? and password = ?";
User resultUser = runner.query(connection, sql, handler, user.getUserName(), user.getPassword());
if (resultUser != null) {
System.out.println("Query UserName " + resultUser.getUserName() + " Success");
}else {
System.out.println("UserName " + user.getUserName() + " Don't Exist");
}
return resultUser;
} catch (SQLException throwables) {
throwables.printStackTrace();
}
return null;
}
@Override
public List<User> queryAll(Connection connection) {
try {
QueryRunner runner = new QueryRunner();
BeanListHandler<User> handlers = new BeanListHandler<>(User.class);
String sql = "Select userName, password from db_user ";
List<User> users = runner.query(connection, sql, handlers);
System.out.println("Query All Users Data Success");
return users;
} catch (SQLException throwables) {
throwables.printStackTrace();
}
return null;
}
}
| [
"mjd64929@gmail.com"
] | mjd64929@gmail.com |
7662affa88fc497069ee44d3a2a3a84c03742d78 | ca2a46024fc5cb6e7ded7a4351db259bd4d9df9c | /app/src/main/java/com/example/segundoauqui/foodcatolog/view/fingerprint/FingerprintHandler.java | a53fae90b832a57e08943547fa2dc8e50e661dfa | [] | no_license | SAUQU/FoodCatolog | c2257c2420c707a8481cde52d2f55ac37adba969 | 6a0838893f6d14068bbaf7099a5e490f1e047d24 | refs/heads/master | 2018-10-25T14:47:08.181761 | 2018-08-21T12:39:13 | 2018-08-21T12:39:13 | 110,216,594 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,156 | java | package com.example.segundoauqui.foodcatolog.view.fingerprint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.hardware.fingerprint.FingerprintManager;
import android.Manifest;
import android.os.Build;
import android.os.CancellationSignal;
import android.support.v4.app.ActivityCompat;
import android.widget.Toast;
import com.example.segundoauqui.foodcatolog.view.mainview.MainView;
@TargetApi(Build.VERSION_CODES.M)
public class FingerprintHandler extends FingerprintManager.AuthenticationCallback {
// You should use the CancellationSignal method whenever your app can no longer process user input, for example when your app goes
// into the background. If you don’t use this method, then other apps will be unable to access the touch sensor, including the lockscreen!//
private CancellationSignal cancellationSignal;
private Context context;
public FingerprintHandler(Context mContext) {
context = mContext;
}
//Implement the startAuth method, which is responsible for starting the fingerprint authentication process//
public void startAuth(FingerprintManager manager, FingerprintManager.CryptoObject cryptoObject) {
cancellationSignal = new CancellationSignal();
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
return;
}
manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}
@Override
//onAuthenticationError is called when a fatal error has occurred. It provides the error code and error message as its parameters//
public void onAuthenticationError(int errMsgId, CharSequence errString) {
//I’m going to display the results of fingerprint authentication as a series of toasts.
//Here, I’m creating the message that’ll be displayed if an error occurs//
Toast.makeText(context, "Authentication error\n" + errString, Toast.LENGTH_LONG).show();
}
@Override
//onAuthenticationFailed is called when the fingerprint doesn’t match with any of the fingerprints registered on the device//
public void onAuthenticationFailed() {
Toast.makeText(context, "Authentication failed", Toast.LENGTH_LONG).show();
}
@Override
//onAuthenticationHelp is called when a non-fatal error has occurred. This method provides additional information about the error,
//so to provide the user with as much feedback as possible I’m incorporating this information into my toast//
public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
Toast.makeText(context, "Authentication help\n" + helpString, Toast.LENGTH_LONG).show();
}@Override
//onAuthenticationSucceeded is called when a fingerprint has been successfully matched to one of the fingerprints stored on the user’s device//
public void onAuthenticationSucceeded(
FingerprintManager.AuthenticationResult result) {
Intent intent = new Intent(context.getApplicationContext(), MainView.class);
context.startActivity(intent);
Toast.makeText(context, "Success!", Toast.LENGTH_LONG).show();
}
} | [
"auquisegundo@gmail.com"
] | auquisegundo@gmail.com |
0b737682188c4c718ae191e6ed30bb7f71fbc210 | 64fa075d41fa8fa5215f9fabecb65cbb8b5f9e28 | /src/main/java/net/shopec/util/FreeMarkerUtils.java | 5363892d3d2f7f6039a70c929f9e62ea097e4f37 | [] | no_license | jay763190097/shopecb2b2c | 069c7a5efd5151f3d267088daa4fcde0f9cb8195 | 08b650dc630d4d264daeaad446c5abfc69894138 | refs/heads/master | 2020-09-06T23:06:12.574861 | 2019-11-14T06:58:40 | 2019-11-14T06:58:40 | 220,583,739 | 0 | 0 | null | 2019-11-09T03:05:25 | 2019-11-09T03:05:25 | null | UTF-8 | Java | false | false | 7,304 | java | package net.shopec.util;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.Date;
import java.util.List;
import java.util.Map;
import net.shopec.CommonAttributes;
import net.shopec.EnumConverter;
import org.apache.commons.beanutils.ConvertUtilsBean;
import org.apache.commons.beanutils.ConvertUtilsBean2;
import org.apache.commons.beanutils.Converter;
import org.apache.commons.beanutils.converters.ArrayConverter;
import org.apache.commons.beanutils.converters.DateConverter;
import org.springframework.context.ApplicationContext;
import org.springframework.util.Assert;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
import freemarker.core.Environment;
import freemarker.ext.beans.BeansWrapper;
import freemarker.ext.beans.BeansWrapperBuilder;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
import freemarker.template.utility.DeepUnwrap;
/**
* Utils - FreeMarker
*
*/
public final class FreeMarkerUtils {
/**
* ConvertUtilsBean
*/
private static final ConvertUtilsBean CONVERT_UTILS;
/**
* FreeMarker默认配置
*/
private static final Configuration DEFAULT_CONFIGURATION = new Configuration(Configuration.VERSION_2_3_25);
/**
* BeansWrapper
*/
private static final BeansWrapper DEFAULT_BEANS_WRAPPER = new BeansWrapperBuilder(Configuration.VERSION_2_3_25).build();
static {
ConvertUtilsBean convertUtilsBean = new ConvertUtilsBean2() {
@Override
public Converter lookup(Class<?> clazz) {
Converter converter = super.lookup(clazz);
if (converter != null) {
return converter;
}
if (clazz.isEnum()) {
EnumConverter enumConverter = new EnumConverter(clazz);
super.register(enumConverter, clazz);
return enumConverter;
}
if (clazz.isArray()) {
Converter componentConverter = lookup(clazz.getComponentType());
if (componentConverter != null) {
ArrayConverter arrayConverter = new ArrayConverter(clazz, componentConverter, 0);
arrayConverter.setOnlyFirstToString(false);
super.register(arrayConverter, clazz);
return arrayConverter;
}
}
return super.lookup(clazz);
}
};
DateConverter dateConverter = new DateConverter();
dateConverter.setPatterns(CommonAttributes.DATE_PATTERNS);
convertUtilsBean.register(dateConverter, Date.class);
CONVERT_UTILS = convertUtilsBean;
}
/**
* 不可实例化
*/
private FreeMarkerUtils() {
}
/**
* 获取当前环境变量
*
* @return 当前环境变量
*/
public static Environment getCurrentEnvironment() {
return Environment.getCurrentEnvironment();
}
/**
* 解析字符串模板
*
* @param template
* 字符串模板
* @return 解析后内容
*/
public static String process(String template) throws IOException, TemplateException {
return process(template, null);
}
/**
* 解析字符串模板
*
* @param template
* 字符串模板
* @param model
* 数据
* @return 解析后内容
*/
public static String process(String template, Object model) throws IOException, TemplateException {
Configuration configuration = null;
ApplicationContext applicationContext = SpringUtils.getApplicationContext();
if (applicationContext != null) {
FreeMarkerConfigurer freeMarkerConfigurer = SpringUtils.getBean("freeMarkerConfigurer", FreeMarkerConfigurer.class);
if (freeMarkerConfigurer != null) {
configuration = freeMarkerConfigurer.getConfiguration();
}
}
return process(template, model, configuration);
}
/**
* 解析字符串模板
*
* @param template
* 字符串模板
* @param model
* 数据
* @param configuration
* 配置
* @return 解析后内容
*/
public static String process(String template, Object model, Configuration configuration) throws IOException, TemplateException {
if (template == null) {
return null;
}
StringWriter out = new StringWriter();
new Template("template", new StringReader(template), configuration != null ? configuration : DEFAULT_CONFIGURATION).process(model, out);
return out.toString();
}
/**
* 获取参数
*
* @param name
* 名称
* @param type
* 类型
* @param params
* 参数
* @return 参数,若不存在则返回null
*/
@SuppressWarnings("unchecked")
public static <T> T getParameter(String name, Class<T> type, Map<String, TemplateModel> params) throws TemplateModelException {
Assert.hasText(name, "hasText");
Assert.notNull(type, "notNull");
Assert.notNull(params, "notNull");
TemplateModel templateModel = params.get(name);
if (templateModel != null) {
Object value = DeepUnwrap.unwrap(templateModel);
if (value != null) {
return (T) CONVERT_UTILS.convert(value, type);
}
}
return null;
}
/**
* 获取参数
*
* @param index
* 索引
* @param type
* 类型
* @param arguments
* 参数
* @return 参数,若不存在则返回null
*/
@SuppressWarnings("unchecked")
public static <T> T getArgument(int index, Class<T> type, List<?> arguments) throws TemplateModelException {
Assert.notNull(type, "notNull");
Assert.notNull(arguments, "notNull");
if (index >= 0 && index < arguments.size()) {
Object argument = arguments.get(index);
Object value;
if (argument != null) {
if (argument instanceof TemplateModel) {
value = DeepUnwrap.unwrap((TemplateModel) argument);
} else {
value = argument;
}
if (value != null) {
return (T) CONVERT_UTILS.convert(value, type);
}
}
}
return null;
}
/**
* 获取变量
*
* @param name
* 名称
* @param env
* 环境变量
* @return 变量
*/
public static TemplateModel getVariable(String name, Environment env) throws TemplateModelException {
Assert.hasText(name, "hasText");
Assert.notNull(env, "notNull");
return env.getVariable(name);
}
/**
* 设置变量
*
* @param name
* 名称
* @param value
* 变量值
* @param env
* 环境变量
*/
public static void setVariable(String name, Object value, Environment env) throws TemplateException {
Assert.hasText(name, "hasText");
Assert.notNull(env, "notNull");
if (value instanceof TemplateModel) {
env.setVariable(name, (TemplateModel) value);
} else {
env.setVariable(name, DEFAULT_BEANS_WRAPPER.wrap(value));
}
}
/**
* 设置变量
*
* @param variables
* 变量
* @param env
* 环境变量
*/
public static void setVariables(Map<String, Object> variables, Environment env) throws TemplateException {
Assert.notNull(variables, "notNull");
Assert.notNull(env, "notNull");
for (Map.Entry<String, Object> entry : variables.entrySet()) {
String name = entry.getKey();
Object value = entry.getValue();
if (value instanceof TemplateModel) {
env.setVariable(name, (TemplateModel) value);
} else {
env.setVariable(name, DEFAULT_BEANS_WRAPPER.wrap(value));
}
}
}
} | [
"fz323817"
] | fz323817 |
9063d09ad6a2647085454c5e3137b4574d1b4186 | 29bb1d481f6bcd0342f994af78bf3553bb080912 | /src/main/java/com/example/smsdrw/controller/CategoryController.java | 07b8806fdbd6bc1d134d96e70ceb04f23cfd6407 | [] | no_license | tanakorn-rattanajariya/money-saving-backend | e0bac2245ed60cba203dde0312f14fed7294dd35 | 32bcaffe99f5531585fc7536bf8ae085937f646f | refs/heads/master | 2023-04-01T23:43:09.891299 | 2021-04-10T02:28:45 | 2021-04-10T02:28:45 | 353,037,572 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,163 | java | package com.example.smsdrw.controller;
import java.util.UUID;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.example.smsdrw.model.Category;
@RestController
@RequestMapping("/category")
public class CategoryController extends controller<Category,Long> {
@Override
public ResponseEntity<?> get(Long id) {
// TODO Auto-generated method stub
return ResponseEntity.ok(service.category.get(id));
}
@Override
public ResponseEntity<?> list() {
// TODO Auto-generated method stub
return ResponseEntity.ok(service.category.list(0));
}
@Override
public ResponseEntity<?> post(Category data) {
// TODO Auto-generated method stub
return ResponseEntity.ok(service.category.post(data));
}
@Override
public ResponseEntity<?> put(Category data, Long id) {
// TODO Auto-generated method stub
return ResponseEntity.ok(service.category.put(data, id));
}
@Override
public ResponseEntity<?> delete(Long id) {
// TODO Auto-generated method stub
return ResponseEntity.ok(service.category.delete(id));
}
}
| [
"lufas2603@gmail.com"
] | lufas2603@gmail.com |
2dcf8b1d189d154563abbf391046b364ea655424 | 13e384e0a3750db3a7e259f64b28724e443bb669 | /app/src/main/java/com/example/liao/xml/MainActivity.java | 4b83e88037d5206de35f3f2602093a846edc0737 | [] | no_license | liaoxianfu/XML | a345c3772ed6e605458ec03bbfc9f92d153bccf4 | 9742f3c475e804a484897dc09389fa6f15b2441f | refs/heads/master | 2020-03-10T21:36:52.900896 | 2018-04-15T10:13:36 | 2018-04-15T10:13:36 | 129,598,506 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,239 | java | package com.example.liao.xml;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Xml;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import org.xmlpull.v1.XmlSerializer;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
public static String XML = "XML";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final List<Person> personList = new LinkedList<Person>();
personList.add(new Person(1, "12", "张三"));
personList.add(new Person(2, "13", "李四"));
Button button = (Button) findViewById(R.id.btn1);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
createXML(personList);
}
});
Button button1 = (Button) findViewById(R.id.btn2);
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
createPassword();
}
});
}
public boolean isExternalStorageWritable() {
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
return true;
}
return false;
}
public boolean isExternalStorageReadable() {
String state = Environment.getExternalStorageState();
if (isExternalStorageWritable() || Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
return true;
}
return false;
}
private File makedirs(String dirName) {
File file = new File(Environment.getExternalStorageDirectory(), dirName);
if (!file.exists()) {
file.mkdirs();
}
return file;
}
private void createXML(List list) {
//创建外部文件
if (!isExternalStorageWritable()) {
Toast.makeText(this, "无法获取存储权限", Toast.LENGTH_SHORT).show();
return;
}
String dirNamme = XML;
File file = new File(makedirs(dirNamme), "person.xml");
try {
FileOutputStream outputStream = new FileOutputStream(file);
XmlSerializer serializer = Xml.newSerializer();
//开始文件流读写
serializer.setOutput(outputStream, "utf-8");
// 开始文件写入
serializer.startDocument("utf-8", true);
serializer.startTag(null, "Persons");
//开始对标签的写入
for (Object person : list) {
Person p = (Person) person;
serializer.startTag(null, "person");
serializer.attribute(null, "id", p.getId() + "");
serializer.startTag(null, "name");
serializer.text(((Person) person).getName());
serializer.endTag(null, "name");
serializer.startTag(null, "age");
serializer.text(((Person) person).getAge());
serializer.endTag(null, "age");
serializer.endTag(null, "person");
}
serializer.endTag(null, "Persons");
// 结束文件写入
serializer.endDocument();
serializer.flush();
outputStream.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
private void createPassword() {
if (!isExternalStorageWritable()) {
Toast.makeText(this, "无法创建目录", Toast.LENGTH_SHORT).show();
return;
}
File file = new File(makedirs("password"), "pss");
//创建文件
try {
FileOutputStream outputStreamm = new FileOutputStream(file);
XmlSerializer serializer = Xml.newSerializer();
serializer.setOutput(outputStreamm,"utf-8");
serializer.startDocument("utf-8", true);
serializer.startTag("password", "password");
serializer.startTag(null, "name");
EditText name = (EditText) findViewById(R.id.name);
/***********用户名**************/
serializer.text(name.getText().toString().trim());
serializer.endTag(null, "name");
serializer.startTag(null, "pass");
EditText pass = (EditText) findViewById(R.id.pass);
serializer.text(pass.getText().toString().trim());
serializer.endTag(null, "pass");
serializer.endTag("password", "password");
serializer.endDocument();
serializer.flush();
outputStreamm.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"liaoxianfu555@outlook.com"
] | liaoxianfu555@outlook.com |
22cd3867395b00e7acf5ca275954fbe59d429cf5 | fee61d9cafa4447e86bcdae4f8d13ac29d7c368d | /src/main/java/com/sanity/utils/PHATLogger.java | 73e0f257ef06a7ca5f6491681c8de34dff93e220 | [] | no_license | angu2015/afw | 22dec9c62d4fd369417576e535e81f6fa71adb05 | 0fa38c1c75d1838ab0a88279d2aeba61685ecc16 | refs/heads/master | 2021-01-10T13:50:21.472960 | 2015-12-18T17:44:51 | 2015-12-18T17:44:51 | 48,242,709 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,741 | java | /**
*
*/
package com.sanity.utils;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
/**
* @author anponnus
*
*/
public class PHATLogger {
/**
* Logger for different log level
*/
private StringBuilder infoLog = new StringBuilder();
private StringBuilder debugLog = new StringBuilder();
private StringBuilder warnLog = new StringBuilder();
private StringBuilder errLog = new StringBuilder();
public PHATLogger() {
// TODO Auto-generated constructor stub
}
/**
* @return the infoLog
*/
public StringBuilder getInfoLog() {
return infoLog;
}
/**
* @param infoLog the infoLog to set
*/
public void setInfoLog(String infoLog) {
this.infoLog.append(infoLog);
this.infoLog.append("\n");
}
/**
* @return the debugLog
*/
public String getDebugLog() {
return debugLog.toString();
}
/**
* @param debugLog the debugLog to set
*/
public void setDebugLog(String debugLog) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss").withLocale(Locale.US);
this.debugLog.append(LocalDateTime.now().format(formatter));
this.debugLog.append(" ");
this.debugLog.append(debugLog);
this.debugLog.append("\n");
}
/**
* @return the warnLog
*/
public StringBuilder getWarnLog() {
return warnLog;
}
/**
* @param warnLog the warnLog to set
*/
public void setWarnLog(String warnLog) {
this.warnLog.append(warnLog);
this.warnLog.append("\n");
}
/**
* @return the errLog
*/
public StringBuilder getErrLog() {
return errLog;
}
/**
* @param errLog the errLog to set
*/
public void setErrLog(String errLog) {
this.errLog.append(errLog);
this.errLog.append("\n");
}
}
| [
"jdakshan@cisco.com"
] | jdakshan@cisco.com |
12f305ca4533ebb7ddfc93509349f62331102865 | 89d67145e783d83ca4a56de5021abdbaa06a3fb3 | /common/src/main/java/qunar/com/hotel/common/jdk8/funtional/Converter.java | d0c90c677fd922b317ddfe2bfe05c816756cc3e8 | [] | no_license | baymaxonly/qunar-my-example | 069495e455caac89227a7a962779218087c98bdb | 68bc3a4ec047e0b9c46283bf71afe8292e7f464a | refs/heads/master | 2021-01-11T11:37:10.145406 | 2016-12-23T12:27:43 | 2016-12-23T12:27:43 | 76,843,231 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 287 | java | package qunar.com.hotel.common.jdk8.funtional;
/**
* Created by shixian.zhen on 2016/12/23.
*
*
*/
// Keep in mind that the code is also valid if the @FunctionalInterface annotation would be ommited.
@FunctionalInterface
public interface Converter<F, T> {
T convert(F from);
}
| [
"543405693@qq.com"
] | 543405693@qq.com |
6ab17606e59ef00fe4bc199f03375d0d382dba14 | 87b120fdfc5aabae26a69cc4ff488b0828a8c3ac | /src/main/java/ru/cheb/intercity/bus/constants/PropertyConstants.java | 3a85624a021e48c38317978b5ad633601f192d48 | [] | no_license | dinarAkv/TelegramBotBusSchedular | 8e894a70dbbfa803bbc0e940e85d7bff29070955 | c1c196e4562149622f019261fdf39daad449d20b | refs/heads/develope | 2021-01-23T10:34:54.059452 | 2017-09-22T08:55:00 | 2017-09-22T08:55:00 | 102,621,327 | 0 | 0 | null | 2017-09-22T08:55:01 | 2017-09-06T14:50:13 | Java | UTF-8 | Java | false | false | 431 | java | package ru.cheb.intercity.bus.constants;
/**
* Class ci=onatin constants that bind with .properties files.
*/
public class PropertyConstants {
public static String propKeyUrlWithStations = "avtoVasUrlWithStations";
public static String propHostUrl = "hostUrl";
public static String propertyFileName = "./src/main/resources/params.properties";
public static final String logSwitcher = "logSwitcher";
}
| [
"akhmetzyanov@i-teco.ru"
] | akhmetzyanov@i-teco.ru |
924453926caab82f5d180ee55d58eff26a5566b0 | 2a2a9b7869bb53105e4397eb1a181f6f9ab7710c | /isp-automotriz-web/src/main/java/com/sd/isp/beans/role/RoleB.java | 848a55f6f32c10070262735048acae7517f9230e | [] | no_license | mlored/swd | 689c3d3e12f42e15175dfa7835b45763f5f0b651 | 80d38d238d6de8ff2e0178fe72c814bea2fa6cd2 | refs/heads/master | 2023-01-22T21:51:56.335512 | 2019-07-04T21:22:54 | 2019-07-04T21:22:54 | 107,619,427 | 0 | 0 | null | 2023-01-11T18:57:57 | 2017-10-20T01:56:02 | JavaScript | UTF-8 | Java | false | false | 55 | java | package com.sd.isp.beans.role;
public class RoleB {
}
| [
"loredelpuerto@gmail.com"
] | loredelpuerto@gmail.com |
443bb280e958d7d4b95fcfa407c071b54d7ea6a3 | 17f6d7ec4ac95b3a95739c94ab292584b088b09a | /app/src/main/java/com/mvs/loaderasynctaskexample/MainActivity.java | 4bc6e585842c62dfa9647a0a348638526acd838c | [] | no_license | devmanjun/LoaderAsyncTaskExample | f81d2014a1e6578e7429780d6344433801d04435 | 950bcf836b09aeff7287da353a4d22e061430043 | refs/heads/master | 2021-05-09T22:39:29.378600 | 2018-01-24T12:01:15 | 2018-01-24T12:01:15 | 118,759,674 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,612 | java | package com.mvs.loaderasynctaskexample;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.ListView;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks<List<Employee>>{
private static final String TAG = MainActivity.class.getSimpleName();
private EmpAdapter empAdapter;
private ListView empListView;
private static final int LOADER_ID=12345;
private boolean loaderRunning=false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initViews();
initLoader(savedInstanceState);
}
private void initLoader(Bundle savedInstanceState) {
/*if(savedInstanceState==null)
{
getSupportLoaderManager().initLoader(LOADER_ID,null,this).forceLoad();
printLog("InitLoader");
}
else
{
getSupportLoaderManager().restartLoader(LOADER_ID,null,this);
printLog("Restart loder");
}*/
getSupportLoaderManager().initLoader(LOADER_ID,null,this).forceLoad();
}
private void printLog(String initLoader) {
Log.i(TAG,initLoader+"");
}
private void initViews() {
empAdapter=new EmpAdapter(this,new ArrayList<Employee>());
empListView=findViewById(R.id.lv_emp);
empListView.setAdapter(empAdapter);
}
@Override
public Loader onCreateLoader(int id, Bundle args) {
loaderRunning=true;
printLog("OnCreateLoader");
return new EmployeeLoader(this);
}
@Override
public void onLoadFinished(Loader<List<Employee>> loader, List<Employee> data) {
empAdapter.setEmployees((ArrayList<Employee>) data);
loaderRunning=false;
printLog("OnLoadFinished");
}
@Override
public void onLoaderReset(Loader loader) {
empAdapter.setEmployees(new ArrayList<Employee>());
printLog("onLoaderReset");
}
@Override
protected void onSaveInstanceState(Bundle outState) {
if(loaderRunning) {
Loader loader = getSupportLoaderManager().getLoader(LOADER_ID);
}
super.onSaveInstanceState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
}
}
| [
"devmanjun@gmail.com"
] | devmanjun@gmail.com |
45d20f0512051290d756ba50467e139e98f00a63 | dbc0aeed3ac687e898ab9b2299ec48b5102930d8 | /domain/src/main/java/com/nhsbsa/security/AppToken.java | 511f221beefeaa8199b6d52b3ff3e5550ddf3759 | [
"MIT"
] | permissive | Muddy91/nhs-finance | 5560309718133f0b87d809a8c3d22eea0f326676 | 2558ac39ab0d0cb7f0ba9380b9b9d23ebe7c8332 | refs/heads/master | 2020-08-04T23:55:36.386894 | 2017-02-09T14:34:21 | 2017-02-09T14:34:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 268 | java | package com.nhsbsa.security;
import lombok.*;
/**
* Created by jeffreya on 27/09/2016.
* AppToken
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ToString(of = {"id", "token"})
public class AppToken {
private String id;
private String token;
}
| [
"andrew-jeffrey@live.co.uk"
] | andrew-jeffrey@live.co.uk |
321dfb5761a4c9bb3cd7afeee8cb03d9834a1be4 | 0ec9b09bca5e448ded9866a5fe30c7a63b82b8b3 | /modelViewPresenter/presentationModel/withoutPrototype/src/main/java/usantatecla/mastermind/MastermindStandaloneDB.java | ee35c7161f93b2d1e087544c82da95231b2df0d9 | [] | no_license | pixelia-es/USantaTecla-project-mastermind-java.swing.socket.sql | 04de19c29176c4b830dbae751dc4746d2de86f2e | 2b5f9bf273c67eedff96189b6b3c5680c8b10958 | refs/heads/master | 2023-06-10T13:09:55.875570 | 2021-06-29T15:16:23 | 2021-06-29T15:16:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 428 | java | package usantatecla.mastermind;
import usantatecla.mastermind.models.DAO.SessionImplementationDAO;
import usantatecla.mastermind.models.dataBase.SessionImplementationDBDAO;
public class MastermindStandaloneDB extends MastermindStandalone{
protected SessionImplementationDAO createDAO() {
return new SessionImplementationDBDAO();
}
public static void main(String[] args) {
new MastermindStandaloneDB().play();
}
}
| [
"jaime.perez@alumnos.upm.es"
] | jaime.perez@alumnos.upm.es |
80d431c8d4daceeae99707dd2b468b9c05ec357e | 9bdc5e2452c18abf969b1c7bd388b5f68549c38a | /cloud-config-server/src/main/java/com/yy/ConfigServerApplication.java | 97a4c1e8fdb460d82edc59b2759fec14e6e46c4e | [] | no_license | 1993Yy/cloud | 7dd3a6a4955de6a9310c601ab997e84a18748a10 | 83bbcd8203a36700a3c05d55b6dcb472c22f5d7e | refs/heads/master | 2022-07-07T02:38:47.853174 | 2019-12-06T09:31:11 | 2019-12-06T09:31:11 | 225,821,891 | 0 | 0 | null | 2022-06-17T02:45:51 | 2019-12-04T08:54:45 | Java | UTF-8 | Java | false | false | 410 | java | package com.yy;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;
@SpringBootApplication
@EnableConfigServer
public class ConfigServerApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigServerApplication.class, args);
}
}
| [
"940357154@qq.com"
] | 940357154@qq.com |
caf712e3a88c59164ac66a843c1b02dd0b258772 | b69bb77d8ac87732bf9bb0989e58964962a9a980 | /src/main/java/com/zlt/service/FinanceService.java | 798bdcb884358037eb48fd09d08fba0b7d34f949 | [] | no_license | hylxj/- | 569506076d592d3ae9c0f3e5f9e3b57f4ece68d2 | d34395ab8bb87d49ee5782a795ca16d3f51dd895 | refs/heads/master | 2022-12-24T17:24:40.503433 | 2020-06-07T06:42:43 | 2020-06-07T06:42:43 | 245,827,787 | 0 | 0 | null | 2022-12-15T23:47:04 | 2020-03-08T14:18:48 | Java | UTF-8 | Java | false | false | 2,035 | java | package com.zlt.service;
import com.zlt.pojo.Expense;
import com.zlt.pojo.FundOut;
import com.zlt.pojo.Income;
import java.util.List;
import java.util.Map;
public interface FinanceService {
/**
* 查询收入表信息
* @return
*/
List<Income> selectIncome();
/**
* 查询支出表信息
* @return
*/
List<Expense> selectExpense();
/**
* 插入数据到支出表
*/
void expenseAdd(Expense expense);
/**
* 插入数据到收入表
* @param income
*/
void incomeAdd(Income income);
/**
* 查找收入表单条数据
* @param id
*/
Income selectOneIncome(Integer id);
/**
* 更新收入表数据
*/
void incomeUpdate(Income income);
/**
* 删除收入表数据
* @param id
*/
void incomeDel(Integer id);
/**
* 收入表查询
* @param busPlate
* @return
*/
List<Income> incomeSel(String busPlate);
/**
* 收入表批量删除
* @param ids
*/
void incomeDels(Long[] ids);
/**
* 支出表查询
* @param expenseId
* @return
*/
Expense expenseSel(Integer expenseId);
/**
* 支出表批量删除
* @param ids
*/
void expenseDels(Long[] ids);
/**
* 查找支出表 单条数据
* @param id
*/
Expense selectOneExpense(Integer id);
/**
* 将支出表数据更新
*/
void expenseUpdate(Expense expense);
/**
* 删除支出表数据
*/
void expenseDel(Integer id);
/**
* @Description: 增加支出记录
* @Param: [fundOut]
* @Return: void
**/
void insertOutFund(FundOut fundOut);
/**
* @Description: 查询收入的详情信息
* @Param: [fundId]
* @Return: java.util.Map<java.lang.String,java.lang.String>
**/
Map<String, Object> fundDetail(String fundId);
}
| [
"1156551992@qq.com"
] | 1156551992@qq.com |
e6a667b38b68a753389ebe339561264e167d5cc6 | 5eee173b40df296242ef57145ee747347b47147c | /BackEndVideo/MiniVideo-common/src/main/java/com/llingwei/utils/RedisOperator.java | 12627517d0487b1a1570112fbc8c8c35f6eed91e | [] | no_license | Luolingwei/Video-Share-Platform | b4bead8f67f00b643904c37149595df20b2798db | 0d458878ea435f2395ecb3b5da615d9f90e19b3c | refs/heads/master | 2022-12-29T06:16:46.952065 | 2020-09-10T00:33:49 | 2020-09-10T00:33:49 | 251,198,476 | 1 | 0 | null | 2022-12-16T11:55:17 | 2020-03-30T04:09:39 | Java | UTF-8 | Java | false | false | 4,420 | java | package com.llingwei.utils;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
/**
* @Description: 使用redisTemplate的操作实现类
*/
@Component
public class RedisOperator {
// @Autowired
// private RedisTemplate<String, Object> redisTemplate;
@Autowired
private StringRedisTemplate redisTemplate;
// Key(键),简单的key-value操作
/**
* 实现命令:TTL key,以秒为单位,返回给定 key的剩余生存时间(TTL, time to live)。
*
* @param key
* @return
*/
public long ttl(String key) {
return redisTemplate.getExpire(key);
}
/**
* 实现命令:expire 设置过期时间,单位秒
*
* @param key
* @return
*/
public void expire(String key, long timeout) {
redisTemplate.expire(key, timeout, TimeUnit.SECONDS);
}
/**
* 实现命令:INCR key,增加key一次
*
* @param key
* @return
*/
public long incr(String key, long delta) {
return redisTemplate.opsForValue().increment(key, delta);
}
/**
* 实现命令:KEYS pattern,查找所有符合给定模式 pattern的 key
*/
public Set<String> keys(String pattern) {
return redisTemplate.keys(pattern);
}
/**
* 实现命令:DEL key,删除一个key
*
* @param key
*/
public void del(String key) {
redisTemplate.delete(key);
}
// String(字符串)
/**
* 实现命令:SET key value,设置一个key-value(将字符串值 value关联到 key)
*
* @param key
* @param value
*/
public void set(String key, String value) {
redisTemplate.opsForValue().set(key, value);
}
/**
* 实现命令:SET key value EX seconds,设置key-value和超时时间(秒)
*
* @param key
* @param value
* @param timeout
* (以秒为单位)
*/
public void set(String key, String value, long timeout) {
redisTemplate.opsForValue().set(key, value, timeout, TimeUnit.SECONDS);
}
/**
* 实现命令:GET key,返回 key所关联的字符串值。
*
* @param key
* @return value
*/
public String get(String key) {
return (String)redisTemplate.opsForValue().get(key);
}
// Hash(哈希表)
/**
* 实现命令:HSET key field value,将哈希表 key中的域 field的值设为 value
*
* @param key
* @param field
* @param value
*/
public void hset(String key, String field, Object value) {
redisTemplate.opsForHash().put(key, field, value);
}
/**
* 实现命令:HGET key field,返回哈希表 key中给定域 field的值
*
* @param key
* @param field
* @return
*/
public String hget(String key, String field) {
return (String) redisTemplate.opsForHash().get(key, field);
}
/**
* 实现命令:HDEL key field [field ...],删除哈希表 key 中的一个或多个指定域,不存在的域将被忽略。
*
* @param key
* @param fields
*/
public void hdel(String key, Object... fields) {
redisTemplate.opsForHash().delete(key, fields);
}
/**
* 实现命令:HGETALL key,返回哈希表 key中,所有的域和值。
*
* @param key
* @return
*/
public Map<Object, Object> hgetall(String key) {
return redisTemplate.opsForHash().entries(key);
}
// List(列表)
/**
* 实现命令:LPUSH key value,将一个值 value插入到列表 key的表头
*
* @param key
* @param value
* @return 执行 LPUSH命令后,列表的长度。
*/
public long lpush(String key, String value) {
return redisTemplate.opsForList().leftPush(key, value);
}
/**
* 实现命令:LPOP key,移除并返回列表 key的头元素。
*
* @param key
* @return 列表key的头元素。
*/
public String lpop(String key) {
return (String)redisTemplate.opsForList().leftPop(key);
}
/**
* 实现命令:RPUSH key value,将一个值 value插入到列表 key的表尾(最右边)。
*
* @param key
* @param value
* @return 执行 LPUSH命令后,列表的长度。
*/
public long rpush(String key, String value) {
return redisTemplate.opsForList().rightPush(key, value);
}
} | [
"564258080@qq.com"
] | 564258080@qq.com |
262cc7b3c9026a49ab83d49596517a2fca4dbad0 | 8c1eec6c8551a9e1977541636e4574dda6f858f2 | /TheProject/src/kyPkg/uFile/FileUtil_Test.java | 595b9fe3bce3dd4c346618442c98c82ac0b3b4e6 | [] | no_license | TinkerLabo/TextFactory | 2cc640a2e5e2e7e7c5a97c7b715ef741f5c802b9 | ba546c0a86682658d452eb746bdc880a1a37ecdb | refs/heads/master | 2020-03-22T21:15:41.064197 | 2018-07-12T06:48:53 | 2018-07-12T06:48:53 | 140,671,984 | 0 | 0 | null | null | null | null | SHIFT_JIS | Java | false | false | 5,020 | java | package kyPkg.uFile;
import static kyPkg.uFile.FileUtil.getDefaultDelimiter;
import static org.junit.Assert.*;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
public class FileUtil_Test {
// @Test
// public void testoFileChk(){
// assertEquals("通常ファイルではありません:.", kyPkg.uFile.FileUtil_.oFileChk("."));
// }
@Test
public void testGetFirstName() {
String userDir = globals.ResControl.getQPRHome();
assertEquals("current.atm",
FileUtil.getFirstName2(userDir + "current.atm.zip"));
assertEquals("current",
FileUtil.getFirstName2(userDir + "current.atm"));
assertEquals("current", FileUtil.getFirstName2("./current.atm"));
}
@Test
public void testgetOtherExt() {
assertEquals("c:/suzy/cream/cheeze/zappa.xls",
FileUtil.changeExt("c:/suzy/cream/cheeze/zappa.txt", "xls"));
}
public void testNormarizeIt() {
assertEquals("c:/suzy/cream/cheeze/zappa.txt",
FileUtil.normarizeIt("c:/suzy/cream/cheeze/zappa.txt"));
}
@Test
public void testGetAbsolutePath() {
assertEquals("T:\\workspace\\QPRweb\\.",
FileUtil.getAbsolutePath("./"));
}
@Test
public void testGetPreExt() {
String rootDir = globals.ResControl.getQprRootDir();
String userDir = globals.ResControl.getQPRHome();
assertEquals(rootDir + "test/zapp",
FileUtil.getPreExt(rootDir + "test/zapp.txt"));
assertEquals(rootDir + "test",
FileUtil.getPreExt(rootDir + "test.txt"));
assertEquals(userDir + "current",
FileUtil.getPreExt(userDir + "current.atm"));
assertEquals(userDir + "current",
FileUtil.getPreExt(userDir + "current"));
}
@Test
public void testGetExt() {
String rootDir = globals.ResControl.getQprRootDir();
String userDir = globals.ResControl.getQPRHome();
assertEquals("EXT", FileUtil.getExt(rootDir + "test.txt.ext"));
assertEquals("TXT", FileUtil.getExt(rootDir + "test.txt"));
assertEquals("ATM", FileUtil.getExt(userDir + "current.atm"));
assertEquals("", FileUtil.getExt(userDir + "current"));
}
@Test
public void testGetDelimByExt() {
assertEquals(",", getDefaultDelimiter("TXT"));
assertEquals(",", getDefaultDelimiter("CSV"));
assertEquals("\t", getDefaultDelimiter("PRN"));
assertEquals("\t", getDefaultDelimiter("TSV"));
}
@Test
public void testGetParent() {
String userDir = globals.ResControl.getQPRHome();
assertEquals(userDir,
FileUtil.getParent2(userDir + "current.atm.zip", true));
}
// 拡張子を除いたファイル名(親パスは含まない)
public static void testGetFirstNamexxx() {
System.out.println("## tester of getFirstName ##");
List<String> list = new ArrayList<String>();
list.add("./current.atm");
String userDir = globals.ResControl.getQPRHome();
list.add(userDir + "current.atm.zip");
list.add(userDir + "current.atm");
for (String path : list) {
System.out.println(path + " => " + FileUtil.getFirstName2(path));
}
}
// 拡張子を書き換える
public static void testCnvExt() {
System.out.println("## tester of CnvExt ##");
List<String> list = new ArrayList<String>();
list.add("./current.atm");
String userDir = globals.ResControl.getQPRHome();
list.add(userDir + "current.atm.zip");
list.add(userDir + "current.atm");
for (String path : list) {
System.out.println(path + " => " + FileUtil.cnvExt(path, "dif"));
}
}
// 親パスを書き換える
public static void testCnvParent() {
String userDir = globals.ResControl.getQPRHome();
System.out.println("## tester of cnvParent ##");
List<String> list = new ArrayList<String>();
list.add("./current.atm");
list.add(userDir + "current.atm.zip");
list.add(userDir + "current.atm");
for (String path : list) {
System.out.println(
path + " => " + FileUtil.cnvParent("z:/test.txt", path));
}
}
public static void readHeaderTest() {
String path = "C:/testDataBase/QPR.Db";
boolean flag = FileUtil.readHeader(path, "SQLite ");
System.out.println("readHeader test=>" + flag);
}
public static void testPath() {
// 以下の結果が返る(相対パス表記を使った場合にAbsolute Pathが冗長)
// getPath:..\link.lnk
// getName:link.lnk
// Absolute Path:T:\workspace\QPRweb\..\link.lnk
// CanonicalPath:T:\workspace\link.lnk
try {
String path = "../link.lnk";
// path =
// "c:/@qpr/828111000509/購入水準【購入年月】2013年02月01日〜2013年02月28日0405_171955.xls";
File file = new File(path);
System.out.println("getPath:" + file.getPath());
System.out.println("getName:" + file.getName());
System.out.println("Absolute Path:" + file.getAbsolutePath());
System.out.println("CanonicalPath:" + file.getCanonicalPath());
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] argv) {
testPath();
}
}
| [
"simujya@yahoo.co.jp"
] | simujya@yahoo.co.jp |
a0ea4527486888c73edb61655eaf761ecea62419 | 67dd1c142fd1f7299185d1ac70d6eb870c0ecde9 | /src/main/java/one/innovation/digital/andrelugomes/interfaces/Programa.java | a830f7a3f4f7f1f24db00ba2b0cd53a169a89edb | [] | no_license | vitormanoelcsantos/Bootcamp-Inter-Java-Developer | 88a2c3ec23a7f4835b179a39aa9639192aea314c | f12393a0004a446c4d9776e008db41b345c4dc6b | refs/heads/master | 2023-03-20T05:46:58.745737 | 2021-03-14T16:00:53 | 2021-03-14T16:00:53 | 342,277,276 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,046 | java | package one.innovation.digital.andrelugomes.interfaces;
public class Programa {
public static void main(String[] args) {
// Como dito anteriormente, a classe se torna aquela interface que ela implementou ou seja,
// um Objeto gol, também é do tipo carro.
// final Gol gol = new Gol();
final Carro gol = new Gol();
System.out.println("Marca do Gol : "+gol.marca());
gol.ligar();
gol.autom(); // Método herdado de um interface que herda outra interface
final Veiculo trator = new Trator();
System.out.println("Registro do Trator :"+trator.registro());
trator.ligar();
final Fiesta fiesta = new Fiesta();
System.out.println("Marca do Fiesta : "+fiesta.marca());
System.out.println("Registro do Fiesta : "+fiesta.registro());
fiesta.ligar();
System.out.println(fiesta.autot()); // Método herdado de um interface que herda outra interface
//Carro.super.ligar(); //só pode ser acessado por quem implementa
}
}
| [
"vitormanoelcsantos@outlook.com"
] | vitormanoelcsantos@outlook.com |
6dd914d726391cfba4ac944a43e7b126c2e76430 | 1ae60085fd221d5389f23d36fb04494accbf4e14 | /models/build/tmp/kapt3/stubs/main/com/vimeo/networking2/PlayUtils.java | 7dd96eb2c6ee70a8b1a072e685c606d30ee53d46 | [] | no_license | dadhaniyapratik/MVP_Room_Architicture | 268eee023d1fff408f62c8807c8b4c1a8b012c2e | 832839321cb57a358e15892f3c81fa06f1e5f51e | refs/heads/master | 2020-06-27T14:51:17.706384 | 2019-08-01T05:04:43 | 2019-08-01T05:04:43 | 199,980,300 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 840 | java | package com.vimeo.networking2;
import java.lang.System;
@kotlin.Metadata(mv = {1, 1, 13}, bv = {1, 0, 3}, k = 2, d1 = {"\u0000\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\"\u0015\u0010\u0000\u001a\u00020\u0001*\u00020\u00028F\u00a2\u0006\u0006\u001a\u0004\b\u0003\u0010\u0004\u00a8\u0006\u0005"}, d2 = {"videoPlayStatusType", "Lcom/vimeo/networking2/enums/VideoPlayStatusType;", "Lcom/vimeo/networking2/Play;", "getVideoPlayStatusType", "(Lcom/vimeo/networking2/Play;)Lcom/vimeo/networking2/enums/VideoPlayStatusType;", "models"})
public final class PlayUtils {
@org.jetbrains.annotations.NotNull()
public static final com.vimeo.networking2.enums.VideoPlayStatusType getVideoPlayStatusType(@org.jetbrains.annotations.NotNull()
com.vimeo.networking2.Play $receiver) {
return null;
}
} | [
"pkdadhaniya@cygnet.com"
] | pkdadhaniya@cygnet.com |
81c11854c52190627c3ef6fa702dba9f739123a7 | 3ea71877c83ccdd99bd0f79bd25b6b635cb61cac | /MVCProj9-MiniProject-CURDOperation-StudentRegistration/src/main/java/com/manash/service/StudentRegisterServiceImpl.java | a17ca5c9d4de00617db0dc184d9bf73f9635cc0b | [] | no_license | manash6173/SpringMVC-SFC | d4b12b85153eaa9a8418d5dea09ed6ead1d9ca09 | 6c3831ee17d9d1eea38425c0789d3b7d42d5c16c | refs/heads/master | 2022-12-12T14:03:43.680037 | 2019-05-11T04:32:51 | 2019-05-11T04:32:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,089 | java | package com.manash.service;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.BeanUtils;
import com.manash.bo.StudentBO;
import com.manash.dao.StudentRegisterDAO;
import com.manash.dto.StudentDTO;
public class StudentRegisterServiceImpl implements StudentRegisterService {
private StudentRegisterDAO dao;
public StudentRegisterServiceImpl(StudentRegisterDAO dao) {
this.dao = dao;
}
@Override
public List<StudentDTO> getAllStudent() {
//use DAO
List<StudentBO> listBO=null;
List<StudentDTO> listDTO=new ArrayList<StudentDTO>();
listBO=dao.fetchRegisterStudent();
//copy data from listBo to listDto
listBO.forEach(bo1->{
StudentDTO dto1=new StudentDTO();
BeanUtils.copyProperties(bo1, dto1);
dto1.setSrlNo(listDTO.size()+1);
listDTO.add(dto1);
});
return listDTO;
}
@Override
public StudentDTO getStudByRegNO(int regNo) {
StudentDTO dto=new StudentDTO();
StudentBO bo=null;
//use dao
bo=dao.fetchStudentByRegNo(regNo);
//copy data from bo to dto
BeanUtils.copyProperties(bo, dto);
//return dto
return dto;
}
@Override
public String modifyStudentByRegNo(StudentDTO dto) {
String msg=null;
//copy data from dto to bo
StudentBO bo=new StudentBO();
BeanUtils.copyProperties(dto, bo);
int count=dao.updateStudentById(bo);
msg= (count==0)? "regNo not found and updation failed":"regNo found and Record Updated";
return msg;
}
@Override
public String deleteStudentByRegNo(int regNo) {
//use dao
int count =dao.deleteStudentById(regNo);
return count==0?"RegNo Not found record Not Deleted":"RegNo Found And Record Successfuly deleted" ;
}
@Override
public String registerStudent(StudentDTO dto) {
String msg=null;
StudentBO bo=new StudentBO();
//convert dto to bo object
BeanUtils.copyProperties(dto, bo);
//use dao
int result=dao.addStudent(bo);
if(result==0)
msg="Student Registration failed";
else
msg="Student Registration Successful";
return msg;
}
}
| [
"ManashMVC@gmail.com"
] | ManashMVC@gmail.com |
348ff8d6376a87c3b5b6f209d1c52167971f4ac6 | 83110fbb179713c411ddf301c90ef4b814285846 | /src/HostService.java | a33f58e130a6a591f74181dc6700772990d38761 | [] | no_license | mikelopez/jvm | f10590edf42b498f2d81dec71b0fee120e381c9a | 36a960897062224eabd0c18a1434f7c8961ee81c | refs/heads/master | 2021-01-19T05:36:54.710665 | 2013-06-09T04:36:41 | 2013-06-09T04:36:41 | 3,783,647 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,909 | java |
package com.vmware.vim25;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for HostService complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="HostService">
* <complexContent>
* <extension base="{urn:vim25}DynamicData">
* <sequence>
* <element name="key" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="label" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="required" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
* <element name="uninstallable" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
* <element name="running" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
* <element name="ruleset" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
* <element name="policy" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="sourcePackage" type="{urn:vim25}HostServiceSourcePackage" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "HostService", propOrder = {
"key",
"label",
"required",
"uninstallable",
"running",
"ruleset",
"policy",
"sourcePackage"
})
public class HostService
extends DynamicData
{
@XmlElement(required = true)
protected String key;
@XmlElement(required = true)
protected String label;
protected boolean required;
protected boolean uninstallable;
protected boolean running;
protected List<String> ruleset;
@XmlElement(required = true)
protected String policy;
protected HostServiceSourcePackage sourcePackage;
/**
* Gets the value of the key property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getKey() {
return key;
}
/**
* Sets the value of the key property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setKey(String value) {
this.key = value;
}
/**
* Gets the value of the label property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLabel() {
return label;
}
/**
* Sets the value of the label property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLabel(String value) {
this.label = value;
}
/**
* Gets the value of the required property.
*
*/
public boolean isRequired() {
return required;
}
/**
* Sets the value of the required property.
*
*/
public void setRequired(boolean value) {
this.required = value;
}
/**
* Gets the value of the uninstallable property.
*
*/
public boolean isUninstallable() {
return uninstallable;
}
/**
* Sets the value of the uninstallable property.
*
*/
public void setUninstallable(boolean value) {
this.uninstallable = value;
}
/**
* Gets the value of the running property.
*
*/
public boolean isRunning() {
return running;
}
/**
* Sets the value of the running property.
*
*/
public void setRunning(boolean value) {
this.running = value;
}
/**
* Gets the value of the ruleset property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the ruleset property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getRuleset().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link String }
*
*
*/
public List<String> getRuleset() {
if (ruleset == null) {
ruleset = new ArrayList<String>();
}
return this.ruleset;
}
/**
* Gets the value of the policy property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPolicy() {
return policy;
}
/**
* Sets the value of the policy property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPolicy(String value) {
this.policy = value;
}
/**
* Gets the value of the sourcePackage property.
*
* @return
* possible object is
* {@link HostServiceSourcePackage }
*
*/
public HostServiceSourcePackage getSourcePackage() {
return sourcePackage;
}
/**
* Sets the value of the sourcePackage property.
*
* @param value
* allowed object is
* {@link HostServiceSourcePackage }
*
*/
public void setSourcePackage(HostServiceSourcePackage value) {
this.sourcePackage = value;
}
}
| [
"dev@scidentify.info"
] | dev@scidentify.info |
0d6815f22501b231787aec8777625be274179d02 | 6196bd646a4cbc398bb21d5b16b9973f3b3b1ec8 | /extra/camino/fitters/ZeppelinGDRCylindersMultiRunLM_Fitter.java | 31934a92f49882aa8fe4044cc27c828ff69c19b0 | [
"Artistic-2.0"
] | permissive | justinblaber/dtiQA_app | a684764fd1fd12116e7e1e5d7fba12f337af73aa | ea1577c641564acd9b446dccd1048d2e4b9f58e7 | refs/heads/master | 2021-04-06T09:59:04.402762 | 2018-03-14T01:39:36 | 2018-03-14T01:39:36 | 124,810,970 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,947 | java | package fitters;
import models.*;
import models.compartments.CompartmentModel;
import models.compartments.CompartmentType;
import optimizers.*;
import inverters.*;
import numerics.*;
import misc.*;
import data.*;
import tools.*;
import imaging.*;
/**
* <dl>
*
* <dt>Purpose:
*
* <dd>Fits the ZeppelinGDRCylinders model using multiple runs of a Levenburg
* Marquardt.
*
* <dt>Description:
*
* <dd> Fitting is as in ZeppelinGDRCylindersLM_Fitter. The
* perturbations are 10% of the initial starting value.
*
* </dl>
*
* @author Laura
* @version $Id$
*
*/
public class ZeppelinGDRCylindersMultiRunLM_Fitter extends
ZeppelinGDRCylindersLM_Fitter {
/**
* Constructor implements the mapping between model and optimized
* parameters in the Codec object.
*
* @param scheme The imaging protocol.
*/
public ZeppelinGDRCylindersMultiRunLM_Fitter(DW_Scheme scheme,
int repeats, int seed) {
//super(scheme);
this.scheme = scheme;
makeCodec();
String[] compNames = new String[2];
compNames[0] = new String("gammadistribradiicylinders");
compNames[1] = new String("zeppelin");
double[] initialParams = new double[12];
initialParams[0] = 1.0; // the S0
initialParams[1] = 0.7; // volume fraction of the first compartment
initialParams[2] = 0.3; // volume fraction of the second compartment
initialParams[3] = 1 ;//k
initialParams[4] = 1 ;//beta
initialParams[5] = 1.7e-9;//diffusivity
initialParams[6] = 1.5;//theta
initialParams[7] = 1.5; //phi
initialParams[8] = 1.7e-9;//diffusivity
initialParams[9] = 1.5;//theta
initialParams[10] = 1.5; //phi
initialParams[11] = 1.7e-10;//diffperp
cm = new CompartmentModel(compNames, initialParams);
try {
initMultiRunLM_Minimizer(NoiseModel.getNoiseModel(CL_Initializer.noiseModel), new FixedSTD_GaussianPerturbation(), repeats, seed);
((MultiRunLM_Minimizer) minimizer).setCONVERGETHRESH(1e-8);
((MultiRunLM_Minimizer) minimizer).setMAXITER(5000);
} catch(Exception e) {
throw new LoggedException(e);
}
zcfitter = new ZeppelinCylinderMultiRunLM_Fitter(scheme, 3, 0);
}
public static void main(String[] args) {
CL_Initializer.CL_init(args);
CL_Initializer.checkParsing(args);
CL_Initializer.initImagingScheme();
CL_Initializer.initDataSynthesizer();
OutputManager om = new OutputManager();
ZeppelinGDRCylindersMultiRunLM_Fitter inv = new ZeppelinGDRCylindersMultiRunLM_Fitter(
CL_Initializer.imPars, 100, 0);
// Loop over the voxels.
while (CL_Initializer.data.more()) {
try {
double[] nextVoxel = CL_Initializer.data.nextVoxel();
double[][] fit = inv.fit(nextVoxel);
for (int i = 0; i < fit.length; i++)
om.output(fit[i]);
} catch (Exception e) {
System.err.println(e);
}
}
om.close();
}
}
| [
"justin.akira.blaber@gmail.com"
] | justin.akira.blaber@gmail.com |
7843e35f0eb6bdbf8a52c6f2cf94980764a4ff39 | 6baa09045c69b0231c35c22b06cdf69a8ce227d6 | /modules/adwords_axis/src/main/java/com/google/api/ads/adwords/axis/v201603/cm/CustomerExtensionSettingService.java | 39c797a31ba3086ff29dbadcb3353dbc8b83e464 | [
"Apache-2.0"
] | permissive | remotejob/googleads-java-lib | f603b47117522104f7df2a72d2c96ae8c1ea011d | a330df0799de8d8de0dcdddf4c317d6b0cd2fe10 | refs/heads/master | 2020-12-11T01:36:29.506854 | 2016-07-28T22:13:24 | 2016-07-28T22:13:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 783 | java | /**
* CustomerExtensionSettingService.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter.
*/
package com.google.api.ads.adwords.axis.v201603.cm;
public interface CustomerExtensionSettingService extends javax.xml.rpc.Service {
public java.lang.String getCustomerExtensionSettingServiceInterfacePortAddress();
public com.google.api.ads.adwords.axis.v201603.cm.CustomerExtensionSettingServiceInterface getCustomerExtensionSettingServiceInterfacePort() throws javax.xml.rpc.ServiceException;
public com.google.api.ads.adwords.axis.v201603.cm.CustomerExtensionSettingServiceInterface getCustomerExtensionSettingServiceInterfacePort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException;
}
| [
"jradcliff@users.noreply.github.com"
] | jradcliff@users.noreply.github.com |
6744178075c0faf1cd4cda19ade88ab35dadcf76 | f26a86b07a5ff823f7f2b6f7234e29e86a07104c | /src/coagent/gui.java | 4933f8a1bae4a09ec1e766f5107d0b8c9bc43af7 | [] | no_license | MichelKu/coagent_school_project | 9e147ec1bbb01847ba70a28b40f8316271c09777 | c40cc5dbceab50ca3d95c8bfd8d161dd2bcc8d59 | refs/heads/main | 2023-04-23T20:45:58.694544 | 2021-05-19T10:02:18 | 2021-05-19T10:02:18 | 368,823,473 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,370 | 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 coagent;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author lenovo
*/
public class gui extends javax.swing.JFrame {
/**
* Creates new form gui
*/
CardLayout cardLayout;
public gui() throws Exception {
initComponents();
EditorPanel editorPanel = new EditorPanel();
editorPanel.setVisible(true);
card5.add(editorPanel, BorderLayout.CENTER);
ClientsJPanel clientPanel = new ClientsJPanel();
clientPanel.setVisible(true);
card6.add(clientPanel, BorderLayout.CENTER);
BooksPanel booksPanel = new BooksPanel();
booksPanel.setVisible(true);
card1.add(booksPanel, BorderLayout.CENTER);
SubmissionsPanel submission = new SubmissionsPanel();
submission.setVisible(true);
card2.add(submission, BorderLayout.CENTER);
PublishersPanel publishersPanel = new PublishersPanel();
publishersPanel.setVisible(true);
card4.add(publishersPanel, BorderLayout.CENTER);
ContractPanel contract = new ContractPanel();
contract.setVisible(true);
card3.add(contract, BorderLayout.CENTER);
cardLayout = (CardLayout)(jPanel2Cards.getLayout());
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jEditorPane1 = new javax.swing.JEditorPane();
jSplitPane1 = new javax.swing.JSplitPane();
jPanel1 = new javax.swing.JPanel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jButton6 = new javax.swing.JButton();
jPanel2Cards = new javax.swing.JPanel();
card1 = new javax.swing.JPanel();
card2 = new javax.swing.JPanel();
card3 = new javax.swing.JPanel();
card4 = new javax.swing.JPanel();
card5 = new javax.swing.JPanel();
card6 = new javax.swing.JPanel();
jScrollPane1.setViewportView(jEditorPane1);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setPreferredSize(new java.awt.Dimension(1050, 900));
jSplitPane1.setPreferredSize(new java.awt.Dimension(151, 900));
jPanel1.setBackground(new java.awt.Color(137, 176, 174));
jPanel1.setMinimumSize(new java.awt.Dimension(150, 900));
jPanel1.setPreferredSize(new java.awt.Dimension(150, 900));
jButton1.setBackground(new java.awt.Color(137, 176, 174));
jButton1.setFont(new java.awt.Font("Verdana", 0, 13)); // NOI18N
jButton1.setForeground(new java.awt.Color(76, 80, 82));
jButton1.setText("Books");
jButton1.setBorderPainted(false);
jButton1.setMaximumSize(new java.awt.Dimension(96, 22));
jButton1.setMinimumSize(new java.awt.Dimension(96, 22));
jButton1.setPreferredSize(new java.awt.Dimension(96, 22));
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setBackground(new java.awt.Color(137, 176, 174));
jButton2.setFont(new java.awt.Font("Verdana", 0, 13)); // NOI18N
jButton2.setForeground(new java.awt.Color(76, 80, 82));
jButton2.setText("Submissions");
jButton2.setToolTipText("");
jButton2.setBorderPainted(false);
jButton2.setMargin(new java.awt.Insets(0, 0, 0, 0));
jButton2.setMaximumSize(new java.awt.Dimension(96, 22));
jButton2.setMinimumSize(new java.awt.Dimension(96, 22));
jButton2.setPreferredSize(new java.awt.Dimension(96, 22));
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setBackground(new java.awt.Color(137, 176, 174));
jButton3.setFont(new java.awt.Font("Verdana", 0, 13)); // NOI18N
jButton3.setForeground(new java.awt.Color(76, 80, 82));
jButton3.setText("Contracts");
jButton3.setBorderPainted(false);
jButton3.setMargin(new java.awt.Insets(0, 0, 0, 0));
jButton3.setMaximumSize(new java.awt.Dimension(96, 22));
jButton3.setMinimumSize(new java.awt.Dimension(96, 22));
jButton3.setPreferredSize(new java.awt.Dimension(96, 22));
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setBackground(new java.awt.Color(137, 176, 174));
jButton4.setFont(new java.awt.Font("Verdana", 0, 13)); // NOI18N
jButton4.setForeground(new java.awt.Color(76, 80, 82));
jButton4.setText("Publishers");
jButton4.setBorderPainted(false);
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jButton5.setBackground(new java.awt.Color(137, 176, 174));
jButton5.setFont(new java.awt.Font("Verdana", 0, 13)); // NOI18N
jButton5.setForeground(new java.awt.Color(76, 80, 82));
jButton5.setText("Editors");
jButton5.setBorderPainted(false);
jButton5.setMaximumSize(new java.awt.Dimension(96, 22));
jButton5.setMinimumSize(new java.awt.Dimension(96, 22));
jButton5.setPreferredSize(new java.awt.Dimension(96, 22));
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jButton6.setBackground(new java.awt.Color(137, 176, 174));
jButton6.setFont(new java.awt.Font("Verdana", 0, 13)); // NOI18N
jButton6.setForeground(new java.awt.Color(76, 80, 82));
jButton6.setText("Clients");
jButton6.setBorderPainted(false);
jButton6.setMaximumSize(new java.awt.Dimension(96, 22));
jButton6.setMinimumSize(new java.awt.Dimension(96, 22));
jButton6.setPreferredSize(new java.awt.Dimension(96, 22));
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jButton1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)
.addComponent(jButton5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(26, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(84, 84, 84)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(647, Short.MAX_VALUE))
);
jSplitPane1.setLeftComponent(jPanel1);
jPanel2Cards.setBackground(new java.awt.Color(250, 249, 249));
jPanel2Cards.setLayout(new java.awt.CardLayout());
card1.setBackground(new java.awt.Color(250, 249, 249));
card1.setLayout(new java.awt.BorderLayout());
jPanel2Cards.add(card1, "card1");
card2.setBackground(new java.awt.Color(250, 249, 249));
card2.setLayout(new java.awt.BorderLayout());
jPanel2Cards.add(card2, "card2");
card3.setBackground(new java.awt.Color(250, 249, 249));
card3.setLayout(new java.awt.BorderLayout());
jPanel2Cards.add(card3, "card3");
card4.setBackground(new java.awt.Color(250, 249, 249));
card4.setLayout(new java.awt.BorderLayout());
jPanel2Cards.add(card4, "card4");
card5.setBackground(new java.awt.Color(250, 249, 249));
card5.setLayout(new java.awt.BorderLayout());
jPanel2Cards.add(card5, "card5");
card6.setBackground(new java.awt.Color(250, 249, 249));
card6.setLayout(new java.awt.BorderLayout());
jPanel2Cards.add(card6, "card6");
jSplitPane1.setRightComponent(jPanel2Cards);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
//cardLayout.show(jPanel2Cards, "card1");
cardLayout.show(jPanel2Cards, "card1");
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
cardLayout.show(jPanel2Cards, "card2");
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
cardLayout.show(jPanel2Cards, "card3");
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
cardLayout.show(jPanel2Cards, "card4");
}//GEN-LAST:event_jButton4ActionPerformed
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
cardLayout.show(jPanel2Cards, "card5");
}//GEN-LAST:event_jButton5ActionPerformed
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
cardLayout.show(jPanel2Cards, "card6");
}//GEN-LAST:event_jButton6ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
try {
new gui().setVisible(true);
} catch (Exception ex) {
Logger.getLogger(gui.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel card1;
private javax.swing.JPanel card2;
private javax.swing.JPanel card3;
private javax.swing.JPanel card4;
private javax.swing.JPanel card5;
private javax.swing.JPanel card6;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6;
private javax.swing.JEditorPane jEditorPane1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2Cards;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSplitPane jSplitPane1;
// End of variables declaration//GEN-END:variables
}
| [
"michelkugler95@gmail.com"
] | michelkugler95@gmail.com |
551bda22a027af902705ea7b29591577a9645f19 | 02ece4df74127b779db5348eb9b5d77338ece2c8 | /Formulario_Alta_Usuario.java | 8c0c80945056c290dac8b68ac32f0a372e3cb522 | [] | no_license | elbamer/Ejercicio-Java-Alta-usuarios-y-logarse- | 9b7aa6d4c9ad4500389b3bb804a85e86b37c6e3b | 9937bc30b6d8870b541b494d192e90afb25744cb | refs/heads/master | 2020-07-05T07:02:48.917967 | 2019-08-15T15:14:27 | 2019-08-15T15:14:27 | 202,564,089 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,459 | 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 ejerciciologin;
import javax.swing.JOptionPane;
import metodos_Sql.Metodos_Sql;
/**
*
* @author elbam
*/
public class Formulario_Alta_Usuario extends javax.swing.JFrame {
/**
* Creates new form Formulario_Alta_Usuario
*/
public Formulario_Alta_Usuario() {
initComponents();
setLocationRelativeTo(null);
}
// primero instanciamos la clase
Metodos_Sql meto = new Metodos_Sql();
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
txtNombre = new javax.swing.JTextField();
txtApellidos = new javax.swing.JTextField();
txtCorreo = new javax.swing.JTextField();
txtContrasena = new javax.swing.JPasswordField();
btnGuardar = new javax.swing.JButton();
btnRegresar = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setFont(new java.awt.Font("Arial Black", 2, 12)); // NOI18N
jLabel1.setText("NOMBRE");
jLabel2.setText("APELLIDO");
jLabel3.setText("CORREO");
jLabel4.setText("PASSWORD");
jLabel5.setText("ALTA USUARIO");
btnGuardar.setText("GUARDAR");
btnGuardar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnGuardarActionPerformed(evt);
}
});
btnRegresar.setText("REGRESAR");
btnRegresar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnRegresarActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(66, 66, 66)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5))
.addGap(64, 64, 64)
.addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(jLabel4))
.addGap(83, 83, 83)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtContrasena, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtCorreo, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtApellidos, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGroup(layout.createSequentialGroup()
.addGap(79, 79, 79)
.addComponent(btnGuardar)
.addGap(71, 71, 71)
.addComponent(btnRegresar)))
.addContainerGap(78, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(35, 35, 35)
.addComponent(jLabel5)
.addGap(18, 18, 18)
.addComponent(jLabel1))
.addGroup(layout.createSequentialGroup()
.addGap(82, 82, 82)
.addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtApellidos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addGap(27, 27, 27)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(txtCorreo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(25, 25, 25)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(txtContrasena, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 38, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnGuardar)
.addComponent(btnRegresar))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarActionPerformed
// cogemos los valores y luego hacemos una sentencion condicinal , para indicar si se ha conectado correctamente o no
int i=meto.guardar(txtNombre.getText(), txtApellidos.getText(), txtCorreo.getText(), txtContrasena.getText()) ; // Llamamos a metodo sql
if(i>0)// si i tiene parametros ya insertados
{JOptionPane.showMessageDialog(this,"DATOS GUARDADOS CORRECTAMENTO");
}else{
JOptionPane.showMessageDialog(this,"NO SE PUDIERON GUARDAR LOS DATOS");
}
}//GEN-LAST:event_btnGuardarActionPerformed
private void btnRegresarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRegresarActionPerformed
// instacioamos el formualrio menu
Formulario_Menu ventana= new Formulario_Menu();
ventana.setVisible(true);
this.dispose();
}//GEN-LAST:event_btnRegresarActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Formulario_Alta_Usuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Formulario_Alta_Usuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Formulario_Alta_Usuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Formulario_Alta_Usuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Formulario_Alta_Usuario().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnGuardar;
private javax.swing.JButton btnRegresar;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JTextField txtApellidos;
private javax.swing.JPasswordField txtContrasena;
private javax.swing.JTextField txtCorreo;
private javax.swing.JTextField txtNombre;
// End of variables declaration//GEN-END:variables
}
| [
"elbamer33@gmail.com"
] | elbamer33@gmail.com |
78cf7235224eae90d78ff0203ef561c0689dddee | a780697ef68b4aed3fff4cf644462636d8afe8ec | /app/src/main/java/com/example/android/declarationsapp/retrofit/ApiData.java | a5490a92e00e779b578b0df21ebabaf11294d826 | [] | no_license | LizaPolishchuk/DeclarationSearch | f5536f9f85246ee338b800e996cff2bf80a1a4e3 | f227bf3fd5e1c8a4a6d46f5f2b5119abf295ccb9 | refs/heads/master | 2020-04-01T14:56:59.839650 | 2018-10-21T18:09:44 | 2018-10-21T18:09:44 | 153,314,560 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 297 | java | package com.example.android.declarationsapp.retrofit;
import com.example.android.declarationsapp.data.Items;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Query;
public interface ApiData {
@GET("declaration/")
Call<Items> itemList(@Query("q") String query);
}
| [
"lizapolic@ukr.net"
] | lizapolic@ukr.net |
6081ffcb7dd937cba1ffbb6d4677e6fb3fffcd29 | 6c038bac76027ace0b236ff131cbcffebd274985 | /workspace/05_Jms/src/main/java/com/curso/microservicios/_Jms/Persona.java | 113d1c6bd90a181a920bcac0606d66c409c0cff8 | [] | no_license | victorherrerocazurro/MicroserviciosSpringATSistemasOctubre2017 | 2f1752055c4f58b3faa4ab4470a3e51032e97541 | 2512133b51d64a77a947aaad2e053f69d262d7ba | refs/heads/master | 2021-07-08T15:30:55.572658 | 2017-10-05T17:28:12 | 2017-10-05T17:28:12 | 105,535,171 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 654 | java | package com.curso.microservicios._Jms;
import java.io.Serializable;
public class Persona implements Serializable{
private long id;
private String nombre;
public Persona(long id, String nombre) {
super();
this.id = id;
this.nombre = nombre;
}
public Persona() {
super();
// TODO Auto-generated constructor stub
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
@Override
public String toString() {
return "Persona [id=" + id + ", nombre=" + nombre + "]";
}
}
| [
"victorherrerocazurro@gmail.com"
] | victorherrerocazurro@gmail.com |
4fb94201c6b0ad92113c0d58ed47a1a57d57ab20 | 968bb7ebec13384163c2c53ec1bb2588d3ded9ed | /src/main/java/com/shop/exceptions/UploadException.java | b5910dd92d0a08b0debd1c2383638e899501d7f6 | [] | no_license | LongRongZai/second_hand_shop | 0ee65f789ba023da5088eff19d1f6416eb83b9bc | 623a71da5be5c4d17e71fbfa893150041913a9d8 | refs/heads/main | 2023-04-20T14:09:19.839222 | 2021-05-08T13:47:44 | 2021-05-08T13:47:44 | 356,520,020 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 164 | java | package com.shop.exceptions;
public class UploadException extends RuntimeException {
public UploadException(String message) {
super(message);
}
}
| [
"924602944@qq.com"
] | 924602944@qq.com |
03baf8ae67c36f54378bd52d34ee3a385c610d2d | 6a2b95cdd1338186162004b93225eda376705c47 | /src/se/maxjonsson/days/december2/December2Test.java | bd6fba7bcc3026d65518efbd2931bf63823d3fc3 | [] | no_license | emomax/advent_of_code-2017 | 15d3aa520e07694ba5b6d09b05478083edd59ae3 | 4efd31a57785bdcce084a7a2761f36f38412f941 | refs/heads/master | 2021-08-29T04:36:45.357116 | 2017-12-13T12:01:59 | 2017-12-13T12:01:59 | 112,717,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 808 | java | package se.maxjonsson.days.december2;
import java.util.Arrays;
import org.junit.Test;
import sun.jvm.hotspot.utilities.Assert;
public class December2Test {
/**
* Tests derived from task.getDescription();
*/
@Test
public void taskATest() {
final December2_TaskA task = new December2_TaskA(Arrays.asList("5 1 9 5", "7 5 3", "2 4 6 8"));
task.run();
Assert.that(task.getResult() == 18, "Expected 18 - got " + task.getResult());
}
/**
* Tests derived from task.getDescription();
*/
@Test
public void taskBTest() {
final December2_TaskB task = new December2_TaskB(Arrays.asList("5 9 2 8", "9 4 7 3", "3 8 6 5"));
task.run();
Assert.that(task.getResult() == 9, "Expected 9 - got " + task.getResult());
}
} | [
"jag@maxjonsson.se"
] | jag@maxjonsson.se |
8e4c3bdb72b083c6ef8b0f0e1bd7e69ee7010794 | f8d54143f9c2afd29bb43dd846cabfb947c37ad3 | /app/src/main/java/levandowski/primao/criptocon/fragments/SixthFragment.java | b80c179bc9eed70b3c76ed069c224df646fc4c14 | [] | no_license | glevandowski/criptocon-vplaystore | b8aa688452fc4732c143fb85982db8df80636c70 | cfa5cc6b1d4afa6806ecd2cec273c1821762c78f | refs/heads/master | 2022-12-09T15:48:20.479633 | 2022-12-03T15:50:52 | 2022-12-03T15:50:52 | 129,497,258 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 658 | java | package levandowski.primao.criptocon.fragments;
import android.annotation.SuppressLint;
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import levandowski.primao.criptocon.R;
@SuppressLint("ValidFragment")
public class SixthFragment extends Fragment {
View myView;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
myView = inflater.inflate(R.layout.sixth_fragment, container, false);
return myView;
}
}
| [
"33090649+glevandowski@users.noreply.github.com"
] | 33090649+glevandowski@users.noreply.github.com |
f00d1d67ecb4d9e76002452acf6c9c06bc3c013b | f2197575e69f42af5ba2812d4bd0e563bbe6853f | /src/main/java/org/esupportail/esupsignature/config/security/cas/CasConfig.java | 6055efbd5885adf12937218b1f9bf3a99187ce62 | [
"Apache-2.0",
"CDDL-1.1",
"LGPL-2.1-only",
"BSD-3-Clause",
"CDDL-1.0",
"EPL-1.0",
"Classpath-exception-2.0",
"MIT",
"LGPL-2.0-or-later",
"GPL-2.0-only",
"W3C",
"GPL-1.0-or-later",
"SAX-PD",
"LicenseRef-scancode-public-domain",
"AGPL-3.0-only",
"MPL-1.1"
] | permissive | prigaux/esup-signature | 2d34e3e415ae603877933c921965563ca8a54398 | 32b27c36b61ad1dbe42482314ec25cb1d6d46c42 | refs/heads/master | 2023-08-12T18:17:35.310244 | 2021-10-08T16:01:45 | 2021-10-08T16:03:48 | 271,847,055 | 0 | 0 | Apache-2.0 | 2020-06-12T16:48:41 | 2020-06-12T16:48:40 | null | UTF-8 | Java | false | false | 1,375 | java | package org.esupportail.esupsignature.config.security.cas;
import org.esupportail.esupsignature.service.security.cas.CasSecurityServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.ldap.core.support.LdapContextSource;
@Configuration
@ConditionalOnProperty({"spring.ldap.base", "ldap.search-base", "security.cas.service"})
@EnableConfigurationProperties(CasProperties.class)
public class CasConfig {
private static final Logger logger = LoggerFactory.getLogger(CasConfig.class);
private LdapContextSource ldapContextSource;
@Autowired(required = false)
public void setLdapContextSource(LdapContextSource ldapContextSource) {
this.ldapContextSource = ldapContextSource;
}
@Bean
public CasSecurityServiceImpl CasSecurityServiceImpl() {
if(ldapContextSource!= null && ldapContextSource.getUserDn() != null) {
return new CasSecurityServiceImpl();
} else {
logger.error("cas config found without needed ldap config, cas security will be disabled");
return null;
}
}
}
| [
"david.lemaignent@univ-rouen.fr"
] | david.lemaignent@univ-rouen.fr |
3907aaa248e5945c4446f713f7ff3c9bf2b0991a | a2075d046250d6e8b27d69f1030142f0efdf3e2e | /hrms-backend/src/main/java/com/finalproject/hrmsbackend/entities/concretes/CandidateSkill.java | 32ce1e214e5df6b8e17206fe8e4e181b3ff25a99 | [] | no_license | CosmicDust19/kodlama.io-javareactcamp | c42921845f3a1da52198ca6c59d0747af0bae50f | 886bbae133dcf9739d8dda0471a20cfb9cb4952b | refs/heads/master | 2023-08-18T02:22:23.016255 | 2021-10-04T11:40:26 | 2021-10-04T11:40:26 | 365,454,905 | 20 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,187 | java | package com.finalproject.hrmsbackend.entities.concretes;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.finalproject.hrmsbackend.entities.abstracts.CvProp;
import lombok.*;
import javax.persistence.*;
@Getter
@Setter
@ToString
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "candidates_skills", uniqueConstraints = {@UniqueConstraint(columnNames = {"candidate_id", "skill_id"})})
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class CandidateSkill implements CvProp {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "candidates_skills_id_generator")
@SequenceGenerator(name = "candidates_skills_id_generator", sequenceName = "candidates_skills_id_seq", allocationSize = 1)
@Column(name = "id")
private Integer id;
@ManyToOne
@JoinColumn(name = "candidate_id", nullable = false)
@JsonIgnoreProperties(value = {"cvs", "candidateImages", "candidateJobExperiences",
"candidateLanguages", "candidateSchools", "candidateSkills"})
private Candidate candidate;
@ManyToOne
@JoinColumn(name = "skill_id", nullable = false)
private Skill skill;
}
| [
"smh01.2019@gmail.com"
] | smh01.2019@gmail.com |
5cd0464528eefe6c522f61af9592cbbef6a5bc28 | c27505c5c417b01930825c1d4cf9e563fbc33ee9 | /orgjson/src/test/java/com/hua/test/orgjson/ObjectToXmlTest.java | 952197a38504a84bf230c2aa29d793d12de25edb | [] | no_license | dearcode2018/json-entire | 6234d08c9588c52651a89f275021acd873761b2d | f02a8ac524b24480bd7a984d2c7f6843832d6802 | refs/heads/master | 2023-02-26T18:09:34.445848 | 2021-01-25T10:39:31 | 2021-01-25T10:39:31 | 324,156,464 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,747 | java | /**
* 描述:
* ObjectToXmlTest.java
*
* @author qye.zheng
* version 1.0
*/
package com.hua.test.orgjson;
// 静态导入
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Ignore;
import org.junit.Test;
import com.hua.test.BaseTest;
/**
* 描述:
*
* @author qye.zheng
* ObjectToXmlTest
*/
public final class ObjectToXmlTest extends BaseTest {
/**
*
* 描述:
* @author qye.zheng
*
*/
@Test
public void test() {
try {
} catch (Exception e) {
log.error("test =====> ", e);
}
}
/**
*
* 描述:
* @author qye.zheng
*
*/
@Test
public void testTemp() {
try {
} catch (Exception e) {
log.error("testTemp=====> ", e);
}
}
/**
*
* 描述:
* @author qye.zheng
*
*/
@Test
public void testCommon() {
try {
} catch (Exception e) {
log.error("testCommon =====> ", e);
}
}
/**
*
* 描述:
* @author qye.zheng
*
*/
@Test
public void testSimple() {
try {
} catch (Exception e) {
log.error("testSimple =====> ", e);
}
}
/**
*
* 描述:
* @author qye.zheng
*
*/
@Test
public void testBase() {
try {
} catch (Exception e) {
log.error("testBase =====> ", e);
}
}
/**
*
* 描述: 解决ide静态导入消除问题
* @author qye.zheng
*
*/
@Ignore("解决ide静态导入消除问题 ")
private void noUse() {
String expected = null;
String actual = null;
Object[] expecteds = null;
Object[] actuals = null;
String message = null;
assertEquals(expected, actual);
assertEquals(message, expected, actual);
assertNotEquals(expected, actual);
assertNotEquals(message, expected, actual);
assertArrayEquals(expecteds, actuals);
assertArrayEquals(message, expecteds, actuals);
assertFalse(true);
assertTrue(true);
assertFalse(message, true);
assertTrue(message, true);
assertSame(expecteds, actuals);
assertNotSame(expecteds, actuals);
assertSame(message, expecteds, actuals);
assertNotSame(message, expecteds, actuals);
assertNull(actuals);
assertNotNull(actuals);
assertNull(message, actuals);
assertNotNull(message, actuals);
assertThat(null, null);
assertThat(null, null, null);
fail();
fail("Not yet implemented");
}
}
| [
""
] | |
96e5e6b0e6bd3df0e49c66f2c98be373a6bc797b | ae9efe033a18c3d4a0915bceda7be2b3b00ae571 | /jambeth/jambeth-merge/src/main/java/com/koch/ambeth/merge/util/IPrefetchHelper.java | d838a2023cbb59e1e5839f24bc817ab06c78f6d1 | [
"Apache-2.0"
] | permissive | Dennis-Koch/ambeth | 0902d321ccd15f6dc62ebb5e245e18187b913165 | 8552b210b8b37d3d8f66bdac2e094bf23c8b5fda | refs/heads/develop | 2022-11-10T00:40:00.744551 | 2017-10-27T05:35:20 | 2017-10-27T05:35:20 | 88,013,592 | 0 | 4 | Apache-2.0 | 2022-09-22T18:02:18 | 2017-04-12T05:36:00 | Java | UTF-8 | Java | false | false | 6,579 | java | package com.koch.ambeth.merge.util;
/*-
* #%L
* jambeth-merge
* %%
* Copyright (C) 2017 Koch Softwaredevelopment
* %%
* 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.
* #L%
*/
import java.util.List;
import com.koch.ambeth.util.collections.IList;
/**
* Works as a factory for {@link IPrefetchConfig} instances
*/
public interface IPrefetchHelper {
/**
* Factory method for {@link IPrefetchConfig} instances. After configuring the
* <code>IPrefetchConfig</code> a call to <code>.build()</code> creates the real
* {@link IPrefetchHandle} to be used for prefetching graphs in an entity model. The complexity of
* the batch algorithm to evaluate the needed fetching iterations is defined by the depth of the
* entity graph (not the width of the graph or the amount of entities prefetched). With this
* approach it is even possible to initialize a complete hierarchy of self-relational entities
* (e.g. a UserRole/UserRole tree) very efficiently (again: scaling with the hierarchy depth, not
* the amount of UserRoles)<br>
* <br>
* Usage:<br>
* <code>
* List<?> myEntities = ...<br>
* IPrefetchConfig prefetchConfig = prefetchHelper.createPrefetch();<br>
* prefetchConfig.plan(MyEntity.class).getMyRelations().get(0).getMyTransitiveRelation();<br>
* prefetchConfig.plan(MyEntity.class).getMyOtherRelation();<br>
* prefetchConfig.plan(MyOtherEntity.class).getMyEntity();<br>
* IPrefetchHandle prefetchHandle = prefetchConfig.build();<br>
* prefetchHandle.prefetch(myEntities);<br>
* </code>
*
* @return An empty IPrefetchConfig. Needs to be configured before a call to
* {@link IPrefetchConfig#build()} finishes the configuration and creates a handle to work
* with.
*/
IPrefetchConfig createPrefetch();
/**
* Allows to prefetch pointers to relations of entities in a very fine-grained manner - but still
* allowing the lowest amount of batched fetch operations possible (and therefore with the least
* possible amount of potential remote or database calls). It expects to work not directly with
* entities (because it would not know which relation of those entities to prefetch) but to work
* with composite handles describing a relation of an entity
* (={@link com.koch.ambeth.cache.util.IndirectValueHolderRef}) or an entity instance
* (={@link DirectValueHolderRef}).<br>
* <br>
* A special benefit of these composite handles is that it even allows you to define to only
* prefetch the object references of a relation but not the real initialized relations. This could
* be helpful if you only want to do something like a "count" on the relation or only want to know
* the entity identifiers on the relation, not the complete payload of the related entities.<br>
* <br>
* Usage:<br>
* <code>
* IEntityMetaData metaData = entityMetaDataProvider.getMetaData(entity1.getClass());<br>
* RelationMember myRelation = (RelationMember) metaData.getMemberByName("MyFunnyRelation");<br>
* IObjRefContainer myEntity1 = (IObjRefContainer)entity1;<br>
* IObjRefContainer myEntity2 = (IObjRefContainer)entity2;<br>
* List<?> myPrefetchRelations = Arrays.asList(new DirectValueHolderRef(myEntity1, myRelation, true), new DirectValueHolderRef(myEntity2, myRelation, true));<br>
* prefetchHelper.prefetch(myPrefetchRelations);<br>
* IObjRef[] relationPointersOfEntity1 = myEntity1.get__ObjRefs(metaData.getIndexByRelation(myRelation));<br>
* IObjRef[] relationPointersOfEntity2 = myEntity2.get__ObjRefs(metaData.getIndexByRelation(myRelation));<br>
* </code> *
*
* @param objects A collection or array of instances of either {@link DirectValueHolderRef} or
* {@link com.koch.ambeth.cache.util.IndirectValueHolderRef}
* @return The hard reference to all resolved entity instances of requested relations. It is
* reasonable to store this result on the stack (without working with the stack variable)
* in cases where the associated cache instances are configured to hold entity instances
* in a weakly manner. In those cases it may happen that a prefetch request increases the
* amount of cached entities temporarily above the LRU limit (least recently used
* algorithm). Therefore it is necessary to ensure that the initialized result
* continuously gets a hold in the cache as long as needed for the process on the stack.
* So this hard reference compensates the cases where the LRU cache would consider the
* resolved entity instances as "releasable". If the corresponding caches are generally
* configured to hold hard references to the entity instances themselves the LRU cache is
* effectively disabled and the returned {@link IPrefetchState} has no effective use.
*/
IPrefetchState prefetch(Object objects);
/**
* Convenience method for specific usecases of the {@link #createPrefetch()} approach. With this
* it is possible to prefetch a single deep graph of a set of entity relations and to aggregate
* all distinct entities of those initialized graph leafs as a result. This also works for
* not-yet-persisted entities referenced in the graph.<br>
* <br>
* Usage:<br>
* <code>
* List<MyOtherRelation> allMyOtherRelations = prefetchHelper.extractTargetEntities(myEntities, "Relations.MyRelation.MyOtherRelation", MyEntity.class);
* </code>
*
* @param sourceEntities The entity instances each working as the graph root for the batched
* prefetch operation
* @param sourceToTargetEntityPropertyPath The transitive traversal path to be initialized based
* on each given graph root in 'sourceEntities'
* @param sourceEntityType The common entity type of the set of entity instances in
* 'sourceEntities'
* @return The aggregated list of distinct entity instances resolved as the leaf of the graph
* traversal defined by 'sourceToTargetEntityPropertyPath'
*/
<T, S> IList<T> extractTargetEntities(List<S> sourceEntities,
String sourceToTargetEntityPropertyPath, Class<S> sourceEntityType);
}
| [
"dennis.koch@bruker.com"
] | dennis.koch@bruker.com |
66579143de8a66c77be9abe8e66339ad8b1b4263 | 84d305a2476ade42dcb23f5b247459867c2c9357 | /app/src/main/java/space/firsov/kvantnews/ui/posts/GetCoursesNews.java | b888630c951fb6d4e74b01b3fbc7fc82bdb1182b | [] | no_license | makerssyktyvkar/kvant1 | 996ddad48fcf376b7e916174dd8cb7fb492faac0 | 9639209802b0dc251824b42cde6ce3186bedb323 | refs/heads/master | 2021-01-02T06:57:40.138250 | 2020-06-09T15:47:36 | 2020-06-09T15:47:36 | 239,537,578 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,905 | java | package space.firsov.kvantnews.ui.posts;
import android.content.Context;
import android.os.AsyncTask;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import space.firsov.kvantnews.R;
public class GetCoursesNews extends AsyncTask<String, Void, Integer> {
private String login;
private CoursesNewsOfUserDB coursesNewsOfUserDB;
Context context;
public GetCoursesNews(String login, Context context) {
this.login = login;
coursesNewsOfUserDB = new CoursesNewsOfUserDB(context);
this.context = context;
}
@Override
protected Integer doInBackground(String... args) {
try {
String url = context.getResources().getString(R.string.main_host_dns) + "ReturnCoursesNews.php?login=" + login;
Document document = Jsoup.connect(url).maxBodySize(0).get();
Elements element = document.select("li[class=news-item]");
coursesNewsOfUserDB.deleteAll();
for (int i = element.size() - 1; i >= 0; i--) {
String id_news = element.eq(i).select("p[class=id_news]").eq(0).text();
String name = element.eq(i).select("p[class=course_name]").eq(0).text();
String title = element.eq(i).select("h2[class=title]").eq(0).text();
String message = element.eq(i).select("p[class=message]").eq(0).text();
String time = element.eq(i).select("p[class=time]").eq(0).text();
String linkImage;
try{
linkImage = element.eq(i).select("img").eq(0).attr("src").substring(24);
}catch (Exception e){
linkImage = "";
}
coursesNewsOfUserDB.insert(id_news, name, title,message,linkImage,time);
}
} catch (Exception e) {
//
}
return 1;
}
} | [
"53371833+Firsov62121@users.noreply.github.com"
] | 53371833+Firsov62121@users.noreply.github.com |
d1f3cf9d8f0f7387b8f620658ee41fef17f0405c | 28d1354e63724bb72300507c1b61695bd92fc27c | /gradle/app/src/main/java/com/example/newbiechen/ireader/ui/fragment/DiscHelpsFragment.java | 6f52385f15c68a230b80777b0b2ef2ae980f8b92 | [
"MIT"
] | permissive | yxiaojian33/NovelReader | c2a4dc81653e5a37f9ffea5062ec2a646bf07fa3 | e21ca1d6b84b2420efeaa676fe9a3e850644be22 | refs/heads/master | 2022-02-02T19:58:52.614710 | 2019-05-09T05:22:11 | 2019-05-09T05:22:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,908 | java | package com.test.xiaojian.simple_reader.ui.fragment;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import com.test.xiaojian.simple_reader.R;
import com.test.xiaojian.simple_reader.RxBus;
import com.test.xiaojian.simple_reader.event.SelectorEvent;
import com.test.xiaojian.simple_reader.model.bean.BookHelpsBean;
import com.test.xiaojian.simple_reader.model.flag.BookDistillate;
import com.test.xiaojian.simple_reader.model.flag.BookSort;
import com.test.xiaojian.simple_reader.model.flag.CommunityType;
import com.test.xiaojian.simple_reader.presenter.DiscHelpsPresenter;
import com.test.xiaojian.simple_reader.presenter.contract.DiscHelpsContract;
import com.test.xiaojian.simple_reader.ui.activity.DiscDetailActivity;
import com.test.xiaojian.simple_reader.ui.adapter.DiscHelpsAdapter;
import com.test.xiaojian.simple_reader.ui.base.BaseMVPFragment;
import com.test.xiaojian.simple_reader.utils.Constant;
import com.test.xiaojian.simple_reader.widget.itemdecoration.DividerItemDecoration;
import com.test.xiaojian.simple_reader.widget.refresh.ScrollRefreshRecyclerView;
import com.test.xiaojian.simple_reader.widget.adapter.WholeAdapter;
import java.util.List;
import butterknife.BindView;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
/**
* Created by xiaojian on 17-4-21.
*/
public class DiscHelpsFragment extends BaseMVPFragment<DiscHelpsContract.Presenter> implements DiscHelpsContract.View{
private static final String BUNDLE_SORT = "bundle_sort";
private static final String BUNDLE_DISTILLATE = "bundle_distillate";
/*****************View********************/
@BindView(R.id.scroll_refresh_rv_content)
ScrollRefreshRecyclerView mRvContent;
/******************Object******************/
private DiscHelpsAdapter mDiscHelpsAdapter;
/******************Params*******************/
private BookSort mBookSort = BookSort.DEFAULT;
private BookDistillate mDistillate = BookDistillate.ALL;
private int mStart = 0;
private int mLimited = 20;
/************************init method*********************************/
@Override
protected int getContentId() {
return R.layout.fragment_scroll_refresh_list;
}
@Override
protected void initData(Bundle savedInstanceState) {
super.initData(savedInstanceState);
if (savedInstanceState != null){
mBookSort = (BookSort) savedInstanceState.getSerializable(BUNDLE_SORT);
mDistillate = (BookDistillate) savedInstanceState.getSerializable(BUNDLE_DISTILLATE);
}
}
@Override
protected void initWidget(Bundle savedInstanceState) {
setUpAdapter();
}
private void setUpAdapter(){
mRvContent.setLayoutManager(new LinearLayoutManager(getContext()));
mRvContent.addItemDecoration(new DividerItemDecoration(getContext()));
mDiscHelpsAdapter = new DiscHelpsAdapter(getContext(),new WholeAdapter.Options());
mRvContent.setAdapter(mDiscHelpsAdapter);
}
/******************************click method******************************/
@Override
protected void initClick() {
mRvContent.setOnRefreshListener(
() -> startRefresh()
);
mDiscHelpsAdapter.setOnLoadMoreListener(
() -> mPresenter.loadingBookHelps(mBookSort,mStart, mLimited,mDistillate)
);
mDiscHelpsAdapter.setOnItemClickListener(
(view,pos) -> {
BookHelpsBean bean = mDiscHelpsAdapter.getItem(pos);
DiscDetailActivity.startActivity(getContext(), CommunityType.HELP,bean.get_id());
}
);
Disposable eventDispo = RxBus.getInstance()
.toObservable(Constant.MSG_SELECTOR, SelectorEvent.class)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
(event) ->{
mBookSort = event.sort;
mDistillate = event.distillate;
startRefresh();
}
);
addDisposable(eventDispo);
}
@Override
protected DiscHelpsContract.Presenter bindPresenter() {
return new DiscHelpsPresenter();
}
/*****************************logic method*****************************/
@Override
protected void processLogic() {
super.processLogic();
mRvContent.startRefresh();
mPresenter.firstLoading(mBookSort,mStart,mLimited,mDistillate);
}
private void startRefresh(){
mStart = 0;
mPresenter.refreshBookHelps(mBookSort,mStart,mLimited,mDistillate);
}
/**************************rewrite method****************************************/
@Override
public void finishRefresh(List<BookHelpsBean> beans) {
mDiscHelpsAdapter.refreshItems(beans);
mStart = beans.size();
mRvContent.setRefreshing(false);
}
@Override
public void finishLoading(List<BookHelpsBean> beans) {
mDiscHelpsAdapter.addItems(beans);
mStart += beans.size();
}
@Override
public void showErrorTip() {
mRvContent.showTip();
}
@Override
public void showError() {
mDiscHelpsAdapter.showLoadError();
}
@Override
public void complete() {
mRvContent.finishRefresh();
}
/****************************************************************************/
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putSerializable(BUNDLE_SORT, mBookSort);
outState.putSerializable(BUNDLE_DISTILLATE,mDistillate);
}
@Override
public void onStop() {
super.onStop();
mPresenter.saveBookHelps(mDiscHelpsAdapter.getItems());
}
}
| [
"Xiaojianlei@users.noreply.github.com"
] | Xiaojianlei@users.noreply.github.com |
9a288f917ef78b5f1b4e34d69ac1e268cd9e19c5 | 9117482c62a55d686f7777830723b48fe284d9e8 | /EmployeeDatabase/src/com/cubic/application/services/JDBConn.java | 71624f47b299a2652b56e7ef36c135e5b0d16706 | [] | no_license | smaharjan99/coffee | 3760626af9cfc9fd7995e509f111636f1a03fb2b | 920ef2fe6b0ebb72f1f7908bfa3eaf985209090e | refs/heads/master | 2021-01-12T10:59:18.690988 | 2016-11-29T18:24:33 | 2016-11-29T18:24:33 | 72,780,987 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 435 | java | package com.cubic.application.services;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class JDBConn {
public Connection getConnection() throws ClassNotFoundException, SQLException{
Connection dbconn =null;
Class.forName("oracle.jdbc.driver.OracleDriver");
dbconn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","alkine99");
return dbconn;
}
}
| [
"smaharjan237@gmail.com"
] | smaharjan237@gmail.com |
23c1265b935707f5d2576e3e79afe8cf474539be | 336cbbe808a7353cb1966f816a81bbaf077295c2 | /src/test/java/com/github/madeindjs/feedID3Test/DiscogReleaseTest.java | 6ec088377713a332426cc442537bdb1a20975e85 | [] | no_license | madeindjs/feedID3 | 3458b60f70f9f3af544cd9c96b65ada395b8f6ec | 2a0f3c7fcad47a0ba46ff28139ed35d6ebc33de7 | refs/heads/master | 2021-04-09T17:09:07.973636 | 2018-04-20T11:55:58 | 2018-04-20T11:55:58 | 125,757,937 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,174 | java | package com.github.madeindjs.feedID3Test;
import com.mpatric.mp3agic.ID3v24Tag;
import com.github.madeindjs.feedID3.DiscogRelease;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import junit.framework.Assert;
import org.json.JSONObject;
import org.junit.Test;
/**
*
* @author apprenant
*/
public class DiscogReleaseTest {
private static final String JSON_PATH = "src/test/resources/release.json";
private static final String IMAGE_URL = "https://img.discogs.com/G1-XpvxNjMmcU_HRoshplE-jxGY=/fit-in/600x600/filters:strip_icc():format(jpeg):mode_rgb():quality(90)/discogs-images/R-6879728-1428607084-9223.jpeg.jpg";
/**
* Get a JSONObject who represent a result from Discog API
*
* @return
*/
public static DiscogRelease getDiscogRelease() throws IOException {
String content = new String(Files.readAllBytes(Paths.get(JSON_PATH)));
JSONObject json = new JSONObject(content);
return new DiscogRelease(json);
}
@Test
public void testDiscogRelease() throws IOException {
JSONObject result = getDiscogRelease();
DiscogRelease release = new DiscogRelease(result);
}
@Test
public void testParseJsonObject() throws IOException {
JSONObject result = getDiscogRelease();
DiscogRelease release = new DiscogRelease(result);
Assert.assertEquals("Red Pill", release.getArtist());
Assert.assertEquals("https://api.discogs.com/artists/3835396", release.getArtistUrl());
Assert.assertEquals(7, release.getGenre());
Assert.assertEquals("Hip Hop", release.getGenreDescription());
Assert.assertEquals("Look What This World Did to Us", release.getTitle());
Assert.assertEquals("Look What This World Did to Us", release.getAlbum());
Assert.assertEquals(2015, release.getYear());
}
@Test
public void testToId3() throws IOException {
JSONObject result = getDiscogRelease();
DiscogRelease release = new DiscogRelease(result);
ID3v24Tag id3 = release.toID3();
Assert.assertEquals("Red Pill", id3.getArtist());
Assert.assertEquals("https://api.discogs.com/artists/3835396", id3.getArtistUrl());
Assert.assertEquals(7, id3.getGenre());
Assert.assertEquals("Hip-Hop", id3.getGenreDescription());
Assert.assertEquals("Look What This World Did to Us", id3.getTitle());
Assert.assertEquals("Look What This World Did to Us", id3.getAlbum());
Assert.assertEquals("2015", id3.getYear());
}
@Test
public void getImage() throws IOException {
JSONObject result = getDiscogRelease();
DiscogRelease release = new DiscogRelease(result);
// verify that URL is scraped
String imageUrl = release.getImageUrl();
System.out.println(imageUrl);
Assert.assertEquals(IMAGE_URL, imageUrl);
// verify that image is generated
ID3v24Tag id3 = release.toID3();
byte[] image = id3.getAlbumImage();
Assert.assertNotNull(id3.getAlbumImage());
Assert.assertNotNull("image/jpg", id3.getAlbumImageMimeType());
}
}
| [
"contact@rousseau-alexandre.fr"
] | contact@rousseau-alexandre.fr |
3035a1183b71c5d4654a2a74a5a22387dbdc3fba | 507955ae1ae8efc0b772a02399d15cced3d0442c | /pattern/src/main/java/com/gupao/gp16306/pattern/singleton/lazy/LazyDoubleCheckSingleton.java | d24f6e55d82f617c19168d16269e4716b6c5b9e6 | [] | no_license | fire-feng/GP16306 | 0f302b8bc0492c9fba59f9db6fd02bace2d29ca2 | 8ae1f9278750e27b69dfc51513de51b42a0207bf | refs/heads/master | 2022-12-24T23:27:26.797874 | 2019-06-25T16:10:23 | 2019-06-25T16:10:23 | 174,558,990 | 0 | 0 | null | 2022-12-16T04:24:32 | 2019-03-08T15:12:56 | Java | UTF-8 | Java | false | false | 701 | java | package com.gupao.gp16306.pattern.singleton.lazy;
public class LazyDoubleCheckSingleton {
private volatile static LazyDoubleCheckSingleton lazy = null;
private LazyDoubleCheckSingleton(){ }
public static LazyDoubleCheckSingleton getInstance() {
if (lazy == null) {
synchronized (LazyDoubleCheckSingleton.class){
if (lazy == null) {
lazy = new LazyDoubleCheckSingleton();
}
//1.分配内存给这个对象
//2.初始化对象
//3.设置lazy指向刚分配的内存地址
//4.初次访问对象
}
}
return lazy;
}
}
| [
"369596957@qq.com"
] | 369596957@qq.com |
331451d258a897f5be06a95b64548cbcb85f13ad | e8d9a5ae1a33001a8008bde85565c201077c1cba | /com.io7m.jdae.collada1_5/src/main/java/com/io7m/jdae/collada1_5/MeshType.java | b92c6e0927b0b65b2e6cf68d540b0a5d184fb35b | [
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-public-domain"
] | permissive | io7m/jdae | 6839b34294185a81c5ce9b6ea9a392d992bec0b1 | 9c4555487fd0cab7824ab384c6a3d3eef76ba298 | refs/heads/master | 2023-09-01T22:40:43.760915 | 2021-01-17T14:52:38 | 2021-01-17T14:52:38 | 48,003,036 | 1 | 1 | NOASSERTION | 2020-10-12T23:31:08 | 2015-12-14T21:47:05 | Java | UTF-8 | Java | false | false | 6,595 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.12.14 at 09:36:22 PM UTC
//
package com.io7m.jdae.collada1_5;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlType;
/**
*
* The mesh element contains vertex and primitive information sufficient to describe basic geometric meshes.
*
*
* <p>Java class for mesh_type complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="mesh_type">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="source" type="{http://www.collada.org/2008/03/COLLADASchema}source_type" maxOccurs="unbounded"/>
* <element name="vertices" type="{http://www.collada.org/2008/03/COLLADASchema}vertices_type"/>
* <choice maxOccurs="unbounded" minOccurs="0">
* <element name="lines" type="{http://www.collada.org/2008/03/COLLADASchema}lines_type"/>
* <element name="linestrips" type="{http://www.collada.org/2008/03/COLLADASchema}linestrips_type"/>
* <element name="polygons" type="{http://www.collada.org/2008/03/COLLADASchema}polygons_type"/>
* <element name="polylist" type="{http://www.collada.org/2008/03/COLLADASchema}polylist_type"/>
* <element name="triangles" type="{http://www.collada.org/2008/03/COLLADASchema}triangles_type"/>
* <element name="trifans" type="{http://www.collada.org/2008/03/COLLADASchema}trifans_type"/>
* <element name="tristrips" type="{http://www.collada.org/2008/03/COLLADASchema}tristrips_type"/>
* </choice>
* <element name="extra" type="{http://www.collada.org/2008/03/COLLADASchema}extra_type" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "mesh_type", propOrder = {
"source",
"vertices",
"linesOrLinestripsOrPolygons",
"extra"
})
public class MeshType {
@XmlElement(required = true)
protected List<SourceType> source;
@XmlElement(required = true)
protected VerticesType vertices;
@XmlElements({
@XmlElement(name = "lines", type = LinesType.class),
@XmlElement(name = "linestrips", type = LinestripsType.class),
@XmlElement(name = "polygons", type = PolygonsType.class),
@XmlElement(name = "polylist", type = PolylistType.class),
@XmlElement(name = "triangles", type = TrianglesType.class),
@XmlElement(name = "trifans", type = TrifansType.class),
@XmlElement(name = "tristrips", type = TristripsType.class)
})
protected List<Object> linesOrLinestripsOrPolygons;
protected List<ExtraType> extra;
/**
* Gets the value of the source property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a {@code set} method for the source property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getSource().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link SourceType }
*
*
*/
public List<SourceType> getSource() {
if (source == null) {
source = new ArrayList<SourceType>();
}
return this.source;
}
/**
* Gets the value of the vertices property.
*
* @return
* possible object is
* {@link VerticesType }
*
*/
public VerticesType getVertices() {
return vertices;
}
/**
* Sets the value of the vertices property.
*
* @param value
* allowed object is
* {@link VerticesType }
*
*/
public void setVertices(VerticesType value) {
this.vertices = value;
}
/**
* Gets the value of the linesOrLinestripsOrPolygons property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a {@code set} method for the linesOrLinestripsOrPolygons property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getLinesOrLinestripsOrPolygons().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link LinesType }
* {@link LinestripsType }
* {@link PolygonsType }
* {@link PolylistType }
* {@link TrianglesType }
* {@link TrifansType }
* {@link TristripsType }
*
*
*/
public List<Object> getLinesOrLinestripsOrPolygons() {
if (linesOrLinestripsOrPolygons == null) {
linesOrLinestripsOrPolygons = new ArrayList<Object>();
}
return this.linesOrLinestripsOrPolygons;
}
/**
* Gets the value of the extra property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a {@code set} method for the extra property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getExtra().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ExtraType }
*
*
*/
public List<ExtraType> getExtra() {
if (extra == null) {
extra = new ArrayList<ExtraType>();
}
return this.extra;
}
}
| [
"code@io7m.com"
] | code@io7m.com |
e3e4d46f9ce65e10d6520562ba0a68823e831485 | ec6cf05df19026a5d8aab1752471daeb2a8edefc | /game_api/src/main/java/com/sbmage/exception/LogicException.java | 33d330252e34279ee7678a7b44772e838602a7b3 | [] | no_license | sbmage/game-api | 59e2922ca5ea64afbdfffa8c34eb76f468bb1439 | 0167aacb0191d2f3584f5d637760378a0f247da9 | refs/heads/master | 2021-01-10T04:02:58.966590 | 2016-03-30T04:09:30 | 2016-03-30T04:09:30 | 54,959,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,623 | java | package com.sbmage.exception;
import java.util.Iterator;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import com.sbmage.common.CommonConfig;
import com.sbmage.util.Util;
public class LogicException extends Exception {
private static final long serialVersionUID = 2074542044459042219L;
private static final Logger logger = Logger.getLogger(LogicException.class);
private String errorCode = null;
public LogicException(String errorMessage) {
super(errorMessage);
this.printErrorLog(errorMessage);
}
public LogicException(String errorCode, String errorMessage) {
super(errorMessage);
this.errorCode = errorCode;
this.printErrorLog(errorMessage);
}
private void printErrorLog(String errorMessage) {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String encYn = StringUtils.defaultString(request.getParameter("encYn"), "Y");
StringBuffer errorMessageBuffer = new StringBuffer();
errorMessageBuffer.append(errorMessage).append("\n");
errorMessageBuffer.append("IP - ").append(request.getRemoteAddr()).append("\n");
errorMessageBuffer.append("URL - ").append(request.getRequestURL()).append("\n");
if (!encYn.equals("N")) {
String body = StringUtils.defaultString(request.getParameter(CommonConfig.BODY));
try {
errorMessageBuffer.append("PARAMETER - ").append(new String(Util.decrypt(CommonConfig.INIT, body, CommonConfig.DEFAULT_KEY)));
} catch (Exception e) {System.out.println(e);}
} else {
Map<String, String[]> paramMap = request.getParameterMap();
Iterator<String> it = paramMap.keySet().iterator();
String key = null;
String[] value = null;
StringBuffer valueBuffer = new StringBuffer();
while(it.hasNext()) {
key = it.next();
value = paramMap.get(key);
valueBuffer.append(key).append("=");
for(int i=0; i < value.length; i++) {
valueBuffer.append(value[i]);
if (i < (value.length - 1)) {
valueBuffer.append(",");
}
}
valueBuffer.append("&");
}
errorMessageBuffer.append("PARAMETER - ").append(StringUtils.substringBeforeLast(valueBuffer.toString(), "&"));
}
logger.error(errorMessageBuffer);
}
public String getErrorCode() {
return errorCode;
}
}
| [
"sbmage.ha@gmail.com"
] | sbmage.ha@gmail.com |
80737cd501b788d0f2ff757b772e9c2ce583fd24 | bd6edfdfb35d96f689b3952e2655e05b755c1870 | /src/main/java/net/todo/model/Item.java | 499d616c7aab0bc87842963759439ee27bc40ac3 | [] | no_license | pizzou/task-force | 4779445bacb22ddff447667fae7080504682e9bb | a6f85a1e23c947c818bf8eace07855f70099af19 | refs/heads/master | 2023-03-10T03:21:42.721878 | 2021-02-24T07:23:37 | 2021-02-24T07:23:37 | 341,194,024 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,333 | java | package net.todo.model;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import net.todo.enumerator.Priority;
@Entity
@ApiModel(description = "Class representing a person tracked by the application.")
public class Item extends Auditable<String>{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty(notes = "${item.id}", example = "1", required = true, position = 0)
private Long id;
private String title;
private String description;
@Enumerated
private Priority priority;
public Item() {
//super();
}
public Item(String title, String description, Priority priority) {
//super();
this.title = title;
this.description = description;
this.priority = priority;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Priority getPriority() {
return priority;
}
public void setPriority(Priority priority) {
this.priority = priority;
}
}
| [
"mpumuro.patrick@hotmail.com"
] | mpumuro.patrick@hotmail.com |
3f39d623e4d6214aac14d0f5a705638cc308196a | e8dd79e3db821e8a2d885061cc10b5e4205198cd | /src/main/java/com/gmail/shvetsova2015/inna/controllers/MyControllerSalary.java | b1254b0acfafe5426ef508110c789cd22bfd9de5 | [] | no_license | InnaShvetsova2016/SSM | 50458d5ddcb2046fa70229387284ce71054d05a2 | 617e6d558f8cf1b4e0d3f2f9d0be34ab8e9fae67 | refs/heads/master | 2021-01-01T04:45:50.897486 | 2016-05-25T19:14:32 | 2016-05-25T19:14:32 | 59,362,966 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,134 | java | package com.gmail.shvetsova2015.inna.controllers;
import com.gmail.shvetsova2015.inna.entity.Order;
import com.gmail.shvetsova2015.inna.entity.Salary;
import com.gmail.shvetsova2015.inna.services.MasterService;
import com.gmail.shvetsova2015.inna.services.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Controller
@RequestMapping("/")
public class MyControllerSalary {
@Autowired
private MasterService masterService;
@Autowired
private OrderService orderService;
@RequestMapping("/salary")
public String salary(Model model) {
List<Salary> salaryList = new ArrayList<>();
for (int i = 0; i < masterService.list().size(); i++) {
salaryList.add(new Salary());
salaryList.get(i).setM(masterService.list().get(i));
}
int count = 0;
double profit = 0.00;
for (int i = 0; i < masterService.list().size(); i++) {
for (Order o : orderService.list()) {
if (o.getMasterName().equals(masterService.list().get(i).getName())) {
count += 1;
profit += o.getAmount();
}
}
salaryList.get(i).setCount(count);
salaryList.get(i).setProfit(profit);
count = 0;
profit = 0.00;
}
int totalCount = 0;
double totalProfit = 0.00;
for (int i = 0; i < salaryList.size(); i++) {
totalCount += salaryList.get(i).getCount();
totalProfit += salaryList.get(i).getProfit();
}
model.addAttribute("totalCount", totalCount);
model.addAttribute("totalProfit", totalProfit);
model.addAttribute("salary", salaryList);
model.addAttribute("masters", masterService.list());
model.addAttribute("currentDate", MyController.curDate());
return "salary";
}
@RequestMapping(value = "/calculate", method = RequestMethod.POST)
public String salaryPeriod(@RequestParam String fromDate, @RequestParam String toDate, Model model) throws ParseException {
List<Salary> salaryListPeriod = new ArrayList<>();
for (int i = 0; i < masterService.list().size(); i++) {
salaryListPeriod.add(new Salary());
salaryListPeriod.get(i).setM(masterService.list().get(i));
}
int count = 0;
double profit = 0.00;
Date fromD = MyController.fromString(fromDate);
Date toD = MyController.fromString(toDate);
for (int i = 0; i < masterService.list().size(); i++) {
for (Order o : orderService.list()) {
if (o.getDate().getTime() >= fromD.getTime() && o.getDate().getTime() <= toD.getTime()) {
if (o.getMasterName().equals(masterService.list().get(i).getName())) {
count += 1;
profit += o.getAmount();
}
}
}
salaryListPeriod.get(i).setCount(count);
salaryListPeriod.get(i).setProfit(profit);
count = 0;
profit = 0.00;
}
int totalCountPeriod = 0;
double totalProfitPeriod = 0.00;
for (int i = 0; i < salaryListPeriod.size(); i++) {
totalCountPeriod += salaryListPeriod.get(i).getCount();
totalProfitPeriod += salaryListPeriod.get(i).getProfit();
}
model.addAttribute("totalCount", totalCountPeriod);
model.addAttribute("totalProfit", totalProfitPeriod);
model.addAttribute("salary", salaryListPeriod);
model.addAttribute("masters", masterService.list());
model.addAttribute("currentDate", MyController.curDate());
return "salary";
}
}
| [
"inna.shvetsova2015@gmail.com"
] | inna.shvetsova2015@gmail.com |
46da4d04a62cf8e824fd838ce0dfae58c2ab725a | 8b4d223f252dd135b9271b207a21e29fa4cbfdf3 | /src/main/java/com/db/prisma/droolspoc/pain001/ChequeDelivery1Code.java | cdb4042c05356f2211d3448acc401bef9abb9341 | [
"MIT"
] | permissive | demoth/finistika | 254c4a687cd4fe2ad7ecb590243703cabc4c14eb | 4850cca7345f42033558a83b4c6ffe4e168efc80 | refs/heads/master | 2021-01-18T19:31:46.642965 | 2017-06-06T15:58:40 | 2017-06-06T15:58:40 | 86,899,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,628 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.03.31 at 10:40:01 AM MSK
//
package com.db.prisma.droolspoc.pain001;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ChequeDelivery1Code.
* <p>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <simpleType name="ChequeDelivery1Code">
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="MLDB"/>
* <enumeration value="MLCD"/>
* <enumeration value="MLFA"/>
* <enumeration value="CRDB"/>
* <enumeration value="CRCD"/>
* <enumeration value="CRFA"/>
* <enumeration value="PUDB"/>
* <enumeration value="PUCD"/>
* <enumeration value="PUFA"/>
* <enumeration value="RGDB"/>
* <enumeration value="RGCD"/>
* <enumeration value="RGFA"/>
* </restriction>
* </simpleType>
* </pre>
*/
@XmlType(name = "ChequeDelivery1Code")
@XmlEnum
public enum ChequeDelivery1Code {
MLDB,
MLCD,
MLFA,
CRDB,
CRCD,
CRFA,
PUDB,
PUCD,
PUFA,
RGDB,
RGCD,
RGFA;
public static ChequeDelivery1Code fromValue(String v) {
return valueOf(v);
}
public String value() {
return name();
}
}
| [
"bubnov.d.e@gmail.com"
] | bubnov.d.e@gmail.com |
6e98007505b119e5ecf44bf0714f7918ecac5413 | 4c95ffa4ad30e2bddae85569f3acf8e40e6bcddd | /src/main/java/com/raga/service/ProductRetrieverService.java | e5afa99bfcd6c5433e5461c27d0c5ae3c84baff7 | [] | no_license | rohitsingh186/amazin-cart | 3073e9287d3d8e3370debbdc70d690c77adc789a | 98f5e8fe33ac0cb7eef8b8ce30647c00a42a8e17 | refs/heads/master | 2021-06-15T23:23:52.253903 | 2019-09-05T19:09:42 | 2019-09-05T19:09:42 | 206,617,865 | 0 | 0 | null | 2021-06-04T02:10:36 | 2019-09-05T17:14:32 | Java | UTF-8 | Java | false | false | 1,642 | java | package com.raga.service;
import com.raga.vo.ProductDetails;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
@Service
public class ProductRetrieverService {
private static final String PRODUCT_DETAILS_OUTPUT_FILE_NAME = "Step 1 - Product Details.json";
private final RestTemplate restTemplate;
private final String productDetailsApiUrl;
private final ResultWriterService resultWriterService;
@Autowired
public ProductRetrieverService(RestTemplate restTemplate,
@Value("${product.details.api.url}") String productDetailsApiUrl,
ResultWriterService resultWriterService) {
this.restTemplate = restTemplate;
this.productDetailsApiUrl = productDetailsApiUrl;
this.resultWriterService = resultWriterService;
}
public List<ProductDetails> retrieveProducts() throws IOException {
ProductDetails[] productDetails = fetchProductDetails();
writeResultIntoFile(productDetails);
return Arrays.asList(productDetails);
}
private ProductDetails[] fetchProductDetails() {
return this.restTemplate
.getForEntity(this.productDetailsApiUrl, ProductDetails[].class)
.getBody();
}
private void writeResultIntoFile(ProductDetails[] productDetails) throws IOException {
this.resultWriterService.writeResultIntoFile(productDetails, PRODUCT_DETAILS_OUTPUT_FILE_NAME);
}
}
| [
"rohitsingh17219@gmail.com"
] | rohitsingh17219@gmail.com |
7acd6742659b42dd3d45d17481e03fc44cf07cf1 | 5df41d496c4f422cbe7c01a1bb187df169fd5e9e | /src/main/java/com/mitocode/model/Signos.java | 6f715248445c3d63332bac0b348e28dfa888346e | [] | no_license | CECASTANEDA/mediapp-backend | 5719f835ce9b1f6668df0e88a46cc359a019a9f9 | 2fb5a4eb9a12dc1a1bf459442ccfd0e5a2253597 | refs/heads/main | 2023-05-31T02:12:09.214240 | 2021-06-19T15:49:56 | 2021-06-19T15:49:56 | 378,449,290 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,508 | java | package com.mitocode.model;
import java.time.LocalDateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name = "signos")
public class Signos {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer idSignos;
@ManyToOne
@JoinColumn(name = "id_paciente", nullable = false, foreignKey = @ForeignKey(name = "FK_signos_paciente"))
private Paciente paciente;
@Column(name = "fecha", nullable = false)
private LocalDateTime fecha;
@Column(name = "temperatura", length = 10, nullable = false)
private String temperatura;
@Column(name = "pulso", length = 10, nullable = false)
private String pulso;
@Column(name = "ritmo_respiratorio", length = 10, nullable = false)
private String ritmoRespiratorio;
public Paciente getPaciente() {
return paciente;
}
public void setPaciente(Paciente paciente) {
this.paciente = paciente;
}
public Integer getIdSignos() {
return idSignos;
}
public void setIdSignos(Integer idSignos) {
this.idSignos = idSignos;
}
public LocalDateTime getFecha() {
return fecha;
}
public void setFecha(LocalDateTime fecha) {
this.fecha = fecha;
}
public String getTemperatura() {
return temperatura;
}
public void setTemperatura(String temperatura) {
this.temperatura = temperatura;
}
public String getPulso() {
return pulso;
}
public void setPulso(String pulso) {
this.pulso = pulso;
}
public String getRitmoRespiratorio() {
return ritmoRespiratorio;
}
public void setRitmoRespiratorio(String ritmoRespiratorio) {
this.ritmoRespiratorio = ritmoRespiratorio;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((fecha == null) ? 0 : fecha.hashCode());
result = prime * result + ((idSignos == null) ? 0 : idSignos.hashCode());
result = prime * result + ((paciente == null) ? 0 : paciente.hashCode());
result = prime * result + ((pulso == null) ? 0 : pulso.hashCode());
result = prime * result + ((ritmoRespiratorio == null) ? 0 : ritmoRespiratorio.hashCode());
result = prime * result + ((temperatura == null) ? 0 : temperatura.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Signos other = (Signos) obj;
if (fecha == null) {
if (other.fecha != null)
return false;
} else if (!fecha.equals(other.fecha))
return false;
if (idSignos == null) {
if (other.idSignos != null)
return false;
} else if (!idSignos.equals(other.idSignos))
return false;
if (paciente == null) {
if (other.paciente != null)
return false;
} else if (!paciente.equals(other.paciente))
return false;
if (pulso == null) {
if (other.pulso != null)
return false;
} else if (!pulso.equals(other.pulso))
return false;
if (ritmoRespiratorio == null) {
if (other.ritmoRespiratorio != null)
return false;
} else if (!ritmoRespiratorio.equals(other.ritmoRespiratorio))
return false;
if (temperatura == null) {
if (other.temperatura != null)
return false;
} else if (!temperatura.equals(other.temperatura))
return false;
return true;
}
}
| [
"CARLOS.E.C.CASTILLO@GMAIL.COM"
] | CARLOS.E.C.CASTILLO@GMAIL.COM |
3bf68ccfdb48de251ecb6cea8f1d63e2c8aa380a | 22f3ef4a83b08da3b6be4ebf937e59aecf371619 | /JavaMisc/CommandLineExample.java | 7eda6b93e8f09a4ef67ac49d8be08e53ed0bed80 | [] | no_license | tushar9604/Javatpoint | 574e544ad7bd72354a198a6583dcf119446fbd83 | f325c2a1373394514f9ee9ed60f15e0c62f6cea2 | refs/heads/main | 2023-04-08T01:19:15.617991 | 2021-04-05T04:56:17 | 2021-04-05T04:56:17 | 351,664,806 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 129 | java | class CommandLineExample{
public static void main(String[] args){
System.out.println("Your first argument is: "+args[0]);
}
} | [
"tushar9604@gmail.com"
] | tushar9604@gmail.com |
d695b5e857c48bb08c8f0525771789b68fcf3cbe | 3b92a640108d73e38de0ec1104d8cb3189b9227e | /HydreixBesiegt.java | cd034c9f48f507655dd63fb33449e80ca3ce0468 | [] | no_license | thuylinhluu/reMemorization | 773647ab8660b1808fc26b67bfcb5d7b174962bc | 7ae12a0fbc51d70a0dbdc4feba442827c5e115df | refs/heads/master | 2020-09-22T05:36:05.469064 | 2020-02-24T16:13:02 | 2020-02-24T16:13:02 | 225,069,547 | 0 | 0 | null | 2019-11-30T21:02:52 | 2019-11-30T21:02:52 | null | UTF-8 | Java | false | false | 1,429 | java | import greenfoot.*;
public class HydreixBesiegt extends Textbox
{
private int gespraechsteil;
private Emrael emrael;
public HydreixBesiegt(Emrael em) {
drawText("Hydreix", "Schämst du dich denn nicht?");
gespraechsteil = 1;
setFertig(false);
emrael = em;
emrael.setBewegungBlockiert(true);
}
public void act()
{
if(Greenfoot.isKeyDown("space")) {
switch (gespraechsteil) {
case 1:
drawText("Emrael", "Ich wollte dich bloß um \netwas Wasser bitten...");
gespraechsteil++;
break;
case 2:
drawText("Hydreix", "Beweise mir das, indem du mir \nversprichst, nicht mehr zu morden.");
gespraechsteil++;
break;
case 3:
drawText("Emrael", "Wenn du mir damit verzeihst \n,dann tue ich das für dich.");
gespraechsteil++;
break;
case 4:
ende();
}
}
if(Greenfoot.isKeyDown("enter")) {
ende();
}
}
private void ende()
{
loescheTextbox();
setFertig(true);
emrael.setBewegungBlockiert(false);
emrael.phase = Emrael.Phase.VierterHuettenbesuch;
gespraechsteil = 5;
}
} | [
"linhson@hotmail.de"
] | linhson@hotmail.de |
eba1755ed6db5edbd4cd128539c208c7b56fb1dc | d681cc80c86a1a26f6d833d76d798872599428f3 | /src/com/sunwah/baseapp/weixin/entity/Message/req/LinkMessage.java | 8444ee462fa3134fc282d8550ee1fcda04ff935b | [] | no_license | lwbmygithub/weixinDevelop | 1237fc9ba52753ac2b3c11a29bd0cdf15a30c690 | ea8c0ecdf7064752beb02711647ad22114e10ddd | refs/heads/master | 2020-09-26T08:04:10.215026 | 2016-09-02T02:42:44 | 2016-09-02T02:42:44 | 67,183,808 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 784 | java | package com.sunwah.baseapp.weixin.entity.Message.req;
public class LinkMessage extends BaseMessage {
/**
* 消息标题
*/
private String Title;
/**
* 消息描述
*/
private String Description;
/**
* 消息链接
*/
private String Url;
public String getTitle() {
return Title;
}
public void setTitle(String title) {
Title = title;
}
public String getDescription() {
return Description;
}
public void setDescription(String description) {
Description = description;
}
public String getUrl() {
return Url;
}
public void setUrl(String url) {
Url = url;
}
}
| [
"501312862@qq.com"
] | 501312862@qq.com |
c12eb348b1907055918c0f3ec8a63dc4f81220b7 | 280790f1f00569d2c29a86455e55e9423146f56f | /src/main/java/io/fixer/fixerio/model/RatesByDate.java | 9c3fb36d1254170b18f1ad2d1163e9b5731f767d | [] | no_license | Merkanto/Fixer | e7db2e2847fe5c3fd41b131c983d9f243768dac3 | 5ac61c9dab4c9ee9e7e566ac37982d9ac6f75f41 | refs/heads/master | 2022-12-14T06:37:55.469372 | 2020-09-13T19:25:29 | 2020-09-13T19:25:29 | 295,209,159 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,024 | java | package io.fixer.fixerio.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.util.HashMap;
@JsonIgnoreProperties(ignoreUnknown = true)
public class RatesByDate {
private String date;
private Timestamp timestamp;
private String base;
private HashMap<String, BigInteger> rates;
public RatesByDate() {
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public Timestamp getTimestamp() {
return timestamp;
}
public void setTimestamp(Timestamp timestamp) {
this.timestamp = timestamp;
}
public String getBase() {
return base;
}
public void setBase(String base) {
this.base = base;
}
public HashMap<String, BigInteger> getRates() {
return rates;
}
public void setRates(HashMap<String, BigInteger> rates) {
this.rates = rates;
}
}
| [
"miroslav.i.zhelezchev@gmail.com"
] | miroslav.i.zhelezchev@gmail.com |
c00fa2efc05faaa64b077ffcf956a5d3d0ac359f | a440057da0b221185d1c7c606da223dc971be017 | /src/main/java/com/dgg/store/controller/store/CommonApplyController.java | ffb2198696ab8e57f356f1b15820b65f59782eb8 | [] | no_license | QM-Developers/store_v1.1.1 | 94e2a5df1859bd070ecfb639a377d7b5a4540c97 | 476d494eafc0505b5d981a8ee43f4eb7e8dafb46 | refs/heads/master | 2021-01-21T14:19:33.718456 | 2017-11-15T10:33:22 | 2017-11-15T10:33:22 | 95,266,012 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,342 | java | package com.dgg.store.controller.store;
import com.dgg.store.service.store.CommonApplyService;
import com.dgg.store.util.core.constant.Constant;
import com.dgg.store.util.core.constant.RequestConstant;
import com.dgg.store.util.pojo.CommonApply;
import com.dgg.store.util.pojo.CommonApplyApprove;
import com.dgg.store.util.vo.core.PageVO;
import com.dgg.store.util.vo.core.SessionVO;
import com.dgg.store.util.vo.manage.MemberVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
/**
* 通用 申请/审批 控制器
*/
@Controller
public class CommonApplyController
{
@Autowired
private CommonApplyService service;
/**
* 上传申请用图片
*
* @param file 图片文件
* @param request 用户参数
* @return 图片的Id
*/
@RequestMapping(value = "/s/saveCommonApplyImage", method = POST, produces = {"application/json;charset=UTF-8"})
@ResponseBody
public String saveCommonApplyImage(@RequestParam(value = "img", required = false) MultipartFile file, HttpServletRequest request)
{
SessionVO sessionVO = (SessionVO) request.getAttribute(Constant.LOGININFO);
return service.insertCommonApplyImage(sessionVO, file);
}
@RequestMapping(value = "/s/listCommonMember", method = POST, produces = {RequestConstant.CONTENT_TYPE})
@ResponseBody
public String listCommonMember(HttpServletRequest request, MemberVO memberVO)
{
SessionVO sessionVO = (SessionVO) request.getAttribute(Constant.LOGININFO);
return service.listCommonMember(sessionVO, memberVO);
}
/**
* 发起通用申请
*
* @param request 用户参数
* @param apply 通用申请参数
* @return 操作的结果
*/
@RequestMapping(value = "/s/saveCommonApply", method = POST, produces = {"application/json;charset=UTF-8"})
@ResponseBody
public String saveCommonApply(HttpServletRequest request, CommonApply apply)
{
SessionVO sessionVO = (SessionVO) request.getAttribute(Constant.LOGININFO);
return service.insertCommonApply(sessionVO, apply);
}
/**
* 发起人获取申请列表
*
* @param request 用户参数
* @param apply 筛选条件
* @param pageVO 分页参数
* @return 申请列表
*/
@RequestMapping(value = "/s/listCommonApplyByProposer", method = POST, produces = {"application/json;charset=UTF-8"})
@ResponseBody
public String listCommonApplyByProposer(HttpServletRequest request, CommonApply apply, PageVO pageVO)
{
SessionVO sessionVO = (SessionVO) request.getAttribute(Constant.LOGININFO);
return service.listCommonApplyByProposer(sessionVO, apply, pageVO);
}
/**
* 审批人获取申请列表
*
* @param request 用户参数
* @param apply 筛选条件
* @param pageVO 分页参数
* @return 申请列表
*/
@RequestMapping(value = "/s/listCommonApplyByApprove", method = POST, produces = {"application/json;charset=UTF-8"})
@ResponseBody
public String listCommonApplyByApprove(HttpServletRequest request, CommonApply apply, PageVO pageVO)
{
SessionVO sessionVO = (SessionVO) request.getAttribute(Constant.LOGININFO);
return service.listCommonApplyByApprove(sessionVO, apply, pageVO);
}
/**
* 获取申请详情
*
* @param request 用户参数
* @param apply 申请Id
* @return 申请详情
*/
@RequestMapping(value = "/s/getCommonApply", method = POST, produces = RequestConstant.CONTENT_TYPE)
@ResponseBody
public String getCommonApply(HttpServletRequest request, CommonApply apply)
{
SessionVO sessionVO = (SessionVO) request.getAttribute(Constant.LOGININFO);
return service.getCommonApply(sessionVO, apply);
}
/**
* 同意申请
*
* @param request 用户参数
* @param approve 审批参数
* @return 操作的结果
*/
@RequestMapping(value = "/s/updateCommonApplyAccept", method = POST, produces = {"application/json;charset=UTF-8"})
@ResponseBody
public String updateCommonApplyAccept(HttpServletRequest request, CommonApplyApprove approve)
{
SessionVO sessionVO = (SessionVO) request.getAttribute(Constant.LOGININFO);
return service.updateCommonApplyAccept(sessionVO, approve);
}
/**
* 拒绝申请
*
* @param request 用户参数
* @param approve 审批参数
* @return 操作的结果
*/
@RequestMapping(value = "/s/updateCommonApplyRefuse", method = POST, produces = {"application/json;charset=UTF-8"})
@ResponseBody
public String updateCommonApplyRefuse(HttpServletRequest request, CommonApplyApprove approve)
{
SessionVO sessionVO = (SessionVO) request.getAttribute(Constant.LOGININFO);
return service.updateCommonApplyRefuse(sessionVO, approve);
}
}
| [
"1109440800@qq.com"
] | 1109440800@qq.com |
e087be8bbd10e87afa82fa59b1e7105915caf176 | acb05846499755ddd5bf496a1941818315e7593b | /src/main/java/edu/iis/mto/multithread/BetterRadar.java | 4ef82de664e6f622b5a4bde2402c9c97033c9b5b | [] | no_license | msulejLab/lab5_1 | d35f1324c5f23ca2fdb3a6a610c4ec8cf8c027df | 8671f5068fca3a3489bec370d04471db7267d2b8 | refs/heads/master | 2021-01-22T16:05:10.909327 | 2016-05-20T09:38:03 | 2016-05-20T09:38:03 | 59,214,313 | 0 | 0 | null | 2016-05-19T14:31:36 | 2016-05-19T14:31:35 | Java | UTF-8 | Java | false | false | 660 | java | package edu.iis.mto.multithread;
import java.util.concurrent.Executor;
public class BetterRadar {
private PatriotBattery battery;
private Executor executor;
public BetterRadar(PatriotBattery battery, Executor executor) {
this.battery = battery;
this.executor = executor;
}
public void notice(Scud enemyMissle) {
launchPatriot();
}
private void launchPatriot() {
executor.execute(new Runnable() {
@Override
public void run() {
for (int i = 0; i < 10; i++) {
battery.launchPatriot();
}
}
});
}
}
| [
"187809@edu.p.lodz.pl"
] | 187809@edu.p.lodz.pl |
f97171fa2027a62b61f9a9dbc3237137b2eef439 | f0a489388a23b557fc04a136ee93d9d9cdfdc4e9 | /testWeb2/src/dao/BaseDao.java | ec2666087d96e2884cac3803bc0d560b949cf4bd | [] | no_license | zzt17863815136/stuWeb | f027f4327d6e6729b9791276b9c44d9306c8f199 | 75eae89b951d10865649a12dce951cd84751a674 | refs/heads/master | 2021-05-05T13:05:41.472180 | 2017-09-27T02:56:08 | 2017-09-27T02:56:08 | 104,960,077 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,507 | java | package dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class BaseDao {
Connection conn=null;
Statement stat=null;
PreparedStatement pstat=null;
ResultSet rs=null;
public void getConnection(){
// 2 加载驱动
try {
Class.forName("com.mysql.jdbc.Driver");
// 3 建立连接
conn = DriverManager
.getConnection(
"jdbc:mysql://localhost:3306/170810?characterEncoding=utf-8",
"root", "123456");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void getStatement(){
getConnection();
// 4 建立sql执行器
try {
stat = conn.createStatement();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void getPreparedStatement(String sql){
getConnection();
// 4 建立sql执行器
try {
pstat = conn.prepareStatement(sql);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void closeAll(){
try {
if(conn!=null){
conn.close();}
if(stat!=null){
stat.close();}
if(pstat!=null){
pstat.close();}
if(rs!=null){
rs.close();}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"王文娟"
] | 王文娟 |
7352ba4394a8ecd379305c59773a83fc06e6a636 | 045218f685e847fde11181c8d7933da1b3fc29dd | /app/src/main/java/disstudio/top/dismessenger/Activity/StartActivity.java | 8ac7722d1a60f62fad4d0443dd3716ed11ad865a | [] | no_license | Dis2017/DisMessenger | 3d1902fb3324bae307dc7e40ad86b96fee56e0a2 | dafaebc38986f43ae8dce06f62854b774920d843 | refs/heads/master | 2020-04-21T08:35:01.467263 | 2019-02-06T15:15:07 | 2019-02-06T15:15:07 | 169,423,932 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,057 | java | package disstudio.top.dismessenger.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import disstudio.top.dismessenger.Bean.User;
import disstudio.top.dismessenger.Network.Callback.loginCallback;
import disstudio.top.dismessenger.Other.BaseActivity;
import disstudio.top.dismessenger.Other.MyApplication;
import disstudio.top.dismessenger.R;
public class StartActivity extends BaseActivity {
private TextView mTips;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_start);
mTips = findViewById(R.id.start_tips);
MyApplication.getServer().start();
}
public void setTips(final String text, final int color, final Runnable action) {
runOnUiThread(new Runnable() {
@Override
public void run() {
mTips.setText(text);
mTips.setTextColor(color);
mTips.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (action != null) {
action.run();
}
}
});
}
});
}
@Override
public void onServerConnect() {
super.onServerConnect();
setTips("服务器连接成功", Color.GREEN, null);
if (MyApplication.getCurrentUserAccount() != null && MyApplication.getCurrentUserPassword() != null) {
setTips("正在自动登录...", Color.GREEN, null);
MyApplication.getServer().login(MyApplication.getCurrentUserAccount(), MyApplication.getCurrentUserPassword(), new loginCallback() {
@Override
public void onResult(boolean result, User user) {
if (result) {
MyApplication.getUserManager().updateUser(user);
startActivity(new Intent(StartActivity.this, MainActivity.class));
finish();
} else {
setTips("自动登录失败", Color.RED, null);
startActivity(new Intent(StartActivity.this, LoginAndRegisterActivity.class));
finish();
}
}
});
} else {
setTips("跳转到登录", Color.GREEN, null);
startActivity(new Intent(StartActivity.this, LoginAndRegisterActivity.class));
finish();
}
}
@Override
public void onServerConnectFail() {
super.onServerConnectFail();
setTips("服务器连接失败(点击重连)", Color.RED, new Runnable() {
@Override
public void run() {
setTips("正在重连...", Color.YELLOW, null);
MyApplication.reconnectSerer();
}
});
}
}
| [
"2632699773@qq.com"
] | 2632699773@qq.com |
aba4f34eef95053a96abc246a3aed5568375b626 | 781709a427e29bf7eadb0c11b8a281f718e1e839 | /ViewPageFragment/src/com/example/viewpagefragment/PersonFragement.java | f72aabac4a40b9630e31b0aab7727ed126d3da93 | [] | no_license | RunCross/ifly-android-wuhu-workspace | c46c6a2bfcf5969d83898c139f393a92890e8ccb | a2d1d3e78fd1308a07cc663562a43098ee6015f9 | refs/heads/master | 2020-05-20T09:29:32.793856 | 2013-12-27T02:34:51 | 2013-12-27T02:34:51 | 13,534,808 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,010 | java | package com.example.viewpagefragment;
import java.util.ArrayList;
import com.runcross.vpfragmenutab.po.Person;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
public class PersonFragement extends Fragment {
private ArrayList<Person> persons = new ArrayList<Person>();
public interface ItemClick
{
public void onItemClick(Bundle bundle);
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@SuppressWarnings("unchecked")
@Override
public View onCreateView(LayoutInflater inflater, final ViewGroup container,
Bundle savedInstanceState) {
View fraView = inflater.inflate(R.layout.personlist, null);
ListView listView = (ListView) fraView.findViewById(R.id.personList);
// String type= getArguments().getString("type");
// persons.clear();
persons=(ArrayList) getArguments().getSerializable("datas");
listView.setAdapter(myAdapter);
final ItemClick click=(ItemClick) getActivity();
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Bundle datas = new Bundle();
// datas.putString("name", persons.get(position).getName());
// datas.putString("sex", persons.get(position).getSex());
datas.putSerializable("person", persons.get(position));
Toast.makeText(container.getContext(), "personFragment", Toast.LENGTH_SHORT).show();
System.out.println("personfragment "+persons.get(position).getName());
// System.out.println("personfragment "+datas.getSerializable("person"));
click.onItemClick(datas);
}
});
return fraView;
}
private BaseAdapter myAdapter = new BaseAdapter() {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = LayoutInflater.from(getActivity());
convertView = inflater.inflate(R.layout.personlistitem, null);
TextView txtName = (TextView) convertView
.findViewById(R.id.txtName);
TextView txtSex = (TextView) convertView.findViewById(R.id.txtSex);
Person person = persons.get(position);
txtName.setText(person.getName());
txtSex.setText(person.getSex());
return convertView;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public int getCount() {
return persons.size();
}
};
}
| [
"rujiang_g@qq.com"
] | rujiang_g@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.