blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 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 689M ⌀ | 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 131 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 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ce07809ee29762868c1af993e77be231340583f6 | ac5b6aa269bbaff60baa6e85cadfba9d5705140e | /src/main/java/org/janussistemas/wsssimulator/model/ProductionUnit.java | e2febf10fb9969306b2624b573c89da3431a70a4 | [
"Apache-2.0"
] | permissive | echacon/WSSDigitalTwinBeh | a1389e7028511a80ea17866bf5e829f017afe557 | cc27d906e18154214fcbe07ba3d13ae56b816526 | refs/heads/main | 2023-04-12T14:39:19.167797 | 2021-04-21T21:40:03 | 2021-04-21T21:40:03 | 360,317,982 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 747 | java | package org.janussistemas.wsssimulator.model;
import java.util.Vector;
public interface ProductionUnit {
public void initialize();
public Vector<Double> simul();
public Vector<Transition> disparables();
public boolean evolucion(int trans);
public String eventDetection();
public String supervisor(String event);
public boolean executeOrder(String commandint);
public void imprimirVector();
public int activeState();
// Entradas salidas
public double[] getInput();
public void setInput(double[] input);
public double[] getState();
public void setState(double[] state);
public double[] getOutput();
public void setOutput(double[] output);
public int[] getMarkingVector();
public void setMarkingVector(int[] markingVector);
}
| [
"edgarchacon@localhost"
] | edgarchacon@localhost |
fc51f3d1e567e786bb2d0ceae3287b664ac67c3d | 83a52358636593f6ca8cad40212df4c9d1ed3dcc | /Arrays/mergeSortedArrays.java | 5c814e5c8d14340365c9c39bcc7d0dd92de0b267 | [] | no_license | Trmpsanjay/LeetCode-Solutions | d13073533d1b8c57437cfdf81fd14737536aa899 | 77080dd9d367da076f7ee69523ce7c5abd5bf4ee | refs/heads/master | 2023-03-17T04:53:02.573257 | 2021-03-09T11:43:08 | 2021-03-09T11:43:08 | 269,414,173 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 790 | java | //both arrays are sorted to isme ye krenge ki last wale se compare karenge jo max hoga(dono differenrt array) use apne sahi position par le jyenge and same arra ka ho to usko ek piche khiska denge
class Solution {
public void merge(int[] nums1, int m, int[] nums2, int n) {
int i = m-1;
int j = n-1;
int k = m+n-1;
while(i>=0 && j>=0){
if(nums1[i]>nums2[j]){
nums1[k] = nums1[i];
i--;
k--;
}
else{
nums1[k] = nums2[j];
k--;
j--;
}
}
//copying remaining 2nd
while(j>=0){
nums1[k] = nums2[j];
k--;
j--;
}
}
}
| [
"noreply@github.com"
] | Trmpsanjay.noreply@github.com |
c9a65c6c2c59bccb9f163e7a91352647f199896a | 1d6c8655226ca1dbc9815e6dbb14e981eede116e | /src/gov/nv/dwss/medicaid/application/web/model/HouseHold.java | f2ed639b3890c9d9966256160d491470f2f1aabb | [] | no_license | ZepedaMcMillan/MedicaidWeb | 259fd00dd21ad48e90d1f1d70c06bc76957e5a38 | 610f97a7bb95c6f38f2fce876301ac0750b3dfd6 | refs/heads/master | 2021-01-22T18:23:49.059502 | 2014-12-12T21:03:12 | 2014-12-12T21:03:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 906 | java | package gov.nv.dwss.medicaid.application.web.model;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class HouseHold {
private HealthInsuranceInfo healthInsuranceInfo;
private HouseHoldInfo houseHoldInfo;
private OtherInfo otherInfo;
@XmlElement
public HealthInsuranceInfo getHealthInsuranceInfo() {
return healthInsuranceInfo;
}
public void setHealthInsuranceInfo(HealthInsuranceInfo healthInsuranceInfo) {
this.healthInsuranceInfo = healthInsuranceInfo;
}
@XmlElement
public HouseHoldInfo getHouseHoldInfo() {
return houseHoldInfo;
}
public void setHouseHoldInfo(HouseHoldInfo houseHoldInfo) {
this.houseHoldInfo = houseHoldInfo;
}
@XmlElement
public OtherInfo getOtherInfo() {
return otherInfo;
}
public void setOtherInfo(OtherInfo otherInfo) {
this.otherInfo = otherInfo;
}
public HouseHold() {}
}
| [
"thomas_mcmillan@intuit.com"
] | thomas_mcmillan@intuit.com |
c06a8451dcf6dfbb601d04e5a73279c165f17e41 | e692d7f7ebfd2dd6bc33bd89fd176e73bf68bded | /src/main/java/co/com/bcs/redebanclient/services/LoggingService.java | acdc2286bf9546186bd9276ff09cb9c2e5c2f50f | [] | no_license | apinedam9211/EntregaRedeban | e375f629444626486c63992d0e5ecd5e53059318 | 1d9f99121dd0c9c244a8f33a7aa72222b47a51c4 | refs/heads/main | 2023-01-02T06:52:29.417937 | 2020-10-28T20:53:17 | 2020-10-28T20:53:17 | 308,137,654 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 569 | java | package co.com.bcs.redebanclient.services;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import co.com.bcs.redebanclient.dto.AuditDTO;
import co.com.bcs.redebanclient.dto.RedebanBCSDTO;
public interface LoggingService {
String logRequest(HttpServletRequest httpServletRequest, Object body);
String logResponse(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object body);
void auditRedebanBCSService(String response, RedebanBCSDTO redebanDAO);
void auditar(AuditDTO auditDTO);
}
| [
"Invitados@POOLBOG92443.pslcol.com.co"
] | Invitados@POOLBOG92443.pslcol.com.co |
5558a3d001a3b8d7526347722b227ade73a1f819 | b997f9de6b1410fa0cf5fd9b85ce9575b3031fd7 | /CollegeApplication2.0/src/com/virtusa/cma/service/ApplicationServiceImpl.java | 49df99372af074d5930847d95e774cf22454747d | [] | no_license | avkapratwar/CMA-Application | f9343a01ad4b4164525f0af1b04772189f9740c9 | 2aff2d28ee8582591d40b9b05c50a6947debda64 | refs/heads/master | 2020-07-30T13:14:05.499692 | 2019-09-22T19:48:32 | 2019-09-22T19:48:32 | 210,246,420 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 984 | java | package com.virtusa.cma.service;
import com.virtusa.cma.dao.ApplicationDaoImpl;
import com.virtusa.cma.entity.Applicants;
public class ApplicationServiceImpl implements ApplicationServiceInterFace {
ApplicationDaoImpl applicationDaoImpl;
public ApplicationServiceImpl() {
applicationDaoImpl=new ApplicationDaoImpl();
}
@Override
public int addApplicantService(Applicants applicants) {
return applicationDaoImpl.addApplicant(applicants);
}
@Override
public Applicants[] showAllApplicantsService() {
return applicationDaoImpl.showAllApplicants();
}
@Override
public Applicants showDetailInfoService(int appNo) {
return applicationDaoImpl.showDetailInfo(appNo);
}
@Override
public String updateApplicantStatusService(int appNo, String st) {
return applicationDaoImpl.updateApplicantStatus(appNo, st);
}
@Override
public String checkApplicationStatusService(Applicants applicants) {
return applicationDaoImpl.checkApplicationStatus(applicants);
}
}
| [
"abhiapratwar@gmail.com"
] | abhiapratwar@gmail.com |
0f221d7131b9ef8b7bb6988fdb2121692c0bd8fe | 66bf9e08bfa2c45568326a56f8fc87321303c095 | /Source Code/EVEMap/src/com/evemap/objects/SolarSystem.java | b3c7b953d5032aabba031390efcd5f618313468b | [] | no_license | danielmarkavis/Verite-Space-BOBEra | 4b5675e760b6ede6f387e8f3d0c638fa2f465d2a | 5d074598560bd727999aad367b266c37fe128d46 | refs/heads/master | 2023-08-03T19:46:19.005931 | 2021-09-22T15:00:31 | 2021-09-22T15:00:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,289 | java | package com.evemap.objects;
import java.awt.Point;
import com.evemap.*;
public class SolarSystem extends Point implements Comparable<SolarSystem>{
private int id, constelationID, regionID, sovLevel;
private Alliance sovereignty;
// Use arrays in order to greatly speed up execution time of CalculateRow
public Alliance[] alliances;
public double[] influences;
private boolean station;
public SolarSystem(){}
public SolarSystem(SolarSystem ss){
this(ss.getId(), ss.getConstelationID(), ss.getRegionID(), ss.getSovLevel(), ss.hasStation(), ss.x, ss.y, ss.getSovereignty());
alliances = new Alliance[ss.alliances.length];
System.arraycopy(ss.alliances, 0, alliances, 0, alliances.length);
influences = new double[ss.influences.length];
System.arraycopy(ss.influences, 0, influences, 0, influences.length);
}
/**
*
* @param id
* @param constelationID - Id of the constellation this Solar System is in
* @param regionID - Id of the Region this Solar System is in
* @param sovLevel
* @param hasStation - Deprecated
* @param x - X position on the map
* @param y - Y position on the map
* @param sovereignty - {@link Alliance} that owns the System
*
*/
public SolarSystem(int id, int constelationID, int regionID, int sovLevel, boolean hasStation, int x, int y, Alliance sovereignty){
super(x, y);
this.id = id;
this.constelationID = constelationID;
this.regionID = regionID;
this.sovLevel = sovLevel;
this.station = hasStation;
this.sovereignty = sovereignty;
}
public void addInfluence(Alliance al, double value){
if(alliances == null){
alliances = new Alliance[1];
influences = new double[1];
alliances[0] = al;
influences[0] = value;
return;
}
boolean exists = false;
Alliance[] tempalliances = new Alliance[alliances.length];
double[] tempinfluences = new double[influences.length];
System.arraycopy(alliances, 0, tempalliances, 0, alliances.length);
System.arraycopy(influences, 0, tempinfluences, 0, influences.length);
for(int loc = 0; loc < alliances.length; loc++)
if(alliances[loc].equals(al)){
exists = true;
influences[loc] += value;
break;
}
if(!exists){
alliances = new Alliance[alliances.length + 1];
influences = new double[influences.length + 1];
System.arraycopy(tempalliances, 0, alliances, 0, tempalliances.length);
System.arraycopy(tempinfluences, 0, influences, 0, tempinfluences.length);
alliances[alliances.length - 1] = al;
influences[influences.length - 1] = value;
}
}
public void draw(InfluenceCalculator map){
if(sovereignty != null && sovereignty.getColor() == null){
sovereignty.setColor(map.nextColor(), map.getColorTable());
map.saveColor(sovereignty);
}
map.getGraphicsManager().setColor(sovereignty != null ? sovereignty.getStarColor() : MapConstants.STAR_COLOR);
if(station){
map.getGraphicsManager().fillOval(x-1, y-1, 2, 2);
/*if(sovLevel==5)
{
int[] xarray = {x-3,x+3,x};
int[] yarray = {y-3,y-3,y+3};
map.getGraphicsManager().drawPolygon(xarray,yarray,3);
}
else*/
map.getGraphicsManager().drawRect(x-2, y-2, 4, 4);
}else if (sovereignty != null){
map.getGraphicsManager().fillOval(x-2, y-2, 4, 4);
}else{
map.getGraphicsManager().fillOval(x-1, y-1, 2, 2);
}
}
public boolean hasStation() {
return station;
}
public Alliance getSovereignty() {
return sovereignty;
}
public int getId() {
return id;
}
public int getConstelationID() {
return constelationID;
}
public int getRegionID() {
return regionID;
}
public int getSovLevel() {
return sovLevel;
}
@Override
public int compareTo(SolarSystem o) {
return (id == o.getId() ? 1 : -1);
}
@Override
public int hashCode(){
return id;
}
@Override
public String toString(){
return id + " [Region: " + regionID + ", Const: " + constelationID + "] Sov: " + " by " + sovereignty.getName() +
(station ? "with" : "without") + " Station.";
}
}
| [
"compgeek223@gmail.com"
] | compgeek223@gmail.com |
b71199180a1b0dd7d37eeeef9121d6f1b653164f | ff2cb5b2b2483d4ae8a93f86df72d38cd0f118fe | /app/src/main/java/cn/kingway/launcher/DragView.java | f97be0be52a69a2eeca406c459ab9f509a35eed9 | [] | no_license | LinQingWei/Launcher | 734c207ae5abdacbd21c3d428e7edea042cfaaf5 | ea75c663af717db9143a3452cda545dedf5fcae3 | refs/heads/master | 2020-05-21T21:26:08.021079 | 2017-03-11T09:51:06 | 2017-03-11T09:51:06 | 84,647,431 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,047 | 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 cn.kingway.launcher;
import android.animation.FloatArrayEvaluator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.annotation.TargetApi;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Build;
import android.view.View;
import android.view.animation.DecelerateInterpolator;
import java.util.Arrays;
import cn.kingway.launcher.util.Thunk;
public class DragView extends View {
public static int COLOR_CHANGE_DURATION = 120;
@Thunk
static float sDragAlpha = 1f;
private Bitmap mBitmap;
private Bitmap mCrossFadeBitmap;
@Thunk Paint mPaint;
private int mRegistrationX;
private int mRegistrationY;
private Point mDragVisualizeOffset = null;
private Rect mDragRegion = null;
private DragLayer mDragLayer = null;
private boolean mHasDrawn = false;
@Thunk float mCrossFadeProgress = 0f;
ValueAnimator mAnim;
@Thunk float mOffsetX = 0.0f;
@Thunk float mOffsetY = 0.0f;
private float mInitialScale = 1f;
// The intrinsic icon scale factor is the scale factor for a drag icon over the workspace
// size. This is ignored for non-icons.
private float mIntrinsicIconScale = 1f;
@Thunk float[] mCurrentFilter;
private ValueAnimator mFilterAnimator;
/**
* Construct the drag view.
* <p>
* The registration point is the point inside our view that the touch events should
* be centered upon.
*
* @param launcher The Launcher instance
* @param bitmap The view that we're dragging around. We scale it up when we draw it.
* @param registrationX The x coordinate of the registration point.
* @param registrationY The y coordinate of the registration point.
*/
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public DragView(Launcher launcher, Bitmap bitmap, int registrationX, int registrationY,
int left, int top, int width, int height, final float initialScale) {
super(launcher);
mDragLayer = launcher.getDragLayer();
mInitialScale = initialScale;
final Resources res = getResources();
final float scaleDps = res.getDimensionPixelSize(R.dimen.dragViewScale);
final float scale = (width + scaleDps) / width;
// Set the initial scale to avoid any jumps
setScaleX(initialScale);
setScaleY(initialScale);
// Animate the view into the correct position
mAnim = LauncherAnimUtils.ofFloat(this, 0f, 1f);
mAnim.setDuration(150);
mAnim.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
final float value = (Float) animation.getAnimatedValue();
final int deltaX = (int) (-mOffsetX);
final int deltaY = (int) (-mOffsetY);
mOffsetX += deltaX;
mOffsetY += deltaY;
setScaleX(initialScale + (value * (scale - initialScale)));
setScaleY(initialScale + (value * (scale - initialScale)));
if (sDragAlpha != 1f) {
setAlpha(sDragAlpha * value + (1f - value));
}
if (getParent() == null) {
animation.cancel();
} else {
setTranslationX(getTranslationX() + deltaX);
setTranslationY(getTranslationY() + deltaY);
}
}
});
mBitmap = Bitmap.createBitmap(bitmap, left, top, width, height);
setDragRegion(new Rect(0, 0, width, height));
// The point in our scaled bitmap that the touch events are located
mRegistrationX = registrationX;
mRegistrationY = registrationY;
// Force a measure, because Workspace uses getMeasuredHeight() before the layout pass
int ms = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
measure(ms, ms);
mPaint = new Paint(Paint.FILTER_BITMAP_FLAG);
if (Utilities.ATLEAST_LOLLIPOP) {
setElevation(getResources().getDimension(R.dimen.drag_elevation));
}
}
/** Sets the scale of the view over the normal workspace icon size. */
public void setIntrinsicIconScaleFactor(float scale) {
mIntrinsicIconScale = scale;
}
public float getIntrinsicIconScaleFactor() {
return mIntrinsicIconScale;
}
public float getOffsetY() {
return mOffsetY;
}
public int getDragRegionLeft() {
return mDragRegion.left;
}
public int getDragRegionTop() {
return mDragRegion.top;
}
public int getDragRegionWidth() {
return mDragRegion.width();
}
public int getDragRegionHeight() {
return mDragRegion.height();
}
public void setDragVisualizeOffset(Point p) {
mDragVisualizeOffset = p;
}
public Point getDragVisualizeOffset() {
return mDragVisualizeOffset;
}
public void setDragRegion(Rect r) {
mDragRegion = r;
}
public Rect getDragRegion() {
return mDragRegion;
}
public float getInitialScale() {
return mInitialScale;
}
public void updateInitialScaleToCurrentScale() {
mInitialScale = getScaleX();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(mBitmap.getWidth(), mBitmap.getHeight());
}
@Override
protected void onDraw(Canvas canvas) {
@SuppressWarnings("all") // suppress dead code warning
final boolean debug = false;
if (debug) {
Paint p = new Paint();
p.setStyle(Paint.Style.FILL);
p.setColor(0x66ffffff);
canvas.drawRect(0, 0, getWidth(), getHeight(), p);
}
mHasDrawn = true;
boolean crossFade = mCrossFadeProgress > 0 && mCrossFadeBitmap != null;
if (crossFade) {
int alpha = crossFade ? (int) (255 * (1 - mCrossFadeProgress)) : 255;
mPaint.setAlpha(alpha);
}
canvas.drawBitmap(mBitmap, 0.0f, 0.0f, mPaint);
if (crossFade) {
mPaint.setAlpha((int) (255 * mCrossFadeProgress));
canvas.save();
float sX = (mBitmap.getWidth() * 1.0f) / mCrossFadeBitmap.getWidth();
float sY = (mBitmap.getHeight() * 1.0f) / mCrossFadeBitmap.getHeight();
canvas.scale(sX, sY);
canvas.drawBitmap(mCrossFadeBitmap, 0.0f, 0.0f, mPaint);
canvas.restore();
}
}
public void setCrossFadeBitmap(Bitmap crossFadeBitmap) {
mCrossFadeBitmap = crossFadeBitmap;
}
public void crossFade(int duration) {
ValueAnimator va = LauncherAnimUtils.ofFloat(this, 0f, 1f);
va.setDuration(duration);
va.setInterpolator(new DecelerateInterpolator(1.5f));
va.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
mCrossFadeProgress = animation.getAnimatedFraction();
}
});
va.start();
}
public void setColor(int color) {
if (mPaint == null) {
mPaint = new Paint(Paint.FILTER_BITMAP_FLAG);
}
if (color != 0) {
ColorMatrix m1 = new ColorMatrix();
m1.setSaturation(0);
ColorMatrix m2 = new ColorMatrix();
setColorScale(color, m2);
m1.postConcat(m2);
if (Utilities.ATLEAST_LOLLIPOP) {
animateFilterTo(m1.getArray());
} else {
mPaint.setColorFilter(new ColorMatrixColorFilter(m1));
invalidate();
}
} else {
if (!Utilities.ATLEAST_LOLLIPOP || mCurrentFilter == null) {
mPaint.setColorFilter(null);
invalidate();
} else {
animateFilterTo(new ColorMatrix().getArray());
}
}
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void animateFilterTo(float[] targetFilter) {
float[] oldFilter = mCurrentFilter == null ? new ColorMatrix().getArray() : mCurrentFilter;
mCurrentFilter = Arrays.copyOf(oldFilter, oldFilter.length);
if (mFilterAnimator != null) {
mFilterAnimator.cancel();
}
mFilterAnimator = ValueAnimator.ofObject(new FloatArrayEvaluator(mCurrentFilter),
oldFilter, targetFilter);
mFilterAnimator.setDuration(COLOR_CHANGE_DURATION);
mFilterAnimator.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
mPaint.setColorFilter(new ColorMatrixColorFilter(mCurrentFilter));
invalidate();
}
});
mFilterAnimator.start();
}
public boolean hasDrawn() {
return mHasDrawn;
}
@Override
public void setAlpha(float alpha) {
super.setAlpha(alpha);
mPaint.setAlpha((int) (255 * alpha));
invalidate();
}
/**
* Create a window containing this view and show it.
*
* @param windowToken obtained from v.getWindowToken() from one of your views
* @param touchX the x coordinate the user touched in DragLayer coordinates
* @param touchY the y coordinate the user touched in DragLayer coordinates
*/
public void show(int touchX, int touchY) {
mDragLayer.addView(this);
// Start the pick-up animation
DragLayer.LayoutParams lp = new DragLayer.LayoutParams(0, 0);
lp.width = mBitmap.getWidth();
lp.height = mBitmap.getHeight();
lp.customPosition = true;
setLayoutParams(lp);
setTranslationX(touchX - mRegistrationX);
setTranslationY(touchY - mRegistrationY);
// Post the animation to skip other expensive work happening on the first frame
post(new Runnable() {
public void run() {
mAnim.start();
}
});
}
public void cancelAnimation() {
if (mAnim != null && mAnim.isRunning()) {
mAnim.cancel();
}
}
public void resetLayoutParams() {
mOffsetX = mOffsetY = 0;
requestLayout();
}
/**
* Move the window containing this view.
*
* @param touchX the x coordinate the user touched in DragLayer coordinates
* @param touchY the y coordinate the user touched in DragLayer coordinates
*/
void move(int touchX, int touchY) {
setTranslationX(touchX - mRegistrationX + (int) mOffsetX);
setTranslationY(touchY - mRegistrationY + (int) mOffsetY);
}
void remove() {
if (getParent() != null) {
mDragLayer.removeView(DragView.this);
}
}
public static void setColorScale(int color, ColorMatrix target) {
target.setScale(Color.red(color) / 255f, Color.green(color) / 255f,
Color.blue(color) / 255f, Color.alpha(color) / 255f);
}
}
| [
"i8kobe24@gmail.com"
] | i8kobe24@gmail.com |
8d88d55f4cb61dc19ac8448ebdcb524d6c2b9ee9 | d64ef7a6ed64035e95b80f372e70e9b0faea82fd | /app/src/main/java/com/bm/main/fpl/utils/MoneyTextWatcher.java | 5b14bc9dfadb1513ef71c4525a3868107a46684e | [] | no_license | reyreyhan/scm-pay-kaltim-pt-bms | bb0edee54973f85f259b8f33a870581380ef1f45 | 5ec808513fd4b19ad36d839ef67d99c690a93cfd | refs/heads/master | 2022-12-17T16:48:19.063452 | 2020-09-17T22:29:46 | 2020-09-17T22:29:46 | 294,725,139 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,970 | java | package com.bm.main.fpl.utils;
import android.content.Context;
import android.os.Build;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextWatcher;
import android.widget.EditText;
import com.bm.main.single.ftl.utils.FormatUtil;
import java.lang.ref.WeakReference;
/**
* Created by sarif on 03/03/16.
*/
public class MoneyTextWatcher implements TextWatcher {
private final WeakReference<EditText> editTextWeakReference;
Context mContext;
public MoneyTextWatcher(Context context, EditText editText) {
editTextWeakReference = new WeakReference<EditText>(editText);
mContext = context;
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable editable) {
EditText editText = editTextWeakReference.get();
if (editText == null || editText.equals("")) return;
String s = editable.toString();
editText.removeTextChangedListener(this);
String cleanString = s.replaceAll("[%sRp,.\\\\s]", "");
try {
PreferenceClass.putString("uang", cleanString.trim());
} catch (NumberFormatException nfe) {
PreferenceClass.putString("uang", "0");
}
String formatted;
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(17)});
formatted = cleanString.trim();
} else {
editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(17)});
formatted = FormatUtil.FormatMoneySymbol(cleanString.trim());
}
editText.setText(formatted);
editText.setSelection(formatted.length());
editText.addTextChangedListener(this);
}
}
| [
"revorizaal@gmail.com"
] | revorizaal@gmail.com |
caedf452c9991f1c7a337a448e56cb8fe268ef9e | 6c9304e3298ada65fb66c6796e032e429d94e0bb | /src/com/smile/demo/stat/distribution/ShiftedGeometricDistributionDemo.java | dfee1bb8ba89ed043e76dc5f229b7aaf94bf6fef | [] | no_license | mc0514/smile_practise | 37499a1c91c8de3620e26f4c89016447d43fa8f8 | 1ed169cbcfef49dbe479818b8cd2437c01feae58 | refs/heads/master | 2021-01-22T05:05:55.421845 | 2015-07-18T09:28:54 | 2015-07-18T09:29:15 | 39,293,287 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,019 | java | /*******************************************************************************
* Copyright (c) 2010 Haifeng Li
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package com.smile.demo.stat.distribution;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.util.Hashtable;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSlider;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.smile.plot.PlotCanvas;
import com.smile.plot.BarPlot;
import com.smile.plot.Histogram;
import smile.stat.distribution.ShiftedGeometricDistribution;
/**
*
* @author Haifeng Li
*/
@SuppressWarnings("serial")
public class ShiftedGeometricDistributionDemo extends JPanel implements ChangeListener {
private JPanel optionPane;
private JPanel canvas;
private PlotCanvas pdf;
private PlotCanvas cdf;
private PlotCanvas histogram;
private JSlider probSlider;
private double prob = 0.3;
public ShiftedGeometricDistributionDemo() {
super(new BorderLayout());
Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>();
for (int i = 1; i < 10; i+=2) {
labelTable.put(new Integer(i), new JLabel(String.valueOf(i/10.0)));
}
probSlider = new JSlider(1, 9, (int) Math.round(prob * 10));
probSlider.addChangeListener(this);
probSlider.setLabelTable(labelTable);
probSlider.setMajorTickSpacing(5);
probSlider.setMinorTickSpacing(1);
probSlider.setPaintTicks(true);
probSlider.setPaintLabels(true);
optionPane = new JPanel(new FlowLayout(FlowLayout.LEFT));
optionPane.setBorder(BorderFactory.createRaisedBevelBorder());
optionPane.add(new JLabel("Probability:"));
optionPane.add(probSlider);
add(optionPane, BorderLayout.NORTH);
canvas = new JPanel(new GridLayout(1, 3));
add(canvas, BorderLayout.CENTER);
ShiftedGeometricDistribution dist = new ShiftedGeometricDistribution(prob);
double[][] p = new double[11][2];
double[][] q = new double[11][2];
for (int i = 0; i < p.length; i++) {
p[i][0] = i;
p[i][1] = dist.p(p[i][0]);
q[i][0] = i;
q[i][1] = dist.cdf(p[i][0]);
}
double[] lowerBound = {0.0, 0.0};
double[] upperBound = {10.0, 1.0};
pdf = new PlotCanvas(lowerBound, upperBound);
pdf.add(new BarPlot(p));
pdf.setTitle("PDF");
canvas.add(pdf);
cdf = new PlotCanvas(lowerBound, upperBound);
cdf.staircase(q, Color.BLACK);
cdf.setTitle("CDF");
canvas.add(cdf);
double[] data = new double[500];
for (int i = 0; i < data.length; i++) {
data[i] = dist.rand();
}
histogram = Histogram.plot(data, 10);
histogram.setTitle("Histogram");
canvas.add(histogram);
}
@Override
public void stateChanged(ChangeEvent e) {
if (e.getSource() == probSlider) {
prob = probSlider.getValue() / 10.0;
ShiftedGeometricDistribution dist = new ShiftedGeometricDistribution(prob);
double[][] p = new double[11][2];
double[][] q = new double[11][2];
for (int i = 0; i < p.length; i++) {
p[i][0] = i;
p[i][1] = dist.p(p[i][0]);
q[i][0] = i;
q[i][1] = dist.cdf(p[i][0]);
}
pdf.clear();
pdf.add(new BarPlot(p));
cdf.clear();
cdf.staircase(q, Color.BLACK);
double[] data = new double[500];
for (int i = 0; i < data.length; i++) {
data[i] = dist.rand();
}
histogram.clear();
histogram.histogram(data, 10, Color.BLUE);
}
}
@Override
public String toString() {
return "Shifted Geometric";
}
public static void main(String[] args) {
JFrame frame = new JFrame("Shifted Geometric Distribution");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.getContentPane().add(new ShiftedGeometricDistributionDemo());
frame.setVisible(true);
}
}
| [
"mc0514@163.com"
] | mc0514@163.com |
2a7b7af95279a7cb1da079a0a81e7bb89f5837db | 9d699309791f1e6bce3483ab669de78ec647d34b | /Step25_JDBC_My/src/test/frame/JTableTest.java | 1669600194fb4a44f2af5c8f208a72be2c3b46a8 | [] | no_license | sumi0717/SadClass | 9f8c59ddd61fad25349884f73d2ef045cfc92b40 | c2276a2f877135770e1d5ec5d64ab4e38229e289 | refs/heads/master | 2020-03-19T10:53:23.346618 | 2018-06-27T02:08:29 | 2018-06-27T02:08:29 | 136,409,646 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,558 | java | package test.frame;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import test.dao.MemberDao;
import test.dto.MemberDto;
public class JTableTest extends JFrame
implements ActionListener{
//필드
DefaultTableModel model;
//생성자
public JTableTest() {
//레이아웃 법칙을 BorderLayout 으로 설정
setLayout(new BorderLayout());
//테이블의 칼럼명
String[] colNames= {"번호","이름", "주소"};
//테이블에 연결할 모델 객체
model=new DefaultTableModel(colNames, 0);
//테이블 객체를 생성하고
JTable table=new JTable();
//모델을 연결하기
table.setModel(model);
//테이블을 스크롤 페널에 붙이고
JScrollPane scPane=new JScrollPane(table);
//스크롤 페널을 프레임의 가운데에 배치
add(scPane, BorderLayout.CENTER);
//페널을 만들고
JPanel northPanel=new JPanel();
//버튼을 만들어서
JButton testBtn=new JButton("테스트");
//페널에 붙이고
northPanel.add(testBtn);
//버튼이 붙은 페널을 프레임의 북쪽에 배치
add(northPanel, BorderLayout.NORTH);
//버튼의 리스너 등록
testBtn.addActionListener(this);
setBounds(100, 100, 500, 500);
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public static void main(String[] args) {
new JTableTest();
}
@Override
public void actionPerformed(ActionEvent arg0) {
// Object[] data1= {1, "김구라", "노량진"};
// Object[] data2= {2, "해골", "행신동"};
//
// Object[] data3=new Object[3];
// data3[0]=3;
// data3[1]="원숭이";
// data3[2]="상도동";
//
// model.addRow(data1);
// model.addRow(data2);
// model.addRow(data3);
MemberDao dao=MemberDao.getInstance();
List<MemberDto> list=dao.getList();
//반복문 돌면서 MemberDto 객체를 하나씩 참조해서
for(MemberDto tmp:list) {
//Object[] 객체에 회원 한명의 정보를 담아서
//Object[] data=
//{tmp.getNum(), tmp.getName(), tmp.getAddr()};
Object[] data=new Object[3];
data[0]=tmp.getNum();
data[1]=tmp.getName();
data[2]=tmp.getAddr();
//모델에 추가하기
model.addRow(data);
}
}
}
| [
"tina@gmail.com"
] | tina@gmail.com |
3c733171d42b3d5e2286fa46bc6c33e44311fa34 | bd05ca8df8b2ce2f7081eae59a5aec06f778e210 | /flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/executor/ExecutorBase.java | fb6bbf179aed07d5feed00f1e6b25a1443e3ed96 | [
"Apache-2.0",
"GPL-2.0-only",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"CC-BY-3.0",
"LGPL-2.1-only",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-other-permissive",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-jdom",
"BSD-3-Clause",
"GCC-... | permissive | 1u0/flink | 5ec19c83119c3eefc764064a3782918171949ba6 | be794ac078360cf82435dca550f8690ca7abdca2 | refs/heads/master | 2020-04-03T20:41:48.431077 | 2019-07-09T17:32:15 | 2019-07-10T09:12:25 | 155,554,452 | 1 | 0 | Apache-2.0 | 2019-08-08T14:22:01 | 2018-10-31T12:33:47 | Java | UTF-8 | Java | false | false | 2,075 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.flink.table.executor;
import org.apache.flink.annotation.Internal;
import org.apache.flink.api.dag.Transformation;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.table.delegation.Executor;
import org.apache.flink.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
/**
* An implementation of {@link Executor} that is backed by a {@link StreamExecutionEnvironment}.
*/
@Internal
public abstract class ExecutorBase implements Executor {
private static final String DEFAULT_JOB_NAME = "Flink Exec Table Job";
private final StreamExecutionEnvironment executionEnvironment;
protected List<Transformation<?>> transformations = new ArrayList<>();
public ExecutorBase(StreamExecutionEnvironment executionEnvironment) {
this.executionEnvironment = executionEnvironment;
}
@Override
public void apply(List<Transformation<?>> transformations) {
this.transformations.addAll(transformations);
}
public StreamExecutionEnvironment getExecutionEnvironment() {
return executionEnvironment;
}
protected String getNonEmptyJobName(String jobName) {
if (StringUtils.isNullOrWhitespaceOnly(jobName)) {
return DEFAULT_JOB_NAME;
} else {
return jobName;
}
}
}
| [
"ykt836@gmail.com"
] | ykt836@gmail.com |
0dbe7cd38b39b7fc52ccce23d2b2a15a6a61c537 | 48e835e6f176a8ac9ae3ca718e8922891f1e5a18 | /benchmark/training/org/apache/mahout/math/TestSingularValueDecomposition.java | 24b1c3dc43529fabaee37f91e7e6e491fa1720c8 | [] | no_license | STAMP-project/dspot-experiments | f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5 | 121487e65cdce6988081b67f21bbc6731354a47f | refs/heads/master | 2023-02-07T14:40:12.919811 | 2019-11-06T07:17:09 | 2019-11-06T07:17:09 | 75,710,758 | 14 | 19 | null | 2023-01-26T23:57:41 | 2016-12-06T08:27:42 | null | UTF-8 | Java | false | false | 8,209 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.mahout.math;
import Functions.ABS;
import Functions.PLUS;
import java.io.IOException;
import java.util.Random;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import org.apache.mahout.common.RandomUtils;
import org.junit.Test;
// To launch this test only : mvn test -Dtest=org.apache.mahout.math.TestSingularValueDecomposition
public final class TestSingularValueDecomposition extends MahoutTestCase {
private final double[][] testSquare = new double[][]{ new double[]{ 24.0 / 25.0, 43.0 / 25.0 }, new double[]{ 57.0 / 25.0, 24.0 / 25.0 } };
private final double[][] testNonSquare = new double[][]{ new double[]{ (-540.0) / 625.0, 963.0 / 625.0, (-216.0) / 625.0 }, new double[]{ (-1730.0) / 625.0, (-744.0) / 625.0, 1008.0 / 625.0 }, new double[]{ (-720.0) / 625.0, 1284.0 / 625.0, (-288.0) / 625.0 }, new double[]{ (-360.0) / 625.0, 192.0 / 625.0, 1756.0 / 625.0 } };
private static final double NORM_TOLERANCE = 1.0E-13;
@Test
public void testMoreRows() {
double[] singularValues = new double[]{ 123.456, 2.3, 1.001, 0.999 };
int rows = (singularValues.length) + 2;
int columns = singularValues.length;
Random r = RandomUtils.getRandom();
SingularValueDecomposition svd = new SingularValueDecomposition(TestSingularValueDecomposition.createTestMatrix(r, rows, columns, singularValues));
double[] computedSV = svd.getSingularValues();
assertEquals(singularValues.length, computedSV.length);
for (int i = 0; i < (singularValues.length); ++i) {
assertEquals(singularValues[i], computedSV[i], 1.0E-10);
}
}
@Test
public void testMoreColumns() {
double[] singularValues = new double[]{ 123.456, 2.3, 1.001, 0.999 };
int rows = singularValues.length;
int columns = (singularValues.length) + 2;
Random r = RandomUtils.getRandom();
SingularValueDecomposition svd = new SingularValueDecomposition(TestSingularValueDecomposition.createTestMatrix(r, rows, columns, singularValues));
double[] computedSV = svd.getSingularValues();
assertEquals(singularValues.length, computedSV.length);
for (int i = 0; i < (singularValues.length); ++i) {
assertEquals(singularValues[i], computedSV[i], 1.0E-10);
}
}
/**
* test dimensions
*/
@Test
public void testDimensions() {
Matrix matrix = new DenseMatrix(testSquare);
int m = matrix.numRows();
int n = matrix.numCols();
SingularValueDecomposition svd = new SingularValueDecomposition(matrix);
assertEquals(m, svd.getU().numRows());
assertEquals(m, svd.getU().numCols());
assertEquals(m, svd.getS().numCols());
assertEquals(n, svd.getS().numCols());
assertEquals(n, svd.getV().numRows());
assertEquals(n, svd.getV().numCols());
}
/**
* Test based on a dimension 4 Hadamard matrix.
*/
// getCovariance to be implemented
@Test
public void testHadamard() {
Matrix matrix = new DenseMatrix(new double[][]{ new double[]{ 15.0 / 2.0, 5.0 / 2.0, 9.0 / 2.0, 3.0 / 2.0 }, new double[]{ 5.0 / 2.0, 15.0 / 2.0, 3.0 / 2.0, 9.0 / 2.0 }, new double[]{ 9.0 / 2.0, 3.0 / 2.0, 15.0 / 2.0, 5.0 / 2.0 }, new double[]{ 3.0 / 2.0, 9.0 / 2.0, 5.0 / 2.0, 15.0 / 2.0 } });
SingularValueDecomposition svd = new SingularValueDecomposition(matrix);
assertEquals(16.0, svd.getSingularValues()[0], 1.0E-14);
assertEquals(8.0, svd.getSingularValues()[1], 1.0E-14);
assertEquals(4.0, svd.getSingularValues()[2], 1.0E-14);
assertEquals(2.0, svd.getSingularValues()[3], 1.0E-14);
Matrix fullCovariance = new DenseMatrix(new double[][]{ new double[]{ 85.0 / 1024, (-51.0) / 1024, (-75.0) / 1024, 45.0 / 1024 }, new double[]{ (-51.0) / 1024, 85.0 / 1024, 45.0 / 1024, (-75.0) / 1024 }, new double[]{ (-75.0) / 1024, 45.0 / 1024, 85.0 / 1024, (-51.0) / 1024 }, new double[]{ 45.0 / 1024, (-75.0) / 1024, (-51.0) / 1024, 85.0 / 1024 } });
assertEquals(0.0, Algebra.getNorm(fullCovariance.minus(svd.getCovariance(0.0))), 1.0E-14);
Matrix halfCovariance = new DenseMatrix(new double[][]{ new double[]{ 5.0 / 1024, (-3.0) / 1024, 5.0 / 1024, (-3.0) / 1024 }, new double[]{ (-3.0) / 1024, 5.0 / 1024, (-3.0) / 1024, 5.0 / 1024 }, new double[]{ 5.0 / 1024, (-3.0) / 1024, 5.0 / 1024, (-3.0) / 1024 }, new double[]{ (-3.0) / 1024, 5.0 / 1024, (-3.0) / 1024, 5.0 / 1024 } });
assertEquals(0.0, Algebra.getNorm(halfCovariance.minus(svd.getCovariance(6.0))), 1.0E-14);
}
/**
* test A = USVt
*/
@Test
public void testAEqualUSVt() {
TestSingularValueDecomposition.checkAEqualUSVt(new DenseMatrix(testSquare));
TestSingularValueDecomposition.checkAEqualUSVt(new DenseMatrix(testNonSquare));
TestSingularValueDecomposition.checkAEqualUSVt(new DenseMatrix(testNonSquare).transpose());
}
/**
* test that U is orthogonal
*/
@Test
public void testUOrthogonal() {
TestSingularValueDecomposition.checkOrthogonal(getU());
TestSingularValueDecomposition.checkOrthogonal(getU());
TestSingularValueDecomposition.checkOrthogonal(getU());
}
/**
* test that V is orthogonal
*/
@Test
public void testVOrthogonal() {
TestSingularValueDecomposition.checkOrthogonal(getV());
TestSingularValueDecomposition.checkOrthogonal(getV());
TestSingularValueDecomposition.checkOrthogonal(getV());
}
/**
* test matrices values
*/
@Test
public void testMatricesValues1() {
SingularValueDecomposition svd = new SingularValueDecomposition(new DenseMatrix(testSquare));
Matrix uRef = new DenseMatrix(new double[][]{ new double[]{ 3.0 / 5.0, 4.0 / 5.0 }, new double[]{ 4.0 / 5.0, (-3.0) / 5.0 } });
Matrix sRef = new DenseMatrix(new double[][]{ new double[]{ 3.0, 0.0 }, new double[]{ 0.0, 1.0 } });
Matrix vRef = new DenseMatrix(new double[][]{ new double[]{ 4.0 / 5.0, (-3.0) / 5.0 }, new double[]{ 3.0 / 5.0, 4.0 / 5.0 } });
// check values against known references
Matrix u = svd.getU();
assertEquals(0, Algebra.getNorm(u.minus(uRef)), TestSingularValueDecomposition.NORM_TOLERANCE);
Matrix s = svd.getS();
assertEquals(0, Algebra.getNorm(s.minus(sRef)), TestSingularValueDecomposition.NORM_TOLERANCE);
Matrix v = svd.getV();
assertEquals(0, Algebra.getNorm(v.minus(vRef)), TestSingularValueDecomposition.NORM_TOLERANCE);
}
/**
* test condition number
*/
@Test
public void testConditionNumber() {
SingularValueDecomposition svd = new SingularValueDecomposition(new DenseMatrix(testSquare));
// replace 1.0e-15 with 1.5e-15
assertEquals(3.0, svd.cond(), 1.5E-15);
}
@Test
public void testSvdHang() throws IOException, InterruptedException, ExecutionException, TimeoutException {
System.out.printf("starting hanging-svd\n");
final Matrix m = readTsv("hanging-svd.tsv");
SingularValueDecomposition svd = new SingularValueDecomposition(m);
assertEquals(0, m.minus(svd.getU().times(svd.getS()).times(svd.getV().transpose())).aggregate(PLUS, ABS), 1.0E-10);
System.out.printf("No hang\n");
}
}
| [
"benjamin.danglot@inria.fr"
] | benjamin.danglot@inria.fr |
dd6856e91156753682ed9ff50424729bdc33b2c1 | ac9a94b7098e1de02e22c5c106510a2b55d3cddc | /src/main/java/com/messages/humanactor/MakeTurn.java | 125118599ca1b05de892e9c9a7a5a0ae868aa104 | [] | no_license | mparszewski/sag-evacuation-exit | 35023bc52a3a92553b3e8b83d3430f8957d94e8e | 05aedd1160ca4d10eae693e39c495f9d12058ac5 | refs/heads/master | 2022-12-17T10:37:28.777096 | 2020-07-03T12:03:58 | 2020-07-03T12:12:02 | 272,754,118 | 0 | 0 | null | 2022-12-13T05:21:38 | 2020-06-16T16:08:44 | Java | UTF-8 | Java | false | false | 200 | java | package com.messages.humanactor;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class MakeTurn implements HumanActorMessage {
private int numberOfRound;
} | [
"k.apolinarski@gmail.com"
] | k.apolinarski@gmail.com |
a01330424b530ae504f32abd23a41ac27cb5825b | 248926e9bbe389971aeeec67f777b8439d3f3045 | /gui/src/main/java/cn/blmdz/invoice/model/RequestQueryNum.java | bf026e849e532a47e46431044deac62875fc5c0e | [] | no_license | xpoll/qxx | 1a815e0a0a987a2ff09bffd6eaa3e7bdc2282d2b | b330b7526d6d0338ced5200757139031a3e25e72 | refs/heads/master | 2021-01-18T17:46:15.660750 | 2019-03-13T03:47:06 | 2019-03-13T03:47:06 | 86,813,055 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 804 | java | package cn.blmdz.invoice.model;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
import lombok.Data;
/**
* request<br>
*
* 获取企业可用发票数量API
*
* @api ECXML.QY.KPTTXX
*
* @author yongzongyang
* @date 2017年9月17日
*/
@Data
@XStreamAlias("REQUEST_KYFPSL")
public class RequestQueryNum {
/**
* 纳税人编号
*/
@XStreamAlias("NSRSBH")
private String nsrsbh;
// ---------------- @XStreamAsAttribute ---------------
@XStreamAsAttribute
@XStreamAlias("class")
private String a;
// ---------------- @AllArgsConstructor ---------------
public RequestQueryNum(String nsrsbh) {
this.nsrsbh = nsrsbh;
this.a = this.getClass().getAnnotation(XStreamAlias.class).value();
}
}
| [
"blmdz521@126.com"
] | blmdz521@126.com |
7a6f5016de3f97145b1a4039b4830e355233c7bc | 3d87310d9c8eef2284c50a218120afc0bed5f3ec | /SampleJSF/src/java/CustomerBean.java | cb94ec484dae9755fc2ee93566d2da3ca857b2ca | [] | no_license | kamlendu/myprojects | f5c77cb44c5b99162bf314de224f3649d1ef7450 | a318494d75240e24756ee79dae967aaeb46e2ec8 | refs/heads/master | 2021-01-04T21:33:48.105471 | 2020-05-12T09:12:02 | 2020-05-12T09:12:02 | 240,766,880 | 9 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,809 | 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.
*/
import java.util.Date;
import javax.inject.Named;
import javax.enterprise.context.RequestScoped;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;
/**
*
* @author root
*/
@Named(value = "customerBean")
@RequestScoped
public class CustomerBean {
private String customerUserName;
private String customerPassword;
private String customerName = "::sadasdsadas::";
private int customerAge;
private Date regDate = new Date();
private String customerEmail;
String message;
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String showPrompt()
{
message = "hello I am here";
return message;
}
public String getCustomerEmail() {
return customerEmail;
}
public void setCustomerEmail(String customerEmail) {
this.customerEmail = customerEmail;
}
public void validateLength(FacesContext ctx, UIComponent ui, Object obj)
{
String str = (String) obj;
if(str.length()<=3)
{
((UIInput)ui).setValid(false);
FacesMessage message = new FacesMessage("Bean : The length sould not be less than 3 characters");
// message.setSeverity(FacesMessage.SEVERITY_ERROR);
ctx.addMessage(ui.getClientId(ctx), message);
}
}
public Date getRegDate() {
return regDate;
}
public void setRegDate(Date regDate) {
this.regDate = regDate;
}
/**
* Creates a new instance of CustomerBean
*/
public CustomerBean() {
}
public String getCustomerUserName() {
return customerUserName;
}
public void setCustomerUserName(String customerUserName) {
this.customerUserName = customerUserName;
}
public String getCustomerPassword() {
return customerPassword;
}
public void setCustomerPassword(String customerPassword) {
this.customerPassword = customerPassword;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public int getCustomerAge() {
return customerAge;
}
public void setCustomerAge(int customerAge) {
this.customerAge = customerAge;
}
public String showData()
{
// message="Form done";
return "ShowDataPage";
}
}
| [
"noreply@github.com"
] | kamlendu.noreply@github.com |
18ec18278734c31d4e1fc718182be397b067ab95 | f23cea24d608040480052390588de82e7c9daf70 | /src/kosta/mvc/model/dao/CustomerDAOImpl.java | 10fb43676fc60a9789f74eb1f0798db6857d9208 | [] | no_license | ruddmss/step12_goods_orderJDBC | 21dc88a2efb11b32da280cdc9c03d394aefba525 | c736f95a7643f589ef50609f5b474d8faecf79ec | refs/heads/master | 2022-12-12T21:17:43.997563 | 2020-09-14T06:17:11 | 2020-09-14T06:17:11 | 295,315,404 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 977 | java | package kosta.mvc.model.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import kosta.mvc.model.dto.Customer;
import kosta.mvc.util.DbUtil;
public class CustomerDAOImpl implements CustomerDAO {
@Override
public Customer login(String userId, String userPwd) throws SQLException {
Connection con=null;
PreparedStatement ps=null;
ResultSet rs=null;
Customer customer=null;
try {
con = DbUtil.getConnection();
ps= con.prepareStatement("select * from Customer where user_id=? and user_pwd=?");
ps.setString(1, userId);
ps.setString(2, userPwd);
rs = ps.executeQuery();
if(rs.next()) {
customer = new Customer(rs.getString(1), rs.getString(2), rs.getString(3), rs.getString(4));
}
}finally {
DbUtil.close(con, ps, rs);
}
return customer;
}
}
| [
"KOSTA@192.168.0.104"
] | KOSTA@192.168.0.104 |
b466b5695d62ba4735fa4bf4ea9753ca9613bf25 | b70f91269aabe1470a9e237eaa9bd97aac67b533 | /src/main/java/com/ft/service/system/imperfection_entry/Imperfection_entryService.java | 1618302e56eb6d9581a0ae601b3577a261bd17ab | [] | no_license | supjin/ford | e467ee6c450bb30fa30ffa71cf3fb6c46acbfec2 | 7abe4aed660d5d8ddfe530fb585e4f352907b05f | refs/heads/master | 2021-05-09T02:47:35.034160 | 2018-01-28T02:51:47 | 2018-01-28T02:51:47 | 119,221,271 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,573 | java | package com.ft.service.system.imperfection_entry;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.ft.dao.DaoSupport;
import com.ft.entity.Page;
import com.ft.util.PageData;
@Service("imperfection_entryService")
public class Imperfection_entryService {
@Resource(name = "daoSupport")
private DaoSupport dao;
/*
* 新增
*/
public void save(PageData pd)throws Exception{
dao.save("Imperfection_entryMapper.save", pd);
}
/*
* 删除
*/
public void delete(PageData pd)throws Exception{
dao.delete("Imperfection_entryMapper.delete", pd);
}
/*
* 修改
*/
public void edit(PageData pd)throws Exception{
dao.update("Imperfection_entryMapper.edit", pd);
}
/*
*列表
*/
public List<PageData> list(Page page)throws Exception{
return (List<PageData>)dao.findForList("Imperfection_entryMapper.datalistPage", page);
}
/*
*列表(全部)
*/
public List<PageData> listAll(PageData pd)throws Exception{
return (List<PageData>)dao.findForList("Imperfection_entryMapper.listAll", pd);
}
/*
*列表(全部 TOP 10)
*/
public List<PageData> listMost(PageData pd)throws Exception{
return (List<PageData>)dao.findForList("Imperfection_entryMapper.listMost", pd);
}
/*
*列表(全部 TOP 10)
*/
public List<PageData> listMostNomber(PageData pd)throws Exception{
return (List<PageData>)dao.findForList("Imperfection_entryMapper.listMostNomber", pd);
}
/*
*列表(全部 TOP 10)
*/
public List<PageData> listMostNonlve(PageData pd)throws Exception{
return (List<PageData>)dao.findForList("Imperfection_entryMapper.listMostNonlve", pd);
}
/*
*列表(全部 TOP 10)
*/
public List<PageData> listMostProducber(PageData pd)throws Exception{
return (List<PageData>)dao.findForList("Imperfection_entryMapper.listMostProducber", pd);
}
/*列表(全部 TOP 10)
*/
public List<PageData> listMostequiber(PageData pd)throws Exception{
return (List<PageData>)dao.findForList("Imperfection_entryMapper.listMostequiber", pd);
}
/*列表(全部 TOP 10)
*/
public List<PageData> listMosteprocber (PageData pd)throws Exception{
return (List<PageData>)dao.findForList("Imperfection_entryMapper.listMosteprocber", pd);
}
/*
* 通过id获取数据
*/
public PageData findById(PageData pd)throws Exception{
return (PageData)dao.findForObject("Imperfection_entryMapper.findById", pd);
}
/*
* 批量删除
*/
public void deleteAll(String[] ArrayDATA_IDS)throws Exception{
dao.delete("Imperfection_entryMapper.deleteAll", ArrayDATA_IDS);
}
}
| [
"664192354@qq.com"
] | 664192354@qq.com |
edc50c65a4ec80783c922493450540d1d64fd633 | 7a02483656beebcd897495757fcc736c353211e2 | /app/src/main/java/com/ggkjg/dto/EvaluateUserDto.java | 9a1e239a45eaf34abd98f39b0c59b9b28e56f08a | [] | no_license | Meikostar/Ggkjg | e694deba682d19d3847d3e8c028052bb87c555ea | 150e6f17614282af496681f2e7cb5db6ee0e8138 | refs/heads/master | 2020-06-29T14:08:09.658448 | 2019-09-29T09:49:33 | 2019-09-29T09:49:33 | 200,557,406 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,163 | java | package com.ggkjg.dto;
import java.io.Serializable;
/**
* 评价
*/
public class EvaluateUserDto implements Serializable {
// {
// "id": 29,
// "user_id": 9,
// "commented_type": "SMG\\Product\\Models\\Product",
// "commented_id": 2,
// "comment": "\u597d\u597d",
// "rate": {
// "default": "5"
// },
// "images": ["comment\/201812\/20\/cB4TvEVdoQqqPXj315LAV0cU6XbpSpLuNyRnejCO.jpeg",
// "comment\/201812\/20\/SquvJ78olMxViKWsj10wZGSyF4gvflteRuSmQsO5.jpeg",
// "comment\/201812\/20\/kZoE4a8BKewILbyF0ch1yLISy2h8LZYPvzZiASUn.jpeg"],
// "created_at": "2019-01-02 12:06:53",
// "flag": "90",
// "user": {
// "data": {
// "id": 9,
// "name": "\u7f8e\u5986",
// "avatar": "avatar\/201901\/02\/D2iIGaDifnH8P52UzNCj8A2FHYir0zW8v3rfvoGh.jpeg",
// "phone": "138****8000",
// "sex": 0,
// "level": 1,
// "sn": "2018121314080762225"
// }
// }
// }
private long id;
private String name;
private String avatar;
private String phone;
private int sex;
private int level;
private String sn;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public int getSex() {
return sex;
}
public void setSex(int sex) {
this.sex = sex;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public String getSn() {
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
}
| [
"admin"
] | admin |
8793093be17141fc673773abc90081116d40b0a5 | 0f1f7332b8b06d3c9f61870eb2caed00aa529aaa | /ebean/trunk/src/main/java/com/avaje/ebeaninternal/server/text/json/ReadJsonContext.java | f3f4b4c1d80d2f02170c6c3cc3e99c617bc57b74 | [] | no_license | rbygrave/sourceforge-ebean | 7e52e3ef439ed64eaf5ce48e0311e2625f7ee5ed | 694274581a188be664614135baa3e4697d52d6fb | refs/heads/master | 2020-06-19T10:29:37.011676 | 2019-12-17T22:09:29 | 2019-12-17T22:09:29 | 196,677,514 | 1 | 0 | null | 2019-12-17T22:07:13 | 2019-07-13T04:21:16 | Java | UTF-8 | Java | false | false | 7,184 | java | /**
* Copyright (C) 2009 Authors
*
* This file is part of Ebean.
*
* Ebean is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* Ebean is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Ebean; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
package com.avaje.ebeaninternal.server.text.json;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import com.avaje.ebean.bean.EntityBean;
import com.avaje.ebean.bean.EntityBeanIntercept;
import com.avaje.ebean.text.json.JsonElement;
import com.avaje.ebean.text.json.JsonReadBeanVisitor;
import com.avaje.ebean.text.json.JsonReadOptions;
import com.avaje.ebean.text.json.JsonValueAdapter;
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
import com.avaje.ebeaninternal.server.util.ArrayStack;
public class ReadJsonContext extends ReadBasicJsonContext {
private final Map<String, JsonReadBeanVisitor<?>> visitorMap;
private final JsonValueAdapter valueAdapter;
private final PathStack pathStack;
private final ArrayStack<ReadBeanState> beanState;
private ReadBeanState currentState;
public ReadJsonContext(ReadJsonSource src, JsonValueAdapter dfltValueAdapter, JsonReadOptions options) {
super(src);
this.beanState = new ArrayStack<ReadBeanState>();
if (options == null){
this.valueAdapter = dfltValueAdapter;
this.visitorMap = null;
this.pathStack = null;
} else {
this.valueAdapter = getValueAdapter(dfltValueAdapter, options.getValueAdapter());
this.visitorMap = options.getVisitorMap();
this.pathStack = (visitorMap == null || visitorMap.isEmpty()) ? null : new PathStack();
}
}
private JsonValueAdapter getValueAdapter(JsonValueAdapter dfltValueAdapter, JsonValueAdapter valueAdapter) {
return valueAdapter == null ? dfltValueAdapter : valueAdapter;
}
public JsonValueAdapter getValueAdapter() {
return valueAdapter;
}
public String readScalarValue() {
ignoreWhiteSpace();
char prevChar = nextChar();//"EOF reading scalarValue?");
if ('"' == prevChar){
return readQuotedValue();
} else {
return readUnquotedValue(prevChar);
}
}
public void pushBean(Object bean, String path, BeanDescriptor<?> beanDescriptor){
currentState = new ReadBeanState(bean, beanDescriptor);
beanState.push(currentState);
if (pathStack != null){
pathStack.pushPathKey(path);
}
}
public ReadBeanState popBeanState() {
if (pathStack != null){
String path = pathStack.peekWithNull();
JsonReadBeanVisitor<?> beanVisitor = visitorMap.get(path);
if (beanVisitor != null){
currentState.visit(beanVisitor);
}
pathStack.pop();
}
// return the current ReadBeanState as we can't call setLoadedState()
// yet. We might bind master/detail beans together via mappedBy property
// so wait until after that before calling ReadBeanStatesetLoadedState();
ReadBeanState s = currentState;
beanState.pop();
currentState = beanState.peekWithNull();
return s;
}
public void setProperty(String propertyName){
currentState.setLoaded(propertyName);
}
/**
* Got a key that doesn't map to a known property so read the json value
* which could be json primitive, object or array.
* <p>
* Provide these values to a JsonReadBeanVisitor if registered.
* </p>
*/
public JsonElement readUnmappedJson(String key) {
JsonElement rawJsonValue = ReadJsonRawReader.readJsonElement(this);
if (visitorMap != null){
currentState.addUnmappedJson(key, rawJsonValue);
}
return rawJsonValue;
}
public static class ReadBeanState implements PropertyChangeListener {
private final Object bean;
private final BeanDescriptor<?> beanDescriptor;
private final EntityBeanIntercept ebi;
private final Set<String> loadedProps;
private Map<String,JsonElement> unmapped;
private ReadBeanState(Object bean, BeanDescriptor<?> beanDescriptor) {
this.bean = bean;
this.beanDescriptor = beanDescriptor;
if (bean instanceof EntityBean){
this.ebi = ((EntityBean)bean)._ebean_getIntercept();
this.loadedProps = new HashSet<String>();
} else {
this.ebi = null;
this.loadedProps = null;
}
}
public String toString(){
return bean.getClass().getSimpleName()+" loaded:"+loadedProps;
}
/**
* Add a loaded/set property to the set of loadedProps.
*/
public void setLoaded(String propertyName){
if (ebi != null){
loadedProps.add(propertyName);
}
}
private void addUnmappedJson(String key, JsonElement value){
if (unmapped == null){
unmapped = new LinkedHashMap<String, JsonElement>();
}
unmapped.put(key, value);
}
@SuppressWarnings("unchecked")
private <T> void visit(JsonReadBeanVisitor<T> beanVisitor) {
// listen for property change events so that
// we can update the loadedProps if necessary
if (ebi != null){
ebi.addPropertyChangeListener(this);
}
beanVisitor.visit((T)bean, unmapped);
if (ebi != null){
ebi.removePropertyChangeListener(this);
}
}
public void setLoadedState(){
if (ebi != null){
// takes into account reference beans
beanDescriptor.setLoadedProps(ebi, loadedProps);
}
}
public void propertyChange(PropertyChangeEvent evt) {
String propName = evt.getPropertyName();
loadedProps.add(propName);
}
public Object getBean() {
return bean;
}
}
}
| [
"208973+rbygrave@users.noreply.github.com"
] | 208973+rbygrave@users.noreply.github.com |
e90b867295ec78ab7cad3446f92e3e1941529be3 | d862f004c2c7bdfe4f993212c522b1cbd9524243 | /src/test/java/youbenshan/SimpleConfiguration.java | c80a46090624d139549a8f090c3b109367d3371b | [] | no_license | YouBenshan/jpaQuery | bc1239ccb93aa3b11e8f4a8599334a6500f2f4a5 | a8418c0a0bda4a6295de28c38564d236bab85620 | refs/heads/master | 2021-01-10T14:40:00.540495 | 2016-03-09T09:28:59 | 2016-03-09T09:28:59 | 50,002,094 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 453 | java | package youbenshan;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.orm.jpa.EntityScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters;
@Configuration
@EnableAutoConfiguration
@EntityScan(basePackageClasses = { SimpleConfiguration.class, Jsr310JpaConverters.class })
class SimpleConfiguration {
}
| [
"benshan.you@gmail.com"
] | benshan.you@gmail.com |
a9fb954870edadca78b7ad9ec94aaaa107e46715 | dc032d477054c877d3bad86d67bf0ea4230c4a5b | /android/app/src/main/java/com/reduxapp/MainApplication.java | 6e92c98b0576d242de26cdcb8b933a1b3ad9108a | [] | no_license | anmolpandeyy/reduxTodo | 5c44520c209d24aae95b0b3dc56396b4dbefba82 | dc99af5e447c2a091632a16fc6e78f8630a9477a | refs/heads/master | 2020-04-06T19:00:32.935077 | 2018-11-15T14:04:29 | 2018-11-15T14:04:29 | 157,721,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,133 | java | package com.reduxapp;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.oblador.vectoricons.VectorIconsPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new VectorIconsPackage()
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
| [
"anmol@classpro.in"
] | anmol@classpro.in |
6070a2814fed97178492950069f00faf1175544d | cd6612c191d1b41ad9f281a42d20fe6eedaf3067 | /src/main/java/AuxBufferPerm.java | 0239e84838a645ff35f63550dbb82ba8ab35a4f4 | [] | no_license | mangeshh/coding-practice-short-notes | 3aadedcba66e7ec9ee6b8d730ce0658016156d3b | ae442dbf6ee2e2cb9a8f6d3babe895b5c3d972a6 | refs/heads/master | 2022-11-28T17:52:16.843328 | 2020-07-25T17:35:11 | 2020-07-25T17:35:11 | 282,493,126 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 573 | java | import java.util.Arrays;
public class AuxBufferPerm {
public static void function(int[] a, int[] b, int pos) {
if (pos == (b.length)) {
System.out.println(Arrays.toString(b));
return;
}
for(int i= pos; i < b.length; i++){
for(int j = i; j < a.length; j++){
b[pos] = a[j];
function(a, b, i+1);
}
}
}
public static void main(String[] args) {
int a[] = {1, 2, 3, 4, 5, 6};
int b[] = new int[2];
function(a, b, 0);
}
}
| [
"mangesh.hankare@gmail.com"
] | mangesh.hankare@gmail.com |
39b24ea5272d2bb68ed7bd7f5291940d2b8cfdf2 | 2a69a6337c3edd4070e9b88894880e64c9f5f685 | /src/main/java/org/openhab/binding/fibaro/internal/FibaroHandlerFactory.java | 5e4a0a26598f7b16287468ab5430f71bba590619 | [] | no_license | weenerberg/org.openhab.binding.fibaro | be1186467c8f3b6aa01ac42d0c1218649368a1a5 | d846e0ab0611ea9d688222bab41c06dff74c45f1 | refs/heads/master | 2021-01-20T15:51:33.755791 | 2017-05-09T22:04:20 | 2017-05-09T22:04:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,346 | java | /**
* Copyright (c) 2014-2016 by the respective copyright holders.
* 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
*/
package org.openhab.binding.fibaro.internal;
import static org.openhab.binding.fibaro.FibaroBindingConstants.SUPPORTED_THING_TYPES_UIDS;
import org.eclipse.smarthome.config.core.Configuration;
import org.eclipse.smarthome.core.thing.Bridge;
import org.eclipse.smarthome.core.thing.Thing;
import org.eclipse.smarthome.core.thing.ThingTypeUID;
import org.eclipse.smarthome.core.thing.ThingUID;
import org.eclipse.smarthome.core.thing.binding.BaseThingHandlerFactory;
import org.eclipse.smarthome.core.thing.binding.ThingHandler;
import org.openhab.binding.fibaro.FibaroBindingConstants;
import org.openhab.binding.fibaro.config.FibaroGatewayConfiguration;
import org.openhab.binding.fibaro.handler.FibaroActorThingHandler;
import org.openhab.binding.fibaro.handler.FibaroGatewayBridgeHandler;
import org.openhab.binding.fibaro.handler.FibaroSensorThingHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The {@link FibaroHandlerFactory} is responsible for creating things and thing
* handlers.
*
* @author Johan Williams - Initial contribution
*/
public class FibaroHandlerFactory extends BaseThingHandlerFactory {
private Logger logger = LoggerFactory.getLogger(FibaroHandlerFactory.class);
@Override
public Thing createThing(ThingTypeUID thingTypeUID, Configuration configuration, ThingUID thingUID,
ThingUID bridgeUID) {
if (FibaroBindingConstants.THING_TYPE_BRIDGE_GATEWAY.equals(thingTypeUID)) {
ThingUID fibaroGatewayUID = getFibaroGatewayThingUID(thingTypeUID, thingUID, configuration);
logger.debug("createThing(): {}: Creating an '{}' type Thing - {}",
FibaroBindingConstants.BRIDGE_ID_GATEWAY, thingTypeUID, fibaroGatewayUID.getId());
return super.createThing(thingTypeUID, configuration, fibaroGatewayUID, null);
} else if (FibaroBindingConstants.THING_TYPE_ACTOR.equals(thingTypeUID)) {
ThingUID fibaroActorThingUID = getFibaroActorUID(thingTypeUID, thingUID, configuration, bridgeUID);
logger.debug("createThing(): {}: Creating an '{}' type Thing - {}", FibaroBindingConstants.THING_ID_ACTOR,
thingTypeUID, fibaroActorThingUID.getId());
return super.createThing(thingTypeUID, configuration, fibaroActorThingUID, bridgeUID);
} else if (FibaroBindingConstants.THING_TYPE_SENSOR.equals(thingTypeUID)) {
ThingUID fibaroSensorThingUID = getFibaroSensorUID(thingTypeUID, thingUID, configuration, bridgeUID);
logger.debug("createThing(): {}: Creating an '{}' type Thing - {}", FibaroBindingConstants.THING_ID_ACTOR,
thingTypeUID, fibaroSensorThingUID.getId());
return super.createThing(thingTypeUID, configuration, fibaroSensorThingUID, bridgeUID);
}
throw new IllegalArgumentException(
"createThing(): The thing type " + thingTypeUID + " is not supported by the Fibaro binding.");
}
@Override
public boolean supportsThingType(ThingTypeUID thingTypeUID) {
return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID);
}
/**
* Get the Fibaro Gateway Thing UID.
*
* @param thingTypeUID
* @param thingUID
* @param configuration
* @return thingUID
*/
private ThingUID getFibaroGatewayThingUID(ThingTypeUID thingTypeUID, ThingUID thingUID,
Configuration configuration) {
if (thingUID == null) {
String ipAddress = (String) configuration.get(FibaroGatewayConfiguration.IP_ADDRESS);
String bridgeID = ipAddress.replace('.', '_');
thingUID = new ThingUID(thingTypeUID, bridgeID);
}
return thingUID;
}
/**
* Get the Actor Thing UID.
*
* @param thingTypeUID
* @param thingUID
* @param configuration
* @param bridgeUID
* @return thingUID
*/
private ThingUID getFibaroActorUID(ThingTypeUID thingTypeUID, ThingUID thingUID, Configuration configuration,
ThingUID bridgeUID) {
if (thingUID == null) {
thingUID = new ThingUID(thingTypeUID, FibaroBindingConstants.THING_ID_ACTOR, bridgeUID.getId());
}
return thingUID;
}
/**
* Get the Sensor Thing UID.
*
* @param thingTypeUID
* @param thingUID
* @param configuration
* @param bridgeUID
* @return thingUID
*/
private ThingUID getFibaroSensorUID(ThingTypeUID thingTypeUID, ThingUID thingUID, Configuration configuration,
ThingUID bridgeUID) {
if (thingUID == null) {
thingUID = new ThingUID(thingTypeUID, FibaroBindingConstants.THING_ID_SENSOR, bridgeUID.getId());
}
return thingUID;
}
@Override
protected ThingHandler createHandler(Thing thing) {
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
if (thingTypeUID.equals(FibaroBindingConstants.THING_TYPE_BRIDGE_GATEWAY)) {
FibaroGatewayBridgeHandler handler = new FibaroGatewayBridgeHandler((Bridge) thing);
// registerFibaroDiscoveryService(handler);
logger.debug("createHandler(): {}: ThingHandler created for {}", FibaroBindingConstants.BRIDGE_ID_GATEWAY,
thingTypeUID);
return handler;
} else if (thingTypeUID.equals(FibaroBindingConstants.THING_TYPE_ACTOR)) {
logger.debug("createHandler(): {}: ThingHandler created for {}", FibaroBindingConstants.THING_ID_ACTOR,
thingTypeUID);
return new FibaroActorThingHandler(thing);
} else if (thingTypeUID.equals(FibaroBindingConstants.THING_TYPE_SENSOR)) {
logger.debug("createHandler(): {}: ThingHandler created for {}", FibaroBindingConstants.THING_ID_SENSOR,
thingTypeUID);
return new FibaroSensorThingHandler(thing);
} else {
logger.debug("createHandler(): ThingHandler not found for {}", thingTypeUID);
return null;
}
}
}
| [
"williams.johan@gmail.com"
] | williams.johan@gmail.com |
06b6add7b9d85ae904dd079c65fcd4cae886c280 | 5126dabc8f5cc9cde51fbf3b28c367ad2f01b882 | /ssm_itheima_web/src/main/java/com/itheima/controller/ProductController.java | db19e879c04c4174a86a47c93b2d74cb78c7c76a | [] | no_license | weimeidanzise/ssm_project | 9c47f73bc2de027d4145e77aa9716fecaa62f8a0 | 523633830376e5e7e18292532f17afad3a35c88c | refs/heads/master | 2020-04-13T18:15:56.329727 | 2018-12-28T06:38:10 | 2018-12-28T06:38:10 | 163,368,867 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,981 | java | package com.itheima.controller;
import com.github.pagehelper.PageInfo;
import com.itheima.domain.Product;
import com.itheima.service.ProductService;
import com.sun.org.apache.xpath.internal.operations.Mod;
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.RequestParam;
import java.util.List;
@Controller
@RequestMapping("/product")
public class ProductController {
@Autowired
private ProductService productService;
@RequestMapping("/findAll")
public String findAll(@RequestParam(required = false,defaultValue = "1")Integer pageNum,
@RequestParam(required = false,defaultValue = "3") Integer pageSize, Model model,
String productName) throws Exception {
List<Product> productList = productService.findAll(pageNum,pageSize,productName);
PageInfo page=new PageInfo(productList);
model.addAttribute("productName",productName);
model.addAttribute("page",page);
System.out.println(productName+"6666666666666666666666666666666666666666");
return "product-list";
}
@RequestMapping("/findProductById")
public String findById(Model model,String id) throws Exception{
Product byId = productService.findProductById(id);
model.addAttribute("productList",byId);
return "product-list";
}
@RequestMapping("/save")
public String save(Product product) throws Exception{
if (product!=null){
productService.save(product);
}
return "redirect:/product/findAll";
}
@RequestMapping("/delete")
public String delete(String[] ids)throws Exception{
for (String id : ids) {
productService.delete(id);
}
return "redirect:/product/findAll";
}
}
| [
"1459100127@qq.com"
] | 1459100127@qq.com |
69f50549dadc0c1d756f35911979f262f47ae67c | 4aedbf2490deaaec9c7fd0eed1204bacb44975c5 | /JavaRushTasks/4.JavaCollections/src/com/javarush/task/task40/task4002/Solution.java | f16c6af92fd2bdf8daf03f232af9f0e055a2f2d1 | [] | no_license | VladislavK777/Java2 | c3319e8bf0fea59cb5ab7e58509e50166ead9afe | 8ccaf15eac8762b86bc9c9210e35e7136870ee97 | refs/heads/master | 2021-01-25T08:19:50.783370 | 2017-07-17T18:34:35 | 2017-07-17T18:34:35 | 93,755,594 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,996 | java | package com.javarush.task.task40.task4002;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.message.BasicNameValuePair;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/*
Опять POST, а не GET
*/
public class Solution {
public static void main(String[] args) throws Exception {
Solution solution = new Solution();
solution.sendPost("http://requestb.in/1h4qhvv1", "name=zapp&mood=good&locale=&id=777");
}
public void sendPost(String url, String urlParameters) throws Exception {
HttpClient client = getHttpClient();
HttpPost request = new HttpPost(url);
List<NameValuePair> list = new ArrayList<NameValuePair>();
String[] s = urlParameters.split("&");
for (int i = 0; i < s.length; i++) {
String v = s[i];
list.add(new BasicNameValuePair(v.substring(0, v.indexOf("=")), v.substring(v.indexOf("=") + 1)));
}
request.setEntity(new UrlEncodedFormEntity(list));
request.addHeader("User-Agent", "Mozilla/5.0");
HttpResponse response = client.execute(request);
System.out.println("Response Code: " + response.getStatusLine().getStatusCode());
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer result = new StringBuffer();
String responseLine;
while ((responseLine = bufferedReader.readLine()) != null) {
result.append(responseLine);
}
System.out.println("Response: " + result.toString());
}
protected HttpClient getHttpClient() {
return HttpClientBuilder.create().build();
}
}
| [
"vlad-klochkov@mail.ru"
] | vlad-klochkov@mail.ru |
16081f8943f2818d44a45b5392674d95869eb59c | 341dc83b8bc1616066b522030a9d493127afb62b | /lab12/Matrices.java | 507dcc8d9fb373b2281a3541b1c98aaf9cd13b78 | [] | no_license | dux218/CSE2 | 63cf0d5c34ee80f202def42c58c4b9f6bb33751e | 2b154fca269cebfef33aa6e50926c9e0642658c2 | refs/heads/master | 2021-01-18T21:29:03.251154 | 2015-04-29T20:57:51 | 2015-04-29T20:57:51 | 29,748,811 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,189 | java | //Duo Xu 2015/4/17
//[CSE2] lab12: Row and Column Major Matrices
import java.util.Scanner;
public class Matrices{
public static void main(String[] args){
int width1=(int)(Math.random()*6);
int width2=(int)(Math.random()*6);
int height1=(int)(Math.random()*6);
int height2=(int)(Math.random()*6);
int[][]A=new int[height1][width1];
int[][]B=new int[width1][height1];
int[][]C=new int[height2][width2];
A=increasingMatrix(width1,height1,true);
B=increasingMatrix(width1,height1,false);
C=increasingMatrix(width2,height2,true);
System.out.println("Generating a matrix with width "+width1+" and height "+height1+" :");
printMatrix(A,true);
System.out.println("Generating a matrix with width "+width1+" and height "+height1+" :");
printMatrix(B,false);
System.out.println("Generating a matrix with width "+width2+" and height "+height2+" :");
printMatrix(C,true);
addMatrix(A,true,B,false);
addMatrix(A,true,C,true);
}//main class end
//first method
public static int[][] increasingMatrix(int width, int height, boolean format){
//row major
int count1=0;
int[][] matrix1 ;
if (format==true){
matrix1=new int[height][width];
for(int i=0;i<height;i++){
for(int j=0;j<width;j++){
count1++;
matrix1[i][j]=count1;
}
}
}
else {
matrix1=new int[width][height];
for(int i=0;i<height;i++){
for(int j=0;j<width;j++){
count1++;
matrix1[j][i]=count1;
}
}
}
return matrix1;
}
//second method
public static void printMatrix( int[][] array, boolean format ){
if(array.length==0||array[0].length==0){
//if(array.length==0||array[0].length==0){
System.out.println("the array was empty!");
}
//non-empty
else{
if(format==true){
for(int i=0;i<array.length;i++){
System.out.print("[ ");
for(int j=0;j<array[0].length;j++){
System.out.print(array[i][j]+" ");
}
System.out.println("]");
}
}
else{
for(int i=0;i<array[0].length;i++){
System.out.print("[ ");
for(int j=0;j<array.length;j++){
System.out.print(array[j][i]+" ");
}
System.out.println("]");
}
}
}
}
//third method
public static int[][] translate(int[][] array){
if(array.length==0||array[0].length==0){
return null;
}
else{
int width=array.length;
int height=array[0].length;
int[][] arrayRow=new int[height][width];
for(int i=0;i<height;i++){
for(int j=0;j<width;j++){
arrayRow[i][j]=array[j][i];
}
}
return arrayRow;
}
}
//fourth method
public static int[][] addMatrix( int[][] a, boolean formata, int[][] b, boolean formatb){
int[][] array1; int[][] array2;
//a
if(formata==true){
array1=a;
}
else{
array1=translate(a);
}
//b
if(formatb==true){
array2=b;
}
else{
array2=translate(b);
}
if(array1.length!=0&&array1[0].length!=0&&array2.length!=0&&array2[0].length!=0){
int widthA=array1[0].length;
int heightA=array1.length;
int widthB=array2[0].length;
int heightB=array2.length;
if(widthA==widthB&heightA==heightB){
System.out.println("Adding two matrices.");
printMatrix(a,formata);
System.out.println("plus");
printMatrix(b,formatb);
System.out.println("Translating column major to row major input.");
System.out.println("output:");
int [][]arrayOut=new int[heightA][widthA];
for(int i=0;i<heightA;i++){
for(int j=0;j<widthA;j++){
arrayOut[i][j]=array1[i][j]+array2[i][j];
}
}
printMatrix(arrayOut,true);
return arrayOut;
}
else{
System.out.println("Unable to add input matrices.");
return null;
}
}
else{
System.out.println("Unable to add input matrices.");
return null;
}
}
}//public class | [
"553734336@qq.com"
] | 553734336@qq.com |
9cabba183bfce760c5cab94e70e38d3bfd8aef89 | 3a24926bb0c8c8d3fbc0e46db975259a38e58a1d | /src/cn/itcast/ssm/mapper/UUserMapper.java | ca8c8b0330db8806e9147eceaa7139ff4c0557ef | [] | no_license | luoxianjiao/SpringMVC-Mybatis-Shiro-Redis-AdminLTE | 733c11276c839541155a54b13e1b2b510a5143a4 | 37a1007298582302cdf2cff3e0da85021b1b0be1 | refs/heads/master | 2020-04-28T02:57:19.249257 | 2019-03-11T03:08:21 | 2019-03-11T03:08:21 | 174,917,763 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 805 | java | package cn.itcast.ssm.mapper;
import cn.itcast.ssm.po.UUser;
import cn.itcast.ssm.po.UUserExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface UUserMapper {
int countByExample(UUserExample example);
int deleteByExample(UUserExample example);
int deleteByPrimaryKey(Long userId);
int insert(UUser record);
int insertSelective(UUser record);
List<UUser> selectByExample(UUserExample example);
UUser selectByPrimaryKey(Long userId);
int updateByExampleSelective(@Param("record") UUser record, @Param("example") UUserExample example);
int updateByExample(@Param("record") UUser record, @Param("example") UUserExample example);
int updateByPrimaryKeySelective(UUser record);
int updateByPrimaryKey(UUser record);
} | [
"gototang@qq.com"
] | gototang@qq.com |
5d610a0e3c38a25f4fe641d7d3bda9f23b6883e2 | 41dd7295526eb61a693571b2b2b96bcd9bc3c878 | /app/src/main/java/com/zhihuihezhang/zj/jiaxing/net/ProgressDownloader.java | cef8888241f78349937d08b6d4ff6693ec298951 | [] | no_license | m00219907/zhihuihezhang | 948955e07a6600c75dd6c1105455478151c7d198 | 24ef4774366bee4cf9850c58306a859d21862c16 | refs/heads/master | 2021-01-19T03:25:10.492584 | 2017-04-10T09:54:00 | 2017-04-10T09:54:00 | 87,311,219 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,197 | java | package com.zhihuihezhang.zj.jiaxing.net;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.ResponseBody;
public class ProgressDownloader {
public static final String TAG = "ProgressDownloader";
private ProgressResponseBody.ProgressResponseListener progressListener;
private String url;
private OkHttpClient client;
private File destination;
private Call call;
public ProgressDownloader(String url, File destination, ProgressResponseBody.ProgressResponseListener progressListener) {
this.url = url;
this.destination = destination;
this.progressListener = progressListener;
//在下载、暂停后的继续下载中可复用同一个client对象
client = getProgressClient();
}
//每次下载需要新建新的Call对象
private Call newCall(long startPoints) {
Request request = new Request.Builder()
.url(url)
.header("RANGE", "bytes=" + startPoints + "-")//断点续传要用到的,指示下载的区间
.build();
return client.newCall(request);
}
public OkHttpClient getProgressClient() {
// 拦截器,用上ProgressResponseBody
Interceptor interceptor = new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
};
return new OkHttpClient.Builder()
.addNetworkInterceptor(interceptor)
.build();
}
// startsPoint指定开始下载的点
public void download(final long startsPoint) {
call = newCall(startsPoint);
call.enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}
@Override
public void onResponse(Call call, Response response) throws IOException {
save(response, startsPoint);
}
});
}
public void pause() {
if(call!=null){
call.cancel();
}
}
private void save(Response response, long startsPoint) {
ResponseBody body = response.body();
InputStream in = body.byteStream();
FileChannel channelOut = null;
// 随机访问文件,可以指定断点续传的起始位置
RandomAccessFile randomAccessFile = null;
try {
randomAccessFile = new RandomAccessFile(destination, "rwd");
//Chanel NIO中的用法,由于RandomAccessFile没有使用缓存策略,直接使用会使得下载速度变慢,亲测缓存下载3.3秒的文件,用普通的RandomAccessFile需要20多秒。
channelOut = randomAccessFile.getChannel();
// 内存映射,直接使用RandomAccessFile,是用其seek方法指定下载的起始位置,使用缓存下载,在这里指定下载位置。
MappedByteBuffer mappedBuffer = channelOut.map(FileChannel.MapMode.READ_WRITE, startsPoint, body.contentLength());
byte[] buffer = new byte[1024];
int len;
while ((len = in.read(buffer)) != -1) {
mappedBuffer.put(buffer, 0, len);
}
} catch (Exception e) {
e.printStackTrace();
}finally {
try {
in.close();
if (channelOut != null) {
channelOut.close();
}
if (randomAccessFile != null) {
randomAccessFile.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
| [
"747959177@qq.com"
] | 747959177@qq.com |
744bbad41a88029eaa7ea76ab646c45c1b649181 | c2f477734c5d65d8e184c8fb8904ce331781e227 | /app/src/main/java/br/com/hbsis/tonaarea/util/Validator.java | b502a766fa6efa91affd4191554f61bebe5f5c3f | [] | no_license | RafaelPegoretti/ToNaArea | f5055a2561be9193656b41554721d58cfc70ae58 | f0e8678a1d1e46b2925bb650207b25d391aac83e | refs/heads/master | 2020-04-24T09:26:05.961535 | 2019-04-08T14:32:43 | 2019-04-08T14:32:43 | 171,862,541 | 0 | 0 | null | 2019-04-08T14:32:44 | 2019-02-21T11:51:18 | Java | UTF-8 | Java | false | false | 359 | java | package br.com.hbsis.tonaarea.util;
public class Validator {
boolean isValid;
String message;
public Validator(boolean isValid, String message) {
this.isValid = isValid;
this.message = message;
}
public boolean isValid() {
return isValid;
}
public String getMessage() {
return message;
}
}
| [
"rafael.pegoretti@hbsis.com.br"
] | rafael.pegoretti@hbsis.com.br |
458d860d31ff65a645e3dc0ac02d4b9a98c61ab2 | d509a7aae5ebb8407361b6fb772e2bc7c66d6c72 | /Console.java | 67a7c7e86f162641bcb97c5c99ef9976d4b8cdfe | [] | no_license | Osambezy/cronof2 | 1b3c50fbafc35d094716bf9d3ee38bcdaad48c69 | d6f1c29de0b1b490c236904890edc73483b06b44 | refs/heads/master | 2021-01-22T23:10:54.935519 | 2014-04-29T13:43:10 | 2014-04-29T13:43:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,375 | java | import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
public class Console {
private static int pos_y;
private static Info[] info;
private static int[] infotime;
private final static int infodelay = 300; //60~1 sec
private final static int infoamount = 20;
public static boolean open = false;
// evtl current info amount - schont die for schleife
public Console(int y) {
pos_y = y;
info = new Info[infoamount];
infotime = new int[infoamount];
}
public static void print(String str) {
for (int i = infoamount - 1; i >= 0; --i) {
if (i + 1 < infoamount) {
// Verschiebe alles nach oben, wenn neue Nachricht
info[i + 1] = info[i];
if(info[i]!=null && info[i+1]!=null)
if(info[i].getType()==false)
info[i+1].setY(pos_y - 20 * (i+1) - 11);
}
}
info[0] = new Info(str, 9, pos_y -11, 12, infodelay, false);
}
public static void print(String str, int x, int y, int fontsize, int time)
{
for (int i = infoamount - 1; i >= 0; --i) {
if (i + 1 < infoamount) {
info[i + 1] = info[i];
}
}
info[0] = new Info(str, x, y, fontsize, time, true);
}
public static void update()
{
for (int i = 0; i < infoamount; i++) {
if (info[i] != null)
info[i].time();}
}
public static void paint(Graphics g) {
for (int i = 0; i < infoamount; i++) {
//infotime[i]--;
if (info[i] != null)
if (info[i].getTime() > 0)
{
g.setFont(new Font("Arial", Font.PLAIN, info[i].getFontSize()));
g.setColor(Color.black);
g.drawString(info[i].getText(), info[i].getX() , info[i].getY());
g.setColor(Color.white);
g.drawString(info[i].getText(), info[i].getX() , info[i].getY()+1);
}
}
}
}
class Info
{
private String text;
private int x;
private int y;
private int fontsize;
private int time;
private Boolean type;
public Info(String itext, int ix, int iy, int ifontsize, int itime, Boolean itype)
{
text=itext;
x=ix;
y=iy;
fontsize=ifontsize;
time=itime;
type=itype;
}
public String getText()
{
return text;
}
public int getTime()
{
return time;
}
public void time()
{
time--;
}
public int getX()
{
return x;
}
public int getY()
{
return y;
}
public void setY(int iy)
{
y=iy;
}
public int getFontSize()
{
return fontsize;
}
public Boolean getType()
{
return type;
}
}
| [
"andi@wafna.de"
] | andi@wafna.de |
b149baf9b82247beabf061127ab26956926fb9a1 | 8d563a038ad4c3a2b3a1ae5a4ddfe4d33f3235b7 | /mapbox/libandroid-telemetry/src/main/java/com/mapbox/services/android/telemetry/TelemetryLocationReceiver.java | c7d9eb6bc35ab347d96157c3f72f36806121e85c | [
"MIT"
] | permissive | RepoForks/mapbox-java | b84327295f83bdb85ca8adffc51d3b33f825843c | 54a56b5114b1ee9ba664ca473df122beb0a248d3 | refs/heads/master | 2020-04-06T04:43:57.363292 | 2017-02-22T19:46:23 | 2017-02-22T19:46:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,151 | java | package com.mapbox.services.android.telemetry;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.location.LocationManager;
import android.util.Log;
/**
* The TelemetryService will register for updates sent to this TelemetryLocationReceiver.
* Messages are sent locally using a LocalBroadcastManager.
*/
public class TelemetryLocationReceiver extends BroadcastReceiver {
private static final String LOG_TAG = TelemetryLocationReceiver.class.getSimpleName();
public static final String INTENT_STRING =
"com.mapbox.services.android.telemetry.location.TelemetryLocationReceiver";
@Override
public void onReceive(Context context, Intent intent) {
Log.v(LOG_TAG, "Event received.");
// See https://github.com/mapbox/mapbox-gl-native/issues/6934
if (intent == null || intent.getExtras() == null) {
return;
}
Location location = (Location) intent.getExtras().get(LocationManager.KEY_LOCATION_CHANGED);
if (location != null) {
MapboxTelemetry.getInstance().addLocationEvent(location);
}
}
}
| [
"noreply@github.com"
] | RepoForks.noreply@github.com |
b11ff308b11f432305be192de0c4354fcd1bf260 | 96b7952d51e45a40223d872d0d79cc9f7a0d6600 | /src/javascript/Main.java | c9ca207011296e0f8f1284e018313321d4965043 | [] | no_license | letorn/mytest | bf395f66587b71e140c167a9516666a6eeeab6cc | e40c2f144c9edda859c37b729f73acc584d7f6bf | refs/heads/master | 2021-01-10T08:40:40.949386 | 2016-04-14T08:09:22 | 2016-04-14T08:09:22 | 50,896,662 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 434 | java | package javascript;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
public class Main {
public static void main(String[] args) throws Exception {
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("javascript");
engine.put("性别", 1);
engine.eval("性别 = 性别 +1");
Object val = engine.get("性别");
System.out.println(val);
}
}
| [
"letorn@163.com"
] | letorn@163.com |
c3c2f1d87577e916fbc52bb7f0cab1da608e4fbf | 24e84f77e0a5a8afab3348bfe1e6a79a524355d7 | /src/com/kn/dao/CommonDao.java | be91327f429aa378637f6bf406d7b9c251218f17 | [] | no_license | davidsky11/CxfServer | 41de47dc25f52d8156e09649f51b17d1455965b8 | e28b4b5d911cc9a3854acf68fe66a2ab720fef23 | refs/heads/master | 2016-09-11T02:03:06.660926 | 2014-08-15T07:35:52 | 2014-08-15T07:35:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 893 | java | package com.kn.dao;
import java.util.List;
public interface CommonDao<T>{
/**
* 将对象数据插入到数据库中
* @param obj
* @throws Exception
*/
void create(T obj) throws Exception;
/**
* 将对象数据更新到数据库中
* @param obj
* @throws Exception
*/
void update(T obj) throws Exception;
/**
* 从数据库中删除对象数据
* @param obj
* @throws Exception
*/
void delete(T obj) throws Exception;
/**
* 通过id获取对象
* @param clazz
* @param id
* @return
* @throws Exception
*/
T get(Class <? extends T> clazz,Object id) throws Exception;
/**
* 查询数据库中对象的所有数据生成对象集合
* @param clazz
* @return
* @throws Exception
*/
List<T> getAll(Class <? extends T> clazz) throws Exception;
}
| [
"kevin103@foxconn.com"
] | kevin103@foxconn.com |
c106272e9cb917d8735340ea062265f0b5e8f498 | e318d71c8673795893d43e9802df60f0b853c74c | /gen/src/test/java/org/jboss/shrinkwrap/descriptor/impl/jboss51/RemoteBindingTypeImplTestCase.java | 6e1c0f10db45a1c6fddde3d8e85c2c000ec30948 | [] | no_license | ralfbattenfeld/descriptors | 7468e458f48cb918ee1581384c1c179bcdf96d26 | 37535bcb17434ab9a3263928afc88f83e759f091 | refs/heads/master | 2021-01-21T01:38:49.820940 | 2011-07-13T17:20:54 | 2011-07-13T17:20:54 | 1,726,318 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,426 | java | package org.jboss.shrinkwrap.descriptor.impl.jboss51;
import org.jboss.shrinkwrap.descriptor.spi.Node;
import org.jboss.shrinkwrap.descriptor.gen.TestDescriptorImpl;
import org.jboss.shrinkwrap.descriptor.api.Descriptors;import org.junit.Test;
import static org.junit.Assert.*;
import org.jboss.shrinkwrap.descriptor.api.jboss51.RemoteBindingType;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.jboss.shrinkwrap.descriptor.api.Child;
import org.jboss.shrinkwrap.descriptor.impl.base.XMLDate;
import org.jboss.shrinkwrap.descriptor.impl.base.XMLExporter;
import org.jboss.shrinkwrap.descriptor.impl.base.Strings;
import org.jboss.shrinkwrap.descriptor.spi.DescriptorExporter;
public class RemoteBindingTypeImplTestCase
{
@Test
public void testDescription() throws Exception
{
TestDescriptorImpl provider = new TestDescriptorImpl("test");
RemoteBindingType<TestDescriptorImpl> type = new RemoteBindingTypeImpl<TestDescriptorImpl>(provider, "remote-bindingType", provider.getRootNode());
type.setDescription("value1");
type.setDescription("value2");
type.setDescriptionList("value3", "value4");
assertTrue(type.getDescriptionList().size() == 4);
assertEquals(type.getDescriptionList().get(0), "value1");
assertEquals(type.getDescriptionList().get(1), "value2");
assertEquals(type.getDescriptionList().get(2), "value3");
assertEquals(type.getDescriptionList().get(3), "value4");
type.removeAllDescription();
assertTrue(type.getDescriptionList().size() == 0);
}
@Test
public void testJndiName() throws Exception
{
TestDescriptorImpl provider = new TestDescriptorImpl("test");
RemoteBindingType<TestDescriptorImpl> type = new RemoteBindingTypeImpl<TestDescriptorImpl>(provider, "remote-bindingType", provider.getRootNode());
type.setJndiName("test");
assertEquals(type.getJndiName(), "test");
type.removeJndiName();
assertNull(type.getJndiName());
}
@Test
public void testClientBindUrl() throws Exception
{
TestDescriptorImpl provider = new TestDescriptorImpl("test");
RemoteBindingType<TestDescriptorImpl> type = new RemoteBindingTypeImpl<TestDescriptorImpl>(provider, "remote-bindingType", provider.getRootNode());
type.setClientBindUrl("test");
assertEquals(type.getClientBindUrl(), "test");
type.removeClientBindUrl();
assertNull(type.getClientBindUrl());
}
@Test
public void testInterceptorStack() throws Exception
{
TestDescriptorImpl provider = new TestDescriptorImpl("test");
RemoteBindingType<TestDescriptorImpl> type = new RemoteBindingTypeImpl<TestDescriptorImpl>(provider, "remote-bindingType", provider.getRootNode());
type.setInterceptorStack("test");
assertEquals(type.getInterceptorStack(), "test");
type.removeInterceptorStack();
assertNull(type.getInterceptorStack());
}
@Test
public void testInvokerName() throws Exception
{
TestDescriptorImpl provider = new TestDescriptorImpl("test");
RemoteBindingType<TestDescriptorImpl> type = new RemoteBindingTypeImpl<TestDescriptorImpl>(provider, "remote-bindingType", provider.getRootNode());
type.setInvokerName("test");
assertEquals(type.getInvokerName(), "test");
type.removeInvokerName();
assertNull(type.getInvokerName());
}
}
| [
"ralf.battenfeld@bluewin.ch"
] | ralf.battenfeld@bluewin.ch |
7420e19ed174485282b9a5922a156c21bc16b09d | 084448eb5b1a9f20e200954e6a3deead5c430aab | /src/com/yl/SubtractProductAndSum.java | 25e58bb5c8e75b5e4a4d4d8a345db7ccedd059fd | [] | no_license | YLongGe/Algorithm | db93222cef662e28ba27e5cf60ebb3e523ecdd35 | 49a73530b9cce8663259e6d77def281dc5d6aa62 | refs/heads/master | 2022-06-11T19:10:33.308651 | 2022-06-08T07:06:18 | 2022-06-08T07:06:18 | 192,141,134 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,262 | java | package com.yl;
/**
* 给你一个整数 n,请你帮忙计算并返回该整数「各位数字之积」与「各位数字之和」的差。
*
*
*
* 示例 1:
*
* 输入:n = 234
* 输出:15
* 解释:
* 各位数之积 = 2 * 3 * 4 = 24
* 各位数之和 = 2 + 3 + 4 = 9
* 结果 = 24 - 9 = 15
* 示例 2:
*
* 输入:n = 4421
* 输出:21
* 解释:
* 各位数之积 = 4 * 4 * 2 * 1 = 32
* 各位数之和 = 4 + 4 + 2 + 1 = 11
* 结果 = 32 - 11 = 21
*
*
* 提示:
*
* 1 <= n <= 10^5
*
* 来源:力扣(LeetCode)
* 链接:https://leetcode.cn/problems/subtract-the-product-and-sum-of-digits-of-an-integer
* 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
* @author yanglong
* @date 2022/6/8
*/
public class SubtractProductAndSum {
public static void main(String[] args) {
System.out.println(subtractProductAndSum(234));
}
public static int subtractProductAndSum(int n) {
if( n == 0 ) return 0;
// 和
int sum = 0;
// 积
int mul = 1;
while (n > 0) {
sum += (n % 10);
mul *= (n % 10);
n = n/10;
}
return mul - sum;
}
}
| [
"ekxixas@dingtalk.com"
] | ekxixas@dingtalk.com |
bdca65724f6877aae71fad38184b9cffc89cac12 | 80b9733c541c2ad856520fe1ba61b42b82e78217 | /src/orca/StrategySecond/IStrategy.java | 73096617a84cebed9b8cb00f7384277d0a824f91 | [] | no_license | markhuang19994/designpattern-1 | 6bd3dc4f8d15cbf6acba771247fcc8b3f996b395 | a8c119d262fb70088de135d4c02aa2e795f49b61 | refs/heads/master | 2020-04-28T17:32:52.934924 | 2018-11-25T05:09:16 | 2018-11-25T05:09:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 95 | java | package orca.StrategySecond;
public interface IStrategy {
public int calculate(int km);
}
| [
"orcarex1@hotmail.com"
] | orcarex1@hotmail.com |
228a34ce46ac6e5ff36c995f47ba917776d461f9 | 6d3b8c30f9d873683287ae1843633158e6ba59f5 | /nio-impl/src/main/java/org/xnio/nio/QueuedNioTcpServer2.java | cc2ca3208914210b32d4603a69ae64eb62a462d0 | [
"Apache-2.0"
] | permissive | xnio/xnio | acbb76424e3bdaa76f792a2049ae433426c2af38 | 636b1d5b4a063d2834f86c98ece075472f150b5c | refs/heads/3.x | 2023-09-05T12:01:38.728059 | 2023-08-17T04:10:36 | 2023-08-17T04:10:36 | 820,836 | 258 | 115 | Apache-2.0 | 2023-08-30T14:08:20 | 2010-08-06T06:03:15 | Java | UTF-8 | Java | false | false | 5,986 | java | /*
* JBoss, Home of Professional Open Source.
* Copyright 2019 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.xnio.nio;
import java.io.IOException;
import java.net.SocketAddress;
import java.nio.channels.ClosedChannelException;
import java.util.ArrayList;
import java.util.List;
import java.util.Queue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import org.wildfly.common.Assert;
import org.xnio.ChannelListener;
import org.xnio.ChannelListeners;
import org.xnio.Option;
import org.xnio.StreamConnection;
import org.xnio.XnioExecutor;
import org.xnio.XnioIoThread;
import org.xnio.channels.AcceptListenerSettable;
import org.xnio.channels.AcceptingChannel;
final class QueuedNioTcpServer2 extends AbstractNioChannel<QueuedNioTcpServer2> implements AcceptingChannel<StreamConnection>, AcceptListenerSettable<QueuedNioTcpServer2> {
private final NioTcpServer realServer;
private final List<Queue<StreamConnection>> acceptQueues;
private final Runnable acceptTask = this::acceptTask;
private volatile ChannelListener<? super QueuedNioTcpServer2> acceptListener;
QueuedNioTcpServer2(final NioTcpServer realServer) {
super(realServer.getWorker());
this.realServer = realServer;
final NioXnioWorker worker = realServer.getWorker();
final int cnt = worker.getIoThreadCount();
acceptQueues = new ArrayList<>(cnt);
for (int i = 0; i < cnt; i ++) {
acceptQueues.add(new LinkedBlockingQueue<>());
}
realServer.getCloseSetter().set(ignored -> invokeCloseHandler());
realServer.getAcceptSetter().set(ignored -> handleReady());
}
public StreamConnection accept() throws IOException {
final WorkerThread current = WorkerThread.getCurrent();
if (current == null) {
return null;
}
final Queue<StreamConnection> socketChannels = acceptQueues.get(current.getNumber());
final StreamConnection connection = socketChannels.poll();
if (connection == null) {
if (! realServer.isOpen()) {
throw new ClosedChannelException();
}
}
return connection;
}
public ChannelListener<? super QueuedNioTcpServer2> getAcceptListener() {
return acceptListener;
}
public void setAcceptListener(final ChannelListener<? super QueuedNioTcpServer2> listener) {
this.acceptListener = listener;
}
public ChannelListener.Setter<QueuedNioTcpServer2> getAcceptSetter() {
return new Setter<QueuedNioTcpServer2>(this);
}
public SocketAddress getLocalAddress() {
return realServer.getLocalAddress();
}
public <A extends SocketAddress> A getLocalAddress(final Class<A> type) {
return realServer.getLocalAddress(type);
}
public void suspendAccepts() {
realServer.suspendAccepts();
}
public void resumeAccepts() {
realServer.resumeAccepts();
}
public boolean isAcceptResumed() {
return realServer.isAcceptResumed();
}
public void wakeupAccepts() {
realServer.wakeupAccepts();
}
public void awaitAcceptable() {
throw Assert.unsupported();
}
public void awaitAcceptable(final long time, final TimeUnit timeUnit) {
throw Assert.unsupported();
}
@Deprecated
public XnioExecutor getAcceptThread() {
return getIoThread();
}
public void close() throws IOException {
realServer.close();
}
public boolean isOpen() {
return realServer.isOpen();
}
public boolean supportsOption(final Option<?> option) {
return realServer.supportsOption(option);
}
public <T> T getOption(final Option<T> option) throws IOException {
return realServer.getOption(option);
}
public <T> T setOption(final Option<T> option, final T value) throws IllegalArgumentException, IOException {
return realServer.setOption(option, value);
}
void handleReady() {
final NioTcpServer realServer = this.realServer;
NioSocketStreamConnection connection;
try {
connection = realServer.accept();
} catch (ClosedChannelException e) {
return;
}
XnioIoThread thread;
if (connection != null) {
int i = 0;
final Runnable acceptTask = this.acceptTask;
do {
thread = connection.getIoThread();
acceptQueues.get(thread.getNumber()).add(connection);
thread.execute(acceptTask);
if (++i == 128) {
// prevent starvation of other acceptors
return;
}
try {
connection = realServer.accept();
} catch (ClosedChannelException e) {
return;
}
} while (connection != null);
}
}
void acceptTask() {
final WorkerThread current = WorkerThread.getCurrent();
assert current != null;
final Queue<StreamConnection> queue = acceptQueues.get(current.getNumber());
ChannelListeners.invokeChannelListener(QueuedNioTcpServer2.this, getAcceptListener());
if (! queue.isEmpty()) {
current.execute(acceptTask);
}
}
}
| [
"david.lloyd@redhat.com"
] | david.lloyd@redhat.com |
abc4d73d65cdaa8ead626acf02bd487eb8b5b77b | 95d958f70e05ac3733d1b04d40507fddd0013968 | /Common/src/main/java/com/uzm/common/controllers/LagController.java | f763a5f3c8d903ef2701cdf2c47f954335196ba4 | [
"MIT"
] | permissive | JaelysonM/uzm-common | 9fff352599c6e34ed7d27cd7df7c8b307cd49992 | c707edf675a4efc74ba4717866cdb7c0bf8b9a9f | refs/heads/master | 2023-06-20T18:53:05.850067 | 2021-07-10T19:37:50 | 2021-07-10T19:37:50 | 374,212,751 | 1 | 1 | MIT | 2021-06-05T21:47:15 | 2021-06-05T21:09:33 | Java | UTF-8 | Java | false | false | 898 | java | package com.uzm.common.controllers;
import lombok.Getter;
import lombok.Setter;
/**
* A complete and upgradable plugin for <strong>any</strong> use for any project..
*
* @author JotaMPê (UzmStudio)
* @version 2.0.6
*/
@Getter
@Setter
public class LagController implements Runnable {
private int tick;
private double tps;
private double lastFinish;
private boolean lowTps;
@Override
public void run() {
tick++;
if (tick == 20) {
tps = tick;
tick = 0;
if (lastFinish + 1000 < System.currentTimeMillis()) tps /= (System.currentTimeMillis() - lastFinish) / 1000;
lastFinish = System.currentTimeMillis();
if (tps < 15) {
if (!lowTps)
lowTps = true;
}
} else {
if (lowTps)
lowTps = false;
}
}
}
| [
"jaelysonmartins@gmail.com"
] | jaelysonmartins@gmail.com |
b9030750118c7b36f6096d3e0d762dd3843019df | 3184322437170aa16e7d105abab60fc220b83c36 | /src/FromPythonCodeIntoJavaCode.java | 7623df8da22fd772ec3ed5f43802a7ece26191e0 | [] | no_license | Dhoni77/stepik-adaptive-java | 7b52413b4d095d21f2182298e468c43930b7312e | 0b98f4650925983b340cc8596241516b8785b4f9 | refs/heads/master | 2022-09-20T15:51:18.337253 | 2020-06-05T18:39:38 | 2020-06-05T18:39:38 | 284,483,676 | 1 | 0 | null | 2020-08-02T15:00:51 | 2020-08-02T15:00:50 | null | UTF-8 | Java | false | false | 1,697 | java | import java.util.*;
import java.util.stream.Stream;
//You decided to write a converter from Python code into Java code. As CamelCase names are standard in Java, you decided to learn how to convert names from underscore into this format.
//
// First, write a program, which changes variable names from underscore to the UpperCamelCase style.
//
// In the underscore style each word starts from a lowercase letter characterizes, and the underscore character “_” separates the words. In the UpperCamelCase style each word is starts from the capital letter and there are no separators between the words.
//
// Input format:
// Single string, containing the name, written in the underscore style.
//
// Output format:
// The string, containing the new name in the UpperCamelCase style.
//
// Sample Input 1:
//
// my_first_class
// Sample Output 1:
//
// MyFirstClass
// Sample Input 2:
//
// a
// Sample Output 2:
//
// A
// Sample Input 3:
//
// anOther_clAss
// Sample Output 3:
//
// AnotherClass
public class FromPythonCodeIntoJavaCode {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String n = scanner.nextLine();
if(n.contains("_")) {
String[] array = n.split("_");
Stream.of(array).map(x->x.substring(0,1).toUpperCase()+x.substring(1).toLowerCase()).forEach(System.out::print);
}
else {
if (n.length()==1)
System.out.println(n.toUpperCase());
else
System.out.println(n.substring(0,1).toUpperCase()+n.substring(1).toLowerCase());
}// put your code here
}
}
| [
"frankest@yandex.ru"
] | frankest@yandex.ru |
d08a75e19343afdfba3e5ccdbee05c1ac378e813 | 0fe692d2c54d7c6f7e4d687cb018495c3d8eddf2 | /Assignment 4/DiningJavaPhilosophers1/src/diningjavaphilosophers/Philosopher.java | d796efb345090d04ae257503310f15f3cf446a8d | [] | no_license | eliotcowley/CS377 | 423b5b8685417a4a8c2a4a4038a61336e1e9e707 | 8cb47d641653d20c0a445184dbe14cc70931fb7e | refs/heads/master | 2021-01-10T12:36:33.660803 | 2015-05-24T01:05:22 | 2015-05-24T01:05:22 | 36,149,779 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,125 | java | package diningjavaphilosophers;
/**
* This class implements a dining philosopher.
*
* @author Marc L. Smith
* @version 1.0
*/
public class Philosopher extends Thread {
/* instance variables */
private int id; // Philosopher's unique identifier
private int left; // philosopher's left chopstick
private int right; // philosopher's right chopstick
/** Constructor for Philosopher object.
* @param id Unique identifier for this Philosopher.
*/
public Philosopher(int id) {
// initialize instance variables
this.id = id;
this.left = id;
this.right = (id + 1) % Chopsticks.numPhilosophers;
}
/** A dining philosopher's behavior is to eat and think -- forever!
*/
@Override
public void run() {
// don't all start in order of creation!
this.delay(this.randomInt());
while (true) {
// pick up forks
this.getForks();
// eat
System.out.println("Philosopher " + this.id + " eating...");
this.delay(this.randomInt()); // chew your food!
// finished eating, so put down forks
this.putDownForks();
System.out.println("BURP! (Philosopher " + this.id + ")");
// think
System.out.println("Philosopher " + id + " thinking...");
this.delay(this.randomInt()); // can't rush genius!
}
}
/**
* Unsafe way to pick up both forks.
*/
private void getForks() {
/* to avoid deadlock, have one philosopher (in this case, philosopher 0)
* pick up their chopsticks in a different order than the others */
if (this.id == 0) {
System.out.println("Philosopher " + this.id
+ " waiting for left fork...");
synchronized (Chopsticks.getLeft(this.id)) {
// simulate time to pick up left fork
this.delay(this.randomInt());
System.out.println("Philosopher " + this.id
+ " picked up left fork!");
System.out.println("Philosopher " + this.id
+ " waiting for right fork...");
synchronized (Chopsticks.getRight(this.id)) {
// simulate time to pick up right fork
this.delay(this.randomInt());
System.out.println("Philosopher " + this.id
+ " picked up right fork!");
}
}
}
/* other philosophers pick up right chopstick first, then left */
else {
System.out.println("Philosopher " + this.id
+ " waiting for right fork...");
synchronized (Chopsticks.getRight(this.id)) {
// simulate time to pick up right fork
this.delay(this.randomInt());
System.out.println("Philosopher " + this.id
+ " picked up right fork!");
System.out.println("Philosopher " + this.id
+ " waiting for left fork...");
synchronized (Chopsticks.getLeft(this.id)) {
// simulate time to pick up left fork
this.delay(this.randomInt());
System.out.println("Philosopher " + this.id
+ " picked up left fork!");
}
}
}
}
/**
* Philosopher puts down forks.
*/
private void putDownForks() {
/* philosopher 0 puts down chopsticks left first, then right */
if (this.id == 0) {
Chopsticks.putDownLeft(this.id);
System.out.println("Philosopher " + this.id + " put down left fork.");
this.delay(this.randomInt()); // simulate time to put down fork
Chopsticks.putDownRight(this.id);
System.out.println("Philosopher " + this.id + " put down right fork.");
this.delay(this.randomInt()); // simulate time to put down fork
}
/* other philosophers put down chopsticks right first, then left */
else {
Chopsticks.putDownRight(this.id);
System.out.println("Philosopher " + this.id + " put down right fork.");
this.delay(this.randomInt()); // simulate time to put down fork
Chopsticks.putDownLeft(this.id);
System.out.println("Philosopher " + this.id + " put down left fork.");
this.delay(this.randomInt()); // simulate time to put down fork
}
}
/**
* Returns a random integer.
* @return Random integer between 1 and 100?
*/
public int randomInt() {
double r = Math.random();
return (int) Math.floor(r * 100) + 1;
}
/**
* Simulates a philosopher pausing for a given amount of time.
* @param mSec Integer representing milliseconds that philosopher pauses for.
*/
public void delay(int mSec) {
try {
Thread.sleep(mSec);
} catch (InterruptedException ex) {
}
}
}
| [
"elcowley@vassar.edu"
] | elcowley@vassar.edu |
ccca98e9f1cdbfd8a7a9de3a2d2344511889d313 | a767fb562f910215d81a55793874a54063b9641a | /app/src/androidTest/java/com/example/fyphomefitness/ExampleInstrumentedTest.java | fc6c399bbb475d0e936ae941edff0d91c33c960e | [] | no_license | samuelchyke/Home-Fitness-App-Repo | b7cc5bd63aa774697a633c45816e3d703fe3d8db | 6756b3745a437e8d405dd3033b05f6a648a55970 | refs/heads/main | 2023-03-27T14:30:28.279021 | 2021-03-26T00:05:30 | 2021-03-26T00:05:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 766 | java | package com.example.fyphomefitness;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.fyphomefitness", appContext.getPackageName());
}
} | [
"samuelchyke@hotmail.com"
] | samuelchyke@hotmail.com |
985ad38735e8616be2efdae9f6911036e3009d54 | 4360f67db067ceff6035a3b300976ec78bb23391 | /wemirr-platform-gateway/src/main/java/com/wemirr/platform/gateway/filter/BlackWhiteListGatewayFilterFactory.java | 2540549b739b076b3aaf0d4922ee4b4fbdd4a99a | [
"Apache-2.0"
] | permissive | yang755994/wemirr-platform | b4b815d8949f9df364b04dfe1008eabea6076196 | a43e27e250525fb5e27d8005bbd4df43165fde25 | refs/heads/master | 2023-07-17T14:46:22.656827 | 2021-07-14T05:31:05 | 2021-07-14T05:31:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,352 | java | package com.wemirr.platform.gateway.filter;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.net.HttpHeaders;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import org.springframework.cloud.gateway.support.ipresolver.XForwardedRemoteAddressResolver;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.server.reactive.ServerHttpResponse;
import reactor.core.publisher.Mono;
import java.net.InetSocketAddress;
import java.util.List;
/**
* XForwardedRemoteAddressResolver
* 黑白名单过滤器
*
* @author Levin
*/
@Slf4j
@Order(99)
@Configuration
public class BlackWhiteListGatewayFilterFactory extends AbstractGatewayFilterFactory<BlackWhiteListGatewayFilterFactory.Config> {
private static final String DEFAULT_FILTER_NAME = "BlackWhiteList";
@Override
public String name() {
return DEFAULT_FILTER_NAME;
}
public BlackWhiteListGatewayFilterFactory() {
super(Config.class);
}
@Override
public GatewayFilter apply(Config config) {
return (exchange, chain) -> {
InetSocketAddress remoteAddress = XForwardedRemoteAddressResolver.maxTrustedIndex(1).resolve(exchange);
String ip = remoteAddress.getAddress().getHostAddress();
log.debug("[访问者IP地址] - [{}]", ip);
if (config.type == BlackWhiteListType.BLACK_LIST) {
boolean access = config.getWhiteLists().contains(ip);
if (access) {
return chain.filter(exchange);
}
}
if (config.type == BlackWhiteListType.WHITE_LIST) {
boolean access = config.getWhiteLists().contains(ip);
if (!access) {
return chain.filter(exchange);
}
}
log.warn("[访问受限,该地址在黑名单或者不在白名单里] - [{}]", ip);
ServerHttpResponse response = exchange.getResponse();
response.setStatusCode(HttpStatus.FORBIDDEN);
response.getHeaders().set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
JSONObject result = new JSONObject();
result.put("messageId", HttpStatus.FORBIDDEN.value());
result.put("message", "访问受限,请联系管理员");
result.put("successful", false);
result.put("timestamp", System.currentTimeMillis());
return response.writeWith(Mono.just(response.bufferFactory().wrap(JSON.toJSONBytes(result))));
};
}
@Data
public static class Config {
private Integer maxTrustedIndex = 1;
private BlackWhiteListType type;
private List<String> blackLists;
private List<String> whiteLists;
}
@AllArgsConstructor
public enum BlackWhiteListType {
/**
* 黑名单
*/
BLACK_LIST,
/**
* 白名单
*/
WHITE_LIST;
}
}
| [
"xiongfei"
] | xiongfei |
18a80b1a4686641900b8ee1922719fe39e243853 | e0ec9e652cd7b1e2bccf7c4c698636b468a9220f | /activiti-workflow/src/main/java/com/rxv5/workflow/dao/UserMapper.java | 4b9aecd57130fc394a9bb5cf5c3ec75cda2a450b | [] | no_license | congrixu/spring-cloud-framework | 0df00f2f470b297c530417e6c5fb6bacdabb7f9b | 080189784addfc44af306e0b8454d8e21defa7a4 | refs/heads/master | 2022-08-04T03:12:21.840132 | 2019-12-06T06:16:59 | 2019-12-06T06:16:59 | 205,096,932 | 0 | 0 | null | 2022-06-21T01:51:50 | 2019-08-29T06:35:10 | Java | UTF-8 | Java | false | false | 283 | java | package com.rxv5.workflow.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.rxv5.workflow.entity.User;
public interface UserMapper {
public List<User> select(@Param("userId") String userId, @Param("userName") String userName);
}
| [
"rixuv5@126.com"
] | rixuv5@126.com |
522d71904311b26e39074eccd05bf1fc46bb2617 | 872967c9fa836eee09600f4dbd080c0da4a944c1 | /source/com/sun/corba/se/impl/copyobject/ORBStreamObjectCopierImpl.java | 11cd8fa34da9c26da6f994a06b2f044a962e9bc1 | [] | no_license | pangaogao/jdk | 7002b50b74042a22f0ba70a9d3c683bd616c526e | 3310ff7c577b2e175d90dec948caa81d2da86897 | refs/heads/master | 2021-01-21T02:27:18.595853 | 2018-10-22T02:45:34 | 2018-10-22T02:45:34 | 101,888,886 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,179 | java | /*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package com.sun.corba.se.impl.copyobject ;
import java.io.Serializable;
import java.rmi.Remote;
import test.org.omg.CORBA_2_3.portable.InputStream;
import test.org.omg.CORBA_2_3.portable.OutputStream;
import test.org.omg.CORBA.ORB ;
import com.sun.corba.se.spi.copyobject.ObjectCopier ;
import com.sun.corba.se.impl.util.Utility;
public class ORBStreamObjectCopierImpl implements ObjectCopier {
public ORBStreamObjectCopierImpl( ORB orb )
{
this.orb = orb ;
}
public Object copy(Object obj) {
if (obj instanceof Remote) {
// Yes, so make sure it is connected and converted
// to a stub (if needed)...
return Utility.autoConnect(obj,orb,true);
}
OutputStream out = (OutputStream)orb.create_output_stream();
out.write_value((Serializable)obj);
InputStream in = (InputStream)out.create_input_stream();
return in.read_value();
}
private ORB orb;
}
| [
"gaopanpan@meituan.com"
] | gaopanpan@meituan.com |
5ecedf89b719e2bdb76da71d77f5ee0753241d55 | 5ba707b2dc7cf04a2db7fbdd741c869108b428ad | /src/org/jcodings/unicode/CR_S.java | 40a9399e76d2f437442669d6120c523d87ca3e86 | [] | no_license | lopex/jcodings | aab14e87d7504d043310c6aeb55ffbe4f9477070 | 7258cb78e01c7ab615b58d33595f059eea1881d4 | refs/heads/master | 2021-01-17T21:51:58.267134 | 2012-02-14T02:32:08 | 2012-02-14T02:32:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,398 | java | /*
* 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.jcodings.unicode;
import org.jcodings.Config;
public class CR_S {
static final int Table[] = Config.USE_UNICODE_PROPERTIES ? new int[] {
208,
0x0024, 0x0024,
0x002b, 0x002b,
0x003c, 0x003e,
0x005e, 0x005e,
0x0060, 0x0060,
0x007c, 0x007c,
0x007e, 0x007e,
0x00a2, 0x00a9,
0x00ac, 0x00ac,
0x00ae, 0x00b1,
0x00b4, 0x00b4,
0x00b6, 0x00b6,
0x00b8, 0x00b8,
0x00d7, 0x00d7,
0x00f7, 0x00f7,
0x02c2, 0x02c5,
0x02d2, 0x02df,
0x02e5, 0x02eb,
0x02ed, 0x02ed,
0x02ef, 0x02ff,
0x0375, 0x0375,
0x0384, 0x0385,
0x03f6, 0x03f6,
0x0482, 0x0482,
0x0606, 0x0608,
0x060b, 0x060b,
0x060e, 0x060f,
0x06de, 0x06de,
0x06e9, 0x06e9,
0x06fd, 0x06fe,
0x07f6, 0x07f6,
0x09f2, 0x09f3,
0x09fa, 0x09fb,
0x0af1, 0x0af1,
0x0b70, 0x0b70,
0x0bf3, 0x0bfa,
0x0c7f, 0x0c7f,
0x0d79, 0x0d79,
0x0e3f, 0x0e3f,
0x0f01, 0x0f03,
0x0f13, 0x0f17,
0x0f1a, 0x0f1f,
0x0f34, 0x0f34,
0x0f36, 0x0f36,
0x0f38, 0x0f38,
0x0fbe, 0x0fc5,
0x0fc7, 0x0fcc,
0x0fce, 0x0fcf,
0x0fd5, 0x0fd8,
0x109e, 0x109f,
0x1360, 0x1360,
0x1390, 0x1399,
0x17db, 0x17db,
0x1940, 0x1940,
0x19de, 0x19ff,
0x1b61, 0x1b6a,
0x1b74, 0x1b7c,
0x1fbd, 0x1fbd,
0x1fbf, 0x1fc1,
0x1fcd, 0x1fcf,
0x1fdd, 0x1fdf,
0x1fed, 0x1fef,
0x1ffd, 0x1ffe,
0x2044, 0x2044,
0x2052, 0x2052,
0x207a, 0x207c,
0x208a, 0x208c,
0x20a0, 0x20b9,
0x2100, 0x2101,
0x2103, 0x2106,
0x2108, 0x2109,
0x2114, 0x2114,
0x2116, 0x2118,
0x211e, 0x2123,
0x2125, 0x2125,
0x2127, 0x2127,
0x2129, 0x2129,
0x212e, 0x212e,
0x213a, 0x213b,
0x2140, 0x2144,
0x214a, 0x214d,
0x214f, 0x214f,
0x2190, 0x2328,
0x232b, 0x23f3,
0x2400, 0x2426,
0x2440, 0x244a,
0x249c, 0x24e9,
0x2500, 0x26ff,
0x2701, 0x2767,
0x2794, 0x27c4,
0x27c7, 0x27ca,
0x27cc, 0x27cc,
0x27ce, 0x27e5,
0x27f0, 0x2982,
0x2999, 0x29d7,
0x29dc, 0x29fb,
0x29fe, 0x2b4c,
0x2b50, 0x2b59,
0x2ce5, 0x2cea,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
0x2ff0, 0x2ffb,
0x3004, 0x3004,
0x3012, 0x3013,
0x3020, 0x3020,
0x3036, 0x3037,
0x303e, 0x303f,
0x309b, 0x309c,
0x3190, 0x3191,
0x3196, 0x319f,
0x31c0, 0x31e3,
0x3200, 0x321e,
0x322a, 0x3250,
0x3260, 0x327f,
0x328a, 0x32b0,
0x32c0, 0x32fe,
0x3300, 0x33ff,
0x4dc0, 0x4dff,
0xa490, 0xa4c6,
0xa700, 0xa716,
0xa720, 0xa721,
0xa789, 0xa78a,
0xa828, 0xa82b,
0xa836, 0xa839,
0xaa77, 0xaa79,
0xfb29, 0xfb29,
0xfbb2, 0xfbc1,
0xfdfc, 0xfdfd,
0xfe62, 0xfe62,
0xfe64, 0xfe66,
0xfe69, 0xfe69,
0xff04, 0xff04,
0xff0b, 0xff0b,
0xff1c, 0xff1e,
0xff3e, 0xff3e,
0xff40, 0xff40,
0xff5c, 0xff5c,
0xff5e, 0xff5e,
0xffe0, 0xffe6,
0xffe8, 0xffee,
0xfffc, 0xfffd,
0x10102, 0x10102,
0x10137, 0x1013f,
0x10179, 0x10189,
0x10190, 0x1019b,
0x101d0, 0x101fc,
0x1d000, 0x1d0f5,
0x1d100, 0x1d126,
0x1d129, 0x1d164,
0x1d16a, 0x1d16c,
0x1d183, 0x1d184,
0x1d18c, 0x1d1a9,
0x1d1ae, 0x1d1dd,
0x1d200, 0x1d241,
0x1d245, 0x1d245,
0x1d300, 0x1d356,
0x1d6c1, 0x1d6c1,
0x1d6db, 0x1d6db,
0x1d6fb, 0x1d6fb,
0x1d715, 0x1d715,
0x1d735, 0x1d735,
0x1d74f, 0x1d74f,
0x1d76f, 0x1d76f,
0x1d789, 0x1d789,
0x1d7a9, 0x1d7a9,
0x1d7c3, 0x1d7c3,
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
0x1f0b1, 0x1f0be,
0x1f0c1, 0x1f0cf,
0x1f0d1, 0x1f0df,
0x1f110, 0x1f12e,
0x1f130, 0x1f169,
0x1f170, 0x1f19a,
0x1f1e6, 0x1f202,
0x1f210, 0x1f23a,
0x1f240, 0x1f248,
0x1f250, 0x1f251,
0x1f300, 0x1f320,
0x1f330, 0x1f335,
0x1f337, 0x1f37c,
0x1f380, 0x1f393,
0x1f3a0, 0x1f3c4,
0x1f3c6, 0x1f3ca,
0x1f3e0, 0x1f3f0,
0x1f400, 0x1f43e,
0x1f440, 0x1f440,
0x1f442, 0x1f4f7,
0x1f4f9, 0x1f4fc,
0x1f500, 0x1f53d,
0x1f550, 0x1f567,
0x1f5fb, 0x1f5ff,
0x1f601, 0x1f610,
0x1f612, 0x1f614,
0x1f616, 0x1f616,
0x1f618, 0x1f618,
0x1f61a, 0x1f61a,
0x1f61c, 0x1f61e,
0x1f620, 0x1f625,
0x1f628, 0x1f62b,
0x1f62d, 0x1f62d,
0x1f630, 0x1f633,
0x1f635, 0x1f640,
0x1f645, 0x1f64f,
0x1f680, 0x1f6c5,
0x1f700, 0x1f773,
} : null;
} | [
"lopx@gazeta.pl"
] | lopx@gazeta.pl |
d31619bc3ccda51c508b0161f02e774c1aeea94a | 1a1c0caaf153bc604a5da0335be8fb4425098b4a | /CryptoChat/main/java/CreateContactActivity.java | 3ba101f81131bdc7d1f2d04380c15b73e91c2880 | [] | no_license | thanna96/Crypto-Chat | 07ded129c840f1373d2b9eb7b90c8b7360864c9c | 36862816c822673a72b12e37d1affb8fad5a7a75 | refs/heads/master | 2020-04-13T17:09:02.891467 | 2018-12-27T22:45:24 | 2018-12-27T22:45:24 | 163,340,082 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,696 | java | package com.example.thann.cryptochat;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
public class CreateContactActivity extends AppCompatActivity implements View.OnClickListener{
private FirebaseAuth firebaseAuth;
EditText editTextName;
EditText editTextPhone;
EditText editTextEmail;
EditText editTextKey;
Button buttonAdd;
DatabaseReference databaseReference;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_contact);
firebaseAuth = FirebaseAuth.getInstance();
databaseReference = FirebaseDatabase.getInstance().getReference("UserInfo");
editTextName = (EditText) findViewById(R.id.ACname);
editTextPhone = (EditText) findViewById(R.id.ACPhone);
editTextEmail = (EditText) findViewById(R.id.ACemail);
editTextKey = (EditText) findViewById(R.id.ACPK);
buttonAdd = (Button) findViewById(R.id.ACbutton);
FirebaseUser user = firebaseAuth.getCurrentUser();
buttonAdd.setOnClickListener(this);
}
public void addContact() {
String name = editTextName.getText().toString().trim();
String phone = editTextPhone.getText().toString().trim();
String email = editTextEmail.getText().toString().trim();
String key = editTextKey.getText().toString().trim();
if(!TextUtils.isEmpty(name)||
!TextUtils.isEmpty(phone)||!TextUtils.isEmpty(email)
||!TextUtils.isEmpty(key)){
Contacts contacts = new Contacts(name,email,phone,key);
FirebaseUser user = firebaseAuth.getCurrentUser();
databaseReference.child(user.getUid()).child("Contacts").child(name).setValue(contacts);
Toast.makeText(this,"New Contact Added!",Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(this, "Please Fill Blank Fields", Toast.LENGTH_LONG).show();
}
Intent intent = new Intent(this, ContactActivity.class);
startActivity(intent);
}
@Override
public void onClick(View v) {
if(v == buttonAdd){
addContact();
}
}
}
| [
"noreply@github.com"
] | thanna96.noreply@github.com |
0adb2c4b5ce817b422e1ce6482f70acf51f03564 | 73fb3212274525b1ad47c4eeca7082a6a0a97250 | /yewulibs1/yewulibs1-appcomm/src/main/java/com/example/slbappcomm/huyan/Huyanservices.java | 4f26a79ee634ba1c79b77ca75cef47d0ac7eac11 | [] | no_license | dahui888/androidkuangjia2021 | d6ba565e14b50f2a484154d8fffdb486ee56f433 | 624e212b97bb4b47d4763f644be30ef2a26d244d | refs/heads/main | 2023-07-18T00:00:43.079443 | 2021-08-26T10:15:53 | 2021-08-26T10:15:53 | 383,725,172 | 1 | 0 | null | 2021-07-07T08:18:31 | 2021-07-07T08:18:30 | null | UTF-8 | Java | false | false | 4,446 | java | package com.example.slbappcomm.huyan;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.os.Binder;
import android.os.Build;
import android.os.IBinder;
//import android.support.annotation.ColorInt;
//
import android.view.Display;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import androidx.annotation.ColorInt;
import androidx.annotation.Nullable;
import com.example.slbappcomm.R;
import com.geek.libutils.app.BaseApp;
public class Huyanservices extends Service {
public static final int HUYAN_MANAGE_NOTIFICATION_ID = 1001611;
private WindowManager mWindowManager;
private View view;
@Nullable
@Override
public IBinder onBind(Intent intent) {
return new MsgBinder();
}
public class MsgBinder extends Binder {
public Huyanservices getService() {
return Huyanservices.this;
}
}
@Override
public void onCreate() {
super.onCreate();
init();
}
private void init() {
mWindowManager = (WindowManager) BaseApp.get().getSystemService(Context.WINDOW_SERVICE);
WindowManager.LayoutParams params = new WindowManager.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_SYSTEM_ERROR,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.RGBA_8888);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {//8.0+
params.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
} else {
params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
}
// params.format = PixelFormat.RGBA_8888;
// params.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
Display display = mWindowManager.getDefaultDisplay();
Point p = new Point();
display.getRealSize(p);
// params.width = (int) (p.x * 1.0);
// params.height = (int) (p.y * 1.0);
// params.width = WindowManager.LayoutParams.MATCH_PARENT;
// params.height = WindowManager.LayoutParams.MATCH_PARENT;
params.gravity = Gravity.TOP | Gravity.LEFT;
params.y = 0;
params.x = 0;
view = LayoutInflater.from(BaseApp.get()).inflate(R.layout.activity_huyan, null);
view.setBackgroundColor(getColors(30));
// view.setBackgroundResource(R.color.transparent60);//c62
// view.setFocusableInTouchMode(true);
// view.setOnTouchListener(new View.OnTouchListener() {
// @Override
// public boolean onTouch(View view, MotionEvent motionEvent) {
// return false;
// }
// });
mWindowManager.addView(view, params);
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// startForeground(HUYAN_MANAGE_NOTIFICATION_ID, new Notification());
Intent it = new Intent(this, HuyanservicesBg.class);
it.putExtra(HuyanservicesBg.EXTRA_NOTIFICATION_ID, HUYAN_MANAGE_NOTIFICATION_ID);
startService(it);
return START_STICKY;
}
@Override
public void onDestroy() {
// if (view.getParent() != null) {
// mWindowManager.removeView(view);//移除窗口
// }
mWindowManager.removeView(view);//移除窗口
super.onDestroy();
}
/**
* 过滤蓝光
*
* @param blueFilterPercent 蓝光过滤比例[10-80]
*/
public static @ColorInt
int getColors(int blueFilterPercent) {
int realFilter = blueFilterPercent;
if (realFilter < 10) {
realFilter = 10;
} else if (realFilter > 80) {
realFilter = 80;
}
int a = (int) (realFilter / 80f * 180);
int r = (int) (200 - (realFilter / 80f) * 190);
int g = (int) (180 - (realFilter / 80f) * 170);
int b = (int) (60 - realFilter / 80f * 60);
return Color.argb(a, r, g, b);
}
}
| [
"liangxiao6@live.com"
] | liangxiao6@live.com |
5538c42a508f694f2a5b2c727dcae6f5ee099af1 | 9f1cdcaf3e0fc841e4f9185b2e144bbce5252816 | /Backend/VehicleLoanGladiator-Updated/src/main/java/com/lti/model/UserBasic.java | f9c5200818562d1e6db32f8e8b1d68314030e99f | [] | no_license | Hell-Spider/VehicleLoan | a998357400bf9565e09affb6b08408729dfeb565 | 51a0fe314b6dea85f0b95861c6a9c4b5f5e063bd | refs/heads/master | 2022-12-20T00:26:56.471303 | 2020-10-08T13:15:09 | 2020-10-08T13:15:09 | 294,777,633 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,516 | java | package com.lti.model;
import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty.Access;
@Entity
@Table(name = "USER_REGISTRATION")
public class UserBasic implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "USER_EMAIL")
private String email;
@Column(name = "USER_FULL_NAME")
private String name;
@Column(name = "USER_GENDER")
private String gender;
@Column(name = "USER_PHONE_NUMBER")
private String mobile;
@Column(name = "USER_AGE")
private int age;
@Column(name = "USER_PASSWORD")
private String password;
// User Advanced Mapping
@OneToOne(cascade = CascadeType.PERSIST)
@JoinColumn(name = "USER_DETAILS_ID")
@JsonIgnoreProperties(allowGetters = true)
private UserAdvanced userdetails;
// CONSTRUCTORS
public UserBasic() {
}
public UserBasic(String email, String name, String gender, String mobile, String password, int age) {
super();
this.email = email;
this.name = name;
this.gender = gender;
this.mobile = mobile;
this.password = password;
this.age = age;
}
// GETTERS AND SETTERS
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public UserAdvanced getUserdetails() {
return userdetails;
}
public void setUserdetails(UserAdvanced userdetails) {
this.userdetails = userdetails;
}
// TO-STRING
@Override
public String toString() {
return "UserBasic [email=" + email + ", name=" + name + ", gender=" + gender + ", mobile=" + mobile
+ ", password=" + password + ", age=" + age + "]";
}
}
| [
"jeetonwheelstwice@gmail.com"
] | jeetonwheelstwice@gmail.com |
58ef67307e568b52107f10b76f14bba2a761a6f7 | 80d4b8e084e2402735dbb1a00cf550b480f4da05 | /src/test/java/com/isiseko/org/web/rest/WithUnauthenticatedMockUser.java | edc9ba72b8fe89c302968aae1b4a588d6df3f4fd | [] | no_license | smtandabuzo/marriage-counselling-app | 769cdb5812b800559a4e9d7dd7e34efb9cccd57d | a4a3710676f79525aeb6d95eff5526d9c398ffc3 | refs/heads/master | 2023-05-31T19:22:53.580921 | 2020-03-31T18:45:27 | 2020-03-31T18:45:27 | 251,698,483 | 0 | 0 | null | 2023-05-10T03:34:47 | 2020-03-31T18:39:41 | Java | UTF-8 | Java | false | false | 987 | java | package com.isiseko.org.web.rest;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.test.context.support.WithSecurityContext;
import org.springframework.security.test.context.support.WithSecurityContextFactory;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@WithSecurityContext(factory = WithUnauthenticatedMockUser.Factory.class)
public @interface WithUnauthenticatedMockUser {
class Factory implements WithSecurityContextFactory<WithUnauthenticatedMockUser> {
@Override
public SecurityContext createSecurityContext(WithUnauthenticatedMockUser annotation) {
return SecurityContextHolder.createEmptyContext();
}
}
}
| [
"sazi@sazimtandabuzo.com"
] | sazi@sazimtandabuzo.com |
4df944a30245c478246058b37e7a7e3af3f4c47f | c827bfebbde82906e6b14a3f77d8f17830ea35da | /Development3.0/TeevraServer/platform/businessobject/src/main/java/org/fixprotocol/fixml_5_0/AssignmentMethodEnumT.java | 3cdb4f38404606d339fca9b2cfbdd2166ab2c5fc | [] | no_license | GiovanniPucariello/TeevraCore | 13ccf7995c116267de5c403b962f1dc524ac1af7 | 9d755cc9ca91fb3ebc5b227d9de6bcf98a02c7b7 | refs/heads/master | 2021-05-29T18:12:29.174279 | 2013-04-22T07:44:28 | 2013-04-22T07:44:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,152 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
// 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: 2009.06.08 at 01:47:27 PM IST
//
package org.fixprotocol.fixml_5_0;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for AssignmentMethod_enum_t.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <simpleType name="AssignmentMethod_enum_t">
* <restriction base="{http://www.fixprotocol.org/FIXML-5-0}char">
* <enumeration value="P"/>
* <enumeration value="R"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "AssignmentMethod_enum_t")
@XmlEnum
public enum AssignmentMethodEnumT {
P,
R;
public String value() {
return name();
}
public static AssignmentMethodEnumT fromValue(String v) {
return valueOf(v);
}
}
| [
"ritwik.bose@headstrong.com"
] | ritwik.bose@headstrong.com |
841000fc0451728c2038114cb3010f8b367856e6 | 1869205092dc444c82d8b0ba35d29f87d2514373 | /goci-core/goci-db-binding/src/main/java/db/migration/V2_0_1_016__Populate_gene_entrez_gene_table.java | b14af4197282b78583cbb31cfce27f350cfce25e | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | EBISPOT/goci | 42a9d4939e46e41ecaaf2fbf315d2e4504112a20 | be3af797798ae6640036e2f7f78c55fcb2dfe012 | refs/heads/2.x-stable | 2023-08-16T19:16:10.406830 | 2023-08-02T16:46:44 | 2023-08-02T16:46:44 | 2,995,118 | 26 | 22 | Apache-2.0 | 2023-09-14T14:58:09 | 2011-12-16T14:25:43 | Java | UTF-8 | Java | false | false | 2,033 | java | package db.migration;
import org.flywaydb.core.api.migration.spring.SpringJdbcMigration;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.simple.SimpleJdbcInsert;
import java.util.HashMap;
import java.util.Map;
/**
* Created by emma on 21/07/2015.
*
* @author emma
* <p>
* Jira ticket: https://www.ebi.ac.uk/panda/jira/browse/GOCI-951. Populate GENE_ENTREZ_GENE table with details
* from GENE table.
*/
public class V2_0_1_016__Populate_gene_entrez_gene_table implements SpringJdbcMigration {
private static final String SELECT_GENE_ID_AND_ENTREZ_ID = "SELECT ID, ENTREZ_GENE_ID FROM GENE\n" +
"WHERE ENTREZ_GENE_ID IS NOT NULL\n" +
"ORDER BY ID";
private static final String SELECT_ENTREZ_GENE_ID = "SELECT ID FROM ENTREZ_GENE \n" +
"WHERE ENTREZ_GENE_ID = ?";
@Override public void migrate(JdbcTemplate jdbcTemplate) throws Exception {
// Query for gene IDs and its linked entrezGeneId
jdbcTemplate.query(SELECT_GENE_ID_AND_ENTREZ_ID, (resultSet, i) -> {
Long geneId = resultSet.getLong(1);
String entrezIdinGeneTable = resultSet.getString(2);
// Find ID of entrez gene in ENTREZ_GENE table linked to that ID
Long idInEntrezGeneTable =
jdbcTemplate.queryForObject(SELECT_ENTREZ_GENE_ID, Long.class, entrezIdinGeneTable);
// Insert into new table
SimpleJdbcInsert insertGeneEntrezGene =
new SimpleJdbcInsert(jdbcTemplate)
.withTableName("GENE_ENTREZ_GENE")
.usingColumns("GENE_ID",
"ENTREZ_GENE_ID");
Map<String, Object> insertArgs = new HashMap<>();
insertArgs.put("GENE_ID", geneId);
insertArgs.put("ENTREZ_GENE_ID", idInEntrezGeneTable);
insertGeneEntrezGene.execute(insertArgs);
return null;
});
}
}
| [
"emma@ebi.ac.uk"
] | emma@ebi.ac.uk |
fc8a76d0233d28b8646fb9d801e27e69a989b1d8 | 1a99b7ad4fccd9824aeada985171dfcc258a16aa | /src/main/java/org/jboss/wfk/repotree/artifact/Artifact.java | d33834f6fae0ff837846ed42290494e1a82a0146 | [] | no_license | kpiwko/repotree | 7183021f6fa05f548ba40c581c35866d63ac7530 | 5874d9258cceeb26fd8c803a8acb7d5b79fba961 | refs/heads/master | 2016-09-06T15:10:05.334842 | 2011-05-18T15:40:03 | 2011-05-18T15:40:03 | 1,068,751 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,650 | java | /*
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat Middleware LLC, and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.wfk.repotree.artifact;
import java.io.File;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.maven.model.Model;
import org.sonatype.aether.util.artifact.DefaultArtifact;
/**
* @author <a href="mailto:kpiwko@redhat.com">Karel Piwko</a>
* @author Benjamin Bentmann
*
*/
public class Artifact
{
private final String groupId;
private final String artifactId;
private final String extension;
private final String classifier;
private final String version;
/**
*
* @param coordinates The artifact coordinates in the format {@code <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>}, must not be {@code null}.
*/
public Artifact(String coordinates)
{
Pattern p = Pattern.compile("([^: ]+):([^: ]+)(:([^: ]*)(:([^: ]+))?)?:([^: ]+)");
Matcher m = p.matcher(coordinates);
if (!m.matches())
{
throw new IllegalArgumentException("Bad artifact coordinates"
+ ", expected format is <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>");
}
groupId = m.group(1);
artifactId = m.group(2);
extension = get(m.group(4), "jar");
classifier = get(m.group(6), "");
version = m.group(7);
}
public Artifact(String groupId, String artifactId, String version)
{
this(groupId, artifactId, "jar", "", version);
}
public Artifact(String groupId, String artifactId, String extension, String classifier, String version)
{
this.groupId = groupId;
this.artifactId = artifactId;
this.extension = extension;
this.classifier = classifier;
this.version = version;
}
public Artifact(Model model)
{
this.groupId = !empty(model.getGroupId()) ? model.getGroupId() : model.getParent().getGroupId();
this.artifactId = model.getArtifactId();
this.version = !empty(model.getVersion()) ? model.getVersion() : model.getParent().getVersion();
this.extension = model.getPackaging();
this.classifier = "";
}
public static Artifact fromTree(String dependencyCoords)
{
// sanity checks
int index = 0;
while (index < dependencyCoords.length())
{
char c = dependencyCoords.charAt(index);
if (c == '\\' || c == '|' || c == ' ' || c == '+' || c == '-')
{
index++;
}
else
{
break;
}
}
for (int testIndex = index, i = 0; i < 4; i++)
{
testIndex = dependencyCoords.substring(testIndex).indexOf(":");
if (testIndex == -1)
{
throw new IllegalArgumentException("Invalid format of the dependency coordinates for " + dependencyCoords);
}
}
// parse
StringTokenizer st = new StringTokenizer(dependencyCoords.substring(index), ":");
String groupId = st.nextToken();
String artifactId = st.nextToken();
String extension = st.nextToken();
String classifier, version;
// this is the root artifact
if (index == 0)
{
if (st.countTokens() == 1)
{
classifier = "";
version = st.nextToken();
}
else if (st.countTokens() == 2)
{
classifier = st.nextToken();
version = st.nextToken();
}
else
{
throw new IllegalArgumentException("Invalid format of the dependency coordinates for " + dependencyCoords);
}
}
// otherwise, omitting the scope
else
{
if (st.countTokens() == 2)
{
classifier = "";
version = st.nextToken();
}
else if (st.countTokens() == 3)
{
classifier = st.nextToken();
version = st.nextToken();
}
else
{
throw new IllegalArgumentException("Invalid format of the dependency coordinates for " + dependencyCoords);
}
}
return new Artifact(groupId, artifactId, extension, classifier, version);
}
public org.sonatype.aether.artifact.Artifact attachFile(File file)
{
return new DefaultArtifact(groupId, artifactId, classifier, extension, version, null, file);
}
public String filename()
{
StringBuilder sb = new StringBuilder();
sb.append(artifactId).append("-").append(version);
if (classifier.length() != 0)
{
sb.append("-").append(classifier);
}
sb.append(".").append(extension);
return sb.toString();
}
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("groupId=").append(groupId).append(", ");
sb.append("artifactId=").append(artifactId).append(", ");
sb.append("type=").append(extension).append(", ");
sb.append("version=").append(version);
if (classifier != "")
{
sb.append(", classifier=").append(classifier);
}
return sb.toString();
}
private static String get(String value, String defaultValue)
{
return (value == null || value.length() <= 0) ? defaultValue : value;
}
private static boolean empty(String value)
{
return value == null || value.length() == 0;
}
/**
* @return the groupId
*/
public String getGroupId()
{
return groupId;
}
/**
* @return the artifactId
*/
public String getArtifactId()
{
return artifactId;
}
/**
* @return the extension
*/
public String getExtension()
{
return extension;
}
/**
* @return the classifier
*/
public String getClassifier()
{
return classifier;
}
/**
* @return the version
*/
public String getVersion()
{
return version;
}
}
| [
"kpiwko@redhat.com"
] | kpiwko@redhat.com |
6760883eee20c909d84567c289d500766059175b | 4cd6d33abc6762e7471934015b69dde714e5ab47 | /Bilifit/src/com/applifit/bilifit/client/templatesUibinder/formulaires/BodyConsultation.java | 9ecce23db48fca409ac2e5ea26cc6b17abf7b0f9 | [] | no_license | nktltbt/bilit | 6b06a38acb588070f0ee8ec99eacc2895fb79c92 | d9f0748835fcc58f610e40dad1563ebbec7aaa95 | refs/heads/master | 2016-09-05T14:03:48.875714 | 2013-05-16T13:01:41 | 2013-05-16T13:01:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,963 | java | /**
*
*/
package com.applifit.bilifit.client.templatesUibinder.formulaires;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.AnchorElement;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.TableSectionElement;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.UIObject;
/**
* @author Meryem
*
*/
public class BodyConsultation extends UIObject {
@UiField
protected TableSectionElement tbody;
@UiField
protected AnchorElement lien_enregistrer;
@UiField
protected DivElement part1;
@UiField
protected DivElement part2;
@UiField
protected DivElement part3;
private static BodyConsultationUiBinder uiBinder = GWT
.create(BodyConsultationUiBinder.class);
interface BodyConsultationUiBinder extends
UiBinder<Element, BodyConsultation> {
}
public BodyConsultation() {
setElement(uiBinder.createAndBindUi(this));
}
public TableSectionElement getTbody() {
return tbody;
}
public void setTbody(TableSectionElement tbody) {
this.tbody = tbody;
}
public AnchorElement getLien_enregistrer() {
return lien_enregistrer;
}
public void setLien_enregistrer(AnchorElement lien_enregistrer) {
this.lien_enregistrer = lien_enregistrer;
}
/**
* @return the part1
*/
public DivElement getPart1() {
return part1;
}
/**
* @param part1 the part1 to set
*/
public void setPart1(DivElement part1) {
this.part1 = part1;
}
/**
* @return the part2
*/
public DivElement getPart2() {
return part2;
}
/**
* @param part2 the part2 to set
*/
public void setPart2(DivElement part2) {
this.part2 = part2;
}
/**
* @return the part3
*/
public DivElement getPart3() {
return part3;
}
/**
* @param part3 the part3 to set
*/
public void setPart3(DivElement part3) {
this.part3 = part3;
}
}
| [
"nkt.nguyen.kim.trong@gmail.com"
] | nkt.nguyen.kim.trong@gmail.com |
bc7699a1007a7e6f1d87597247311dca907771e2 | be1e3adeed13545cf593280928004ab345de4ba2 | /EJBServer/ejbModule/com/mooc/service/SessionServiceLocal.java | 44a195d05cb6c62f8b2ac5a784cdcc33b4852d21 | [] | no_license | Abdelatiflatrach/trollapp | 911caba29f5f15222ce0dbec6bb7883eec489e33 | 1197adc28d943f35151917714ce103164c14ca57 | refs/heads/master | 2021-01-17T17:24:16.556510 | 2016-07-03T00:03:35 | 2016-07-03T00:03:35 | 62,311,588 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 179 | java | package com.mooc.service;
import javax.ejb.Local;
import com.mooc.domain.Session;
@Local
public interface SessionServiceLocal extends GenericEntityService<Session>{
}
| [
"latrach.abdelatif@gmail.com"
] | latrach.abdelatif@gmail.com |
1d8180d168ecfe1597a89ff5371bdde07a9b8b9c | 9f7ba70e0912da8cb690b75622fa6ba2c7a5d53c | /src/esper/esper_2/POJO_0/POJO_test.java | 254fe573bb7c4ce8a5720e3fe3cc80101d351a9a | [
"Apache-2.0"
] | permissive | Asnebula/test_java_env | c96e1bd3e455b738ad4f5f74d57892bbc9e5d035 | fac1c17efd7e75413b13c99dcb149ce27010aab2 | refs/heads/master | 2020-03-25T01:57:22.410828 | 2018-08-03T02:03:10 | 2018-08-03T02:03:10 | 143,266,645 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,291 | java | package esper.esper_2.POJO_0;
import com.espertech.esper.client.*;
/**
* @author by Wangshuo5 on 2018/4/11
*/
class PersonListener implements UpdateListener {
public void update(EventBean[] newEvents, EventBean[] oldEvents) {
if (newEvents != null) {
Integer age = (Integer) newEvents[0].get("age");
System.out.println("the person's age is " + age);
}
}
}
public class POJO_test {
public static void main(String args[]) {
EPServiceProvider epsService = EPServiceProviderManager.getDefaultProvider();
EPAdministrator admin = epsService.getEPAdministrator();
/*
有如下这句话,则epl中的from可以直接写Person,否则要用Person.class.getName();
* */
// admin.getConfiguration().addEventType(Person.class);
String ps = Person_0.class.getName();
String epl = "select age from " + ps + " where name='ws'";
EPStatement state = admin.createEPL(epl);
state.addListener(new PersonListener());
EPRuntime runtime = epsService.getEPRuntime();
Person_0 person1 = new Person_0();
person1.setName("ws");
person1.setAge(15);
runtime.sendEvent(person1);
}
}
| [
"Asenbula@sina.com"
] | Asenbula@sina.com |
ec64ba875aad61fd7975598a001aadcd284b2de4 | abddc4160ed182e56d4e6fa60017bdc08c79a0bc | /src/main/java/com/team1678/frc2017/subsystems/WheelDrive.java | 2874b82d2acd71203d0dd1d366842bf566c113b7 | [
"MIT"
] | permissive | Shuzhengz/c2017-rewrite | 7721ea1ed445267ea9897f427d6ba298920de44b | 900cddbaf3805e848ffb86995a266691df863db5 | refs/heads/master | 2023-02-10T20:01:12.455979 | 2021-01-03T05:08:57 | 2021-01-03T05:08:57 | 316,335,511 | 1 | 0 | MIT | 2020-12-23T01:58:06 | 2020-11-26T20:58:49 | Java | UTF-8 | Java | false | false | 1,440 | java | package com.team1678.frc2017.subsystems;
//import edu.wpi.first.wpilibj.PIDController;
import com.team1678.lib.control.PIDController;
import com.ctre.phoenix.motorcontrol.ControlMode;
import com.ctre.phoenix.motorcontrol.can.TalonFX;
public class WheelDrive extends Subsystem{
private TalonFX motorSpeed;
private PIDController pidController;
private final double kMaxV = 4.95; // MAX voltage
public WheelDrive(int motorAngle, int motorSpeed, int encoder) {
new TalonFX(motorAngle);
this.motorSpeed = new TalonFX(motorSpeed);
pidController = new PIDController(1, 0, 0);
//this version of PIDController was removed
//pidController.setOutputRange (-1, 1);
//pidController.setContinuous ();
//pidController.enable ();
}
public void drive(double speed, double angle) {
motorSpeed.set(ControlMode.PercentOutput, speed); // motorSpeed == speedMotor
double setpoint = angle * (kMaxV * 0.5) + (kMaxV * 0.5); // Calculate offset
if (setpoint < 0) {
setpoint = kMaxV + setpoint;
}
if (setpoint > kMaxV) {
setpoint = setpoint - kMaxV;
}
pidController.setGoal(setpoint); // setGoal == setPoint
}
@Override
public void stop() {
}
@Override
public boolean checkSystem() {
return false;
}
@Override
public void outputTelemetry() {
}
} | [
"treez.zhang@gmail.com"
] | treez.zhang@gmail.com |
92e8be86722ebce2eb14335184298b9318faadf1 | 28c23fe74868b7614db1c6b82d0b5a63cbb43829 | /transport-thirdparty/src/test/java/com/github/kevinjdolan/intervaltree/IntervalTest.java | 5a7d66a6066369d645acd2e1d13045c75886ffac | [
"BSD-3-Clause",
"LGPL-3.0-only",
"CECILL-C",
"EPL-1.0",
"Apache-2.0",
"MIT",
"LGPL-2.0-or-later"
] | permissive | oskopek/TransportEditor | 8e3afd72d2312d562bc3e710102a2f1270143576 | 5f99e64ae6e4068fae69d3df6c1d9e58e73e9d11 | refs/heads/master | 2023-06-23T09:50:25.857542 | 2021-05-18T19:51:16 | 2021-06-09T22:57:43 | 54,718,618 | 5 | 3 | MIT | 2023-06-14T22:42:20 | 2016-03-25T12:56:08 | Java | UTF-8 | Java | false | false | 1,691 | java | package com.github.kevinjdolan.intervaltree;
import org.junit.Test;
import static org.assertj.core.api.Assertions.*;
public class IntervalTest {
@Test
public void contains() throws Exception {
assertThat(new Interval<Void>(0, 2).contains(1)).isTrue();
assertThat(new Interval<Void>(0, 2).contains(0)).isTrue();
assertThat(new Interval<Void>(0, 2).contains(2)).isFalse();
assertThat(new Interval<Void>(0, 2).contains(3)).isFalse();
assertThat(new Interval<Void>(0, 2).contains(-1)).isFalse();
}
@Test
public void intersects() throws Exception {
assertThat(new Interval<Void>(0, 2).intersects(new Interval<>(2, 3))).isFalse();
assertThat(new Interval<Void>(0, 2).intersects(new Interval<>(1, 3))).isTrue();
assertThat(new Interval<Void>(0, 2).intersects(new Interval<>(-1, 0))).isFalse();
assertThat(new Interval<Void>(0, 2).intersects(new Interval<>(-1, 1))).isTrue();
}
@Test
public void compareTo() throws Exception {
assertThat(new Interval<Void>(0, 2).compareTo(new Interval<>(2, 3))).isLessThan(0);
assertThat(new Interval<Void>(0, 2).compareTo(new Interval<>(1, 3))).isLessThan(0);
assertThat(new Interval<Void>(0, 2).compareTo(new Interval<>(0, 3))).isLessThan(0);
assertThat(new Interval<Void>(0, 2).compareTo(new Interval<>(0, 2))).isEqualTo(0);
assertThat(new Interval<Void>(0, 2).compareTo(new Interval<>(0, 1))).isGreaterThan(0);
assertThat(new Interval<Void>(0, 2).compareTo(new Interval<>(-1, 0))).isGreaterThan(0);
assertThat(new Interval<Void>(0, 2).compareTo(new Interval<>(-1, 1))).isGreaterThan(0);
}
}
| [
"skopekondrej@gmail.com"
] | skopekondrej@gmail.com |
63fb211369be4a643c5c2a05f41e61e3f430c4b9 | 8b47e0142f36b82b62ef6f6e64d3fd7e4b3e26aa | /day3/WhileLab2.java | d643e7eb4038a3abed4fc6ff1844a2e438b0b1bc | [] | no_license | Park-MinSoo/TIL | a93632f9e939f41059cc4c9fcd3aab82987de7d7 | e87d2873957d2d9e7bc1b3cd7d269c3240a0ed43 | refs/heads/master | 2020-09-26T09:04:12.172158 | 2020-01-06T07:44:27 | 2020-01-06T07:44:27 | 226,223,361 | 4 | 0 | null | null | null | null | UHC | Java | false | false | 489 | java | package day3;
public class WhileLab2 {
public static void main(String[] args) {
int pairNum1 = (int)(Math.random()*6)+1;
int pairNum2 = (int)(Math.random()*6)+1;
while(true) {
if(pairNum1 > pairNum2) {
System.out.println(pairNum1 + "이" +pairNum2 + "보다 크다.");
}
else if (pairNum1 < pairNum2){
System.out.println(pairNum1 + "이" +pairNum2 + "보다 작다.");
}
else
System.out.println("게임 끝");
break;
}
}
}
| [
"noreply@github.com"
] | Park-MinSoo.noreply@github.com |
e55e04895f094499ce927d3152042524814f41ea | f2f9a6faf83d766b8608c458a0405a56ba466a89 | /FundTransfer/src/main/java/com/bank/repository/TransactionRepository.java | c841f67b1a91777c9bd816bf5284f628c783aea7 | [] | no_license | Vasugi-P/ProjectsDownload | b46512ff267fec84d0a925d8a5673ec70f968ff1 | 2c648ad8dfd009da096acbad5eebf129298bebd9 | refs/heads/main | 2023-02-22T02:00:35.675338 | 2021-01-19T06:56:59 | 2021-01-19T06:56:59 | 330,887,337 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 285 | java | package com.bank.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.bank.entity.Transaction;
@Repository
public interface TransactionRepository extends JpaRepository<Transaction,Long> {
}
| [
"noreply@github.com"
] | Vasugi-P.noreply@github.com |
0a519efe6a0cfda588960465ea69311ffef6f4d4 | 061fc84af0b9c0694888659a6bd44ce56159a3ab | /sdk/src/main/java/com/gzch/lsplat/work/mode/DeviceInfoCache.java | b16612615153173646c0a81d2527d9cd520b137a | [] | no_license | Donwy/Arr | ac2b8180f5b26366e31e9ddd1e004554c9f9ac0e | e21dcea1c10d01662668feaeff4246b23a72af40 | refs/heads/master | 2020-07-29T20:37:09.909758 | 2019-10-11T03:49:21 | 2019-10-11T03:49:21 | 209,951,286 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,043 | java | package com.gzch.lsplat.work.mode;
import org.json.JSONObject;
import java.lang.ref.SoftReference;
/**
* Created by lw on 2019/7/8.
*/
public class DeviceInfoCache {
/**
* 获取到的设备信息
*/
private SoftReference<JSONObject> data;
/**
* 信息获取时间
*/
private long time;
public JSONObject getData() {
if (data != null){
return data.get();
}
return null;
}
public void setData(JSONObject device) {
if (device != null){
data = new SoftReference<JSONObject>(device);
}
}
public long getTime() {
return time;
}
public void setTime(long time) {
this.time = time;
}
/**
* 设备信息 有效期 5 分钟,超时后重新请求
* @return
*/
public boolean checkEqupInfo(){
if (getData() == null)return false;
if ((System.currentTimeMillis() - time) > 5 * 60 * 1000L){
return false;
}
return true;
}
}
| [
"572419921@qq.com"
] | 572419921@qq.com |
1f432bdd1de70d138817d6a15f9f7984d8185fe2 | 327e40b98bc537d97ed283bec22d21d9d693250d | /Source/SkyProcPatcher/FollowerPotionsPatcher/src/followerpotionspatcher/FollowerPotionsPatcher.java | 16405210f7d78596eea30f0069d36855041b31c4 | [] | no_license | kalivore/follower-potions-and-poisons | b38cd6db59abe5e924e5626b45eb863c824a4f7b | d3922eb0b148a54f88fb6de0178b3bcebb9d8179 | refs/heads/master | 2020-03-30T17:41:00.996843 | 2018-10-03T19:31:28 | 2018-10-03T19:31:28 | 151,465,589 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,016 | java | package followerpotionspatcher;
import java.awt.Color;
import java.awt.Font;
import java.net.URL;
import java.util.ArrayList;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import lev.gui.LSaveFile;
import skyproc.*;
import skyproc.gui.SPMainMenuPanel;
import skyproc.gui.SUM;
import skyproc.gui.SUMGUI;
import followerpotionspatcher.YourSaveFile.Settings;
/**
*
* @author Your Name Here
*/
public class FollowerPotionsPatcher implements SUM {
/*
* The important functions to change are:
* - getStandardMenu(), where you set up the GUI
* - runChangesToPatch(), where you put all the processing code and add records to the output patch.
*/
/*
* The types of records you want your patcher to import. Change this to
* customize the import to what you need.
*/
GRUP_TYPE[] importRequests = new GRUP_TYPE[]{
GRUP_TYPE.NPC_,
GRUP_TYPE.MGEF,
GRUP_TYPE.KYWD
};
public static String myPatchName = "Follower Potions Patcher";
public static String authorName = "Kalivore";
public static String version = "2.0";
public static String welcomeText = "This patcher applies the PerkSkillBoosts and AlchemySkillBoosts Perks to all NPCs, allowing them to benefit from the effects of Fortify enchantments and potions."+
"\n"+
"Also adds vanilla (but unused) MagicAlchDamageHealth, MagicAlchDamageMagicka and MagicAlchDamageStamina keywords to relevant poison Magic Effects, so followers can identify and use them.";
public static String descriptionToShowInSUM = "Applies the PerkSkillBoosts and AlchemySkillBoosts Perks to all NPCs, allowing them to benefit from the effects of Fortify enchantments and potions."+
"\n"+
"Also adds vanilla (but unused) MagicAlchDamageHealth, MagicAlchDamageMagicka and MagicAlchDamageStamina keywords to relevant poison Magic Effects, so followers can identify and use them.";
public static Color headerColor = new Color(66, 181, 184); // Teal
public static Color settingsColor = new Color(72, 179, 58); // Green
public static Font settingsFont = new Font("Serif", Font.BOLD, 15);
public static SkyProcSave save = new YourSaveFile();
// Do not write the bulk of your program here
// Instead, write your patch changes in the "runChangesToPatch" function
// at the bottom
public static void main(String[] args) {
try {
SPGlobal.createGlobalLog();
SPGlobal.logMain("SPGlobal", "Follower Potions Patcher is starting");
SUMGUI.open(new FollowerPotionsPatcher(), args);
}
catch (Exception e) {
// If a major error happens, print it everywhere and display a message box.
System.err.println(e.toString());
SPGlobal.logException(e);
JOptionPane.showMessageDialog(null, "There was an exception thrown during program execution: '" + e + "' Check the debug logs or contact the author.");
SPGlobal.closeDebug();
}
}
@Override
public String getName() {
return myPatchName;
}
// This function labels any record types that you "multiply".
// For example, if you took all the armors in a mod list and made 3 copies,
// you would put ARMO here.
// This is to help monitor/prevent issues where multiple SkyProc patchers
// multiply the same record type to yeild a huge number of records.
@Override
public GRUP_TYPE[] dangerousRecordReport() {
// None
return new GRUP_TYPE[0];
}
@Override
public GRUP_TYPE[] importRequests() {
return importRequests;
}
@Override
public boolean importAtStart() {
return false;
}
@Override
public boolean hasStandardMenu() {
return true;
}
// This is where you add panels to the main menu.
// First create custom panel classes (as shown by YourFirstSettingsPanel),
// Then add them here.
@Override
public SPMainMenuPanel getStandardMenu() {
SPMainMenuPanel settingsMenu = new SPMainMenuPanel(getHeaderColor());
settingsMenu.setWelcomePanel(new WelcomePanel(settingsMenu));
settingsMenu.addMenu(new OtherSettingsPanel(settingsMenu), false, save, Settings.OTHER_SETTINGS);
return settingsMenu;
}
// Usually false unless you want to make your own GUI
@Override
public boolean hasCustomMenu() {
return false;
}
@Override
public JFrame openCustomMenu() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean hasLogo() {
return false;
}
@Override
public URL getLogo() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean hasSave() {
return true;
}
@Override
public LSaveFile getSave() {
return save;
}
@Override
public String getVersion() {
return version;
}
@Override
public ModListing getListing() {
return new ModListing(getName(), false);
}
@Override
public Mod getExportPatch() {
Mod out = new Mod(getListing());
out.setAuthor(authorName);
return out;
}
@Override
public Color getHeaderColor() {
return headerColor;
}
// Add any custom checks to determine if a patch is needed.
// On Automatic Variants, this function would check if any new packages were
// added or removed.
@Override
public boolean needsPatching() {
return false;
}
// This function runs when the program opens to "set things up"
// It runs right after the save file is loaded, and before the GUI is displayed
@Override
public void onStart() throws Exception {
}
// This function runs right as the program is about to close.
@Override
public void onExit(boolean patchWasGenerated) throws Exception {
}
// Add any mods that you REQUIRE to be present in order to patch.
@Override
public ArrayList<ModListing> requiredMods() {
return new ArrayList<>(0);
}
@Override
public String description() {
return "Applies the PerkSkillBoosts and AlchemySkillBoosts Perks to all NPCs, allowing them to benefit from the effects of Fortify enchantments and potions."+
"\n"+
"Also adds vanilla (but unused) MagicAlchDamageHealth, MagicAlchDamageMagicka and MagicAlchDamageStamina keywords to relevant poison Magic Effects, so followers can identify and use them.";
}
// This is where you should write the bulk of your code.
// Write the changes you would like to make to the patch,
// but DO NOT export it. Exporting is handled internally.
@Override
public void runChangesToPatch() throws Exception
{
Mod patch = SPGlobal.getGlobalPatch();
Mod merger = new Mod(getName() + "Merger", false);
merger.addAsOverrides(SPGlobal.getDB());
// Write your changes to the patch here.
FormID mgefFearFormId = new FormID("73F20", "Skyrim.esm");
FormID mgefFrenzyFormId = new FormID("73F29", "Skyrim.esm");
MGEF fear = (MGEF)merger.getMajor(mgefFearFormId, GRUP_TYPE.MGEF);
MGEF frenzy = (MGEF)merger.getMajor(mgefFrenzyFormId, GRUP_TYPE.MGEF);
// get the 'BasicNeedsSleepRested' keyword
FormID cacoKeywordFormId = new FormID("5D2183", "Complete Alchemy & Cooking Overhaul.esp");
KYWD cacoKeyword = (KYWD)merger.getMajor(cacoKeywordFormId, GRUP_TYPE.KYWD);
if (cacoKeyword == null)
{
SPGlobal.logMain("SPGlobal", "CACO not present - adding MagicAlchDamage keywords to effects");
FormID mgefDamageHealthFormId = new FormID("3EB42", "Skyrim.esm");
FormID mgefDamageMagickaFormId = new FormID("3A2B6", "Skyrim.esm");
FormID mgefDamageStaminaFormId = new FormID("3A2C6", "Skyrim.esm");
FormID alchDamageHealthFormId = new FormID("10F9DD", "Skyrim.esm");
FormID alchDamageMagickaFormId = new FormID("10F9DE", "Skyrim.esm");
FormID alchDamageStaminaFormId = new FormID("10F9DC", "Skyrim.esm");
FormID alchHarmfulFormId = new FormID("42509", "Skyrim.esm");
MGEF damageHealth = (MGEF)merger.getMajor(mgefDamageHealthFormId, GRUP_TYPE.MGEF);
damageHealth.getKeywordSet().addKeywordRef(alchDamageHealthFormId);
patch.addRecord(damageHealth);
MGEF damageMagicka = (MGEF)merger.getMajor(mgefDamageMagickaFormId, GRUP_TYPE.MGEF);
damageMagicka.getKeywordSet().addKeywordRef(alchDamageMagickaFormId);
patch.addRecord(damageMagicka);
MGEF damageStamina = (MGEF)merger.getMajor(mgefDamageStaminaFormId, GRUP_TYPE.MGEF);
damageStamina.getKeywordSet().addKeywordRef(alchDamageStaminaFormId);
patch.addRecord(damageStamina);
fear.getKeywordSet().addKeywordRef(alchHarmfulFormId);
frenzy.getKeywordSet().addKeywordRef(alchHarmfulFormId);
}
else
{
SPGlobal.logMain("SPGlobal", "CACO present - MagicAlchDamage keywords already on effects");
// FormID alchSilenceCacoFormId = new FormID("07A150", "Complete Alchemy & Cooking Overhaul.esp");
// FormID alchFatigueCacoFormId = new FormID("07A153", "Complete Alchemy & Cooking Overhaul.esp");
// FormID alchDrainIntCacoFormId = new FormID("25B701", "Complete Alchemy & Cooking Overhaul.esp");
//
}
FormID fppMagicFearFormId = new FormID("01256F", "FollowerPotions.esp");
KYWD kywdFear = (KYWD)merger.getMajor(fppMagicFearFormId, GRUP_TYPE.KYWD);
if (kywdFear != null)
{
SPGlobal.logMain("SPGlobal", "Adding FPP MagicFear keyword");
fear.getKeywordSet().addKeywordRef(fppMagicFearFormId);
patch.addRecord(fear);
}
else if (cacoKeyword == null)
{
patch.addRecord(fear);
}
FormID fppMagicFrenzyFormId = new FormID("012570", "FollowerPotions.esp");
KYWD kywdFrenzy = (KYWD)merger.getMajor(fppMagicFrenzyFormId, GRUP_TYPE.KYWD);
if (kywdFrenzy != null)
{
SPGlobal.logMain("SPGlobal", "Adding FPP MagicFrenzy keyword");
frenzy.getKeywordSet().addKeywordRef(fppMagicFrenzyFormId);
patch.addRecord(frenzy);
}
else if (cacoKeyword == null)
{
patch.addRecord(frenzy);
}
// add perks for NPCs
FormID enchPerkID = new FormID("cf788", "Skyrim.esm");
FormID alchPerkID = new FormID("a725c", "Skyrim.esm");
for (NPC_ n : merger.getNPCs())
{
ArrayList<SubFormInt> npcPerks = n.getPerks();
ArrayList<FormID> npcPerkForms = new ArrayList<>(npcPerks.size());
npcPerks.forEach((s) -> npcPerkForms.add(s.getForm()));
if (!save.getBool(Settings.ONLY_ADD_FOLLOWERS))
{
if (needsPerks(npcPerkForms, enchPerkID, alchPerkID, n)) {
patch.addRecord(n);
SPGlobal.logMain("SPGlobal", "NPC " + n.getName() + " added as we're adding all NPCs");
}
continue;
}
ArrayList<SubFormInt> factions = n.getFactions();
for (SubFormInt f : factions)
{
boolean potFollower = "0005C84D".equals(f.getFormStr());
boolean curFollower = "0005C84E".equals(f.getFormStr());
if (!potFollower && !curFollower)
{
continue;
}
if (potFollower)
{
SPGlobal.logMain("SPGlobal", "NPC " + n.getName() + " is in Pot Follower faction");
}
else if (curFollower)
{
SPGlobal.logMain("SPGlobal", "NPC " + n.getName() + " is in Cur Follower faction");
}
if (needsPerks(npcPerkForms, enchPerkID, alchPerkID, n)) {
patch.addRecord(n);
}
break;
}
}
}
private boolean needsPerks(ArrayList<FormID> npcPerkForms, FormID enchPerkID, FormID alchPerkID, NPC_ n) {
boolean altered = false;
if (!npcPerkForms.contains(enchPerkID)) {
n.addPerk(enchPerkID, 1);
altered = true;
}
if (!npcPerkForms.contains(enchPerkID)) {
n.addPerk(alchPerkID, 1);
altered = true;
}
return altered;
}
}
| [
"carbonel@b3f044cf-877e-40fc-ad9c-bbe828048b5c"
] | carbonel@b3f044cf-877e-40fc-ad9c-bbe828048b5c |
6504d32a19a9523d5cc303c47eeaa2d313eeb3c6 | a81021e76f0f5983d4876c82f52636ab830b2d81 | /src/net/wms/view/Userdelete.java | fb2d62b128ee2223b198cbaf7e0715480e447d15 | [] | no_license | monkeyXiang/Information | a7410415f8f6146d05acecdee7dbe206f9dd83a5 | adff21eae8055b70f3cd57b0b6ecedcbec995077 | refs/heads/master | 2020-06-06T19:44:06.005138 | 2019-07-03T15:59:01 | 2019-07-03T15:59:01 | 192,837,586 | 1 | 0 | null | null | null | null | GB18030 | Java | false | false | 3,650 | java | package net.wms.view;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import net.wms.bean.User;
import net.wms.dao.LoginUseImp;
public class Userdelete extends IndexAdmin {
//声明部分对象
JLabel name;
JLabel pwd;
JLabel style;
JTextField dname;
//为User类初始化对象
User user = new User();
//构造函数
public Userdelete(String name) {
super(name);
init();
}
public void init() {
//初始化字体
Font d = new Font("楷体", Font.BOLD, 24);
Font f = new Font("楷体", Font.BOLD, 18);
//初始化对象
JLabel userdelete = new JLabel("用户删除");
JLabel deletename = new JLabel("输入用户名:");
dname = new JTextField();
JLabel usertitle = new JLabel("删除的用户信息");
JLabel username = new JLabel("用户名:");
name = new JLabel();
JLabel userpwd = new JLabel("密 码:");
pwd = new JLabel();
JLabel userstyle = new JLabel("类 型:");
style = new JLabel();
JButton submit = new JButton("确定");
JButton delete = new JButton("删除");
//设置对象
userdelete.setBounds(250, 30, 100, 40);
userdelete.setFont(d);
deletename.setBounds(120, 90, 120, 30);
deletename.setFont(f);
dname.setBounds(230, 90, 150, 30);
dname.setFont(f);
usertitle.setBounds(200, 140, 200, 40);
usertitle.setFont(d);
username.setBounds(160, 200, 80, 30);
username.setFont(f);
name.setBounds(240, 200, 150, 30);
name.setFont(f);
userpwd.setBounds(160, 260, 80, 30);
userpwd.setFont(f);
pwd.setBounds(240, 260, 150, 30);
pwd.setFont(f);
userstyle.setBounds(160, 320, 80, 30);
userstyle.setFont(f);
style.setBounds(240, 320, 150, 30);
style.setFont(f);
submit.setBounds(390, 90, 80, 30);
submit.setFont(f);
delete.setBounds(250, 380, 80, 30);
delete.setFont(f);
//添加对象
index.add(userdelete);
index.add(deletename);
index.add(dname);
index.add(submit);
index.add(usertitle);
index.add(username);
index.add(name);
index.add(userpwd);
index.add(pwd);
index.add(style);
index.add(userstyle);
index.add(delete);
//为确定按钮添加监听事件
submit.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
//从文本框中取得用户名设置进user对象中
user.setusername(dname.getText());
LoginUseImp l = new LoginUseImp();
boolean b;
try {
//执行sql语句
b = l.Query1(user, "select * from users where username= '"+dname.getText()+"'");
if(b){
//将数据库中的值设置进文本框
name.setText(user.getusername());
pwd.setText(user.getuserpwd());
style.setText(user.getFlag());
} else {
//未查找到提示框
JOptionPane.showMessageDialog(null,"未查到该用户");
}
} catch (SQLException e1) {
e1.printStackTrace();
}
}
});
//为删除按钮添加监听事件
delete.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
//将选中的名字添加进文本框
user.setusername(dname.getText());
LoginUseImp l = new LoginUseImp();
try {
//执行删除的sql语句
l.Delete(user, "delete from users where username='"+dname.getText()+"'");
JOptionPane.showMessageDialog(null, "删除成功");
} catch (SQLException e1) {
// TODO 自动生成的 catch 块
e1.printStackTrace();
}
}
});
}
} | [
"xianghanglove@outlook.com"
] | xianghanglove@outlook.com |
a483be50bb59f246e5a9c6b5ed3ece87fad22b4c | d83ca5bd812cde55ce2e1866113265bc807038cd | /svn/src/java/modele/Pays.java | 9f3f2745e33ec75ad8958b9136cc13f6007d2835 | [] | no_license | fseigneur/svn-florian | cbc3ae931a3e367de155be3569dcc83840850f5e | fdd6eab95050509c2326f8c5640ae787039bfe5c | refs/heads/master | 2021-01-10T11:07:34.928058 | 2013-12-03T13:15:54 | 2013-12-03T13:15:54 | 53,979,426 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,387 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package modele;
import java.util.Collection;
import java.util.HashSet;
/**
*
* @author fseigneur
*/
public class Pays {
private Collection<Spe> lesSpes= new HashSet<Spe>();
private Collection<Departement> lesDeps = new HashSet<Departement>();
public Pays() {
lesDeps = DAO.getLesDeps();
lesSpes = DAO.getLesSpes();
this.assocMedecins(DAO.getLesMeds());
}
public Collection<Departement> getLesDeps() {
return lesDeps;
}
public Collection<Spe> getLesSpes(){
return lesSpes;
}
private void assocMedecins(Collection<Medecin> lesMeds){
for(Medecin unMed : lesMeds){
getLeDep(unMed.getLeDep()).addUnMed(unMed);
Spe uneSpe = getLaSpe(unMed.getSpe());
if(uneSpe != null){
uneSpe.addUnMed(unMed);
}
}
}
public Departement getLeDep(String numDep) {
for (Departement d : lesDeps) {
if (numDep.equals(d.getNum())) {
return d;
}
}
return null;
}
public Spe getLaSpe(String num) {
for (Spe uneSpe : lesSpes) {
if (uneSpe.getNum().equals(num)) {
return uneSpe;
}
}
return null;
}
} | [
"turgotseigneurflorian@gmail.com"
] | turgotseigneurflorian@gmail.com |
5ebb8c3091f4910a7df7bd76f0c130d53a83d84a | 08824148c423ca9f9940fa267a8a441308060010 | /lib/taskana-core/src/test/java/acceptance/builder/WorkbasketAccessItemBuilderTest.java | 68a7f4dd4c2fd9b774d7f002ef90b723d00c0b0a | [
"Apache-2.0"
] | permissive | Haasini98/Taskana | 439fd0d8881d5540fc0a64900e900bef7aa90ad1 | 60cdb4b08fb0008f5f2c77dd8627faa7f8d28c37 | refs/heads/master | 2023-08-04T17:59:01.708071 | 2021-09-16T15:48:44 | 2021-09-16T15:48:44 | 407,483,963 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,103 | java | package acceptance.builder;
import static acceptance.DefaultTestEntities.defaultTestWorkbasket;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.AssertionsForClassTypes.assertThatCode;
import static pro.taskana.common.internal.util.CheckedSupplier.wrap;
import static pro.taskana.workbasket.internal.WorkbasketAccessItemBuilder.newWorkbasketAccessItem;
import acceptance.TaskanaIntegrationTestExtension;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import pro.taskana.common.api.TaskanaEngine;
import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.workbasket.api.WorkbasketPermission;
import pro.taskana.workbasket.api.WorkbasketService;
import pro.taskana.workbasket.api.models.Workbasket;
import pro.taskana.workbasket.api.models.WorkbasketAccessItem;
import pro.taskana.workbasket.internal.WorkbasketAccessItemBuilder;
import pro.taskana.workbasket.internal.models.WorkbasketAccessItemImpl;
@ExtendWith({JaasExtension.class, TaskanaIntegrationTestExtension.class})
class WorkbasketAccessItemBuilderTest {
private final WorkbasketService workbasketService;
private final TaskanaEngine taskanaEngine;
WorkbasketAccessItemBuilderTest(
WorkbasketService workbasketService, TaskanaEngine taskanaEngine) {
this.workbasketService = workbasketService;
this.taskanaEngine = taskanaEngine;
}
@WithAccessId(user = "businessadmin")
@Test
void should_PersistWorkbasketAccessItem_When_UsingWorkbasketAccessItemBuilder() throws Exception {
Workbasket workbasket = defaultTestWorkbasket().key("key0_F").buildAndStore(workbasketService);
WorkbasketAccessItem workbasketAccessItem =
newWorkbasketAccessItem()
.workbasketId(workbasket.getId())
.accessId("user-1-1")
.permission(WorkbasketPermission.READ)
.buildAndStore(workbasketService);
List<WorkbasketAccessItem> workbasketAccessItems =
workbasketService.getWorkbasketAccessItems(workbasket.getId());
assertThat(workbasketAccessItems).containsExactly(workbasketAccessItem);
}
@Test
void should_PersistWorkbasketAccessItemAsUser_When_UsingWorkbasketAccessItemBuilder()
throws Exception {
Workbasket workbasket =
defaultTestWorkbasket().key("key1_F").buildAndStore(workbasketService, "businessadmin");
WorkbasketAccessItem workbasketAccessItem =
newWorkbasketAccessItem()
.workbasketId(workbasket.getId())
.accessId("user-1-1")
.permission(WorkbasketPermission.READ)
.buildAndStore(workbasketService, "businessadmin");
List<WorkbasketAccessItem> workbasketAccessItems =
taskanaEngine.runAsAdmin(
wrap(() -> workbasketService.getWorkbasketAccessItems(workbasket.getId())));
assertThat(workbasketAccessItems).containsExactly(workbasketAccessItem);
}
@WithAccessId(user = "businessadmin")
@Test
void should_PopulateWorkbasketAccessItem_When_UsingEveryBuilderFunction() throws Exception {
Workbasket workbasket = defaultTestWorkbasket().key("key2_F").buildAndStore(workbasketService);
WorkbasketAccessItemImpl expectedWorkbasketAccessItem =
(WorkbasketAccessItemImpl)
workbasketService.newWorkbasketAccessItem(workbasket.getId(), "user-1-1");
expectedWorkbasketAccessItem.setWorkbasketKey(workbasket.getKey());
expectedWorkbasketAccessItem.setAccessName("Max Mustermann");
expectedWorkbasketAccessItem.setPermission(WorkbasketPermission.READ, true);
expectedWorkbasketAccessItem.setPermission(WorkbasketPermission.OPEN, true);
expectedWorkbasketAccessItem.setPermission(WorkbasketPermission.APPEND, true);
expectedWorkbasketAccessItem.setPermission(WorkbasketPermission.TRANSFER, true);
expectedWorkbasketAccessItem.setPermission(WorkbasketPermission.DISTRIBUTE, true);
expectedWorkbasketAccessItem.setPermission(WorkbasketPermission.CUSTOM_1, true);
expectedWorkbasketAccessItem.setPermission(WorkbasketPermission.CUSTOM_2, true);
expectedWorkbasketAccessItem.setPermission(WorkbasketPermission.CUSTOM_3, true);
expectedWorkbasketAccessItem.setPermission(WorkbasketPermission.CUSTOM_4, true);
expectedWorkbasketAccessItem.setPermission(WorkbasketPermission.CUSTOM_5, true);
expectedWorkbasketAccessItem.setPermission(WorkbasketPermission.CUSTOM_6, true);
expectedWorkbasketAccessItem.setPermission(WorkbasketPermission.CUSTOM_7, true);
expectedWorkbasketAccessItem.setPermission(WorkbasketPermission.CUSTOM_8, true);
expectedWorkbasketAccessItem.setPermission(WorkbasketPermission.CUSTOM_9, true);
expectedWorkbasketAccessItem.setPermission(WorkbasketPermission.CUSTOM_10, true);
expectedWorkbasketAccessItem.setPermission(WorkbasketPermission.CUSTOM_11, true);
expectedWorkbasketAccessItem.setPermission(WorkbasketPermission.CUSTOM_12, true);
WorkbasketAccessItem accessItem =
newWorkbasketAccessItem()
.workbasketId(workbasket.getId())
.accessId("user-1-1")
.accessName("Max Mustermann")
.permission(WorkbasketPermission.READ)
.permission(WorkbasketPermission.OPEN)
.permission(WorkbasketPermission.APPEND)
.permission(WorkbasketPermission.TRANSFER)
.permission(WorkbasketPermission.DISTRIBUTE)
.permission(WorkbasketPermission.CUSTOM_1)
.permission(WorkbasketPermission.CUSTOM_2)
.permission(WorkbasketPermission.CUSTOM_3)
.permission(WorkbasketPermission.CUSTOM_4)
.permission(WorkbasketPermission.CUSTOM_5)
.permission(WorkbasketPermission.CUSTOM_6)
.permission(WorkbasketPermission.CUSTOM_7)
.permission(WorkbasketPermission.CUSTOM_8)
.permission(WorkbasketPermission.CUSTOM_9)
.permission(WorkbasketPermission.CUSTOM_10)
.permission(WorkbasketPermission.CUSTOM_11)
.permission(WorkbasketPermission.CUSTOM_12)
.buildAndStore(workbasketService);
assertThat(accessItem)
.hasNoNullFieldsOrProperties()
.usingRecursiveComparison()
.ignoringFields("id")
.isEqualTo(expectedWorkbasketAccessItem);
}
@WithAccessId(user = "businessadmin")
@Test
void should_ResetClassificationId_When_StoringClassificationMultipleTimes() throws Exception {
Workbasket workbasket = defaultTestWorkbasket().key("key3_F").buildAndStore(workbasketService);
WorkbasketAccessItemBuilder workbasketAccessItemBuilder =
newWorkbasketAccessItem()
.workbasketId(workbasket.getId())
.permission(WorkbasketPermission.READ);
assertThatCode(
() -> {
workbasketAccessItemBuilder.accessId("hanspeter").buildAndStore(workbasketService);
workbasketAccessItemBuilder.accessId("hanspeter2").buildAndStore(workbasketService);
})
.doesNotThrowAnyException();
}
}
| [
"15628173+mustaphazorgati@users.noreply.github.com"
] | 15628173+mustaphazorgati@users.noreply.github.com |
8df61e13e00d0c1ee88b0f58e4b9641ca1ceeca0 | b062d73eb71fb7af07e6b20b5c9f82f4b0f4adcd | /src/test/java/enterprises/orbital/evekit/sde/indtests/TestIndBlueprint.java | c480a4022451a55864ea5c6a01bfa0567455631d | [] | no_license | OrbitalEnterprises/evekit-sde | 479690e5ec07592bfd93718bf21b102ae4e22f02 | 0f2bc3a998c75477c9f8c6ed853c8be9b54840c2 | refs/heads/master | 2022-07-05T22:50:11.695668 | 2022-06-21T03:11:17 | 2022-06-21T03:11:17 | 55,967,837 | 3 | 0 | null | 2022-06-21T03:11:18 | 2016-04-11T11:49:11 | Java | UTF-8 | Java | false | false | 1,204 | java | package enterprises.orbital.evekit.sde.indtests;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import enterprises.orbital.evekit.sde.AttributeSelector;
import enterprises.orbital.evekit.sde.TestSetup;
import enterprises.orbital.evekit.sde.ind.IndBlueprint;
public class TestIndBlueprint extends TestSetup {
@Test
public void testTableCount() {
int maxresults = 1000;
int contid = 0;
AttributeSelector all = new AttributeSelector("{any:true}");
List<IndBlueprint> next = IndBlueprint.access(contid, maxresults, all, all);
while (!next.isEmpty()) {
contid += next.size();
next = IndBlueprint.access(contid, maxresults, all, all);
}
Assert.assertEquals(4398, contid);
}
@Test
public void testRandomElement() {
AttributeSelector all = new AttributeSelector("{any:true}");
List<IndBlueprint> next = IndBlueprint.access(0, 1000, new AttributeSelector("{values:[687]}"), all);
Assert.assertEquals(1, next.size());
IndBlueprint random = next.get(0);
Assert.assertNotNull(random);
Assert.assertEquals(687, random.getTypeID());
Assert.assertEquals(new Integer(10), random.getMaxProductionLimit());
}
}
| [
"deadlybulb@orbital.enterprises"
] | deadlybulb@orbital.enterprises |
6139a78aba0fd6f9f9cc7474d574bf3ea14d80cc | f1f2db7925443c4ca99dbe4b6be3082c8203cbc4 | /Semester 1/email.java | e45b047dc8fd4af36cc54490e7cd40e9a2d64dbe | [] | no_license | lambegraham/FirstYearJava | 1e1d9cf8abcb9e4fe698140879bbccb7214b38d6 | c8f46187a7b99676514ef5518211f4b160d2f9a0 | refs/heads/master | 2020-07-06T17:50:29.017914 | 2019-08-20T17:46:19 | 2019-08-20T17:46:19 | 203,095,160 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 231 | java | public class email {
public static void main (String [] args) {
String firstname = new String("Micky");
String secondname = new String("Mouse");
String yr = new String("2017");
String mu = new String ("@mumail.ie");
}
} | [
"lambegraham@gmail.com"
] | lambegraham@gmail.com |
82e14559d4595b31b577493048863343e3430bd5 | eb9f655206c43c12b497c667ba56a0d358b6bc3a | /plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/AbstractLombokParsingTestCase.java | cb804b0492e56b71180af02888065827305add6a | [
"Apache-2.0"
] | permissive | JetBrains/intellij-community | 2ed226e200ecc17c037dcddd4a006de56cd43941 | 05dbd4575d01a213f3f4d69aa4968473f2536142 | refs/heads/master | 2023-09-03T17:06:37.560889 | 2023-09-03T11:51:00 | 2023-09-03T12:12:27 | 2,489,216 | 16,288 | 6,635 | Apache-2.0 | 2023-09-12T07:41:58 | 2011-09-30T13:33:05 | null | UTF-8 | Java | false | false | 18,223 | java | package de.plushnikov.intellij.plugin;
import com.google.common.base.Objects;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.pom.PomNamedTarget;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.containers.ContainerUtil;
import de.plushnikov.intellij.plugin.util.PsiElementUtil;
import org.jetbrains.annotations.NotNull;
import java.util.*;
import java.util.function.Predicate;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* Base test case for testing that the Lombok plugin parses the Lombok annotations correctly.
*/
public abstract class AbstractLombokParsingTestCase extends AbstractLombokLightCodeInsightTestCase {
private static final Logger LOG = Logger.getInstance(AbstractLombokParsingTestCase.class);
protected boolean shouldCompareAnnotations() {
return !".*".equals(annotationToComparePattern());
}
protected String annotationToComparePattern() {
return ".*";
}
protected Collection<String> annotationsToIgnoreList() {
return Set.of("java.lang.SuppressWarnings", "java.lang.Override", "com.fasterxml.jackson.databind.annotation.JsonDeserialize");
}
protected boolean shouldCompareCodeBlocks() {
return true;
}
public void doTest() {
doTest(false);
}
public void doTest(final boolean lowercaseFirstLetter) {
doTest(getTestName(lowercaseFirstLetter));
}
public void doTest(String testName) {
compareFiles(loadBeforeLombokFile(testName), loadAfterDeLombokFile(testName));
}
private PsiJavaFile loadBeforeLombokFile(String testName) {
return getPsiJavaFile(testName, "before");
}
private PsiJavaFile loadAfterDeLombokFile(String testName) {
return getPsiJavaFile(testName, "after");
}
@NotNull
private PsiJavaFile getPsiJavaFile(String testName, String type) {
final String fileName = testName.replace('$', '/') + ".java";
final String filePath = type + "/" + fileName;
final PsiFile psiFile = loadToPsiFile(filePath);
if (!(psiFile instanceof PsiJavaFile)) {
fail("The test file type is not supported");
}
return (PsiJavaFile)psiFile;
}
protected void compareFiles(PsiJavaFile beforeLombokFile, PsiJavaFile afterDelombokFile) {
PsiClass[] beforeClasses = beforeLombokFile.getClasses();
PsiClass[] afterClasses = afterDelombokFile.getClasses();
compareClasses(beforeClasses, afterClasses);
}
private void compareClasses(PsiClass[] beforeClasses, PsiClass[] afterClasses) {
String before = "Before classes: " + Arrays.toString(beforeClasses);
String after = "After classes: " + Arrays.toString(afterClasses);
assertEquals("Class counts are different " + before + " <> " + after, afterClasses.length, beforeClasses.length);
for (PsiClass afterClass : afterClasses) {
boolean compared = false;
for (PsiClass beforeClass : beforeClasses) {
if (Objects.equal(afterClass.getName(), beforeClass.getName())) {
compareTwoClasses(beforeClass, afterClass);
compared = true;
}
}
assertTrue("Class names are not equal, class (" + afterClass.getName() + ") not found", compared);
}
}
private void compareTwoClasses(PsiClass beforeClass, PsiClass afterClass) {
LOG.info("Comparing classes " + beforeClass.getName() + " with " + afterClass.getName());
PsiModifierList beforeFieldModifierList = beforeClass.getModifierList();
PsiModifierList afterFieldModifierList = afterClass.getModifierList();
compareContainingClasses(beforeClass, afterClass);
if (beforeFieldModifierList != null && afterFieldModifierList != null) {
compareModifiers(beforeFieldModifierList, afterFieldModifierList);
}
compareFields(beforeClass, afterClass);
compareMethods(beforeClass, afterClass);
compareConstructors(beforeClass, afterClass);
compareInnerClasses(beforeClass, afterClass);
LOG.debug("Compared classes IntelliJ " + beforeClass.getName() + " with " + afterClass.getName());
}
private void compareFields(PsiClass beforeClass, PsiClass afterClass) {
PsiField[] beforeClassFields = beforeClass.getFields();
PsiField[] afterClassFields = afterClass.getFields();
LOG.debug("IntelliJ fields for class " + beforeClass.getName() + ": " + Arrays.toString(beforeClassFields));
LOG.debug("Theirs fields for class " + afterClass.getName() + ": " + Arrays.toString(afterClassFields));
assertEquals("Field are different for Class: " + beforeClass.getName(),
Arrays.toString(toList(afterClassFields)), Arrays.toString(toList(beforeClassFields)));
for (PsiField afterField : afterClassFields) {
boolean compared = false;
final PsiModifierList afterFieldModifierList = afterField.getModifierList();
for (PsiField beforeField : beforeClassFields) {
if (Objects.equal(afterField.getName(), beforeField.getName())) {
final PsiModifierList beforeFieldModifierList = beforeField.getModifierList();
if (beforeFieldModifierList != null && afterFieldModifierList != null) {
compareModifiers(beforeFieldModifierList, afterFieldModifierList);
}
compareType(beforeField.getType(), afterField.getType(), afterField);
compareInitializers(beforeField.getInitializer(), afterField.getInitializer());
compared = true;
}
}
assertTrue("Fieldnames are not equal, Field (" + afterField.getName() + ") not found", compared);
}
}
private static void compareInitializers(PsiExpression beforeInitializer, PsiExpression afterInitializer) {
String beforeInitializerText = null == beforeInitializer ? "" : beforeInitializer.getText();
String afterInitializerText = null == afterInitializer ? "" : afterInitializer.getText();
assertEquals("Initializers are not equals ", afterInitializerText, beforeInitializerText);
}
private static void compareType(PsiType beforeType, PsiType afterType, PomNamedTarget whereTarget) {
if (null != beforeType && null != afterType) {
final String afterText = stripJavaLang(afterType.getCanonicalText());
final String beforeText = stripJavaLang(beforeType.getCanonicalText());
assertEquals(String.format("Types are not equal for element: %s", whereTarget.getName()), afterText, beforeText);
}
}
private static String stripJavaLang(String canonicalText) {
return StringUtil.trimStart(canonicalText, "java.lang.");
}
private void compareModifiers(@NotNull PsiModifierList beforeModifierList, @NotNull PsiModifierList afterModifierList) {
for (String modifier : PsiModifier.MODIFIERS) {
boolean haveSameModifiers = afterModifierList.hasModifierProperty(modifier) == beforeModifierList.hasModifierProperty(modifier);
if (!haveSameModifiers) {
final PsiMethod afterModifierListParentMethod = PsiTreeUtil.getContextOfType(afterModifierList, PsiMethod.class);
final PsiMethod afterModifierListParentField = PsiTreeUtil.getContextOfType(afterModifierList, PsiMethod.class);
final PsiClass afterModifierListParentClass = PsiTreeUtil.getContextOfType(afterModifierList, PsiClass.class);
final String target;
if (afterModifierListParentMethod != null) {
target = afterModifierListParentMethod.getText();
}
else if (afterModifierListParentField != null) {
target = afterModifierListParentField.getName();
}
else {
target = afterModifierListParentClass.getName();
}
fail(modifier + " Modifier is not equal for " + target);
}
}
compareAnnotations(beforeModifierList, afterModifierList);
}
private void compareAnnotations(PsiModifierList beforeModifierList, PsiModifierList afterModifierList) {
if (shouldCompareAnnotations()) {
Collection<String> beforeAnnotations = Arrays.stream(beforeModifierList.getAnnotations())
.map(PsiAnnotation::getQualifiedName)
.filter(Pattern.compile("lombok.*").asPredicate().negate().or(LombokClassNames.NON_NULL::equals))
.filter(Pattern.compile(annotationToComparePattern()).asPredicate())
.filter(Predicate.not(annotationsToIgnoreList()::contains))
.toList();
Collection<String> afterAnnotations = Arrays.stream(afterModifierList.getAnnotations())
.map(PsiAnnotation::getQualifiedName)
.filter(Pattern.compile(annotationToComparePattern()).asPredicate())
.filter(Predicate.not(annotationsToIgnoreList()::contains))
.toList();
assertTrue("Annotations are different for " + afterModifierList.getParent() + ": " + beforeAnnotations + "/" + afterAnnotations,
beforeAnnotations.size() == afterAnnotations.size()
&& beforeAnnotations.containsAll(afterAnnotations)
&& afterAnnotations.containsAll(beforeAnnotations));
// compare annotations parameter list
for (PsiAnnotation beforeAnnotation : beforeModifierList.getAnnotations()) {
String qualifiedName = beforeAnnotation.getQualifiedName();
PsiAnnotation afterAnnotation = afterModifierList.findAnnotation(qualifiedName);
if (null != afterAnnotation) {
Map<String, String> beforeParameter = Stream.of(beforeAnnotation.getParameterList().getAttributes())
.collect(Collectors.toMap(PsiNameValuePair::getAttributeName, p -> p.getValue().getText()));
Map<String, String> afterParameter = Stream.of(afterAnnotation.getParameterList().getAttributes())
.collect(Collectors.toMap(PsiNameValuePair::getAttributeName, p -> p.getValue().getText()));
assertEquals("Annotation parameter are not same for " + qualifiedName, afterParameter, beforeParameter);
}
}
}
}
private void compareMethods(PsiClass beforeClass, PsiClass afterClass) {
PsiMethod[] beforeMethods = beforeClass.getMethods();
PsiMethod[] afterMethods = afterClass.getMethods();
assertEquals("Methods are different for Class: " + beforeClass.getName(),
Arrays.toString(toList(afterMethods)), Arrays.toString(toList(beforeMethods)));
for (PsiMethod afterMethod : afterMethods) {
final Collection<PsiMethod> matchedMethods = filterMethods(beforeMethods, afterMethod);
if (matchedMethods.isEmpty()) {
fail("Method names are not equal, Method: (" + afterMethod.getName() + ") not found in class : " + beforeClass.getName());
}
for (PsiMethod beforeMethod : matchedMethods) {
compareMethod(beforeClass, afterClass, afterMethod, beforeMethod);
}
}
}
private void compareMethod(PsiClass beforeClass, PsiClass afterClass, PsiMethod afterMethod, PsiMethod beforeMethod) {
final PsiModifierList afterModifierList = afterMethod.getModifierList();
PsiModifierList beforeModifierList = beforeMethod.getModifierList();
compareModifiers(beforeModifierList, afterModifierList);
compareType(beforeMethod.getReturnType(), afterMethod.getReturnType(), afterMethod);
compareParams(beforeMethod.getParameterList(), afterMethod.getParameterList());
compareThrows(beforeMethod.getThrowsList(), afterMethod.getThrowsList(), afterMethod);
if (shouldCompareCodeBlocks()) {
final PsiCodeBlock beforeMethodBody = beforeMethod.getBody();
final PsiCodeBlock afterMethodBody = afterMethod.getBody();
if (null != beforeMethodBody && null != afterMethodBody) {
boolean codeBlocksAreEqual = beforeMethodBody.textMatches(afterMethodBody);
if (!codeBlocksAreEqual) {
String text1 = beforeMethodBody.getText().replaceAll("java\\.lang\\.", "").replaceAll("\\s+", "");
String text2 = afterMethodBody.getText().replaceAll("java\\.lang\\.", "").replaceAll("\\s+", "");
assertEquals("Method: (" + afterMethod.getName() + ") in Class:" + afterClass.getName() + " different", text2, text1);
}
}
else {
if (null != afterMethodBody) {
fail("MethodCodeBlocks is null: Method: (" + beforeMethod.getName() + ") Class:" + beforeClass.getName());
}
}
}
}
private static Collection<PsiMethod> filterMethods(PsiMethod[] beforeMethods, PsiMethod compareMethod) {
Collection<PsiMethod> result = new ArrayList<>();
for (PsiMethod psiMethod : beforeMethods) {
final PsiParameterList compareMethodParameterList = compareMethod.getParameterList();
final PsiParameterList psiMethodParameterList = psiMethod.getParameterList();
if (compareMethod.getName().equals(psiMethod.getName()) &&
compareMethodParameterList.getParametersCount() == psiMethodParameterList.getParametersCount()) {
final Collection<String> typesOfCompareMethod = mapToTypeString(compareMethodParameterList);
final Collection<String> typesOfPsiMethod = mapToTypeString(psiMethodParameterList);
if (typesOfCompareMethod.equals(typesOfPsiMethod)) {
result.add(psiMethod);
}
}
}
return result;
}
@NotNull
private static Collection<String> mapToTypeString(PsiParameterList compareMethodParameterList) {
Collection<String> result = new ArrayList<>();
final PsiParameter[] compareMethodParameterListParameters = compareMethodParameterList.getParameters();
for (PsiParameter compareMethodParameterListParameter : compareMethodParameterListParameters) {
result.add(stripJavaLang(compareMethodParameterListParameter.getType().getCanonicalText()));
}
return result;
}
private static String[] toList(PsiNamedElement[] beforeMethods) {
return Arrays.stream(beforeMethods).map(PsiNamedElement::getName)
.filter(java.util.Objects::isNull).sorted(String.CASE_INSENSITIVE_ORDER).toArray(String[]::new);
}
private static void compareThrows(PsiReferenceList beforeThrows, PsiReferenceList afterThrows, PsiMethod psiMethod) {
PsiClassType[] beforeTypes = beforeThrows.getReferencedTypes();
PsiClassType[] afterTypes = afterThrows.getReferencedTypes();
assertEquals("Throws counts are different for Method :" + psiMethod.getName(), beforeTypes.length, afterTypes.length);
for (PsiClassType beforeType : beforeTypes) {
boolean found = false;
for (PsiClassType afterType : afterTypes) {
if (beforeType.equals(afterType)) {
found = true;
break;
}
}
assertTrue("Expected throw: " + beforeType.getClassName() + " not found on " + psiMethod.getName(), found);
}
}
private void compareConstructors(PsiClass beforeClass, PsiClass afterClass) {
PsiMethod[] beforeConstructors = beforeClass.getConstructors();
PsiMethod[] afterConstructors = afterClass.getConstructors();
LOG.debug("IntelliJ constructors for class " + beforeClass.getName() + ": " + Arrays.toString(beforeConstructors));
LOG.debug("Theirs constructors for class " + afterClass.getName() + ": " + Arrays.toString(afterConstructors));
assertEquals("Constructor counts are different for Class: " + beforeClass.getName(), afterConstructors.length,
beforeConstructors.length);
for (PsiMethod afterConstructor : afterConstructors) {
boolean compared = false;
final PsiModifierList theirsFieldModifierList = afterConstructor.getModifierList();
final List<PsiType> afterConstructorParameterTypes =
ContainerUtil.map(afterConstructor.getParameterList().getParameters(), PsiParameter::getType);
for (PsiMethod beforeConstructor : beforeConstructors) {
if (PsiElementUtil.methodMatches(beforeConstructor, null, null, afterConstructor.getName(), afterConstructorParameterTypes)) {
final PsiModifierList intellijConstructorModifierList = beforeConstructor.getModifierList();
compareModifiers(intellijConstructorModifierList, theirsFieldModifierList);
compared = true;
break;
}
}
assertTrue("Constructors are not equal, Constructor: '" +
afterConstructor.getName() +
"' (with same parameters) not found in class : " +
beforeClass.getName(), compared);
}
}
private static void compareContainingClasses(PsiClass intellij, PsiClass theirs) {
PsiClass intellijContainingClass = intellij.getContainingClass();
PsiClass theirsContainingClass = theirs.getContainingClass();
String intellijContainingClassName = intellijContainingClass == null ? null : intellijContainingClass.toString();
String theirsContainingClassName = theirsContainingClass == null ? null : theirsContainingClass.toString();
LOG.debug("IntelliJ containing class for class " + intellij.getName() + ": " + intellijContainingClassName);
LOG.debug("Theirs containing class for class " + theirs.getName() + ": " + theirsContainingClassName);
assertEquals("Containing classes different for class: " + intellij.getName(), intellijContainingClassName, theirsContainingClassName);
}
private void compareInnerClasses(PsiClass intellij, PsiClass theirs) {
PsiClass[] intellijClasses = intellij.getInnerClasses();
PsiClass[] theirsClasses = theirs.getInnerClasses();
LOG.debug("IntelliJ inner classes for class " + intellij.getName() + ": " + Arrays.toString(intellijClasses));
LOG.debug("Theirs inner classes for class " + theirs.getName() + ": " + Arrays.toString(theirsClasses));
compareClasses(intellijClasses, theirsClasses);
}
private void compareParams(PsiParameterList intellij, PsiParameterList theirs) {
assertEquals(theirs.getParametersCount(), intellij.getParametersCount());
PsiParameter[] intellijParameters = intellij.getParameters();
PsiParameter[] theirsParameters = theirs.getParameters();
for (int i = 0; i < intellijParameters.length; i++) {
PsiParameter intellijParameter = intellijParameters[i];
PsiParameter theirsParameter = theirsParameters[i];
compareType(intellijParameter.getType(), theirsParameter.getType(), theirsParameter);
compareAnnotations(intellijParameter.getModifierList(), theirsParameter.getModifierList());
}
}
}
| [
"intellij-monorepo-bot-no-reply@jetbrains.com"
] | intellij-monorepo-bot-no-reply@jetbrains.com |
989646946b034d47b6afa9a6adc06d5a489e83ca | 302d0bda73fb870e6e5b9124116af68375a8e628 | /data/src/main/java/com/shamildev/retro/data/cache/realm/mapper/ConfigurationRealmMapper.java | e2edef4d530b3e2ef7a504ba1d03f200c0a629bf | [] | no_license | lazargit/Retro | c7e77c2efa7dfa4ec09829a208fd53c381604b41 | 032f9fe7e0fbc083ca786eb1b3ae38f3d4671ae1 | refs/heads/master | 2020-03-27T08:47:27.604589 | 2018-09-02T02:56:09 | 2018-09-02T02:56:09 | 146,284,434 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,382 | java | package com.shamildev.retro.data.cache.realm.mapper;
import com.shamildev.retro.data.cache.realm.models.TMDbConfigurationRealm;
import com.shamildev.retro.domain.models.Configuration;
import javax.inject.Inject;
import dagger.Reusable;
/**
* Created by Shamil Lazar on 31.12.2017.
*/
@Reusable
final class ConfigurationRealmMapper implements RealmMapper<Configuration, TMDbConfigurationRealm> {
@Inject
ConfigurationRealmMapper() {
}
@Override
@SuppressWarnings("unchecked")
public TMDbConfigurationRealm map(Configuration model) {
TMDbConfigurationRealm configurationRealm = new TMDbConfigurationRealm();
configurationRealm.setBaseUrl(model.baseUrl());
configurationRealm.setSecureBaseUrl(model.secureBaseUrl());
configurationRealm.setBackdropSizes(RealmListMapper.listToRealmList(model.backdropSizes()));
configurationRealm.setChangeKeys(RealmListMapper.listToRealmList(model.changeKeys()));
configurationRealm.setLogoSizes(RealmListMapper.listToRealmList(model.logoSizes()));
configurationRealm.setPosterSizes(RealmListMapper.listToRealmList(model.posterSizes()));
configurationRealm.setProfileSizes(RealmListMapper.listToRealmList(model.posterSizes()));
configurationRealm.setStillSizes(RealmListMapper.listToRealmList(model.stillSizes()));
configurationRealm.setLast_update(model.lastUpdate());
return configurationRealm;
}
@Override
public Configuration map(TMDbConfigurationRealm entity) {
System.out.println("ConfigurationRealmMapper" +entity.getBackdropSizes());
return Configuration.builder()
.baseUrl(entity.getBaseUrl())
.secureBaseUrl(entity.getSecureBaseUrl())
.backdropSizes( RealmListMapper.mapToStringList(entity.getBackdropSizes()))
.changeKeys( RealmListMapper.mapToStringList(entity.getChangeKeys()))
.logoSizes( RealmListMapper.mapToStringList(entity.getLogoSizes()))
.posterSizes( RealmListMapper.mapToStringList(entity.getPosterSizes()))
.profileSizes( RealmListMapper.mapToStringList(entity.getProfileSizes()))
.stillSizes( RealmListMapper.mapToStringList(entity.getStillSizes()))
.lastUpdate(entity.getLast_update())
.build();
}
}
| [
"shamil.lazar@gmail.com"
] | shamil.lazar@gmail.com |
30f60d56eb0f5d334a23ec6e5a09de018d112d49 | 0369d1869ab3b323d7e38a5eba75c966adc861ec | /app/src/main/java/com/xuhuawei/myfragmentapp/utils/ToastUtil.java | 3c453f19fbe7866c3743a752c367ef81d169ec00 | [] | no_license | xuhuawei131/MyFragmentApp | 806f87ed6ed8683622ac0ca834d486ce2af786d0 | 6ddab0f5711509a358f2cbb410757b3fce749faf | refs/heads/master | 2020-08-19T18:27:17.162973 | 2019-10-21T11:26:10 | 2019-10-21T11:26:10 | 215,942,874 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,636 | java | package com.xuhuawei.myfragmentapp.utils;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.xuhuawei.myfragmentapp.App;
import com.xuhuawei.myfragmentapp.R;
public class ToastUtil {
public static Toast showActionResult(int strID) {
View v = View.inflate(App.getAppContext(),
R.layout.toast_result_layout, null);
// UIUtils.dip2px();
// float w = ScreenSizeUtil.getScreenWidth(App.getAppContext());
// v.setMinimumWidth((int) (w * 0.4f));
// v.setMinimumHeight((int) (w * 0.4f));
TextView tv = (TextView) v.findViewById(R.id.tv_toast);
tv.setText(App.getAppContext().getString(strID));
Toast toast = new Toast(App.getAppContext());
toast.setView(v);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.setDuration(Toast.LENGTH_SHORT);
toast.show();
return toast;
}
public static Toast showActionResult(String str) {
View v = View.inflate(App.getAppContext(),
R.layout.common_toast_result_layout, null);
ImageView iv = (ImageView) v.findViewById(R.id.iv_toast);
iv.setImageResource( R.drawable.icon_toast);
TextView tv = (TextView) v.findViewById(R.id.tv_toast);
tv.setText(str);
Toast toast = new Toast(App.getAppContext());
toast.setView(v);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.setDuration(Toast.LENGTH_SHORT);
toast.show();
return toast;
}
public static Toast showActionResult(String str, boolean isOk) {
View v = View.inflate(App.getAppContext(),
R.layout.toast_result_layout, null);
// float w = ScreenSizeUtil.getScreenWidth(Mage.getInstance().getApplication());
// v.setMinimumWidth((int) (w * 0.4f));
// v.setMinimumHeight((int) (w * 0.4f));
ImageView iv = (ImageView) v.findViewById(R.id.iv_toast);
// iv.setImageResource(isOk ? R.drawable.toast_ok
// : R.drawable.toast_error);
iv.setImageResource( R.drawable.icon_toast);
TextView tv = (TextView) v.findViewById(R.id.tv_toast);
tv.setText(str);
Toast toast = new Toast(App.getAppContext());
toast.setView(v);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.setDuration(Toast.LENGTH_SHORT);
toast.show();
return toast;
}
public static Toast showActionResult(int res, boolean isOk) {
return showActionResult(App.getAppContext().getString(res), isOk);
}
}
| [
"xuhw@knowbox.cn"
] | xuhw@knowbox.cn |
a8957014485ddfceae6afee02db2ec2ab13dd37f | 9e20645e45cc51e94c345108b7b8a2dd5d33193e | /L2J_Mobius_05.5_EtinasFate/dist/game/data/scripts/handlers/bypasshandlers/QuestLink.java | 2872dc8d6090e21daed6e0cf07c46680bb8fa650 | [] | no_license | Enryu99/L2jMobius-01-11 | 2da23f1c04dcf6e88b770f6dcbd25a80d9162461 | 4683916852a03573b2fe590842f6cac4cc8177b8 | refs/heads/master | 2023-09-01T22:09:52.702058 | 2021-11-02T17:37:29 | 2021-11-02T17:37:29 | 423,405,362 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 12,012 | java | /*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.stream.Collectors;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.handler.IBypassHandler;
import org.l2jmobius.gameserver.instancemanager.QuestManager;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.listeners.AbstractEventListener;
import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState;
import org.l2jmobius.gameserver.network.NpcStringId;
import org.l2jmobius.gameserver.network.NpcStringId.NSLocalisation;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
public class QuestLink implements IBypassHandler
{
private static final String[] COMMANDS =
{
"Quest"
};
@Override
public boolean useBypass(String command, PlayerInstance player, Creature target)
{
String quest = "";
try
{
quest = command.substring(5).trim();
}
catch (IndexOutOfBoundsException ioobe)
{
}
if (quest.isEmpty())
{
showQuestWindow(player, (Npc) target);
}
else
{
final int questNameEnd = quest.indexOf(' ');
if (questNameEnd == -1)
{
showQuestWindow(player, (Npc) target, quest);
}
else
{
player.processQuestEvent(quest.substring(0, questNameEnd), quest.substring(questNameEnd).trim());
}
}
return true;
}
/**
* Open a choose quest window on client with all quests available of the NpcInstance.<br>
* <br>
* <b><u>Actions</u>:</b><br>
* <li>Send a Server->Client NpcHtmlMessage containing the text of the NpcInstance to the PlayerInstance</li><br>
* @param player The PlayerInstance that talk with the NpcInstance
* @param npc The table containing quests of the NpcInstance
* @param quests
*/
private void showQuestChooseWindow(PlayerInstance player, Npc npc, Collection<Quest> quests)
{
final StringBuilder sbStarted = new StringBuilder(128);
final StringBuilder sbCanStart = new StringBuilder(128);
final StringBuilder sbCantStart = new StringBuilder(128);
final StringBuilder sbCompleted = new StringBuilder(128);
//@formatter:off
final Set<Quest> startingQuests = npc.getListeners(EventType.ON_NPC_QUEST_START).stream()
.map(AbstractEventListener::getOwner)
.filter(Quest.class::isInstance)
.map(Quest.class::cast)
.distinct()
.collect(Collectors.toSet());
//@formatter:on
Collection<Quest> questList = quests;
if (Config.ORDER_QUEST_LIST_BY_QUESTID)
{
final Map<Integer, Quest> orderedQuests = new TreeMap<>(); // Use TreeMap to order quests
for (Quest q : questList)
{
orderedQuests.put(q.getId(), q);
}
questList = orderedQuests.values();
}
for (Quest quest : questList)
{
final QuestState qs = player.getQuestState(quest.getScriptName());
if ((qs == null) || qs.isCreated() || (qs.isCompleted() && qs.isNowAvailable()))
{
final String startConditionHtml = quest.getStartConditionHtml(player, npc);
if (((startConditionHtml != null) && startConditionHtml.isEmpty()) || !startingQuests.contains(quest))
{
continue;
}
else if (startingQuests.contains(quest) && quest.canStartQuest(player))
{
sbCanStart.append("<font color=\"bbaa88\">");
sbCanStart.append("<button icon=\"quest\" align=\"left\" action=\"bypass -h npc_" + npc.getObjectId() + "_Quest " + quest.getName() + "\">");
String localisation = quest.isCustomQuest() ? quest.getPath() : "<fstring>" + quest.getNpcStringId() + "01</fstring>";
if (Config.MULTILANG_ENABLE)
{
final NpcStringId ns = NpcStringId.getNpcStringId(Integer.parseInt(quest.getNpcStringId() + "01"));
if (ns != null)
{
final NSLocalisation nsl = ns.getLocalisation(player.getLang());
if (nsl != null)
{
localisation = nsl.getLocalisation(Collections.emptyList());
}
}
}
sbCanStart.append(localisation);
sbCanStart.append("</button></font>");
}
else
{
sbCantStart.append("<font color=\"a62f31\">");
sbCantStart.append("<button icon=\"quest\" align=\"left\" action=\"bypass -h npc_" + npc.getObjectId() + "_Quest " + quest.getName() + "\">");
String localisation = quest.isCustomQuest() ? quest.getPath() : "<fstring>" + quest.getNpcStringId() + "01</fstring>";
if (Config.MULTILANG_ENABLE)
{
final NpcStringId ns = NpcStringId.getNpcStringId(Integer.parseInt(quest.getNpcStringId() + "01"));
if (ns != null)
{
final NSLocalisation nsl = ns.getLocalisation(player.getLang());
if (nsl != null)
{
localisation = nsl.getLocalisation(Collections.emptyList());
}
}
}
sbCantStart.append(localisation);
sbCantStart.append("</button></font>");
}
}
else if (Quest.getNoQuestMsg(player).equals(quest.onTalk(npc, player, true)))
{
continue;
}
else if (qs.isStarted())
{
sbStarted.append("<font color=\"ffdd66\">");
sbStarted.append("<button icon=\"quest\" align=\"left\" action=\"bypass -h npc_" + npc.getObjectId() + "_Quest " + quest.getName() + "\">");
String localisation = quest.isCustomQuest() ? quest.getPath() + " (In Progress)" : "<fstring>" + quest.getNpcStringId() + "02</fstring>";
if (Config.MULTILANG_ENABLE)
{
final NpcStringId ns = NpcStringId.getNpcStringId(Integer.parseInt(quest.getNpcStringId() + "02"));
if (ns != null)
{
final NSLocalisation nsl = ns.getLocalisation(player.getLang());
if (nsl != null)
{
localisation = nsl.getLocalisation(Collections.emptyList());
}
}
}
sbStarted.append(localisation);
sbStarted.append("</button></font>");
}
else if (qs.isCompleted())
{
sbCompleted.append("<font color=\"787878\">");
sbCompleted.append("<button icon=\"quest\" align=\"left\" action=\"bypass -h npc_" + npc.getObjectId() + "_Quest " + quest.getName() + "\">");
String localisation = quest.isCustomQuest() ? quest.getPath() + " (Done) " : "<fstring>" + quest.getNpcStringId() + "03</fstring>";
if (Config.MULTILANG_ENABLE)
{
final NpcStringId ns = NpcStringId.getNpcStringId(Integer.parseInt(quest.getNpcStringId() + "03"));
if (ns != null)
{
final NSLocalisation nsl = ns.getLocalisation(player.getLang());
if (nsl != null)
{
localisation = nsl.getLocalisation(Collections.emptyList());
}
}
}
sbCompleted.append(localisation);
sbCompleted.append("</button></font>");
}
}
String content;
if ((sbStarted.length() > 0) || (sbCanStart.length() > 0) || (sbCantStart.length() > 0) || (sbCompleted.length() > 0))
{
final StringBuilder sb = new StringBuilder(128);
sb.append("<html><body>");
sb.append(sbStarted.toString());
sb.append(sbCanStart.toString());
sb.append(sbCantStart.toString());
sb.append(sbCompleted.toString());
sb.append("</body></html>");
content = sb.toString();
}
else
{
content = Quest.getNoQuestMsg(player);
}
// Send a Server->Client packet NpcHtmlMessage to the PlayerInstance in order to display the message of the NpcInstance
content = content.replace("%objectId%", String.valueOf(npc.getObjectId()));
player.sendPacket(new NpcHtmlMessage(npc.getObjectId(), content));
}
/**
* Open a quest window on client with the text of the NpcInstance.<br>
* <br>
* <b><u>Actions</u>:</b><br>
* <ul>
* <li>Get the text of the quest state in the folder data/scripts/quests/questId/stateId.htm</li>
* <li>Send a Server->Client NpcHtmlMessage containing the text of the NpcInstance to the PlayerInstance</li>
* <li>Send a Server->Client ActionFailed to the PlayerInstance in order to avoid that the client wait another packet</li>
* </ul>
* @param player the PlayerInstance that talk with the {@code npc}
* @param npc the NpcInstance that chats with the {@code player}
* @param questId the Id of the quest to display the message
*/
private void showQuestWindow(PlayerInstance player, Npc npc, String questId)
{
String content = null;
final Quest q = QuestManager.getInstance().getQuest(questId);
// Get the state of the selected quest
final QuestState qs = player.getQuestState(questId);
if (q != null)
{
if (((q.getId() >= 1) && (q.getId() < 20000)) && ((player.getWeightPenalty() >= 3) || !player.isInventoryUnder90(true)))
{
player.sendPacket(SystemMessageId.NOT_ENOUGH_SPACE_IN_THE_INVENTORY_UNABLE_TO_PROCESS_THIS_REQUEST_UNTIL_YOUR_INVENTORY_S_WEIGHT_AND_SLOT_COUNT_ARE_LESS_THAN_80_PERCENT_OF_CAPACITY);
return;
}
if ((qs == null) && (q.getId() >= 1) && (q.getId() < 20000) && (player.getAllActiveQuests().size() > 40))
{
final NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
html.setFile(player, "data/html/fullquest.html");
player.sendPacket(html);
return;
}
q.notifyTalk(npc, player);
}
else
{
content = Quest.getNoQuestMsg(player); // no quests found
}
// Send a Server->Client packet NpcHtmlMessage to the PlayerInstance in order to display the message of the NpcInstance
if (content != null)
{
content = content.replace("%objectId%", String.valueOf(npc.getObjectId()));
player.sendPacket(new NpcHtmlMessage(npc.getObjectId(), content));
}
// Send a Server->Client ActionFailed to the PlayerInstance in order to avoid that the client wait another packet
player.sendPacket(ActionFailed.STATIC_PACKET);
}
/**
* Collect awaiting quests/start points and display a QuestChooseWindow (if several available) or QuestWindow.
* @param player the PlayerInstance that talk with the {@code npc}.
* @param npc the NpcInstance that chats with the {@code player}.
*/
private void showQuestWindow(PlayerInstance player, Npc npc)
{
//@formatter:off
final Set<Quest> quests = npc.getListeners(EventType.ON_NPC_TALK).stream()
.map(AbstractEventListener::getOwner)
.filter(Quest.class::isInstance)
.map(Quest.class::cast)
.filter(quest -> (quest.getId() > 0) && (quest.getId() < 20000) && (quest.getId() != 255))
.filter(quest -> !Quest.getNoQuestMsg(player).equals(quest.onTalk(npc, player, true)))
.distinct()
.collect(Collectors.toSet());
//@formatter:on
if (quests.size() > 1)
{
showQuestChooseWindow(player, npc, quests);
}
else if (quests.size() == 1)
{
showQuestWindow(player, npc, quests.stream().findFirst().get().getName());
}
else
{
showQuestWindow(player, npc, "");
}
}
@Override
public String[] getBypassList()
{
return COMMANDS;
}
}
| [
"MobiusDevelopment@7325c9f8-25fd-504a-9f63-8876acdc129b"
] | MobiusDevelopment@7325c9f8-25fd-504a-9f63-8876acdc129b |
ac33dd38b29400e2c907052abb530a3145d73d51 | 1cdc1d34c80d6ed26ff4f48266bf628d42ae1470 | /spdy-client/src/main/java/net/haibo/spdy/client/App.java | fb41dfa164510e02b65a329df644c4aef4b0266d | [
"Apache-2.0"
] | permissive | NannanZ/spdymcsclient | cd9e701498590b69348fcbab6f56d3625588ef3c | 2e970151503617aa073262afb7e6882d10856eab | refs/heads/master | 2020-08-08T21:32:32.319259 | 2014-07-24T09:50:44 | 2014-07-24T09:50:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,194 | java | package net.haibo.spdy.client;
import static com.squareup.okhttp.internal.Util.UTF_8;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.util.EntityUtils;
import com.squareup.okhttp.ConnectionPool;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.OkUrlFactory;
import com.squareup.okhttp.Protocol;
import com.squareup.okhttp.apache.OkApacheClient;
//import java.io.FileInputStream;
/**
* Hello MCS!
*/
public class App implements MCSCallback
{
// static Logger logger = Logger.getLogger("net.haibo.spdy.client.App");
public static void main(String[] args)
{
try {
System.out.println( "Hello MCS!" );
// HELP:
// This configuration is just set for self-signed https host, you can follow below refer:
// http://www.oschina.net/code/snippet_12_4092
// and
// http://wangrqa.blog.163.com/blog/static/17094682720133954149784/
// NOTE: This config has been dropped, pls using <code>allowInsecure</code>.
// System.setProperty("javax.net.ssl.trustStore", CONTEXT.CERTIFICATION_FILE_PATH);
// This configuration is set for max connection count of okhttp connection pool
// There are some other relevant setting terms, you can check them from okhttp's connectionpool.java
System.setProperty("http.maxConnections", "10");
// PREVIEW:
// The okHttp by default, just supports the spdy 3.1 and http2.0, so if the host
// uses spdy 2.0 or spdy 3.0, the okhttp will automaticall turns to http 1.1
// for data transportation.
// If you want to preferred one kind of protocol for a single host,
// you could use config the preferred protocol for each okhttp client:
/** <code>
// firstly, we create a okhttp lib client for further using
OkHttpClient ok = new OkHttpClient();
// we config a host with a prefered portocol kind
// actally http://118.186.217.31 hosts with a spdy style http service
ok.configPreferredHostProtocol("118.186.217.31", Protocol.SPDY_3);
*/
// OR you could set the preferred protocol for each request before send it:
/** <code>
// Create request for remote resource.
Request request = new Request.Builder()
.url(url)
.preferredProtocol(isForcedSpdy ? Protocol.SPDY_3 : null)
.build();
</code>
*/
// SAMPLE URLS with spdy host:
// String url = "https://www.google.com.hk/webhp?hl=zh-CN";
// String url = "https://www.cloudflare.com"; // spdy 3.1 non-auto to spdy
// String url = "https://webtide.com/"; // spdy 3.0 auto to spdy
// String url = "https://123.125.36.108:443";
// String url = "http://123.125.36.108:443";
//// String url = "http://118.186.217.31";
// int count = 4;
//// IHttpRequest request = TheRequest.Spdy.create();
// for (int i = 0; i < count; ++i) {
// String the = TheRequest.Apache.create().get(url);
// }
// Important note: according the implemenation of okhttp,
// If you want to share the conncetion in the whole application for
// reducing network latency, your requests need qualifying
// with the same address(defined by okhttp),
// which means you should make follow call to be true:
// Address.equals() note:http and https have different terms
// So sharing an OkHttpClient instance is a recommanded way but not the least.
// bollow http get requests share the same OkHttpClient instance
// IHttpRequest request = TheRequest.OkHttp.create();
// for (int i = 0; i < 4; ++i) {
// String the = request.get(url);
// }
// Important issue (maybe an okhttp's bug):
// If we don't share the client instance between the different requsts.
// Which means all request actually don't share the connection including spdy connection.
// The ALPN call will report a debug error info:
// INFO: NPN/ALPN callback dropped: SPDY and HTTP/2 are disabled. Is npn-boot or alpn-boot on the boot class path?
// Follow is the reproduce code
// for (int i = 0; i < count; ++i) {
// String the = TheRequest.OkHttp.create().get(url);
// }
// It's a smoke testing
sequenceSmokeTesting();
testMutiPart();
// It's a apache http alike api sample with okhttp lib's implementation
apacheAlikeApiSample();
// Ensure the deamon threads exit
ConnectionPool.getDefault().evictAll();
} catch (Exception ex) {
System.out.println("\n\n### APP LEVEL ERROR: \n");
ex.printStackTrace();
}
}
private static void testMutiPart() throws Exception {
LoginInfo login = UTILS.getLogin();
Map<String, String> query = UTILS.createMcsDefaultQuery();
query.put("session_key", login.getInfo().session_key);
query.put("method", "photos.uploadbin");
List<File> files = new ArrayList<>();
files.add(new File("resource/images/1.jpg"));
UTILS.uploadBytes(TheRequest.Spdy, query, files, login.getInfo().secret_key);
files.clear();
files.add(new File("resource/images/2.jpg"));
UTILS.createDefaultUploadCase(TheRequest.Spdy, login, null, "http://118.186.217.31/api/", files)
.execute();
}
private static void sequenceSmokeTesting() throws Exception {
LoginInfo login = UTILS.getLogin();
// MCSClient feeds = UTILS.createDefaultFeedGet(TheRequest.Spdy, login, null, "http://118.186.217.31/api/");
MCSClient feeds = UTILS.createDefaultFeedGet(TheRequest.Spdy, login, null, "http://api.m.renren.com/api/");
for (int i = 0; i < 20; ++i) {
System.out.println(">>S"+i);
feeds.execute();
}
TheRequest.OkHttp.create().get("https://118.186.217.31/");
}
private static void apacheAlikeApiSample() throws Exception {
System.out.println("::: It's a apache client alike api usage.");
// ::: It's a apache client alike api usage.
// Create a apache kind of http client which you can share in whole application
OkApacheClient client = new OkApacheClient();
client.impl().setHostnameVerifier(UTILS.createInsecureHostnameVerifier());
client.impl().setSslSocketFactory(UTILS.createInsecureSslSocketFactory());
// Config the preferred protocol for special host you prefer to invoke with special protocol.
client.configPreferredHostProtocol("118.186.217.31", Protocol.SPDY_3);
// http://118.186.217.31 hosts with a spdy style http service, we create a get request for it
HttpGet request = new HttpGet(new URL("http://118.186.217.31/").toURI());
// HttpGet request = new HttpGet(new URL("https://www.cloudflare.com/").toURI());
// then run it.
HttpResponse response = client.execute(request);
// should OUTPUT:
// HTTP/1.1 200 OK [OkHttp-Selected-Protocol: spdy/3.1, server: nginx/1.5.11, date: \
// Thu, 12 Jun 2014 09:09:34 GMT, content-type: text/html; charset=UTF-8, alternate-protocol:\
// 443:npn-spdy/3, OkHttp-Sent-Millis: 1402564173672, OkHttp-Received-Millis: 1402564173708]\
// HTTP/1.1 200 OK [OkHttp-Selected-Protocol: spdy/3.1, server: cloudflare-nginx, date: \
// Wed, 18 Jun 2014 10:35:44 GMT, content-type: text/html; charset=UTF-8, set-cookie: \
// __cfduid=dec44ce8ac515d613f7490568f39612f21403087744468; expires=Mon, 23-Dec-2019 23:50:00 GMT; \
// path=/; domain=.cloudflare.com; HttpOnly, expires: Wed, 18 Jun 2014 14:35:44 GMT, cache-control: \
// public, max-age=14400, pragma: no-cache, x-frame-options: DENY, vary: Accept-Encoding, \
// strict-transport-security: max-age=31536000, cf-cache-status: HIT, cf-ray: 13c6d782e0ac0d31-LAX, \
// OkHttp-Sent-Millis: 1403087740701, OkHttp-Received-Millis: 1403087741183]
System.out.println(response);
String actual = EntityUtils.toString(response.getEntity(), UTF_8);
System.out.println(actual);
System.out.println(":::\n");
System.out.println("::: It's a Url connection alike api usage.");
// ::: It's a Url connection alike api usage
// firstly, we create a okhttp lib client for further using
OkHttpClient ok = new OkHttpClient();
ok.setHostnameVerifier(UTILS.createInsecureHostnameVerifier());
ok.setSslSocketFactory(UTILS.createInsecureSslSocketFactory());
// we config a host with a prefered portocol kind
// actally http://118.186.217.31 hosts with a spdy style http service
// ok.configPreferredHostProtocol("118.186.217.31", Protocol.SPDY_3);
// with the customized client, create a url factory
OkUrlFactory factory = new OkUrlFactory(ok);
// open an connection from a URL
HttpURLConnection connection = factory.open(new URL("https://118.186.217.31"));
connection.connect();
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), UTF_8));
for (String line = null; (line = reader.readLine()) != null;) System.out.println(line);
reader.close();
connection.disconnect();
System.out.println(":::\n");
}
@Override
public void arrives(MCSClient sender, String response) {
System.out.println("##=>Mcs reponse arrives: " + response);
}
}
| [
"Hiber.Luo@foxmail.com"
] | Hiber.Luo@foxmail.com |
e49c431070a21e81cd6ed42fec0c8197676ad0ee | bb9cc750c1c621083054ad50d4de7a8cbbf48d32 | /app/src/main/java/com/ikhiloyaimokhai/fileupload/CameraActivityWithoutSaving.java | 798b58d3ef0bc866bd1fba181bcddce7397cd708 | [] | no_license | Ikhiloya/FileChooser | e15710b12919dbd0b84ff2ed4154cea4afdc2096 | 03bf12ecf15e7b6bbce2f05d9ee865bc8041b6bb | refs/heads/master | 2020-07-19T22:15:26.561809 | 2020-02-10T12:28:56 | 2020-02-10T12:28:56 | 206,522,891 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,595 | java | package com.ikhiloyaimokhai.fileupload;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
public class CameraActivityWithoutSaving extends AppCompatActivity {
ImageView imageView;
static final int REQUEST_IMAGE_CAPTURE = 2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_camera_without_saving);
imageView = findViewById(R.id.imageView);
Button button = findViewById(R.id.imageBtn);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dispatchTakePictureIntent();
}
});
}
private void dispatchTakePictureIntent() {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();
Bitmap imageBitmap = (Bitmap) extras.get("data");
imageView.setImageBitmap(imageBitmap);
}
}
}
| [
"imokhaiikhiloya@gmail.com"
] | imokhaiikhiloya@gmail.com |
2f7ae07747b1c036beeb7e3569ffd81fb650187c | 37eeafcdaabba8abc230a8601cfddd421259b6c1 | /src/main/java/kz/iitu/libmanagement/repository/BookRepository.java | 96e7c81ebd92c3dc4e93984e0f45e204ef189ed6 | [] | no_license | dumbkiddo/Library-Management-System | 2d9e79519841e41146e28e2f0b11d01f5a555026 | 20d6ec80a8ebf1c9f2f3490e6e6a0bd56024a838 | refs/heads/master | 2022-06-12T06:10:55.740421 | 2020-04-26T13:49:12 | 2020-04-26T13:49:12 | 253,251,268 | 0 | 0 | null | 2022-05-25T23:28:15 | 2020-04-05T14:15:11 | Java | UTF-8 | Java | false | false | 393 | java | package kz.iitu.libmanagement.repository;
import kz.iitu.libmanagement.entity.Book;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface BookRepository extends JpaRepository<Book, Long> {
List<Book> findByAuthor(String author);
List<Book> findByTitle(String title);
}
| [
"43108050+dumbkiddo@users.noreply.github.com"
] | 43108050+dumbkiddo@users.noreply.github.com |
845512753af795cce201452840ea58d7cbc6ffd3 | 597300e11cebbf299a679cef574719d786c28ca5 | /src/test/java/com/gox/parking/finder/api/controller/ParkingControllerTest.java | 52edf072a7cf0ba03d86a180872dc30cff384d7a | [] | no_license | GoX1337/parking-finder-api | 6bccccf3e8d74dd2f05417c3be82f0eeec79916d | f25d85e117aef98b369abf3b8d95fe3aaa304927 | refs/heads/master | 2023-08-04T17:56:23.579493 | 2021-09-22T11:47:04 | 2021-09-22T11:47:04 | 407,879,337 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,304 | java | package com.gox.parking.finder.api.controller;
import com.gox.parking.finder.api.dto.ParkingDto;
import com.gox.parking.finder.api.exception.CityNotSupportedException;
import com.gox.parking.finder.api.exception.NoParkingFoundException;
import com.gox.parking.finder.api.service.ParkingService;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.RequestBuilder;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import java.util.ArrayList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@WebMvcTest(ParkingController.class)
@ExtendWith(SpringExtension.class)
class ParkingControllerTest {
@Autowired
private MockMvc mockMvc;
@MockBean
private ParkingService parkingService;
@Test
void parkings() throws Exception {
List<ParkingDto> pkgs = List.of(
new ParkingDto(1L, "pkg1", "parking 1", null, "32 rue a droite", 100, 200, "LIBRE"),
new ParkingDto(2L, "pkg2", "parking 2", null, "666 avenue du général", 50, 300, "LIBRE")
);
when(parkingService.findAllParkings("bordeaux")).thenReturn(pkgs);
RequestBuilder req = MockMvcRequestBuilders.get("/api/bordeaux/parking");
mockMvc.perform(req)
.andExpect(status().isOk())
.andExpect(jsonPath("$[0].name").value("parking 1"))
.andExpect(jsonPath("$[0].ident").value("pkg1"))
.andExpect(jsonPath("$[1].free").value(50))
.andExpect(jsonPath("$[1].total").value(300));
}
@Test
void parkingNear() throws Exception {
List<ParkingDto> pkgs = List.of(
new ParkingDto(1L, "pkg1", "parking 1", null, "32 rue a droite", 100, 200, "LIBRE"),
new ParkingDto(2L, "pkg2", "parking 2", null, "666 avenue du général", 50, 300, "LIBRE")
);
when(parkingService.findAllParkingNear("bordeaux", 40, 50, 1000)).thenReturn(pkgs);
RequestBuilder req = MockMvcRequestBuilders.get("/api/bordeaux/parking/near?latitude=40&longitude=50&distance=1000");
mockMvc.perform(req)
.andExpect(status().isOk())
.andExpect(jsonPath("$[0].name").value("parking 1"))
.andExpect(jsonPath("$[0].ident").value("pkg1"))
.andExpect(jsonPath("$[1].free").value(50))
.andExpect(jsonPath("$[1].total").value(300));
}
@Test
void noParking() throws Exception {
when(parkingService.findAllParkings("bordeaux")).thenThrow(new NoParkingFoundException());
RequestBuilder req = MockMvcRequestBuilders.get("/api/bordeaux/parking");
mockMvc.perform(req)
.andExpect(status().isNotFound())
.andExpect(jsonPath("$.error").value("No parking found"));
}
@Test
void noParkingNear() throws Exception {
when(parkingService.findAllParkingNear("bordeaux", 40, 50, 1000)).thenThrow(new NoParkingFoundException());
RequestBuilder req = MockMvcRequestBuilders.get("/api/bordeaux/parking/near?latitude=40&longitude=50&distance=1000");
mockMvc.perform(req)
.andExpect(status().isNotFound())
.andExpect(jsonPath("$.error").value("No parking found"));
}
@Test
void cityNotSupported() throws Exception {
when(parkingService.findAllParkings("paris")).thenThrow(new CityNotSupportedException("paris"));
RequestBuilder req = MockMvcRequestBuilders.get("/api/paris/parking");
mockMvc.perform(req)
.andExpect(status().isNotFound())
.andExpect(jsonPath("$.error").value("The city paris is not supported"));
}
} | [
"gox.roche@gmail.com"
] | gox.roche@gmail.com |
8565cde16246ffd1d7bf0828f9f1c4693bbd619e | 8422d2113a7819473cc940d0e91333c440d75fa7 | /Collection/src/main/java/com/yannyao/demo/nio/nio/Server.java | 479bd4656484d0c08c5592de248951744619d54f | [] | no_license | YannPro/Kinds-Of-Java | 309f47167fb4078ce5af4113fab227234bb6f679 | caeb586cbd90d3a305442fd8b406cf78a03a96e6 | refs/heads/master | 2020-03-22T09:26:29.701037 | 2018-12-02T16:18:52 | 2018-12-02T16:18:52 | 139,837,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 503 | java | package com.yannyao.demo.nio.nio;
public class Server {
private static int DEFAULT_PORT = 12345;
private static ServerHandle serverHandle;
public static void start(){
start(DEFAULT_PORT);
}
public static synchronized void start(int port){
if(serverHandle!=null)
serverHandle.stop();
serverHandle = new ServerHandle(port);
new Thread(serverHandle,"Server").start();
}
public static void main(String[] args){
start();
}
} | [
"849723885@qq.com"
] | 849723885@qq.com |
36d8db88d8b1225e72165aab9a06d380f08c3d3e | 5010351199c264198bdf12665e6dc72db8535791 | /src/main/java/com/gharharyali/org/service/ProductService.java | 4bdaec1fde65d1d613b2e4434d551d51c084201a | [] | no_license | bhupenderkumar/seller | 84c5f7e57b3e1edf6327ea3d7a06bf64310cb3e3 | 93adbfd14db4e49bb99d8d5fab53a619a8a26446 | refs/heads/main | 2022-12-19T20:38:22.559326 | 2020-10-05T14:09:15 | 2020-10-05T14:09:15 | 301,380,102 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,267 | java | package com.gharharyali.org.service;
import com.gharharyali.org.service.dto.ProductDTO;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.Optional;
/**
* Service Interface for managing {@link com.gharharyali.org.domain.Product}.
*/
public interface ProductService {
/**
* Save a product.
*
* @param productDTO the entity to save.
* @return the persisted entity.
*/
ProductDTO save(ProductDTO productDTO);
/**
* Get all the products.
*
* @param pageable the pagination information.
* @return the list of entities.
*/
Page<ProductDTO> findAll(Pageable pageable);
/**
* Get the "id" product.
*
* @param id the id of the entity.
* @return the entity.
*/
Optional<ProductDTO> findOne(Long id);
/**
* Delete the "id" product.
*
* @param id the id of the entity.
*/
void delete(Long id);
/**
* Search for the product corresponding to the query.
*
* @param query the query of the search.
*
* @param pageable the pagination information.
* @return the list of entities.
*/
Page<ProductDTO> search(String query, Pageable pageable);
}
| [
"BKumar4@INTERNAL.COLT.NET"
] | BKumar4@INTERNAL.COLT.NET |
dad398a3a5bd59378fe71fb88a21606c964e4429 | ae5eb1a38b4d22c82dfd67c86db73592094edc4b | /project408/src/test/java/org/gradle/test/performance/largejavamultiproject/project408/p2041/Test40827.java | 9e8169856b0675d3b637c98234a1837dc84af412 | [] | no_license | big-guy/largeJavaMultiProject | 405cc7f55301e1fd87cee5878a165ec5d4a071aa | 1cd6a3f9c59e9b13dffa35ad27d911114f253c33 | refs/heads/main | 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,113 | java | package org.gradle.test.performance.largejavamultiproject.project408.p2041;
import org.junit.Test;
import static org.junit.Assert.*;
public class Test40827 {
Production40827 objectUnderTest = new Production40827();
@Test
public void testProperty0() {
String value = "value";
objectUnderTest.setProperty0(value);
assertEquals(value, objectUnderTest.getProperty0());
}
@Test
public void testProperty1() {
String value = "value";
objectUnderTest.setProperty1(value);
assertEquals(value, objectUnderTest.getProperty1());
}
@Test
public void testProperty2() {
String value = "value";
objectUnderTest.setProperty2(value);
assertEquals(value, objectUnderTest.getProperty2());
}
@Test
public void testProperty3() {
String value = "value";
objectUnderTest.setProperty3(value);
assertEquals(value, objectUnderTest.getProperty3());
}
@Test
public void testProperty4() {
String value = "value";
objectUnderTest.setProperty4(value);
assertEquals(value, objectUnderTest.getProperty4());
}
@Test
public void testProperty5() {
String value = "value";
objectUnderTest.setProperty5(value);
assertEquals(value, objectUnderTest.getProperty5());
}
@Test
public void testProperty6() {
String value = "value";
objectUnderTest.setProperty6(value);
assertEquals(value, objectUnderTest.getProperty6());
}
@Test
public void testProperty7() {
String value = "value";
objectUnderTest.setProperty7(value);
assertEquals(value, objectUnderTest.getProperty7());
}
@Test
public void testProperty8() {
String value = "value";
objectUnderTest.setProperty8(value);
assertEquals(value, objectUnderTest.getProperty8());
}
@Test
public void testProperty9() {
String value = "value";
objectUnderTest.setProperty9(value);
assertEquals(value, objectUnderTest.getProperty9());
}
} | [
"sterling.greene@gmail.com"
] | sterling.greene@gmail.com |
bdb285c622bb661924be8447a154da60ee7fb22c | 75402d8589fb5061b5fe9568292a66ca86eb04b0 | /tubes/src/kontroler/daftar_kontroler.java | 0f7e53d397f560710b33456b8ab1247041848c90 | [] | no_license | febrytriyadi/impal | dd492031b070793ef030f25c0c1a89f7003a0184 | 6d1d3908d289d738209f062d28493960f2324a58 | refs/heads/master | 2020-04-06T13:32:33.137903 | 2018-11-01T03:42:34 | 2018-11-01T03:42:34 | 157,504,309 | 0 | 0 | null | 2018-11-14T06:50:26 | 2018-11-14T06:50:26 | null | UTF-8 | Java | false | false | 4,121 | 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 kontroler;
import database.database;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import view.daftar;
/**
*
* @author Administrator
*/
public class daftar_kontroler implements MouseListener,ActionListener{
private daftar gui;
private database db = new database();
private ResultSet rs;
public daftar_kontroler(){
db.konek();
gui = new daftar();
gui.setVisible(true);
gui.addlistener(this);
gui.addmouseistener(this);
}
@Override
public void mouseClicked(MouseEvent e) {
Object source = e.getSource();
if (source.equals(gui.getexit())){
gui.dispose();
new login_kontroler();
}//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void mousePressed(MouseEvent e) {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void mouseReleased(MouseEvent e) {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void mouseEntered(MouseEvent e) {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void mouseExited(MouseEvent e) {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void actionPerformed(ActionEvent e) {
String username=gui.getusername().trim();
String password=gui.getpassword().trim();
String nama=gui.getnama();
String alamat=gui.getalamat();
char kelamin=gui.getkelamin();
String email=gui.getemail();
String agama=gui.getagama();
String nomor=gui.getnomor();
if(username.equals("") || password.equals("")){
JOptionPane.showMessageDialog(gui,"tidak boleh ada fild yang kosong","error",0);
}else{
try {
rs = db.getdata("select username from userpass where username='"+username+"'");
if(rs.next()){
JOptionPane.showMessageDialog(gui,"username sudah dipakai orang lain","error",0);
}else{
String command="insert into userpass values('"+
username+"'"+
",'"+password+"'"+
",'c')";
db.isidata(command);
command="insert into customer(nama,alamat,nomer_telp,jenis_kelamin,email,agama,username) values('"
+ nama+"','"
+ alamat+"','"
+ nomor +"','"
+ kelamin+"','"
+ email+"','"
+ agama+"','"
+ username+"')";
db.isidata(command);
JOptionPane.showMessageDialog(gui,"silahkan login","selamat",1);
gui.dispose();
new login_kontroler();
}
} catch (SQLException ex) {
Logger.getLogger(daftar_kontroler.class.getName()).log(Level.SEVERE, null, ex);
}
}
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
| [
"edy.puji4ever@gmail.com"
] | edy.puji4ever@gmail.com |
aa4e60033e2584d513a68ac97aa5d705347d3ab0 | 521c8b389fca801a87e7fcdbcb6d356b1e69af66 | /DockerIMAGE_PRESTASHOP/PrestaShop/src/test/java/com/PrestaShop/test2/AddNewCategory.java | 7fab3a6a41b987b3830940d081947474c0fcb02f | [] | no_license | MechaniC1024/Sbros | 4eb22d59fd6b96f9e989c61a9cffbfbfe42d279b | a0f66d46e4a6dbcdb1b99f467ca4097dddf31c92 | refs/heads/master | 2022-12-21T15:55:07.019501 | 2020-09-19T01:52:27 | 2020-09-19T01:52:27 | 296,765,559 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,151 | java | package com.PrestaShop.test2;
import static com.PrestaShop.DataResources.GetUrlAdminPanel.*;
import static com.PrestaShop.Report.Report.*;
import java.util.List;
import org.testng.annotations.Test;
import com.PrestaShop.Admin.*;
import com.PrestaShop.Asserts.Asserts;
import com.PrestaShop.DataResources.GetLoginAndPassword;
import com.PrestaShop.InitialConfiguration.InitialConfiguration;
import io.qameta.allure.*;
@Epic("Тестовый набор 2.")
@Feature("Проверка титулов страниц сайта.")
public class AddNewCategory extends InitialConfiguration {
private String newCategory = "Jacket";
private String buttonAlertExpected = "Создано";
private UserPage userPage;
private Category category;
@Step("Ввод логина и пароля, нажатие кнопки логин.")
@Story("Ввод логина и пароля, нажатие кнопки логин.")
@Test(dataProvider = "getLoginAndPassword", dataProviderClass = GetLoginAndPassword.class, description = "Вход в админ панель.", alwaysRun = true)
public void signIn(String login, String password) {
setURL(getUrlAdminPanel());
LoginPage loginPage = new LoginPage(getDriver());
loginPage.inputLogin(login).inputPassword(password).clickOnLoginButton();
userPage = new UserPage(getDriver());
}
@Step("Переход в раздел категории товаров.")
@Story("Переход в раздел категории товаров.")
@Test(dependsOnMethods = "signIn", description = "Переход в раздел категории товаров.", alwaysRun = true)
public void categorySection() {
category = userPage.selectCatalog().goToCategories();
}
@Step("Создание новой категории.")
@Story("Создание новой категории.")
@Test(dependsOnMethods = "categorySection", description = "Добавление новой категории.", alwaysRun = true)
public void addNewCategory() {
String buttonAlertActual = category.addNewCategory().setNameCategoty(newCategory).clickSaveButton()
.getTextButtonAlert();
Asserts.assertVariable(buttonAlertActual, buttonAlertExpected);
category.clickOnCloseButtonAlert();
}
@Step("Проверка созданной новой категории.")
@Story("Проверка созданной новой категории.")
@Test(dependsOnMethods = "addNewCategory", description = "Проверка созданной категории.", alwaysRun = true)
public void checkingNewCategory() {
List<String> list = category.setFilterByNameCategory(newCategory).filterSearch().getListCategories();
addAttachmentToReport("Проверка новой категории.", newCategory);
Asserts.assertContainsVariable(list, newCategory);
}
@Step("Выход из админ панели сайта.")
@Story("Выход из админ панели сайта.")
@Test(dependsOnMethods = "checkingNewCategory", description = "Выход с аккаунта.", alwaysRun = true)
public void logOut() {
userPage.clickOnImageProfile().clickOnLogOut();
}
} | [
"bog2641@yandex.ru"
] | bog2641@yandex.ru |
a8e00bd87e5bba097a68289d54f4b49c17b7794b | 85042cc78c47880b88d63441c246d525356d0fea | /week-05/src/AircraftCarrier/Carrier.java | a449177579cc1ab077dcc500f458f1b24f771919 | [] | no_license | green-fox-academy/szirmaidora | 1800cba72450d7789e4a1913b3e734f0c6291534 | fc677814948fa01ef87f04da53fbfb0bad5a7101 | refs/heads/master | 2020-04-02T22:57:46.222027 | 2019-01-09T19:38:58 | 2019-01-09T19:38:58 | 154,850,643 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,469 | java | package AircraftCarrier;
import java.util.ArrayList;
import java.util.List;
public class Carrier {
int ammoCarr;
int health;
List<Aircraft> carrier = new ArrayList<>();
public Carrier(int ammoCarr, int health) {
this.ammoCarr = ammoCarr;
this.health = health;
}
public void add(Aircraft one) {
carrier.add(one);
}
public int ammoNeeded() {
int ammoNeed = 0;
for (Aircraft ind : carrier) {
ammoNeed += ind.maxAmmo - ind.ammoStore;
}
return ammoNeed;
}
public void fill() {
if (ammoCarr > ammoNeeded()) {
for (Aircraft ind : carrier) {
if (ind.ammoStore < ind.maxAmmo) {
ammoCarr -= ind.maxAmmo - ind.ammoStore;
ind.ammoStore = ind.maxAmmo;
}
}
} else {
for (Aircraft ind : carrier) {
if (ind.ammoStore < ind.maxAmmo && ind.priority) {
ammoCarr -= ind.maxAmmo - ind.ammoStore;
ind.ammoStore = ind.maxAmmo;
}
}
for (Aircraft ind : carrier) {
if (ind.ammoStore < ind.maxAmmo) {
ammoCarr -= ind.maxAmmo - ind.ammoStore;
ind.ammoStore = ind.maxAmmo;
}
}
}
}
}
| [
"szirmaidora@gmail.com"
] | szirmaidora@gmail.com |
85cb8a97262db8f29f1a55bcaea633ac26fd47c8 | 8ef72de70772d2921b6547ff6255db705b5db337 | /src/main/java/com/yeguo/server/dao/impl/UserFollowDAOImpl.java | 1fce91b7c51d780f73affe744ee1bee05ff50e3e | [] | no_license | huangmiao1986/yeguo-server | 3956198f7c9941c3f6d9318f3399856af92731e4 | 7f6712cf7708547f6d8d58f5bd76242094a1af38 | refs/heads/master | 2021-01-17T20:32:37.829269 | 2016-08-12T11:37:44 | 2016-08-12T11:37:44 | 65,548,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,365 | java | package com.yeguo.server.dao.impl;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Repository;
import com.yeguo.server.base.CustomerContextHolder;
import com.yeguo.server.base.JdbcTemplateWrapper;
import com.yeguo.server.dao.UserFollowDAO;
import com.yeguo.server.model.UserFollow;
@Repository
public class UserFollowDAOImpl implements UserFollowDAO {
@Resource
private JdbcTemplateWrapper jdbcTemplate;
@Override
public int addUserFollow(UserFollow follow) {
CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_WRITE);
String sql = "insert into tb_yeguo_user_follow (user_id,follow_user_id,create_time,update_time) values (?,?,?,?)";
int ret = jdbcTemplate.insertAndGetKey(sql, new Object[]{follow.getUserId(),follow.getFollowUserId(),follow.getCreateTime(),follow.getUpdateTime()});
CustomerContextHolder.clearCustomerType();
return ret;
}
@Override
public int delUserFollow(int id) {
CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_WRITE);
String sql = "delete from tb_yeguo_user_follow where id = ?";
int ret = jdbcTemplate.update(sql, new Object[]{id});
CustomerContextHolder.clearCustomerType();
return ret;
}
@Override
public UserFollow getUserFollowByUserIdAndFollowUserId(long userId, long followUserId) {
CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_WRITE);
String sql = "select * from tb_yeguo_user_follow where user_id = ? and follow_user_id=?";
UserFollow follow = jdbcTemplate.queryForObject(sql, new Object[]{userId,followUserId},new UserFollowMapper());
CustomerContextHolder.clearCustomerType();
return follow;
}
@Override
public List<UserFollow> getFollowListByUserId(long userId, int start, int count) {
CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_WRITE);
String sql = "select * from tb_yeguo_user_follow where user_id = ? order by create_time desc limit ?,?";
List<UserFollow> list = jdbcTemplate.query(sql, new Object[]{userId,start,count},new UserFollowMapper());
CustomerContextHolder.clearCustomerType();
return list;
}
@Override
public int getFollowCountByUserId(long userId) {
CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_WRITE);
String sql = "select count(*) from tb_yeguo_user_follow where user_id = ?";
int count = jdbcTemplate.queryForInt(sql, new Object[]{userId});
CustomerContextHolder.clearCustomerType();
return count;
}
private static final class UserFollowMapper implements RowMapper<UserFollow> {
public UserFollow mapRow(ResultSet rs, int rowNum) throws SQLException {
UserFollow follow = new UserFollow();
follow.setCreateTime(rs.getDate("create_time"));
follow.setFollowUserId(rs.getLong("follow_user_id"));
follow.setId(rs.getInt("id"));
follow.setUpdateTime(rs.getDate("update_time"));
follow.setUserId(rs.getLong("user_id"));
return follow;
}
}
}
| [
"huangmiao21com@sina.com"
] | huangmiao21com@sina.com |
29e572e01e0abc28e7b54d0c97317f94e9030218 | e64cebd26ca371de236779a9c08b6c9caacad283 | /sim/frc_sim_svn/library/com/sun/cldc/jna/TaskExecutor.java | 7cfb17f72b667217bdc67cac1ac567ca41bc5991 | [] | no_license | BishopEustaceRoboticsTeam/bert | 49987253ff3a62eee0dd782accfcee4d1033b2e0 | 054db4c81b8bafac2680fd4334eddbd22b93a723 | refs/heads/master | 2021-01-13T00:59:16.638915 | 2016-04-15T12:51:06 | 2016-04-15T12:51:06 | 50,206,900 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 640 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.sun.cldc.jna;
import java.util.concurrent.*;
/**
*
* @author wolf
*/
public class TaskExecutor extends ThreadPoolExecutor {
static ArrayBlockingQueue m_arrayBlockingQueue = new ArrayBlockingQueue(25);
public TaskExecutor(String name) {
super(20, Integer.MAX_VALUE, Long.MAX_VALUE, TimeUnit.MILLISECONDS, m_arrayBlockingQueue);
}
public void cancelTaskExecutor() {
shutdown();
}
public int deleteTaskExecutor() {
finalize();
return 0;
}
public void stopTaskExecutor() {
shutdown();
finalize();
}
}
| [
"bert5@bert5.(none)"
] | bert5@bert5.(none) |
7e1e2346d676d1738cd28b716966c498872e3ac9 | f67096184165a8d81cf43cc05728ffe101fbb090 | /src/Interface/FixAssets.java | bdef4f8d77171ae21744a03c8abfb862d8796f24 | [] | no_license | rahalsandeepa/Garment-Apperel-System-master | 248d3c775889482d62b78791de158695553a028f | e896ffb24b6a419b21c07dd18655bebacb5eab4b | refs/heads/main | 2023-01-14T04:14:12.044056 | 2020-11-17T09:02:12 | 2020-11-17T09:02:12 | 313,536,792 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 24,925 | java | package Interface;
import java.awt.print.PrinterException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import mycode.DBconnect;
import net.proteanit.sql.DbUtils;
public class FixAssets extends javax.swing.JFrame {
Connection con = null;
PreparedStatement pst = null;
ResultSet rs = null;
public FixAssets() {
initComponents();
//connect to DB
con = DBconnect.connect();
//load table
fixassetstableload();
}
public void fixassetstableload(){
try{
String sql = "SELECT fixassetsno, fixassetstype, fixassetsdate, fixassetsdep, fixassetsdeprate, fixassetsaccdep, cost FROM fixassets ";
pst = con.prepareStatement(sql);
rs = pst.executeQuery();
fixasstesTable.setModel(DbUtils.resultSetToTableModel(rs));
}
catch (Exception e){
}
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel2 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
fixassetsnobox = new javax.swing.JTextField();
fixassetstypebox = new javax.swing.JTextField();
fixassetsdepbox = new javax.swing.JTextField();
fixassetsdepratebox = new javax.swing.JTextField();
fixassetsaccdepbox = new javax.swing.JTextField();
costbox = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jLabel9 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jButton4 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
fixassetsdatebox = new com.github.lgooddatepicker.components.DatePicker();
jPanel3 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
fixasstesTable = new javax.swing.JTable();
jButton6 = new javax.swing.JButton();
searchbox = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel2.setBackground(new java.awt.Color(204, 204, 255));
jPanel1.setBackground(new java.awt.Color(255, 255, 255));
jLabel3.setText("Fix Assets No:");
jLabel3.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N
jLabel4.setText("Fix Assets Type:");
jLabel4.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N
jLabel5.setText("Depreaciation Rate:");
jLabel5.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N
jLabel6.setText("Depreaciation:");
jLabel6.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N
jLabel7.setText("Accumulate Depreaciation:");
jLabel7.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N
jButton1.setText("ADD");
jButton1.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("UPDATE");
jButton2.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setText("DELETE");
jButton3.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jLabel9.setText("Cost:");
jLabel9.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N
jLabel2.setText("Date:");
jLabel2.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N
jButton4.setText("DEMO");
jButton4.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jButton5.setText("GENARATE REPORT");
jButton5.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(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()
.addGap(30, 30, 30)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton5)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton1)
.addGap(18, 18, 18)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton3)
.addGap(18, 18, 18)
.addComponent(jButton4))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7)
.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(fixassetsaccdepbox, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
.addComponent(fixassetsdepratebox, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(fixassetsdepbox, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(fixassetstypebox, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(fixassetsnobox, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(costbox)
.addComponent(fixassetsdatebox, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addGap(50, 50, 50))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(30, 30, 30)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(fixassetsnobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(30, 30, 30)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(fixassetstypebox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(30, 30, 30)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(fixassetsdatebox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(29, 29, 29)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(fixassetsdepbox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(30, 30, 30)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(fixassetsdepratebox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(30, 30, 30)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(fixassetsaccdepbox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(30, 30, 30)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(costbox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(40, 40, 40)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2)
.addComponent(jButton3)
.addComponent(jButton4))
.addGap(18, 18, 18)
.addComponent(jButton5)
.addContainerGap(100, Short.MAX_VALUE))
);
jPanel3.setBackground(new java.awt.Color(153, 153, 255));
fixasstesTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null}
},
new String [] {
"Fix Assets No", "Fix Assets Type", "Date", "Depreaciation", "Rate", "Accumulate"
}
));
fixasstesTable.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
fixasstesTableMouseClicked(evt);
}
});
jScrollPane1.setViewportView(fixasstesTable);
jButton6.setText("SEARCH");
jButton6.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});
jLabel1.setText("Fix assets No:");
jLabel1.setFont(new java.awt.Font("Tahoma", 0, 15)); // NOI18N
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 780, Short.MAX_VALUE)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(searchbox, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton6)))
.addContainerGap())
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(30, 30, 30)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton6)
.addComponent(searchbox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addGap(18, 18, 18)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 481, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(13, Short.MAX_VALUE))
);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 437, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jTabbedPane1.addTab("FIX ASSETS", jPanel2);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane1)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 618, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(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
String no = fixassetsnobox.getText();
String type = fixassetstypebox.getText();
String date = fixassetsdatebox.getText();
String dep = fixassetsdepbox.getText();
String deprate = fixassetsdepratebox.getText();
String accdep = fixassetsaccdepbox.getText();
String cost = costbox.getText();
if(no.equals("")){
JOptionPane.showMessageDialog(null, "Enter fixassets no.");
}
else if(type.equals("")){
JOptionPane.showMessageDialog(null, "Enter fixassets type.");
}
else if(date.equals("")){
JOptionPane.showMessageDialog(null, "Enter fixassets date.");
}
else if(dep.equals("")){
JOptionPane.showMessageDialog(null, "Enter fixassets description.");
}
else if(deprate.equals("")){
JOptionPane.showMessageDialog(null, "Enter fixassets description rate.");
}
else if(accdep.equals("")){
JOptionPane.showMessageDialog(null, "Enter fixassets accumulate description.");
}
else if(cost.equals("")){
JOptionPane.showMessageDialog(null, "Enter fixassets cost.");
}
try{
String q = "INSERT INTO fixassets (fixassetsno, fixassetstype, fixassetsdate, fixassetsdep, fixassetsdeprate, fixassetsaccdep, cost) values('"+no+"', '"+type+"','"+date+"', '"+dep+"','"+deprate+"', '"+accdep+"','"+cost+"')";
pst = con.prepareStatement(q);
pst.execute();
//load table
fixassetstableload();
}
catch(Exception e){
}
}//GEN-LAST:event_jButton1ActionPerformed
private void fixasstesTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_fixasstesTableMouseClicked
int r = fixasstesTable.getSelectedRow();
String no = fixasstesTable.getValueAt(r, 0).toString();
String type = fixasstesTable.getValueAt(r, 1).toString();
String date = fixasstesTable.getValueAt(r, 2).toString();
String dep = fixasstesTable.getValueAt(r, 3).toString();
String deprate = fixasstesTable.getValueAt(r, 4).toString();
String accdep = fixasstesTable.getValueAt(r, 5).toString();
String cost = fixasstesTable.getValueAt(r, 6).toString();
fixassetsnobox.setText(no);
fixassetstypebox.setText(type);
fixassetsdatebox.setText(date);
fixassetsdepbox.setText(dep);
fixassetsdepratebox.setText(deprate);
fixassetsaccdepbox.setText(accdep);
costbox.setText(cost);
}//GEN-LAST:event_fixasstesTableMouseClicked
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
int x = JOptionPane.showConfirmDialog(null, "Do you want to UPDATE");
if(x==0){
String no = fixassetsnobox.getText();
String type = fixassetstypebox.getText();
String date = fixassetsdatebox.getText();
String dep = fixassetsdepbox.getText();
String deprate = fixassetsdepratebox.getText();
String accdep = fixassetsaccdepbox.getText();
String cost = costbox.getText();
try{
String q = "UPDATE fixassets SET fixassetstype = '"+type+"', fixassetsdate = '"+date+"', fixassetsdep = '"+dep+"', fixassetsdeprate = '"+deprate+"', fixassetsaccdep = '"+accdep+"', cost = '"+cost+"' WHERE fixassetsno = '"+no+"' ";
pst = con.prepareStatement(q);
pst.execute();
//load table
fixassetstableload();
}
catch(Exception e){
}
}
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
int x = JOptionPane.showConfirmDialog(null,"Do you want to DELETE this");
if(x==0){
String no = fixassetsnobox.getText();
String q ="DELEte from fixassets where fixassetsno = '"+no+"' ";
try{
pst = con.prepareStatement(q);
pst.execute();
//load table
fixassetstableload();
}
catch(Exception e){
}
}
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
String no = searchbox.getText();
String q = "SELECT fixassetsno, fixassetstype, fixassetsdate, fixassetsdep, fixassetsdeprate, fixassetsaccdep, cost FROM fixassets where fixassetsno ='"+no+"'";
try{
pst = con.prepareStatement(q);
rs = pst.executeQuery();
fixasstesTable.setModel(DbUtils.resultSetToTableModel(rs));
}
catch(Exception e){
}
}//GEN-LAST:event_jButton6ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
// Demo button
fixassetsnobox.setText("FNo111");
fixassetstypebox.setText("building");
fixassetsdatebox.setText("2019-10-01");
fixassetsdepbox.setText("1000");
fixassetsdepratebox.setText("2");
fixassetsaccdepbox.setText("1000");
costbox.setText("1000");
}//GEN-LAST:event_jButton4ActionPerformed
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
// GENARATE REPORT
try{
fixasstesTable.print();
}
catch(PrinterException e){
Logger.getLogger(registerAcademic.class.getName()).log(Level.SEVERE, null, e);
}
}//GEN-LAST:event_jButton5ActionPerformed
public static void main(String args[]){
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FixAssets().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField costbox;
private javax.swing.JTextField fixassetsaccdepbox;
private com.github.lgooddatepicker.components.DatePicker fixassetsdatebox;
private javax.swing.JTextField fixassetsdepbox;
private javax.swing.JTextField fixassetsdepratebox;
private javax.swing.JTextField fixassetsnobox;
private javax.swing.JTextField fixassetstypebox;
private javax.swing.JTable fixasstesTable;
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.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.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JTextField searchbox;
// End of variables declaration//GEN-END:variables
}
| [
"rahalsandeepa99@gmail.com"
] | rahalsandeepa99@gmail.com |
b063b760e13f6a5dcc7b14df58f059e368f9e994 | 1e5cd15657fff9c97296002986f1be83707def76 | /Core/src/main/java/pt/jmfgameiro/resources/core/cache/CacheFactory.java | 2bc1f11436e90ba81630aafc70040d2fb83b6574 | [] | no_license | jmfgameiro/Resources | bb1081fbc52cf9e4cd27f3042a5a94454d90b549 | 3837a03a16448a375a76d3f17bbd7e8ada76a68e | refs/heads/master | 2021-01-16T21:44:31.095125 | 2016-11-18T12:12:39 | 2016-11-18T12:12:39 | 63,698,860 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package pt.jmfgameiro.resources.core.cache;
import org.ehcache.CacheManager;
import org.ehcache.config.builders.CacheManagerBuilder;
/**
* @author João Gameiro
*
*/
public final class CacheFactory {
/***** CONSTANTS *****/
public static final CacheManager MANAGER = CacheManagerBuilder.newCacheManagerBuilder().build( true );
/***** CONSTANTS *****/
private CacheFactory() {}
}
| [
"jmfgameiro@gmail.com"
] | jmfgameiro@gmail.com |
ec621a4a178cc378354f56ea2d8750ec110f2d32 | 92338c2a7f21926a13143dd7661599b4e033c834 | /Documentation/POO3/POO1/telas/TelaProdutoInserirStub.java | c0048dd1e69cc8f0b758b473f6d12ed4910e4fb5 | [] | no_license | joaoguimaraes31/tcc | fb9166e78e874215d96512c62dcf2e2510b32f02 | 3057dac1fb4cc4d12a7b04420340720673dcb9bd | refs/heads/master | 2021-07-15T01:57:16.473447 | 2017-10-20T18:42:22 | 2017-10-20T18:42:22 | 106,132,699 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 978 | java | /*
* Created on 20/04/2005
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package telas;
import javax.swing.JOptionPane;
import entidades.SolicitaProduto;
/**
* @author yury
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class TelaProdutoInserirStub {
public void editar(SolicitaProduto SolPro){
JOptionPane.showMessageDialog(null,"Botão Inserir foi apertado"+" "+
"ID:"+SolPro.iDProduto+" "+"Descrição Textual:"+SolPro.descricaoTextual+" "+
"Tipo:"+SolPro.tipo+" "+"\nPreço:"+SolPro.preco+" "+
"Quantidade:"+SolPro.quantidade);
}
public void voltar(){
JOptionPane.showMessageDialog(null,"Botão Voltar foi apertado");
}
public static void main(String[] args) {
// new TelaProdutoInserir().show();
}
}
| [
"joaoguimaraes31@gmail.com"
] | joaoguimaraes31@gmail.com |
99a0664ee884845a79f89cd9e6652f9549573d4b | 4ed3a941773f0604c9dbc4820b371e263f44b60d | /src/main/java/org/eclipse/cargotracker/interfaces/booking/web/ListCargo.java | 072cdf8eedcbf6eae2e4c3904460b96b1c2c8b61 | [
"MIT"
] | permissive | thadumi/cargotracker | c49cf16e1f28d566610af1bc663379735a18cb07 | 0685f6c746693201888826daad367c10ace76853 | refs/heads/master | 2023-01-01T11:20:55.971269 | 2020-10-10T18:31:45 | 2020-10-10T18:31:45 | 268,377,666 | 0 | 0 | MIT | 2020-08-29T01:08:19 | 2020-05-31T22:50:30 | Java | UTF-8 | Java | false | false | 2,646 | java | package org.eclipse.cargotracker.interfaces.booking.web;
import org.eclipse.cargotracker.interfaces.booking.facade.BookingServiceFacade;
import org.eclipse.cargotracker.interfaces.booking.facade.dto.CargoRoute;
import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.ArrayList;
import java.util.List;
/**
* Handles listing cargo. Operates against a dedicated service facade, and could
* easily be rewritten as a thick Swing client. Completely separated from the
* domain layer, unlike the tracking user interface.
* <p/>
* In order to successfully keep the domain model shielded from user interface
* considerations, this approach is generally preferred to the one taken in the
* tracking controller. However, there is never any one perfect solution for all
* situations, so we've chosen to demonstrate two polarized ways to build user
* interfaces.
*/
@Named
@RequestScoped
public class ListCargo {
private List<CargoRoute> cargos;
private List<CargoRoute> routedCargos;
private List<CargoRoute> claimedCargos;
private List<CargoRoute> notRoutedCargos;
private List<CargoRoute> routedUnclaimedCargos;
@Inject
private BookingServiceFacade bookingServiceFacade;
public List<CargoRoute> getCargos() {
return cargos;
}
@PostConstruct
public void init() {
cargos = bookingServiceFacade.listAllCargos();
}
public List<CargoRoute> getRoutedCargos() {
routedCargos = new ArrayList<>();
for (CargoRoute route : cargos) {
if (route.isRouted()) {
routedCargos.add(route);
}
}
return routedCargos;
}
public List<CargoRoute> getRoutedUnclaimedCargos() {
routedUnclaimedCargos = new ArrayList<>();
for (CargoRoute route : cargos) {
if (route.isRouted() && !route.isClaimed()) {
routedUnclaimedCargos.add(route);
}
}
return routedUnclaimedCargos;
}
public List<CargoRoute> getClaimedCargos() {
claimedCargos = new ArrayList<>();
for (CargoRoute route : cargos) {
if (route.isClaimed()) {
claimedCargos.add(route);
}
}
return claimedCargos;
}
public List<CargoRoute> getNotRoutedCargos() {
notRoutedCargos = new ArrayList<>();
for (CargoRoute route : cargos) {
if (!route.isRouted()) {
notRoutedCargos.add(route);
}
}
return notRoutedCargos;
}
}
| [
"th.theodor.th@gmail.com"
] | th.theodor.th@gmail.com |
461dcebded41b402e2a32c1f80efc19c94b3e229 | 1f5c3fe13b245f2149f3a8201d575cb2a666d13f | /src/main/java/com/atom/coco/config/DefaultProfileUtil.java | 8b26cd11fbe095a7b224876c5e97de0c7f066320 | [] | no_license | feel7iii/Coco | cdee74d1d650c48bfecf532c55bce97b71cc5b46 | 8880f9cfcf2c1aa24f631de9b00d335ecb876d34 | refs/heads/master | 2021-01-19T19:35:17.265746 | 2018-02-09T06:49:04 | 2018-02-09T06:49:04 | 88,425,687 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,709 | java | package com.atom.coco.config;
import io.github.jhipster.config.JHipsterConstants;
import org.springframework.boot.SpringApplication;
import org.springframework.core.env.Environment;
import java.util.*;
/**
* Utility class to load a Spring profile to be used as default
* when there is no <code>spring.profiles.active</code> set in the environment or as command line argument.
* If the value is not available in <code>application.yml</code> then <code>dev</code> profile will be used as default.
*/
public final class DefaultProfileUtil {
private static final String SPRING_PROFILE_DEFAULT = "spring.profiles.default";
private DefaultProfileUtil() {
}
/**
* Set a default to use when no profile is configured.
*
* @param app the Spring application
*/
public static void addDefaultProfile(SpringApplication app) {
Map<String, Object> defProperties = new HashMap<>();
/*
* The default profile to use when no other profiles are defined
* This cannot be set in the <code>application.yml</code> file.
* See https://github.com/spring-projects/spring-boot/issues/1219
*/
defProperties.put(SPRING_PROFILE_DEFAULT, JHipsterConstants.SPRING_PROFILE_DEVELOPMENT);
app.setDefaultProperties(defProperties);
}
/**
* Get the profiles that are applied else get default profiles.
*
* @param env spring environment
* @return profiles
*/
public static String[] getActiveProfiles(Environment env) {
String[] profiles = env.getActiveProfiles();
if (profiles.length == 0) {
return env.getDefaultProfiles();
}
return profiles;
}
}
| [
"feelwisteria@sina.cn"
] | feelwisteria@sina.cn |
1fb5faa32802b5d857e53ccdbaa6c5cd83b4e1b9 | b2a3210ea197e86967e9d57d1390fd0f804b2a36 | /on-java8/src/main/java/com/ericaShy/java8/concurrent/CountingTask.java | d823940bb9c0ce496323f1939f727e56aa0011d8 | [] | no_license | 547358880/javatutorials | 5b97781755c7b00064e078228120cf8e8775aa67 | c4f698805e437a30ffd9d4804284c84327d8693b | refs/heads/master | 2021-06-26T19:28:17.101859 | 2020-01-02T00:49:07 | 2020-01-02T00:49:07 | 220,178,290 | 0 | 0 | null | 2021-03-31T21:38:17 | 2019-11-07T07:37:28 | Java | UTF-8 | Java | false | false | 469 | java | package com.ericaShy.java8.concurrent;
import java.util.concurrent.Callable;
public class CountingTask implements Callable<Integer> {
final int id;
public CountingTask(int id) {
this.id = id;
}
@Override
public Integer call() {
Integer val = 0;
for (int i = 0; i < 100; i++) {
val++;
}
System.out.println(id + " " + Thread.currentThread().getName() + " " + val);
return val;
}
}
| [
"547358880@qq.com"
] | 547358880@qq.com |
b5b85dc122e914c348d45e9b4c38486b53326f9a | c323c93269ba87802f8cbc9fa636f365af09ea87 | /15-javaexception/src/exception1/Exception2.java | e3f4b44b8020b9ca9670facb5ae96299ce17ac49 | [] | no_license | Ryu-kwonhee/javabasic-1 | 14645a4ae8cb855910fde6e89fa6c6e7d3a1089a | 4ac1e49d7967a7f5f678db0b9ab3a5b036ae4010 | refs/heads/master | 2023-07-05T04:59:47.489039 | 2021-08-16T07:12:31 | 2021-08-16T07:12:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 359 | java | package exception1;
public class Exception2 {
public static void main(String[] args) {
// 예외 발생 케이스 2.
// 실행 예외는 실행하기 전까지는 예외를 인지할 수 없는 예외입니다.
// 대표적인 예시로는 어떤 숫자를 0으로 나누는 것입니다.
int a= 1;
int b = 0;
System.out.println(a/b);
}
}
| [
"shinwr7@naver.com"
] | shinwr7@naver.com |
ec68006a564ecd43c3c15a7c162c8347eb18c542 | 4c6478ef9e2708788a1145ab7663ae9c9b3b8417 | /rmqa/src/main/java/com/utsman/rmqa/RmqaConnection.java | c748de5f1360a91cf2bade7648033a8a8a6a5bf9 | [
"Apache-2.0"
] | permissive | esqi/rmqa | dabba0723cb889d96ca6977f490eafb976faeda7 | eedf95256d0c12d2f999b9ef0c8b2a49396d885e | refs/heads/master | 2020-09-21T11:22:35.416560 | 2019-10-23T04:48:14 | 2019-10-23T04:48:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,893 | java | package com.utsman.rmqa;
import android.content.Context;
import android.util.Log;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.Observer;
import com.utsman.rmqa.event.PublishEvent;
import com.utsman.rmqa.event.PublishSingleEvent;
import com.utsman.rmqa.listener.ConnectionListener;
import com.utsman.rmqa.listener.DeliveryListener;
import com.utsman.rmqa.listener.DeliveryListenerRaw;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.json.JSONException;
import org.json.JSONObject;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
import kotlinx.android.parcel.Parcelize;
@Parcelize
public class RmqaConnection {
Builder builder;
private CompositeDisposable compositeDisposable = new CompositeDisposable();
private RmqaApp rmqaApp = new RmqaApp();
private MutableLiveData<JSONObject> mutableLiveData = new MutableLiveData<>();
private RmqaConnection(Builder builder) {
this.builder = builder;
}
public static class Builder {
private String url;
private String server;
private String username;
private String password;
private String vhost;
private String connectionName;
private String exchangeName;
private String routingKey;
private boolean clear = false;
private Context context;
public Builder(Context context) {
this.context = context;
}
public Builder setServer(String server) {
this.server = server;
return this;
}
public Builder setUsername(String username) {
this.username = username;
return this;
}
public Builder setPassword(String password) {
this.password = password;
return this;
}
public Builder setVhost(String vhost) {
this.vhost = vhost;
return this;
}
public Builder setConnectionName(String connectionName) {
this.connectionName = connectionName;
return this;
}
public Builder setExchangeName(String exchangeName) {
this.exchangeName = exchangeName;
return this;
}
public Builder setRoutingKey(String routingKey) {
this.routingKey = routingKey;
return this;
}
public Builder setAutoClearQueue(boolean clear) {
this.clear = clear;
return this;
}
public RmqaConnection build() {
url = "amqp://" + username + ":" + password + "@" + server + "/" + vhost;
return new RmqaConnection(this);
}
}
void connect(final String queueName,
final String type,
final ConnectionListener connectionListener) {
final String exName = builder.context.getPackageName() + "." + builder.exchangeName;
Disposable disposable = Observable.just(rmqaApp)
.subscribeOn(Schedulers.io())
.doOnNext(new Consumer<RmqaApp>() {
@Override
public void accept(RmqaApp rabbitConnection) {
rabbitConnection.connect(
builder.connectionName,
exName,
queueName,
builder.url,
builder.routingKey,
builder.clear,
type);
}
})
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<RmqaApp>() {
@Override
public void accept(RmqaApp rabbitConnection) throws Exception {
connectionListener.onConnected();
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
Log.e("anjay", "connect fail");
}
});
compositeDisposable.add(disposable);
}
void subscribe(final String queueName, final DeliveryListener listener) {
Disposable disposable = Observable.just(rmqaApp)
.subscribeOn(Schedulers.newThread())
.doOnNext(new Consumer<RmqaApp>() {
@Override
public void accept(RmqaApp rabbitConnection) {
rabbitConnection.subscribe(queueName, new DeliveryListenerRaw() {
@Override
public void onRawJson(JSONObject jsonObject) {
mutableLiveData.postValue(jsonObject);
}
});
}
})
.subscribe(new Consumer<RmqaApp>() {
@Override
public void accept(RmqaApp rabbitConnection) throws Exception {
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
}
});
mutableLiveData.observeForever(new Observer<JSONObject>() {
@Override
public void onChanged(JSONObject jsonObject) {
try {
String senderId = jsonObject.getString("sender_id");
JSONObject data = jsonObject.getJSONObject("body");
listener.onDelivery(senderId, data);
} catch (JSONException e) {
Log.e("anjay", "Failed parsing json");
}
}
});
compositeDisposable.add(disposable);
}
@Subscribe
public void publish(final PublishEvent publishEvent) {
final String exName = builder.context.getPackageName() + "." + publishEvent.exchangeName;
Disposable disposable = Observable.just(rmqaApp)
.subscribeOn(Schedulers.io())
.doOnNext(new Consumer<RmqaApp>() {
@Override
public void accept(RmqaApp rabbitConnection) {
rmqaApp.publish(builder.routingKey, exName, publishEvent.jsonData, publishEvent.senderId);
}
})
.observeOn(AndroidSchedulers.mainThread())
.subscribe();
compositeDisposable.add(disposable);
}
@Subscribe
public void publish(final PublishSingleEvent singleEvent) {
Disposable disposable = Observable.just(rmqaApp)
.subscribeOn(Schedulers.io())
.doOnNext(new Consumer<RmqaApp>() {
@Override
public void accept(RmqaApp rmqaConnection) throws Exception {
rmqaApp.publishTo(singleEvent.queueName, singleEvent.jsonData, singleEvent.senderId);
}
})
.observeOn(AndroidSchedulers.mainThread())
.subscribe();
compositeDisposable.add(disposable);
}
void registerPublisher() {
boolean registered = EventBus.getDefault().isRegistered(this);
if (!registered) {
EventBus.getDefault().register(this);
} else {
Log.i("anjay", "Publisher has registerd");
}
}
void disconnect() {
compositeDisposable.dispose();
rmqaApp.disconnect();
EventBus.getDefault().unregister(this);
}
}
| [
"kucingapes@gmail.com"
] | kucingapes@gmail.com |
4cadc47ca28693feb784291a60d82c5f76de16d2 | 33d130dca166c7db01a5749fb89862a6aea519dd | /androidannotations-api/src/main/java/org/androidannotations/annotations/WindowFeature.java | c0e56a2732983d48101a216910ba29bd0e5b6dad | [] | no_license | wengwenwen/androidannotations | d2eb8ab864f96323523de8674edc55dc5dcd19c1 | 5d03876138913c5605aa21e729332fa75a47282b | refs/heads/master | 2020-12-03T00:05:15.819314 | 2015-02-13T03:28:48 | 2015-02-13T03:28:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,500 | java | /**
* Copyright (C) 2010-2014 eBusiness Information, Excilys Group
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed To in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.androidannotations.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* <p>
* Should be used on {@link EActivity} classes to set custom window features.
* </p>
* <p>
* The annotation value should be one or several of {@link android.view.Window}
* constants.
* </p>
* <p>
* <b>Note:</b> This should replace {@link NoTitle} annotation.
* </p>
* <blockquote>
*
* Example :
*
* <pre>
* @WindowFeature({ Window.FEATURE_NO_TITLE, Window.FEATURE_INDETERMINATE_PROGRESS })
* @EActivity
* public class MyActivity extends Activity {
*
* }
* </pre>
*
* </blockquote>
*
* @see EActivity
*/
@Retention(RetentionPolicy.CLASS)
@Target(ElementType.TYPE)
public @interface WindowFeature {
int[] value();
}
| [
"bobdeng@163.com"
] | bobdeng@163.com |
dfd3d36dec406a2fddc93facc5f39d59700b2d78 | 42b68a55d4ca4c48b40ea0e0811f16fa0a523b33 | /src/main/java/com/colin/springboot/fileserver/config/MongoConf.java | 02650d4bab7852b13060ab3ec1c55a8bbda95132 | [] | no_license | siasColin/fileserver | 0ca49e8be5eb195c4c6e967f26ff9d74dc9950a2 | e0d4577489bc3adc6f71b7279eba68350ef36d85 | refs/heads/master | 2021-05-22T16:27:57.059036 | 2020-08-20T10:11:05 | 2020-08-20T10:11:05 | 253,003,009 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 923 | java | package com.colin.springboot.fileserver.config;
/**
* @Package: com.colin.springboot.fileserver.config
* @Author: sxf
* @Date: 2020-8-19
* @Description: mongodb的配置类
* 解决新版本不支持获取GGridFSDBFile
*/
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.gridfs.GridFSBucket;
import com.mongodb.client.gridfs.GridFSBuckets;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.MongoDbFactory;
@Configuration
public class MongoConf {
@Autowired
private MongoDbFactory mongoDbFactory;
/**
* GridFSBucket用于打开下载流
* @return
*/
@Bean
public GridFSBucket gridFSBucket() {
MongoDatabase db = mongoDbFactory.getDb();
return GridFSBuckets.create(db);
}
}
| [
"1540247870@qq.com"
] | 1540247870@qq.com |
fb255e8a17f7fdd3d4cc4ba75a46fb79064ed38b | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/34/34_2e53066dab37e065534ec6ab46f1ee00c5f16c25/ClashOfClay/34_2e53066dab37e065534ec6ab46f1ee00c5f16c25_ClashOfClay_t.java | 4d89a6c82e61db6a04110790f16f97c9c7f60a22 | [] | 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 | 5,083 | java | package com.oresomecraft.BattleMaps.maps;
import java.util.List;
import com.oresomecraft.BattleMaps.IBattleMap;
import com.oresomecraft.BattleMaps.api.InvUtils;
import com.oresomecraft.OresomeBattles.BattlePlayer;
import com.oresomecraft.OresomeBattles.gamemodes.TDM;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import com.oresomecraft.BattleMaps.BattleMap;
import com.oresomecraft.OresomeBattles.Gamemode;
import com.oresomecraft.OresomeBattles.events.InventoryEvent;
public class ClashOfClay extends BattleMap implements IBattleMap, Listener {
public ClashOfClay() {
super.initiate(this);
setDetails(name, fullName, creators, modes);
}
String name = "clashofclay";
String fullName = "Clash Of Clay";
String creators = "_Moist and niceman506";
Gamemode[] modes = {Gamemode.TDM};
public void readyTDMSpawns() {
World w = Bukkit.getServer().getWorld(name);
Location redSpawn = new Location(w, -22, 81, 8);
Location blueSpawn = new Location(w, -23, 81, 164);
redSpawns.add(redSpawn);
blueSpawns.add(blueSpawn);
setRedSpawns(name, redSpawns);
setBlueSpawns(name, blueSpawns);
}
public void readyFFASpawns() {
World w = Bukkit.getServer().getWorld(name);
Location redSpawn = new Location(w, -22, 81, 8);
Location blueSpawn = new Location(w, -23, 81, 164);
FFASpawns.add(blueSpawn);
FFASpawns.add(redSpawn);
setFFASpawns(name, FFASpawns);
}
@EventHandler(priority = EventPriority.NORMAL)
public void applyInventory(InventoryEvent event) {
if (event.getMessage().equalsIgnoreCase(name)) {
final BattlePlayer p = event.getPlayer();
Inventory i = p.getInventory();
clearInv(p);
ItemStack WOODEN_SWORD = new ItemStack(Material.WOOD_SWORD, 1, (short) -16373);
ItemStack BOW = new ItemStack(Material.BOW, 1);
ItemStack IRON_PICKAXE = new ItemStack(Material.IRON_PICKAXE, 1, (short) -1400);
//Make the pick semi-unlimited - R3
ItemStack PUMPKIN_PIE = new ItemStack(Material.PUMPKIN_PIE, 5);
ItemStack APPLE = new ItemStack(Material.GOLDEN_APPLE, 2);
ItemStack BLUE_STAINED_CLAY = new ItemStack(Material.STAINED_CLAY, 48, (short) 11);
ItemStack RED_STAINED_CLAY = new ItemStack(Material.STAINED_CLAY, 48, (short) 14);
//Give a LITTLE more clay - R3
ItemStack LEATHER_CHESTPLATE = new ItemStack(Material.LEATHER_CHESTPLATE, 1);
ItemStack DIAMOND_HELMET = new ItemStack(Material.DIAMOND_HELMET, 1);
//Make the rushers a little less weak, about 10% less damage/
ItemStack TORCH = new ItemStack(Material.TORCH, 16);
ItemStack ARROW = new ItemStack(Material.ARROW, 1);
p.getInventory().setChestplate(LEATHER_CHESTPLATE);
p.getInventory().setHelmet(DIAMOND_HELMET);
BOW.addEnchantment(Enchantment.ARROW_INFINITE, 1);
InvUtils.colourArmourAccordingToTeam(p, new ItemStack[]{LEATHER_CHESTPLATE});
i.setItem(0, WOODEN_SWORD);
i.setItem(1, BOW);
i.setItem(2, IRON_PICKAXE);
i.setItem(3, PUMPKIN_PIE);
i.setItem(4, APPLE);
if (TDM.isRed(p.getName())) {
i.setItem(5, RED_STAINED_CLAY);
}
if (TDM.isBlue(p.getName())) {
i.setItem(5, BLUE_STAINED_CLAY);
}
i.setItem(6, TORCH);
i.setItem(27, ARROW);
}
}
// Region. (Top corner block and bottom corner block.
// Top left corner.
public int x1 = -100;
public int y1 = 160;
public int z1 = -70;
//Bottom right corner.
public int x2 = -70;
public int y2 = 30;
public int z2 = 50;
@EventHandler
public void death(org.bukkit.event.entity.PlayerDeathEvent event) {
Player p = event.getEntity();
List<ItemStack> drops = event.getDrops();
for (ItemStack item : drops) {
Material mat = item.getType();
if (mat == Material.DIAMOND_HELMET || mat == Material.WOOD_SWORD) {
item.setType(Material.AIR);
}
}
}
@EventHandler
public void place(org.bukkit.event.block.BlockPlaceEvent event) {
if (contains(event.getBlock().getLocation(), -24, -21, 81, 84, 165, 162)) event.setCancelled(true);
if (contains(event.getBlock().getLocation(), -21, -24, 81, 86, 7, 10)) event.setCancelled(true);
}
//May be incorrect, if not, fix.
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
69983e437171cb2d90d958c2140c71027b374337 | cb1d9056e728be0c022df1c0e539e49c77329392 | /library/src/main/java/com/zhou/library/utils/statusbarUtils/OSUtils.java | 67849f93df5093400043ddc9542a411d386ef033 | [] | no_license | 327585419/CryptoSigner | af9a897df07dca5c7d64fb35b0e98f9c4ef1abaa | 54c99961bc6a0c05f94b17209bbdf353fc2d8604 | refs/heads/master | 2022-04-06T02:16:21.579175 | 2020-03-04T02:48:23 | 2020-03-04T02:48:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,551 | java | package com.zhou.library.utils.statusbarUtils;
import android.os.Build;
import android.text.TextUtils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class OSUtils {
public static final String ROM_MIUI = "MIUI";
public static final String ROM_EMUI = "EMUI";
public static final String ROM_FLYME = "FLYME";
public static final String ROM_OPPO = "OPPO";
public static final String ROM_SMARTISAN = "SMARTISAN";
public static final String ROM_VIVO = "VIVO";
public static final String ROM_QIKU = "QIKU";
private static final String KEY_VERSION_MIUI = "ro.miui.ui.version.name";
private static final String KEY_VERSION_EMUI = "ro.build.version.emui";
private static final String KEY_VERSION_OPPO = "ro.build.version.opporom";
private static final String KEY_VERSION_SMARTISAN = "ro.smartisan.version";
private static final String KEY_VERSION_VIVO = "ro.vivo.os.version";
private static String sName;
private static String sVersion;
public static boolean isEmui() {
return check(ROM_EMUI);
}
public static boolean isMiui() {
return check(ROM_MIUI);
}
public static boolean isVivo() {
return check(ROM_VIVO);
}
public static boolean isOppo() {
return check(ROM_OPPO);
}
public static boolean isFlyme() {
return check(ROM_FLYME);
}
public static boolean is360() {
return check(ROM_QIKU) || check("360");
}
public static boolean isSmartisan() {
return check(ROM_SMARTISAN);
}
public static String getName() {
if (sName == null) {
check("");
}
return sName;
}
public static String getVersion() {
if (sVersion == null) {
check("");
}
return sVersion;
}
public static boolean check(String rom) {
if (sName != null) {
return sName.equals(rom);
}
if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_MIUI))) {
sName = ROM_MIUI;
} else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_EMUI))) {
sName = ROM_EMUI;
} else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_OPPO))) {
sName = ROM_OPPO;
} else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_VIVO))) {
sName = ROM_VIVO;
} else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_SMARTISAN))) {
sName = ROM_SMARTISAN;
} else {
sVersion = Build.DISPLAY;
if (sVersion.toUpperCase().contains(ROM_FLYME)) {
sName = ROM_FLYME;
} else {
sVersion = Build.UNKNOWN;
sName = Build.MANUFACTURER.toUpperCase();
}
}
return sName.equals(rom);
}
public static String getProp(String name) {
String line = null;
BufferedReader input = null;
try {
Process p = Runtime.getRuntime().exec("getprop " + name);
input = new BufferedReader(new InputStreamReader(p.getInputStream()), 1024);
line = input.readLine();
input.close();
} catch (IOException ex) {
return null;
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return line;
}
}
| [
"cmfifa@163.com"
] | cmfifa@163.com |
8447ddf60060801b01a622cc6688e29b0935fdb9 | 21f10d11ace5a2790a40fd58d0e1f1334f646f68 | /web/src/main/java/com/zwl/mall/system/datasource/DruidConfiguration.java | 2bbfd7a5398c00c899c0dbe0b1de2a799d0c0d87 | [] | no_license | weiliangzhou/mall_plus | 7c8e54b7a4b38392b228b101b358c940b052008f | 4a78226ff9f45f09524f423c2e3b097c46e11126 | refs/heads/master | 2022-07-15T14:55:05.435760 | 2019-05-24T09:47:28 | 2019-05-24T09:47:28 | 167,795,087 | 1 | 0 | null | 2022-06-21T00:55:44 | 2019-01-27T10:14:39 | Java | UTF-8 | Java | false | false | 1,671 | java | package com.zwl.mall.system.datasource;
import com.alibaba.druid.support.http.StatViewServlet;
import com.alibaba.druid.support.http.WebStatFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author 二师兄超级帅
*/
@Configuration
public class DruidConfiguration {
@Bean
public ServletRegistrationBean startViewServlet(){
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(),"/druid/*");
// IP白名单
servletRegistrationBean.addInitParameter("allow","127.0.0.1");
// IP黑名单(共同存在时,deny优先于allow)
servletRegistrationBean.addInitParameter("deny","127.0.0.1");
//控制台管理用户
servletRegistrationBean.addInitParameter("loginUsername","admin");
servletRegistrationBean.addInitParameter("loginPassword","123456");
//是否能够重置数据
servletRegistrationBean.addInitParameter("resetEnable","false");
return servletRegistrationBean;
}
@Bean
public FilterRegistrationBean statFilter(){
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new WebStatFilter());
//添加过滤规则
filterRegistrationBean.addUrlPatterns("/*");
//忽略过滤的格式
filterRegistrationBean.addInitParameter("exclusions","*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*");
return filterRegistrationBean;
}
}
| [
"382308664@qq.com"
] | 382308664@qq.com |
846b524530b1e76207d33b11f0cda8716f42eb4c | 110c79207c528e9604520c789cde7d25404ca572 | /baselibrary/src/main/java/com/micang/baselibrary/event/BindEventBus.java | b1391d230e52048f2f588f1114bf25a6fca38c34 | [] | no_license | led-os/baozhu-android | 87893e3d982b2091999d38a7a68c8fdc6c48992a | a71c61ac594e8e66d5230753b2396a2d8b583c1a | refs/heads/master | 2022-12-10T08:55:53.761411 | 2020-08-27T10:34:55 | 2020-08-27T10:34:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 298 | java | package com.micang.baselibrary.event;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface BindEventBus {
}
| [
"songyixian@bailuntec.com"
] | songyixian@bailuntec.com |
e9bee1bae99353dafb55091a24221d395ae44444 | 5289e40e25fe505c0bf483aca75080c0f3ae69b4 | /java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaUtilImpl.java | 4d73d637b5d82b0919af63e0df7342e52fe08193 | [
"Apache-2.0"
] | permissive | haarlemmer/Jvav-Studio-Community | 507e4fa1b4873cd1ede5442219d105757a91abbb | de80b70f5507f0110de89a95d72b8f902ca72b3e | refs/heads/main | 2023-06-30T10:09:28.470066 | 2021-08-04T08:39:35 | 2021-08-04T08:39:35 | 392,603,002 | 0 | 0 | Apache-2.0 | 2021-08-04T08:04:52 | 2021-08-04T08:04:51 | null | UTF-8 | Java | false | false | 33,720 | java | // Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInspection.reference;
import com.intellij.codeInsight.daemon.impl.analysis.GenericsHighlightUtil;
import com.intellij.java.analysis.JavaAnalysisBundle;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.psi.*;
import com.intellij.psi.impl.light.LightElement;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.MethodSignatureUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.util.ObjectUtils;
import com.intellij.util.VisibilityUtil;
import com.siyeh.ig.psiutils.ExpressionUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.uast.*;
import org.jetbrains.uast.visitor.AbstractUastVisitor;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
public class RefJavaUtilImpl extends RefJavaUtil {
private static final Logger LOG = Logger.getInstance(RefJavaUtilImpl.class);
@Override
public void addReferences(@NotNull PsiModifierListOwner psiFrom, @NotNull RefJavaElement ref, @Nullable PsiElement findIn) {
UDeclaration decl = UastContextKt.toUElement(psiFrom, UDeclaration.class);
UElement uFindIn = UastContextKt.toUElement(findIn);
if (decl != null && findIn != null) {
addReferencesTo(decl, ref, new UElement[]{uFindIn});
}
}
@Override
public void addReferencesTo(@NotNull final UDeclaration decl, @NotNull final RefJavaElement ref, final UElement @Nullable [] findIn) {
final RefJavaElementImpl refFrom = (RefJavaElementImpl)ref;
if (findIn == null) {
return;
}
for (UElement element : findIn) {
if (element == null) continue;
element.accept(new AbstractUastVisitor() {
@Override
public boolean visitEnumConstant(@NotNull UEnumConstant node) {
processNewLikeConstruct(node.resolve(), node.getValueArguments());
return false;
}
@Override
public boolean visitAnnotation(@NotNull UAnnotation node) {
PsiClass javaClass = node.resolve();
if (javaClass != null) {
final RefClassImpl refClass = (RefClassImpl)refFrom.getRefManager().getReference(javaClass.getOriginalElement());
refFrom.addReference(refClass, javaClass.getOriginalElement(), decl, false, true, null);
}
return false;
}
@Override
public boolean visitTypeReferenceExpression(@NotNull UTypeReferenceExpression node) {
PsiType type = node.getType();
visitTypeRefs(type);
return false;
}
private void visitTypeRefs(PsiType type) {
type = type.getDeepComponentType();
if (type instanceof PsiClassType) {
type.accept(new PsiTypeVisitor<Void>() {
@Override
public Void visitClassType(@NotNull PsiClassType classType) {
for (PsiType parameter : classType.getParameters()) {
parameter.accept(this);
}
UClass target = UastContextKt.toUElement(classType.resolve(), UClass.class);
if (target != null) {
final RefClassImpl refClass = (RefClassImpl)refFrom.getRefManager().getReference(target.getSourcePsi());
refFrom.addReference(refClass, target.getSourcePsi(), decl, false, true, null);
}
return null;
}
});
}
}
@Override
public boolean visitVariable(@NotNull UVariable node) {
visitTypeRefs(node.getType());
return false;
}
@Override
public boolean visitSimpleNameReferenceExpression(@NotNull USimpleNameReferenceExpression node) {
final PsiElement target = node.resolve();
visitReferenceExpression(node);
if (target instanceof PsiClass) {
final PsiClass aClass = (PsiClass)target;
final RefClassImpl refClass = (RefClassImpl)refFrom.getRefManager().getReference(aClass);
refFrom.addReference(refClass, aClass, decl, false, true, null);
}
return false;
}
@Override
public boolean visitLiteralExpression(@NotNull ULiteralExpression node) {
PsiElement sourcePsi = node.getSourcePsi();
if (sourcePsi != null) {
for (PsiReference reference : sourcePsi.getReferences()) {
PsiElement resolve = reference.resolve();
if (resolve instanceof PsiMember) {
final RefElement refResolved = refFrom.getRefManager().getReference(resolve);
refFrom.addReference(refResolved, resolve, decl, false, true, null);
if (refResolved instanceof RefMethod) {
updateRefMethod(resolve, refResolved, node, decl, refFrom);
}
}
}
}
return false;
}
@Override
public boolean visitPrefixExpression(@NotNull UPrefixExpression node) {
visitReferenceExpression(node);
return false;
}
@Override
public boolean visitPostfixExpression(@NotNull UPostfixExpression node) {
visitReferenceExpression(node);
return false;
}
@Override
public boolean visitUnaryExpression(@NotNull UUnaryExpression node) {
visitReferenceExpression(node);
return false;
}
@Override
public boolean visitBinaryExpression(@NotNull UBinaryExpression node) {
visitReferenceExpression(node);
return false;
}
@Override
public boolean visitQualifiedReferenceExpression(@NotNull UQualifiedReferenceExpression node) {
visitReferenceExpression(node);
return false;
}
@Override
public boolean visitCallableReferenceExpression(@NotNull UCallableReferenceExpression node) {
visitReferenceExpression(node);
processFunctionalExpression(node, getFunctionalInterfaceType(node));
markParametersReferenced(node);
return false;
}
private void markParametersReferenced(@NotNull UCallableReferenceExpression node) {
PsiElement resolved = node.resolve();
if (resolved == null) return;
RefElement refElement = refFrom.getRefManager().getReference(resolved);
if (refElement instanceof RefMethod) {
for (RefParameter parameter : ((RefMethod)refElement).getParameters()) {
refFrom.addReference(parameter, parameter.getPsiElement(), decl, false, true, node);
}
}
}
@Override
public boolean visitObjectLiteralExpression(@NotNull UObjectLiteralExpression node) {
visitReferenceExpression(node);
visitClass(node.getDeclaration());
return false;
}
@Override
public boolean visitCallExpression(@NotNull UCallExpression node) {
visitReferenceExpression(node);
if (node instanceof UObjectLiteralExpression) {
visitClass(((UObjectLiteralExpression)node).getDeclaration());
}
if (node.getKind() == UastCallKind.CONSTRUCTOR_CALL) {
PsiMethod resolvedMethod = node.resolve();
final List<UExpression> argumentList = node.getValueArguments();
RefMethod refConstructor = processNewLikeConstruct(resolvedMethod, argumentList);
if (refConstructor == null) { // No explicit constructor referenced. Should use default one.
UReferenceExpression reference = node.getClassReference();
if (reference != null) {
PsiElement constructorClass = reference.resolve();
if (constructorClass instanceof PsiClass) {
processClassReference((PsiClass)constructorClass, refFrom, decl, true, node);
}
}
}
}
try {
node.getTypeArguments().forEach(this::visitTypeRefs);
}
catch (UnsupportedOperationException e) {
//TODO happens somewhere in kotlin plugin. Please assign those exception for Dmitry Batkovich
LOG.error(e);
}
return false;
}
private void visitReferenceExpression(UExpression node) {
UElement uastParent = node.getUastParent();
if (uastParent instanceof UQualifiedReferenceExpression && ((UQualifiedReferenceExpression)uastParent).getSelector() == node) {
return;
}
PsiElement psiResolved = null;
if (node instanceof UResolvable) {
psiResolved = ((UResolvable)node).resolve();
}
else if (node instanceof UBinaryExpression) {
psiResolved = ((UBinaryExpression)node).resolveOperator();
}
else if (node instanceof UUnaryExpression) {
psiResolved = ((UUnaryExpression)node).resolveOperator();
}
if (psiResolved == null) {
psiResolved = tryFindKotlinParameter(node, decl);
}
if (psiResolved instanceof LightElement) {
psiResolved = psiResolved.getNavigationElement();
}
RefElement refResolved = refFrom.getRefManager().getReference(psiResolved);
boolean writing = isAccessedForWriting(node);
boolean reading = isAccessedForReading(node);
refFrom.addReference(refResolved, psiResolved, decl, writing, reading, node);
if (refResolved instanceof RefMethod) {
updateRefMethod(psiResolved, refResolved, node, decl, refFrom);
}
if (psiResolved instanceof PsiMember) {
//TODO support kotlin
addClassReferenceForStaticImport(node, (PsiMember)psiResolved, refFrom, decl);
}
}
@Override
public boolean visitLambdaExpression(@NotNull ULambdaExpression node) {
processFunctionalExpression(node, node.getFunctionalInterfaceType());
return false;
}
private void processFunctionalExpression(UExpression expression, PsiType type) {
PsiElement aClass = PsiUtil.resolveClassInType(type);
if (aClass != null) {
aClass = ((PsiClass)aClass).getSourceElement();
}
if (aClass != null) {
refFrom.addReference(refFrom.getRefManager().getReference(aClass), aClass, decl, false, true, null);
final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(type);
if (interfaceMethod != null) {
refFrom.addReference(refFrom.getRefManager().getReference(interfaceMethod), interfaceMethod, decl, false, true, null);
refFrom.getRefManager().fireNodeMarkedReferenced(interfaceMethod, expression.getSourcePsi());
}
}
}
@Nullable
private RefMethod processNewLikeConstruct(final PsiMethod javaConstructor, final List<UExpression> argumentList) {
if (javaConstructor == null) return null;
RefMethodImpl refConstructor = (RefMethodImpl)refFrom.getRefManager().getReference(javaConstructor.getOriginalElement());
refFrom.addReference(refConstructor, javaConstructor, decl, false, true, null);
for (UExpression arg : argumentList) {
arg.accept(this);
}
if (refConstructor != null) {
refConstructor.updateParameterValues(argumentList, javaConstructor);
}
return refConstructor;
}
@Override
public boolean visitClass(@NotNull UClass uClass) {
for (UTypeReferenceExpression type : uClass.getUastSuperTypes()) {
type.accept(this);
}
RefClassImpl refClass = (RefClassImpl)refFrom.getRefManager().getReference(uClass.getSourcePsi());
refFrom.addReference(refClass, uClass.getSourcePsi(), decl, false, true, null);
return true;
}
@Override
public boolean visitReturnExpression(@NotNull UReturnExpression node) {
if (refFrom instanceof RefMethodImpl &&
UastUtils.getParentOfType(node, UMethod.class, false, UClass.class, ULambdaExpression.class) == decl) {
RefMethodImpl refMethod = (RefMethodImpl)refFrom;
refMethod.updateReturnValueTemplate(node.getReturnExpression());
}
return false;
}
@Override
public boolean visitClassLiteralExpression(@NotNull UClassLiteralExpression node) {
final PsiType type = node.getType();
if (type instanceof PsiClassType) {
processClassReference(((PsiClassType)type).resolve(), refFrom, decl, false, node);
}
return false;
}
private void processClassReference(PsiClass psiClass,
RefJavaElementImpl refFrom,
UDeclaration from,
boolean defaultConstructorOnly,
UExpression node) {
if (psiClass != null) {
RefClassImpl refClass = ObjectUtils.tryCast(refFrom.getRefManager().getReference(psiClass.getNavigationElement()), RefClassImpl.class);
if (refClass != null) {
boolean hasConstructorsMarked = false;
if (defaultConstructorOnly) {
WritableRefElement refDefaultConstructor = (WritableRefElement)refClass.getDefaultConstructor();
if (refDefaultConstructor != null) {
refDefaultConstructor.addInReference(refFrom);
refFrom.addOutReference(refDefaultConstructor);
hasConstructorsMarked = true;
}
}
else {
for (RefMethod cons : refClass.getConstructors()) {
if (cons instanceof RefImplicitConstructor) continue;
((WritableRefElement)cons).addInReference(refFrom);
refFrom.addOutReference(cons);
hasConstructorsMarked = true;
}
UClass uClass = refClass.getUastElement();
if (uClass != null && uClass.getJavaPsi().isEnum()) {
for (RefEntity child : refClass.getChildren()) {
if (child instanceof RefField) {
UField uField = ((RefField)child).getUastElement();
if (uField instanceof UEnumConstant) {
((RefFieldImpl) child).markReferenced(refFrom, false, true, node);
refFrom.addOutReference((RefElement)child);
}
}
}
}
}
if (!hasConstructorsMarked) {
refFrom.addReference(refClass, psiClass, from, false, true, null);
}
}
}
}
}
);
}
}
private static void addClassReferenceForStaticImport(UExpression node,
PsiMember psiResolved,
RefJavaElementImpl refFrom, UDeclaration decl) {
PsiElement sourcePsi = node.getSourcePsi();
if (sourcePsi instanceof PsiReferenceExpression) {
JavaResolveResult result = ((PsiReferenceExpression)sourcePsi).advancedResolve(false);
if (result.getCurrentFileResolveScope() instanceof PsiImportStaticStatement) {
final PsiClass containingClass = psiResolved.getContainingClass();
if (containingClass != null) {
RefElement refContainingClass = refFrom.getRefManager().getReference(containingClass);
if (refContainingClass != null) {
refFrom.addReference(refContainingClass, containingClass, decl, false, true, node);
}
}
}
}
}
private static PsiElement tryFindKotlinParameter(@NotNull UExpression node,
@NotNull UDeclaration decl) {
//TODO see KT-25524
if (node instanceof UCallExpression && "invoke".equals(((UCallExpression)node).getMethodName())) {
UIdentifier identifier = ((UCallExpression)node).getMethodIdentifier();
if (identifier != null) {
String name = identifier.getName();
if (decl instanceof UMethod) {
UParameter parameter = ((UMethod)decl).getUastParameters().stream().filter(p -> name.equals(p.getName())).findAny().orElse(null);
if (parameter != null) {
return parameter.getSourcePsi();
}
}
}
}
return null;
}
private void updateRefMethod(PsiElement psiResolved,
RefElement refResolved,
UExpression refExpression,
final UElement uFrom,
final RefElement refFrom) {
UMethod uMethod = Objects.requireNonNull(UastContextKt.toUElement(psiResolved, UMethod.class));
RefMethodImpl refMethod = (RefMethodImpl)refResolved;
if (refExpression instanceof UCallableReferenceExpression) {
PsiType returnType = uMethod.getReturnType();
if (!uMethod.isConstructor() &&
!PsiType.VOID
.equals(LambdaUtil.getFunctionalInterfaceReturnType(getFunctionalInterfaceType((UCallableReferenceExpression)refExpression)))) {
refMethod.setReturnValueUsed(true);
addTypeReference(uFrom, returnType, refFrom.getRefManager());
}
refMethod.setParametersAreUnknown();
return;
}
if (refExpression instanceof ULiteralExpression) { //references in literal expressions
PsiType returnType = uMethod.getReturnType();
if (!uMethod.isConstructor() && !PsiType.VOID.equals(returnType)) {
refMethod.setReturnValueUsed(true);
addTypeReference(uFrom, returnType, refFrom.getRefManager());
}
return;
}
UCallExpression call = null;
if (refExpression instanceof UCallExpression) {
call = (UCallExpression)refExpression;
}
else if (refExpression instanceof UQualifiedReferenceExpression) {
call = ObjectUtils.tryCast(((UQualifiedReferenceExpression)refExpression).getSelector(), UCallExpression.class);
}
if (call != null) {
PsiType returnType = uMethod.getReturnType();
if (!uMethod.isConstructor() && !PsiType.VOID.equals(returnType)) {
PsiExpression expression = ObjectUtils.tryCast(call.getJavaPsi(), PsiExpression.class);
if (expression == null || !ExpressionUtils.isVoidContext(expression)) {
refMethod.setReturnValueUsed(true);
}
addTypeReference(uFrom, returnType, refFrom.getRefManager());
}
List<UExpression> argumentList = call.getValueArguments();
if (!argumentList.isEmpty()) {
refMethod.updateParameterValues(argumentList, psiResolved);
}
final UExpression uExpression = call.getReceiver();
if (uExpression != null) {
final PsiType usedType = uExpression.getExpressionType();
if (usedType != null) {
UClass containingClass = UDeclarationKt.getContainingDeclaration(uMethod, UClass.class);
final String fqName;
if (containingClass != null) {
fqName = containingClass.getQualifiedName();
if (fqName != null) {
final PsiClassType methodOwnerType = JavaPsiFacade.getElementFactory(psiResolved.getProject())
.createTypeByFQClassName(fqName, GlobalSearchScope.allScope(psiResolved.getProject()));
if (!usedType.equals(methodOwnerType)) {
refMethod.setCalledOnSubClass(true);
}
}
}
}
}
}
}
private static PsiType getFunctionalInterfaceType(UCallableReferenceExpression expression) {
PsiElement psi = expression.getSourcePsi();
if (psi instanceof PsiFunctionalExpression) {
return ((PsiFunctionalExpression)psi).getFunctionalInterfaceType();
}
return null;
}
@Override
public RefClass getTopLevelClass(@NotNull RefElement refElement) {
RefEntity refParent = refElement.getOwner();
while (refParent instanceof RefElement && !(refParent instanceof RefFile)) {
refElement = (RefElementImpl)refParent;
refParent = refParent.getOwner();
}
return refElement instanceof RefClass ? (RefClass)refElement : null;
}
@Override
public boolean isInheritor(@NotNull RefClass subClass, RefClass superClass) {
if (subClass == superClass) return true;
for (RefClass baseClass : subClass.getBaseClasses()) {
if (isInheritor(baseClass, superClass)) return true;
}
return false;
}
@Override
@Nullable
public String getPackageName(RefEntity refEntity) {
if (refEntity instanceof RefProject || refEntity instanceof RefJavaModule) {
return null;
}
RefPackage refPackage = getPackage(refEntity);
return refPackage == null ? JavaAnalysisBundle.message("inspection.reference.default.package") : refPackage.getQualifiedName();
}
@NotNull
@Override
public String getAccessModifier(@NotNull PsiModifierListOwner psiElement) {
if (psiElement instanceof PsiParameter) return PsiModifier.PACKAGE_LOCAL;
PsiModifierList list = psiElement.getModifierList();
String result = PsiModifier.PACKAGE_LOCAL;
if (list != null) {
if (list.hasModifierProperty(PsiModifier.PRIVATE)) {
result = PsiModifier.PRIVATE;
}
else if (list.hasModifierProperty(PsiModifier.PROTECTED)) {
result = PsiModifier.PROTECTED;
}
else if (list.hasModifierProperty(PsiModifier.PUBLIC)) {
result = PsiModifier.PUBLIC;
}
else if (psiElement.getParent() instanceof PsiClass) {
PsiClass ownerClass = (PsiClass)psiElement.getParent();
if (ownerClass.isInterface()) {
result = PsiModifier.PUBLIC;
}
}
}
return result;
}
@Override
@Nullable
public RefClass getOwnerClass(RefManager refManager, UElement uElement) {
while (uElement != null && !(uElement instanceof UClass)) {
uElement = uElement.getUastParent();
}
return uElement != null ? (RefClass)refManager.getReference(uElement.getSourcePsi()) : null;
}
@Override
@Nullable
public RefClass getOwnerClass(RefElement refElement) {
RefEntity parent = refElement.getOwner();
while (!(parent instanceof RefClass) && parent instanceof RefElement) {
parent = parent.getOwner();
}
if (parent instanceof RefClass) return (RefClass)parent;
return null;
}
@Override
public boolean isMethodOnlyCallsSuper(UMethod method) {
PsiMethod javaMethod = method.getJavaPsi();
boolean hasStatements = false;
UExpression body = method.getUastBody();
if (body != null) {
List<UExpression> statements =
body instanceof UBlockExpression ? ((UBlockExpression)body).getExpressions() : Collections.singletonList(body);
if (statements.size() > 1) return false;
for (UExpression expression : statements) {
boolean isCallToSameSuper = false;
if (expression instanceof UReturnExpression) {
UExpression returnExpr = ((UReturnExpression)expression).getReturnExpression();
isCallToSameSuper = returnExpr == null || isCallToSuperMethod(returnExpr, method);
}
else if (!(expression instanceof UBlockExpression)) {
isCallToSameSuper = isCallToSuperMethod(expression, method);
}
hasStatements = true;
if (isCallToSameSuper) continue;
return false;
}
}
if (hasStatements) {
final PsiMethod[] superMethods = javaMethod.findSuperMethods();
for (PsiMethod superMethod : superMethods) {
if (VisibilityUtil.compare(VisibilityUtil.getVisibilityModifier(superMethod.getModifierList()),
VisibilityUtil.getVisibilityModifier(javaMethod.getModifierList())) > 0) {
return false;
}
}
PsiClass aClass = javaMethod.getContainingClass();
if (aClass == null ||
GenericsHighlightUtil.getUnrelatedDefaultsMessage(aClass, Arrays.asList(superMethods), true) != null) {
return false;
}
}
return hasStatements;
}
@Override
public boolean isCallToSuperMethod(UExpression expression, UMethod method) {
if (expression instanceof UQualifiedReferenceExpression) {
UExpression receiver = ((UQualifiedReferenceExpression)expression).getReceiver();
UExpression selector = ((UQualifiedReferenceExpression)expression).getSelector();
if (receiver instanceof USuperExpression && selector instanceof UCallExpression) {
PsiMethod superMethod = ((UCallExpression)selector).resolve();
if (superMethod == null || !MethodSignatureUtil.areSignaturesEqual(method.getJavaPsi(), superMethod)) return false;
List<UExpression> args = ((UCallExpression)selector).getValueArguments();
List<UParameter> params = method.getUastParameters();
for (int i = 0; i < args.size(); i++) {
UExpression arg = args.get(i);
if (!(arg instanceof USimpleNameReferenceExpression)) return false;
if (!params.get(i).equals(((USimpleNameReferenceExpression)arg).resolve())) return false;
}
return true;
}
}
return false;
}
@Override
public int compareAccess(String a1, String a2) {
return Integer.compare(getAccessNumber(a1), getAccessNumber(a2));
}
@SuppressWarnings("StringEquality")
private static int getAccessNumber(String a) {
if (a == PsiModifier.PRIVATE) {
return 0;
}
if (a == PsiModifier.PACKAGE_LOCAL) {
return 1;
}
if (a == PsiModifier.PROTECTED) {
return 2;
}
if (a == PsiModifier.PUBLIC) return 3;
return -1;
}
@Override
public void setAccessModifier(@NotNull RefJavaElement refElement, @NotNull String newAccess) {
((RefJavaElementImpl)refElement).setAccessModifier(newAccess);
}
@Override
public void setIsStatic(RefJavaElement refElement, boolean isStatic) {
((RefJavaElementImpl)refElement).setIsStatic(isStatic);
}
@Override
public void setIsFinal(RefJavaElement refElement, boolean isFinal) {
((RefJavaElementImpl)refElement).setIsFinal(isFinal);
}
@Override
public void addTypeReference(UElement uElement, PsiType psiType, RefManager refManager) {
addTypeReference(uElement, psiType, refManager, null);
}
@Override
public void addTypeReference(UElement uElement, PsiType psiType, RefManager refManager, @Nullable RefJavaElement refMethod) {
if (psiType != null) {
final RefClass ownerClass = getOwnerClass(refManager, uElement);
if (ownerClass != null) {
psiType = psiType.getDeepComponentType();
if (psiType instanceof PsiClassType) {
PsiClass psiClass = PsiUtil.resolveClassInType(psiType);
if (psiClass != null && refManager.belongsToScope(psiClass)) {
RefClassImpl refClass = (RefClassImpl)refManager.getReference(psiClass);
if (refClass != null) {
refClass.addTypeReference(ownerClass);
if (refMethod != null) {
refClass.addClassExporter(refMethod);
}
}
}
else {
((RefManagerImpl)refManager).fireNodeMarkedReferenced(psiClass, uElement.getSourcePsi());
}
}
}
}
}
private static boolean isAccessedForWriting(@NotNull UElement expression) {
if (isOnAssignmentLeftHand(expression)) return true;
UElement parent = skipParenthesises(expression);
return isIncrementDecrement(parent);
}
private static boolean isIncrementDecrement(UElement element) {
if (!(element instanceof UUnaryExpression)) return false;
UastOperator operator = ((UUnaryExpression)element).getOperator();
return operator == UastPostfixOperator.DEC
|| operator == UastPostfixOperator.INC
|| operator == UastPrefixOperator.DEC
|| operator == UastPrefixOperator.INC;
}
private static boolean isAccessedForReading(@NotNull UElement expression) {
UElement parent = skipParenthesises(expression);
return !(parent instanceof UBinaryExpression) ||
!(((UBinaryExpression)parent).getOperator() instanceof UastBinaryOperator.AssignOperator) ||
UastUtils.isUastChildOf(((UBinaryExpression)parent).getRightOperand(), expression, false);
}
private static boolean isOnAssignmentLeftHand(@NotNull UElement expression) {
UExpression parent = ObjectUtils.tryCast(skipParenthesises(expression), UExpression.class);
if (parent == null) return false;
return parent instanceof UBinaryExpression
&& ((UBinaryExpression)parent).getOperator() instanceof UastBinaryOperator.AssignOperator
&& UastUtils.isUastChildOf(expression, ((UBinaryExpression)parent).getLeftOperand(), false);
}
private static UElement skipParenthesises(@NotNull UElement expression) {
return UastUtils.skipParentOfType(expression, true, UParenthesizedExpression.class);
}
}
| [
"luckystar5408@github.com"
] | luckystar5408@github.com |
274594ec5757a7642b155c304ab5dbac833106a4 | ddb65176a2908f2d35e9740f49b5c5cf91014a31 | /src/main/java/br/berdugo/vpsa/pojo/registro/RegistroArduinoPojo.java | 060b30285e88d03148b64db8f522457afe16c7be | [] | no_license | gberdugo/VPSA-Ponto-Server | f41de13010ca8a12b0c35933218eb06385dde3d1 | 670012aa5b95bd8e073d88fad268b4093c1b3016 | refs/heads/master | 2020-05-16T22:18:55.152341 | 2013-11-18T23:18:53 | 2013-11-18T23:18:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,039 | java | package br.berdugo.vpsa.pojo.registro;
public class RegistroArduinoPojo {
private String nroRfid;
private Integer ano;
private Integer mes;
private Integer dia;
private Integer hora;
private Integer minuto;
private Integer segundo;
public String getNroRfid() {
return nroRfid;
}
public void setNroRfid(String nroRfid) {
this.nroRfid = nroRfid;
}
public Integer getAno() {
return ano;
}
public void setAno(Integer ano) {
this.ano = ano;
}
public Integer getMes() {
return mes;
}
public void setMes(Integer mes) {
this.mes = mes;
}
public Integer getDia() {
return dia;
}
public void setDia(Integer dia) {
this.dia = dia;
}
public Integer getHora() {
return hora;
}
public void setHora(Integer hora) {
this.hora = hora;
}
public Integer getMinuto() {
return minuto;
}
public void setMinuto(Integer minuto) {
this.minuto = minuto;
}
public Integer getSegundo() {
return segundo;
}
public void setSegundo(Integer segundo) {
this.segundo = segundo;
}
}
| [
"gberdugo@gmail.com"
] | gberdugo@gmail.com |
f90ddebef0a494abebcfeab9d4a1cdb725102f3e | 3567c6fcf6c8a4dd167dd6145f43c636de9edd6f | /java/org/apache/tomcat/util/http/fileupload/RequestContext.java | 763d55e2da2c84e95706e82c1ddc4de9196e635c | [
"Apache-2.0",
"bzip2-1.0.6",
"Zlib",
"CPL-1.0",
"EPL-1.0",
"LZMA-exception",
"LicenseRef-scancode-unknown-license-reference",
"CDDL-1.0"
] | permissive | 0cmg/tomcat | e5f1186f93a3e252a6adc392060713da7a90bcc8 | ca606da5d138260ce8fc7937ba2f0c3e4b055816 | refs/heads/trunk | 2021-12-14T04:24:30.666484 | 2021-11-16T02:05:54 | 2021-11-16T02:05:54 | 83,262,556 | 1 | 0 | Apache-2.0 | 2021-11-16T02:05:55 | 2017-02-27T03:05:28 | Java | UTF-8 | Java | false | false | 1,766 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.tomcat.util.http.fileupload;
import java.io.IOException;
import java.io.InputStream;
/**
* <p>Abstracts access to the request information needed for file uploads. This
* interface should be implemented for each type of request that may be
* handled by FileUpload, such as servlets and portlets.</p>
*
* @since FileUpload 1.1
*
* @version $Id$
*/
public interface RequestContext {
/**
* Retrieve the character encoding for the request.
*
* @return The character encoding for the request.
*/
String getCharacterEncoding();
/**
* Retrieve the content type of the request.
*
* @return The content type of the request.
*/
String getContentType();
/**
* Retrieve the input stream for the request.
*
* @return The input stream for the request.
*
* @throws IOException if a problem occurs.
*/
InputStream getInputStream() throws IOException;
}
| [
"markt@apache.org"
] | markt@apache.org |
6d95e9e2131acc7cefb7adbe8c264c2638b40fbf | 319531f0ef01900b83d106d53cb4e9502e33f355 | /openjpa-kernel/src/main/java/org/apache/openjpa/kernel/OpCallbacks.java | 12fcaff9d1b4c70e649699133cc197146547650a | [
"Apache-2.0",
"CDDL-1.0",
"LicenseRef-scancode-oracle-openjdk-exception-2.0",
"GPL-2.0-only"
] | permissive | wso2/wso2-openjpa | 798822ee319590eed5a00ae21b65b6977faf162d | 9c3801c861d1a0c9d93a9fa5cfa0cbe749114b92 | refs/heads/master | 2023-08-14T23:55:26.907881 | 2022-04-05T09:32:59 | 2022-04-05T09:32:59 | 97,706,188 | 35 | 16 | Apache-2.0 | 2022-04-05T09:33:00 | 2017-07-19T10:56:02 | Java | UTF-8 | Java | false | false | 2,067 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.openjpa.kernel;
/**
* Allows facades to control the particulars of persistence operations
* through callbacks.
*
* @author Abe White
*/
public interface OpCallbacks {
public static final int OP_PERSIST = 0;
public static final int OP_DELETE = 1;
public static final int OP_REFRESH = 2;
public static final int OP_RETRIEVE = 3;
public static final int OP_RELEASE = 4;
public static final int OP_EVICT = 5;
public static final int OP_ATTACH = 6;
public static final int OP_DETACH = 7;
public static final int OP_NONTRANSACTIONAL = 8;
public static final int OP_TRANSACTIONAL = 9;
public static final int OP_LOCK = 10;
public static final int ACT_NONE = 0;
public static final int ACT_CASCADE = 2 << 0;
public static final int ACT_RUN = 2 << 1;
/**
* Process operation argument. Throw proper
* {@link org.apache.openjpa.util.OpenJPAException} for illegal value.
*
* @param op the operation constant
* @param arg the object passed to the operation
* @param sm the argument's state manager, or null if none
* @return the action to take on the argument
*/
public int processArgument(int op, Object arg, OpenJPAStateManager sm);
}
| [
"nandika@wso2.com"
] | nandika@wso2.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.