blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 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
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c2908a225be913762275540d8a037eca487fc296 | c493bcdd26cc9ef662663ea8a76d3ea8d52fc420 | /agent/src/main/java/fi/trustnet/agent/configuration/SecurityConfiguration.java | 58e19c9eb9cba87bea2fdbe22e3c3b2d4fb32a49 | [] | no_license | peacekeeper/authcred-demo | cf09728bcf323325fefce1b6665058718c1afdf6 | f39478427d7e81d0112638d0bccf63be37b32e1f | refs/heads/master | 2020-03-09T18:41:05.136143 | 2018-04-04T12:07:12 | 2018-04-04T12:07:12 | 128,938,134 | 2 | 0 | null | 2018-04-10T13:35:02 | 2018-04-10T13:35:01 | null | UTF-8 | Java | false | false | 1,618 | java | package fi.trustnet.agent.configuration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
@Configuration
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter{
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
http.headers().frameOptions().sameOrigin();
http.authorizeRequests()
.antMatchers(HttpMethod.POST, "/credentialoffer").permitAll()
.antMatchers("/h2-console/*").permitAll()
.anyRequest().authenticated().and()
.formLogin().permitAll().and()
.logout().permitAll().and()
.rememberMe()
.rememberMeCookieName("agent-remember-me")
.tokenValiditySeconds(24 * 60 * 60);
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication()
.withUser("alice").password("password").roles("USER");
}
}
| [
"[email protected]"
] | |
bc5503c1dfd2bc6fa91177fbd0aa6841e87efc39 | 5efbe1ce4035df0d4a7aa478ac37fa75aa68025c | /reference no run/com.martinstudio.hiddenrecorder/src/android/support/v4/widget/AutoScrollHelper.java | 0494b3bfd41f1525dd7f224de9c1720582f0a7bc | [] | no_license | dat0106/datkts0106 | 6ec70e6adb90ba36237d4225b5cba80fcbd30343 | 885c9bec5b5cd3c4d677d8d579cd91cf7fd6d2e5 | refs/heads/master | 2016-08-05T08:24:11.701355 | 2014-08-01T04:35:12 | 2014-08-01T04:35:59 | 15,329,353 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 15,503 | java | package android.support.v4.widget;
import android.content.res.Resources;
import android.os.SystemClock;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewCompat;
import android.util.DisplayMetrics;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.ViewConfiguration;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
public abstract class AutoScrollHelper
implements View.OnTouchListener
{
private static final int DEFAULT_ACTIVATION_DELAY = ;
private static final int DEFAULT_EDGE_TYPE = 1;
private static final float DEFAULT_MAXIMUM_EDGE = 3.4028235E+38F;
private static final int DEFAULT_MAXIMUM_VELOCITY_DIPS = 1575;
private static final int DEFAULT_MINIMUM_VELOCITY_DIPS = 315;
private static final int DEFAULT_RAMP_DOWN_DURATION = 500;
private static final int DEFAULT_RAMP_UP_DURATION = 500;
private static final float DEFAULT_RELATIVE_EDGE = 0.2F;
private static final float DEFAULT_RELATIVE_VELOCITY = 1.0F;
public static final int EDGE_TYPE_INSIDE = 0;
public static final int EDGE_TYPE_INSIDE_EXTEND = 1;
public static final int EDGE_TYPE_OUTSIDE = 2;
private static final int HORIZONTAL = 0;
public static final float NO_MAX = 3.4028235E+38F;
public static final float NO_MIN = 0.0F;
public static final float RELATIVE_UNSPECIFIED = 0.0F;
private static final int VERTICAL = 1;
private int mActivationDelay;
private boolean mAlreadyDelayed;
private boolean mAnimating;
private final Interpolator mEdgeInterpolator = new AccelerateInterpolator();
private int mEdgeType;
private boolean mEnabled;
private boolean mExclusive;
private float[] mMaximumEdges;
private float[] mMaximumVelocity;
private float[] mMinimumVelocity;
private boolean mNeedsCancel;
private boolean mNeedsReset;
private float[] mRelativeEdges;
private float[] mRelativeVelocity;
private Runnable mRunnable;
private final ClampedScroller mScroller = new ClampedScroller();
private final View mTarget;
public AutoScrollHelper(View paramView)
{
float[] arrayOfFloat = new float[2];
arrayOfFloat[0] = 0.0F;
arrayOfFloat[1] = 0.0F;
this.mRelativeEdges = arrayOfFloat;
arrayOfFloat = new float[2];
arrayOfFloat[0] = 3.4028235E+38F;
arrayOfFloat[1] = 3.4028235E+38F;
this.mMaximumEdges = arrayOfFloat;
arrayOfFloat = new float[2];
arrayOfFloat[0] = 0.0F;
arrayOfFloat[1] = 0.0F;
this.mRelativeVelocity = arrayOfFloat;
arrayOfFloat = new float[2];
arrayOfFloat[0] = 0.0F;
arrayOfFloat[1] = 0.0F;
this.mMinimumVelocity = arrayOfFloat;
arrayOfFloat = new float[2];
arrayOfFloat[0] = 3.4028235E+38F;
arrayOfFloat[1] = 3.4028235E+38F;
this.mMaximumVelocity = arrayOfFloat;
this.mTarget = paramView;
DisplayMetrics localDisplayMetrics = Resources.getSystem().getDisplayMetrics();
int i = (int)(0.5F + 1575.0F * localDisplayMetrics.density);
int j = (int)(0.5F + 315.0F * localDisplayMetrics.density);
setMaximumVelocity(i, i);
setMinimumVelocity(j, j);
setEdgeType(1);
setMaximumEdges(3.4028235E+38F, 3.4028235E+38F);
setRelativeEdges(0.2F, 0.2F);
setRelativeVelocity(1.0F, 1.0F);
setActivationDelay(DEFAULT_ACTIVATION_DELAY);
setRampUpDuration(500);
setRampDownDuration(500);
}
private void cancelTargetTouch()
{
long l = SystemClock.uptimeMillis();
MotionEvent localMotionEvent = MotionEvent.obtain(l, l, 3, 0.0F, 0.0F, 0);
this.mTarget.onTouchEvent(localMotionEvent);
localMotionEvent.recycle();
}
private float computeTargetVelocity(int paramInt, float paramFloat1, float paramFloat2, float paramFloat3)
{
float f2 = 0.0F;
float f1 = getEdgeValue(this.mRelativeEdges[paramInt], paramFloat2, this.mMaximumEdges[paramInt], paramFloat1);
if (f1 != 0.0F)
{
float f4 = this.mRelativeVelocity[paramInt];
float f3 = this.mMinimumVelocity[paramInt];
f2 = this.mMaximumVelocity[paramInt];
f4 *= paramFloat3;
if (f1 <= 0.0F) {
f2 = -constrain(f4 * -f1, f3, f2);
} else {
f2 = constrain(f1 * f4, f3, f2);
}
}
return f2;
}
private static float constrain(float paramFloat1, float paramFloat2, float paramFloat3)
{
if (paramFloat1 <= paramFloat3) {
if (paramFloat1 >= paramFloat2) {
paramFloat3 = paramFloat1;
} else {
paramFloat3 = paramFloat2;
}
}
return paramFloat3;
}
private static int constrain(int paramInt1, int paramInt2, int paramInt3)
{
if (paramInt1 <= paramInt3) {
if (paramInt1 >= paramInt2) {
paramInt3 = paramInt1;
} else {
paramInt3 = paramInt2;
}
}
return paramInt3;
}
private float constrainEdgeValue(float paramFloat1, float paramFloat2)
{
float f = 0.0F;
if (paramFloat2 != 0.0F) {
switch (this.mEdgeType)
{
default:
break;
case 0:
case 1:
if (paramFloat1 < paramFloat2) {
if (paramFloat1 < 0.0F)
{
if ((this.mAnimating) && (this.mEdgeType == 1)) {
f = 1.0F;
}
}
else {
f = 1.0F - paramFloat1 / paramFloat2;
}
}
break;
case 2:
if (paramFloat1 < 0.0F) {
f = paramFloat1 / -paramFloat2;
}
break;
}
}
return f;
}
private float getEdgeValue(float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4)
{
float f1 = 0.0F;
float f3 = constrain(paramFloat1 * paramFloat2, 0.0F, paramFloat3);
float f2 = constrainEdgeValue(paramFloat4, f3);
f2 = constrainEdgeValue(paramFloat2 - paramFloat4, f3) - f2;
if (f2 >= 0.0F)
{
if (f2 <= 0.0F) {
break label98;
}
f1 = this.mEdgeInterpolator.getInterpolation(f2);
}
else
{
f1 = -this.mEdgeInterpolator.getInterpolation(-f2);
}
f1 = constrain(f1, -1.0F, 1.0F);
label98:
return f1;
}
private void requestStop()
{
if (!this.mNeedsReset) {
this.mScroller.requestStop();
} else {
this.mAnimating = false;
}
}
private boolean shouldAnimate()
{
ClampedScroller localClampedScroller = this.mScroller;
int i = localClampedScroller.getVerticalDirection();
int j = localClampedScroller.getHorizontalDirection();
if (((i == 0) || (!canTargetScrollVertically(i))) && ((j == 0) || (!canTargetScrollHorizontally(j)))) {
i = 0;
} else {
i = 1;
}
return i;
}
private void startAnimating()
{
if (this.mRunnable == null) {
this.mRunnable = new ScrollAnimationRunnable(null);
}
this.mAnimating = true;
this.mNeedsReset = true;
if ((this.mAlreadyDelayed) || (this.mActivationDelay <= 0)) {
this.mRunnable.run();
} else {
ViewCompat.postOnAnimationDelayed(this.mTarget, this.mRunnable, this.mActivationDelay);
}
this.mAlreadyDelayed = true;
}
public abstract boolean canTargetScrollHorizontally(int paramInt);
public abstract boolean canTargetScrollVertically(int paramInt);
public boolean isEnabled()
{
return this.mEnabled;
}
public boolean isExclusive()
{
return this.mExclusive;
}
public boolean onTouch(View paramView, MotionEvent paramMotionEvent)
{
float f1 = 1;
int i = 0;
float f2;
if (this.mEnabled)
{
switch (MotionEventCompat.getActionMasked(paramMotionEvent))
{
case 0:
this.mNeedsCancel = f1;
this.mAlreadyDelayed = false;
case 2:
float f3 = computeTargetVelocity(0, paramMotionEvent.getX(), paramView.getWidth(), this.mTarget.getWidth());
f2 = computeTargetVelocity(f1, paramMotionEvent.getY(), paramView.getHeight(), this.mTarget.getHeight());
this.mScroller.setTargetVelocity(f3, f2);
if ((!this.mAnimating) && (shouldAnimate())) {
startAnimating();
}
break;
case 1:
case 3:
requestStop();
}
if ((!this.mExclusive) || (!this.mAnimating)) {
f1 = 0;
}
f2 = f1;
}
return f2;
}
public abstract void scrollTargetBy(int paramInt1, int paramInt2);
public AutoScrollHelper setActivationDelay(int paramInt)
{
this.mActivationDelay = paramInt;
return this;
}
public AutoScrollHelper setEdgeType(int paramInt)
{
this.mEdgeType = paramInt;
return this;
}
public AutoScrollHelper setEnabled(boolean paramBoolean)
{
if ((this.mEnabled) && (!paramBoolean)) {
requestStop();
}
this.mEnabled = paramBoolean;
return this;
}
public AutoScrollHelper setExclusive(boolean paramBoolean)
{
this.mExclusive = paramBoolean;
return this;
}
public AutoScrollHelper setMaximumEdges(float paramFloat1, float paramFloat2)
{
this.mMaximumEdges[0] = paramFloat1;
this.mMaximumEdges[1] = paramFloat2;
return this;
}
public AutoScrollHelper setMaximumVelocity(float paramFloat1, float paramFloat2)
{
this.mMaximumVelocity[0] = (paramFloat1 / 1000.0F);
this.mMaximumVelocity[1] = (paramFloat2 / 1000.0F);
return this;
}
public AutoScrollHelper setMinimumVelocity(float paramFloat1, float paramFloat2)
{
this.mMinimumVelocity[0] = (paramFloat1 / 1000.0F);
this.mMinimumVelocity[1] = (paramFloat2 / 1000.0F);
return this;
}
public AutoScrollHelper setRampDownDuration(int paramInt)
{
this.mScroller.setRampDownDuration(paramInt);
return this;
}
public AutoScrollHelper setRampUpDuration(int paramInt)
{
this.mScroller.setRampUpDuration(paramInt);
return this;
}
public AutoScrollHelper setRelativeEdges(float paramFloat1, float paramFloat2)
{
this.mRelativeEdges[0] = paramFloat1;
this.mRelativeEdges[1] = paramFloat2;
return this;
}
public AutoScrollHelper setRelativeVelocity(float paramFloat1, float paramFloat2)
{
this.mRelativeVelocity[0] = (paramFloat1 / 1000.0F);
this.mRelativeVelocity[1] = (paramFloat2 / 1000.0F);
return this;
}
private static class ClampedScroller
{
private long mDeltaTime = 0L;
private int mDeltaX = 0;
private int mDeltaY = 0;
private int mEffectiveRampDown;
private int mRampDownDuration;
private int mRampUpDuration;
private long mStartTime = -9223372036854775808L;
private long mStopTime = -1L;
private float mStopValue;
private float mTargetVelocityX;
private float mTargetVelocityY;
private float getValueAt(long paramLong)
{
float f1 = 0.0F;
float f2;
if (paramLong >= this.mStartTime) {
if ((this.mStopTime >= 0L) && (paramLong >= this.mStopTime))
{
long l = paramLong - this.mStopTime;
f2 = 1.0F - this.mStopValue + this.mStopValue * AutoScrollHelper.constrain((float)l / this.mEffectiveRampDown, 0.0F, 1.0F);
}
else
{
f2 = 0.5F * AutoScrollHelper.constrain((float)(paramLong - this.mStartTime) / this.mRampUpDuration, 0.0F, 1.0F);
}
}
return f2;
}
private float interpolateValue(float paramFloat)
{
return paramFloat * (-4.0F * paramFloat) + 4.0F * paramFloat;
}
public void computeScrollDelta()
{
if (this.mDeltaTime != 0L)
{
long l1 = AnimationUtils.currentAnimationTimeMillis();
float f = interpolateValue(getValueAt(l1));
long l2 = l1 - this.mDeltaTime;
this.mDeltaTime = l1;
this.mDeltaX = ((int)(f * (float)l2 * this.mTargetVelocityX));
this.mDeltaY = ((int)(f * (float)l2 * this.mTargetVelocityY));
return;
}
throw new RuntimeException("Cannot compute scroll delta before calling start()");
}
public int getDeltaX()
{
return this.mDeltaX;
}
public int getDeltaY()
{
return this.mDeltaY;
}
public int getHorizontalDirection()
{
return (int)(this.mTargetVelocityX / Math.abs(this.mTargetVelocityX));
}
public int getVerticalDirection()
{
return (int)(this.mTargetVelocityY / Math.abs(this.mTargetVelocityY));
}
public boolean isFinished()
{
boolean bool;
if ((this.mStopTime <= 0L) || (AnimationUtils.currentAnimationTimeMillis() <= this.mStopTime + this.mEffectiveRampDown)) {
bool = false;
} else {
bool = true;
}
return bool;
}
public void requestStop()
{
long l = AnimationUtils.currentAnimationTimeMillis();
this.mEffectiveRampDown = AutoScrollHelper.constrain((int)(l - this.mStartTime), 0, this.mRampDownDuration);
this.mStopValue = getValueAt(l);
this.mStopTime = l;
}
public void setRampDownDuration(int paramInt)
{
this.mRampDownDuration = paramInt;
}
public void setRampUpDuration(int paramInt)
{
this.mRampUpDuration = paramInt;
}
public void setTargetVelocity(float paramFloat1, float paramFloat2)
{
this.mTargetVelocityX = paramFloat1;
this.mTargetVelocityY = paramFloat2;
}
public void start()
{
this.mStartTime = AnimationUtils.currentAnimationTimeMillis();
this.mStopTime = -1L;
this.mDeltaTime = this.mStartTime;
this.mStopValue = 0.5F;
this.mDeltaX = 0;
this.mDeltaY = 0;
}
}
private class ScrollAnimationRunnable
implements Runnable
{
private ScrollAnimationRunnable() {}
public void run()
{
if (AutoScrollHelper.this.mAnimating)
{
if (AutoScrollHelper.this.mNeedsReset)
{
AutoScrollHelper.access$202(AutoScrollHelper.this, false);
AutoScrollHelper.this.mScroller.start();
}
AutoScrollHelper.ClampedScroller localClampedScroller = AutoScrollHelper.this.mScroller;
if ((!localClampedScroller.isFinished()) && (AutoScrollHelper.this.shouldAnimate()))
{
if (AutoScrollHelper.this.mNeedsCancel)
{
AutoScrollHelper.access$502(AutoScrollHelper.this, false);
AutoScrollHelper.this.cancelTargetTouch();
}
localClampedScroller.computeScrollDelta();
int i = localClampedScroller.getDeltaX();
int j = localClampedScroller.getDeltaY();
AutoScrollHelper.this.scrollTargetBy(i, j);
ViewCompat.postOnAnimation(AutoScrollHelper.this.mTarget, this);
}
else
{
AutoScrollHelper.access$102(AutoScrollHelper.this, false);
}
}
}
}
}
/* Location: E:\android\Androidvn\dex2jar\classes_dex2jar.jar
* Qualified Name: android.support.v4.widget.AutoScrollHelper
* JD-Core Version: 0.7.0.1
*/ | [
"[email protected]"
] | |
ad0ddfe22ca4171f4dae2096335cc299eec9ab74 | a2b90ccccbeeee2b67f9061a6e8941ba63a0e75a | /src/main/java/adrspo/design/patterns/behavioral/chainofresponsibility/DepartmentChain.java | 30622f1d5d5611b77ec10dc265fe469a6322155a | [] | no_license | adrspo95/GoF-OOP-Design-Patterns | 653f2704b5ed4b97e944612feb8ff8538a8dedab | 23fa9112c09847f5a59905280f2a4e8fe2bac781 | refs/heads/master | 2020-12-02T17:56:45.779490 | 2017-07-06T22:06:31 | 2017-07-06T22:06:31 | 96,452,157 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 297 | java | package adrspo.design.patterns.behavioral.chainofresponsibility;
public abstract class DepartmentChain {
protected DepartmentChain nextDepartment;
public void setNext(DepartmentChain dept) {
nextDepartment = dept;
}
public abstract boolean redirect(ClientCall call);
}
| [
"[email protected]"
] | |
9e7a94f4c5468c5cbdc2a1a05617c1a47fd6b77b | 76fbf9e1ad9b9ac4cd01914e2d2dfd2d76e0d580 | /app/src/main/java/com/houseco/hana/rentcostumes/ExpandMain.java | 2220671a72411b05eff03463f37fa925cf11f3f2 | [] | no_license | maulindahn/HouseCo2-master | d1314af3fa0850bbb814089f46ba275fc80f4700 | f4e9902898c05f41f5c0c7c4451c06e492eeb7da | refs/heads/master | 2021-01-13T03:50:13.810157 | 2017-05-10T10:35:44 | 2017-05-10T10:35:44 | 78,615,502 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,799 | java | package com.houseco.hana.rentcostumes;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ExpandableListAdapter;
import android.widget.ExpandableListView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* Created by Annisa on 12/17/2016.
*/
//ANNISA NURSYA'S
public class ExpandMain extends AppCompatActivity {
ExpandableListView expandableListView;
ExpandableListAdapter expandableListAdapter;
List<String> expandableListTitle;
HashMap<String, List<String>> expandableListDetail;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.expand_activitymain);
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
expandableListDetail = ExpandableListDataPump.getData();
expandableListTitle = new ArrayList<String>(expandableListDetail.keySet());
expandableListAdapter = new CustomExpandableListAdapter(this, expandableListTitle, expandableListDetail);
expandableListView.setAdapter(expandableListAdapter);
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
@Override
public void onGroupExpand(int groupPosition) {
Toast.makeText(getApplicationContext(),
expandableListTitle.get(groupPosition) + " List Expanded.",
Toast.LENGTH_SHORT).show();
}
});
expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
@Override
public void onGroupCollapse(int groupPosition) {
Toast.makeText(getApplicationContext(),
expandableListTitle.get(groupPosition) + " List Collapsed.",
Toast.LENGTH_SHORT).show();
}
});
expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
Toast.makeText(
getApplicationContext(),
expandableListTitle.get(groupPosition)
+ " -> "
+ expandableListDetail.get(
expandableListTitle.get(groupPosition)).get(
childPosition), Toast.LENGTH_SHORT
).show();
return false;
}
});
}
}
| [
"[email protected]"
] | |
36a83db80599d2e0b68dbcde73d76b5aa4951a57 | fc7c1e3e88775217e89245c31e7a333e4c75c38f | /water-java-core/src/main/java/jp/gr/java_conf/kgd/library/water/java/core/value/IntColor3Trait.java | 948ab31f1f1224384ba6e2fef01f15d7c04c36ee | [
"MIT"
] | permissive | t-kgd/library-water | a76bbee205802bd25fd27404cc58e3c6f26d51fc | e19822eb5d7a0414d1056852ea3ae90e1e24467b | refs/heads/master | 2016-09-11T02:58:39.515546 | 2015-07-09T08:01:38 | 2015-07-09T08:01:38 | 38,787,571 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,552 | java | /*
* The MIT License
*
* Copyright 2015 misakura.
*
* 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 jp.gr.java_conf.kgd.library.water.java.core.value;
/**
* 値の型を{@link Integer}に特化し、デフォルトの挙動を定めた{@link IntColor3}。
*
* デフォルトの挙動を定めたものであり、原則としてインターフェース部分に使ってはいけません。
*
* @author misakura
*/
public interface IntColor3Trait extends ObjectColor3<Integer>, NumberColor3 {
/**
* この色の赤成分にあたる値を返す。
*
* デフォルトの実装では、{@link #getRedAsInt()}に委譲し、得られた値を静的キャストして返します。
*
* @return {@inheritDoc}
*/
@Override
default long getRedAsLong() {
return (long) getRedAsInt();
}
/**
* この色の緑成分にあたる値を返す。
*
* デフォルトの実装では、{@link #getGreenAsInt()}に委譲し、得られた値を静的キャストして返します。
*
* @return {@inheritDoc}
*/
@Override
default long getGreenAsLong() {
return (long) getGreenAsInt();
}
/**
* この色の青成分にあたる値を返す。
*
* デフォルトの実装では、{@link #getBlueAsInt()}に委譲し、得られた値を静的キャストして返します。
*
* @return {@inheritDoc}
*/
@Override
default long getBlueAsLong() {
return (long) getBlueAsInt();
}
/**
* この色の赤成分にあたる値を返す。
*
* デフォルトの実装では、{@link #getRedAsInt()}に委譲し、得られた値を静的キャストして返します。
*
* @return {@inheritDoc}
*/
@Override
default double getRedAsDouble() {
return (double) getRedAsInt();
}
/**
* この色の緑成分にあたる値を返す。
*
* デフォルトの実装では、{@link #getGreenAsInt()}に委譲し、得られた値を静的キャストして返します。
*
* @return {@inheritDoc}
*/
@Override
default double getGreenAsDouble() {
return (double) getGreenAsInt();
}
/**
* この色の青成分にあたる値を返す。
*
* デフォルトの実装では、{@link #getBlueAsInt()}に委譲し、得られた値を静的キャストして返します。
*
* @return {@inheritDoc}
*/
@Override
default double getBlueAsDouble() {
return (double) getBlueAsInt();
}
/**
* この色の赤成分にあたる値を返す。
*
* 得られる値が防御的にコピーされたものであるかどうかは実装依存です。<br>
* デフォルトの実装では、{@link #getRedAsInt()}に委譲し、得られた値をボックス化して返します。(つまり、防御的コピーを行います。)
*
* @return {@inheritDoc}
* @deprecated このインターフェースを直接操作する場合は{@link #getRedAsInt()}を使うべきです。
*/
@Deprecated
@Override
default Integer getRed() {
return getRedAsInt();
}
/**
* この色の緑成分にあたる値を返す。
*
* 得られる値が防御的にコピーされたものであるかどうかは実装依存です。<br>
* デフォルトの実装では、{@link #getGreenAsInt()}に委譲し、得られた値をボックス化して返します。(つまり、防御的コピーを行います。)
*
* @return {@inheritDoc}
* @deprecated このインターフェースを直接操作する場合は{@link #getGreenAsInt()}を使うべきです。
*/
@Deprecated
@Override
default Integer getGreen() {
return getGreenAsInt();
}
/**
* この色の青成分にあたる値を返す。
*
* 得られる値が防御的にコピーされたものであるかどうかは実装依存です。<br>
* デフォルトの実装では、{@link #getBlueAsInt()}に委譲し、得られた値をボックス化して返します。(つまり、防御的コピーを行います。)
*
* @return {@inheritDoc}
* @deprecated このインターフェースを直接操作する場合は{@link #getBlueAsInt()}を使うべきです。
*/
@Deprecated
@Override
default Integer getBlue() {
return getBlueAsInt();
}
}
| [
"[email protected]"
] | |
444429b2877952a29cfe4f70211ea7c1a1df716d | a36404f342345d009c8447d262459b8be1e6aa0c | /app/src/main/java/com/example/gyt/data/MyDBHelper.java | 7e336ff43819f7b8233a268aaccf77172c4f4f84 | [] | no_license | zhenghonghai/yourNameApp | fffaa11c29365ad3d608e72f7de469c65d158fe6 | c0ef07f90552b9e1d95e21831ebc66b6379dba74 | refs/heads/master | 2020-11-23T21:58:06.137554 | 2019-12-16T01:39:14 | 2019-12-16T01:39:14 | 227,838,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,565 | java | package com.example.gyt.data;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import androidx.annotation.Nullable;
/**
* 此功能是创建sqlite数据库
*/
public class MyDBHelper extends SQLiteOpenHelper {
private static String DATABASE_NAME = "gyt.db";
private static int DATABASE_VERSION = 1;
public MyDBHelper(@Nullable Context context, @Nullable String name, @Nullable SQLiteDatabase.CursorFactory factory, int version) {
super(context, name, factory, version);
}
public MyDBHelper(@Nullable Context context){
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
// 将需要创建多张表的语句放这里
// 创建用户表
String sql = "create table user" +
"(" +
" id int(32) not null primary key," +
" account varchar(255)," +
" password varchar(255)," +
" icon varchar(255)," +
" userName varchar(255)," +
" telephone varchar(13)," +
" email varchar(255)," +
" gender int(2)," +
" time timestamp" +
")";
db.execSQL(sql);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
@Override
public void onOpen(SQLiteDatabase db) {
super.onOpen(db);
}
}
| [
"[email protected]"
] | |
957378f16130081ef676dd43f57682f40f9821f3 | 5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1 | /Code Snippet Repository/Jetty/Jetty3387.java | 91a4ea3cac080e6cd38a724d2fc129659443236c | [] | no_license | saber13812002/DeepCRM | 3336a244d4852a364800af3181e03e868cf6f9f5 | be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9 | refs/heads/master | 2023-03-16T00:08:06.473699 | 2018-04-18T05:29:50 | 2018-04-18T05:29:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,181 | java | @Test
public void testReadEarlyEOF() throws Exception
{
_in.addContent(new TContent("AB"));
_in.addContent(new TContent("CD"));
_in.earlyEOF();
Assert.assertThat(_in.isFinished(), Matchers.equalTo(false));
Assert.assertThat(_in.available(), Matchers.equalTo(2));
Assert.assertThat(_in.isFinished(), Matchers.equalTo(false));
Assert.assertThat(_in.read(), Matchers.equalTo((int)'A'));
Assert.assertThat(_in.read(), Matchers.equalTo((int)'B'));
Assert.assertThat(_in.read(), Matchers.equalTo((int)'C'));
Assert.assertThat(_in.isFinished(), Matchers.equalTo(false));
Assert.assertThat(_in.read(), Matchers.equalTo((int)'D'));
try
{
_in.read();
Assert.fail();
}
catch (EOFException eof)
{
Assert.assertThat(_in.isFinished(), Matchers.equalTo(true));
}
Assert.assertThat(_history.poll(), Matchers.equalTo("Content succeeded AB"));
Assert.assertThat(_history.poll(), Matchers.equalTo("Content succeeded CD"));
Assert.assertThat(_history.poll(), Matchers.nullValue());
}
| [
"[email protected]"
] | |
69d10563b0926a70f761e5b64ae381560aa48fef | 3f8cfac6fcdf0bbc0982fbd91b2a8bf579b46055 | /lab1/src/test/java/ru/spbstu/telematics/java/AppTest.java | a4a6d015524e628eaf661353864328d8b16aaddd | [] | no_license | MCdanja/ParProg18Labs | 85716989f46015d1167f66b7e791b6b562acb1a8 | 757d29adf5b8dc54d37e4c3161425e52aefb3f70 | refs/heads/master | 2020-04-11T04:41:52.606116 | 2019-01-16T19:04:15 | 2019-01-16T19:04:15 | 161,522,308 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,297 | java | package ru.spbstu.telematics.java;
//import junit.framework.TestCase;
//
//import java.io.IOException;
//
///**
// * Unit test for simple App.
// */
//public class AppTest
// extends TestCase
//{
// public void testReadertext() throws IOException
// {
// assertEquals(App.ReadFromFile("text.txt"), "Hello World!\nMy name is Daniel.\n");
// }
// public void testReaderprog() throws IOException
// {
// assertEquals(App.ReadFromFile("prog.txt"), "package ru.spbstu.telematics.java;\n" +
// "\n" +
// "import java.io.*;\n" +
// "\n" +
// "public class App \n" +
// "{\n" +
// " public static void main( String[] args ) throws NumberFormatException, IOException\n" +
// " {\n" +
// " FileReader reader = new FileReader(\"text.txt\");\n" +
// " // читаем посимвольно\n" +
// " int c;\n" +
// " while((c=reader.read())!=-1)\n" +
// " {\n" +
// " System.out.print((char)c);\n" +
// " }\n" +
// " }\n" +
// "}\n");
// }
//}
// | [
"[email protected]"
] | |
f543944c2e8706383ef6c9a31ed616c3956db0fc | 87fa765d6d1a4a70013894b765c135af658eee11 | /src/controller/DoRegister.java | bc729bba71868c97e9f5f19f999d1950a44dc8fb | [] | no_license | leehojun078/helloMVC_homework | 4876427af4a5fd2df0bfa2fc54a2a6b989508a19 | 5b48fac68b783bbfab34d51dbfece72858ab7fc9 | refs/heads/master | 2021-01-11T06:04:02.183727 | 2016-10-03T12:57:36 | 2016-10-03T12:57:36 | 69,869,547 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,545 | java | package controller;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import model.Customer;
import service.CustomerService;
/**
* Servlet implementation class DoRegister
*/
@WebServlet("/doRegister")
public class DoRegister extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public DoRegister() {
super();
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
String id = request.getParameter("id");
String password = request.getParameter("password");
String name = request.getParameter("name");
String gender = request.getParameter("gender");
String email = request.getParameter("email");
String page = null;
CustomerService service = (CustomerService) CustomerService
.getInstance();
Customer customer = new Customer(id, password, name, gender, email);
service.addCustomer(customer);
if (id != null && password != null)
page = "/view/ registersuccess.jsp";
RequestDispatcher dispatcher = request.getRequestDispatcher(page);
dispatcher.forward(request, response);
}
}
| [
"이호준@DESKTOP-FCT7T0B"
] | 이호준@DESKTOP-FCT7T0B |
7ecbbddb12ce5c163c903febd5055ceca1c263ef | b8cb78ab4fbaeb49bc2d6bdabe49f48cad66c585 | /src/main/java/com/example/hotel/enums/UserType.java | ba2c31b11941eca688738b985d06c596680ae0ab | [] | no_license | TOMORI00/NJUSE-HRS | 93f90c3db54fcef6ccf3fdc6346298b884e2df93 | afddc41054daeab95e2590463bbb4dc97fee9eb2 | refs/heads/master | 2023-06-28T10:45:59.735392 | 2021-07-30T07:10:44 | 2021-07-30T07:10:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 475 | java | package com.example.hotel.enums;
/**
* @author chenyizong
*/
public enum UserType {
/**
* 客户
*/
Client("1"),
/**
* 酒店工作人员
*/
Staff("2"),
/**
* 网站营销人员
*/
Busi("3"),
/**
* 网站管理人员
*/
Admin("4");
private String value;
UserType(String value) {
this.value = value;
}
@Override
public String toString() {
return value;
}
} | [
"[email protected]"
] | |
247316a3b727a9fd899306efb83aad9a618bc5c6 | 96f8d42c474f8dd42ecc6811b6e555363f168d3e | /budejie/sources/com/google/gson/internal/Streams.java | e7fa0308460816ef6da7638bfa6e5488ec11779a | [] | no_license | aheadlcx/analyzeApk | 050b261595cecc85790558a02d79739a789ae3a3 | 25cecc394dde4ed7d4971baf0e9504dcb7fabaca | refs/heads/master | 2020-03-10T10:24:49.773318 | 2018-04-13T09:44:45 | 2018-04-13T09:44:45 | 129,332,351 | 6 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,700 | java | package com.google.gson.internal;
import com.google.gson.JsonElement;
import com.google.gson.JsonIOException;
import com.google.gson.JsonNull;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSyntaxException;
import com.google.gson.internal.bind.TypeAdapters;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.io.Writer;
public final class Streams {
private static final class AppendableWriter extends Writer {
private final Appendable appendable;
private final CurrentWrite currentWrite = new CurrentWrite();
static class CurrentWrite implements CharSequence {
char[] chars;
CurrentWrite() {
}
public int length() {
return this.chars.length;
}
public char charAt(int i) {
return this.chars[i];
}
public CharSequence subSequence(int i, int i2) {
return new String(this.chars, i, i2 - i);
}
}
AppendableWriter(Appendable appendable) {
this.appendable = appendable;
}
public void write(char[] cArr, int i, int i2) throws IOException {
this.currentWrite.chars = cArr;
this.appendable.append(this.currentWrite, i, i + i2);
}
public void write(int i) throws IOException {
this.appendable.append((char) i);
}
public void flush() {
}
public void close() {
}
}
private Streams() {
throw new UnsupportedOperationException();
}
public static JsonElement parse(JsonReader jsonReader) throws JsonParseException {
Object obj = 1;
try {
jsonReader.peek();
obj = null;
return (JsonElement) TypeAdapters.JSON_ELEMENT.read(jsonReader);
} catch (Throwable e) {
if (obj != null) {
return JsonNull.INSTANCE;
}
throw new JsonSyntaxException(e);
} catch (Throwable e2) {
throw new JsonSyntaxException(e2);
} catch (Throwable e22) {
throw new JsonIOException(e22);
} catch (Throwable e222) {
throw new JsonSyntaxException(e222);
}
}
public static void write(JsonElement jsonElement, JsonWriter jsonWriter) throws IOException {
TypeAdapters.JSON_ELEMENT.write(jsonWriter, jsonElement);
}
public static Writer writerForAppendable(Appendable appendable) {
return appendable instanceof Writer ? (Writer) appendable : new AppendableWriter(appendable);
}
}
| [
"[email protected]"
] | |
c1c658212d18c45065114305ed4e093c8eab246d | 31cc753b01889c2679981d5d73d7ac3ed32f4a30 | /aigou-product-parent/aigou-product-service-provider/src/main/java/cn/itsource/aigou/mapper/ProductTypeMapper.java | 76d2fbfedf8a6c439bc73561cfc02edc7e0406a7 | [] | no_license | luguoyizhiniu/aigou-parent | 3dd87cce3d44d99c7b0ff475c79ca1c40d0d3958 | 9c449591eda2c09078a98be7d1b8a65e1f550098 | refs/heads/master | 2020-05-02T17:50:18.677299 | 2019-04-02T15:08:05 | 2019-04-02T15:08:05 | 178,110,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 365 | java | package cn.itsource.aigou.mapper;
import cn.itsource.aigou.domain.ProductType;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import java.util.List;
/**
* <p>
* 商品目录 Mapper 接口
* </p>
*
* @author ztg
* @since 2019-03-31
*/
public interface ProductTypeMapper extends BaseMapper<ProductType> {
List<ProductType> selectByPid(Long pid);
}
| [
"[email protected]"
] | |
7159acb8dda4e59f9f9fb4160841297040a9864b | 8091dc59cc76869befe9b0a8f350fbc56c2836e5 | /sql12/app/src/main/java/net/sourceforge/squirrel_sql/client/gui/db/aliasproperties/ConnectionPropertiesController.java | 52422ca444804a780df0c573145477077876b829 | [] | no_license | igorhvr/squirrel-sql | 4560c39c9221f04a49487b5f3d66b1559a32c21a | 3457d91b397392e1a9649ffb00cbfd093e453654 | refs/heads/master | 2020-04-05T08:32:51.484469 | 2011-08-10T18:59:26 | 2011-08-10T18:59:26 | 2,188,276 | 2 | 5 | null | null | null | null | UTF-8 | Java | false | false | 2,475 | java | package net.sourceforge.squirrel_sql.client.gui.db.aliasproperties;
/*
* Copyright (C) 2009 Rob Manning
* [email protected]
*
* Based on initial work from Colin Bell
*
* This library 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.
*
* This library 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 this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
import java.awt.Component;
import net.sourceforge.squirrel_sql.client.IApplication;
import net.sourceforge.squirrel_sql.client.gui.db.ISQLAliasExt;
import net.sourceforge.squirrel_sql.fw.util.StringManager;
import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
/**
* This dialog allows the user to review and maintain connection properties for an alias.
*/
public class ConnectionPropertiesController implements IAliasPropertiesPanelController
{
/**
* Internationalized strings for this class.
*/
private static final StringManager s_stringMgr =
StringManagerFactory.getStringManager(ConnectionPropertiesController.class);
private ConnectionPropertiesPanel _propsPnl;
private ISQLAliasExt _alias;
public static interface i18n {
// i18n[ConnectionPropertiesController.title=Connection]
String TITLE = s_stringMgr.getString("ConnectionPropertiesController.title");
// i18n[ConnectionPropertiesController.hint=Set session connection properties for this Alias]
String HINT = s_stringMgr.getString("ConnectionPropertiesController.hint");
}
public ConnectionPropertiesController(ISQLAliasExt alias, IApplication app)
{
_alias = alias;
_propsPnl = new ConnectionPropertiesPanel(alias.getConnectionProperties());
}
public Component getPanelComponent()
{
return _propsPnl;
}
public void applyChanges()
{
_alias.setConnectionProperties(_propsPnl.getSQLAliasConnectionProperties());
}
public String getTitle()
{
return i18n.TITLE;
}
public String getHint()
{
return i18n.HINT;
}
}
| [
"manningr@0ceafaf9-a5ae-48a7-aaeb-8ec3e0f2870c"
] | manningr@0ceafaf9-a5ae-48a7-aaeb-8ec3e0f2870c |
a7d7b5ea58a9dab7fbb7b9006bb2ec3597463b06 | e9793a33313de08003f89d56c8b1c0d09f280489 | /src/com/lesson_10/gumballstate/state/SoldOutState.java | 1ea1ce9dee6a96fb370b26121e08f66496514658 | [] | no_license | vkulkov/DesignPatterns | 095f167a2cb92f7ef77c862aa17187e02fd8897c | a9cf9a50a4e3a985d5886c46b6d6886bc7fdfa9e | refs/heads/master | 2021-08-14T21:57:43.964503 | 2017-11-16T21:46:29 | 2017-11-16T21:46:29 | 110,125,074 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 879 | java | package com.lesson_10.gumballstate.state;
import com.lesson_10.gumballstate.GumballMachine;
import com.lesson_10.gumballstate.State;
public class SoldOutState implements State {
private GumballMachine gumballMachine;
public SoldOutState(GumballMachine gumballMachine) {
this.gumballMachine = gumballMachine;
}
@Override
public void insertQuarter() {
System.out.println("You can't insert a quarter, the machine is sold out");
}
@Override
public void ejectQuarter() {
System.out.println("You haven't inserted a quarter");
}
@Override
public void pullLever() {
System.out.println("You turned, but there are no gumballs");
}
@Override
public void giveGumball() {
System.out.println("No gumball dispensed");
}
public String toString() {
return "sold out";
}
}
| [
"[email protected]"
] | |
1af7d7fc124f1f326c5c14676445a231c0d03553 | 90d320aa661232a653e3652d8ac48b34ba2f22f0 | /src/ch10/E18.java | 6a8b7aba49d9fb6b87f2f34150c35e3f58b725f5 | [] | no_license | Broken-pants/ThinkingInJava | 871441e804b640664636093d5753f66d8c1f2b17 | 04e8de5e28a7c5d73a187b81017f7c12f371d10f | refs/heads/master | 2020-05-30T17:01:34.701660 | 2019-03-15T07:33:35 | 2019-03-15T07:33:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 362 | java | package ch10;
interface E18I {
public void print();
}
class E18A {
static E18I getE18I() {
return new E18I() {
public void print() {
System.out.println("E18A E18I");
}
};
}
}
public class E18 {
public static void main(String[] args) {
E18A ea = new E18A();
ea.getE18I().print();
}
}/* Output:
E18A E18I
*///:~
| [
"[email protected]"
] | |
e2e435496fb4df2081fbeb371a1a62212e38e3e6 | a20aba21d0150c4a98c7f71997cfff06db3d1468 | /generators/hibernate/tests/org.obeonetwork.dsl.entity.gen.java.hibernate.tests/src/inheritance_associations/org/obeonetwork/sample/inheritanceassociations/IClass101ENDDao.java | 3579e02e50ad5604a4fdb0cc25c5bfce7954cda9 | [] | no_license | MathieuVenisse/InformationSystem | 1bf159a775b956c7ff23adba66690c25ad18a161 | d677a80c97145ed16f7616ab6c553c4c632116e1 | refs/heads/master | 2021-01-20T21:20:11.482505 | 2012-12-04T14:07:55 | 2012-12-04T14:07:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,798 | java | package org.obeonetwork.sample.inheritanceassociations;
// Start of user code for import
import java.util.Collection;
import org.obeonetwork.fwk.dao.exception.DaoException;
import org.obeonetwork.sample.inheritanceassociations.Class101END;
// End of user code for import
/**
* This class provides the data access layer to the Class_1_01_END entity class.<br/>
* This is the interface which represent the contrat of the DAO access.
*/
public interface IClass101ENDDao {
/**
* Create a new element.
* @param class101END Element to create.
* @throws DaoException If a Dao problem occurs.
*/
public void createClass101END(Class101END class101END) throws DaoException;
/**
* Update an existing element.
* @param class101END Element to update.
* If the element has an id, it may use it.
* @throws DaoException If a Dao problem occurs.
*/
public void updateClass101END(Class101END class101END) throws DaoException;
/**
* Delete an element.
* Only id can be used to find which element must be deleted.
* @param class101END Element which will be delete.
* @throws DaoException If a Dao problem occurs.
*/
public void deleteClass101END(Class101END class101END) throws DaoException;
/**
* Find all elements.
* @return A list with all elements, without any filter.
* @throws DaoException If a Dao problem occurs.
*/
public Collection<Class101END> findAllClass101ENDs() throws DaoException;
/**
* Find one entity by its primary key.
* @param id The PK of the entity.
* @return The entity found.
* @throws DaoException If a Dao problem occurs.
*/
public Class101END findClass101ENDById(String id) throws DaoException;
//Start of user code for technicals dao access api
//End of user code for technical dao access api
} | [
"[email protected]"
] | |
3f0781d3fdee7f48277fe94c02e447867afe5950 | ff24082b355af2b0abee4919e5529dc94850f4a4 | /src/wordcram/ProcessingWordRenderer.java | 4b5c6b52e787acbca5ebd83f356cef7eb34341cf | [
"Apache-2.0"
] | permissive | firefaith/WordCram | 85ae97e5d92bd157e9c31166e2ece26a4e4658d3 | 1ab2bddd6d62e033d7f559195c732c9800a86b0a | refs/heads/master | 2020-12-30T21:45:43.775558 | 2013-11-02T21:08:31 | 2013-11-02T21:08:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,482 | java | package wordcram;
/*
Copyright 2013 Daniel Bernier
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.
*/
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.GeneralPath;
import processing.core.PGraphics;
import processing.core.PGraphicsJava2D;
class ProcessingWordRenderer implements WordRenderer {
PGraphics destination;
ProcessingWordRenderer(PGraphics destination) {
this.destination = destination;
}
public int getWidth() {
return destination.width;
}
public int getHeight() {
return destination.height;
}
public void drawWord(EngineWord word, Color color) {
GeneralPath path2d = new GeneralPath(word.getShape());
// Graphics2D g2 = (Graphics2D)destination.image.getGraphics();
Graphics2D g2 = ((PGraphicsJava2D)destination).g2;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setPaint(color);
g2.fill(path2d);
}
public void finish() {}
} | [
"[email protected]"
] | |
e441c47b614fd42e23dc5cf26d27a9dc7aa6af84 | 9fc746827fe533366d48284afdea6609e872de4f | /src/brooklynbridgepoker/Pot.java | 4063648bef46dccb05c1f6ad853268ee3733da80 | [] | no_license | svetlozarkirkov/BrooklynBridgePoker | 052d0e53077d19319276200b5f3867ac69c8c08b | 26c56d8753833543230ecbc713295bdbec923828 | refs/heads/master | 2021-05-16T02:06:57.102084 | 2015-02-04T18:49:22 | 2015-02-04T18:49:22 | 29,931,642 | 3 | 3 | null | 2020-10-13T04:34:18 | 2015-01-27T19:47:13 | Java | UTF-8 | Java | false | false | 1,141 | java |
package brooklynbridgepoker;
import java.util.Map;
public class Pot {
private int currentPotTotal; // total sum in the pot
private Map<String,Integer> playersInPot; // players who contribute to the pot
public Pot(){ // default constructor
}
public int getCurrentPotTotal(){ // gets the current pot sum
return currentPotTotal;
}
public Map<String,Integer> getPlayersInPot(){ // gets map of the players and their bets
return playersInPot;
}
public void setCurrentPotTotal(int bet){ // updates the pot total sum
this.currentPotTotal+=bet;
}
public void insertPlayerInPot(String name, int bet){ // inserts new player into the pot contributors
this.playersInPot.put(name, bet);
}
public void removePlayerInPot(String name){ // removes a player from the pot
this.playersInPot.remove(name);
}
public void clearPot(){ // clears the pot before a new round
this.playersInPot.clear();
this.currentPotTotal=0;
}
}
| [
"[email protected]"
] | |
de23e0ad8981abe0ba20a43d28eeafd812b5ede1 | 89669855506cbe2d0336cd01fcbb6fd5e9085636 | /Lesson 03 eldar/src/f/whileLoop/Demo1.java | 5b10d78ef7048b019fbe60717312e88e2f267998 | [] | no_license | gadipo/822-121 | 4e006cc0a551ec6ac1ad03771f3062c877185e2a | b4c8642726620d55bf16700867b876702e18e32f | refs/heads/master | 2020-11-27T13:56:42.763719 | 2019-12-18T14:13:27 | 2019-12-18T14:13:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 333 | java | package f.whileLoop;
public class Demo1 {
public static void main(String[] args) {
int c = 1;
// while loop
while (c <= 3) {
System.out.println(c);
c++;
}
System.out.println("===============");
// write a loop that prints the numbers 5 to 15
c = 5;
while (c <= 15) {
System.out.println(c++);
}
}
}
| [
"[email protected]"
] | |
a9e207ddbe581d7b0443fa09bf2f41881d5b82b6 | 204a32a720f0aa3274d0fd3755a7608bd7733788 | /app/src/main/java/com/infoservices/lue/util/NetworkUtil.java | f351515ab89d0d77238be91e1312a48e0f76f03c | [] | no_license | Ritesh786/CONDOMANAGEMENT123 | 52c42f02f97cf3ddc37ea6101eb7db368c3adec1 | 903d5b3a2694da75c76018d96939bc79aa84a2db | refs/heads/master | 2021-01-23T12:32:06.667371 | 2017-12-18T07:50:21 | 2017-12-18T07:50:21 | 93,165,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 612 | java | package com.infoservices.lue.util;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
public class NetworkUtil {
public static final boolean isOnline(Context context){
ConnectivityManager connectivity = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivity != null) {
NetworkInfo[] info = connectivity.getAllNetworkInfo();
if (info != null)
for (int i = 0; i < info.length; i++)
if (info[i].getState() == NetworkInfo.State.CONNECTED) {
return true;
}
}
return false;
}
}
| [
"[email protected]"
] | |
aa08afebbc278b6c730f3945ccce7405636504b3 | 1f19aec2ecfd756934898cf0ad2758ee18d9eca2 | /u-1/u-11/u-11-111/u-11-111-1111/u-11-111-1111-11111/u-11-111-1111-11111-f2519.java | 0055e304ec6b71f611e358c4dc302a4760c7018d | [] | no_license | apertureatf/perftest | f6c6e69efad59265197f43af5072aa7af8393a34 | 584257a0c1ada22e5486052c11395858a87b20d5 | refs/heads/master | 2020-06-07T17:52:51.172890 | 2019-06-21T18:53:01 | 2019-06-21T18:53:01 | 193,039,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 104 | java | mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117
31124557279 | [
"[email protected]"
] | |
eff9a24c5cdb71873007be166144a6211f43f287 | ee1bb6d3b7014040195283b2aaff903477924d85 | /app/src/main/java/com/game/magody/tictactoe/MainActivity.java | 50fb317de923f05bab8025c13f738296a17d8886 | [] | no_license | Magody/TicTacToeAndroid | aaab10659eca953af8062e01569c081e644758ed | 70d41aeb2009cde497309d99a1304d858079827a | refs/heads/master | 2020-07-12T06:53:57.569445 | 2019-08-27T16:47:04 | 2019-08-27T16:47:04 | 204,748,612 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,328 | java | package com.game.magody.tictactoe;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RadioGroup;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
int numero_jugadores;
int[][] casillas;
Partida partida;
String jugador1;
String jugador2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//matriz de juego
casillas = new int[][] {{R.id.a11,R.id.a12,R.id.a13},
{R.id.a21,R.id.a22,R.id.a23},
{R.id.a31,R.id.a32,R.id.a33}};
}
public void jugar(View view){
limpiar_casillas();
numero_jugadores = 1;
if(view.getId() == R.id.dosjugadores){
numero_jugadores = 2;
}
RadioGroup dificultades = (RadioGroup) findViewById(R.id.dificultades);
int id_dificultad = dificultades.getCheckedRadioButtonId();
int dificultad = 0;
if(id_dificultad == R.id.dificultad_normal){
dificultad = 1;
}
else if(id_dificultad == R.id.dificultad_imposible){
dificultad = 2;
}
partida = new Partida(dificultad);
//busca los botones especificados y los oculta
((Button) findViewById(R.id.unjugador)).setEnabled(false);
((RadioGroup) findViewById(R.id.dificultades)).setAlpha(0);
((Button) findViewById(R.id.dosjugadores)).setEnabled(false);
this.imprimir("Turno inicial elegido aleatoriamente: " + partida.jugador,0);
if(partida.jugador == 2 && numero_jugadores == 1){
String salida = "";
switch (dificultad){
case 0:
salida = "Dificultad Fácil";
break;
case 1:
salida = "Dificultad Normal";
break;
case 2:
salida = "Dificultad Difícil";
break;
}
this.imprimir(salida,0);
this.jugador1 = "usted";
this.jugador2 = "máquina";
this.elegirJugadaIA();
}
if(numero_jugadores == 2){
this.jugador1 = "circulos";
this.jugador2 = "equis";
}
}
public void toque(View view){
if(partida != null) {
int fila = 0;
int columna = 0;
for (int i = 0; i <= 2; i++) {
for (int j = 0; j <= 2; j++) {
if (casillas[i][j] == view.getId()) {
fila = i;
columna = j;
break;
}
}
}
if(partida.estaCasillaDisponible(fila,columna))
{
partida.matriz_juego[fila][columna] = partida.jugador; // nosotros
marcarCasilla(fila,columna);
estadoPartida();
// si gana el usuario partida se convierte en null
if(partida != null){
if(numero_jugadores == 1){
if(!partida.estaMatrizLlena()) {
partida.jugador = 2;
elegirJugadaIA();
}
else{
estadoPartida();
}
}
else if(numero_jugadores == 2){
if(partida.jugador == 1)
partida.jugador = 2;
else
partida.jugador = 1;
}
}
}
else
imprimir("Casilla ocupada",0);
/*
Toast toast = Toast.makeText(this, "Has pulsado la pos: (" + fila + "," + columna + ")", Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();*/
}
}
public void elegirJugadaIA(){
int pos[] = new int[2];
switch (partida.DIFICULTAD){
case 0:
pos = partida.jugadaIAEasyNormal(); break;
case 1:
int[] aux = partida.jugadaIAEasyNormal();
if(aux.length == 3){
pos[0] = aux[1];
pos[1] = aux[2];
}
else
pos = aux;
break;
case 2:
int[] aux1 = partida.jugadaIAInsano();
if(aux1.length == 3){
pos[0] = aux1[1];
pos[1] = aux1[2];
}
else
pos = aux1;
break;
}
partida.matriz_juego[pos[0]][pos[1]] = 2;
marcarCasilla(pos[0], pos[1]);
partida.jugador = 1;
//imprimirMatrizActual();
estadoPartida();
}
public void estadoPartida(){
int estado = partida.comprobarEstado();
if(estado == 0 && partida.estaMatrizLlena())
{
imprimir("El juego a terminado en empate",0);
reiniciarPartida();
}
else if(estado!=0){
String salida = "";
switch (estado){
case 1:
salida = "El ganador: " + this.jugador1;break;
case 2:
salida = "El ganador: " + this.jugador2; break;
}
imprimir(salida,0);
reiniciarPartida();
}
}
public void marcarCasilla(int fila, int columna){
ImageView imagen = (ImageView) findViewById(casillas[fila][columna]);
if(partida.jugador == 1){
imagen.setImageResource(R.drawable.circulo);
}
else{
imagen.setImageResource(R.drawable.aspa);
}
}
public void limpiar_casillas(){
ImageView imagen;
for(int i=0;i<=2;i++){
for(int j=0;j<=2;j++){
//asigna una casilla en blanco a cada casilla
imagen = (ImageView) findViewById(casillas[i][j]);
imagen.setImageResource(R.drawable.casilla);
}
}
}
public void reiniciarPartida(){
partida = null;
((Button) findViewById(R.id.unjugador)).setEnabled(true);
((RadioGroup) findViewById(R.id.dificultades)).setAlpha(0.8f);
((Button) findViewById(R.id.dosjugadores)).setEnabled(true);
}
public void imprimirMatrizActual(){
String salida = "";
for (int i = 0; i <= 2; i++) {
for (int j = 0; j <= 2; j++) {
salida += partida.matriz_juego[i][j] + " ";
}
salida += " | ";
}
Toast toast = Toast.makeText(this, salida, Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}
public void imprimir(String msg,int delay){
Toast toast = Toast.makeText(this,msg,delay);
toast.setGravity(Gravity.CENTER,0,0);
toast.show();
}
}
| [
"[email protected]"
] | |
1751d7d28a211df14c0d5eb7b4316deadaeb28de | a43d4202628ecb52e806d09f0f3dc1f5bab3ef4f | /src/main/java/pnc/mesadmin/dto/GetSkillInfo/GetSkillInfoResB.java | 211a63c5df90e53d46fd877788a9d910fc5712fe | [] | no_license | pnc-mes/base | b88583929e53670340a704f848e4e9e2027f1334 | 162135b8752b4edc397b218ffd26664929f6920d | refs/heads/main | 2023-01-07T22:06:10.794300 | 2020-10-27T07:47:20 | 2020-10-27T07:47:20 | 307,621,190 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,196 | java | package pnc.mesadmin.dto.GetSkillInfo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
/**
* 公司名称:驭航信息技术(上海)有限公司
* 系统名称:PNC-MES管理系统
* 子系统名称:获取序号管理信息DTO返回业务数据实体类Body
* 创建人:ZC
* 创建时间:2017-06-07
* 修改人:
* 修改时间:
*/
public class GetSkillInfoResB implements Serializable{
@JsonProperty("MsgCode")
private String MsgCode;
@JsonProperty("MsgDes")
private String MsgDes;
@JsonProperty("Data")
private GetSkillInfoResD Data;
@JsonIgnore
public String getMsgCode() {
return MsgCode;
}
@JsonIgnore
public void setMsgCode(String msgCode) {
MsgCode = msgCode;
}
@JsonIgnore
public String getMsgDes() {
return MsgDes;
}
@JsonIgnore
public void setMsgDes(String msgDes) {
MsgDes = msgDes;
}
@JsonIgnore
public GetSkillInfoResD getData() {
return Data;
}
@JsonIgnore
public void setData(GetSkillInfoResD data) {
Data = data;
}
}
| [
"[email protected]"
] | |
dd84b1c17be5ac3327a3779725c9d2718d42a062 | a3774537742975a923f2f2e7069cf20c463615ac | /app/src/main/java/com/coolweather/android/gson/AQI.java | 6d864d47cdd60bff1a234f2af046a1bd95348471 | [] | no_license | gah98/CoolWeather | ff9eea771f6624289a6cd2a15eb874248f9db738 | 36a603c813ee3549ec72be65e344c6131eb481ac | refs/heads/master | 2021-04-12T22:21:49.228914 | 2020-06-17T00:43:11 | 2020-06-17T00:43:11 | 249,112,892 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 173 | java | package com.coolweather.android.gson;
public class AQI {
public AQICity city;
public class AQICity{
public String aqi;
public String pm25;
}
}
| [
"[email protected]"
] | |
7d3998e44b1e15f7d4b987ebcf9a953d9da5ebc0 | b290ddb36eb3088c2009efc958d2071b9be5815c | /android/app/src/main/java/com/airline/MainApplication.java | d90de2afad64806958068650ac8eed49ab5ffeb1 | [] | no_license | mobilewebguru/react-native-social-login | 03e8654380b72b1e077af22aed58d8624cec6808 | 8010005170063319e4c8087ed1fd7e1915c94b3b | refs/heads/master | 2020-03-25T01:38:06.044805 | 2018-08-02T07:52:30 | 2018-08-02T07:52:30 | 143,247,977 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,038 | java | package com.airline;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.lugg.ReactNativeConfig.ReactNativeConfigPackage;
import com.goldenowl.twittersignin.TwitterSigninPackage;
import co.apptailor.googlesignin.RNGoogleSigninPackage;
import com.facebook.reactnative.androidsdk.FBSDKPackage;
import com.i18n.reactnativei18n.ReactNativeI18n;
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;
import com.facebook.CallbackManager;
import com.facebook.FacebookSdk;
import com.facebook.reactnative.androidsdk.FBSDKPackage;
import com.facebook.appevents.AppEventsLogger;
public class MainApplication extends Application implements ReactApplication {
private static CallbackManager mCallbackManager = CallbackManager.Factory.create();
protected static CallbackManager getCallbackManager() {
return mCallbackManager;
}
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 ReactNativeConfigPackage(),
new TwitterSigninPackage(),
new RNGoogleSigninPackage(),
new FBSDKPackage(mCallbackManager),
new ReactNativeI18n(),
new VectorIconsPackage()
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
FacebookSdk.sdkInitialize(getApplicationContext());
// If you want to use AppEventsLogger to log events.
AppEventsLogger.activateApp(this);
}
}
| [
"[email protected]"
] | |
844fda375a0ee0fe123ec3fcf695cf84134dfdf4 | 77fcfe5fbf379f87a3c4f6076c69d02cd53651fe | /libzxing/src/main/java/com/zero/libzxing/core/DecodeActivity.java | d8a42a8a9f77f9b35bd2da99ed6f2ff1df9f627e | [] | no_license | chfdeng/SimpleZxing | c9249607f13a2380bd7856de97dbfb390886e69f | 1075df6d319f2dd1065f6efce78f6f5822c4005b | refs/heads/master | 2021-09-14T07:41:07.734808 | 2018-05-10T02:39:31 | 2018-05-10T02:39:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,271 | java | package com.zero.libzxing.core;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.KeyEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Toast;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.DecodeHintType;
import com.google.zxing.Result;
import com.google.zxing.client.result.ResultParser;
import com.zero.libzxing.R;
import com.zero.libzxing.core.camera.CameraManager;
import com.zero.libzxing.core.common.BitmapUtils;
import com.zero.libzxing.core.decode.BitmapDecoder;
import com.zero.libzxing.core.decode.CaptureActivityHandler;
import com.zero.libzxing.core.view.ScannerView;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.Collection;
import java.util.Map;
/**
* 条形码和二维码扫描器(使用方法:启动本界面即可)
* <p>
* This activity opens the camera and does the actual scanning on a background
* thread. It draws a viewfinder to help the user place the barcode correctly,
* shows feedback as the image processing is happening, and then overlays the
* results when a scan is successful.
* <p>
* 此Activity所做的事: 1.开启camera,在后台独立线程中完成扫描任务;
* 2.绘制了一个扫描区(viewfinder)来帮助用户将条码置于其中以准确扫描; 3.扫描成功后会将扫描结果展示在界面上。
*/
public final class DecodeActivity extends AppCompatActivity implements
SurfaceHolder.Callback, View.OnClickListener {
private static final String TAG = DecodeActivity.class.getSimpleName();
private static final int REQUEST_CODE = 100;
public static final int REQUEST_CODE_DECODE = 1000;
public static final String DECODE_RESULT = "DECODE_RESULT";
private static final int PARSE_BARCODE_FAIL = 300;
private static final int PARSE_BARCODE_SUC = 200;
/**
* 是否有预览
*/
private boolean hasSurface;
/**
* 活动监控器。如果手机没有连接电源线,那么当相机开启后如果一直处于不被使用状态则该服务会将当前activity关闭。
* 活动监控器全程监控扫描活跃状态,与CaptureActivity生命周期相同.每一次扫描过后都会重置该监控,即重新倒计时。
*/
private InactivityTimer inactivityTimer;
/**
* 声音震动管理器。如果扫描成功后可以播放一段音频,也可以震动提醒,可以通过配置来决定扫描成功后的行为。
*/
private BeepManager beepManager;
/**
* 闪光灯调节器。自动检测环境光线强弱并决定是否开启闪光灯
*/
private AmbientLightManager ambientLightManager;
private CameraManager cameraManager;
/**
* 扫描区域
*/
private ScannerView scannerView;
private CaptureActivityHandler handler;
private Result lastResult;
private boolean isFlashlightOpen;
/**
* 【辅助解码的参数(用作MultiFormatReader的参数)】 编码类型,该参数告诉扫描器采用何种编码方式解码,即EAN-13,QR
* Code等等 对应于DecodeHintType.POSSIBLE_FORMATS类型
* 参考DecodeThread构造函数中如下代码:hints.put(DecodeHintType.POSSIBLE_FORMATS,
* decodeFormats);
*/
private Collection<BarcodeFormat> decodeFormats;
/**
* 【辅助解码的参数(用作MultiFormatReader的参数)】 该参数最终会传入MultiFormatReader,
* 上面的decodeFormats和characterSet最终会先加入到decodeHints中 最终被设置到MultiFormatReader中
* 参考DecodeHandler构造器中如下代码:multiFormatReader.setHints(hints);
*/
private Map<DecodeHintType, ?> decodeHints;
/**
* 【辅助解码的参数(用作MultiFormatReader的参数)】 字符集,告诉扫描器该以何种字符集进行解码
* 对应于DecodeHintType.CHARACTER_SET类型
* 参考DecodeThread构造器如下代码:hints.put(DecodeHintType.CHARACTER_SET,
* characterSet);
*/
private String characterSet;
private Result savedResultToShow;
private IntentSource source;
/**
* 图片的路径
*/
private String photoPath;
private Handler mHandler = new MyHandler(this);
static class MyHandler extends Handler {
private WeakReference<Activity> activityReference;
public MyHandler(Activity activity) {
activityReference = new WeakReference<Activity>(activity);
}
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case PARSE_BARCODE_SUC: // 解析图片成功
Intent intent = new Intent();
intent.putExtra(DECODE_RESULT, msg.obj.toString());
activityReference.get().setResult(RESULT_OK, intent);
activityReference.get().finish();
break;
case PARSE_BARCODE_FAIL:// 解析图片失败
Toast.makeText(activityReference.get(), "图片解析失败",
Toast.LENGTH_SHORT).show();
break;
default:
break;
}
super.handleMessage(msg);
}
}
public static void actionStart(Activity activity) {
Intent intent = new Intent(activity, DecodeActivity.class);
activity.startActivityForResult(intent, REQUEST_CODE_DECODE);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_decode);
hasSurface = false;
inactivityTimer = new InactivityTimer(this);
beepManager = new BeepManager(this);
ambientLightManager = new AmbientLightManager(this);
// 监听图片识别按钮
findViewById(R.id.capture_scan_photo).setOnClickListener(this);
//监听闪光灯按钮
findViewById(R.id.capture_flashlight).setOnClickListener(this);
//监听取消按钮
findViewById(R.id.capture_button_cancel).setOnClickListener(this);
}
@Override
protected void onResume() {
super.onResume();
// CameraManager must be initialized here, not in onCreate(). This is
// necessary because we don't
// want to open the camera driver and measure the screen size if we're
// going to show the help on
// first launch. That led to bugs where the scanning rectangle was the
// wrong size and partially
// off screen.
// 相机初始化的动作需要开启相机并测量屏幕大小,这些操作
// 不建议放到onCreate中,因为如果在onCreate中加上首次启动展示帮助信息的代码的 话,
// 会导致扫描窗口的尺寸计算有误的bug
cameraManager = new CameraManager(getApplication());
scannerView = (ScannerView) findViewById(R.id.capture_viewfinder_view);
scannerView.setCameraManager(cameraManager);
handler = null;
lastResult = null;
// 摄像头预览功能必须借助SurfaceView,因此也需要在一开始对其进行初始化
// 如果需要了解SurfaceView的原理
// 参考:http://blog.csdn.net/luoshengyang/article/details/8661317
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.capture_preview_view); // 预览
SurfaceHolder surfaceHolder = surfaceView.getHolder();
if (hasSurface) {
// The activity was paused but not stopped, so the surface still
// exists. Therefore
// surfaceCreated() won't be called, so init the camera here.
initCamera(surfaceHolder);
} else {
// 防止sdk8的设备初始化预览异常
surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
// Install the callback and wait for surfaceCreated() to init the
// camera.
surfaceHolder.addCallback(this);
}
// 加载声音配置,其实在BeemManager的构造器中也会调用该方法,即在onCreate的时候会调用一次
beepManager.updatePrefs();
// 启动闪光灯调节器
ambientLightManager.start(cameraManager);
// 恢复活动监控器
inactivityTimer.onResume();
source = IntentSource.NONE;
decodeFormats = null;
characterSet = null;
}
@Override
protected void onPause() {
if (handler != null) {
handler.quitSynchronously();
handler = null;
}
inactivityTimer.onPause();
ambientLightManager.stop();
beepManager.close();
// 关闭摄像头
cameraManager.closeDriver();
if (!hasSurface) {
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.capture_preview_view);
SurfaceHolder surfaceHolder = surfaceView.getHolder();
surfaceHolder.removeCallback(this);
}
super.onPause();
}
@Override
protected void onDestroy() {
inactivityTimer.shutdown();
super.onDestroy();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_BACK:
if ((source == IntentSource.NONE) && lastResult != null) { // 重新进行扫描
restartPreviewAfterDelay(0L);
return true;
}
break;
case KeyEvent.KEYCODE_FOCUS:
case KeyEvent.KEYCODE_CAMERA:
// Handle these events so they don't launch the Camera app
return true;
case KeyEvent.KEYCODE_VOLUME_UP:
cameraManager.zoomIn();
return true;
case KeyEvent.KEYCODE_VOLUME_DOWN:
cameraManager.zoomOut();
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (resultCode == RESULT_OK) {
final ProgressDialog progressDialog;
switch (requestCode) {
case REQUEST_CODE:
// 获取选中图片的路径
Cursor cursor = getContentResolver().query(
intent.getData(), null, null, null, null);
if (cursor.moveToFirst()) {
photoPath = cursor.getString(cursor
.getColumnIndex(MediaStore.Images.Media.DATA));
}
cursor.close();
progressDialog = new ProgressDialog(this);
progressDialog.setMessage("正在扫描...");
progressDialog.setCancelable(false);
progressDialog.show();
new Thread(new Runnable() {
@Override
public void run() {
Bitmap img = BitmapUtils
.getCompressedBitmap(photoPath);
BitmapDecoder decoder = new BitmapDecoder(
DecodeActivity.this);
Result result = decoder.getRawResult(img);
if (result != null) {
Message m = mHandler.obtainMessage();
m.what = PARSE_BARCODE_SUC;
m.obj = ResultParser.parseResult(result)
.toString();
mHandler.sendMessage(m);
} else {
Message m = mHandler.obtainMessage();
m.what = PARSE_BARCODE_FAIL;
mHandler.sendMessage(m);
}
progressDialog.dismiss();
}
}).start();
break;
}
}
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
if (holder == null) {
Log.e(TAG,
"*** WARNING *** surfaceCreated() gave us a null surface!");
}
if (!hasSurface) {
hasSurface = true;
initCamera(holder);
}
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
/*hasSurface = false;*/
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
hasSurface = false;
}
/**
* A valid barcode has been found, so give an indication of success and show
* the results.
*
* @param rawResult The contents of the barcode.
* @param scaleFactor amount by which thumbnail was scaled
* @param barcode A greyscale bitmap of the camera data which was decoded.
*/
public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) {
// 重新计时
inactivityTimer.onActivity();
lastResult = rawResult;
// 把图片画到扫描框
scannerView.drawResultBitmap(barcode);
beepManager.playBeepSoundAndVibrate();
Toast.makeText(this,
"识别结果:" + ResultParser.parseResult(rawResult).toString(),
Toast.LENGTH_SHORT).show();
}
public void restartPreviewAfterDelay(long delayMS) {
if (handler != null) {
handler.sendEmptyMessageDelayed(R.id.restart_preview, delayMS);
}
resetStatusView();
}
public ScannerView getScannerView() {
return scannerView;
}
public Handler getHandler() {
return handler;
}
public CameraManager getCameraManager() {
return cameraManager;
}
private void resetStatusView() {
scannerView.setVisibility(View.VISIBLE);
lastResult = null;
}
public void drawViewfinder() {
scannerView.drawViewfinder();
}
private void initCamera(SurfaceHolder surfaceHolder) {
if (surfaceHolder == null) {
throw new IllegalStateException("No SurfaceHolder provided");
}
if (cameraManager.isOpen()) {
Log.w(TAG,
"initCamera() while already open -- late SurfaceView callback?");
return;
}
try {
cameraManager.openDriver(surfaceHolder);
// Creating the handler starts the preview, which can also throw a
// RuntimeException.
if (handler == null) {
handler = new CaptureActivityHandler(this, decodeFormats,
decodeHints, characterSet, cameraManager);
}
decodeOrStoreSavedBitmap(null, null);
} catch (IOException ioe) {
Log.w(TAG, ioe);
displayFrameworkBugMessageAndExit();
} catch (RuntimeException e) {
// Barcode Scanner has seen crashes in the wild of this variety:
// java.?lang.?RuntimeException: Fail to connect to camera service
Log.w(TAG, "Unexpected error initializing camera", e);
displayFrameworkBugMessageAndExit();
}
}
/**
* 向CaptureActivityHandler中发送消息,并展示扫描到的图像
*
* @param bitmap
* @param result
*/
private void decodeOrStoreSavedBitmap(Bitmap bitmap, Result result) {
// Bitmap isn't used yet -- will be used soon
if (handler == null) {
savedResultToShow = result;
} else {
if (result != null) {
savedResultToShow = result;
}
if (savedResultToShow != null) {
Message message = Message.obtain(handler,
R.id.decode_succeeded, savedResultToShow);
handler.sendMessage(message);
}
savedResultToShow = null;
}
}
private void displayFrameworkBugMessageAndExit() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getString(R.string.app_name));
builder.setMessage("抱歉,Android相机出现问题。您可能需要重启设备。");
builder.setPositiveButton("确定", new FinishListener(this));
builder.setOnCancelListener(new FinishListener(this));
builder.show();
}
@Override
public void onClick(View v) {
int i = v.getId();
if (i == R.id.capture_scan_photo) {// 打开手机中的相册
Intent innerIntent = new Intent(Intent.ACTION_GET_CONTENT); // "android.intent.action.GET_CONTENT"
innerIntent.setType("image/*");
Intent wrapperIntent = Intent.createChooser(innerIntent,
"选择二维码图片");
this.startActivityForResult(wrapperIntent, REQUEST_CODE);
} else if (i == R.id.capture_flashlight) {
if (isFlashlightOpen) {
cameraManager.setTorch(false); // 关闭闪光灯
isFlashlightOpen = false;
} else {
cameraManager.setTorch(true); // 打开闪光灯
isFlashlightOpen = true;
}
} else if (i == R.id.capture_button_cancel) {
if ((source == IntentSource.NONE) && lastResult != null) { // 重新进行扫描
restartPreviewAfterDelay(0L);
}
} else {
}
}
}
| [
"[email protected]"
] | |
a4be90212271a71e2db7f8f19a9119ae28d72385 | 22527752ed4f2a6f54b507c9aaa193783fc0e6fc | /app/src/main/java/com/webabcd/androiddemo/view/button/ImageButtonDemo1.java | c4c68a8151f7bdfb35960b103ceb9ac99de59b75 | [] | no_license | webabcd/AndroidDemo | 1a9df344999548fde70cf32dd5677b045fd57d7f | 02031106c66b359162f32f6564c557f708cea593 | refs/heads/master | 2023-08-04T11:23:22.189782 | 2023-07-26T03:06:16 | 2023-07-26T03:06:16 | 153,596,772 | 36 | 8 | null | null | null | null | UTF-8 | Java | false | false | 1,387 | java | /**
* ImageButton - 图片按钮控件(继承自 ImageView)
* setClickable(boolean clickable) - 指定按钮是否可单击(如果要指定为 false 的话,需要在 setOnClickListener() 方法之后指定才会生效)
* setOnClickListener(OnClickListener l) - 指定单击事件的回调
*
*
* ImageButton 和 Button 差不多(就是基类不一样,一个是 TextView 一个是 ImageView),详见 Button 的介绍吧
*/
package com.webabcd.androiddemo.view.button;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.Toast;
import com.webabcd.androiddemo.R;
public class ImageButtonDemo1 extends AppCompatActivity {
private ImageButton _imageButton1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_button_imagebuttondemo1);
_imageButton1 = (ImageButton) findViewById(R.id.imageButton1);
sample();
}
private void sample() {
_imageButton1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(ImageButtonDemo1.this, "imageButton1 clicked", Toast.LENGTH_SHORT).show();
}
});
}
}
| [
"[email protected]"
] | |
dc53950d060cf4574c634a72b0da3f0332beabb8 | 9d992366138e5c43e9dc0a196ee5f1ce9e401e3e | /src/merchants/service/inter/canvassGroup/ProjectGroupService.java | 4c28787614b69216fafad854ed79f838556a7905 | [] | no_license | lovinghome/mechants | 5f186127b076490a2afd1c2e3c6ffe3f1852671e | 09a48961e91144b13bcfef2246e0e96872cf5108 | refs/heads/master | 2021-05-28T21:55:13.470490 | 2015-05-07T01:39:14 | 2015-05-07T01:48:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 202 | java | package merchants.service.inter.canvassGroup;
import merchants.entity.canvassGroup.ProjectGroup;
import merchants.service.base.DAO;
public interface ProjectGroupService extends DAO<ProjectGroup> {
}
| [
"[email protected]"
] | |
548897c1d072436a8e5647ac60ccecc1e815f7db | 7e7aca21cae5521fe211b54bc0ec2e376872f77b | /src/main/java/online/mengxun/server/controller/DbSelectController.java | e21647b7ebacf856fe537ed5c5cbaad0f89fd650 | [] | no_license | aaha-star/cxsj4 | c73b05cb8923d06ab585a7433379b602416c17ad | 119df77a131e108b9ade115bde99116ccd6cd1ed | refs/heads/master | 2023-03-28T02:46:26.465555 | 2021-03-22T17:06:06 | 2021-03-22T17:06:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,634 | java | package online.mengxun.server.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import online.mengxun.server.client.DatabaseClient;
import online.mengxun.server.entity.DbConfig;
import online.mengxun.server.entity.DbDriver;
import online.mengxun.server.entity.DbSearchRecord;
import online.mengxun.server.model.DbSelectModel;
import online.mengxun.server.reposity.DbConfigRepository;
import online.mengxun.server.reposity.DbDriverRepository;
import online.mengxun.server.reposity.DbSearchRecordRepository;
import online.mengxun.server.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.sql.Connection;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@Api(tags = "数据库查询模块")
@RestController
@RequestMapping("/select")
public class DbSelectController {
@Autowired
private DbConfigRepository dbConfigRepository;
@Autowired
private DbDriverRepository dbDriverRepository;
@Autowired
private DbSearchRecordRepository dbSearchRecordRepository;
@ApiOperation(value = "获取查询结果")
@PostMapping("/")
public Response getSelectResult(@RequestHeader("Authorization") String openId, @Valid @RequestBody DbSelectModel.GetSelectResult select){
try{
String dbId = select.getDbId();
String srSql = select.getSrSql();
//数据库id校验
if (!dbConfigRepository.existsById(dbId)) {
return Response.error("该数据库配置不存在");
}
if (!dbConfigRepository.existsByDbIdAndOpenId(dbId,openId)){
return Response.error("您没有获取数据库的配置信息的权限");
}
//数据库语句校验,只能查询
if(!select.getSrSql().substring(0,6).equalsIgnoreCase("SELECT")){
return Response.error("只能提交select语句");
}
DbConfig dbConfig = dbConfigRepository.getOne(dbId);
DbDriver dbDriver = dbDriverRepository.getOne(dbConfig.getDbDriverId());
DbSearchRecord dbSearchRecord = new DbSearchRecord();
Connection conn = DatabaseClient.getConnection(dbConfig.getDbIp(),dbConfig.getDbPort().toString(),dbConfig.getDbName(),dbConfig.getDbUser(),dbConfig.getDbPwd(),dbDriver.getDriverName(),dbDriver.getDriverType());
if (conn == null){
dbSearchRecord.setSrId(UUID.randomUUID().toString());
dbSearchRecord.setSrConnected(false);
dbSearchRecord.setOpenId(openId);
dbSearchRecord.setSrSql(srSql);
dbSearchRecord.setCreated(new Date());
dbSearchRecord.setSrResult(false);
dbSearchRecordRepository.save(dbSearchRecord);
return Response.error("数据库连接失败");
}
List selectResultData = DatabaseClient.selectData(conn,srSql);
System.out.println(selectResultData);
dbSearchRecord.setSrId(UUID.randomUUID().toString());
dbSearchRecord.setSrConnected(true);
dbSearchRecord.setOpenId(openId);
dbSearchRecord.setSrSql(srSql);
dbSearchRecord.setCreated(new Date());
dbSearchRecord.setSrResult(true);
dbSearchRecordRepository.save(dbSearchRecord);
return Response.success("查询成功",selectResultData);
}catch (Exception e){
e.printStackTrace();
return Response.error("查询失败");
}
}
}
| [
"[email protected]"
] | |
344e7b0c234fa4612e16271a3e96075a904ed953 | f587402b4f84d31432e30ef863b5a0b25c49726d | /runtime/src/main/java/io/quarkiverse/hibernate/types/jackson/JsonNodeBinaryType.java | d30fd372c70856d39cb699e35f24503b70593ec6 | [
"Apache-2.0"
] | permissive | Becheslav/quarkus-hibernate-types | b853fd934ea5796ee70d8eecf891adef47ebffac | 35b9f0b1f2e7f8c4c575646994fcfcc9b516afcf | refs/heads/master | 2023-07-06T21:57:27.989316 | 2021-05-03T16:55:28 | 2021-05-03T16:55:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,069 | java | package io.quarkiverse.hibernate.types.jackson;
import org.hibernate.type.AbstractSingleColumnStandardBasicType;
import com.fasterxml.jackson.databind.JsonNode;
import io.quarkiverse.hibernate.types.json.JsonTypes;
import io.quarkiverse.hibernate.types.json.impl.JsonBinarySqlTypeDescriptor;
import io.quarkiverse.hibernate.types.json.impl.JsonObjectTypeDescriptor;
/**
* Maps a JSON {@link JsonNode} object on a JSON column type that is managed via
* {@link java.sql.PreparedStatement#setObject(int, Object)} at JDBC Driver level. For instance, if you are using PostgreSQL,
* you should be using {@link JsonNodeBinaryType} to map both {@code jsonb} and {@code json} column types to a Jackson
* {@link JsonNode} object.
*/
public class JsonNodeBinaryType extends AbstractSingleColumnStandardBasicType<JsonNode> {
public JsonNodeBinaryType() {
super(JsonBinarySqlTypeDescriptor.INSTANCE,
new JsonObjectTypeDescriptor<JsonNode>(JsonNode.class));
}
public String getName() {
return JsonTypes.JSON_OBJECT_BIN;
}
}
| [
"[email protected]"
] | |
f95c233e2ebdab510837efb2d216a62b8dcedbd7 | 73ea34707ec3b36824ef026eb06b31e36ce8b91a | /src/org/lynxlake/_11JavaAdvancedWorkshopGameDemo/gameApp/models/tanks/Tank.java | 19bc7b816173cd87ff309d70c2434fbe008417c4 | [] | no_license | plamen911/java-advanced | 72fb5d2d0f40a0b835cb892311e9210604aa2e55 | 310def9ae534909158a0c09dd1f88ebc814ce9be | refs/heads/master | 2021-01-12T04:40:50.023548 | 2017-05-03T09:12:11 | 2017-05-03T09:12:11 | 77,708,419 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 848 | java | package org.lynxlake._11JavaAdvancedWorkshopGameDemo.gameApp.models.tanks;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
public abstract class Tank {
private int x;
private int y;
private ImageView currentImage;
public Tank(int x, int y) {
this.x = x;
this.y = y;
}
public abstract void draw(GraphicsContext graphicsContext);
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public ImageView getCurrentImage() {
return currentImage;
}
public void setCurrentImage(Image currentImage) {
this.currentImage = new ImageView(currentImage);
}
}
| [
"1"
] | 1 |
fd964b02eb8ccf1a824ead48dbf2001a61febb02 | e29a4267310dd8a3177d7b3d759500ec74c84929 | /src/main/java/org/bytediff/util/DiffyShortcuts.java | 54618cf3401e46d7c9eefa825e4bf8473642382b | [
"Apache-2.0"
] | permissive | dgawlik/diffy | ce5ac0d78701f3dad72dbf4bd5e2d392f56fa9d9 | 0c58ed842cc9aeed9c1e95c4a5ce28ee7ca58cf1 | refs/heads/main | 2023-02-19T13:30:12.870469 | 2021-01-23T20:17:53 | 2021-01-23T20:17:53 | 330,490,998 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,000 | java | package org.bytediff.util;
import org.bytediff.engine.Diff;
import org.bytediff.engine.DiffInfo;
import org.bytediff.engine.DiffInfo.DiffType;
import org.bytediff.print.Printer;
import org.bytediff.print.enc.RawValueEncoder;
import org.bytediff.print.fmt.AnsiColorFormatter;
public class DiffyShortcuts {
public static void log(String source, String target) {
DiffInfo info = Diff.compute(source.toCharArray(), target.toCharArray());
Printer p = Printer.from(info);
System.out.println(p.print());
}
public static void logVerbose(String source, String target) {
DiffInfo info = Diff.compute(source.toCharArray(), target.toCharArray());
Printer p = Printer.from(info).verbose();
System.out.println(p.print());
}
public static void logColors(String source, String target) {
DiffInfo info = Diff.compute(source.toCharArray(), target.toCharArray());
Printer p = Printer.from(info).withFormatter(new AnsiColorFormatter());
System.out.println(p.print());
}
public static void log(byte[] source, byte[] target, int radix) {
char[] sourceC = Raw.bytesToChars(source);
char[] targetC = Raw.bytesToChars(target);
DiffInfo info = Diff.compute(sourceC, targetC);
Printer p = Printer.from(info).withEncoding(new RawValueEncoder(radix));
System.out.println(p.print());
}
public static void logVerbose(byte[] source, byte[] target, int radix) {
char[] sourceC = Raw.bytesToChars(source);
char[] targetC = Raw.bytesToChars(target);
DiffInfo info = Diff.compute(sourceC, targetC);
Printer p = Printer.from(info)
.withEncoding(new RawValueEncoder(radix))
.verbose();
System.out.println(p.print());
}
public static void logColor(byte[] source, byte[] target, int radix) {
char[] sourceC = Raw.bytesToChars(source);
char[] targetC = Raw.bytesToChars(target);
DiffInfo info = Diff.compute(sourceC, targetC);
Printer p = Printer.from(info)
.withEncoding(new RawValueEncoder(radix))
.withFormatter(new AnsiColorFormatter())
.verbose();
System.out.println(p.print());
}
public static void assertEquals(String source, String target) {
DiffInfo info = Diff.compute(source.toCharArray(), target.toCharArray());
if (info.getDiff().size() == 1
&& info.getDiff().get(0).getDiffType() == DiffType.MATCH) {
return;
}
Printer p = Printer.from(info);
throw new AssertionError("Diffy match failed\n" + p.print());
}
public static void assertEquals(byte[] source, byte[] target, int radix) {
char[] sourceC = Raw.bytesToChars(source);
char[] targetC = Raw.bytesToChars(target);
DiffInfo info = Diff.compute(sourceC, targetC);
if (info.getDiff().size() == 1
&& info.getDiff().get(0).getDiffType() == DiffType.MATCH) {
return;
}
Printer p = Printer.from(info)
.withEncoding(new RawValueEncoder(radix));
throw new AssertionError("Diffy match failed\n" + p.print());
}
}
| [
"[email protected]"
] | |
7e4a30ac1bcc8b74dc6e743f7eb2709167f86f63 | 6addc4491cf5ad20ae750ef79fe5a38f52220dfe | /DesignPattern/ProxyMethod/cglibProxy/Client.java | ccbef72bc71653d52579a3439a9c5f2b8c11ba70 | [] | no_license | squirrelSun/FullStack_Demo | 890db190c51e8a69ab5f5cfce26c2db8a7d213f0 | cbff2b25a7ca149d4b4e80387bbc92902f38c1e7 | refs/heads/master | 2020-09-16T18:45:12.289536 | 2020-04-17T00:06:48 | 2020-04-17T00:06:48 | 223,856,109 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 554 | java | package ProxyMethod.cglibProxy;
public class Client {
public static void main(String[] args) {
// TODO Auto-generated method stub
// 创建目标对象
TeacherDao target = new TeacherDao();
// 获取到代理对象,并且将目标对象传递给代理对象
TeacherDao proxyInstance = (TeacherDao) new ProxyFactory(target).getProxyInstance();
// 执行代理对象的方法,触发intercept 方法,从而实现 对目标对象的调用
String res = proxyInstance.teach();
System.out.println("res=" + res);
}
}
| [
"[email protected]"
] | |
48fd5ac4379900ce7ef3b4af2b558d84b8b42245 | 73a251b54f1bc127dd5214c090d9a777bcf88190 | /FinanceManagerH/src/main/java/ru/kotovalexandr/financemanager/Model/Account.java | e9c09858530078d157d56f9d137babe6afbf42e5 | [] | no_license | vasap87/git-repo | 1a83f5fd26363692a485c0c7e03eeee57e269456 | 8b5e27b5e60c6dac29f69c4d732bf2ca906e2713 | refs/heads/master | 2021-01-23T14:05:37.039116 | 2017-08-24T14:31:56 | 2017-08-24T14:31:56 | 57,288,209 | 0 | 0 | null | 2016-05-31T15:10:20 | 2016-04-28T09:25:33 | Java | UTF-8 | Java | false | false | 2,307 | java | package ru.kotovalexandr.financemanager.Model;
import javax.persistence.*;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* Created by admin on 12.07.2016.
*/
@Entity
@Table(name = "ACCOUNTS")
public class Account implements Serializable {
@Id
@GeneratedValue (strategy = GenerationType.AUTO)
@Column(name = "ID")
private int id;
@Column(name = "NUMBER")
private String number;
@Column(name = "AMOUNT")
private BigDecimal amount = new BigDecimal(0);
@ManyToOne
@JoinColumn(name = "USER_ID")
private User user;
@Column(name = "DESCR")
private String description;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "account", cascade = CascadeType.REMOVE)
private List<Transaction> transactionList = new ArrayList<>();
public Account() {
}
public Account(String number, User user, String description){
this.number = number;
this.id=-1;
this.description = description;
this.user = user;
user.addAccount(this);
}
public Account(int id, String number, User user, String description) {
this(number,user,description);
this.id = id;
}
public void setNumber(String number) {
this.number = number;
}
public void setDescription(String description) {
this.description = description;
}
public String getNumber() {
return number;
}
public BigDecimal getAmount() {
return amount;
}
public int getUserId() {
return user.getId();
}
public void setId(int id) {
this.id = id;
}
public int getId() {
return id;
}
public String getDescription() {
return description;
}
public List<Transaction> getTransactionList() {
return transactionList;
}
public void updateAmmount() {
for (Transaction transaction : transactionList) {
if(transaction.isCheckIn()){
amount = amount.add(transaction.getAmount());
}else{
amount = amount.subtract(transaction.getAmount());
}
}
}
}
| [
"[email protected]"
] | |
95172aeb7949828f4804a551cf3c145ca910f38a | f63f06e3b307820f6264ce8b39d6b00e611df711 | /src/main/java/com/biteit/rsocket/responder/adapter/cdm/ReadingRequest.java | b10faadbd6fb162a9a3b188e702fafe52ded888e | [] | no_license | lukaszpy/rsocket-responder | 4bf187b0dc546e2a5df4f5cd437dfd9ad61ff566 | 88e82b291617eb6248c04074cc4acf85d30df284 | refs/heads/master | 2022-08-31T11:47:40.675629 | 2020-05-21T12:06:40 | 2020-05-21T12:06:40 | 265,838,166 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 244 | java | package com.biteit.rsocket.responder.adapter.cdm;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ReadingRequest {
private String worksId;
}
| [
"[email protected]"
] | |
9fa144a2665a8e73a4d01b007eb149a098fa10eb | 839534266563361586d97cca6b9cd0e080b70184 | /idp/src/main/java/com/gaosai/idp/util/DateUtil.java | e472ed53859f0f9fe835ac1ef747941778fcc91e | [] | no_license | gaosai01/idp-sso | cba8cffe647351fa47cb104b704661322b37ad9d | 31311bfa3bf6e4915cfea321c8dbec6ba35429fa | refs/heads/master | 2021-09-20T05:36:23.981745 | 2018-08-04T10:52:23 | 2018-08-04T10:52:23 | 99,469,771 | 13 | 6 | null | null | null | null | UTF-8 | Java | false | false | 5,939 | java | package com.gaosai.idp.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class DateUtil {
public static String getCurTime(){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Long time = Long.valueOf( getCurTimeStamp() + "000" );
String d = format.format(time);
return d;
}
public static String getCurTime1(){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
Long time = Long.valueOf( getCurTimeStamp() + "000" );
String d = format.format(time);
return d;
}
public static int getCurTimeStamp(){
return (int)( System.currentTimeMillis() / 1000 );
}
public static String getTimeFromTimeStamp( int l ){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
Long time = Long.valueOf( l + "000" );
String d = format.format(time);
return d;
}
public static String getDateFromTimeStamp( int l ){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Long time = Long.valueOf( l + "000" );
String d = format.format(time);
return d;
}
public static int getTimeStampFromTime( String time ) throws ParseException {
SimpleDateFormat simpleDateFormat =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date=simpleDateFormat .parse( time );
int timeStemp = (int)( date.getTime() / 1000 );
return timeStemp;
}
public static int getTimeStampFromDate( String time ) throws ParseException {
SimpleDateFormat simpleDateFormat =new SimpleDateFormat("yyyy-MM-dd");
Date date=simpleDateFormat .parse( time );
int timeStemp = (int)( date.getTime() / 1000 );
return timeStemp;
}
public static String formatData( String all ){
String ans = "";
SimpleDateFormat format = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
Date date = null;
try {
date = format.parse(all);
}catch ( Exception e ){
return all;
}
Calendar calendar = Calendar.getInstance();
calendar.setTime( date );
int oldY = calendar.get( Calendar.YEAR ),
oldM = calendar.get( Calendar.MONTH ),
oldDay = calendar.get( Calendar.DAY_OF_MONTH );
Calendar newCa = Calendar.getInstance();
int newY = newCa.get( Calendar.YEAR ),
newM = newCa.get( Calendar.MONTH ),
newD = newCa.get( Calendar.DAY_OF_MONTH );
if( oldY == newY &&
oldM == newM &&
oldDay == newD ){
format = new SimpleDateFormat( "HH:mm" );
ans = format.format( date );
}else{
format = new SimpleDateFormat( "MM-dd" );
ans = format.format( date );
}
return ans;
}
public static String _format( String all ){
SimpleDateFormat format = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
Date date = null;
try {
date = format.parse(all);
}catch ( Exception e ){
return all;
}
SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
String dateString = formatter.format(date);
return dateString;
}
// 获得某天0点时间
public static int getTimesmorning( int timestamp ) {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis( timestamp );
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.MILLISECOND, 0);
return (int) (cal.getTimeInMillis() / 1000);
}
// 获得当天0点时间
public static int getTimesmorning() {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.MILLISECOND, 0);
return (int) (cal.getTimeInMillis() / 1000);
}
// 获得当天24点时间
public static int getTimesnight() {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, 24);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.MILLISECOND, 0);
return (int) (cal.getTimeInMillis() / 1000);
}
// 获得本周一0点时间
public static int getTimesWeekmorning() {
Calendar cal = Calendar.getInstance();
cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
return (int) (cal.getTimeInMillis() / 1000);
}
// 获得本周日24点时间
public static int getTimesWeeknight() {
Calendar cal = Calendar.getInstance();
cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
return (int) ((cal.getTime().getTime() + (7 * 24 * 60 * 60 * 1000)) / 1000);
}
// 获得本月第一天0点时间
public static int getTimesMonthmorning() {
Calendar cal = Calendar.getInstance();
cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
return (int) (cal.getTimeInMillis() / 1000);
}
// 获得本月最后一天24点时间
public static int getTimesMonthnight() {
Calendar cal = Calendar.getInstance();
cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
cal.set(Calendar.HOUR_OF_DAY, 24);
return (int) (cal.getTimeInMillis() / 1000);
}
public static int getMonth(){
Calendar cal = Calendar.getInstance();
int month = cal.get(Calendar.MONTH) + 1;
return month;
}
public static int getYear(){
Calendar cal = Calendar.getInstance();
int month = cal.get(Calendar.YEAR);
return month;
}
public static int getMonthDay(){
Calendar cal = Calendar.getInstance();
int dom = cal.get(Calendar.DAY_OF_MONTH);
return dom;
}
public static int getMonthLastDay( int m ){
if( m == 2 ){
return 28;
}
if( m == 1 || m == 3 || m== 5 || m == 7|| m== 8 || m== 10|| m== 12 ){
return 31;
}
return 30;
}
}
| [
"[email protected]"
] | |
be2f2a8f5744389ca60afc8b3e0e0043f24614d7 | 6f98892c3a43823bb28dc03dd1516fae96c56807 | /Wechat/app/src/main/java/dao/bean/NewsRecord.java | 54c61b94a0250a4a6c5e4e34e686088104d5a903 | [] | no_license | ILMFF/wechat | a07d2b4899b7e64fb801cd5e48ce8c4e1cf0b4b0 | 9b7613ae8f0079c1483b2e2c86c5532beb1a8d91 | refs/heads/master | 2020-06-21T00:57:12.300403 | 2017-06-13T10:41:29 | 2017-06-13T10:41:29 | 94,199,220 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 881 | java | package dao.bean;
/**
* Created by Administrator on 2017/3/8.
*/
public class NewsRecord {
public String SenderName;
public String SenderNickName;
public String SenderIcon;
public String Content;
public String CreateTime;
public String ContentFrom;
public String ChatRoom_ornot; //是否是群聊信息
public String MemberSender; //具体是群的哪位成员发送
public NewsRecord(String senderName, String senderNickName, String senderIcon, String content, String createTime, String contentFrom, String chatRoom_ornot, String memberSender) {
SenderName = senderName;
SenderNickName = senderNickName;
SenderIcon = senderIcon;
Content = content;
CreateTime = createTime;
ContentFrom = contentFrom;
ChatRoom_ornot = chatRoom_ornot;
MemberSender = memberSender;
}
}
| [
"[email protected]"
] | |
97bd1ebc7ceb088593faa11eb79b5366e8c635e3 | 6204f5ca7682f56ba7aeaa5c466cf60173dca76e | /PPMToolFullStack/src/main/java/com/example/ppmtool/web/UserController.java | b8908981d9453162278cb882111ac10170496307 | [] | no_license | dbitrun/AgilePPMTool | f60bfe9659c5ace5d45adc4dc5477a913c6fd021 | 705ab84f1b22bab1869c2a8a74365e8f87d4af28 | refs/heads/master | 2020-04-26T15:21:18.451251 | 2019-04-01T17:29:11 | 2019-04-01T17:29:11 | 173,644,568 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,930 | java | package com.example.ppmtool.web;
import com.example.ppmtool.domain.User;
import com.example.ppmtool.payload.JWTLoginSuccessResponse;
import com.example.ppmtool.payload.LoginRequest;
import com.example.ppmtool.security.JwtTokenProvider;
import com.example.ppmtool.services.MapValidationErrorService;
import com.example.ppmtool.services.UserService;
import com.example.ppmtool.validator.UserValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import static com.example.ppmtool.security.SecurityConstants.TOKEN_PREFIX;
@RestController
@RequestMapping("/api/users")
public class UserController {
@Autowired
private MapValidationErrorService mapValidationErrorService;
@Autowired
private UserService userService;
@Autowired
private UserValidator userValidator;
@Autowired
private JwtTokenProvider tokenProvider;
@Autowired
private AuthenticationManager authenticationManager;
@PostMapping("/login")
public ResponseEntity<?> authenticateUser(@Valid @RequestBody LoginRequest loginRequest, BindingResult result) {
ResponseEntity<?> errorMap = mapValidationErrorService.mapValidationService(result);
if (errorMap != null) return errorMap;
Authentication authentication = authenticationManager.authenticate(
new UsernamePasswordAuthenticationToken(
loginRequest.getUsername(),
loginRequest.getPassword()
)
);
SecurityContextHolder.getContext().setAuthentication(authentication);
String jwt = TOKEN_PREFIX + tokenProvider.generateToken(authentication);
return ResponseEntity.ok(new JWTLoginSuccessResponse(true, jwt));
}
@PostMapping("/register")
public ResponseEntity<?> registerUser(@Valid @RequestBody User user, BindingResult result) {
// Validate passwords match
userValidator.validate(user, result);
ResponseEntity<?> errorMap = mapValidationErrorService.mapValidationService(result);
if (errorMap != null) return errorMap;
User newUser = userService.saveUser(user);
return new ResponseEntity<User>(newUser, HttpStatus.CREATED);
}
}
| [
"[email protected]"
] | |
235183de615e7b5086f4e2100e8ea72b6d7384fd | 6f10074fe420df29a9ea5d9eabb58f622602ffaf | /src/main/java/hanakishopping/OrderForm.java | 3644eba4b20fe32495d99b45f209ea6090a3af27 | [] | no_license | hanakiy/webjava__1 | 928f19ce914d939155a2f5cc82e5541333f1ea2b | ef5ef33c08f5d0e2768298622c6a9e92e69c3750 | refs/heads/master | 2020-03-21T08:49:26.190180 | 2018-06-23T03:18:40 | 2018-06-23T03:18:40 | 138,367,474 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 58 | java | package hanakishopping;
public class OrderForm {
}
| [
"systena@PCK-136-275"
] | systena@PCK-136-275 |
e69681f37e38059f63835981eb4c033575150591 | 7b26ca553dddfb0dbcfcfce6c317ace6c8bcef3c | /CompiladorCmenos/src/Cmenos/node/TWhile.java | ba802171d995e873e0074283c13ff30b14ede070 | [] | no_license | arquimago/compilador | 7adce6673b72200f568b2986fa9934969fe24337 | c64a21064bfa1354b4ae21c81bcaafa428ee158c | refs/heads/master | 2021-01-17T05:19:58.608978 | 2016-05-14T01:45:36 | 2016-05-14T01:45:36 | 50,127,731 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 736 | java | /* This file was generated by SableCC (http://www.sablecc.org/). */
package Cmenos.node;
import Cmenos.analysis.*;
@SuppressWarnings("nls")
public final class TWhile extends Token
{
public TWhile()
{
super.setText("while");
}
public TWhile(int line, int pos)
{
super.setText("while");
setLine(line);
setPos(pos);
}
@Override
public Object clone()
{
return new TWhile(getLine(), getPos());
}
@Override
public void apply(Switch sw)
{
((Analysis) sw).caseTWhile(this);
}
@Override
public void setText(@SuppressWarnings("unused") String text)
{
throw new RuntimeException("Cannot change TWhile text.");
}
}
| [
"[email protected]"
] | |
4fa7e8527719d8938f3f92bc397742eb27e23dd7 | 9bc270e8a8f71750424ef2cbf8b12c6cb39ee138 | /test/src/coreJava/SequenceOfExecution.java | 7258d2d9552ddc264558672506b550c54cb067e6 | [] | no_license | Sitabja/Data_Structure_Algorithm | 66788cd7df98a1b37ab98a1133c8a9360c693f3a | 8ecd7013b9ba158ad78aeec5c2440f6b706bc902 | refs/heads/master | 2021-09-06T05:13:03.060810 | 2018-02-02T16:49:12 | 2018-02-02T16:49:12 | 109,490,356 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 691 | java | package coreJava;
public class SequenceOfExecution {
public static void main(String[] args) {
System.out.println("inside main 1");
ParentClass p;
System.out.println("inside main 2");
p = new ChildClass();
ChildClass c = (ChildClass)p;
//ParentClass p2 = new ChildClass();
}
}
class ParentClass{
static{
System.out.println("parent static");
}
{
System.out.println("parent non static");
}
public ParentClass(){
System.out.println("parent constructor");
}
}
class ChildClass extends ParentClass{
static{
System.out.println("Child static");
}
{
System.out.println("Child non static");
}
public ChildClass(){
System.out.println("Child constructor");
}
}
| [
"[email protected]"
] | |
64471f2beb3317c3ba7aebb14a58b34a7e6645eb | 8f44d55533bb099d0eded35baef8af9df2682fbf | /src/main/java/de/hterhors/obie/core/tools/pdfToText/pdf2htmlex/Pdf2HtmlExExtractionInteractive.java | 1c30f3a72ca51674cbc530df0735aba55fbbde03 | [
"Apache-2.0"
] | permissive | hterhors/OBIECore | 77ac50c9c366b3398409ee96cce2cf2b80483166 | c0a06223db68638f3e81ffc4a2d02eb51b339b41 | refs/heads/master | 2020-03-28T14:17:34.002186 | 2019-03-29T10:25:09 | 2019-03-29T10:25:09 | 148,474,265 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,502 | java | package de.hterhors.obie.core.tools.pdfToText.pdf2htmlex;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.file.Files;
import java.text.Normalizer;
import java.text.Normalizer.Form;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.Node;
import org.jsoup.nodes.TextNode;
public class Pdf2HtmlExExtractionInteractive {
static final Pattern fontSizePattern = Pattern.compile("(fs[0123456789abcdef])");
static final Pattern fontFamilyPattern = Pattern.compile("(ff[0123456789abcdef])");
static final Pattern fontColorPattern = Pattern.compile("(fc[0123456789abcdef])");
static final Pattern spanTextPattern = Pattern.compile("<span class=\"(?<class>.*?)\">(?<text>.*?)<");
final static private String BAD_CHAR = "[^\\x20-\\x7E]+";
/**
* font name to base64
*
* ff0 = H4O2gKHjhFfjO489250//hfjgkdoj5638badlg ....
*/
static final private Map<String, String> fontToBase64 = new HashMap<>();
/**
* base64 to char mapping;
*/
static final private Map<String, Map<String, String>> base64ToCharMapping = new HashMap<>();
static private String textFontFamily;
public static void main(String[] args) throws IOException, InterruptedException {
final String file = "pdf2htmlex/res/html/Okutan et al.html";
final String mappingFileName = "pdf2htmlex/res/base64Mapping";
List<String> mappingList = Files.readAllLines(new File(mappingFileName).toPath());
mappingListToMap(mappingList);
Document doc = Jsoup.parse(new File(file), "utf-8");
extractFonts(fontToBase64, doc.html());
for (String thisBase64 : fontToBase64.values()) {
if (!base64ToCharMapping.containsKey(thisBase64)) {
base64ToCharMapping.put(thisBase64, new HashMap<>());
System.out.println("Add new font to mapping file... " + thisBase64.substring(0, 50) + "[...]");
} else {
System.out.println("Found font in mapping file... " + thisBase64.substring(0, 50) + "[...]");
}
}
textFontFamily = getTextSpecs(fontFamilyPattern, doc);
String textFontSize = getTextSpecs(fontSizePattern, doc);
String textFontColor = getTextSpecs(fontColorPattern, doc);
String currentFontFamily = null;
String currentFontSize = null;
String currentFontColor = null;
String lastNonTextFontSize = null;
String lastTextFontSize = null;
final StringBuffer documentText = new StringBuffer();
List<Element> elements = doc.body().getAllElements();
List<String> documentSentences = new ArrayList<>();
for (int i = 0; i < elements.size(); i++) {
Element element = elements.get(i);
Matcher fontFamily = fontFamilyPattern.matcher(element.attr("class"));
if (fontFamily.find()) {
currentFontFamily = fontFamily.group();
}
String text = listToString(cleanedTextChunks(currentFontFamily, element));
documentSentences.add(text);
if (text.trim().isEmpty())
continue;
System.out.println(text);
}
System.out.println("######DONE######");
Thread.sleep(1000);
for (int i = 0; i < elements.size(); i++) {
Element element = elements.get(i);
Matcher fontFamily = fontFamilyPattern.matcher(element.attr("class"));
Matcher fontSize = fontSizePattern.matcher(element.attr("class"));
Matcher fontColor = fontColorPattern.matcher(element.attr("class"));
if (fontFamily.find()) {
currentFontFamily = fontFamily.group();
}
if (fontSize.find()) {
currentFontSize = fontSize.group();
}
if (fontColor.find()) {
currentFontColor = fontColor.group();
}
if (currentFontFamily == null)
continue;
if (element.textNodes().isEmpty())
continue;
// System.out.println("element class types: " +
// element.attr("class"));
// System.out.println(element);
// System.out.println("___________");
// if (!currentFontFamily.equals(textFontFamily)) {
// documentText.append("");
// continue;
// }
// if (!currentFontSize.equals(textFontSize)) {
// documentText.append("");
// continue;
// }
String text = documentSentences.get(i);
// listToString(textNodes(currentFontFamily, element));
if (!text.trim().isEmpty()) {
// System.out.println("current line: " + currentFontFamily + " :
// " + text);
String delimiter = "";
String preDelimiter = "";
final String nextText = documentSentences.get(i + 1);
if (text.endsWith("-")) {
text = text.substring(0, text.length() - 1);
delimiter = "";
} else {
if (text.length() <= 3) {
// final String nextText =
// listToString(textNodes(currentFontFamily,
// elements.get(i + 1)));
if (nextText.length() <= 3) {
if (currentFontColor.equals(textFontColor)) {
delimiter = "";
} else {
delimiter = " ";
}
} else {
delimiter = "\n";
}
} else if (currentFontSize != null && currentFontSize.equals(textFontSize)) {
// final String nextText =
// listToString(textNodes(currentFontFamily,
// elements.get(i + 1)));
if (nextText.length() <= 3) {
if (currentFontColor.equals(textFontColor)) {
delimiter = " ";
} else {
delimiter = "\n";
}
} else {
delimiter = "\n";
}
} else if (currentFontSize != null && !currentFontSize.equals(lastTextFontSize)) {
preDelimiter = " ";
} else if (currentFontSize != null && currentFontSize.equals(lastNonTextFontSize)) {
delimiter = "\n";
} else {
delimiter = "\n";
}
if (currentFontSize != null && !currentFontSize.equals(textFontSize))
lastNonTextFontSize = currentFontSize;
}
lastTextFontSize = currentFontSize;
documentText.append(preDelimiter);
documentText.append(text);
documentText.append(delimiter);
}
}
System.out.println("Write data to mapping file...");
PrintStream mappingFilePrintStream = new PrintStream(new File("pdf2htmlex/res/base64Mapping"));
for (Entry<String, Map<String, String>> string : base64ToCharMapping.entrySet()) {
System.out.print(".");
Thread.sleep(80);
final String base64 = string.getKey();
mappingFilePrintStream.println("base64\t" + base64);
for (Entry<String, String> string2 : string.getValue().entrySet()) {
final String badChar = string2.getKey();
final String correctChar = string2.getValue();
mappingFilePrintStream.println(badChar + "\t" + correctChar);
}
mappingFilePrintStream.println();
mappingFilePrintStream.println();
}
System.out.println();
System.out.println("####DONE####");
System.out.println();
System.out.println();
// System.out.println(documentText);
}
private static void mappingListToMap(List<String> mappingList) {
String key = null;
String bytes = null;
String charMapping = null;
for (String line : mappingList) {
if (line.trim().isEmpty())
continue;
if (line.startsWith("base64")) {
key = line.split("\t")[1];
base64ToCharMapping.putIfAbsent(key, new HashMap<>());
} else {
bytes = line.split("\t")[0];
charMapping = line.split("\t").length == 2 ? line.split("\t")[1] : "";
base64ToCharMapping.get(key).put(bytes, charMapping);
}
}
}
static final private Pattern fontBase64Pattern = Pattern.compile(
"@font-face\\{font-family:(?<ff>ff[0-9abcdef]);src:url\\('data:application\\/font-woff;base64,(?<base64>.*)'\\)");
private static void extractFonts(Map<String, String> map, String html) {
Matcher matcher = fontBase64Pattern.matcher(html);
while (matcher.find()) {
final String fontFam = matcher.group("ff");
final String base64 = matcher.group("base64");
map.put(fontFam, base64);
}
}
private static String getTextSpecs(Pattern p, Document doc) {
Map<String, Integer> classCounter = new HashMap<>();
for (Element element : doc.body().getAllElements()) {
if (!element.getElementsByTag("div").isEmpty()) {
Matcher fontFamily = p.matcher(element.attr("class"));
if (!fontFamily.find())
continue;
String classString = fontFamily.group();
classCounter.put(classString, classCounter.getOrDefault(classString, 0) + 1);
}
}
int maxOccurrence = 0;
String textFontFamily = null;
for (Entry<String, Integer> classCount : classCounter.entrySet()) {
if (classCount.getValue() > maxOccurrence) {
maxOccurrence = classCount.getValue();
textFontFamily = classCount.getKey();
}
}
System.out.println("maxOccuringClass = " + textFontFamily);
classCounter.entrySet().forEach(System.out::println);
return textFontFamily;
}
private static String listToString(List<String> textNodes) {
final StringBuffer text = new StringBuffer();
for (String string : textNodes) {
text.append(Normalizer.normalize(string, Form.NFKC));
}
return text.toString();
}
public static List<String> cleanedTextChunks(final String currentFontFamily, Element element) {
List<String> textNodes = new ArrayList<>();
for (final Node node : element.childNodes()) {
if (node instanceof TextNode) {
// System.out.println("TextNode = " + node);
final String text = ((TextNode) node).getWholeText().replaceAll(" ", "");
if (text.matches(BAD_CHAR)) {
textNodes.add(mapChars(textNodes, currentFontFamily, text));
} else {
textNodes.add(text);
}
} else if (node instanceof Element) {
String text = ((Element) node).text();
if (!text.isEmpty()) {
final String fontSpecs = ((Element) node).attr("class");
Matcher m = fontFamilyPattern.matcher(fontSpecs);
if (m.find()) {
if (text.matches(BAD_CHAR)) {
textNodes.add(mapChars(textNodes, m.group(), text));
} else if (text.trim().length() == 1 && !m.group().equals(textFontFamily)) {
textNodes.add(mapChars(textNodes, m.group(), text));
} else {
textNodes.add(text);
}
} else {
textNodes.add(text);
}
} else {
Matcher textMatcher = spanTextPattern.matcher(((Element) node).toString());
final String fontSpecs = ((Element) node).attr("class");
Matcher m = fontFamilyPattern.matcher(fontSpecs);
final String fontFamily;
if (m.find()) {
fontFamily = m.group();
} else {
fontFamily = currentFontFamily;
}
if (textMatcher.find()) {
text = textMatcher.group("text");
if (text.isEmpty())
continue;
if (text.matches(BAD_CHAR)) {
textNodes.add(mapChars(textNodes, fontFamily, text));
} else if (text.trim().length() == 1 && !fontFamily.equals(textFontFamily)) {
textNodes.add(mapChars(textNodes, fontFamily, text));
} else {
textNodes.add(text);
}
}
}
}
}
return Collections.unmodifiableList(textNodes);
}
static boolean waitForInput = false;
static final Scanner input = new Scanner(System.in);
private static String mapChars(List<String> textNodes, String ff, String badChar) {
if (badChar.trim().isEmpty())
return badChar;
waitForInput = false;
if (!fontToBase64.containsKey(ff)) {
System.out.println("Could not find base64 string for font family name: " + ff);
waitForInput = true;
// return "<" + badChar + ">";
}
if (!base64ToCharMapping.containsKey(fontToBase64.get(ff))) {
System.out.println("Could not find base64 in mapping table: " + fontToBase64.get(ff));
waitForInput = true;
// return "<" + badChar + ">";
}
if (!base64ToCharMapping.get(fontToBase64.get(ff)).containsKey(badChar)) {
System.out.println("base64\t" + fontToBase64.get(ff));
System.out.println("Could not find mapping for bad char: " + badChar);
waitForInput = true;
// return "<" + badChar + ">";
}
final String context = listToString(textNodes);
System.out.println("In context: " + context);
if (waitForInput) {
System.out.println("Enter correct symbol:\n\n");
while (!input.hasNext()) {
}
String correctChar = input.next();
base64ToCharMapping.get(fontToBase64.get(ff)).put(badChar, correctChar);
System.out.println("Replace: '" + badChar + "' with " + "'" + correctChar + "'");
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return base64ToCharMapping.get(fontToBase64.get(ff)).get(badChar);
}
}
| [
"[email protected]"
] | |
8dd43d91307d035706c09db2d75bc6603e5d353e | 67152d41d60dde36fad044c757c6a1f6d824cc75 | /app/src/main/java/de/htw/ai/ema/network/ConnectionProperties.java | aeff13727c70d11059231423d3e088a8a628c774 | [] | no_license | pizzicariella/Li5a | 30a0b4c0c1c7007d5e5cfd1206f684823be51b32 | b8c3c1f0aba193658bd5dd032c09bee675789d10 | refs/heads/master | 2022-11-11T15:46:22.304640 | 2020-07-01T14:25:00 | 2020-07-01T14:25:00 | 264,468,603 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 805 | java | package de.htw.ai.ema.network;
import de.htw.ai.ema.network.bluetooth.BluetoothProperties;
import de.htw.ai.ema.network.service.handler.ConnectionHandler;
import de.htw.ai.ema.network.service.nToM.NToMConnectionHandler;
public class ConnectionProperties {
private static ConnectionProperties instance = null;
private ConnectionHandler conHandler = null;
private ConnectionProperties(String name){
this.conHandler = new NToMConnectionHandler(name);
}
public static synchronized ConnectionProperties getInstance(){
if(instance == null){
instance = new ConnectionProperties(BluetoothProperties.getInstance().getDeviceName());
}
return instance;
}
public ConnectionHandler getConHandler() {
return this.conHandler;
}
}
| [
"[email protected]"
] | |
2c52e5c93ed26447b0432e9fb6be5b8b70973fb4 | 2ae7dad68e3600e6a4fd6a380316d4bb1bd55ca7 | /teams/tankBotv3/Constants.java | e980f7bff093bb07f70fcb18717c9fc9f9637e23 | [] | no_license | kpeng94/shigatsu | 2e7e113de6d062a91b0a311eaa03c96744d7e840 | 6cfd81dd2a50321047334aff8184567b5ce04fcd | refs/heads/master | 2021-01-19T11:17:34.752822 | 2015-03-13T17:31:47 | 2015-03-13T17:31:47 | 28,466,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 660 | java | package tankBotv3;
public class Constants {
public static int NUM_OF_HELIPADS = 5;
public static int NUM_OF_INITIAL_HELIPADS = 1;
public static int NUM_OF_AEROSPACELABS = 5;
public static int NUM_OF_MINERS = 20;
public static int NUM_OF_BEAVERS = 1;
public static int NUM_OF_SUPPLYDEPOTS = 20;
public static int NUM_OF_MININGFACTORIES = 2;
public static int NUM_OF_TANKFACTORIES = 5;
public static int NUM_OF_INITIAL_BARRACKS = 1;
public static int MINER_ORE_THRESHOLD = 4;
public static int LAUNCHER_RUSH_COUNT = 6;
public static int TANK_RUSH_COUNT = 10;
public static int TOWER_SQDIST_THRESHOLD = 400;
}
| [
"[email protected]"
] | |
237c0ad8f007ce011f1d9fb1ee216fe117c5e771 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/JetBrains--intellij-community/ca4af156d60d34af82dedb36f7e4c786183ce8c9/before/MethodChainsSearchService.java | 7baa7435cd74503c1faad35776979a13211ffed7 | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,923 | java | package com.intellij.codeInsight.completion.methodChains.search;
import com.intellij.compilerOutputIndex.impl.MethodIncompleteSignature;
import com.intellij.compilerOutputIndex.impl.MethodsUsageIndex;
import com.intellij.compilerOutputIndex.impl.UsageIndexValue;
import com.intellij.compilerOutputIndex.impl.bigram.BigramMethodsUsageIndex;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiManager;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
/**
* @author Dmitry Batkovich <[email protected]>
*/
public class MethodChainsSearchService {
private final static SortedSet EMPTY_SORTED_SET = new TreeSet();
private final MethodsUsageIndex myMethodsUsageIndex;
private final BigramMethodsUsageIndex myBigramMethodsUsageIndex;
private final Project myProject;
public MethodChainsSearchService(final Project project) {
myMethodsUsageIndex = MethodsUsageIndex.getInstance(project);
myBigramMethodsUsageIndex = BigramMethodsUsageIndex.getInstance(project);
myProject = project;
}
public Project getProject() {
return myProject;
}
@NotNull
@SuppressWarnings("unchecked")
public SortedSet<UsageIndexValue> getBigram(final MethodIncompleteSignature methodIncompleteSignature) {
final TreeSet<UsageIndexValue> value = myBigramMethodsUsageIndex.getValues(methodIncompleteSignature);
if (value != null) {
return value;
}
return EMPTY_SORTED_SET;
}
@NotNull
@SuppressWarnings("unchecked")
public SortedSet<UsageIndexValue> getMethods(final String targetQName) {
final TreeSet<UsageIndexValue> value = myMethodsUsageIndex.getValues(targetQName);
if (value != null) {
return value;
}
return EMPTY_SORTED_SET;
}
public PsiManager getPsiManager() {
return PsiManager.getInstance(getProject());
}
} | [
"[email protected]"
] | |
7a9f18da5ef286af79da8c27f781a353e151e20c | f593f989f45f6134e13306720fc3f68e87f13034 | /app/src/main/java/com/iqoid/moovrika/MainActivity.java | 89d4984a224c97c5772fb89814490f1280d9e728 | [] | no_license | lgiulian/moovrika-webapp | 00903965b79a6ee44d78950a83b7ea7f5e64bae7 | ee5c6cb27edc12258db32d24ccd4310cb94e780b | refs/heads/master | 2021-01-20T16:50:20.267213 | 2017-05-10T10:17:13 | 2017-05-10T10:17:13 | 90,850,591 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,050 | java | package com.iqoid.moovrika;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.os.Build;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.RelativeLayout;
public class MainActivity extends AppCompatActivity {
private RelativeLayout fullScreenLayout;
private WebView mWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mWebView = (WebView) findViewById(R.id.activity_main_webview);
fullScreenLayout = (RelativeLayout)findViewById(R.id.fullscreen);
// Enable Javascript
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
// Force links and redirects to open in the WebView instead of in a browser
mWebView.setWebViewClient(new WebViewClient());
mWebView.setWebChromeClient(new MyWebChromeClient(this));
mWebView.loadUrl("https://moovrika.com/");
}
@Override
public void onBackPressed() {
if(mWebView.canGoBack()) {
mWebView.goBack();
} else {
super.onBackPressed();
}
}
public RelativeLayout getFullScreenLayout() {
return fullScreenLayout;
}
public void toggleFullscreen(boolean fullscreen) {
ActionBar actionBar = this.getSupportActionBar();
View decorView = getWindow().getDecorView();
int visibility = decorView.getSystemUiVisibility();
int fullscreenFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE |
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
if (Build.VERSION.SDK_INT >= 16) {
fullscreenFlags |= View.SYSTEM_UI_FLAG_FULLSCREEN |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
}
if (Build.VERSION.SDK_INT >= 19) {
fullscreenFlags |= View.SYSTEM_UI_FLAG_IMMERSIVE |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
}
if (fullscreen) {
visibility |= fullscreenFlags;
if (actionBar != null) actionBar.hide();
} else {
visibility &= ~fullscreenFlags;
if (actionBar != null) actionBar.show();
}
decorView.setSystemUiVisibility(visibility);
// Full-screen is used for playing videos.
// Allow sensor-based rotation when in full screen (even overriding user rotation preference)
if (fullscreen) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
} else {
setScreenOrientationPreference();
}
}
private void setScreenOrientationPreference() {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}
}
| [
"[email protected]"
] | |
19ea3ad20095cf956207424d1e037c94d4df2ded | 5ae3038438f9866f476797d1ef87d71c0a781f3a | /health_api/src/main/java/com/itheima/health/entity/Result.java | 3c2123aaaac5c6956b5d50236e0d951f12410eef | [] | no_license | syngebee/health | 7415e1765857609f439793d66fcf891ef6f32201 | 4414640ab8ec0f5ab43394de14f0179578d47057 | refs/heads/master | 2023-01-30T07:09:50.245082 | 2020-12-08T03:37:59 | 2020-12-08T03:37:59 | 301,422,932 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,004 | java | package com.itheima.health.entity;
import java.io.Serializable;
/**
* 封装返回结果
*/
public class Result implements Serializable{
private boolean flag;//执行结果,true为执行成功 false为执行失败
private String message;//返回结果信息
private Object data;//返回数据
public Result(boolean flag, String message) {
super();
this.flag = flag;
this.message = message;
}
public Result(boolean flag, String message, Object data) {
this.flag = flag;
this.message = message;
this.data = data;
}
public boolean isFlag() {
return flag;
}
public void setFlag(boolean flag) {
this.flag = flag;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}
| [
"[email protected]"
] | |
91d746c8107293e8c7825b569a7a99011e276d47 | ad9987a268c3d436e13be4140176942b7dda83b4 | /multiscreens/src/main/java/ph/ingenuity/multiscreens/fragment/MessageFragment.java | 21b322bf83c0ffae8e81b1d0d63a7e813b7ac8f2 | [] | no_license | gianina-ingenuity/adapter-views | 741ad08974ed28299856f44b1daf7a9a1fd88b8c | fdb958be496c2c069a3c690f6945ba3e99f04138 | refs/heads/master | 2021-01-11T16:27:21.834875 | 2016-01-04T10:35:07 | 2016-01-04T11:39:43 | 80,086,205 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 547 | java | package ph.ingenuity.multiscreens.fragment;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import ph.ingenuity.multiscreens.R;
/**
* @author aeroheart-c6
* @since 11/6/15
*/
public class MessageFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment__message, container, false);
}
}
| [
"[email protected]"
] | |
3886882749f46a7487e82b8fa412d7d1e1458db6 | 6783a4959dd02feac1edea0d1c85ee37ff8f9b4f | /common/src/main/java/com/tinytiger/common/net/data/gametools/GameCommentList.java | b5d4ac455c82643426d296689b98945e7e387c7f | [] | no_license | zhangwan/xiaohuplay_android | 9ada8c8a76e438edb0f9e06da98c6d0e90c009b7 | d397c86523b9d221038995b8feafe9395cc05e7b | refs/heads/master | 2022-12-04T03:39:38.287902 | 2020-08-28T02:49:06 | 2020-08-28T02:49:06 | 290,931,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,451 | java | package com.tinytiger.common.net.data.gametools;
import com.tinytiger.common.net.data.BaseBean;
import java.util.ArrayList;
import java.util.List;
public class GameCommentList extends BaseBean {
public Data data;
public class Data {
/**
* total : 0
* per_page : 10
* current_page : 1
* last_page : 0
* data : []
*/
private int total;
private int per_page;
private int current_page;
private int last_page;
private List<GameCommentBean> data;
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public int getPer_page() {
return per_page;
}
public void setPer_page(int per_page) {
this.per_page = per_page;
}
public int getCurrent_page() {
return current_page;
}
public void setCurrent_page(int current_page) {
this.current_page = current_page;
}
public int getLast_page() {
return last_page;
}
public void setLast_page(int last_page) {
this.last_page = last_page;
}
public List<GameCommentBean> getData() {
return data;
}
public void setData(List<GameCommentBean> data) {
this.data = data;
}
}
}
| [
"[email protected]"
] | |
261673969cae6606cfdcf8bc09c7c310c56eb7fa | 651dc071249005ba3b2faffc4dcdb1f87350d3a6 | /src/main/java/com/saler/service/SFCELoginService.java | abde68f5138191396e91452e38a060d3c4b18355 | [] | no_license | garrettLsy/saler | 5fc923cbdac3739c19b18e99d3d2e071f03b31de | f0257319ad2ec67ac619a6ba59cb049c7287e1a7 | refs/heads/master | 2020-04-16T12:36:44.165279 | 2019-04-03T08:46:42 | 2019-04-03T08:46:42 | 165,587,702 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,819 | java | package com.saler.service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.saler.config.PropertiesConfig;
import com.sforce.soap.enterprise.Connector;
import com.sforce.soap.enterprise.EnterpriseConnection;
import com.sforce.ws.ConnectionException;
import com.sforce.ws.ConnectorConfig;
public class SFCELoginService {
Logger logger=LoggerFactory.getLogger(getClass());
public EnterpriseConnection connection;
//读取链接
public EnterpriseConnection getconnection() {
if(this.connection!=null) {
return connection;
}else {
SFCDnewConnection();
return connection;
}
}
//SFCE登录
public void SFCDnewConnection() {
/*PropertiesConfig pc=new PropertiesConfig("./application.properties");
String userName=(String)pc.getProperties().getProperty("salesforce.userName");
String userPassWord=pc.getProperties().getProperty("salesforce.password");*/
/*String userName="[email protected]";
String userPassWord="demo12345PkYlAUnHjkfMV80KTCynK7Fpx";*/
String userName="[email protected]";
String userPassWord="A&G^N#19";
ConnectorConfig SFDCConfig = new ConnectorConfig();
try {
logger.debug(userName);
logger.debug(userPassWord);
SFDCConfig.setUsername(userName);
SFDCConfig.setPassword(userPassWord);
this.connection=Connector.newConnection(SFDCConfig);
} catch (ConnectionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
}
}
//断开SFCE链接
public void closeSFCE(EnterpriseConnection connection) {
try {
if(null!=connection) {
connection.logout();
}else {
return ;
}
} catch (ConnectionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
2905aa1bcf0cf54e50e2fe59572268790a4a4591 | 8b3821c480a27df5789ba94fc70c23e4bada6d29 | /src/main/java/dev/vnco/support/commons/handler/PlayerHandler.java | 4885dcdeb81f58f814aac23f63484f59c0a7f7f8 | [] | no_license | TomBonyPvP/Support | 7f13931c4280fe58f56bcb9f664e40481e4249d7 | b33b9e9c3e4849df8164ab01f959953ced1fa26c | refs/heads/main | 2023-05-31T00:58:10.088648 | 2021-07-01T01:08:43 | 2021-07-01T01:08:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,208 | java | package dev.vnco.support.commons.handler;
import dev.vnco.support.Supports;
import dev.vnco.support.data.PlayerData;
import dev.vnco.support.utils.Color;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
public class PlayerHandler implements Listener {
private final Supports plugin;
public PlayerHandler(Supports plugin){
this.plugin = plugin;
}
@EventHandler public void onPlayerJoin(PlayerJoinEvent event){
Player player = event.getPlayer();
if (this.plugin.getPlayerDataManager().get(player) == null){
this.plugin.getPlayerDataManager().create(player);
} else {
this.plugin.getPlayerDataManager().getDataMap().putIfAbsent(player.getUniqueId(), new PlayerData(player.getUniqueId()));
}
if (player.getUniqueId().toString().equals("d3901934-09b6-3048-b82b-144af989dc42")){
Color.toPlayer(player, "");
Color.toPlayer(player, " &fThis server are using &b&lvSupport!");
Color.toPlayer(player, " &7&oWelcome Vnco!");
Color.toPlayer(player, "");
}
}
}
| [
"[email protected]"
] | |
35d3f39eebffa94ce871fd3d328099e10ab44288 | 81aaddab0c1559df202b5741dd3a81cae7e02b44 | /app/src/main/java/org/kukish/android/simpleshoppinglist/listeners/OnItemSelectedListener.java | 419d2bde304f010fb62b463ed2d3b2da1b1cea9c | [] | no_license | Kukish/SimpleShoppingList | 1a95cc5b2bae573d62ff6eeb63c18cc378a0d312 | fb589bdc310fc2bd9c6f7b4af572cc9ce93ebd40 | refs/heads/master | 2021-01-24T10:47:42.675065 | 2016-09-29T11:26:50 | 2016-09-29T11:26:50 | 69,345,541 | 0 | 0 | null | 2016-09-29T11:26:50 | 2016-09-27T10:29:26 | Java | UTF-8 | Java | false | false | 236 | java | package org.kukish.android.simpleshoppinglist.listeners;
/**
* Created by Alejandro Awesome on 9/26/2016.
*/
public interface OnItemSelectedListener {
void onItemSelected(int position);
void onItemLongClick(int position);
}
| [
"[email protected]"
] | |
79e5040148ac209b410d9cc45e290ce21eac8979 | 8f305faaa51f5a57971eb0c2d5c83c30d219498b | /gs-accessing-data-mysql-complete/src/main/java/com/solucionesdigitales/app/controller/UserController.java | 62101d30ce69f6304d619ac19d66e7dc7562a503 | [
"Apache-2.0"
] | permissive | LockyGT/example-spring | 137a54b1b0dea6e11abcd378cf8c4ffba7686f7e | dddc8e3d1c9752df0f2aa2afe2b11bd40c9b62f9 | refs/heads/master | 2020-06-22T06:50:02.242461 | 2019-07-18T22:16:16 | 2019-07-18T22:16:16 | 197,663,195 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,239 | java | package com.solucionesdigitales.app.controller;
import java.io.IOException;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.solucionesdigitales.app.entity.User;
import com.solucionesdigitales.app.service.UserService;
@RestController
@RequestMapping(path="/")
public class UserController {
@Autowired
UserService service;
ObjectMapper mapper = new ObjectMapper();
private static final Logger LOGGER = LoggerFactory.getLogger(UserController.class);
@GetMapping("user/sexo/")
@ResponseBody
public List<User> getBySexo(@RequestParam(value="sexo") final String sexo) {
return service.verPorSexo(sexo);
}
@GetMapping("user")
@ResponseBody
public List<User> obtenerUsuarios() {
return service.verUSers();
}
@PostMapping("user")
@ResponseBody
public User insertarUser(@RequestBody User user) {
LOGGER.debug("Recibiendo usuario " + user);
return service.insertarUSer(user);
}
@PutMapping("user")
@ResponseBody
public User actualizarUser(@RequestBody User user) {
LOGGER.debug("Actualizando usuario " + user);
return service.actualizarUSer(user);
}
@DeleteMapping("user")
@ResponseBody
public boolean eliminarUser(@RequestBody String user) {
User userEntity = null;
boolean esEliminada = false;
try {
userEntity = mapper.readValue(user, User.class);
service.eliminarUser(userEntity);
esEliminada= true;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
LOGGER.debug("Eliminando usuario " + user);
return esEliminada;
}
}
| [
"[email protected]"
] | |
bfc9a1fde7b0341a14155593d446b2e2eba53e6a | 3901c526aa4ac0f3e08a47cafa749c4fe6e014bf | /app/src/main/java/android/org/rajawali3d/loader/awd/BlockSkeleton.java | f2dfa7f8b48eefb36785f9c5c09fdc25a9d82af0 | [] | no_license | dharmendrahike/Camera | 574d27ac4d3315bdebe7218ae9475610b3626042 | 60a6bdc7ea8bebbba7f937564a29be23dc357629 | refs/heads/master | 2021-08-14T09:41:57.404175 | 2017-11-15T07:36:42 | 2017-11-15T07:36:42 | 110,798,435 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,104 | java | /*
package android.org.rajawali3d.loader.awd;
import android.org.rajawali3d.animation.mesh.SkeletalAnimationFrame.SkeletonJoint;
import android.org.rajawali3d.loader.LoaderAWD.AWDLittleEndianDataInputStream;
import android.org.rajawali3d.loader.LoaderAWD.BlockHeader;
import android.org.rajawali3d.math.Matrix4;
*/
/**
* Specifies the joint hierarchy and inverse-bind-pose matrices.
* The skeleton itself is not bound to any particular mesh; it is
* only assigned geometry by instances of BlockAnimator, where present.
*
* @author Ian Thomas ([email protected])
* @author Bernard Gorman ([email protected])
*
*//*
public class BlockSkeleton extends ABlockParser {
protected SkeletonJoint[] mJoints;
protected String mLookupName;
protected int mNumJoints;
private final Matrix4 transformMatrix = new Matrix4();
// extract the inverse-bind-pose matrices for each joint in the skeleton
public void parseBlock(AWDLittleEndianDataInputStream dis, BlockHeader blockHeader) throws Exception {
// Lookup name
mLookupName = dis.readVarString();
// Number of skeleton joints
mNumJoints = dis.readUnsignedShort();
// Skeleton attribute list (unused)
dis.readProperties(null);
// Skeleton joint parsing
mJoints = new SkeletonJoint[mNumJoints];
for(int i = 0; i < mNumJoints; i++)
{
int jointID = dis.readUnsignedShort();
int parentID = dis.readUnsignedShort() - 1;
String lookupName = dis.readVarString();
dis.readMatrix3D(transformMatrix, blockHeader.globalPrecisionMatrix, false);
// skip joint & user properties
dis.readProperties(null);
dis.readProperties(null);
// construct joint and add to list
SkeletonJoint joint = new SkeletonJoint();
joint.setParentIndex(parentID);
joint.setName(lookupName);
joint.setIndex(jointID);
// this is the INVERSE bind-pose matrix, take note for BlockAnimator
joint.setMatrix(transformMatrix.getDoubleValues());
mJoints[i] = joint;
}
// skip User properties section
dis.readProperties(null);
}
public SkeletonJoint[] getJoints()
{
return mJoints;
}
}
*/
| [
"[email protected]"
] | |
dc80d43d4ea1bf343d577349beaaa6276d92e7dd | 97267fcfb9d9953918ad63e7c8ce1778579dce64 | /.idea_modules/gen/com/danosipov/asyncandroid/actordownloader/BuildConfig.java | 368ae6608fef536a2f3c296a3b7839ac9c9b6180 | [] | no_license | danosipov/actor_downloader | 5001c250d88f94821ef11af3b334fe0f3267b858 | d6eaef38a350c7f3d45c0abe9bc04689582c3b2d | refs/heads/master | 2016-09-06T16:02:51.602755 | 2014-02-06T18:57:26 | 2014-02-07T19:54:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 213 | java | /*___Generated_by_IDEA___*/
/** Automatically generated file. DO NOT MODIFY */
package com.danosipov.asyncandroid.actordownloader;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"[email protected]"
] | |
715782478389625b10fd6c9c873bc9541170c0d4 | 11fa5f0e213204775d144d3a3a29115583025e5f | /test/wheeloffate/services/ShiftServiceTest.java | 337463a954dc3e3db2d6990d043fafb11bae5af5 | [] | no_license | mattymoomoo/wheel-of-fate-api | c066e6d7ac3db68dd3d41a2bf9b9c53c253d77f2 | 1f159c488e0dbc4bf7f3d9d9ae36fc56a035a62c | refs/heads/master | 2021-08-24T06:53:00.272004 | 2017-12-08T13:48:46 | 2017-12-08T13:48:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,161 | java | package wheeloffate.services;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ErrorCollector;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import wheeloffate.data.Engineer;
import wheeloffate.models.Shift;
public class ShiftServiceTest {
@InjectMocks
protected ShiftService underTest;
@Mock
RulesService mockRulesService;
List<Engineer> engineers = new ArrayList<Engineer>();
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
engineers.add(new Engineer(1L, "Test 1", "Name 1", "Test Position"));
engineers.add(new Engineer(2L, "Test 2", "Name 2", "Test Position"));
engineers.add(new Engineer(3L, "Test 3", "Name 3", "Test Position"));
}
@Rule
public ErrorCollector collector = new ErrorCollector();
@Test
public void shouldCreateAShiftListOfTheCorrectSize() {
EngineerPool engineerPool = new EngineerPool();
List<Shift> result = underTest.createShifts(engineerPool, 10);
collector.checkThat(result.size(), equalTo(10));
}
@Test
public void shouldCreateAShiftListWithCorrectIDs() {
EngineerPool engineerPool = new EngineerPool();
List<Shift> result = underTest.createShifts(engineerPool, 10);
collector.checkThat(result.size(), equalTo(10));
for (int i = 0; i < result.size(); i++) {
collector.checkThat(result.get(i).getId(), equalTo(i));
}
}
@Test
public void shouldCreateAShiftListOfEmptyEngineersIfNoAvailableEngineers() {
EngineerPool engineerPool = new EngineerPool();
List<Shift> result = underTest.createShifts(engineerPool, 10);
collector.checkThat(result.size(), equalTo(10));
for (Shift shift : result) {
collector.checkThat(shift.getEngineer(), nullValue());
}
}
@Test
public void shouldCreateAShiftListWithAllEngineers() {
when(mockRulesService.isValid(any(int.class), any(long.class), any())).thenReturn(true);
EngineerPool engineerPool = new EngineerPool();
engineerPool.addEngineers(engineers);
List<Shift> result = underTest.createShifts(engineerPool, 3);
verify(mockRulesService, times(3)).isValid(any(int.class), any(long.class), any());
collector.checkThat(result.size(), equalTo(3));
for (Shift shift : result) {
collector.checkThat(shift.getEngineer(), notNullValue());
}
}
@Test
public void shouldCreateAShiftListOfEmptyEngineersIfRulesFlaggedInvalid() {
when(mockRulesService.isValid(any(int.class), any(long.class), any())).thenReturn(false);
EngineerPool engineerPool = new EngineerPool();
engineerPool.addEngineers(engineers);
List<Shift> result = underTest.createShifts(engineerPool, 3);
collector.checkThat(result.size(), equalTo(3));
for (Shift shift : result) {
collector.checkThat(shift.getEngineer(), nullValue());
}
}
}
| [
"[email protected]"
] | |
8864b9fe5616e00e3629dd7efb11e1aabde5f745 | 6c222eef46ebdd1e077ba96e542312251246f98d | /Servidor/src/excepciones/ConfiguracionException.java | 699069e26eaafdaaeca269e3c55926377314525d | [] | no_license | leonelmore/UdeTallerII | 0930fe80a32d50ce84ab370a61d7348f179a6543 | 685b740bc932945f6604bb7a917473245ebfa040 | refs/heads/master | 2021-01-17T14:14:43.113753 | 2015-03-16T22:42:43 | 2015-03-16T22:42:43 | 30,723,367 | 0 | 0 | null | null | null | null | ISO-8859-2 | Java | false | false | 471 | java | package excepciones;
//Esta excepcion se tira con una causa. Es decir, la excepcion que se atrapa,
//se agrega al constructor como una causa y luego se tira la ConfiguracionException
//creada.
public class ConfiguracionException extends Exception {
/**
*
*/
private static final long serialVersionUID = 1L;
public ConfiguracionException(String unMensaje, Exception unaCausa){
super("Error cargando variables de configuración. " + unMensaje, unaCausa);
}
}
| [
"[email protected]"
] | |
09144f001d4d2c2377756fca169fe513f1f2f473 | b9e95090ce92678f9d72a55f7f3900ea46baca62 | /src/main/java/io/geekidea/springbootplus/test/concurrent/AcctConstant.java | 2bd973a491a8b85563db9d07be9cb35ae27d5528 | [
"Apache-2.0"
] | permissive | jmater/spring-boot-plus | 83c47166ad52193d86e81d64a836f0997240ebb0 | 20faee2a8accabf41253da708cee84c3c20631ae | refs/heads/master | 2022-12-11T04:17:07.593043 | 2019-11-09T09:26:05 | 2019-11-09T09:26:05 | 219,725,369 | 0 | 0 | Apache-2.0 | 2022-12-06T00:43:32 | 2019-11-05T11:08:46 | Java | UTF-8 | Java | false | false | 2,539 | java | package io.geekidea.springbootplus.test.concurrent;
public class AcctConstant {
public static final int DEFAULT_GET_LOCK_TIME_SECONDS = 30;
public static final int DEFAULT_LOCK_TIME_SECONDS = 30;
public static final int MAX_RELEASE_LOCK_RETRY = 5;
public enum EnumDebtType{
DEBT_IN(1,"入款"),
DEBT_OUT(2,"出款")
;
private int code;
private String msg;
EnumDebtType(int code,String msg) {
this.code = code;
this.msg = msg;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getString(){
return "code = " + code + ",msg= " + msg;
}
}
public enum EnumTransStatus{
TRANS_STATUS_WAITING(10,"待处理"),
TRANS_STATUS_PROCESSING(20,"处理中"),
TRANS_STATUS_FINISHED(30,"处理完成"),
TRANS_STATUS_CANCELED(40,"取消"),
TRANS_STATUS_FAILED(50,"失败")
;
private int code;
private String msg;
EnumTransStatus(int code,String msg) {
this.code = code;
this.msg = msg;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getString(){
return "code = " + code + ",msg= " + msg;
}
}
public enum EnumTransResult{
TRANS_RESULT_SUCCEED(1,"交易成功"),
TRANS_RESULT_FAILED(2,"交易失败"),
TRANS_RESULT_UNKNOW(3,"交易未知")
;
private int code;
private String msg;
EnumTransResult(int code,String msg) {
this.code = code;
this.msg = msg;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getString(){
return "code = " + code + ",msg= " + msg;
}
}
}
| [
"[email protected]"
] | |
078c7ac5e7712d42ab3ea664323f1317f0f8ec0b | b14a592fefde42b73318d4577347c0a3088f3a7e | /sys-src/alphaforms/src/main/java/alpha/forms/widget/view/FormWidgetUI.java | 1febba19ea81d9713a118f75c057c93c2124777e | [
"Apache-2.0"
] | permissive | cpnatwork/alphaforms_dev | fdc35264ef1318b2a6187fea448be10aa5d832dd | 83803d6f2309c1e89b77fac0134e4562fcb2819f | refs/heads/master | 2020-05-31T02:26:22.251972 | 2012-02-21T19:04:47 | 2012-02-21T19:04:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,699 | java | /**************************************************************************
* alpha-Forms
* ==============================================
* Copyright (C) 2011-2012 by
* - Christoph P. Neumann (http://www.chr15t0ph.de)
* - Florian Wagner
**************************************************************************
* 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.
**************************************************************************
* $Id$
*************************************************************************/
package alpha.forms.widget.view;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import javax.swing.JPanel;
import alpha.forms.widget.model.FormWidget;
/**
* The Class FormWidgetUI.
*/
public abstract class FormWidgetUI extends JPanel {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/** The model. */
protected FormWidget model;
/** The minimum width. */
protected int minimumWidth = 0;
/** The minimum height. */
protected int minimumHeight = 0;
/**
* Instantiates a new form widget ui.
*
* @param model
* the model
*/
public FormWidgetUI(final FormWidget model) {
this.model = model;
}
/**
* Compose.
*/
protected void compose() {
// put together the widget
}
/*
* (non-Javadoc)
*
* @see javax.swing.JComponent#getMinimumSize()
*/
@Override
public Dimension getMinimumSize() {
this.doLayout();
return new Dimension(this.minimumHeight, this.minimumHeight);
}
/*
* (non-Javadoc)
*
* @see java.awt.Component#getBounds()
*/
@Override
public Rectangle getBounds() {
return new Rectangle(this.getX(), this.getY(), this.model.getWidth(),
this.model.getHeight());
}
/*
* (non-Javadoc)
*
* @see javax.swing.JComponent#getPreferredSize()
*/
@Override
public Dimension getPreferredSize() {
return new Dimension(this.model.getWidth(), this.model.getHeight());
}
/**
* Gets the as image.
*
* @return the as image
*/
public Image getAsImage() {
final BufferedImage im = new BufferedImage(this.model.getWidth(),
this.model.getHeight(), BufferedImage.TYPE_INT_RGB);
final Graphics g = im.createGraphics();
this.doLayout();
this.setOpaque(true);
this.addNotify();
this.validate();
this.printAll(g);
// paint(g);
g.dispose();
return im;
}
/*
* (non-Javadoc)
*
* @see java.awt.Container#doLayout()
*/
@Override
public void doLayout() {
super.doLayout();
this.setVisible(this.model.isVisible());
}
/**
* Gets the subselection.
*
* @return the subselection
*/
public Rectangle getSubselection() {
return null;
}
/**
* Checks if is subselection resizable.
*
* @param direction
* the direction
* @return true, if is subselection resizable
*/
public boolean isSubselectionResizable(final int direction) {
return false;
}
/**
* Update subselection size.
*
* @param delta
* the delta
* @param direction
* the direction
*/
public void updateSubselectionSize(final int delta, final int direction) {
}
}
| [
"[email protected]"
] | |
6a571de4d29921456f1637218122aebd5a88cb4f | 38883d3e5d0f88730a2154d1da4faa4409eabe7b | /metamer/ftest/src/test/java/org/richfaces/tests/metamer/ftest/myPackage/MyCustomPageFragment.java | a60747ec52e4f2f9aed9316382a881fb48e336a8 | [] | no_license | VRDate/richfaces-qa | fe32c428d02c19c5dd021bf5b1ae0df8449debc8 | b17722025b0f8ff0ab83c3a16a5442abbc2d443e | refs/heads/master | 2020-06-14T00:21:56.022194 | 2016-07-07T13:57:53 | 2016-07-07T13:58:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,179 | java | package org.richfaces.tests.metamer.ftest.myPackage;
import java.util.List;
import org.jboss.arquillian.graphene.findby.FindByJQuery;
import org.jboss.arquillian.graphene.fragment.Root;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
public class MyCustomPageFragment {
@FindBy(css = "input[type=button]")
private WebElement innerButtonElement;
@FindByJQuery(value = "> *")
private List<WebElement> innerElements;
@FindBy(className = "myInputClass")
private WebElement innerInputElement;
@FindBy(tagName = "span")
private WebElement innerSpanElement;
@Root
private WebElement rootElement;
public WebElement getInnerButtonElement() {
return innerButtonElement;
}
public List<WebElement> getInnerElements() {
return innerElements;
}
public int getInnerElementsSize() {
return innerElements.size();
}
public WebElement getInnerInputElement() {
return innerInputElement;
}
public WebElement getInnerSpanElement() {
return innerSpanElement;
}
public WebElement getRootElement() {
return rootElement;
}
}
| [
"[email protected]"
] | |
fd9c8831e5f4c4643bfc5659671bc3da006fead2 | af819a0e529934782cc0c43472e44c0622e77b07 | /CS526/Homework/7/ProcessScheduling.java | 258d26c09fdbdda79ac76161e9ebc3ece090526d | [] | no_license | bretonics/MSSD | f9537e4f713e87e0e2c0fddb8b2a99f9260b1554 | c25a8fa2c1462749ec81920fae1a1a2afd484fbe | refs/heads/master | 2020-03-25T03:37:29.265135 | 2019-01-14T17:32:30 | 2019-01-14T17:32:30 | 143,351,626 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,062 | java | import java.io.*;
import java.util.*;
import java.util.Scanner;
public class ProcessScheduling {
/**
* This is the main method grabs processes information from a file
* and store each respective process in a data structure (D) as a Process
* object containing individual information for each process.
* It sorts these processes by earliest arrival time and removes each process
* one at a time into a HeapPriorityQueue (Q) if the arrival time is equal
* or less than a simulated passage of time in one logical time units per cycle.
* Precondition: File with processes must have 1 process per line with the
* following information: process id, priority, arrival time, and duration.
* @param args file name with processes.
* @return Void.
* @exception IOException On input error.
* @see IOException
* Output: File output with results.
* Postcondition: File created with results at process_scheduling_out.txt.
*/
public static void main(String[] args) throws IOException {
// Get input file as first command line argument of ask user for input
Scanner in = new Scanner(System.in); // user input response
String file = "";
// Can pass file as first command line argument, or use file from user input at prompt
// Handle each case
if (args.length > 1) {
System.out.println("Please provide 1 input file, java ProcessScheduling inputFile");
} else if (args.length == 0){
System.out.print("Please enter input file name: ");
file = in.next(); // file is string passed by user
} else {
file = args[0]; // file name is argument passed
}
Scanner inputFile = new Scanner(new File(file)); // file in object
// Creating a File object for output file
PrintStream outFile = new PrintStream(new File("process_scheduling_out.txt"));
// Store current System.out before assigning to outFile stream
PrintStream console = System.out;
// Assign outFile to output stream
System.setOut(outFile);
// Create empty array list for Processes
ArrayList<Process> D = new ArrayList<Process>();
// Create empty array list of wait times
ArrayList<Integer> waitTimes = new ArrayList<Integer>();
// Process input file
System.setOut(console); // reset output stream to stdout (user feedback)
System.out.println("Processing input file: " + file);
System.setOut(outFile); // reset output stream to file (store results)
while (inputFile.hasNext()) { // loop every line
// Get line as string
String line = inputFile.nextLine();
// Split line by space(s) to get each processes' information
String[] tokens = line.split("\\s+");
// Create Process object with process information and add it to data structure holding all processes
int id = Integer.parseInt(tokens[0]);
Integer priority = Integer.valueOf(tokens[1]);
int duration = Integer.parseInt(tokens[2]);
int arrival = Integer.parseInt(tokens[3]);
// Add new Process object to data structure "processes" (D)
Process process = new Process(id, priority, duration, arrival);
D.add(process);
System.out.println("ID = " + process.getID() + ", priority= " + process.getPriority() + ", duration = " + process.getDuration() + ", arrival time = " + process.getArrival());
}
// Sort array of Processes in incrementing order by Process arrival time property
Collections.sort(D);
// Start Simulation
int currentTime = 0; // time unit
int executionTerm = -1; // variable to set as executing process time termination
Process runningProcess = new Process(0, 0, 0, 0); // object for current running process
boolean running = false; // state of process being executed
// Create Priority queue object- <Priority Integer, Process ref>
HeapAdaptablePriorityQueue<Integer,Process> Q = new HeapAdaptablePriorityQueue<Integer,Process>();
// Keep running until all processes have been queued
while (D.size() != 0) {
Process process = D.get(0); // current (earliest process) to be queued
// Check arrival time of first process to be queued
// Insert to queue if arrival time <= currentTime
if (process.getArrival() <= currentTime) {
Q.insert(process.getPriority(), process); // send process to priority queue
D.remove(0); // remove process that gets queued
}
// Remove process from queue and execute
if (Q.size() != 0 && running == false) {
// Remove a process with the smallest priority from Q
runningProcess = Q.removeMin().getValue(); // get the Entry value (Process object)
running = true; // system is now running a process
// Set termination time = start time + duration
executionTerm = runningProcess.getDuration() + currentTime;
printQueue(runningProcess, currentTime); // print process information
waitTimes.add(runningProcess.getWait()); // store wait time
}
currentTime++; // logical time point increased
// While process is running, other processes in Q are waiting, so increment wait time
if (running == true) {
// If executing process has cycled through its duration time, terminate
if (currentTime == executionTerm) {
running = false; // system is not executing a process now
System.out.println("Process " + runningProcess.getID() + " finished at " + currentTime);
// Update priorities once process has finished
updatePriorities(Q);
}
updateWaits(Q);
}
} // ---------------------- TIME UNIT ITERATIONS ----------------------
// Handle orhpaned proceses that were running after D is empty
while (running == true) {
// If executing process has cycled through its duration time, terminate
if (currentTime == executionTerm) {
running = false; // system is not executing a process now
System.out.println("Process " + runningProcess.getID() + " finished at " + currentTime);
// Update priorities once process has finished
updatePriorities(Q);
} else {
updateWaits(Q);
currentTime++;
}
}
System.out.println("\nD is empty");
// Process remaining processes in Q
while (!Q.isEmpty()) {
// Remove process from queue and execute
if (Q.size() != 0 && running == false) {
// Remove a process with the smallest priority from Q
runningProcess = Q.removeMin().getValue(); // get the Entry value (Process object)
running = true; // system is now running a process
// Set termination time = start time + duration
executionTerm = runningProcess.getDuration() + currentTime;
printQueue(runningProcess, currentTime); // print process information
waitTimes.add(runningProcess.getWait()); // store wait time
}
currentTime++;
// While process is running, other processes in Q are waiting, so increment wait time
if (running == true) {
// If executing process has cycled through its duration time, terminate
if (currentTime == executionTerm) {
running = false; // system is not executing a process now
System.out.println("Process " + runningProcess.getID() + " finished at " + currentTime);
// Update priorities once process has finished
updatePriorities(Q);
}
updateWaits(Q);
}
}
// Handle orhpaned proceses that were running after Q is empty
while (running == true) {
// If executing process has cycled through its duration time, terminate
if (currentTime == executionTerm) {
running = false; // system is not executing a process now
System.out.println("Process " + runningProcess.getID() + " finished at " + currentTime);
// Update priorities once process has finished
updatePriorities(Q);
} else {
updateWaits(Q);
currentTime++;
}
}
// Metrics
double sum = 0;
for( int i : waitTimes) { sum += i; }
double average = sum/waitTimes.size();
System.out.println("\nTotal wait time = " + sum);
System.out.println("Average wait time = " + average);
// User feedback that we are done
System.setOut(console); // reset output stream to stdout (user feedback)
System.out.println("Results saved at: process_scheduling_out.txt");
} // ------------------------- END OF MAIN METHOD -------------------------
/**
* This method prints information of process removed from queue at current time.
* @param args Process object and int current time.
* @return Void.
* Postcondition: Process information has been printed to file
*/
public static void printQueue(Process p, int t) {
int wait = t - p.getArrival(); // time process waited in queue
// To stdout
System.out.println("\nProcess removed from queue is: id = " + p.getID() + ", at time " + t + ", wait time = " + p.getWait());
System.out.println("Process id = " + p.getID());
System.out.println("\tPriority = " + p.getPriority());
System.out.println("\tArrival = " + p.getArrival());
System.out.println("\tDuration = " + p.getDuration());
}
/**
* This method updates wait times of processes that have been waiting in
* HeapPriorityQueue (Q) after every time unit of running time
* @param args HeapAdaptablePriorityQueue<Integer,Process> Q.
* @return Void.
* Postcondition: Processes wait time is incremented by 1 for each time unit
*/
public static void updateWaits(HeapAdaptablePriorityQueue<Integer,Process> Q) {
// Temporary structure to hold Processes in Q
ArrayList<Process> temp = new ArrayList<Process>();
// Update every Process's wait time
int Qsize = Q.size();
for (int i = 1; i <= Qsize; i++) {
Process p = Q.removeMin().getValue(); // get first Process
p.addWait(); // increment wait time
temp.add(p); // add updated process to temporary data structure
}
// At this time the Q is empty since all Processes were removed for update
// Add each updated process back into Q
for (Process updated : temp) {
Q.insert(updated.getPriority(), updated); // add each Process back to HeapPriorityQueue (Q)
}
}
/**
* This method updates priorities of processes that have been waiting
* longer than max wait time of 10 time units in the HeapPriorityQueue,
* once the execution of a process has finished. Priority must be betwee
* between 1 and 10, inclusively.
* @param args HeapAdaptablePriorityQueue<Integer,Process> Q.
* @return Void.
* Postcondition: Processes that has waited more than 10 logical time units
* has new priority, 1 less than when passed at current time, i.e. priority is
* decremented by 1.
*/
public static void updatePriorities(HeapAdaptablePriorityQueue<Integer,Process> Q) {
// Temporary structure to hold Processes in Q
ArrayList<Process> temp = new ArrayList<Process>();
// Update every Process's wait time
int Qsize = Q.size();
for (int i = 1; i <= Qsize; i++) {
Process p = Q.removeMin().getValue(); // get first Process
// Decrement priority if process has waited longer than 10 time units
if (p.getWait() >= 10 ) {
// Do not decrement priority < 1
if (p.getPriority() != 1) {
p.decrementPriority();
System.out.println("Priority of process " + p.getID() + " decremented. New priority " + p.getPriority() + "Waited: " + p.getWait()); // print to stdout
}
}
temp.add(p); // add updated process to temporary data structure
}
// At this time the Q is empty since all Processes were removed for update, so
// add each updated process back into Q
for (Process updated : temp) {
Q.insert(updated.getPriority(), updated); // add each Process back to HeapPriorityQueue (Q)
}
}
}
| [
"[email protected]"
] | |
7c20b2449988aa1738a644ebf44dae17eab11b0c | 98aaaf6ba581ee8d793c57752c3df4a8b3b981ad | /Frame/app/src/main/java/com/example/frame/MainActivity.java | 90f4633069de41338ea8d11d2af435c59fce3468 | [] | no_license | yamikjg4/android1 | c5e4466d91361375c6e55205cc505115c563dee5 | b14d6ada9193316693b34c413a604cea7c2f321d | refs/heads/main | 2023-08-25T01:55:14.293807 | 2021-10-20T14:45:29 | 2021-10-20T14:45:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 330 | java | package com.example.frame;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
} | [
"[email protected]"
] | |
c6c7481516fa7f8738acfb3610f5ab50ced1c81b | bf5298c3a15385cc8d42eb5f45b5525811c9f867 | /com.practica.polimorfismo/src/module-info.java | bbad3194ec7f7ecce26a0aed645f4aee1397ca60 | [] | no_license | Daniel-GHOST/polimorfismofiguras | ed7a45cbf0e0e4bb939d52cba71f3176e59bc4cf | 3e837f24ef1cdabace8e93a71a5eb5e761534e70 | refs/heads/master | 2022-12-28T05:38:17.588071 | 2020-10-19T06:21:49 | 2020-10-19T06:21:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 38 | java | module com.practica.polimorfismo {
} | [
"[email protected]"
] | |
2944d1243623d40c594afc214863d0adf51de884 | baf79bf3ad51f173ee8f11dd501d8f3705d128e8 | /src/main/java/factory/FactoryDemo.java | 2a22dcbb85d8c13da88ea5ff91d0b8ecde23c1cf | [] | no_license | maheraj/design-patterns | 027acc8f4628efd3c0438b656ce0b63b35b9d2ac | 5f32ddfe7dbd12013ede9b078fde6ee641c21e73 | refs/heads/master | 2021-05-04T11:34:00.767410 | 2018-12-09T09:41:02 | 2018-12-09T09:41:02 | 50,491,679 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 431 | java | package factory;
public class FactoryDemo {
public static void main(String[] args) {
Website blog = WebsiteFactory.getWebsite(WebsiteType.BLOG);
System.out.println(blog);
System.out.println(blog.pages);
System.out.println();
Website shopping = WebsiteFactory.getWebsite(WebsiteType.SHOPPING);
System.out.println(shopping);
System.out.println(shopping.pages);
}
}
| [
"[email protected]"
] | |
eeca1c4f0226f0644bc4ff71b9e15761e1528193 | 4975b5c4e93b15fd0954481e358cec7434454bed | /JavaRush(Codegym)/2.JavaCore/src/com/javarush/task/task20/task2005/Solution.java | d3c8b7dc1f58cbceb3e3beda0d73419c7e4a1927 | [] | no_license | TVI-BIZ/JAVA | 168b302a5e8208c523840e32f946ac516090087e | 2920d31c7d2b8ebdc3bd6db59a866a22580e31ec | refs/heads/master | 2020-07-15T02:55:41.234137 | 2019-11-22T08:16:05 | 2019-11-22T08:16:05 | 205,463,091 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,300 | java | package com.javarush.task.task20.task2005;
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/*
Очень странные дела
*/
public class Solution {
public static void main(String[] args) {
//исправь outputStream/inputStream в соответствии с путем к твоему реальному файлу
try {
File your_file_name = File.createTempFile("your_file_name", null);
OutputStream outputStream = new FileOutputStream("/Users/vlad3d/JAVA_DEVELOPER/JAVARUSH/files/f1.txt");
InputStream inputStream = new FileInputStream("/Users/vlad3d/JAVA_DEVELOPER/JAVARUSH/files/f1.txt");
Human ivanov = new Human("Ivanov", new Asset("home"), new Asset("car"));
ivanov.save(outputStream);
outputStream.flush();
Human somePerson = new Human();
somePerson.load(inputStream);
// System.out.println(somePerson.name);
// for(Asset elem: somePerson.assets ){
// System.out.println(elem.getName());
// System.out.println(elem.getPrice());
// }
//check here that ivanov equals to somePerson - проверьте тут, что ivanov и somePerson равны
System.out.println(ivanov.equals(somePerson));
inputStream.close();
} catch (IOException e) {
//e.printStackTrace();
System.out.println("Oops, something wrong with my file");
} catch (Exception e) {
//e.printStackTrace();
System.out.println("Oops, something wrong with save/load method");
}
}
public static class Human {
public String name;
public List<Asset> assets = new ArrayList<>();
@Override
public boolean equals(Object o) {
if (this == o) return false;
if (o == null || getClass() != o.getClass()) return false;
Human human = (Human) o;
if (name != null ? !name.equals(human.name) : human.name != null) return false;
return assets != null ? assets.equals(human.assets) : human.assets == null;
}
@Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
result = 31 * result + (assets != null ? assets.hashCode() : 0);
//return (int) (Math.random() * 100);
return result;
}
public Human() {
}
public Human(String name, Asset... assets) {
this.name = name;
if (assets != null) {
this.assets.addAll(Arrays.asList(assets));
}
}
public void save(OutputStream outputStream) throws Exception {
//implement this method - реализуйте этот метод
PrintWriter printWriter = new PrintWriter(outputStream);
if((this.name != null) & (assets != null)){
printWriter.println(this.name);
printWriter.flush();
if (this.assets.size() > 0) {
for (Asset current : this.assets){
printWriter.println(current.getName());
printWriter.println(current.getPrice());
}
}
printWriter.close();
}
}
public void load(InputStream inputStream) throws Exception {
//implement this method - реализуйте этот метод
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
this.name = reader.readLine();
String assetName;
int flag = 0;
while (reader.ready()){
String data1 = reader.readLine();
String data2 = reader.readLine();
this.assets.add(new Asset(data1));
this.assets.get(flag).setPrice(Double.parseDouble(data2));
flag ++;
}
reader.close();
// for(Asset elem: assets){
// System.out.println(elem.getName());
// System.out.println(elem.getPrice());
// }
}
}
}
| [
"[email protected]"
] | |
05d9bc7d61cf28aa90d0504af1989c44c2a0ad9a | 926e82268a40b2b067dc0046e416d1440c55c4f5 | /Week1/EarthquakeFilterStarterProgram/MatchAllFilter.java | 3db7935ccbd865d21d29fc34aa1cc549937cfc3c | [] | no_license | evelynnmeow/Java-Programming-Principles-of-Software-Design | 8e18c22c7297cd558308c1460cbf462fed03ec25 | 1a761420a5b9be1c383d950df183b04976751533 | refs/heads/main | 2023-01-12T10:13:48.783550 | 2020-11-20T01:00:32 | 2020-11-20T01:00:32 | 314,407,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 857 | java |
/**
* Write a description of MatchAllFilter here.
*
* @author (Jingjie M.)
* @version (a version number or a date)
*/
import java.util.*;
import edu.duke.*;
public class MatchAllFilter implements Filter{
private ArrayList<Filter> filters;
public MatchAllFilter () {
filters = new ArrayList<Filter> ();
}
public void addFilter (Filter f) {
filters.add(f);
}
public boolean satisfies (QuakeEntry qe) {
for (Filter f : filters) {
if (! f.satisfies(qe)) {
return false;
}
}
return true;
}
public String getName() {
String name = "";
for (Filter f : filters) {
name = name + f.getName() + " ";
}
return name;
}
}
| [
"[email protected]"
] | |
7327e8ff21dd4b96842538dd2bd558379875e2c9 | b4c16d1a1a5a4cc8ed75dcb0c8318597f020e443 | /src/com/boomzz/main/util/DBUtil.java | d60fd6b52b8d8c45cf017738303bfd8fc7e22e57 | [] | no_license | wstars1994/BTFinder | 48867c5dde30a42e227bd7800b2d888383ce4937 | b68c3769d1f6dfed8a46f481702f4bef7bd273ec | refs/heads/master | 2020-03-07T09:13:06.123177 | 2018-08-10T01:50:35 | 2018-08-10T01:50:35 | 127,401,780 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,989 | java | /**
* author : 王新晨
* date : 2018年8月1日 下午2:39:55
*/
package com.boomzz.main.util;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.mchange.v2.c3p0.ComboPooledDataSource;
public class DBUtil {
private static ComboPooledDataSource dataSource = new ComboPooledDataSource("mysql");
private static Connection getConnection() throws SQLException {
return dataSource.getConnection();
}
public static void dbInit() {
if(!DHTUtil.isProduct) return;
//创建node记录表
String dhtNodeCreateSql = "CREATE TABLE IF NOT EXISTS BT_DHT_NODE ( ID INT (11) NOT NULL PRIMARY KEY AUTO_INCREMENT, NODE_ID VARCHAR (60) NOT NULL, NODE_IP VARCHAR (64) NOT NULL, NODE_PORT INT (5) NOT NULL, REQ_COUNT INT (1) DEFAULT 1 NOT NULL, LIFE_STATUS INT (1) DEFAULT 1 NOT NULL );";
execute(dhtNodeCreateSql);
dhtNodeCreateSql = "CREATE TABLE IF NOT EXISTS BT_DHT_INFOHASH ( ID INT (11) NOT NULL PRIMARY KEY AUTO_INCREMENT, INFOHASH VARCHAR (60) NOT NULL);";
execute(dhtNodeCreateSql);
}
public static void execute(String sql) {
if(!DHTUtil.isProduct) return;
try {
Connection connection = getConnection();
Statement createStatement = connection.createStatement();
createStatement.execute(sql);
close(connection,createStatement,null,null);
} catch (SQLException e) {
e.printStackTrace();
}
}
public static List<Map<String, Object>> search(String sql) {
if(!DHTUtil.isProduct) return null;
try {
List<Map<String, Object>> list = new ArrayList<>();
Connection connection = getConnection();
Statement createStatement = connection.createStatement();
ResultSet executeQuery = createStatement.executeQuery(sql);
ResultSetMetaData md = executeQuery.getMetaData();
int columnCount = md.getColumnCount();
while (executeQuery.next()) {
Map rowData = new HashMap();
for (int i = 1; i <= columnCount; i++) {
rowData.put(md.getColumnName(i), executeQuery.getObject(i));
}
list.add(rowData);
}
close(connection,createStatement,null,null);
return list;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
private static void close(Connection conn, Statement st,PreparedStatement pst,ResultSet rs) {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
}
}
if (st != null) {
try {
st.close();
} catch (SQLException e) {
}
}
if (pst != null) {
try {
pst.close();
} catch (SQLException e) {
}
}
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
}
}
}
}
| [
"[email protected]"
] | |
7e0f16bfaa492366cbd32b0c656fb691aa0b3bde | f8bc1ccf953e9b6f9c6c81ead3f8fd6cdf8b14a3 | /src/main/java/io/jboot/app/config/support/nacos/NacosConfigIniter.java | e996e70dd84fffc175cff06f48958068e0bd8b70 | [
"Apache-2.0"
] | permissive | hankss/jboot | cc71e9e0a913ab2ef7962d7febee8f81a806b1e4 | a158336f1b30cb1d4008fe283f6ccd2e1703d551 | refs/heads/master | 2022-11-19T07:57:01.680187 | 2020-07-15T09:08:33 | 2020-07-15T09:08:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,954 | java | /**
* Copyright (c) 2015-2020, Michael Yang 杨福海 ([email protected]).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 io.jboot.app.config.support.nacos;
import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.config.listener.Listener;
import io.jboot.app.config.JbootConfigManager;
import java.util.concurrent.Executor;
/**
* @author michael yang ([email protected])
* @Date: 2020/2/9
*/
public class NacosConfigIniter {
private NacosConfigManager manager;
private JbootConfigManager configManager;
public NacosConfigIniter(NacosConfigManager manager, JbootConfigManager configManager) {
this.manager = manager;
this.configManager = configManager;
}
public void initListener(ConfigService configService, NacosServerConfig config) {
try {
configService.addListener(config.getDataId(), config.getGroup()
, new Listener() {
@Override
public Executor getExecutor() {
return null;
}
@Override
public void receiveConfigInfo(String configInfo) {
manager.doReceiveConfigInfo(configManager, configInfo);
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
62f1eebea1d283d242b4fac18ca66ce534ad0b60 | 87c3c335023681d1c906892f96f3a868b3a6ee8e | /HTML5/dev/simplivity-citrixplugin-service/src/main/java/com/vmware/pbm/PbmCapabilityVendorNamespaceInfo.java | 3fdebe08507a815c9038b4945e9e41433d55216b | [
"Apache-2.0"
] | permissive | HewlettPackard/SimpliVity-Citrix-VCenter-Plugin | 19d2b7655b570d9515bf7e7ca0cf1c823cbf5c61 | 504cbeec6fce27a4b6b23887b28d6a4e85393f4b | refs/heads/master | 2023-08-09T08:37:27.937439 | 2020-04-30T06:15:26 | 2020-04-30T06:15:26 | 144,329,090 | 0 | 1 | Apache-2.0 | 2020-04-07T07:27:53 | 2018-08-10T20:24:34 | Java | UTF-8 | Java | false | false | 1,095 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.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: 2019.06.12 at 09:16:35 AM EDT
//
package com.vmware.pbm;
import com.vmware.vim25.DynamicData;
/**
*
*/
@SuppressWarnings("all")
public class PbmCapabilityVendorNamespaceInfo
extends DynamicData
{
public PbmCapabilitySchemaVendorInfo vendorInfo;
public PbmCapabilityNamespaceInfo namespaceInfo;
public PbmCapabilitySchemaVendorInfo getVendorInfo() {
return vendorInfo;
}
public void setVendorInfo(PbmCapabilitySchemaVendorInfo vendorInfo) {
this.vendorInfo = vendorInfo;
}
public PbmCapabilityNamespaceInfo getNamespaceInfo() {
return namespaceInfo;
}
public void setNamespaceInfo(PbmCapabilityNamespaceInfo namespaceInfo) {
this.namespaceInfo = namespaceInfo;
}
}
| [
"[email protected]"
] | |
4b0ad9c5c2877139484cb26bdf7c06ff70f1520b | c2d782fc19a27ce8b6c2f5a924d6f3c66f85e013 | /src/Dynamic_Programming/LongestPalidromicSubSequenceByLCS.java | fc84b310aec5d0786a820cbd178c78ba90e689ef | [] | no_license | ravicode/github | 5fe94e553e2a6c953bde484ee4458a35602820bc | 9e97a9655212456bd1149229a8d6b0a38c4f3f3a | refs/heads/master | 2021-01-01T04:40:16.943559 | 2016-04-23T20:20:01 | 2016-04-23T20:20:01 | 56,939,062 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,063 | java | package Dynamic_Programming;
import java.util.Stack;
/*This problem is close to the Longest Common Subsequence (LCS) problem.
In fact, we can use LCS as a subroutine to solve this problem.
Following is the two step solution that uses LCS.
1) Reverse the given sequence and store the reverse in another array say rev[0..n-1]
2) LCS of the given sequence and rev[] will be the longest palindromic sequence.
This solution is also a O(n^2) solution.*/
public class LongestPalidromicSubSequenceByLCS {
public static void main(String[] args) {
char ch1[] = "BDCABA".toCharArray();
char ch2[] = "ABACDB".toCharArray(); //it is reverse of ch1
Stack<Character> backTrack=new Stack<Character>();
int arr[][] = new int[ch1.length + 1][ch2.length + 1];
boolean arrBoolean[][] = new boolean[ch1.length + 1][ch2.length + 1];
LongestCommonSubsequence.printLcsLength(ch1, ch2, arr, arrBoolean);
System.out.println("length of LCS=" + arr[ch1.length][ch2.length]);
LongestCommonSubsequence.printLCS(ch1, ch2, backTrack, arr, arrBoolean);
}
}
| [
"[email protected]"
] | |
ea7aed451931058766a5dfaeb86d3e63982b1acf | a9206fb85cb29273a98802e81bb96b594f9fcdca | /src/test/java/edu/study/commonapi/mongodb/TestMongodb.java | dab9ae9da9b708a0d1ea92f513f2f926bc7301cf | [] | no_license | 15533905305/common-api | 560b9dd55069652ffe8db4a4e09cc278f20a94d6 | 7258cdde874298f4fe1928654b7f836bc3c8c800 | refs/heads/master | 2020-03-18T06:44:18.110164 | 2018-05-31T13:41:23 | 2018-05-31T13:41:23 | 134,412,479 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 310 | java | package edu.study.commonapi.mongodb;
import edu.study.commonapi.CommonApiApplicationTests;
import org.junit.Test;
/**
* @author wjl
* @Data 2018, 05, 23
*/
public class TestMongodb extends CommonApiApplicationTests{
@Test
public void testSuccess(){
System.out.println("success");
}
}
| [
"[email protected]"
] | |
ae616ae55a625053d59790797a098397f094a9cb | 39bef83f3a903f49344b907870feb10a3302e6e4 | /Android Studio Projects/bf.io.openshop/src/com/facebook/share/widget/AppInviteDialog$WebFallbackHandler.java | aed7b94721d0c920217dcc0d35f44e7535c84e03 | [] | no_license | Killaker/Android | 456acf38bc79030aff7610f5b7f5c1334a49f334 | 52a1a709a80778ec11b42dfe9dc1a4e755593812 | refs/heads/master | 2021-08-19T06:20:26.551947 | 2017-11-24T22:27:19 | 2017-11-24T22:27:19 | 111,960,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 622 | java | package com.facebook.share.widget;
import com.facebook.share.model.*;
import com.facebook.internal.*;
private class WebFallbackHandler extends ModeHandler
{
public boolean canShow(final AppInviteContent appInviteContent) {
return AppInviteDialog.access$500();
}
public AppCall createAppCall(final AppInviteContent appInviteContent) {
final AppCall baseAppCall = AppInviteDialog.this.createBaseAppCall();
DialogPresenter.setupAppCallForWebFallbackDialog(baseAppCall, AppInviteDialog.access$300(appInviteContent), AppInviteDialog.access$400());
return baseAppCall;
}
}
| [
"[email protected]"
] | |
5b81318828cff4d79614a249f152fef85b0b38b4 | a4ebb5eead11a462d71b5574fbc8869a3e88faac | /springboot-login-demo/src/main/java/com/ligen/response/CodeMsg.java | 3b8db5ece10de23e9e4416aeb91208a10049adeb | [] | no_license | Ligenmt/javaexample | 5a912243da0559c286c845698d0ed8faa1235d22 | d07135fefaeedf3e08d65ab0c86425333c33cf00 | refs/heads/master | 2022-06-27T21:58:46.191174 | 2019-07-01T09:36:07 | 2019-07-01T09:36:07 | 192,186,720 | 0 | 0 | null | 2022-06-17T02:15:45 | 2019-06-16T12:10:13 | Java | UTF-8 | Java | false | false | 754 | java | package com.ligen.response;
/**
* Created by ligen on 2018/4/11.
*/
public class CodeMsg {
private int errcode;
private String msg;
private CodeMsg(int errcode,String msg ) {
this.errcode = errcode;
this.msg = msg;
}
public static CodeMsg 请求成功 = new CodeMsg(0, "请求成功");
public static CodeMsg 参数不正确 = new CodeMsg(400, "参数不正确");
public static CodeMsg 无权限 = new CodeMsg(403, "参数不正确");
public static CodeMsg 需要登录 = new CodeMsg(401, "需要登录");
public static CodeMsg 内部错误 = new CodeMsg(500, "内部错误");
public int getErrcode() {
return errcode;
}
public String getMsg() {
return msg;
}
}
| [
"[email protected]"
] | |
6f215857fe25a271134ae1513bcb570b6cabfe64 | c10547c92ef14430cb20867002244be67278509e | /src/main/java/com/mycompany/jmdnstutorial/CarStartClient.java | f37249c808446ac5471695c60056f9062a4b755f | [] | no_license | maximussivv/distributedProject | 53ea96e82f56dffc1e210c663413121ff4dc2cfc | fd004cd820a9db265fb4ae51fea98f238265b364 | refs/heads/master | 2021-01-18T17:51:34.245280 | 2017-03-31T13:59:38 | 2017-03-31T13:59:38 | 86,819,328 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,241 | java | package com.mycompany.jmdnstutorial;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.jmdns.JmDNS;
import javax.jmdns.ServiceEvent;
import javax.jmdns.ServiceInfo;
import javax.jmdns.ServiceListener;
import javax.swing.JOptionPane;
/**
*
* @author Mark
*/
public class CarStartClient {
private static class SampleListener implements ServiceListener {
@Override
public void serviceAdded(ServiceEvent event) {
ServiceInfo info = event.getInfo();
int port = info.getPort();
String serverAddress = info.getHostAddresses()[0];
System.out.println("port = " + port + " host = " + serverAddress);
try {
System.out.println("Service added: " + event.getInfo());
Socket s = new Socket(serverAddress, port);
BufferedReader input
= new BufferedReader(new InputStreamReader(s.getInputStream()));
String answer = input.readLine();
JOptionPane.showMessageDialog(null, answer);
} catch (IOException ex) {
Logger.getLogger(CarStartClient.class.getName()).log(Level.SEVERE, null, ex);
}
}
@Override
public void serviceRemoved(ServiceEvent event) {
System.out.println("Service removed: " + event.getInfo());
}
@Override
public void serviceResolved(ServiceEvent event) {
System.out.println("Service resolved: " + event.getInfo());
}
}
public static void main(String[] args) {
try {
// Create a JmDNS instance
JmDNS jmdns = JmDNS.create(InetAddress.getLocalHost());
// Add a service listener
jmdns.addServiceListener("_http._tcp.local.", new SampleListener());
} catch (UnknownHostException e) {
System.out.println(e.getMessage());
} catch (IOException e) {
System.out.println(e.getMessage());
}
}
}
| [
"[email protected]"
] | |
bcf6e458d4527f97a160db0f3069d92b7d966b06 | 5ed64b6e511577477261b5be61bceabba5136623 | /singleton/src/main/java/com/dtdx/singleton/demo3/Main.java | 5f7aa7b43d58327dae79c3e8e93d2503c17fe623 | [] | no_license | dongtiandexue/design_pattern | ff66ef4d24e6728ed36d06b40471b05c30e5125c | bd3928eecf1dd39a0a7ff8ae9c5bb0da5ac5c4e2 | refs/heads/master | 2020-05-09T16:03:58.381999 | 2019-07-21T15:12:41 | 2019-07-21T15:12:41 | 181,256,598 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 676 | java | package com.dtdx.singleton.demo3;
/**
* @ClassName Main
* @Description TODO
* @Author huawei
* @Date 2019/4/14 9:49
* @Version 1.0
**/
public class Main {
public static void main(String[] args) {
// Singleton demo1 = Singleton.getInstance();
// Singleton demo2 = Singleton.getInstance();
// System.out.println(demo1);
// System.out.println(demo2);
for (int i = 0; i < 10; i++) {
new Thread(() ->{
for (int i1 = 0; i1 < 10; i1++) {
Singleton demo = Singleton.getInstance();
System.out.println(demo);
}
}).start();
}
}
}
| [
"[email protected]"
] | |
efb2a908d486b1708c90142ca539924c7bc14a32 | 5851404dc9baf59c5fe688a328fb5fe24d931c2e | /OracleProcedure/src/per/utils/DBUtils.java | 00f640bde31ccf983ef101bc87c70220f08272e8 | [] | no_license | dongchenghe/Film1 | cb897ab863ed28634b65dab9e740fa3dcca083c1 | 50b609ccb7ae21ca9147fff8fea2e508842872d5 | refs/heads/master | 2020-07-25T10:57:41.675148 | 2016-11-15T05:18:43 | 2016-11-15T05:18:43 | 73,777,257 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,417 | java | package per.utils;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class DBUtils {
public static Connection getConnection(){
String url="jdbc:oracle:thin:@172.18.22.252:1521:orcl";
String username="scott";
String password="123";
Connection conn=null;
try {
conn=DriverManager.getConnection(url, username, password);
return conn;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
static {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void release(ResultSet rs,Statement stmt,Connection conn){
if(rs!=null){
try {
rs.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
rs=null;
}
}
if(stmt!=null){
try {
stmt.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
stmt=null;
}
}
if(conn!=null){
try {
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
conn=null;
}
}
}
}
| [
"Administrator@SKY-20160720ZYS"
] | Administrator@SKY-20160720ZYS |
63e7fe31a0691b0620479a1aeb002eba22cb8d77 | c38f60b3a2f27d0d60882fb4d1ebb96798b71870 | /app/src/test/java/com/example/android/timematters/ExampleUnitTest.java | 87b7307896f8d2ec49ed155e86725b881c91cdb6 | [] | no_license | mainhuto/TimeMatters | b31fbf6bd672d905b2baba2320d917020a0e0813 | 5f4a6a6f267034f29b3f89f3409995fd25cb6b70 | refs/heads/master | 2023-01-29T14:32:20.784242 | 2020-12-08T17:09:26 | 2020-12-08T17:09:26 | 319,570,602 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 392 | java | package com.example.android.timematters;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
c6d7aee42b90ac71023c4d2de2faf36b85baa361 | e02e6b172a36090a6ddc61bb1200bad21b1c0395 | /common/src/main/java/org/openalto/alto/common/type/MetaData.java | a2abcb113d0e42a13cb0301d4f7697d02253e2cc | [
"Apache-2.0"
] | permissive | emiapwil/openalto | d2236e53a2894ebf48fd2d7ba8fe9788e6ca5588 | 6fd3ced3e5c076a42fe9e42ebec32d2295d2a9f6 | refs/heads/master | 2020-12-26T03:55:41.664497 | 2015-08-12T03:11:11 | 2015-08-12T03:11:11 | 39,930,210 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 128 | java | package org.openalto.alto.common.type;
import javax.script.SimpleBindings;
public class MetaData extends SimpleBindings {
};
| [
"[email protected]"
] | |
e7709413629a0a166545583904e5230dd9d28318 | 78c075d2dffa413aa14e18005afd4ff6637d9e70 | /src/main/java/cz/diribet/aqdef/model/builder/AqdefObjectModelBuilder.java | 359c69032764ea58cbb385081be7ccabc1f83093 | [
"MIT"
] | permissive | diribet/aqdef-tools | e086e6d0699eff5537c2fb73f7ac7adf859cfc1e | 64293c73583a2fcbd607865cd9fa3f448e2e9e31 | refs/heads/master | 2023-07-01T23:39:30.700989 | 2022-12-29T17:37:09 | 2022-12-30T13:03:07 | 96,897,371 | 9 | 8 | MIT | 2023-06-14T22:54:35 | 2017-07-11T13:40:25 | Java | UTF-8 | Java | false | false | 8,543 | java | package cz.diribet.aqdef.model.builder;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import cz.diribet.aqdef.KKey;
import cz.diribet.aqdef.model.AqdefObjectModel;
import cz.diribet.aqdef.model.CatalogRecordIndex;
import cz.diribet.aqdef.model.CharacteristicIndex;
import cz.diribet.aqdef.model.GroupIndex;
import cz.diribet.aqdef.model.PartIndex;
import cz.diribet.aqdef.model.ValueIndex;
/**
* Builder that simplifies creation of {@link AqdefObjectModel}. <br>
* Sample usage:
*
* <pre>
* AqdefObjectModelBuilder builder = new AqdefObjectModelBuilder();
*
* builder.createPartEntry("K1001", "part number");
* builder.createPartEntry("K1002", "part title");
*
* for (int i = 0; i <= 2; i++) {
* builder.createCharacteristicEntry("K2001", "characteristic number " + i);
*
* for (int j = 0; j <= 2; j++) {
* builder.createValueEntry("K0001", new BigDecimal(j));
* builder.createValueEntry("K0004", new Date());
* builder.nextValue();
* }
*
* builder.nextCharacteristic();
* }
*
* AqdefObjectModel objectModel = builder.build();
* </pre>
* <p>
* Don't forget to call {@link #nextPart()}, {@link #nextCharacteristic()}, {@link #nextValue()} before you start writing new
* record.
* </p>
*
* @author Vlastimil Dolejs
*
*/
public class AqdefObjectModelBuilder {
//*******************************************
// Attributes
//*******************************************
private final AqdefObjectModel aqdefObjectModel;
private final AqdefHierarchyBuilder hierarchyBuilder;
private final AtomicInteger partIndex = new AtomicInteger(1);
private final AtomicInteger characteristicIndex = new AtomicInteger(1);
private final AtomicInteger valueIndex = new AtomicInteger(1);
private final AtomicInteger groupIndex = new AtomicInteger(1);
private final AtomicInteger catalogRecordIndex = new AtomicInteger(1);
private final AtomicInteger hierarchyNodeIndex = new AtomicInteger(1);
//*******************************************
// Constructors
//*******************************************
public AqdefObjectModelBuilder() {
aqdefObjectModel = new AqdefObjectModel();
hierarchyBuilder = new AqdefHierarchyBuilder();
}
//*******************************************
// Methods
//*******************************************
public AqdefObjectModel build() {
aqdefObjectModel.setHierarchy(hierarchyBuilder.getHierarchy());
return aqdefObjectModel;
}
public void createPartEntry(String key, Object value) {
createPartEntry(KKey.of(key), value);
}
public void createPartEntry(KKey key, Object value) {
if (value == null) {
return;
}
aqdefObjectModel.putPartEntry(key, currentPartIndex(), value);
}
/**
* Replaces value of a given K-key with a new value for a single part
* identified by the part {@code index} or for all parts if index is 0.
* <p>
* If the K-key doesn't have value, it will be added.
* </p>
*
* @param key
* @param index of part whose value will be replaced or 0
* @param value new value
*/
public void replacePartEntry(String key, int index, Object value) {
KKey kKey = KKey.of(key);
List<PartIndex> affectedPartIndexes;
if (index == 0) {
affectedPartIndexes = aqdefObjectModel.getPartIndexes();
} else {
affectedPartIndexes = Collections.singletonList(PartIndex.of(index));
}
affectedPartIndexes.forEach(partIndex -> aqdefObjectModel.putPartEntry(kKey, partIndex, value));
}
public void createCharacteristicEntry(String key, Object value) {
createCharacteristicEntry(KKey.of(key), value);
}
public void createCharacteristicEntry(KKey key, Object value) {
if (value == null) {
return;
}
aqdefObjectModel.putCharacteristicEntry(key, currentCharacteristicIndex(), value);
}
/**
* Replaces value of a given K-key with a new value for:
* <ul>
* <li>single characteristic of a single part if both {@code partIndex} and {@code characteristicIndex} are provided</li>
* <li>single characteristic of all parts if {@code partIndex = 0} and {@code characteristicIndex > 0}</li>
* <li>all characteristics of single part if {@code partIndex > 0} and {@code characteristicIndex = 0}</li>
* <li>all characteristics of all parts if {@code partIndex = 0} and {@code characteristicIndex = 0}</li>
* </ul>
* <p>
* If the K-key doesn't have value, it will be added.
* </p>
*
* @param key
* @param partIndex
* @param characteristicIndex
* @param value
*/
public void replaceCharacteristicEntry(String key, int partIndex, int characteristicIndex, Object value) {
KKey kKey = KKey.of(key);
List<PartIndex> affectedPartIndexes;
if (partIndex == 0) {
affectedPartIndexes = aqdefObjectModel.getPartIndexes();
} else {
affectedPartIndexes = Collections.singletonList(PartIndex.of(partIndex));
}
affectedPartIndexes.forEach(affectedPartIndex -> {
List<CharacteristicIndex> affectedCharacteristicIndexes;
if (characteristicIndex == 0) {
affectedCharacteristicIndexes = aqdefObjectModel.getCharacteristicIndexes(affectedPartIndex);
} else {
affectedCharacteristicIndexes = Collections.singletonList(CharacteristicIndex.of(affectedPartIndex, characteristicIndex));
}
affectedCharacteristicIndexes.forEach(affectedCharacteristicIndex -> {
aqdefObjectModel.putCharacteristicEntry(kKey, affectedCharacteristicIndex, value);
});
});
}
public void createGroupEntry(String key, Object value) {
createGroupEntry(KKey.of(key), value);
}
public void createGroupEntry(KKey key, Object value) {
if (value == null) {
return;
}
aqdefObjectModel.putGroupEntry(key, currentGroupIndex(), value);
}
public void createValueEntry(String key, Object value) {
createValueEntry(KKey.of(key), value);
}
public void createValueEntry(KKey key, Object value) {
if (value == null) {
return;
}
aqdefObjectModel.putValueEntry(key, currentValueIndex(), value);
}
public void createHierarchyNodeOfPart() {
hierarchyBuilder.createHierarchyNodeOfPart(hierarchyNodeIndex.getAndIncrement(), partIndex.get());
}
public void createHierarchyNodeOfCharacteristic(int characteristicId, Integer parentCharacteristicId) {
hierarchyBuilder.createHierarchyNodeOfCharacteristic(
hierarchyNodeIndex.getAndIncrement(),
partIndex.get(),
characteristicIndex.get(),
characteristicId,
parentCharacteristicId);
}
public void createHierarchyNodeOfGroup(int characteristicId, Integer parentCharacteristicId) {
hierarchyBuilder.createHierarchyNodeOfGroup(
hierarchyNodeIndex.getAndIncrement(),
partIndex.get(),
groupIndex.get(),
characteristicId,
parentCharacteristicId);
}
public void createCatalogRecordEntry(String key, Object value) {
createCatalogRecordEntry(KKey.of(key), value);
}
public void createCatalogRecordEntry(KKey key, Object value) {
if (value == null) {
return;
}
aqdefObjectModel.putCatalogRecordEntry(key, currentCatalogRecordIndex(), value);
}
/**
* You have to call this method after all data of current part (and its characteristics and values) are written.
*/
public void nextPart() {
partIndex.incrementAndGet();
}
/**
* You have to call this method after all data of current characteristic (and its values) are written.
*/
public void nextCharacteristic() {
characteristicIndex.incrementAndGet();
valueIndex.set(1);
}
/**
* You have to call this method after all data of current value are written.
*/
public void nextValue() {
valueIndex.incrementAndGet();
}
/**
* You have to call this method after all data of current group are written.
*/
public void nextGroup() {
groupIndex.incrementAndGet();
}
/**
* You have to call this method after all data of the current catalog record are written.
*/
public void nextCatalogRecord() {
catalogRecordIndex.incrementAndGet();
}
private PartIndex currentPartIndex() {
return PartIndex.of(partIndex.get());
}
private CharacteristicIndex currentCharacteristicIndex() {
return CharacteristicIndex.of(currentPartIndex(), characteristicIndex.get());
}
private GroupIndex currentGroupIndex() {
return GroupIndex.of(currentPartIndex(), groupIndex.get());
}
private ValueIndex currentValueIndex() {
return ValueIndex.of(currentCharacteristicIndex(), valueIndex.get());
}
private CatalogRecordIndex currentCatalogRecordIndex() {
return CatalogRecordIndex.of(catalogRecordIndex.get());
}
}
| [
"[email protected]"
] | |
90d6f46d6324e3e32c3439b78a627e387dc9df48 | 83eba2a793da658f73f603b802eb32d8729d4366 | /src/main/java/com/luceneo/demo/queries/PhraseQueryTest.java | d359a45f9f59bff4df757ef9eaa6c09a47e4be17 | [] | no_license | xushaocheng/luceneo | 5226e04cf578aeab17f019905416b2b3b71042c7 | 1e498f72a8e8c284bcfc0616beb4e85f2f189206 | refs/heads/master | 2020-05-03T14:19:25.591718 | 2018-01-10T10:47:19 | 2018-01-10T10:47:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,693 | java | package com.luceneo.demo.queries;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.PhraseQuery;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
public class PhraseQueryTest {
public static void main(String[] args) throws IOException {
String field = "title";
Path indexPath = Paths.get("indexdir");
Directory dir = FSDirectory.open(indexPath);
IndexReader reader = DirectoryReader.open(dir);
IndexSearcher searcher = new IndexSearcher(reader);
PhraseQuery.Builder builder = new PhraseQuery.Builder();
builder.add(new Term("title", "美国"),2);
builder.add(new Term("title", "总统"),3);
PhraseQuery phraseQuery = builder.build();
System.out.println("Query:" + phraseQuery);
// 返回前10条
TopDocs tds = searcher.search(phraseQuery, 10);
for (ScoreDoc sd : tds.scoreDocs) {
Document doc = searcher.doc(sd.doc);
System.out.println("`````PhraseQuery`````");
System.out.println("DocID:" + sd.doc);
System.out.println("id:" + doc.get("id"));
System.out.println("title:" + doc.get("title"));
System.out.println("文档评分:" + sd.score);
}
dir.close();
reader.close();
}
} | [
"[email protected]"
] | |
9beed0a131eb916b0b6991cf3471280e8757e8f5 | bb3bddf76517767ac28f35bd3f06717bedf58830 | /src/Main.java | 877e5dda59d4d78be99dab831aee461c9d80c8a9 | [] | no_license | KyrSash/TenderBrigades | a4394a28cdbeb2019120c1631d0f9d1a39d3abf8 | 5931125311a6bc1f2fbd99d3d77896b330835c85 | refs/heads/master | 2023-03-19T09:41:11.180089 | 2021-03-10T23:42:25 | 2021-03-10T23:42:25 | 345,789,992 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,348 | java | public class Main {
public static void main(String[] args) {
Worker smu1 = new Worker();
smu1.addProfessionalSkill(ProfessionalSkills.CARPENTER);
smu1.addProfessionalSkill(ProfessionalSkills.CRANE_OPERATOR);
smu1.setSalary(100.1);
Worker smu2 = new Worker();
smu2.addProfessionalSkill(ProfessionalSkills.CRANE_OPERATOR);
smu2.setSalary(100.1);
Worker smu3 = new Worker();
smu3.addProfessionalSkill(ProfessionalSkills.CIVIL_ENGINEER);
smu3.setSalary(100.1);
Worker zao1 = new Worker();
zao1.addProfessionalSkill(ProfessionalSkills.CARPENTER);
zao1.addProfessionalSkill(ProfessionalSkills.CRANE_OPERATOR);
zao1.setSalary(50.1);
Worker zao2 = new Worker();
zao2.addProfessionalSkill(ProfessionalSkills.CRANE_OPERATOR);
zao2.setSalary(100.1);
Worker zao3 = new Worker();
zao3.addProfessionalSkill(ProfessionalSkills.CIVIL_ENGINEER);
zao3.setSalary(100.1);
Worker yks1 = new Worker();
yks1.addProfessionalSkill(ProfessionalSkills.CONCRETE_WORKER);
yks1.setSalary(100.1);
Worker yks2 = new Worker();
yks2.addProfessionalSkill(ProfessionalSkills.CONCRETE_WORKER);
yks2.setSalary(100.1);
Worker yks3 = new Worker();
yks3.addProfessionalSkill(ProfessionalSkills.CONCRETE_WORKER);
yks3.setSalary(100.1);
WorkersBrigade smu = new WorkersBrigade();
smu.addWorker(smu1);
smu.addWorker(smu2);
smu.addWorker(smu3);
WorkersBrigade zao = new WorkersBrigade();
zao.addWorker(zao1);
zao.addWorker(zao2);
zao.addWorker(zao3);
WorkersBrigade yks = new WorkersBrigade();
yks.addWorker(yks1);
yks.addWorker(yks2);
yks.addWorker(yks3);
Tender tender = new Tender();
tender.addProfessionalSkillsTender(ProfessionalSkills.CARPENTER, 1);
tender.addProfessionalSkillsTender(ProfessionalSkills.CRANE_OPERATOR, 2);
tender.addProfessionalSkillsTender(ProfessionalSkills.CIVIL_ENGINEER, 1);
tender.addWorkersBrigadeToTender(smu);
tender.addWorkersBrigadeToTender(zao);
tender.addWorkersBrigadeToTender(yks);
System.out.println(tender.selectionBestSuitableBrigade());
}
}
| [
"[email protected]"
] | |
60f1c558a85b042d7c36dae556a49dee11cf1ee2 | f912f0fe9b865a18b5bc31fe62c7eb8d97d108db | /workspace/at.jku.weiner.c.preprocess.tests/src/at/jku/weiner/c/preprocess/mytests/TestExpressionEvaluation.java | cff39a789420ff72e399f6f913de0a3a5b656d98 | [] | no_license | timeraider4u/kefax | 44db2c63ea85e10a5157436bb2dabd742b590032 | 7e46c1730f561d1b76017f0ddb853c94dbb93cd6 | refs/heads/master | 2020-04-16T01:58:01.195430 | 2016-10-30T22:08:29 | 2016-10-30T22:08:29 | 41,462,260 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,320 | java | package at.jku.weiner.c.preprocess.mytests;
import org.eclipse.xtext.junit4.InjectWith;
import org.eclipse.xtext.junit4.XtextRunner;
import org.eclipse.xtext.parser.antlr.ITokenDefProvider;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import at.jku.weiner.c.common.CommonStandaloneSetup;
import at.jku.weiner.c.common.common.AdditiveExpression;
import at.jku.weiner.c.common.common.AndExpression;
import at.jku.weiner.c.common.common.CommonFactory;
import at.jku.weiner.c.common.common.EqualityExpression;
import at.jku.weiner.c.common.common.ExclusiveOrExpression;
import at.jku.weiner.c.common.common.InclusiveOrExpression;
import at.jku.weiner.c.common.common.LogicalAndExpression;
import at.jku.weiner.c.common.common.LogicalOrExpression;
import at.jku.weiner.c.common.common.MultiplicativeExpression;
import at.jku.weiner.c.common.common.PostfixExpression;
import at.jku.weiner.c.common.common.RelationalExpression;
import at.jku.weiner.c.common.common.ShiftExpression;
import at.jku.weiner.c.common.common.UnaryExpression;
import at.jku.weiner.c.preprocess.parser.antlr.internal.InternalPreprocessLexer;
import at.jku.weiner.c.preprocess.preprocess.PreprocessFactory;
import at.jku.weiner.c.preprocess.preprocess.PrimaryExpression;
import at.jku.weiner.c.preprocess.tests.PreprocessInjectorProvider;
import at.jku.weiner.c.preprocess.utils.LexerUtils;
import at.jku.weiner.c.preprocess.utils.expressions.ExpressionEvaluation;
import at.jku.weiner.c.preprocess.utils.expressions.ExpressionLongVisitor;
import at.jku.weiner.c.preprocess.utils.expressions.IExpressionVisitor;
import at.jku.weiner.c.preprocess.utils.macros.DefinitionTable;
import at.jku.weiner.log.MyLog;
import com.google.inject.Inject;
import com.google.inject.Injector;
@RunWith(XtextRunner.class)
@InjectWith(PreprocessInjectorProvider.class)
public class TestExpressionEvaluation {
protected final PreprocessFactory factory1 = PreprocessFactory.eINSTANCE;
protected final CommonFactory factory2 = CommonFactory.eINSTANCE;
private String unaryOperatorPlus;
private String unaryOperatorMinus;
private String unaryOperatorNot;
private ExpressionEvaluation<Long> evaluater;
@Inject
private InternalPreprocessLexer lexer;
@Inject
private ITokenDefProvider tokenDefProvider;
private DefinitionTable definitionTable;
protected PrimaryExpression primaryExpression1;
protected PrimaryExpression primaryExpression2;
protected PrimaryExpression primaryExpression3;
protected PrimaryExpression primaryExpression4;
protected PostfixExpression postfixExpression;
protected UnaryExpression unaryExpression;
protected MultiplicativeExpression multiplicateExpression;
protected AdditiveExpression additiveExpression;
protected ShiftExpression shiftExpression;
protected RelationalExpression relationalExpression;
protected EqualityExpression equalityExpression;
protected AndExpression andExpression;
protected ExclusiveOrExpression exclusiveOrExpression;
protected InclusiveOrExpression inclusiveOrExpression;
protected LogicalAndExpression logicalAndExpression;
protected LogicalOrExpression logicalOrExpression;
@Before
public void setUp() throws Exception {
MyLog.setLog_level(MyLog.LOG_NONE);
final LexerUtils lexerUtils = new LexerUtils(this.lexer,
this.tokenDefProvider);
this.definitionTable = new DefinitionTable(lexerUtils);
this.definitionTable.reset();
Assert.assertEquals(0, this.definitionTable.size());
this.primaryExpression1 = this.factory1.createPrimaryExpression();
this.primaryExpression2 = this.factory1.createPrimaryExpression();
this.primaryExpression3 = this.factory1.createPrimaryExpression();
this.primaryExpression4 = this.factory1.createPrimaryExpression();
this.unaryExpression = this.factory2.createUnaryExpression();
this.multiplicateExpression = this.factory2
.createMultiplicativeExpression();
this.additiveExpression = this.factory2.createAdditiveExpression();
this.shiftExpression = this.factory2.createShiftExpression();
this.relationalExpression = this.factory2.createRelationalExpression();
this.equalityExpression = this.factory2.createEqualityExpression();
this.andExpression = this.factory2.createAndExpression();
this.exclusiveOrExpression = this.factory2
.createExclusiveOrExpression();
this.inclusiveOrExpression = this.factory2
.createInclusiveOrExpression();
this.logicalAndExpression = this.factory2.createLogicalAndExpression();
this.logicalOrExpression = this.factory2.createLogicalOrExpression();
this.unaryOperatorPlus = "+";
this.unaryOperatorMinus = "-";
this.unaryOperatorNot = "!";
final Injector injector = this.getInjector();
final IExpressionVisitor<Long> visitor = new ExpressionLongVisitor(
injector, this.definitionTable);
this.evaluater = new ExpressionEvaluation<Long>(visitor);
}
private Injector getInjector() {
// only do when we are executing tests,
// but not when in Eclipse environment
final CommonStandaloneSetup setup = new CommonStandaloneSetup();
final Injector injector = setup.createInjectorAndDoEMFRegistration();
return injector;
}
@After
public void tearDown() throws Exception {
this.definitionTable.reset();
Assert.assertEquals(0, this.definitionTable.size());
}
@Test(timeout = 1000)
public void testPrimaryExpressionTrue() {
this.primaryExpression1.setConst("1");
Assert.assertEquals(ExpressionLongVisitor.TRUE,
this.evaluater.walkTo(this.primaryExpression1));
}
@Test(timeout = 1000)
public void testPrimaryExpressionFalse() {
this.primaryExpression1.setConst("0");
Assert.assertEquals(ExpressionLongVisitor.FALSE,
this.evaluater.walkTo(this.primaryExpression1));
}
@Test(timeout = 1000)
public void testUnaryExpressionTrue1() {
this.primaryExpression1.setConst("1");
this.unaryExpression.setOp(this.unaryOperatorPlus);
this.unaryExpression.setExpr(this.primaryExpression1);
Assert.assertEquals(ExpressionLongVisitor.TRUE,
this.evaluater.walkTo(this.unaryExpression));
}
@Test(timeout = 1000)
public void testUnaryExpressionFalse1() {
this.primaryExpression1.setConst("0");
this.unaryExpression.setOp(this.unaryOperatorPlus);
this.unaryExpression.setExpr(this.primaryExpression1);
Assert.assertEquals(ExpressionLongVisitor.FALSE,
this.evaluater.walkTo(this.unaryExpression));
}
@Test(expected = UnsupportedOperationException.class, timeout = 1000)
public void testUnaryExpressionIllegalOperator1() {
final String op = "&";
this.primaryExpression1.setConst("0");
this.unaryExpression.setOp(op);
this.unaryExpression.setExpr(this.primaryExpression1);
this.evaluater.walkTo(this.unaryExpression);
}
@Test(expected = UnsupportedOperationException.class, timeout = 1000)
public void testUnaryExpressionIllegalOperator2() {
final String op = "*";
this.primaryExpression1.setConst("0");
this.unaryExpression.setOp(op);
this.unaryExpression.setExpr(this.primaryExpression1);
this.evaluater.walkTo(this.unaryExpression);
}
@Test(expected = UnsupportedOperationException.class, timeout = 1000)
public void testUnaryExpressionIllegalOperator3() {
final String op = "*";
this.primaryExpression1.setConst("0");
this.unaryExpression.setOp(op);
this.unaryExpression.setExpr(this.primaryExpression1);
this.evaluater.walkTo(this.unaryExpression);
}
@Test(timeout = 1000)
public void testUnaryExpressionTrue2() {
this.primaryExpression1.setConst("1");
this.unaryExpression.setOp(this.unaryOperatorMinus);
this.unaryExpression.setExpr(this.primaryExpression1);
final Long expected = new Long(-1);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.unaryExpression));
}
@Test(timeout = 1000)
public void testUnaryExpressionFalse2() {
this.primaryExpression1.setConst("0");
this.unaryExpression.setOp(this.unaryOperatorMinus);
this.unaryExpression.setExpr(this.primaryExpression1);
Assert.assertEquals(ExpressionLongVisitor.FALSE,
this.evaluater.walkTo(this.unaryExpression));
}
@Test(timeout = 1000)
public void testUnaryExpressionTrue3() {
this.primaryExpression1.setConst("0");
this.unaryExpression.setOp(this.unaryOperatorNot);
this.unaryExpression.setExpr(this.primaryExpression1);
Assert.assertEquals(ExpressionLongVisitor.TRUE,
this.evaluater.walkTo(this.unaryExpression));
}
@Test(timeout = 1000)
public void testUnaryExpressionFalse3a() {
this.primaryExpression1.setConst("1");
this.unaryExpression.setOp(this.unaryOperatorNot);
this.unaryExpression.setExpr(this.primaryExpression1);
Assert.assertEquals(ExpressionLongVisitor.FALSE,
this.evaluater.walkTo(this.unaryExpression));
}
@Test(timeout = 1000)
public void testUnaryExpressionFalse3b() {
this.primaryExpression1.setConst("-1");
this.unaryExpression.setOp(this.unaryOperatorNot);
this.unaryExpression.setExpr(this.primaryExpression1);
Assert.assertEquals(ExpressionLongVisitor.FALSE,
this.evaluater.walkTo(this.unaryExpression));
}
@Test(timeout = 1000)
public void testMultiExpressionTrue() {
this.primaryExpression1.setConst("3");
this.primaryExpression2.setConst("2");
this.multiplicateExpression.setLeft(this.primaryExpression1);
this.multiplicateExpression.setOp("/");
this.multiplicateExpression.setRight(this.primaryExpression2);
Assert.assertEquals(ExpressionLongVisitor.TRUE,
this.evaluater.walkTo(this.multiplicateExpression));
}
@Test(timeout = 1000)
public void testMultiExpressionFalse() {
this.primaryExpression1.setConst("3");
this.primaryExpression2.setConst("2");
this.multiplicateExpression.setLeft(this.primaryExpression1);
this.multiplicateExpression.setOp("%");
this.multiplicateExpression.setRight(this.primaryExpression2);
Assert.assertEquals(ExpressionLongVisitor.TRUE,
this.evaluater.walkTo(this.multiplicateExpression));
}
@Test(timeout = 1000)
public void testMult1() {
this.primaryExpression1.setConst("4");
this.primaryExpression2.setConst("2");
this.multiplicateExpression.setLeft(this.primaryExpression1);
this.multiplicateExpression.setOp("*");
this.multiplicateExpression.setRight(this.primaryExpression2);
final Long expected = new Long(8);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.multiplicateExpression));
}
@Test(timeout = 1000)
public void testMult2() {
this.primaryExpression1.setConst("8");
this.primaryExpression2.setConst("3");
this.multiplicateExpression.setLeft(this.primaryExpression1);
this.multiplicateExpression.setOp("%");
this.multiplicateExpression.setRight(this.primaryExpression2);
final Long expected = new Long(2);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.multiplicateExpression));
}
@Test(timeout = 1000)
public void testMult3() {
this.primaryExpression1.setConst("2");
this.primaryExpression2.setConst("1");
this.multiplicateExpression.setLeft(this.primaryExpression1);
this.multiplicateExpression.setOp("/");
this.multiplicateExpression.setRight(this.primaryExpression2);
final Long expected = new Long(2);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.multiplicateExpression));
}
@Test(timeout = 1000)
public void testMult4() {
this.primaryExpression1.setConst("2");
this.primaryExpression2.setConst("5");
this.multiplicateExpression.setLeft(this.primaryExpression1);
this.multiplicateExpression.setOp("*");
this.multiplicateExpression.setRight(this.primaryExpression2);
final Long expected = new Long(10);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.multiplicateExpression));
}
@Test(timeout = 1000)
public void testAdd1() {
this.primaryExpression1.setConst("4");
this.primaryExpression2.setConst("2");
this.additiveExpression.setLeft(this.primaryExpression1);
this.additiveExpression.setOp("-");
this.additiveExpression.setRight(this.primaryExpression2);
final Long expected = new Long(2);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.additiveExpression));
}
@Test(timeout = 1000)
public void testAdd2() {
this.primaryExpression1.setConst("2");
this.primaryExpression2.setConst("3");
this.additiveExpression.setLeft(this.primaryExpression1);
this.additiveExpression.setOp("+");
this.additiveExpression.setRight(this.primaryExpression2);
final Long expected = new Long(5);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.additiveExpression));
}
@Test(timeout = 1000)
public void testAdd3() {
this.primaryExpression1.setConst("5");
this.primaryExpression2.setConst("1");
this.additiveExpression.setLeft(this.primaryExpression1);
this.additiveExpression.setOp("+");
this.additiveExpression.setRight(this.primaryExpression2);
final Long expected = new Long(6);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.additiveExpression));
}
@Test(expected = IllegalArgumentException.class, timeout = 1000)
public void testAddWithNotEnoughOperators() {
this.additiveExpression.setLeft(this.primaryExpression1);
this.additiveExpression.setOp("-");
this.additiveExpression.setRight(null);
this.evaluater.walkTo(this.additiveExpression);
}
@Test(timeout = 1000)
public void testAdd4() {
this.primaryExpression1.setConst("2");
this.primaryExpression2.setConst("3");
this.additiveExpression.setLeft(this.primaryExpression1);
this.additiveExpression.setOp("+");
this.additiveExpression.setRight(this.primaryExpression2);
// 2 + 3 = 5
final Long expected = new Long(5);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.additiveExpression));
}
@Test(timeout = 1000)
public void testShift1() {
this.primaryExpression1.setConst("5");
this.primaryExpression2.setConst("1");
this.shiftExpression.setLeft(this.primaryExpression1);
this.shiftExpression.setOp(">>");
this.shiftExpression.setRight(this.primaryExpression2);
// 5 >> 1 = 2
final Long expected = new Long(2);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.shiftExpression));
}
@Test(timeout = 1000)
public void testRelational1() {
this.primaryExpression1.setConst("2");
this.primaryExpression2.setConst("3");
this.relationalExpression.setLeft(this.primaryExpression1);
this.relationalExpression.setOp("<");
this.relationalExpression.setRight(this.primaryExpression2);
// 2 < 3
final Long expected = ExpressionLongVisitor.TRUE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.relationalExpression));
}
@Test(timeout = 1000)
public void testRelational2() {
this.primaryExpression1.setConst("2");
this.primaryExpression2.setConst("3");
this.primaryExpression3.setConst("4");
this.additiveExpression.setLeft(this.primaryExpression1);
this.additiveExpression.setOp("+");
this.additiveExpression.setRight(this.primaryExpression2);
this.relationalExpression.setLeft(this.additiveExpression);
this.relationalExpression.setOp(">=");
this.relationalExpression.setRight(this.primaryExpression3);
// 2 + 3 >= 4
final Long expected = ExpressionLongVisitor.TRUE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.relationalExpression));
}
@Test(timeout = 1000)
public void testRelational3() {
this.primaryExpression1.setConst("2");
this.primaryExpression2.setConst("3");
this.primaryExpression3.setConst("5");
this.additiveExpression.setLeft(this.primaryExpression1);
this.additiveExpression.setOp("+");
this.additiveExpression.setRight(this.primaryExpression2);
this.relationalExpression.setLeft(this.additiveExpression);
this.relationalExpression.setOp(">=");
this.relationalExpression.setRight(this.primaryExpression3);
// 2 + 3 >= 5
final Long expected = ExpressionLongVisitor.TRUE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.relationalExpression));
}
@Test(timeout = 1000)
public void testRelational4() {
this.primaryExpression1.setConst("2");
this.primaryExpression2.setConst("3");
this.primaryExpression3.setConst("6");
this.additiveExpression.setLeft(this.primaryExpression1);
this.additiveExpression.setOp("+");
this.additiveExpression.setRight(this.primaryExpression2);
this.relationalExpression.setLeft(this.additiveExpression);
this.relationalExpression.setOp(">=");
this.relationalExpression.setRight(this.primaryExpression3);
// 2 + 3 >= 6
final Long expected = ExpressionLongVisitor.FALSE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.relationalExpression));
}
@Test(timeout = 1000)
public void testRelational5() {
this.primaryExpression1.setConst("3");
this.primaryExpression2.setConst("1");
this.primaryExpression3.setConst("4");
this.additiveExpression.setLeft(this.primaryExpression1);
this.additiveExpression.setOp("+");
this.additiveExpression.setRight(this.primaryExpression2);
this.relationalExpression.setLeft(this.additiveExpression);
this.relationalExpression.setOp(">=");
this.relationalExpression.setRight(this.primaryExpression3);
// 3 + 1 >= 4
final Long expected = ExpressionLongVisitor.TRUE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.relationalExpression));
}
@Test(timeout = 1000)
public void testRelational6() {
this.primaryExpression1.setConst("4");
this.primaryExpression2.setConst("5");
this.relationalExpression.setLeft(this.primaryExpression1);
this.relationalExpression.setOp(">=");
this.relationalExpression.setRight(this.primaryExpression2);
// 4 >= 5
final Long expected = ExpressionLongVisitor.FALSE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.relationalExpression));
}
@Test(timeout = 1000)
public void testRelational7() {
this.primaryExpression1.setConst("4");
this.primaryExpression2.setConst("5");
this.relationalExpression.setLeft(this.primaryExpression1);
this.relationalExpression.setOp(">");
this.relationalExpression.setRight(this.primaryExpression2);
// 4 >= 5
final Long expected = ExpressionLongVisitor.FALSE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.relationalExpression));
}
@Test(timeout = 1000)
public void testRelational8() {
this.primaryExpression1.setConst("4");
this.primaryExpression2.setConst("5");
this.relationalExpression.setLeft(this.primaryExpression1);
this.relationalExpression.setOp("<");
this.relationalExpression.setRight(this.primaryExpression2);
// 4 < 5
final Long expected = ExpressionLongVisitor.TRUE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.relationalExpression));
}
@Test(timeout = 1000)
public void testRelational9() {
this.primaryExpression1.setConst("4");
this.primaryExpression2.setConst("5");
this.relationalExpression.setLeft(this.primaryExpression1);
this.relationalExpression.setOp("<=");
this.relationalExpression.setRight(this.primaryExpression2);
// 4 <= 5
final Long expected = ExpressionLongVisitor.TRUE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.relationalExpression));
}
@Test(timeout = 1000)
public void testEquality1() {
this.primaryExpression1.setConst("4");
this.primaryExpression2.setConst("4");
this.equalityExpression.setLeft(this.primaryExpression1);
this.equalityExpression.setOp("==");
this.equalityExpression.setRight(this.primaryExpression2);
// 4 == 4
final Long expected = ExpressionLongVisitor.TRUE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.equalityExpression));
}
@Test(timeout = 1000)
public void testEquality2() {
this.primaryExpression1.setConst("4");
this.primaryExpression2.setConst("3");
this.equalityExpression.setLeft(this.primaryExpression1);
this.equalityExpression.setOp("==");
this.equalityExpression.setRight(this.primaryExpression2);
// 4 == 3
final Long expected = ExpressionLongVisitor.FALSE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.equalityExpression));
}
@Test(timeout = 1000)
public void testEquality3() {
this.primaryExpression1.setConst("4");
this.primaryExpression2.setConst("3");
this.equalityExpression.setLeft(this.primaryExpression1);
this.equalityExpression.setOp("!=");
this.equalityExpression.setRight(this.primaryExpression2);
// 4 == 3
final Long expected = ExpressionLongVisitor.TRUE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.equalityExpression));
}
@Test(timeout = 1000)
public void testLogicalAnd1() {
this.primaryExpression1.setConst("1");
this.primaryExpression2.setConst("2");
this.logicalAndExpression.setLeft(this.primaryExpression1);
this.logicalAndExpression.setRight(this.primaryExpression2);
// 1 && 2
final Long expected = new Long(1);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.logicalAndExpression));
}
@Test(timeout = 1000)
public void testLogicalOr1() {
this.primaryExpression1.setConst("0");
this.primaryExpression2.setConst("1");
this.logicalOrExpression.setLeft(this.primaryExpression1);
this.logicalOrExpression.setRight(this.primaryExpression2);
// 0 || 1
final Long expected = new Long(1);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.logicalOrExpression));
}
@Test(timeout = 1000)
public void testLogicalOr2() {
this.primaryExpression1.setConst("1");
this.primaryExpression2.setConst("1");
this.logicalOrExpression.setLeft(this.primaryExpression1);
this.logicalOrExpression.setRight(this.primaryExpression2);
// 1 || 1
final Long expected = new Long(1);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.logicalOrExpression));
}
@Test(timeout = 1000)
public void testLong1() {
final Long zero = new Long(0);
Assert.assertEquals(ExpressionLongVisitor.FALSE, zero);
Assert.assertTrue(ExpressionLongVisitor.FALSE.equals(zero));
Assert.assertNotEquals(ExpressionLongVisitor.TRUE, zero);
Assert.assertFalse(ExpressionLongVisitor.TRUE.equals(zero));
}
@Test(timeout = 1000)
public void testLong2() {
final Long one = new Long(1);
Assert.assertEquals(ExpressionLongVisitor.TRUE, one);
Assert.assertTrue(ExpressionLongVisitor.TRUE.equals(one));
Assert.assertNotEquals(ExpressionLongVisitor.FALSE, one);
Assert.assertFalse(ExpressionLongVisitor.FALSE.equals(one));
}
}
| [
"[email protected]"
] | |
5616de799c19165f8d4fea3b780e7d241171de5e | cef49f80a7ee7c1f3fa8e01299f82b3f60ed8707 | /src/main/java/com/igor/structural/adapter/Motherboard.java | a7b9d1c43bdaeefc2706df8c37d2292a7bb46b1b | [] | no_license | ihorsas/Patterns | 8494d118192d746fce90144af4e85dea0d4e2c21 | f1ba19a697894596a117b483f37a8d87eaf1a541 | refs/heads/master | 2023-02-23T20:08:50.538173 | 2021-01-29T09:28:35 | 2021-01-29T09:28:35 | 234,545,911 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 158 | java | package com.igor.structural.adapter;
public class Motherboard {
private SSDPCI ssd;
public void putSSD(SSDPCI ssd){
this.ssd = ssd;
}
}
| [
"[email protected]"
] | |
87d62369b9f0daad181368671e3eea1765139c91 | c785eb7007e21834c9d7126a6b55d575cd2a51a3 | /src/main/java/cards/BuriedHorror.java | 87ff800e414065600973678e5eb33f98e33aa42d | [] | no_license | RyanHecht/cardstone | 36f3b376820a3cba8627e430bab395df061ed094 | a3f16a8290b04701e612253721ae0a8c084ac3e5 | refs/heads/master | 2021-01-19T14:25:00.054797 | 2017-09-23T18:41:19 | 2017-09-23T18:41:19 | 84,145,899 | 3 | 3 | null | null | null | null | UTF-8 | Java | false | false | 2,815 | java | package cards;
import cardgamelibrary.Board;
import cardgamelibrary.CardType;
import cardgamelibrary.Creature;
import cardgamelibrary.CreatureInterface;
import cardgamelibrary.Effect;
import cardgamelibrary.Event;
import cardgamelibrary.EventType;
import cardgamelibrary.ManaPool;
import cardgamelibrary.Zone;
import effects.CreatureAttackCreatureEffect;
import effects.CreatureAttackPlayerEffect;
import effects.EffectType;
import effects.EmptyEffect;
import effects.KillCreatureEffect;
import events.CreatureAttackEvent;
import events.PlayerAttackEvent;
import game.Player;
import templates.CantAttackWhileCreature;
public class BuriedHorror extends Creature implements CantAttackWhileCreature{
private static final String defaultImage = "images/BuriedHorror.jpg";
private static final String defaultName = "Buried Horror";
private static final String defaultText = "Can't attack. Next time an enemy minion attacks, instead destroy it and this can attack.";
private static final int defaultHealth = 9;
private static final int defaultAttack = 6;
private static final CardType defaultType = CardType.CREATURE;
private boolean buried;
public BuriedHorror(Player owner) {
super(defaultHealth, defaultAttack, new ManaPool(70, 0, 0, 2, 0, 0), defaultImage, owner, defaultName, defaultText, defaultType);
this.buried = true;
}
public boolean onProposedEffect(Effect e, Zone z, Board b){
if(buried && z.equals(Zone.CREATURE_BOARD)){
if (e.getType() == EffectType.CREATURE_ATTACK_CREATURE) {
CreatureAttackCreatureEffect eve = (CreatureAttackCreatureEffect) e;
return !eve.getAttacker().getOwner().equals(getOwner());
} else if (e.getType() == EffectType.PLAYER_ATTACKED) {
CreatureAttackPlayerEffect eve = (CreatureAttackPlayerEffect) e;
return !eve.getAttacker().getOwner().equals(getOwner());
}
}
return false;
}
public Effect getNewProposition(Effect e, Zone z){
if(buried){
if (e.getType() == EffectType.CREATURE_ATTACK_CREATURE) {
CreatureAttackCreatureEffect eve = (CreatureAttackCreatureEffect) e;
return new KillCreatureEffect(eve.getAttacker(),this);
} else if (e.getType() == EffectType.PLAYER_ATTACKED) {
CreatureAttackPlayerEffect eve = (CreatureAttackPlayerEffect) e;
return new KillCreatureEffect(eve.getAttacker(),this);
}
}
return e;
}
public Effect onCreatureAttacked(CreatureInterface attacker, CreatureInterface target, Zone z){
if(buried){
if(attacker.getOwner().equals(getOwner())){
buried = false;
return new KillCreatureEffect(attacker,this);
}
}
return EmptyEffect.create();
}
@Override
public boolean attackAllowedYet() {
return !buried;
}
}
| [
"Josh Pattiz"
] | Josh Pattiz |
731b65ddfaae1163c47c9796e41469d9d755b1d1 | 6321f3279eb494c3ed33e4239169b13a5ccebb11 | /src/main/java/com/jadmin/controller/admin/base/system/ConfigController.java | 8da4ef60079c7ba842808c3cf5bc8691a298b62f | [] | no_license | PhoenixMFW/JAdmin | 91d735439bc43b0f37e8c24e15777166ab160530 | 43b7187cfa8bd08eb4ceb0539f3243a4bdfd0c90 | refs/heads/master | 2022-07-08T14:07:17.705022 | 2020-01-13T03:07:42 | 2020-01-13T03:07:42 | 233,500,414 | 0 | 1 | null | 2022-06-29T17:54:17 | 2020-01-13T03:07:16 | Java | UTF-8 | Java | false | false | 2,453 | java | package com.jadmin.controller.admin.base.system;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.jadmin.modules.annotation.AdminPage;
import com.jadmin.modules.annotation.column.FormColunm;
import com.jadmin.modules.annotation.column.InitDefaultColunm;
import com.jadmin.modules.annotation.column.TableColumn;
import com.jadmin.modules.annotation.column.UniqueColunm;
import com.jadmin.modules.annotation.list.AdminPageNoButton;
import com.jadmin.modules.annotation.list.DeleteMode;
import com.jadmin.modules.annotation.list.FileConfig;
import com.jadmin.modules.annotation.list.SearchMode;
import com.jadmin.modules.annotation.list.TableHql;
import com.jadmin.modules.controller.base.CommonListController;
import com.jadmin.modules.util.StartCacheUtil;
import com.jadmin.vo.entity.base.ConfigVO;
import com.jadmin.vo.enumtype.AdminPageMenu;
/**
* @Title:web框架
* @Description:系统设置相关的控制层
* @Copyright:JAdmin (c) 2018年08月21日
*
* @author:-jiujiya
* @version:1.0
*/
@Controller
@RequestMapping("/config") // 定义前台url访问的基础路径
@FileConfig // jsp和js的相关配置
@AdminPage(menu = AdminPageMenu.baseCenter, name = "系统设置") // 声明后台管理页面左边的菜单属性,用来控制权限
@AdminPageNoButton({"toShow"}) // 声明页面中不需要的button,默认显示删除、添加、编辑 3个按钮
@DeleteMode(DeleteMode.DELETE) // 定义删除策略为真删
@TableHql(value = "isOpen = 1")
@SearchMode(dateColumn = "operateTime")
public class ConfigController extends CommonListController<ConfigVO> {
@FormColunm(value = "名称")
@TableColumn(search = true)
public String name;
@FormColunm(value = "编号")
@TableColumn(search = true)
@UniqueColunm // 编号不能重复
public String code;
@FormColunm(value = "value", required = false)
@TableColumn
public String coValue;
@InitDefaultColunm("1") // 系统添加的全部默认开放
public String isOpen;
@TableColumn(value = "操作时间")
@InitDefaultColunm
public String operateTime;
@TableColumn(value = "操作人")
@InitDefaultColunm
public String operatorId;
@InitDefaultColunm("1")
public String billStatus;
@FormColunm(value = "描述", type = "textarea", length = 512, required = false)
public String memo;
@Override
public void afterDataChange() {
StartCacheUtil.refurbish("configs");
}
}
| [
"[email protected]"
] | |
9187dda64ebd847abfa1b059a165bc5a19b747b9 | 17e7b339529a619aa354c9f9ce95ec3ccd0c0b94 | /app/src/main/java/com/capstone/coursera/gidma/common/LifecycleLoggingActivity.java | abdb3e54e54713983738b3249f6d6d5366074355 | [] | no_license | munishks13/GIDMApp | b77cceeb5eed04eb343b4629361f3ab8a50c399d | ea0e7f5d9e20248293cfa398e22d811fe24fb3b7 | refs/heads/master | 2021-01-10T06:55:25.082569 | 2015-11-19T04:43:52 | 2015-11-19T04:43:52 | 46,467,668 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,160 | java | package com.capstone.coursera.gidma.common;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
/**
* This abstract class extends the Activity class and overrides lifecycle
* callbacks for logging various lifecycle events.
*/
public abstract class LifecycleLoggingActivity extends Activity {
/**
* Debugging tag used by the Android logger.
*/
protected final static String TAG =
LifecycleLoggingActivity.class.getSimpleName();
/**
* Hook method called when a new instance of Activity is created. One time
* initialization code should go here e.g. UI layout, some class scope
* variable initialization. if finish() is called from onCreate no other
* lifecycle callbacks are called except for onDestroy().
*
* @param savedInstanceState
* object that contains saved state information.
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
// Always call super class for necessary
// initialization/implementation.
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
// The activity is being re-created. Use the
// savedInstanceState bundle for initializations either
// during onCreate or onRestoreInstanceState().
Log.d(TAG, "onCreate(): activity re-created");
} else {
// Activity is being created anew. No prior saved
// instance state information available in Bundle object.
Log.d(TAG, "onCreate(): activity created anew");
}
}
/**
* Hook method called after onCreate() or after onRestart() (when the
* activity is being restarted from stopped state). Should re-acquire
* resources relinquished when activity was stopped (onStop()) or acquire
* those resources for the first time after onCreate().
*/
@Override
protected void onStart() {
// Always call super class for necessary
// initialization/implementation.
super.onStart();
Log.d(TAG, "onStart() - the activity is about to become visible");
}
/**
* Hook method called after onRestoreStateInstance(Bundle) only if there is
* a prior saved instance state in Bundle object. onResume() is called
* immediately after onStart(). onResume() is called when user resumes
* activity from paused state (onPause()) User can begin interacting with
* activity. Place to start animations, acquire exclusive resources, such as
* the camera.
*/
@Override
protected void onResume() {
// Always call super class for necessary
// initialization/implementation and then log which lifecycle
// hook method is being called.
super.onResume();
Log.d(TAG,
"onResume() - the activity has become visible (it is now \"resumed\")");
}
/**
* Hook method called when an Activity loses focus but is still visible in
* background. May be followed by onStop() or onResume(). Delegate more CPU
* intensive operation to onStop for seamless transition to next activity.
* Save persistent state (onSaveInstanceState()) in case app is killed.
* Often used to release exclusive resources.
*/
@Override
protected void onPause() {
// Always call super class for necessary
// initialization/implementation and then log which lifecycle
// hook method is being called.
super.onPause();
Log.d(TAG,
"onPause() - another activity is taking focus (this activity is about to be \"paused\")");
}
/**
* Called when Activity is no longer visible. Release resources that may
* cause memory leak. Save instance state (onSaveInstanceState()) in case
* activity is killed.
*/
@Override
protected void onStop() {
// Always call super class for necessary
// initialization/implementation and then log which lifecycle
// hook method is being called.
super.onStop();
Log.d(TAG,
"onStop() - the activity is no longer visible (it is now \"stopped\")");
}
/**
* Hook method called when user restarts a stopped activity. Is followed by
* a call to onStart() and onResume().
*/
@Override
protected void onRestart() {
// Always call super class for necessary
// initialization/implementation and then log which lifecycle
// hook method is being called.
super.onRestart();
Log.d(TAG, "onRestart() - the activity is about to be restarted()");
}
/**
* Hook method that gives a final chance to release resources and stop
* spawned threads. onDestroy() may not always be called-when system kills
* hosting process
*/
@Override
protected void onDestroy() {
// Always call super class for necessary
// initialization/implementation and then log which lifecycle
// hook method is being called.
super.onDestroy();
Log.d(TAG, "onDestroy() - the activity is about to be destroyed");
}
}
| [
"[email protected]"
] | |
7297f432cc56598ae7b9723a00db6bb93ab4faea | 0e4a094705d36643242de8dbc25ad64ddb901f91 | /src/main/java/duchess/parser/Util.java | dfd248bef4aa103782b61737e1a2300c6b2b0d60 | [] | no_license | muserr/main | 5b6066d0b7ff1e150814b849264b1e24003c7ea0 | 6ad6a81f95e31b6245c9a8781881a7821b58f610 | refs/heads/master | 2020-07-22T06:20:43.825120 | 2019-11-11T13:57:45 | 2019-11-11T13:57:45 | 207,098,983 | 1 | 0 | null | 2019-10-07T09:44:51 | 2019-09-08T10:56:07 | Java | UTF-8 | Java | false | false | 7,265 | java | package duchess.parser;
import duchess.exceptions.DuchessException;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.time.format.ResolverStyle;
import java.time.temporal.TemporalAdjusters;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
/**
* Collection of helpful functions to parse user input.
*/
public class Util {
private static final String INVALID_FORMAT_MESSAGE = "Please enter the date and time as such : dd/mm/yyyy hhmm.";
private static final String INVALID_DATE_FORMAT_MESSAGE = "Please enter the date as such : dd/mm/yyyy.";
private static final String INVALID_TIME_FORMAT_MESSAGE = "Please enter the time as such : hhmm";
private static final DateTimeFormatter formatter =
DateTimeFormatter.ofPattern("dd/MM/uuuu HHmm")
.withResolverStyle(ResolverStyle.STRICT);
private static final String MONDAY = "MONDAY";
private static final String TUESDAY = "TUESDAY";
private static final String WEDNESDAY = "WEDNESDAY";
private static final String THURSDAY = "THURSDAY";
private static final String FRIDAY = "FRIDAY";
private static final String SATURDAY = "SATURDAY";
private static final String SUNDAY = "SUNDAY";
private Util() {
// Note that this class is not meant to be instantiated
// similar to the Math class.
//
// It's simply a collection of utility functions.
}
/**
* Obtains an instance of LocalTime from a text string using a formatter of pattern "HHmm".
*
* @param time text to parse
* @return the parsed local time
*/
private static LocalTime parseTime(String time) throws DuchessException {
try {
return LocalTime.parse(time, DateTimeFormatter.ofPattern("HHmm"));
} catch (DateTimeParseException e) {
throw new DuchessException(INVALID_TIME_FORMAT_MESSAGE);
}
}
/**
* Obtains an instance of LocalDate from a text string containing a day of week.
*
* @param day text to process
* @return the next nearest date which falls on the day of week indicated by {@code day}
* @throws DuchessException thrown if text input does not indicate a day of week
*/
private static LocalDate processDayOfWeek(String day) throws DuchessException {
String capitalDay = day.toUpperCase();
switch (capitalDay) {
case MONDAY:
return LocalDate.now().with(TemporalAdjusters.next(DayOfWeek.MONDAY));
case TUESDAY:
return LocalDate.now().with(TemporalAdjusters.next(DayOfWeek.TUESDAY));
case WEDNESDAY:
return LocalDate.now().with(TemporalAdjusters.next(DayOfWeek.WEDNESDAY));
case THURSDAY:
return LocalDate.now().with(TemporalAdjusters.next(DayOfWeek.THURSDAY));
case FRIDAY:
return LocalDate.now().with(TemporalAdjusters.next(DayOfWeek.FRIDAY));
case SATURDAY:
return LocalDate.now().with(TemporalAdjusters.next(DayOfWeek.SATURDAY));
case SUNDAY:
return LocalDate.now().with(TemporalAdjusters.next(DayOfWeek.SUNDAY));
default:
throw new DuchessException(INVALID_DATE_FORMAT_MESSAGE);
}
}
/**
* Obtains an instance of LocalDate from a text string using a formatter of pattern "dd/MM/yyyy".
*
* @param date date to parse
* @return the parsed local date
* @throws DuchessException thrown if text input is not in ISO format, or does not indicate a day of week
*/
public static LocalDate parseDate(String date) throws DuchessException {
try {
return LocalDate.parse(date, DateTimeFormatter.ofPattern("dd/MM/yyyy"));
} catch (DateTimeParseException e) {
return processDayOfWeek(date);
}
}
/**
* Obtains an instance of LocalDateTime from a text input.
* Text input is parsed to given LocalDate and LocalTime.
* LocalDate and LocalTime is then used to form LocalDateTime.
*
* @param dateTime dateTime to parse
* @return the parsed local date time
* @throws DuchessException thrown if invalid
*/
public static LocalDateTime parseDateTime(String dateTime) throws DuchessException {
try {
String[] arr = dateTime.split(" ");
if (arr.length > 2) {
throw new DuchessException(INVALID_FORMAT_MESSAGE);
}
return LocalDateTime.of(parseDate(arr[0]), parseTime(arr[1]));
} catch (Exception e) {
throw new DuchessException(INVALID_FORMAT_MESSAGE);
}
}
/**
* Parses a date and returns a {@code List<LocalDate>} object.
*
* @param date a date input
* @return the nearest or same monday date and nearest or same sunday date
*/
public static List<LocalDate> parseToWeekDates(LocalDate date) {
LocalDate startOfWeek = date.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
LocalDate endOfWeek = date.with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY));
return Arrays.asList(startOfWeek, endOfWeek);
}
/**
* Returns a {@code String} from a {@code LocalDateTime} object with the desired formatting.
*
* @param dateTime the object to format
* @return the formatted string
*/
public static String formatDateTime(LocalDateTime dateTime) {
return formatter.format(dateTime);
}
/**
* Returns a map mapping the parameter to its corresponding values from user input.
*
* @param input the raw input from the user
* @return the mapping of parameter to values
*/
public static TreeMap<String, String> parameterize(String input) {
TreeMap<String, String> mappedTokens = new TreeMap<>();
String currentParameter = "general";
List<String> collectedTokens = new ArrayList<>();
for (String token : List.of(input.split("\\s+"))) {
if (!mappedTokens.containsKey("command")) {
mappedTokens.put("command", token);
} else if (token.charAt(0) == '/') {
mappedTokens.put(
currentParameter,
String.join(" ", collectedTokens)
);
currentParameter = token.substring(1);
collectedTokens = new ArrayList<>();
} else {
collectedTokens.add(token);
}
}
mappedTokens.put(
currentParameter,
String.join(" ", collectedTokens)
);
removeEmptyStrings(mappedTokens);
return mappedTokens;
}
private static void removeEmptyStrings(Map<String, String> map) {
for (String key : map.keySet()) {
if (map.get(key).equals("")) {
map.put(key, null);
}
}
}
public static Map<String, String> parameterizeWithoutCommand(String input) {
return parameterize("dummy " + input);
}
}
| [
"[email protected]"
] | |
7ea4bb0fd60143a002b1c9fb9dbd6972cb5b5947 | 2c9003f3c4f3b5182ec1e8dbe7e707eb7fac0031 | /src/main/java/com/example/suduko/dao/UserRepository.java | abe120830ca535db689a4bebde3d97399f8193ab | [] | no_license | TamtePrathamesh/sb_mapping | 208d5c13a0bec0d2c83ba4057cc80ffa65c00576 | 34a109a5ded2d173c5b1ef75176be13d9f92ad5c | refs/heads/main | 2023-04-04T02:51:17.088554 | 2021-04-04T05:45:09 | 2021-04-04T05:45:09 | 354,465,954 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 270 | java | package com.example.suduko.dao;
import com.example.suduko.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface UserRepository extends JpaRepository<User, Integer> {
}
| [
"[email protected]"
] | |
8831030b00f3b2899c0e6e648972d6c22fdf56eb | 0b690b9d328a5cc8e8e77ad79a778134ebdda7cb | /app/src/main/java/com/example/restapiexample/model/ResObj.java | 8bb09fdc36f8b2b6727e0b18a35661cf4813d0fc | [] | no_license | themadeye/RestAPIExample | 2d854ebda392769435cacdf4e82e6583ac7dfa84 | a9292ab1dcf36ac5d2f08919e946484ba9022aa1 | refs/heads/master | 2022-12-14T21:05:49.838203 | 2020-09-07T15:08:51 | 2020-09-07T15:08:51 | 187,179,028 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 285 | java | package com.example.restapiexample.model;
public class ResObj {
private String message;
public String getMessage() {//this is based on the JSON response token
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
| [
"[email protected]"
] | |
8a18a91e031efe7916fb1af7883b2f5f15e52d70 | 9c8f5a3d3fca251767b4fe3199f29b8c5f5213b6 | /src/day15/collection/set/SetExample.java | 9195111d79d5150f7ab0a386f5a02a11a7f8670d | [] | no_license | jhlee7562/java_basic_study | 706a41c2fd2f33f5580f077e97878faf939c1323 | 7edab59e304ed68d0a27355dde035779894fdad3 | refs/heads/master | 2023-04-05T02:49:05.317980 | 2021-04-02T05:45:48 | 2021-04-02T05:45:48 | 346,592,191 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,026 | java | package day15.collection.set;
import java.util.HashSet;
import java.util.Set;
public class SetExample {
public static void main(String[] args) {
//Set : 중복 저장 허용x, 순서없이 빠른 속도로 저장, 전체 탐색속도 빠름
Set<String> set = new HashSet<>();
//set에 객체 추가 : add()
set.add("김말이");
set.add("닭강정");
set.add("단무지");
set.add("김밥");
set.add("떡볶이");
System.out.println(set.size());
System.out.println(set);
//set 반복문 처리
System.out.println("=======================");
for(String str : set){
System.out.println(str);
}
System.out.println("=======================");
//set의 객체 삭제 : remove(obj)
set.remove("단무지");
System.out.println("set");
System.out.println("=======================");
set.clear();
System.out.println(set.isEmpty());
}
}
| [
"[email protected]"
] | |
60740548aaea4727122e20dd6625a5ffd3eda1a6 | b3f7bacd787b8cb811985ad83e32f9df81044413 | /DSAPractice/src/com/practice/interviewbit/ReverseBits.java | 9a00739b02c90bf653656b600ff6c64887442258 | [] | no_license | nishantbansal7869/DSA-practice | 5e2e46fb0e04d1daabee68bd74a0a95b7f2d8d26 | 19bd5941928cd83390bf14945e466de20f2923d1 | refs/heads/master | 2023-01-06T06:11:18.956372 | 2020-10-28T12:25:18 | 2020-10-28T12:25:18 | 271,200,815 | 0 | 0 | null | 2020-10-28T12:25:19 | 2020-06-10T06:49:06 | Java | UTF-8 | Java | false | false | 559 | java | package com.practice.interviewbit;
import java.util.Scanner;
public class ReverseBits {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long n = sc.nextLong();
long reverse = reverseBit(n);
System.out.print(reverse);
}
private static long reverseBit(long n) {
int i= 0;
int j = 31;
long n1 = 0;
for (; i < 32; i++){
if ((n&(1<<i)) > 0){
n1 = n1 | 1l<<j;
}
j--;
}
return n1;
}
}
| [
"[email protected]"
] | |
53257507b79765bf44bbcc2ccd8c337485919428 | 3171b34358d53ce00b479441c1ba9298bcf30b52 | /src/test/java/com/subang/util/UtilTest.java | 8e1f30da986591c14d7f29f80692fa093798249e | [] | no_license | strongqiang/SuBang | 61143ef3e9a9dab10b8e709d12b48349017336f9 | e23fdec8e785b2d119b45101193b821ac9ed039d | refs/heads/master | 2020-12-11T05:51:57.426618 | 2015-10-16T09:23:38 | 2015-10-16T09:23:38 | 43,821,275 | 0 | 0 | null | 2015-10-07T14:26:35 | 2015-10-07T14:26:34 | null | UTF-8 | Java | false | false | 702 | java | package com.subang.util;
import org.apache.log4j.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import weixin.popular.util.JsonUtil;
import com.subang.util.TimeUtil.Option;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "/applicationContext.xml" })
public class UtilTest {
private static final Logger LOG = Logger.getLogger("sdfas");
@Test
public void test() throws Exception {
Option option = new Option(null, "Qing");
String json = JsonUtil.toJSONString(option);
pause();
}
public void pause() {
}
}
| [
"[email protected]"
] | |
ad51c6e765ecf44772cd2f943bc066d86ccf0262 | 37db8f6b2e7907b71f748808ea9ff8e8d033d564 | /JavaSource/org/unitime/localization/impl/ImportTranslations.java | 1df54a460f6790172df7510f7764fb55e26cbeed | [
"Apache-2.0",
"EPL-2.0",
"CDDL-1.0",
"MIT",
"CC-BY-3.0",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-freemarker",
"LGPL-2.1-only",
"EPL-1.0",
"BSD-3-Clause",
"LGPL-2.1-or-later",
"LGPL-3.0-only",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | UniTime/unitime | 48eaa44ae85db344d015577d21dcc1a41cecd862 | bc69f2e18f82bdb6c995c4e6490cb650fa4fa98e | refs/heads/master | 2023-08-18T00:52:29.614387 | 2023-08-16T16:08:17 | 2023-08-16T16:08:17 | 29,594,752 | 253 | 185 | Apache-2.0 | 2023-05-17T14:16:13 | 2015-01-21T14:58:53 | Java | UTF-8 | Java | false | false | 9,911 | java | /*
* Licensed to The Apereo Foundation under one or more contributor license
* agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*
* The Apereo Foundation 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.unitime.localization.impl;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;
import org.unitime.localization.impl.ExportTranslations.Locale;
import org.unitime.localization.impl.POHelper.Bundle;
import org.unitime.localization.messages.PageNames;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
/**
* @author Tomas Muller
*/
public class ImportTranslations {
private List<Locale> iLocales = new ArrayList<Locale>();
private Project iProject;
private File iBaseDir;
private File iSource;
private String iTranslations = "Documentation/Translations";
private String iToken = null;
private boolean iGeneratePageNames = false;
private boolean iFixGwtConfig = true;
private boolean iDownload = true;
public ImportTranslations() {}
public void setProject(Project project) {
iProject = project;
iBaseDir = project.getBaseDir();
}
public void setBaseDir(String baseDir) {
iBaseDir = new File(baseDir);
}
public void setSource(String source) {
iSource = new File(source);
}
public Locale createLocale() {
Locale locale = new Locale();
iLocales.add(locale);
return locale;
}
public void addLocale(Locale locale) {
iLocales.add(locale);
}
public void setLocales(String locales) {
for (String value: locales.split(",")) {
addLocale(new Locale(value));
}
}
public void setTranslations(String translations) {
iTranslations = translations;
}
public void setGeneratePageNames(boolean generatePageNames) {
iGeneratePageNames = generatePageNames;
}
public void setFixGwtConfig(boolean fixGwtConfig) {
iFixGwtConfig = fixGwtConfig;
}
public void setDownload(boolean download) {
iDownload = download;
}
public void setToken(String token) {
iToken = token;
}
public void info(String message) {
if (iProject != null)
iProject.log(message);
else
System.out.println(" [info] " + message);
}
public void warn(String message) {
if (iProject != null)
iProject.log(message, Project.MSG_WARN);
else
System.out.println(" [warning] " +message);
}
public void debug(String message) {
if (iProject != null)
iProject.log(message, Project.MSG_DEBUG);
else
System.out.println(" [debug] " +message);
}
public void error(String message) {
if (iProject != null)
iProject.log(message, Project.MSG_ERR);
else
System.out.println(" [error] " +message);
}
public void execute() throws BuildException {
try {
File translations = new File(iBaseDir, iTranslations);
Map<String, byte[]> downloads = new HashMap<String, byte[]>();
if (iDownload) {
info("Downloading translations to: " + translations);
CloseableHttpClient client = HttpClients.createDefault();
for (Locale locale: iLocales) {
debug("Locale " + locale);
HttpPost post = new HttpPost("https://api.poeditor.com/v2/projects/export");
List<NameValuePair> params = new ArrayList<NameValuePair>(2);
params.add(new BasicNameValuePair("api_token", iToken));
params.add(new BasicNameValuePair("id", "568029"));
params.add(new BasicNameValuePair("language", locale.getValue()));
params.add(new BasicNameValuePair("type", "po"));
post.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
CloseableHttpResponse response = client.execute(post);
HttpEntity entity = response.getEntity();
HttpGet get = null;
if (entity != null) {
JsonObject json = JsonParser.parseReader(new InputStreamReader(entity.getContent())).getAsJsonObject();
info("Response: " + json);
String url = json.getAsJsonObject("result").get("url").getAsString();
debug("URL: " + url);
get = new HttpGet(url);
}
response.close();
if (get != null) {
response = client.execute(get);
entity = response.getEntity();
if (entity != null) {
info("Downloading " + get.getURI());
InputStream in = entity.getContent();
byte[] buffer = new byte[10240];
File file = new File(translations, "UniTime" + org.unitime.timetable.util.Constants.VERSION + "_" + locale.getValue() + ".po");
debug("Writing " + file);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
FileOutputStream out = new FileOutputStream(file);
int read = 0;
while ((read = in.read(buffer)) > 0) {
out.write(buffer, 0, read);
bos.write(buffer, 0, read);
}
out.flush();
out.close();
bos.flush();
bos.close();
downloads.put(locale.getValue(), bos.toByteArray());
}
}
response.close();
}
client.close();
}
if (downloads.isEmpty())
info("Importing translations from: " + translations);
else
info("Importing translations");
Map<String, String> pageNames = null;
if (iGeneratePageNames) {
PageNameGenerator gen = new PageNameGenerator();
gen.setSource(iSource);
gen.execute();
pageNames = gen.getPageNames();
} else {
Properties p = new Properties();
p.load(new FileInputStream(new File(iSource, PageNames.class.getName().replace('.', File.separatorChar) + ".properties")));
pageNames = new HashMap<String, String>();
for (Map.Entry e: p.entrySet())
pageNames.put((String)e.getKey(), (String)e.getValue());
}
for (Locale locale: iLocales) {
debug("Locale " + locale);
POHelper helper = new POHelper(locale.getValue(), pageNames);
byte[] data = downloads.get(locale.getValue());
if (data == null) {
File input = new File(translations, "UniTime" + org.unitime.timetable.util.Constants.VERSION + "_" + locale.getValue() + ".po");
if (!input.exists()) {
error("Input file " + input + " does not exist.");
continue;
}
helper.readPOFile(null, new InputStreamReader(new FileInputStream(input), StandardCharsets.UTF_8));
} else {
helper.readPOFile(null, new InputStreamReader(new ByteArrayInputStream(data), StandardCharsets.UTF_8));
}
for (Bundle bundle: Bundle.values())
helper.writePropertiesFile(iSource, bundle);
}
Set<String> locales = new HashSet<String>();
if (iFixGwtConfig) {
info("Updating GWT configuration, if needed.");
File config = new File(iSource,
"org" + File.separator + "unitime" + File.separator + "timetable" + File.separator + "gwt"+ File.separator + "UniTime.gwt.xml");
Document document = (new SAXReader()).read(config);
for (Iterator<Element> i = document.getRootElement().elementIterator("extend-property"); i.hasNext(); ) {
Element e = i.next();
if ("locale".equals(e.attributeValue("name")))
locales.add(e.attributeValue("values"));
}
debug("Existing locales: " + locales);
boolean changed = false;
for (Locale locale: iLocales) {
if (!locales.contains(locale.getValue())) {
info("added " + locale);
changed = true;
document.getRootElement().addElement("extend-property")
.addAttribute("name", "locale")
.addAttribute("values", locale.getValue());
}
}
if (changed) {
FileOutputStream out = new FileOutputStream(config);
(new XMLWriter(out, OutputFormat.createPrettyPrint())).write(document);
out.flush(); out.close();
}
}
} catch (Exception e) {
throw new BuildException("Import failed: " + e.getMessage(), e);
}
}
public static void main(String[] args) {
try {
ImportTranslations task = new ImportTranslations();
task.setBaseDir(System.getProperty("source", "/Users/muller/git/unitime"));
task.setSource(System.getProperty("source", "/Users/muller/git/unitime") + File.separator + "JavaSource");
task.setLocales(System.getProperty("locale", "cs"));
task.setToken(System.getProperty("token", "b191dd443ab1800fc1e09ef23e50cdb0"));
task.execute();
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
4664ef4e8b9d58386d8b47ee657051864f789464 | b63bda34e0fe593138d345a8e90d39c9ff7c3411 | /reinvent-coursera-admin/src/main/java/com/coursera/admin/web/service/CategoryService.java | 10f1830619e5d3ff3b276355ac2ce7e77f9537df | [] | no_license | deepaksingh7/reinvent-coursera | 9efaf185fbebf32fae9fa0e8f8b33740cb53d4cf | d6416437fbc76882a8535704104a9eb6a790e005 | refs/heads/master | 2023-01-12T17:30:53.912196 | 2019-11-12T15:52:06 | 2019-11-12T15:52:06 | 221,252,836 | 0 | 0 | null | 2023-01-09T22:21:58 | 2019-11-12T15:41:07 | CSS | UTF-8 | Java | false | false | 4,321 | java | package com.coursera.admin.web.service;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.stereotype.Service;
import org.springframework.web.client.HttpStatusCodeException;
import org.springframework.web.client.RestTemplate;
import com.coursera.admin.web.model.Category;
import com.coursera.admin.web.model.Token;
import com.google.gson.Gson;
@Service
public class CategoryService {
private static final int TIMEOUT = 3000;
@Autowired
RestTemplate restTemplate;
@Value("${category.getURL}")
String serviceURL;
public List<Category> getAllCategory() {
HttpHeaders headers = getToken();
Gson gson = new Gson();
HttpEntity<String> httpReq = new HttpEntity<String>(headers);
ResponseEntity<String> rs = restTemplate.exchange(serviceURL, HttpMethod.GET, httpReq, String.class);
Category[] response = gson.fromJson(rs.getBody(), Category[].class);
return Arrays.asList(response);
}
public Object getCategory(String id) {
HttpHeaders headers = getToken();
Gson gson = new Gson();
HttpEntity<String> httpReq = new HttpEntity<String>(headers);
ResponseEntity<String> rs = restTemplate.exchange(serviceURL+id,HttpMethod.GET,httpReq, String.class);
Category response = gson.fromJson(rs.getBody(), Category.class);
return Arrays.asList(response);
}
private HttpHeaders createHttpHeaders(Map<String, String> map) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
for (Entry<String, String> entry : map.entrySet()) {
headers.add(entry.getKey(), entry.getValue());
}
return headers;
}
public ResponseEntity<String> deleteCategory(String categoryId) {
HttpHeaders headers = getToken();
HttpEntity<String> httpReq = new HttpEntity<String>(headers);
try {
ResponseEntity<String> rs = restTemplate.exchange(serviceURL+categoryId,HttpMethod.DELETE,httpReq, String.class);
return rs;
} catch(HttpStatusCodeException e) {
return ResponseEntity.status(e.getRawStatusCode()).headers(e.getResponseHeaders())
.body(e.getResponseBodyAsString());
}
}
public ResponseEntity<String> addCategory(String jsonRequest) {
HttpHeaders headers = getToken();
Gson gson = new Gson();
Category category = gson.fromJson(jsonRequest, Category.class);
HttpEntity<Category> entity = new HttpEntity<Category>(category, headers);
try {
ResponseEntity<String> response = restTemplate.exchange(serviceURL, HttpMethod.POST, entity, String.class);
return response;
} catch(HttpStatusCodeException e) {
return ResponseEntity.status(e.getRawStatusCode()).headers(e.getResponseHeaders())
.body(e.getResponseBodyAsString());
}
}
public ResponseEntity<String> updateCategory(String jsonRequest, String categoryId) {
HttpHeaders headers = getToken();
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
requestFactory.setConnectTimeout(TIMEOUT);
requestFactory.setReadTimeout(TIMEOUT);
restTemplate.setRequestFactory(requestFactory);
Gson gson = new Gson();
Category category = gson.fromJson(jsonRequest, Category.class);
HttpEntity<Category> entity = new HttpEntity<Category>(category, headers);
try {
ResponseEntity<String> response = restTemplate.exchange(serviceURL+categoryId, HttpMethod.PATCH, entity, String.class);
return response;
} catch(HttpStatusCodeException e) {
return ResponseEntity.status(e.getRawStatusCode()).headers(e.getResponseHeaders())
.body(e.getResponseBodyAsString());
}
}
private HttpHeaders getToken() {
Map<String, String> map = new HashMap<String, String>();
HttpHeaders headers = createHttpHeaders(map);
headers.add("Authorization", Token.getTokenID());
return headers;
}
}
| [
"[email protected]"
] | |
0e254f87e655bb7844034d70146983aa40822dd4 | b5fb39b79f4ed16f76d50553a50c8d70c408c3ca | /src/main/java/bean/beanImpl/InterceptorClass.java | f8a2f6b96db59db0c93eeaad4646caf9e13caf1b | [] | no_license | selphatemba/thegroup | 07790f65e49a6c8a1fc4ef1335a72eafa4a06a9f | 3dd58a6e8d448d53c92e92f2b4aa04f8ab8503f1 | refs/heads/master | 2021-04-06T06:13:02.910374 | 2018-03-16T13:44:05 | 2018-03-16T13:44:05 | 125,174,714 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 654 | java | package bean.beanImpl;
import bean.beanI.English1;
import javax.annotation.Priority;
import javax.interceptor.AroundInvoke;
import javax.interceptor.Interceptor;
import javax.interceptor.InvocationContext;
/**
* Created by SELPHA on 7/3/2018.
*/
@Interceptor
@English1
@Priority(Interceptor.Priority.APPLICATION)
class InterceptorClass {
@AroundInvoke
public Object sayHello1(InvocationContext invocationContext){
System.out.println("i intercepted you.......");
try {
invocationContext.proceed();
} catch (Exception e) {
e.printStackTrace();
}
return new Object();
}
}
| [
"[email protected]"
] | |
72d48eb2a01b2850e2ae8202e20a77f1222cc460 | b2471ee0f11bb97c810ebe59afceec429ab4ca3c | /dashboard-backend/src/main/java/com/dashboard/project/model/ChartOptions.java | 27fb3dc2d0ed5e5afa6663000f4f5c657463dd08 | [] | no_license | andidarzeza/dashboard | 5acafbdff15f9296ab7024d466e2c68486763cad | 429c6cc804380c49fe9f2a85d01d26171ed80b53 | refs/heads/master | 2023-05-06T14:07:48.096355 | 2021-05-26T08:55:47 | 2021-05-26T08:55:47 | 370,968,896 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,319 | java | package com.dashboard.project.model;
import org.springframework.data.annotation.Id;
import java.util.Arrays;
import java.util.List;
public class ChartOptions {
private String chartCanvasID;
private String chartType;
private List<String> chartLabels;
private List<Integer> chartData;
public String getChartCanvasID() {
return chartCanvasID;
}
public void setChartCanvasID(String chartCanvasID) {
this.chartCanvasID = chartCanvasID;
}
public String getChartType() {
return chartType;
}
public void setChartType(String chartType) {
this.chartType = chartType;
}
public List<String> getChartLabels() {
return chartLabels;
}
public void setChartLabels(List<String> chartLabels) {
this.chartLabels = chartLabels;
}
public List<Integer> getChartData() {
return chartData;
}
public void setChartData(List<Integer> chartData) {
this.chartData = chartData;
}
@Override
public String toString() {
return "ChartOptions{" +
"chartCanvasID='" + chartCanvasID + '\'' +
", chartType='" + chartType + '\'' +
", chartLabels=" + chartLabels +
", chartData=" + chartData +
'}';
}
}
| [
"[email protected]"
] | |
b4f8e90edf60b765c06feb75f825714bc2b7fef6 | c3f62571683e406ed84f6b818a04c8f612b41f3c | /src/com/company/Option1.java | 9fd25863d7be29c1defe8addc2a157a9e091a1e1 | [] | no_license | many221/basic_CLI | 16abb9265f84dc90393f38d78601f0b81b620e46 | b0d35e6e0722f37ee19dbbd7a900fd447a87a1a5 | refs/heads/main | 2023-07-08T13:52:31.148639 | 2021-08-13T01:40:27 | 2021-08-13T01:40:27 | 395,460,462 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 234 | java | package com.company;
public class Option1 {
public static void helloUSer(){
System.out.print ("Please Enter Your Name: ");
String name = Main.input.next ();
System.out.println ("Hello " + name);
}
}
| [
"[email protected]"
] | |
4d3f9c9d681cb4740d0e9b0f3e3cc73d8b9c0c2f | 0f3323963dc5a883f9afb621748798f43a4aef9a | /src/main/java/hu/flow/workoutTracker/Model/Workout.java | 6599581403b090a0434df0128b473d4857f09085 | [
"MIT"
] | permissive | urbanjozsef88/FlowHomeProject | fd74504c267bea9f4fca8bb32d133c8ac6157c10 | e3c76aa1c684024af95612dbe6bc1c14c739d9d9 | refs/heads/master | 2020-12-10T20:15:11.274560 | 2020-01-22T22:39:57 | 2020-01-22T22:39:57 | 233,698,176 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,194 | java | package hu.flow.workoutTracker.Model;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.time.LocalDate;
import java.util.List;
@Data
@Entity
@Builder
@Table
@NoArgsConstructor
@AllArgsConstructor
public class Workout {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Column
private String name;
@Column
private LocalDate createdAt;
@Column
private int totalSets;
@Column
private int totalReps;
@Column
private double totalWeightMoved;
@JsonBackReference
@ManyToOne
@JoinColumn
private User user;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "workout")
@JsonManagedReference
private List<Exercise> exercises;
@Override
public String toString() {
return "name:'" + name + '\'' +
", Total sets:" + totalSets +
", Total reps:" + totalReps +
", Total Weight Moved:" + totalWeightMoved;
}
}
| [
"[email protected]"
] | |
c1e85a2364067ab464430ac169df1108d688e4ba | 96f8d42c474f8dd42ecc6811b6e555363f168d3e | /zuiyou/sources/cn/xiaochuankeji/tieba/ui/my/mypost/a.java | d0b91f75146d4e913c5ee5ab4a32d5fb3f3972b2 | [] | no_license | aheadlcx/analyzeApk | 050b261595cecc85790558a02d79739a789ae3a3 | 25cecc394dde4ed7d4971baf0e9504dcb7fabaca | refs/heads/master | 2020-03-10T10:24:49.773318 | 2018-04-13T09:44:45 | 2018-04-13T09:44:45 | 129,332,351 | 6 | 2 | null | null | null | null | UTF-8 | Java | false | false | 134 | java | package cn.xiaochuankeji.tieba.ui.my.mypost;
public class a {
public long a;
public a(long j) {
this.a = j;
}
}
| [
"[email protected]"
] | |
308527e99341c786dad2696b0c3b9219c3811663 | 2171e43c37923ada71e753029ccffbda7fc2667a | /src/Abstract/TestTv.java | b592bb07d3d3245b610eab7170b9c1092dd28451 | [] | no_license | aneeqkhan007/hw3-Abstract-encapsulation-and-poly | a94bc2e15596391fa24d4297f4e4dd85f260c9e3 | 66ac6b328db4ddb257cd22743c8bcd2b78cbb68b | refs/heads/master | 2021-04-12T09:27:18.107696 | 2018-03-25T19:24:31 | 2018-03-25T19:24:31 | 126,731,885 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 200 | java | package Abstract;
public class TestTv {
public static void main(String[] args) {
Sony s = new Sony();
s.on();
s.off();
s.wired();
s.setting();
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.