text stringlengths 10 2.72M |
|---|
package com.example.girlswhocode.test;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.content.Intent;
import android.view.View;
import android.widget.*;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button2 = (Button) findViewById(R.id.button2);
button2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {mentalhealth();
}
});
Button police= (Button) findViewById(R.id.button3);
police.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {arrest();
}
});
Button immigration = (Button)findViewById(R.id.button4);
immigration.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {immigrants();
}
});
Button queer= (Button) findViewById(R.id.button5);
queer.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {gay();
}
});
Button abuse= (Button) findViewById(R.id.button7);
abuse.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {abused();
}
});
Button assault= (Button) findViewById(R.id.button17);
assault.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {assaulted();
}
});
Button source= (Button) findViewById(R.id.button25);
source.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {sources();
}
});
}
private void mentalhealth() {
Intent intent = new Intent(this, Activity2.class);
startActivity(intent);
}
private void arrest(){
Intent intent = new Intent(this, Police.class);
startActivity(intent);
}
private void immigrants(){
Intent intent = new Intent(this, Immigration.class);
startActivity(intent);
}
public void gay(){
Intent intent = new Intent(this, LGBT.class);
startActivity(intent);
}
public void abused(){
Intent intent = new Intent(this, Abuse.class);
startActivity(intent);
}
public void assaulted(){
Intent intent = new Intent(this, SexualAssault.class);
startActivity(intent);
}
public void sources(){
Intent intent = new Intent(this, Citations.class);
startActivity(intent);
}
} |
package com.espendwise.manta.util.parser;
import com.espendwise.manta.i18n.I18nUtil;
import com.espendwise.manta.util.Utility;
import com.espendwise.manta.util.alert.AppLocale;
import java.math.BigDecimal;
import java.util.Date;
public class Parse {
public static Integer parseInt(String value) {
return AppParserFactory.getParser(Integer.class).parse(value);
}
public static Date parseDate(String value, AppLocale locale) {
return AppParserFactory.getParser(Date.class).parse(value, I18nUtil.getDatePattern(locale));
}
public static Date parseTime(String value, String pattern) {
return AppParserFactory.getParser(Date.class).parse(value, pattern);
}
public static Date parseDateNN(String value, AppLocale locale) {
String s = Utility.ignorePattern(value, I18nUtil.getDatePatternPrompt(locale));
return Utility.isSet(s) ? AppParserFactory.getParser(Date.class).parse(s, I18nUtil.getDatePattern(locale)) : null;
}
public static Date parseDate(String value, String pattern) {
return AppParserFactory.getParser(Date.class).parse(value, pattern);
}
public static Date parseMonthWithDay(String value, Integer year, AppLocale locale) {
return parseMonthWithDay(value, year, I18nUtil.getDayWithMonthPattern(locale));
}
public static Date parseMonthWithDay(String value, Integer year, String mothWithDayPattern) {
return AppParserFactory.getMonthWithDayParser().parse(value, year, mothWithDayPattern);
}
public static Integer parsePercentInt(String percent) {
return AppParserFactory.getPercentParserInt().parse(percent);
}
public static BigDecimal parseAmount(AppLocale locale, String value) {
return AppParserFactory.getAmountParser().parse(value, locale.getLocale());
}
public static Long parseLong(String value) {
return AppParserFactory.getParser(Long.class).parse(value);
}
public static Long parseLong(String value, boolean nullIfExc) {
try {
return AppParserFactory.getParser(Long.class).parse(value);
} catch (AppParserException e) {
if (nullIfExc) {
return null;
}
throw e;
}
}
}
|
package jp.co.disney.spplogin.helper;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import jp.co.disney.spplogin.Application;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@WebAppConfiguration
@ActiveProfiles("unit")
public class RandomHelperTest {
@Autowired
private RandomHelper randomHelper;
@Test
public void randomIdメソッド() throws Exception {
final String actual = randomHelper.randomID();
final Matcher m = Pattern.compile("^[0-9a-z]+$").matcher(actual);
Assert.assertTrue(m.matches());
}
}
|
package mk.petrovski.weathergurumvp.ui.welcome;
import mk.petrovski.weathergurumvp.ui.base.BaseMvpView;
/**
* Created by Nikola Petrovski on 2/14/2017.
*/
public interface WelcomeMvpView extends BaseMvpView {
void showMainScreen();
void startInit();
}
|
package prueba.servicios;
import java.util.List;
public interface Servicio {
public String traerInverso(String txt);
public List<String> traerPermutacion(String txt);
}
|
public interface Index {
public void IndexStart();
}
|
package id.ac.ub.ptiik.papps.base;
public class JadwalMengajar {
public Matakuliah matakuliah;
public Karyawan dosen;
public String kelas;
public String hari;
public String ruang;
public String prodi;
public String jam_mulai;
public String jam_selesai;
public static final int DOSEN = 1;
public static final int DAY = 2;
public static final int SUBJECT = 3;
public JadwalMengajar(String kelas, String hari, String ruang, String prodi,
String jam_mulai, String jam_selesai) {
this.kelas = kelas;
this.hari = hari;
this.ruang = ruang;
this.prodi = prodi;
this.jam_mulai = jam_mulai;
this.jam_selesai = jam_selesai;
}
public void setMatakuliah(Matakuliah matakuliah) {
this.matakuliah = matakuliah;
}
public void setDosen(Karyawan dosen) {
this.dosen = dosen;
}
}
|
/*
* @project: (Sh)ower (R)econstructing (A)pplication for (M)obile (P)hones
* @version: ShRAMP v0.0
*
* @objective: To detect extensive air shower radiation using smartphones
* for the scientific study of ultra-high energy cosmic rays
*
* @institution: University of California, Irvine
* @department: Physics and Astronomy
*
* @author: Eric Albin
* @email: Eric.K.Albin@gmail.com
*
* @updated: 3 May 2019
*/
package sci.crayfis.shramp;
import android.Manifest;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.support.annotation.NonNull;
import android.os.Bundle;
import android.system.Os;
import android.system.StructUtsname;
import android.util.Log;
import sci.crayfis.shramp.util.BuildString;
import sci.crayfis.shramp.error.FailManager;
import sci.crayfis.shramp.util.Datestamp;
////////////////////////////////////////////////////////////////////////////////////////////////////
// (TODO) UNDER CONSTRUCTION (TODO)
////////////////////////////////////////////////////////////////////////////////////////////////////
// Right now, this doesn't do much..
// The app starts with onCreate(), and this class logs basic device metadata and asks permissions
// before handing full control over to MasterController.
// For the future, I haven't decided exactly what else I want this to do, or if it should just
// be part of MasterController..
/**
* Entry point for the ShRAMP app
* Checks permissions then hands control over to MasterController
* AsyncResponse is for SSH data transfer, currently disabled and probably going to be moved
* out of this class.
*/
@TargetApi(21)
public final class MaineShRAMP extends Activity { //implements AsyncResponse {
// Public Class Fields
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// PERMISSIONS and PERMISSION_CODE..............................................................
// The list of device permissions needed for this app to operate.
// Consider moving this over to GlobalSettings..
public static final String[] PERMISSIONS = {
Manifest.permission.INTERNET,
Manifest.permission.CAMERA,
Manifest.permission.WRITE_EXTERNAL_STORAGE
};
public static final int PERMISSION_CODE = 0; // could be anything >= 0
// Private Instance Fields
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// mNextActivity and mFailActivity..............................................................
// Where to pass control of the app over to. Set in onCreate()
private Intent mNextActivity;
private Intent mFailActivity;
////////////////////////////////////////////////////////////////////////////////////////////////
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
////////////////////////////////////////////////////////////////////////////////////////////////
// Public Overriding Instance Methods
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// onCreate.....................................................................................
/**
* Entry point for the app at start.
* @param savedInstanceState passed in by Android OS for returning from a suspended state
* (not used)
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mNextActivity = new Intent(this, MasterController.class);
mFailActivity = new Intent(this, FailManager.class);
// Setting this flag destroys MaineShRAMP after passing control over to one of these new
// intents
mNextActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
mFailActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Log.e(Thread.currentThread().getName(), "Welcome to the Shower Reconstruction Application for Mobile Phones");
Log.e(Thread.currentThread().getName(), "or \"ShRAMP\" for short");
// Log date
Datestamp.logStartDate();
// Log build info
String buildString = BuildString.get();
Log.e(Thread.currentThread().getName(), buildString);
// Log device info
StructUtsname uname = Os.uname();
String unameString = " \n\n"
+ "Machine: " + uname.machine + "\n"
+ "Node name: " + uname.nodename + "\n"
+ "Release: " + uname.release + "\n"
+ "Sysname: " + uname.sysname + "\n"
+ "Version: " + uname.version + "\n ";
Log.e(Thread.currentThread().getName(), unameString);
// Log hardware info
String buildDetails = " \n\n"
+ "Underlying board: " + Build.BOARD + "\n"
+ "Bootloader version: " + Build.BOOTLOADER + "\n"
+ "Brand: " + Build.BRAND + "\n"
+ "Industrial device: " + Build.DEVICE + "\n"
+ "Build fingerprint: " + Build.FINGERPRINT + "\n"
+ "Hardware: " + Build.HARDWARE + "\n"
+ "Host: " + Build.HOST + "\n"
+ "Changelist label/number: " + Build.ID + "\n"
+ "Hardware manufacturer: " + Build.MANUFACTURER + "\n"
+ "Model: " + Build.MODEL + "\n"
+ "Product name: " + Build.PRODUCT + "\n"
+ "Radio firmware version: " + Build.getRadioVersion() + "\n"
+ "Build tags: " + Build.TAGS + "\n"
+ "Build time: " + Long.toString(Build.TIME) + "\n"
+ "Build type: " + Build.TYPE + "\n"
+ "User: " + Build.USER + "\n ";
Log.e(Thread.currentThread().getName(), buildDetails);
// if the API was 22 or below, the user would have granted permissions on start
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
Log.e(Thread.currentThread().getName(), "API 22 or below, permissions granted on start");
Log.e(Thread.currentThread().getName(), "Starting MasterController");
super.startActivity(this.mNextActivity);
}
else {
// if API > 22
if (permissionsGranted()) {
super.startActivity(this.mNextActivity);
}
else {
// Execution resumes with onRequestPermissionResult() below
super.requestPermissions(PERMISSIONS, PERMISSION_CODE);
}
}
}
// Private Instance Methods
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// permissionsGranted...........................................................................
/**
* Check if permissions have been granted
* @return true if all permissions have been granted, false if not
*/
@TargetApi(23)
private boolean permissionsGranted() {
boolean allGranted = true;
for (String permission : MaineShRAMP.PERMISSIONS) {
int permission_value = checkSelfPermission(permission);
if (permission_value == PackageManager.PERMISSION_DENIED) {
Log.e(Thread.currentThread().getName(), permission + ": " + "DENIED");
allGranted = false;
}
else {
Log.e(Thread.currentThread().getName(), permission + ": " + "GRANTED");
}
}
if (allGranted) {
Log.e(Thread.currentThread().getName(), "All permissions granted");
}
else {
Log.e(Thread.currentThread().getName(), "Some or all permissions denied");
}
return allGranted;
}
// onRequestPermissions.........................................................................
/**
* After user responds to permission request, this routine is called.
* @param requestCode permission code, ref. PERMISSION_CODE field
* @param permissions permissions requested
* @param grantResults user's response
*/
@TargetApi(23)
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (this.permissionsGranted()) {
Log.e(Thread.currentThread().getName(), "Permissions asked and granted");
super.startActivity(mNextActivity);
}
else {
Log.e(Thread.currentThread().getName(), "Permissions were not granted");
super.startActivity(mFailActivity);
}
}
// TODO: SSH stuff works, but isn't used at this moment as I work on getting stats and cuts working right
// Also, probably going to to move this out of MaineShRAMP..
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// SSHrampSession is an AsyncTask, holding this reference allows main to
// see the result when it finishes.
// It's linked to this main activity in onCreate below.
//public static SSHrampSession SSHrampSession_reference = new SSHrampSession();
/*
public void upload() {
TextView textOut = (TextView) findViewById(R.id.textOut);
textOut.append("Uploading to craydata.ps.uci.edu.. \n");
if (haveSSHKey()) {
SSHrampSession_reference.execute(filename);
}
else {
textOut.append("\t shit, ssh fail.");
}
}
*/
/**
* Tests if .ssh folder exists and can read it.
* @return true (yes) or false (no)
*/
//public boolean haveSSHKey() {
// String ssh_path = Environment.getExternalStorageDirectory() + "/.ssh";
// File file_obj = new File(ssh_path);
// return file_obj.canRead();
//}
/**
* Implements the AsyncResponse interface.
* Called after an SSHrampSession operation is completed as an AsyncTask.
* @param status a string of information to give back to the Activity.
*/
//@Override
//public void processFinish(String status){
// TextView textOut = (TextView) findViewById(R.id.textOut);
// textOut.append(status);
//}
} |
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.HashMap;
import java.util.Map;
public class Main {
public static void main (String[] args) throws Exception {
File file = new File(args[0]);
BufferedReader reader = new BufferedReader(new FileReader(file));
String line;
Map<String, Duck> duckMap = new HashMap<>();
while ((line = reader.readLine()) != null ) {
String[] info = line.split(" ");
if (info[0].equals("duck")) {
Duck duck;
if(info[1].equals("MallardDuck")) {
duck = new MallardDuck();
duck.setFlyMode(info[2]);
duck.setQuackMode(info[3]);
}
else if (info[1].equals("RubberDuck")) {
duck = new RubberDuck();
duck.setFlyMode(info[2]);
duck.setQuackMode(info[3]);
}
else if (info[1].equals("RedheadDuck")) {
duck = new RedheadDuck();
duck.setFlyMode(info[2]);
duck.setQuackMode(info[3]);
}
else {
duck = new DecoyDuck();
duck.setFlyMode(info[2]);
duck.setQuackMode(info[3]);
}
duckMap.put(info[1], duck);
}
else if (info[0].equals("changeFly")) {
Duck duck = duckMap.get(info[1]);
duck.setFlyMode(info[2]);
}
else if (info[0].equals("changeQuack")) {
Duck duck = duckMap.get(info[1]);
duck.setQuackMode(info[2]);
}
else if (info[0].equals("swim")) {
Duck duck = duckMap.get(info[1]);
duck.swim();
}
else if (info[0].equals("fly")) {
Duck duck = duckMap.get(info[1]);
FlyMode fly = duck.getFlyMode();
fly.fly();
}
else if (info[0].equals("quack")) {
Duck duck = duckMap.get(info[1]);
QuackMode quack = duck.getQuackMode();
quack.quack();
}
else {
System.out.println("No such command!");
}
}
}
}
|
package com.tencent.mm.plugin.account.model;
import android.content.Context;
import android.os.Looper;
import com.tencent.mm.ab.e;
import com.tencent.mm.ab.f;
import com.tencent.mm.ab.l;
import com.tencent.mm.kernel.g;
import com.tencent.mm.plugin.account.a.j;
import com.tencent.mm.sdk.platformtools.ag;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.mm.ui.base.p;
public final class c implements e, f {
public l bKq;
public Context context;
public a eNU;
private ag handler = new ag(Looper.getMainLooper());
public p tipDialog;
public c(Context context, a aVar) {
this.context = context;
this.eNU = aVar;
}
public final void a(int i, int i2, l lVar) {
final int i3 = i2 != 0 ? (int) ((((long) i) * 100) / ((long) i2)) : 0;
this.handler.post(new Runnable() {
public final void run() {
if (c.this.tipDialog != null) {
c.this.tipDialog.setMessage(c.this.context.getString(j.app_loading_data) + i3 + "%");
}
}
});
}
public final void a(int i, int i2, String str, l lVar) {
if (lVar.getType() == 139) {
g.DF().b(139, this);
} else if (lVar.getType() == 138) {
g.DF().b(138, this);
}
if (i2 == 0 && i == 0) {
this.eNU.Yk();
} else {
x.e("MicroMsg.DoInit", "do init failed, err=" + i + "," + i2);
this.eNU.Yk();
}
if (this.tipDialog != null) {
this.tipDialog.dismiss();
}
}
}
|
package com.tencent.mm.ui.chatting.gallery;
import android.view.View;
import com.tencent.mm.ak.e;
import com.tencent.mm.ak.o;
import com.tencent.mm.model.au;
import com.tencent.mm.model.c;
import com.tencent.mm.sdk.platformtools.ag;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.mm.storage.bd;
import com.tencent.mm.ui.base.MMViewPager;
import com.tencent.mm.ui.chatting.gallery.ImageGalleryUI.a;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import junit.framework.Assert;
public class b$a {
protected boolean adE = false;
int edl;
ag handler = new ag();
private int min;
private List<bd> tTO;
int tTP;
protected int tTQ;
protected int tTR;
protected int tTS;
protected long tTT;
private b tTU;
public HashMap<Long, e> tTV = new HashMap();
public HashMap<Long, e> tTW = new HashMap();
private String talker;
static /* synthetic */ void a(b$a b_a) {
b_a.adE = true;
b_a.edl = b_a.tTQ;
b_a.min = b_a.tTR;
b_a.tTP = b_a.tTS;
x.i("MicroMsg.AutoList", "totalCount %s min %s start %s", new Object[]{Integer.valueOf(b_a.edl), Integer.valueOf(b_a.min), Integer.valueOf(b_a.tTP)});
long currentTimeMillis = System.currentTimeMillis();
x.i("MicroMsg.AutoList", "min spent : %s", new Object[]{Long.valueOf(System.currentTimeMillis() - currentTimeMillis)});
currentTimeMillis = System.currentTimeMillis();
b_a.v(b_a.tTT, true);
x.i("MicroMsg.AutoList", "loadMsgInfo spent : %s", new Object[]{Long.valueOf(System.currentTimeMillis() - currentTimeMillis)});
currentTimeMillis = System.currentTimeMillis();
b_a.v(b_a.tTT, false);
x.i("MicroMsg.AutoList", "loadMsgInfo spent : %s", new Object[]{Long.valueOf(System.currentTimeMillis() - currentTimeMillis)});
b_a.tTU.notifyDataSetChanged();
if (!b_a.tTU.tTy.isFinishing()) {
b bVar = b_a.tTU;
View view = (View) b_a.tTU.tzb.get(99999);
MMViewPager mMViewPager = b_a.tTU.tTy.jDB;
bVar.d(99999, view);
}
}
static /* synthetic */ void a(b$a b_a, long j) {
long currentTimeMillis = System.currentTimeMillis();
x.i("MicroMsg.AutoList", "isBizChat = " + b.qIZ);
if (b.qIZ) {
au.HU();
b_a.tTQ = c.FU().aw(b_a.talker, b.hpD);
} else {
au.HU();
b_a.tTQ = c.FT().GW(b_a.talker);
}
x.i("MicroMsg.AutoList", "<init>, totalCount = " + b_a.tTQ);
x.i("MicroMsg.AutoList", "totalCount spent : %s", new Object[]{Long.valueOf(System.currentTimeMillis() - currentTimeMillis)});
long currentTimeMillis2 = System.currentTimeMillis();
if (b.qIZ) {
au.HU();
b_a.tTR = c.FU().v(b_a.talker, b.hpD, j);
} else {
au.HU();
b_a.tTR = c.FT().T(b_a.talker, j);
}
x.i("MicroMsg.AutoList", "min spent : %s", new Object[]{Long.valueOf(System.currentTimeMillis() - currentTimeMillis2)});
if (System.currentTimeMillis() - currentTimeMillis2 > 1000) {
au.HU();
String U = c.FT().U(b_a.talker, j);
x.w("MicroMsg.AutoList", "explain : %s", new Object[]{U});
}
b_a.tTS = b_a.tTR;
b_a.tTT = j;
}
public b$a(long j, String str, final b bVar, Boolean bool) {
this.talker = str;
this.tTO = new LinkedList();
this.tTU = bVar;
au.HU();
bd dW = c.FT().dW(j);
if (dW.field_msgId == 0) {
Assert.assertTrue("MicroMsg.AutoList <init>, currentMsg does not exist, currentMsgId = " + j + ", stack = " + bi.cjd(), false);
return;
}
this.tTO.add(dW);
au.Em().H(new 1(this, j, bool, bVar));
bVar.tTy.tVY = new a() {
public final void k(Boolean bool) {
x.i("MicroMsg.AutoList", "isPlaying : " + bool);
if (!bool.booleanValue()) {
b$a.a(b$a.this);
if (bVar.tTG != null) {
bVar.tTG.iy();
}
}
}
};
}
private void dI(List<bd> list) {
ArrayList arrayList = new ArrayList();
ArrayList arrayList2 = new ArrayList();
for (int i = 0; i < list.size(); i++) {
if (b.bg((bd) list.get(i))) {
arrayList.add(Long.valueOf(((bd) list.get(i)).field_msgSvrId));
if (((bd) list.get(i)).field_isSend == 1) {
arrayList2.add(Long.valueOf(((bd) list.get(i)).field_msgId));
}
}
}
this.tTV.putAll(o.Pf().a((Long[]) arrayList.toArray(new Long[0])));
this.tTW.putAll(o.Pf().b((Long[]) arrayList2.toArray(new Long[0])));
}
public final int Fw(int i) {
return (i - 100000) + this.tTP;
}
public final bd Fx(int i) {
int Fw = Fw(i);
int size = (this.min + this.tTO.size()) - 1;
if (Fw < this.min || Fw > size) {
x.e("MicroMsg.AutoList", "get, invalid pos " + Fw + ", min = " + this.min + ", max = " + size);
return null;
}
x.d("MicroMsg.AutoList", "get, pos = " + Fw);
bd bdVar;
if (Fw == this.min) {
bdVar = (bd) this.tTO.get(0);
if (!this.adE) {
return bdVar;
}
v(bdVar.field_msgId, false);
return bdVar;
} else if (Fw != size || size >= this.edl - 1) {
return (bd) this.tTO.get(Fw - this.min);
} else {
bdVar = (bd) this.tTO.get(this.tTO.size() - 1);
if (!this.adE) {
return bdVar;
}
v(bdVar.field_msgId, true);
return bdVar;
}
}
public final void cwL() {
this.adE = false;
}
private void v(long j, boolean z) {
List b;
x.i("MicroMsg.AutoList", "start loadMsgInfo, currentMsgId = " + j + ", forward = " + z);
if (b.qIZ) {
au.HU();
b = c.FU().b(this.talker, b.hpD, j, z);
} else {
au.HU();
b = c.FT().d(this.talker, j, z);
}
if (b == null || b.size() == 0) {
x.w("MicroMsg.AutoList", "loadMsgInfo fail, addedMsgList is null, forward = " + z);
return;
}
x.i("MicroMsg.AutoList", "loadMsgInfo done, new added list, size = " + b.size() + ", forward = " + z);
long currentTimeMillis = System.currentTimeMillis();
dI(b);
x.i("MicroMsg.AutoList", "loadImgInfo spent : %s", new Object[]{Long.valueOf(System.currentTimeMillis() - currentTimeMillis)});
if (z) {
this.tTO.addAll(b);
return;
}
this.tTO.addAll(0, b);
this.min -= b.size();
if (this.min < 0) {
x.e("MicroMsg.AutoList", "loadMsgInfo fail, min should not be minus, min = " + this.min);
return;
}
x.i("MicroMsg.AutoList", "min from " + (b.size() + this.min) + " to " + this.min);
}
public final String toString() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("AutoList, Size = " + this.tTO.size());
stringBuilder.append("; Content = {");
for (bd bdVar : this.tTO) {
stringBuilder.append(bdVar.field_msgId);
stringBuilder.append(",");
}
stringBuilder.append("}");
return stringBuilder.toString();
}
}
|
/*
* Copyright 2010 Henry Coles
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and limitations under the License.
*/
package org.pitest.mutationtest.engine.gregor.mutators.augmentation;
import java.util.HashMap;
import java.util.Map;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.pitest.mutationtest.engine.MutationIdentifier;
import org.pitest.mutationtest.engine.gregor.AbstractInsnMutator;
import org.pitest.mutationtest.engine.gregor.InsnSubstitution;
import org.pitest.mutationtest.engine.gregor.MethodInfo;
import org.pitest.mutationtest.engine.gregor.MethodMutatorFactory;
import org.pitest.mutationtest.engine.gregor.MutationContext;
import org.pitest.mutationtest.engine.gregor.ZeroOperandMutation;
/*
* To remove the second operand, remove the operator and pop (normal and long) second operand.
* To remove the first operand, remove the operator, swap the two operands and remove the top one.
* Because the second operand is above the first operand on the stack.
*/
public class ArithmeticOperandDeletion implements MethodMutatorFactory {
public enum MutantType {
REMOVE_FIRST_MUTATOR, REMOVE_LAST_MUTATOR;
}
private final MutantType mutatorType;
public ArithmeticOperandDeletion(MutantType mt) {
this.mutatorType = mt;
}
@Override
public MethodVisitor create(final MutationContext context, final MethodInfo methodInfo,
final MethodVisitor methodVisitor) {
if (this.mutatorType == ArithmeticOperandDeletion.MutantType.REMOVE_FIRST_MUTATOR) {
return new AODFirstMethodVisitor(this, methodInfo, context, methodVisitor);
} else if (this.mutatorType == ArithmeticOperandDeletion.MutantType.REMOVE_LAST_MUTATOR) {
return new AODLastMethodVisitor(this, context, methodVisitor);
} else {
return null;
}
}
@Override
public String getGloballyUniqueId() {
return this.getClass().getName() + "_" + this.mutatorType.name();
}
@Override
public String getName() {
return "ArithmeticOperandDeletion - " + this.mutatorType.name();
}
}
/*
* Check the operator type, remove it with POP/POP2 and continue the replacement of the operands.
*/
class AODFirstMethodVisitor extends AbstractInsnMutator {
AODFirstMethodVisitor(final MethodMutatorFactory factory, final MethodInfo methodInfo,
final MutationContext context, final MethodVisitor writer) {
super(factory, methodInfo, context, writer);
}
private static final Map<Integer, ZeroOperandMutation> MUTATIONS = new HashMap<Integer, ZeroOperandMutation>();
static {
MUTATIONS.put(Opcodes.IADD, new InsnSubstitution(Opcodes.POP,
"REMOVE_SECOND_OPERATOR: Remove the second operand from an addition formula (int)"));
MUTATIONS.put(Opcodes.DADD, new InsnSubstitution(Opcodes.POP2,
"REMOVE_SECOND_OPERATOR: Remove the second operand from an addition formula (double)"));
MUTATIONS.put(Opcodes.FADD, new InsnSubstitution(Opcodes.POP,
"REMOVE_SECOND_OPERATOR: Remove the second operand from an addition formula (float)"));
MUTATIONS.put(Opcodes.LADD, new InsnSubstitution(Opcodes.POP2,
"REMOVE_SECOND_OPERATOR: Remove the second operand from an addition formula (long)"));
MUTATIONS.put(Opcodes.ISUB, new InsnSubstitution(Opcodes.POP,
"REMOVE_SECOND_OPERATOR: Remove the second operand from a subtraction formula (int)"));
MUTATIONS.put(Opcodes.DSUB, new InsnSubstitution(Opcodes.POP2,
"REMOVE_SECOND_OPERATOR: Remove the second operand from a subtraction formula (double)"));
MUTATIONS.put(Opcodes.FSUB, new InsnSubstitution(Opcodes.POP,
"REMOVE_SECOND_OPERATOR: Remove the second operand from a subtraction formula (float)"));
MUTATIONS.put(Opcodes.LSUB, new InsnSubstitution(Opcodes.POP2,
"REMOVE_SECOND_OPERATOR: Remove the second operand from a subtraction formula (long)"));
MUTATIONS.put(Opcodes.IMUL, new InsnSubstitution(Opcodes.POP,
"REMOVE_SECOND_OPERATOR: Remove the second operand from a multiplication formula (int)"));
MUTATIONS.put(Opcodes.DMUL, new InsnSubstitution(Opcodes.POP2,
"REMOVE_SECOND_OPERATOR: Remove the second operand from a multiplication formula (double)"));
MUTATIONS.put(Opcodes.FMUL, new InsnSubstitution(Opcodes.POP,
"REMOVE_SECOND_OPERATOR: Remove the second operand from a multiplication formula (float)"));
MUTATIONS.put(Opcodes.LMUL, new InsnSubstitution(Opcodes.POP2,
"REMOVE_SECOND_OPERATOR: Remove the second operand from a multiplication formula (long)"));
MUTATIONS.put(Opcodes.IDIV, new InsnSubstitution(Opcodes.POP,
"REMOVE_SECOND_OPERATOR: Remove the second operand from a division formula (int)"));
MUTATIONS.put(Opcodes.DDIV, new InsnSubstitution(Opcodes.POP2,
"REMOVE_SECOND_OPERATOR: Remove the second operand from a division formula (double)"));
MUTATIONS.put(Opcodes.FDIV, new InsnSubstitution(Opcodes.POP,
"REMOVE_SECOND_OPERATOR: Remove the second operand from a division formula (float)"));
MUTATIONS.put(Opcodes.LDIV, new InsnSubstitution(Opcodes.POP2,
"REMOVE_SECOND_OPERATOR: Remove the second operand from a division formula (long)"));
MUTATIONS.put(Opcodes.IREM,
new InsnSubstitution(Opcodes.POP, "REMOVE_SECOND_OPERATOR: Remove the second operand from a modulus formula (int)"));
MUTATIONS.put(Opcodes.DREM, new InsnSubstitution(Opcodes.POP2,
"REMOVE_SECOND_OPERATOR: Remove the second operand from a modulus formula (double)"));
MUTATIONS.put(Opcodes.FREM, new InsnSubstitution(Opcodes.POP,
"REMOVE_SECOND_OPERATOR: Remove the second operand from a modulus formula (float)"));
MUTATIONS.put(Opcodes.LREM, new InsnSubstitution(Opcodes.POP2,
"REMOVE_SECOND_OPERATOR: Remove the second operand from a modulus formula (long)"));
}
@Override
protected Map<Integer, ZeroOperandMutation> getMutations() {
return MUTATIONS;
}
}
class AODLastMethodVisitor extends MethodVisitor {
private final MethodMutatorFactory factory;
private final MutationContext context;
AODLastMethodVisitor(final MethodMutatorFactory factory, final MutationContext context,
final MethodVisitor methodVisitor) {
super(Opcodes.ASM6, methodVisitor);
this.factory = factory;
this.context = context;
}
@Override
public void visitInsn(int opcode) {
if ((opcode == Opcodes.IADD) || (opcode == Opcodes.FADD)) {
replaceSmallAddOperand(opcode);
} else if ((opcode == Opcodes.ISUB) || (opcode == Opcodes.FSUB)) {
replaceSmallSubOperand(opcode);
} else if ((opcode == Opcodes.IMUL) || (opcode == Opcodes.FMUL)) {
replaceSmallMulOperand(opcode);
} else if ((opcode == Opcodes.IDIV) || (opcode == Opcodes.FDIV)) {
replaceSmallDivOperand(opcode);
} else if ((opcode == Opcodes.IREM) || (opcode == Opcodes.DREM) || (opcode == Opcodes.FREM)) {
replaceSmallRemOperand(opcode);
} else if ((opcode == Opcodes.LADD) || (opcode == Opcodes.LSUB) || (opcode == Opcodes.LMUL)
|| (opcode == Opcodes.LDIV) || (opcode == Opcodes.LREM)) {
replaceLongOperand(opcode);
} else if ((opcode == Opcodes.DADD) || (opcode == Opcodes.DSUB) || (opcode == Opcodes.DMUL)
|| (opcode == Opcodes.DDIV) || (opcode == Opcodes.DREM)) {
replaceDoubleOperand(opcode);
} else {
super.visitInsn(opcode);
}
}
private void replaceSmallAddOperand(int opcode) {
final MutationIdentifier muID = this.context.registerMutation(factory,
"REMOVE_FIRST_OPERAND: Remove the first operand from an addition formula");
if (this.context.shouldMutate(muID)) {
removeSmallFirstOperand();
} else {
super.visitInsn(opcode);
}
}
private void replaceSmallSubOperand(int opcode) {
final MutationIdentifier muID = this.context.registerMutation(factory,
"REMOVE_FIRST_OPERAND: Remove the first operand from a subtraction formula");
if (this.context.shouldMutate(muID)) {
removeSmallFirstOperand();
} else {
super.visitInsn(opcode);
}
}
private void replaceSmallMulOperand(int opcode) {
final MutationIdentifier muID = this.context.registerMutation(factory,
"REMOVE_FIRST_OPERAND: Remove the first operand from a multiplication formula");
if (this.context.shouldMutate(muID)) {
removeSmallFirstOperand();
} else {
super.visitInsn(opcode);
}
}
private void replaceSmallDivOperand(int opcode) {
final MutationIdentifier muID = this.context.registerMutation(factory,
"REMOVE_FIRST_OPERAND: Remove the first operand from a division formula");
if (this.context.shouldMutate(muID)) {
removeSmallFirstOperand();
} else {
super.visitInsn(opcode);
}
}
private void replaceSmallRemOperand(int opcode) {
final MutationIdentifier muID = this.context.registerMutation(factory,
"REMOVE_FIRST_OPERAND: Remove the first operand from a modulus formula");
if (this.context.shouldMutate(muID)) {
removeSmallFirstOperand();
} else {
super.visitInsn(opcode);
}
}
private void replaceLongOperand(int opcode) {
final MutationIdentifier muID = this.context.registerMutation(factory,
"REMOVE_FIRST_OPERAND: Remove the first operand of from a formula involving longs");
if (this.context.shouldMutate(muID)) {
removeLargeFirstOperand();
} else {
super.visitInsn(opcode);
}
}
private void replaceDoubleOperand(int opcode) {
final MutationIdentifier muID = this.context.registerMutation(factory,
"REMOVE_FIRST_OPERAND: Remove the first operand of a formula involving doubles");
if (this.context.shouldMutate(muID)) {
removeLargeFirstOperand();
} else {
super.visitInsn(opcode);
}
}
/*
* Swap the second and first operand, then remove the top operand. This is short
* hand for removing the first operand. This works for
*/
private void removeSmallFirstOperand() {
super.visitInsn(Opcodes.SWAP);
super.visitInsn(Opcodes.POP);
}
/*
* DUP2_X2 duplicates the second operand and put it below the first operand on
* the stack. Then, pop the second operand and the first operand. This is the
* same as using SWAP long values and POP2.
*/
private void removeLargeFirstOperand() {
super.visitInsn(Opcodes.DUP2_X2);
super.visitInsn(Opcodes.POP2);
super.visitInsn(Opcodes.POP2);
}
}
|
package co.com.devco.certificacion.task;
import net.serenitybdd.screenplay.Actor;
import net.serenitybdd.screenplay.Task;
import net.serenitybdd.screenplay.Tasks;
import net.serenitybdd.screenplay.actions.Click;
import net.serenitybdd.screenplay.conditions.Check;
import net.serenitybdd.screenplay.waits.WaitUntil;
import static co.com.devco.certificacion.userinterfase.InformacionHotel.BTN_FECHA;
import static co.com.devco.certificacion.userinterfase.InformacionHotel.BTN_SIGUIENTE_MES;
import static net.serenitybdd.screenplay.matchers.WebElementStateMatchers.isVisible;
public class BuscarFecha implements Task {
private String fecha;
public BuscarFecha(String fecha) {
this.fecha = fecha;
}
@Override
public <T extends Actor> void performAs(T actor) {
boolean estaDato=false;
while (estaDato==false){
if (BTN_FECHA.of(fecha).resolveFor(actor).isVisible()){
actor.attemptsTo(Click.on(BTN_FECHA.of(fecha)));
estaDato=true;
break;
}
actor.attemptsTo(Click.on(BTN_SIGUIENTE_MES));
}
}
public static BuscarFecha deCalentario(String fecha){
return Tasks.instrumented(BuscarFecha.class,fecha);
}
}
|
package com.zhuangjinxin.demo;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import com.zhuangjinxin.demo.activemq.StartActiveMQ;
@SpringBootApplication
@ComponentScan(basePackages="com.zhuangjinxin.demo")
@MapperScan("com.zhuangjinxin.demo.mapper")
public class SpringBootStarter {
public static void main(String[] args) {
SpringApplication.run(SpringBootStarter.class, args);
}
}
|
public class BankClient{
public static void main(String[] args) {
Address address=new Address("228", "H-block dharam colony", "gurugram", 12345);
Savingaccount s1= new Savingaccount(AccountType.SALARIED_ACCOUNT,20000, address);
System.out.print(s1.withdraw(200));
}
} |
package com.nosuchteam.service.serviceImpl;
import com.nosuchteam.bean.RequestList;
import com.nosuchteam.bean.Work;
import com.nosuchteam.mapper.WorkMapper;
import com.nosuchteam.service.WorkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* yuexia
* 2018/12/9
* 22:01
*/
@Service
public class WorkServiceImpl implements WorkService {
@Autowired
WorkMapper workMapper;
public List<Work> findWrokList(RequestList requestList) {
List<Work> customList = workMapper.findWorkList(requestList.getRows(), (requestList.getPage() - 1) * requestList.getRows());
return customList;
}
public int findTotalWorkNum() {
return workMapper.findTotalWork();
}
public List<Work> findAllWork() {
return workMapper.findAllWork();
}
public Work selectByPrimaryKey(String customId) {
return workMapper.selectByPrimaryKey(customId);
}
public int insertNewWork(Work work) {
return workMapper.insert(work);
}
public int updateByPrimaryKeySelective(Work work) {
return workMapper.updateByPrimaryKey(work);
}
public int deleteByPrimaryKey(String ids) {
return workMapper.deleteByPrimaryKey(ids);
}
}
|
package wang.lanchun.view;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import wang.lanchun.dao.UserDao;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
public class RegForm extends JFrame {
private JPanel contentPane;
private JTextField textField;
private JTextField textField_1;
private UserDao userDao;
/**
* Create the frame.
*/
public RegForm() {
userDao = new UserDao();
setTitle("\u7528\u6237\u6CE8\u518C");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
JLabel lblUsername = new JLabel("username:");
textField = new JTextField();
textField.setColumns(10);
JLabel lblPassword = new JLabel("password:");
textField_1 = new JTextField();
textField_1.setColumns(10);
JButton btnNewButton = new JButton("reg");
btnNewButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
String username = textField.getText();
String password = textField_1.getText();
if(username.isEmpty()){
JOptionPane.showMessageDialog(RegForm.this, "用户名不能为空!");
return;
}
if(password.isEmpty()){
JOptionPane.showMessageDialog(RegForm.this, "密码不能为空!");
return;
}
boolean b = userDao.reg(username, password);
if(b){
JOptionPane.showMessageDialog(RegForm.this, "注册成功!");
RegForm.this.dispose();
}else{
JOptionPane.showMessageDialog(RegForm.this, "注册失败!");
}
}
});
GroupLayout gl_contentPane = new GroupLayout(contentPane);
gl_contentPane.setHorizontalGroup(
gl_contentPane.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPane.createSequentialGroup()
.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPane.createSequentialGroup()
.addGap(54)
.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false)
.addGroup(gl_contentPane.createSequentialGroup()
.addComponent(lblPassword)
.addGap(18)
.addComponent(textField_1))
.addGroup(gl_contentPane.createSequentialGroup()
.addComponent(lblUsername)
.addGap(18)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, 149, GroupLayout.PREFERRED_SIZE))))
.addGroup(gl_contentPane.createSequentialGroup()
.addGap(87)
.addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, 144, GroupLayout.PREFERRED_SIZE)))
.addContainerGap(149, Short.MAX_VALUE))
);
gl_contentPane.setVerticalGroup(
gl_contentPane.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPane.createSequentialGroup()
.addGap(42)
.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
.addComponent(lblUsername)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(38)
.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
.addComponent(lblPassword)
.addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(48)
.addComponent(btnNewButton)
.addContainerGap(59, Short.MAX_VALUE))
);
contentPane.setLayout(gl_contentPane);
}
}
|
package it.unical.asd.group6.computerSparePartsCompany.core.services;
import it.unical.asd.group6.computerSparePartsCompany.data.dto.ReviewDTO;
import it.unical.asd.group6.computerSparePartsCompany.data.entities.Customer;
import it.unical.asd.group6.computerSparePartsCompany.data.entities.Review;
import java.util.List;
import java.util.Optional;
public interface ReviewService {
List<ReviewDTO> getAll();
List<ReviewDTO> getAllByCustomer(Customer c);
List<ReviewDTO> getAllByBrandAndModel(String brand,String model);
Boolean delete(Review r);
Optional<Review>getAllByCustomerAndTitleAndText(Customer c,String title,String text);
Optional<Review>getAllByCustomerAndTitleAndTextAndBrandAndModel(Customer c,String title,String text,String brand,String model);
Boolean insert(Review r);
Optional<Review>getByCustomerAndBrandAndModel(Customer c,String brand,String model);
List<ReviewDTO>findByFilters(String username,Long rate,String brand,String model);
List<Review> getAllAsEntity();
}
|
package com.ysyt.constants;
public class YSYTConstants {
public static final String INSTAMOJO_STATUS_SUCCESS = "completed";
public static final String INSTAMOJO_STATUS_PENDING = "pending";
public static final String SECURITY_DEPOSIT ="SecurityDeposit";
public static final Long ACCOMODATION_IMAGES_ATTRIBUTE_ID =(long) 14;
}
|
package classes;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import world.Engine;
import world.GameLevel;
import world.SampleLevel;
import eg.edu.alexu.csd.oop.game.GameEngine;
import eg.edu.alexu.csd.oop.game.GameObject;
import factory.ObjectFactory;
public class main1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
ObjectFactory factory = new ObjectFactory();
List<GameObject> constantObjects = new ArrayList<>();
constantObjects.add(factory.createConstantObject("backGround", "circus.jpg", 1000, 1000));
constantObjects.add(factory.createConstantObject("shelf", "shelf2.png", 300, 69));
GameObject l=factory.createConstantObject("shelf", "shelf2.png", 300, 69);
l.setX(900-300);
constantObjects.add(l);
List<GameObject> control = new ArrayList<>();
GameLevel game = new SampleLevel();
GameEngine.start("Very Simple Game in 99 Line of Code", new Engine(constantObjects,game,900, 800), Color.YELLOW);
}
}
|
package com.tencent.mm.plugin.talkroom.model;
import com.tencent.mm.ab.d.a;
import com.tencent.mm.ab.d.b;
import com.tencent.mm.model.au;
import com.tencent.mm.model.c;
import com.tencent.mm.model.q;
import com.tencent.mm.platformtools.ab;
import com.tencent.mm.protocal.c.bsm;
import com.tencent.mm.protocal.c.by;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.bl;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.mm.storage.bd;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
public final class d implements com.tencent.mm.ab.d {
public final b b(a aVar) {
int i = 1;
by byVar = aVar.dIN;
if (byVar == null) {
x.e("MicroMsg.TalkRoomExtension", "onPreAddMessage cmdAM is null");
} else if (byVar.jQd != 56) {
x.e("MicroMsg.TalkRoomExtension", "onPreAddMessage cmdAM.type:%d", new Object[]{Integer.valueOf(byVar.jQd)});
} else {
String a = ab.a(byVar.rcj);
String a2 = ab.a(byVar.rck);
au.HU();
if (!((String) c.DT().get(2, null)).equals(a)) {
a2 = a;
}
au.HU();
com.tencent.mm.storage.ab Yg = c.FR().Yg(a2);
if (Yg == null || ((int) Yg.dhP) == 0) {
au.HU();
c.FR().T(new com.tencent.mm.storage.ab(a2));
}
String a3 = ab.a(byVar.rcl);
x.d("MicroMsg.TalkRoomExtension", "talkroom xml:" + a3);
Map z = bl.z(a3, "talkroominfo");
if (z != null) {
try {
int i2;
String str;
String bs;
if (Oq((String) z.get(".talkroominfo.tracksysmsgtype")) == 0) {
Oq((String) z.get(".talkroominfo.sysmsgtype"));
i2 = 1;
} else {
i2 = 0;
}
Object linkedList = new LinkedList();
Oq((String) z.get(".talkroominfo.membersize"));
int i3 = 0;
while (true) {
str = ".talkroominfo.memberlist.member" + (i3 == 0 ? "" : Integer.valueOf(i3));
a3 = (String) z.get(str + ".username");
if (bi.oW(a3)) {
break;
}
int Oq = Oq((String) z.get(str + ".memberid"));
bsm bsm = new bsm();
bsm.hbL = a3;
bsm.spS = Oq;
linkedList.add(bsm);
i3++;
}
if (a2.equals(b.bGT().owU)) {
str = br(linkedList);
bs = bi.oW(str) ? bs(linkedList) : null;
} else {
bs = null;
str = null;
}
e bGU = b.bGU();
if (i2 != 0) {
i = 0;
}
bGU.a(a2, linkedList, str, bs, i);
} catch (Throwable e) {
x.e("MicroMsg.TalkRoomExtension", "parsing memList xml failed");
x.printErrStackTrace("MicroMsg.TalkRoomExtension", e, "", new Object[0]);
}
}
}
return null;
}
public final void h(bd bdVar) {
}
private static int Oq(String str) {
int i = 0;
if (bi.oW(str)) {
return i;
}
try {
return Integer.valueOf(str).intValue();
} catch (Throwable e) {
x.printErrStackTrace("MicroMsg.TalkRoomExtension", e, "", new Object[i]);
return i;
}
}
private static String br(List<bsm> list) {
List<bsm> aZp = b.bGT().aZp();
List linkedList = new LinkedList();
for (bsm bsm : list) {
Object obj;
for (bsm bsm2 : aZp) {
if (bsm2.hbL.equals(bsm.hbL)) {
obj = 1;
break;
}
}
obj = null;
if (obj == null) {
linkedList.add(bsm.hbL);
}
}
if (linkedList.isEmpty()) {
return null;
}
for (int i = 0; i < linkedList.size(); i++) {
String str = (String) linkedList.get(i);
if (!str.equals(q.GF())) {
return str;
}
}
return null;
}
private static String bs(List<bsm> list) {
List<bsm> aZp = b.bGT().aZp();
List linkedList = new LinkedList();
for (bsm bsm : aZp) {
Object obj;
for (bsm bsm2 : list) {
if (bsm2.hbL.equals(bsm.hbL)) {
obj = 1;
break;
}
}
obj = null;
if (obj == null) {
linkedList.add(bsm.hbL);
}
}
if (linkedList.isEmpty()) {
return null;
}
for (int i = 0; i < linkedList.size(); i++) {
String str = (String) linkedList.get(i);
if (!str.equals(q.GF())) {
return str;
}
}
return null;
}
}
|
package com.union.design.generator;
import lombok.Builder;
import lombok.Data;
@Builder
@Data
public class TableColumn {
/**
* 列名
*/
private String columnName;
/**
* 类型名称
*/
private String typeName;
/**
* 列大小
*/
private Integer columnSize;
/**
* 列可空性
*/
private String isNullable;
/**
* 列默认值
*/
private String columnDef;
/**
* 列注释
*/
private String remark;
} |
package bank;
public abstract class Client {
private double paymentAccount;
public double getPaymentAccount() {
return paymentAccount;
}
void setPaymentAccount(double paymentAccount) {
this.paymentAccount = paymentAccount;
}
public void withdrawal(double withdrawal) {
if (withdrawal > paymentAccount) {
System.out.println("Недостаточно средств для снятия!");
} else paymentAccount -= withdrawal;
}
public void replenishment(double replenishment) {
paymentAccount += replenishment;
}
}
|
package com.sharpower.dao.impl;
import com.sharpower.entity.ReportDayRecode;
public class ReportDayRecodeDaoImpl extends BaseDaoImpl<ReportDayRecode>{
}
|
/*
* Copyright 2007 Bastian Schenke Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package nz.org.take.r2ml;
import java.util.Map;
import javax.xml.namespace.QName;
/**
* Managment class for names associated with slots in predicates.
*
*
* @author Bastian Schenke (bastian.schenke@googlemail.com)
*
*/
public interface NameMapper {
public String[] getSlotNames(QName predicateID);
public void addSlotNames(QName predicateID, String[] slotNames);
public void addSlotNames(Map<QName, String[]> names);
}
|
package com.tencent.mm.ui.conversation;
import com.tencent.mm.ui.r.a;
class BizConversationUI$a$13 implements a {
final /* synthetic */ BizConversationUI.a unz;
BizConversationUI$a$13(BizConversationUI.a aVar) {
this.unz = aVar;
}
public final void Xb() {
BizConversationUI.a.a(this.unz, BizConversationUI.a.e(this.unz).getCount());
}
public final void Xa() {
}
}
|
package com.kerbii.undersiege;
import javax.microedition.khronos.opengles.GL10;
public class Castle extends GameObject {
public final static int[] TEXTUREARRAY = {
R.drawable.wall100,
R.drawable.wall80,
R.drawable.wall65,
R.drawable.wall51,
R.drawable.wall50p,
R.drawable.wall41,
R.drawable.wall40p,
R.drawable.wall21,
R.drawable.wall20p,
R.drawable.wall10,
};
public static int[] staticTextureIndexArray;
private static float vertices[] = {
0.0f, 480.0f, 0.0f,
262.0f, 480.0f, 0.0f,
0.0f, 0.0f, 0.0f,
262.0f, 0.0f, 0.0f
};
public Castle(float x, float y) {
super(x, y, 120, 480, vertices);
}
public void update(long deltaTime) {
}
public void draw(GL10 gl, int[] textures) {
float healthPercent = (SiegeVariables.castleHealth / SiegeVariables.castleHealthMax) * 100;
if (healthPercent >= 80) {
textureIndex = staticTextureIndexArray[1];
alpha = 1;
// alpha = (100 - healthPercent) / (100 - 80);
super.draw(gl, textures);
textureIndex = staticTextureIndexArray[0];
alpha = (healthPercent - 80) / (100 - 80);
super.draw(gl, textures);
} else if (healthPercent >= 65) {
textureIndex = staticTextureIndexArray[2];
alpha = 1;
super.draw(gl, textures);
textureIndex = staticTextureIndexArray[1];
alpha = (healthPercent - 65) / (79 - 65);
super.draw(gl, textures);
} else if (healthPercent > 50) {
textureIndex = staticTextureIndexArray[3];
alpha = 1;
super.draw(gl, textures);
textureIndex = staticTextureIndexArray[2];
alpha = (healthPercent - 51) / (64 - 51);
super.draw(gl, textures);
} else if (healthPercent > 40) {
textureIndex = staticTextureIndexArray[5];
alpha = 1;
super.draw(gl, textures);
textureIndex = staticTextureIndexArray[4];
alpha = (healthPercent - 41) / (50 - 41);
super.draw(gl, textures);
} else if (healthPercent > 21) {
textureIndex = staticTextureIndexArray[7];
alpha = 1;
super.draw(gl, textures);
textureIndex = staticTextureIndexArray[6];
alpha = (healthPercent - 21) / (40 - 21);
super.draw(gl, textures);
} else if (healthPercent >= 10) {
textureIndex = staticTextureIndexArray[9];
alpha = 1;
super.draw(gl, textures);
textureIndex = staticTextureIndexArray[8];
alpha = (healthPercent - 10) / (20 - 10);
super.draw(gl, textures);
} else {
textureIndex = staticTextureIndexArray[9];
alpha = 1;
super.draw(gl, textures);
}
}
public void damage(float damage) {
SiegeVariables.castleHealth -= damage;
if (SiegeVariables.castleHealth <= 0) {
draw = false;
}
}
}
|
package com.lr.util;
import java.io.Serializable;
public class testPaperUtil implements Serializable {
private static final long serialVersionUID = -35583434405129L;
private Integer id;
private String testpaperId;
private Integer subjectId;
private String subjectName;
private Integer score;
private Integer num;
private Integer state;
public testPaperUtil() {
}
public testPaperUtil(Integer id, String testpaperId, Integer subjectId, String subjectName, Integer sore, Integer num, Integer state) {
this.id = id;
this.testpaperId = testpaperId;
this.subjectId = subjectId;
this.subjectName = subjectName;
this.score = sore;
this.num = num;
this.state = state;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTestpaperId() {
return testpaperId;
}
public void setTestpaperId(String testpaperId) {
this.testpaperId = testpaperId;
}
public Integer getSubjectId() {
return subjectId;
}
public void setSubjectId(Integer subjectId) {
this.subjectId = subjectId;
}
public String getSubjectName() {
return subjectName;
}
public void setSubjectName(String subjectName) {
this.subjectName = subjectName;
}
public Integer getSore() {
return score;
}
public void setSore(Integer sore) {
this.score = sore;
}
public Integer getNum() {
return num;
}
public void setNum(Integer num) {
this.num = num;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
@Override
public String toString() {
return "testPaperUtil{" +
"id=" + id +
", testpaperId='" + testpaperId + '\'' +
", subjectId=" + subjectId +
", subjectName='" + subjectName + '\'' +
", score=" + score +
", num=" + num +
", state=" + state +
'}';
}
}
|
package com.tencent.mm.plugin.appbrand.jsapi.f.a;
import com.tencent.mm.plugin.appbrand.compat.a.b.f;
class d$1 implements f {
final /* synthetic */ double dSw;
final /* synthetic */ double dSx;
final /* synthetic */ d fTX;
d$1(d dVar, double d, double d2) {
this.fTX = dVar;
this.dSw = d;
this.dSx = d2;
}
public final double adG() {
return this.dSw;
}
public final double adH() {
return this.dSx;
}
}
|
package de.zarncke.lib.jna;
import java.io.File;
import java.io.IOException;
import java.util.List;
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.Win32Exception;
import com.sun.jna.platform.win32.WinBase;
import com.sun.jna.platform.win32.WinNT;
import com.sun.jna.platform.win32.WinNT.HANDLE;
import com.sun.jna.platform.win32.WinNT.HANDLEByReference;
import com.sun.jna.ptr.IntByReference;
import de.zarncke.lib.coll.L;
import de.zarncke.lib.coll.Pair;
import de.zarncke.lib.err.Warden;
import de.zarncke.lib.jna.Kernel32.MEMORYSTATUSEX;
import de.zarncke.lib.util.Q;
/**
* This helper contains functions using various functions only available on Windows systems.
* It uses e.g. Kernel32 over JNA or drive C:\.
*
* @author Gunnar Zarncke <gunnar@zarncke.de>
*/
public class WindowsFunctions {
private WindowsFunctions() {
// hidden constructor of helper class
}
public static void init() {
Kernel32.K32.getClass();
}
public static Pair<Long, Long> getAvailableSystemDiskBytesWindows(final File fileOnFileSystem) {
String path = fileOnFileSystem == null ? "C:\\" : fileOnFileSystem.getAbsolutePath();
if (path.startsWith("\\\\")) {
// is UNC
int p = path.indexOf("\\", 2);
path = path.substring(0, p + 1);
} else {
int p = path.indexOf(":\\");
if (p == 1) {
path = path.substring(0, 3);
}
}
IntByReference spc = new IntByReference();
IntByReference bps = new IntByReference();
IntByReference fc = new IntByReference();
IntByReference tc = new IntByReference();
if (Kernel32.K32.GetDiskFreeSpace(path, spc, bps, fc, tc)) {
return Pair.pair(Q.l((long) bps.getValue() * spc.getValue() * fc.getValue()),
Q.l((long) bps.getValue() * spc.getValue() * tc.getValue()));
}
return null;
}
public static class FILE_ZERO_DATA_INFORMATION extends Structure {
public long FileOffset;
public long BeyondFinalZero;
@Override
protected List getFieldOrder() {
return L.l("FileOffset", "BeyondFinalZero");
}
}
/**
* from http://pinvoke.net/default.aspx/Constants/WINBASE.html
*/
public final static int FSCTL_SET_SPARSE = 0x000900c4;
public final static int FSCTL_SET_ZERO_DATA = 0x000980c8;
/**
* Tries to zero a section of a file.
* This is also called 'punching a hole'.
* Converts the file into a sparse if if it is not already.
* Only supported on some file systems, e.g. NTFS.
*
* @param file to punch hole into
* @param position offset
* @param length length of hole
* @return true: successfully punched hole; false: operation not supported by file system
* @throws IOException operation supported but failed
*/
public static boolean setSparseZeros(final File file, final long position, final long length) throws IOException {
com.sun.jna.platform.win32.Kernel32 k32 = com.sun.jna.platform.win32.Kernel32.INSTANCE;
HANDLE hFile = null;
hFile = k32.CreateFile(file.getCanonicalPath(), WinNT.GENERIC_ALL, WinNT.FILE_SHARE_WRITE
| WinNT.FILE_SHARE_READ,
new WinBase.SECURITY_ATTRIBUTES(), WinNT.OPEN_EXISTING, WinNT.FILE_ATTRIBUTE_NORMAL,
new HANDLEByReference().getValue());
if (WinBase.INVALID_HANDLE_VALUE.equals(hFile)) {
throw Warden.spot(new IOException("failed to open " + file, new Win32Exception(
com.sun.jna.platform.win32.Kernel32.INSTANCE.GetLastError())));
}
Throwable excep = null;
try {
// Buffer buffer = ByteBuffer.wrap(new byte[100]);
// IntByReference bytesRead = new IntByReference();
// boolean r = k32.ReadFile(hFile, buffer, 10, bytesRead, null);
// System.out.println(r + ": " + Elements.toString(buffer.array()));
IntByReference dwTemp = new IntByReference();
// ::DeviceIoControl(hFile, FSCTL_SET_SPARSE, NULL, 0, NULL, 0, &dwTemp, NULL);
boolean res = k32.DeviceIoControl(hFile, FSCTL_SET_SPARSE, null, 0, null, 0, dwTemp, null);
if (!res) {
throw new Win32Exception(com.sun.jna.platform.win32.Kernel32.INSTANCE.GetLastError());
}
FILE_ZERO_DATA_INFORMATION fzdi = new FILE_ZERO_DATA_INFORMATION();
fzdi.FileOffset = position;
fzdi.BeyondFinalZero = position + length;
fzdi.write();
// ::DeviceIoControl(hFile, FSCTL_SET_ZERO_DATA, &fzdi, sizeof(fzdi), NULL, 0, &dwTemp, NULL);
res = k32
.DeviceIoControl(hFile, FSCTL_SET_ZERO_DATA, fzdi.getPointer(), fzdi.size(), null, 0, dwTemp, null);
if (!res) {
throw new Win32Exception(com.sun.jna.platform.win32.Kernel32.INSTANCE.GetLastError());
}
// buffer.clear();
// r = k32.ReadFile(hFile, buffer, 10, bytesRead, null);
// System.out.println(r + ": " + Elements.toString(buffer.array()));
return true;
} catch (Win32Exception e) {
excep = e;
throw e;
} finally {
if (hFile != null) {
if (!com.sun.jna.platform.win32.Kernel32.INSTANCE.CloseHandle(hFile)) {
if (excep != null) {
throw (Win32Exception) new Win32Exception(
com.sun.jna.platform.win32.Kernel32.INSTANCE.GetLastError()).initCause(excep);
}
throw new Win32Exception(com.sun.jna.platform.win32.Kernel32.INSTANCE.GetLastError());
}
}
}
}
public static void hardlink(final File src, final File dest) throws IOException {
if (!Kernel32.K32.CreateHardLink(dest.getAbsolutePath(), src.getAbsolutePath(), null)) {
int error = Kernel32.K32.GetLastError();
switch (error) {
case 2:
case 3:
case 15:
throw new IOException("src " + src + " does not exist ");
case 5:
throw new IOException("permission denies to access " + dest);
case 14:
throw new IOException("disk full " + dest);
default:
throw new IOException("hard link " + src + " to " + dest + " failed with code " + error);
}
}
}
public static Pair<Long, Long> getMeminfoWindows() {
MEMORYSTATUSEX mem = new MEMORYSTATUSEX();
mem.dwLength = mem.size();
if (!Kernel32.K32.GlobalMemoryStatusEx(mem)) {
int error = Kernel32.K32.GetLastError();
throw new RuntimeException("Windows returned error " + error + " on call to GlobalMemoryStatusEx");
}
return Pair.pair(Q.l(mem.ullAvailPhys), Q.l(mem.ullTotalPhys));
}
}
|
package com.yiki.blog.jwtAuth;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
@Service
public class AuthService {
@Autowired
private AuthUserMapper authUserMapper;
@Autowired
private HttpServletRequest request;
/*
* 插入一条用户
* 返回:用户的id
* */
public JwtResult insertAuthUser(AuthUser authUser) {
try {
Integer uid = authUserMapper.insertAuthUser(authUser);
//在mapper中指定了keyProperty会自动绑定
return JwtResultUtil.success(uid);
} catch (Exception e) {
return JwtResultUtil.error(1, e.getMessage());
}
}
/*
* 验证用户name&psw
* 返回:user(除密码)+ token
* */
public JwtResult authUser(AuthUser authUser) {
try {
AuthUser user
= authUserMapper.getAuthUserByNameAndPsw(authUser.getAuth_name(), authUser.getAuth_psw());
if (user != null) {
String token = JwtTokenUtils.createToken(user.getAuth_name(), user.getAuth_role(), true);
HashMap<Object, Object> map = new HashMap<Object, Object>();
map.put("token", token);
map.put("user", user);
return JwtResultUtil.success(map);
} else {
return JwtResultUtil.error(1, "不存在该用户/不匹配");
}
} catch (Exception e) {
return JwtResultUtil.error(1, e.getMessage());
}
}
public JwtResult test1(Integer id) {
try {
String role = (String) request.getAttribute("role");
System.out.println(">>>>" + role);
if (role.equals("admin")) {
AuthUser user = authUserMapper.getAuthUserById(id);
if (user != null) {
return JwtResultUtil.success(user);
} else {
return JwtResultUtil.error(1, "无此用户");
}
} else {
return JwtResultUtil.error(1, "权限不足");
}
} catch (Exception e) {
return JwtResultUtil.error(405, e.getMessage());
}
}
public JwtResult test2(Integer id) {
try {
AuthUser user = authUserMapper.getAuthUserById(id);
if (user != null) {
return JwtResultUtil.success(user);
} else {
return JwtResultUtil.error(1, "token错误");
}
} catch (Exception e) {
return JwtResultUtil.error(405, e.getMessage());
}
}
}
|
package step._09_Basic_Math_02;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
/* date : 2021-07-30 (금)
* author : develiberta
* number : 04948
*
* [단계]
* 09. 기본 수학 2
* 소수와 기하를 다뤄 봅시다.
* [제목]
* 05. 베르트랑 공준 (04948)
* 소수 응용 문제 1
* [문제]
* 베르트랑 공준은 임의의 자연수 n에 대하여, n보다 크고, 2n보다 작거나 같은 소수는 적어도 하나 존재한다는 내용을 담고 있다.
* 이 명제는 조제프 베르트랑이 1845년에 추측했고, 파프누티 체비쇼프가 1850년에 증명했다.
* 예를 들어, 10보다 크고, 20보다 작거나 같은 소수는 4개가 있다. (11, 13, 17, 19) 또, 14보다 크고, 28보다 작거나 같은 소수는 3개가 있다. (17, 19, 23)
* 자연수 n이 주어졌을 때, n보다 크고, 2n보다 작거나 같은 소수의 개수를 구하는 프로그램을 작성하시오.
* [입력]
* 입력은 여러 개의 테스트 케이스로 이루어져 있다. 각 케이스는 n을 포함하는 한 줄로 이루어져 있다.
* 입력의 마지막에는 0이 주어진다.
* [출력]
* 각 테스트 케이스에 대해서, n보다 크고, 2n보다 작거나 같은 소수의 개수를 출력한다.
* [제한]
* 1 ≤ n ≤ 123,456
* (예제 입력 1)
* 1
* 10
* 13
* 100
* 1000
* 10000
* 100000
* 0
* (예제 출력 1)
* 1
* 4
* 3
* 21
* 135
* 1033
* 8392
*/
public class _05_04948_BertrandsPostulate {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int n;
while ((n = Integer.parseInt(br.readLine())) != 0) {
bw.write(countPrimeGreaterThanNAndLessThanEqual2N(n) + "\n");
}
br.close();
bw.flush();
bw.close();
}
private static int countPrimeGreaterThanNAndLessThanEqual2N(int n) {
int count = 0;
boolean[] isNotPrime = new boolean[2 * n + 1];
isNotPrime[0] = true;
isNotPrime[1] = true;
for (int i=2; i<Math.sqrt(isNotPrime.length); i++) {
if (isNotPrime[i] == true) {
continue;
}
for (int j=i*i; j<isNotPrime.length; j+=i) {
isNotPrime[j] = true;
}
}
for (int i=n+1; i<=2*n; i++) {
if (isNotPrime[i] == false) {
count++;
}
}
return count;
}
} |
package com.zzidc.web.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* @ClassName SwaggerConfig
* @Author chenxue
* @Description TODO
* @Date 2019/4/1 16:07
**/
@Configuration
@EnableSwagger2
public class SwaggerConfig{
/*
* @Author chenxue
* @Description //创建自定义API文档
* @Date 2019/4/1 16:16
* @Param []
* @return springfox.documentation.spring.web.plugins.Docket
**/
@Bean
public Docket createRestfulApiDocs(){
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.zzidc.web.controller"))
.paths(PathSelectors.any())
.build();
}
/*
* @Author chenxue
* @Description //TODO
* @Date 2019/4/1 16:35
* @Param []
* @return springfox.documentation.service.ApiInfo
**/
public ApiInfo apiInfo(){
return new ApiInfoBuilder()
.title("自定义RESTful接口文档")
.description("测试")
.termsOfServiceUrl("https://baidu.com")
.contact(new Contact("Tom","https://baidu.com","843400447@qq.com"))
.version("1.0.0")
.build();
}
/*@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
// 解决 SWAGGER 404报错
registry.addResourceHandler("/swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
}*/
}
|
/*
* FileName: IWorkPlanService.java
* Description:
* Company: 南宁超创信息工程有限公司
* Copyright: ChaoChuang (c) 2005
* History: 2013-12-11 (hl) Create
*/
package com.spower.business.examitem.service;
import java.util.Date;
import com.spower.basesystem.attach.valueobject.SysAttach;
import com.spower.basesystem.common.command.Page;
import com.spower.business.examitem.command.ExamItemEditInfo;
import com.spower.business.examitem.command.ExamItemQueryInfo;
import com.spower.business.examitem.valueobject.ExamItem;
/**
* @author qinbs
* @createDay 2014-11-18
*/
public interface IExamItemService {
void deleteExamItem(ExamItem examItem);
Page selectExamItemList(ExamItemQueryInfo info);
Long saveExamItem(ExamItemEditInfo info);
ExamItem selectExamItem(Long itemId);
Long saveSingleAttach(SysAttach attach);
void deleteAttachByAttachId(Long id);
Date getLastDate();
/**
*
* 改变状态
* 放入回收站或从回收站还原
* */
Long chengStatus(Long itemId);
ExamItem findByName(String itemName);
}
|
package ac.iie.nnts.Stream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.LinkedList;
import java.util.Random;
public class Stream0 {
public LinkedList<Data> streams;
public Stream0() {
streams = new LinkedList<>();
}
public int getData(String filename) {
try {
BufferedReader bfr = new BufferedReader(new FileReader(new File(filename)));
String line = "";
int time = 1;//毫秒
try {
while ((line = bfr.readLine()) != null) {
String[] atts = line.split(",");
// String[] atts = line.split("\\|");
double[] d = new double[atts.length-1];//第一位是key,后面是属性值
for (int i = 1; i < d.length; i++) {
d[i] = Double.valueOf(atts[i]) + (new Random()).nextDouble() / 10000000;
}
Data data = new Data(Integer.valueOf(atts[0]),d,time);
streams.add(data);
time++;
}
} catch (IOException e) {
e.printStackTrace();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
return streams.peek().values.length;
}
}
|
package Array;
public class RotateImage {
public void rotate(int[][] matrix) {
// reverse the matrix
int lenOfMatrix = matrix.length;
for(int row=0; row<lenOfMatrix/2; row++) {
int[] tempRow = matrix[row];
matrix[row] = matrix[lenOfMatrix-row-1];
matrix[lenOfMatrix-row-1] = tempRow;
}
for(int i=0; i<lenOfMatrix; i++) {
for(int j = i+1; j<matrix[i].length; j++) {
int temp = matrix[i][j];
matrix[i][j] = matrix[j][i];
matrix[j][i] = temp;
}
}
return;
}
}
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package hospital_bd;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
/**
*
* @author almas
*/
public class checar_paciente extends javax.swing.JFrame {
/**
* Creates new form checar_paciente
*/
String IDPACIENTE ="";
String NOMBRE ="";
String TELEFONO ="";
String EDAD ="";
String DIRECCION ="";
String SEXO ="";
String REGISTRO_IDREGISTRO="";
String TRASLADO_IDTRASLADO="";
public checar_paciente() {
initComponents();
jTable1.addMouseListener(new MouseAdapter() {
DefaultTableModel model =new DefaultTableModel();
public void mouseClicked (MouseEvent e){
int i = jTable1.getSelectedRow();
IDPACIENTE=(jTable1.getValueAt(i, 0).toString());
NOMBRE =(jTable1.getValueAt(i,1).toString());
TELEFONO =(jTable1.getValueAt(i,2).toString());
EDAD=(jTable1.getValueAt(i, 0).toString());
DIRECCION =(jTable1.getValueAt(i,1).toString());
SEXO =(jTable1.getValueAt(i,2).toString());
REGISTRO_IDREGISTRO =(jTable1.getValueAt(i,1).toString());
TRASLADO_IDTRASLADO =(jTable1.getValueAt(i,2).toString());
}
});
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jButton1 = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(null);
jButton1.setText("Agregar");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
getContentPane().add(jButton1);
jButton1.setBounds(300, 645, 90, 30);
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Id cuenta paciente", "Id registro", "Costo total", "Registro_id"
}
));
jScrollPane1.setViewportView(jTable1);
getContentPane().add(jScrollPane1);
jScrollPane1.setBounds(20, 20, 640, 610);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
gastos1 g = new gastos1();
g.setVisible(true);
}//GEN-LAST:event_jButton1ActionPerformed
public void consultar(){
int sw=0;
try{
Connection con;//conecta los datos a la base de datos.
PreparedStatement stmt;//traduce las cadenas para mandarlas a la base de datos
ResultSet tabla;
con= DB.getConnection();
String sql=" select * from cuentapaciente " ;
stmt=con.prepareStatement(sql);
System.out.println(sql);
tabla=stmt.executeQuery();
while (tabla.next()) //
{
sw=1;
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
model.addRow(new Object [] { tabla.getString(2), tabla.getString(3), tabla.getString(4)});
}
}
catch(SQLException e1){
JOptionPane.showMessageDialog(null, e1);
}
catch(Exception e2){
JOptionPane.showMessageDialog(null, e2);
}
if (sw==0) {
JOptionPane.showMessageDialog(null, "***no existe el registro*** ");
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(checar_paciente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(checar_paciente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(checar_paciente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(checar_paciente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new checar_paciente().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
// End of variables declaration//GEN-END:variables
}
|
package com.snab.tachkit.databaseRealm.structureTableDatabase;
import io.realm.RealmObject;
/**
* Created by Таня on 13.03.2015.
* Таблица связей кпп и категорий
*/
public class LinkKpp extends RealmObject {
private int id_link_advert_kpp_type;
private int link_advert_type_id;
private int link_kpp_type_id;
public int getId_link_advert_kpp_type() {
return id_link_advert_kpp_type;
}
public void setId_link_advert_kpp_type(int id_link_advert_kpp_type) {
this.id_link_advert_kpp_type = id_link_advert_kpp_type;
}
public int getLink_advert_type_id() {
return link_advert_type_id;
}
public void setLink_advert_type_id(int link_advert_type_id) {
this.link_advert_type_id = link_advert_type_id;
}
public int getLink_kpp_type_id() {
return link_kpp_type_id;
}
public void setLink_kpp_type_id(int link_kpp_type_id) {
this.link_kpp_type_id = link_kpp_type_id;
}
}
|
package lab8;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class carApp {
public static void main(String[] args) throws IOException {
Engine e = new Engine();
e.setEngSize(2500);
e.setHorsePower(150);
//create car object
Car c = new Car();
c.setColor("Red");
c.setBrand("Honda");
c.setCarID("กข-1234");
c.setEngine(e);
System.out.println(c.toString());
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter car color: ");
String color = reader.readLine();
System.out.print("Enter car brand: ");
String brand = reader.readLine();
System.out.print("Enter car ID: ");
String id = reader.readLine();
System.out.print("Enter engine size: ");
int size = Integer.parseInt(reader.readLine());
System.out.print("Enter horse power: ");
int hpower = Integer.parseInt(reader.readLine());
Engine myEng = new Engine(size, hpower);
Car myCar = new Car(color, brand, id, myEng);
System.out.println(myCar.toString());
}//main
}//class |
package com.alonemusk.medicalapp.ui.EnterAdress;
import androidx.lifecycle.ViewModelProviders;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.alonemusk.medicalapp.R;
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import org.json.JSONObject;
import java.util.HashMap;
import static android.content.ContentValues.TAG;
public class AddressForm extends Fragment {
private AddressFormViewModel mViewModel;
String address;
String Landmark;
String City;
String state;
Button submit;
public static AddressForm newInstance() {
return new AddressForm();
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View v=inflater.inflate(R.layout.address_form_fragment, container, false);
submit=v.findViewById(R.id.submit);
final EditText editText =v.findViewById(R.id.line1);
final EditText editText2 =v.findViewById(R.id.line2);
final EditText editText5 =v.findViewById(R.id.line5);
final EditText editTex3 =v.findViewById(R.id.line3);
final EditText editTex4 =v.findViewById(R.id.line4);
submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
InsertAddressToServer(10001,editText.getText().toString(),editText2.getText().toString(),editTex3.getText().toString(),editTex4.getText().toString(),editText5.getText().toString());
}
});
return v;
}
public void InsertAddressToServer(int user_id,String address,String landmark,String city,String state,String mobile_no){
Toast.makeText(getActivity(), "in vooly", Toast.LENGTH_SHORT).show();
RequestQueue queue = Volley.newRequestQueue(getActivity());
// JSONObject urlf = new JSONObject(data);
JSONObject data2 = new JSONObject();
try{
data2.put("address",address);
data2.put("user_id",user_id);
data2.put("landmark",landmark);
data2.put("mobile_no",mobile_no);
data2.put("city",city);
}catch(Exception e){
}
final JsonObjectRequest putRequest = new JsonObjectRequest(Request.Method.POST
, "http://ec2-3-16-216-35.us-east-2.compute.amazonaws.com:3000/user/insert-address", data2,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Toast.makeText(getActivity(), ""+response, Toast.LENGTH_SHORT).show();
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getActivity(), "volly error " + error, Toast.LENGTH_SHORT).show();
}
}
) {
@Override
public HashMap<String, String> getHeaders() throws AuthFailureError {
HashMap<String, String> params = new HashMap<>();
// params.put("Content-Type", " text/javascript");
params.put("Content-Type", "application/json");
return params;
}
};
queue.add(putRequest);
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mViewModel = ViewModelProviders.of(this).get(AddressFormViewModel.class);
}
}
|
package com.klocek.lowrez;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.Disposable;
/**
* Created by Konrad on 2016-04-11.
*/
public class Bar implements Disposable {
private Texture barTexture;
private SpriteBatch batch;
private int yPos;
public Bar(SpriteBatch batch, int yPos) {
this.batch = batch;
this.yPos = yPos;
barTexture = new Texture(Gdx.files.internal("bar.png"));
}
public void update(float delta) {
batch.draw(barTexture, 0, yPos);
}
@Override
public void dispose() {
barTexture.dispose();
}
}
|
package com.tencent.mm.plugin.location.ui;
import com.tencent.mm.sdk.platformtools.al.a;
import com.tencent.mm.sdk.platformtools.x;
class k$2 implements a {
final /* synthetic */ k kGI;
k$2(k kVar) {
this.kGI = kVar;
}
public final boolean vD() {
x.i("MicroMsg.TalkMgr", "seizeMicTimer reach");
k.a(this.kGI);
return false;
}
}
|
package com.example.healthmanage.bean.recyclerview;
public class GetPointRecyclerView {
public int src, point;
public String title, description, tip, jumpTxt;
public GetPointRecyclerView(int src, String title, String description, int point, String tip,
String jumpTxt) {
this.src = src;
this.title = title;
this.description = description;
this.point = point;
this.tip = tip;
this.jumpTxt = jumpTxt;
}
}
|
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.json.JSONObject;
public class JSON2Text
{
public static void main(String [] args) throws Exception
{
String line;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy");
System.out.println("status_id\tuser_id\tcontent\tgmt_time\tgeo\tplace_id");
while((line=br.readLine())!=null)
{
try
{
JSONObject js_tweet = new JSONObject(line);
long status_id = js_tweet.getLong("id");
JSONObject js_user = js_tweet.getJSONObject("user");
long user_id = js_user.getLong("id");
String content = js_tweet.getString("text");
content = content.replaceAll("[\t\n\r\f]+", " ");
content = content.replaceAll("[^ a-zA-Z0-9\\[\\]\\;',./`=\\-~!@#$%\\^&*()_+{}|:\"<>?]", "");
String date = js_tweet.getString("created_at");
Date date2 = sdf.parse(date);
String geo = js_tweet.isNull("geo") ? "null" : js_tweet.getString("geo");
String place = js_tweet.isNull("place") ? "null" : js_tweet.getString("place");
Timestamp ts = new Timestamp(date2.getTime());
System.out.println(String.format("%d\t%d\t%s\t%s\t%s\t%s", status_id, user_id, content, ts.toString(), geo, place));
}
catch (Exception e) {}
}
br.close();
}
}
|
package cn.chuanyun.utils;
/**
* @author 1207263
*
*/
public class GenericUtil {
/**
* @param <T>
* @param argument
* @return boolean
*/
public static <T> boolean isNull(T argument) {
return (argument == null);
}
/**
* @param <T>
* @param argument
* @return boolean
*/
public static <T> boolean isNotNull(T argument) {
return !(argument == null);
}
/**
* @param string
* @return boolean
*/
public static boolean isNumpty(String string) {
return (null == string || string.trim().isEmpty());
}
/**
* @param string
* @return boolean
*/
public static boolean isNotNumpty(String string) {
return (null != string && !string.trim().isEmpty());
}
}
|
package mini.market.minimarket.service;
import mini.market.minimarket.exception.ProductNotFoundException;
import mini.market.minimarket.model.minimarket;
import mini.market.minimarket.repo.MinimarketRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.UUID;
@Service
public class MinimarketService {
private final MinimarketRepo minimarketRepo;
@Autowired
public MinimarketService(MinimarketRepo minimarketRepo) {
this.minimarketRepo = minimarketRepo;
}
public minimarket addProduct(minimarket product) {
product.setProductCode(UUID.randomUUID().toString());
return minimarketRepo.save(product);
}
public List<minimarket> findAllProducts() {
return minimarketRepo.findAll();
}
public minimarket findProductByProductid(Long productid) {
return minimarketRepo.findProductByProductid(productid).orElseThrow(() -> new ProductNotFoundException("Product" + productid + "not found"));
}
public minimarket updateProduct(minimarket product) {
return minimarketRepo.save(product);
}
public void deleteProduct(Long productid) {
minimarketRepo.deleteProductByProductid(productid);
}
}
|
package com.authenticationservice.core.service;
import com.authenticationservice.db.entity.UserEntity;
import com.authenticationservice.dto.Right;
import com.authenticationservice.dto.User;
import java.util.List;
public interface RightService {
List<Right> getAll();
Right getOne(Long rightId);
List<Right> findRightsByUser(User user);
}
|
package com.example.gprslocation;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import android.Manifest;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.provider.Settings;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
TextView txtlocation, txtStatusGPS;
LocationListener locationListener;
LocationManager locationManager;
double latitudeX1, latitudeX2, longtitudeY1, longtitudeY2, refLatitude, refLongtitude;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
txtlocation = findViewById(R.id.location);
txtStatusGPS = findViewById(R.id.statusgps);
getSupportActionBar().setTitle("STIKOM BALI");
setLatitude();
GetLocationUpdate();
}
private void setLatitude(){
if (configLocation.LATITUDEX1 > configLocation.LATITUDEX2){
latitudeX1 = configLocation.LATITUDEX1;
latitudeX2 = configLocation.LATITUDEX2;
}
else {
latitudeX1 = configLocation.LATITUDEX2;
latitudeX2 = configLocation.LATITUDEX1;
}
if (configLocation.LONGTITUDEY1 > configLocation.LONGTITUDEY2){
longtitudeY1 = configLocation.LONGTITUDEY1;
longtitudeY2 = configLocation.LONGTITUDEY2;
}
else {
longtitudeY1 = configLocation.LONGTITUDEY2;
longtitudeY2 = configLocation.LONGTITUDEY1;
}
refLatitude = configLocation.REFLATITUDE;
refLongtitude = configLocation.REFLONGTITUDE;
}
private void GetLocationUpdate(){
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)){
onGPS();
}
else {
getLocation();
}
}
private void getLocation(){
if (ActivityCompat.checkSelfPermission(MainActivity.this,
Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
&& ActivityCompat.checkSelfPermission(MainActivity.this,
Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED){
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 1);
getLocation();
}
else {
locationListener = new LocationListener() {
@Override
public void onLocationChanged(Location location) {
if (location != null){
double lat = location.getLatitude();
double _long = location.getLongitude();
txtlocation.setText("LAT : " + String.valueOf(lat) + "\nLONG : " + String.valueOf(_long));
double jarak = checkJarak(refLatitude, lat, refLongtitude, _long);
if (checkLocation(lat, _long)){
txtStatusGPS.setText("Masuk Gan\nJarak : " + String.format("%.2f", jarak) + " M");
}
else {
txtStatusGPS.setText("Gak Masuk Gan\nJarak : " + String.format("%.2f", jarak) + " M");
}
}
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onProviderDisabled(String provider) {
}
};
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000, 10, locationListener);
}
}
private double checkJarak(double lat1, double lat2, double _long1, double _long2){
double laDistance = toRad(lat2 - lat1);
double longDistance = toRad(_long2 - _long1);
double a = Math.sin(laDistance / 2) * Math.sin(laDistance / 2) +
Math.cos(toRad(lat1)) * Math.cos(toRad(lat2)) * Math.sin(longDistance / 2) * Math.sin(longDistance / 2);
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
double jarak = 6371 * c * 1000;
return jarak;
}
private double toRad(double value){
return value * Math.PI / 180;
}
private boolean checkLocation(double lat, double _long){
if (lat < latitudeX1 && lat > latitudeX2){
if (_long < longtitudeY1 && _long > longtitudeY2){
return true;
}
else {
return false;
}
}
else {
return false;
}
}
private void onGPS(){
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Enable GPS").setCancelable(false).setPositiveButton("yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
}
}). setNegativeButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
final AlertDialog alertDialog = builder.create();
alertDialog.show();
}
}
|
package models;
import java.security.Timestamp;
import java.sql.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import play.db.jpa.Model;
@Entity
public class Permit extends Model{
@ManyToOne
@JoinColumn(name = "id_provider")
private Provider provider;
@ManyToOne
@JoinColumn(name = "id_season")
private Season season;
@ManyToOne
@JoinColumn(name = "id_transport")
private Transport transport;
@ManyToOne
@JoinColumn(name = "id_buyer")
private Buyer buyer;
@ManyToOne
@JoinColumn(name = "id_room")
private Room room;
@Column(columnDefinition = "numeric")
private double final_sum;
@Column(columnDefinition = "numeric")
private double visa;
private Date start_date;
private int period;
public Provider getProvider() {
return provider;
}
public void setProvider(Provider provider) {
this.provider = provider;
}
public Season getSeason() {
return season;
}
public void setSeason(Season season) {
this.season = season;
}
public Transport getTransport() {
return transport;
}
public void setTransport(Transport transport) {
this.transport = transport;
}
public Buyer getBuyer() {
return buyer;
}
public void setBuyer(Buyer buyer) {
this.buyer = buyer;
}
public Room getRoom() {
return room;
}
public void setRoom(Room room) {
this.room = room;
}
public double getFinal_sum() {
return final_sum;
}
public void setFinal_sum(double final_sum) {
this.final_sum = final_sum;
}
public double getVisa() {
return visa;
}
public void setVisa(double visa) {
this.visa = visa;
}
public Date getStart_date() {
return start_date;
}
public void setStart_date(Date start_date) {
this.start_date = start_date;
}
public int getPeriod() {
return period;
}
public void setPeriod(int period) {
this.period = period;
}
}
|
package baekjoon;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Mathematics {
static int answer = 0;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//5073번
// while(true) {
// String s = br.readLine();
// if(s.startsWith("0")) break;
// String[] arr = s.split(" ");
// int[] iArr = new int[3];
// for(int i = 0; i<3; i++) {
// iArr[i] = Integer.parseInt(arr[i]);
// }
// Arrays.sort(iArr);
// int n1 = iArr[0];
// int n2 = iArr[1];
// int n3 = iArr[2];
// if(n1 == n2 && n2 == n3) {
// System.out.println("Equilateral");
// continue;
// }else if(n3 < n1 + n2) {
// if(n1 == n2 || n2 == n3 || n3 == n1) {
// System.out.println("Isosceles");
// }else {
// System.out.println("Scalene");
// }
// }else {
// System.out.println("Invalid");
// }
// }
//1978번
// int N = Integer.parseInt(br.readLine());
// StringTokenizer st = new StringTokenizer(br.readLine());
// int answer = 0;
// for(int i=0; i<N; i++) {
// int num = Integer.parseInt(st.nextToken());
// if(num == 1) continue;
// if(num == 2) {
// answer++;
// continue;
// }
// answer++;
// for(int j=2; j<num; j++) {
// if(num % j == 0) {
// answer--;
// break;
// }
// }
// }
// System.out.println(answer);
//2581번
// int M = Integer.parseInt(br.readLine());
// int N = Integer.parseInt(br.readLine());
//
// int sum = 0;
// int min = Integer.MAX_VALUE;
// String answer = "";
// for(int i=M; i<=N; i++) {
// boolean check = false;
// if(i==0) check = true;
// for(int j=2; j*j<=i; j++) {
// if(i % j == 0) {
// check = true;
// }
// }
// if(!check) {
// sum += i;
// if(min > i) {
// min = i;
// }
// }
// }
//
// if(sum == 0) {
// answer = "-1";
// }else {
// answer = sum + "\n" + min;
// }
//
// System.out.println(answer);
//1929번
// StringTokenizer st = new StringTokenizer(br.readLine());
// int M = Integer.parseInt(st.nextToken());
// int N = Integer.parseInt(st.nextToken());
// int[] arr = new int[N+1];
// arr[1] = 1;
// for(int i=2; i*i<=N; i++) {
// for(int j=2*i; j <=N; j+=i) {
// arr[j] = 1;
// }
// if(i == 2) {
// arr[i] = 0;
// }
// }
// for(int i=M; i<=N; i++) {
// if(arr[i] == 0) {
// System.out.println(i);
// }
// }
//4948번
// int n, cnt = 0;
// int[] arr;
// while (true) {
// n = Integer.parseInt(br.readLine());
// if(n == 0) break;
// arr = new int[2*n +1];
// arr[0] = 1;
// arr[1] = 1;
// for(int i=2; i*i<=2*n; i++) {
// for(int j=2*i; j<=2*n; j+=i) {
// arr[j] = 1;
// }
// }
//
// for(int i = n; i<=2*n; i++) {
// if(arr[i] == 0) {
// System.out.print(i + " ");
// cnt++;
// }
// System.out.println();
// }
// System.out.println(cnt);
// cnt = 0;
//
// }
//9020번
// int T = Integer.parseInt(br.readLine());
// for(int i=0; i<T; i++) {
// int n = Integer.parseInt(br.readLine());
// int[] arr = new int[n+1];
// arr[0] = 1;
// arr[1] = 1;
// for(int j=2; j*j<=n; j++) {
// for(int k=2*j; k<=n; k+=j) {
// arr[k] = 1;
// }
// }
//
// for(int j=n/2; j>=0; j--) {
// if(arr[j] == 0 && arr[n-j] == 0) {
// System.out.println(j + " " + (n -j));
// break;
// }
// }
// }
//1085번
// StringTokenizer st = new StringTokenizer(br.readLine());
// int x = Integer.parseInt(st.nextToken());
// int y = Integer.parseInt(st.nextToken());
// int w = Integer.parseInt(st.nextToken());
// int h = Integer.parseInt(st.nextToken());
//
// int answer = 0;
//
// int tmpR = w-x > x-0 ? x-0 : w-x;
// int tmpC = h-y > y-0 ? y-0 : h-y;
// answer = tmpR > tmpC ? tmpC : tmpR;
// System.out.println(answer);
//3009번
// int tmpX1 = 0;
// int tmpY1 = 0;
// int tmpX2 = 0;
// int tmpY2 = 0;
// int cntX = 1;
// int cntY = 1;
// for(int i=0; i<3; i++) {
// StringTokenizer st = new StringTokenizer(br.readLine());
// int x = Integer.parseInt(st.nextToken());
// int y = Integer.parseInt(st.nextToken());
//
// if(i == 0) {
// tmpX1 = x;
// tmpY1 = y;
// continue;
// }
//
//
// if(tmpX1 == x) {
// cntX++;
// }else {
// tmpX2 = x;
// }
// if(tmpY1 == y){
// cntY++;
// }else {
// tmpY2 = y;
// }
//
// }
// String answer = "";
// answer += cntX == 2 ? tmpX2 : tmpX1;
// answer+=" ";
// answer += cntY == 2 ? tmpY2 : tmpY1;
// System.out.println(answer);
//4153번
// while (true) {
// String str = br.readLine();
// if(str.equals("0 0 0")) break;
// String[] sArr = str.split(" ");
// int[] arr = new int[3];
// for(int i=0; i<3; i++) {
// arr[i] = Integer.parseInt(sArr[i]);
// }
// Arrays.sort(arr);
// String answer = "";
// if(arr[2] * arr[2] == arr[0]*arr[0] + arr[1]*arr[1]) {
// answer = "right";
// }else {
// answer = "wrong";
// }
// System.out.println(answer);
// }
//3053번
// double R = Double.parseDouble(br.readLine());
// System.out.printf("%.6f\n",Math.PI*R*R);
// System.out.printf("%.6f",2*R*R);
//1002번
// int T = Integer.parseInt(br.readLine());
// for(int i=0; i<T; i++) {
// StringTokenizer st = new StringTokenizer(br.readLine());
// int x1 = Integer.parseInt(st.nextToken());
// int y1 = Integer.parseInt(st.nextToken());
// int r1 = Integer.parseInt(st.nextToken());
// int x2 = Integer.parseInt(st.nextToken());
// int y2 = Integer.parseInt(st.nextToken());
// int r2 = Integer.parseInt(st.nextToken());
//
// int distance_pow = (int)(Math.pow(x1-x2,2) +Math.pow(y1-y2,2));
// String answer = "";
// //중점 같으면서 반지름도 같은 경우
// if(x1 == x2 && y1==y2 && r1==r2) {
// answer = "-1";
//
// //두 원의 반지름 합보다 중점 거리가 더 길 때
// }else if(distance_pow > Math.pow(r1+r2,2)) {
// answer = "0";
// //원 안에 있으나 내접하지 않을 때
// }else if(distance_pow < Math.pow(r1-r2,2)) {
// answer = "0";
//
// //내접할 때
// }else if(distance_pow == Math.pow(r1+r2,2)) {
// answer = "1";
//
// //외접할 때
// }else if(distance_pow == Math.pow(r1-r2,2)) {
// answer = "1";
// }else {
// answer = "2";
// }
// System.out.println(answer);
//
//
// }
//10757번
StringTokenizer st = new StringTokenizer(br.readLine());
BigInteger bigInteger1 = new BigInteger(st.nextToken());
BigInteger bigInteger2 = new BigInteger(st.nextToken());
System.out.println(bigInteger1.add(bigInteger2));
}
private static int method(int k, int n) {
if(k == 0) {
return n;
}
int tmp = 0;
for(int i = 1; i <= n; i++) {
tmp += method(k-1, i);
}
return tmp;
}
//이런식으로 while문을 이용해 계속 더한다..
//좋은 방법이라고 생각한다
private static int solution(int n) {
// 1: 1 (1)
// 2 ~ 7 : 2 (6개)
// 8 ~ 19 : 3 (12개)
// 20 ~ 37 : 4 (18개)
// 38 ~ 61 : 5 (24개)
// ...생략..
// a(n) = a(n-1) + 6(n-1) | a(n): 첫 항
if (n == 1) return 1;
int i = 2;
int k = 1;
while (i <= n) {
i += 6 * k++;
}
return k;
}
}
|
package zystudio.demo.ipc;
import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.support.annotation.Nullable;
import zystudio.mylib.utils.LogUtil;
/**
* Created by zylab on 2017/12/12.
*/
public class RemoteAIDLService extends Service {
public void serviceMethod(){
LogUtil.log("BindSerivce -> MyMethod");
}
@Nullable
@Override
public IBinder onBind(Intent intent) {
return myBinder;
}
public class MyBinder extends Binder {
public void invokeServiceMethod(){
serviceMethod();
}
}
private MyBinder myBinder=new MyBinder();
}
|
package net.dk.webService.entity;
import javax.persistence.*;
import java.util.Date;
/**
* Created by enbiya on 21.02.2017.
*/
@Entity
@Table(name = "t_logs")
public class Logs {
@Id
@Column(name = "executionid")
private String executionId;
@Column(name = "senderserialno")
private String senderSerialNo;//bayi id'si
@Column(name = "jobname")
private String jobName;//boş dursun
@Column(name = "startdate")
@Temporal(TemporalType.TIMESTAMP)
private Date startDate;
@Column(name = "recorddate")
@Temporal(TemporalType.TIMESTAMP)
private Date recordDate;
@Column(name = "sentdate")
@Temporal(TemporalType.TIMESTAMP)
private Date sentDate;
@Column(name = "sent")
private boolean sent;
@Column(name = "successful")
private boolean successful;//test sonucu
@Column(name = "faultexception")
private boolean faultException;//false olacak
@Column(name = "exceptionmessage")
private String exceptionMessage;//null
@Column(name = "modemserialnumber")
private String modemSerialNumber;//modem seri nosu
public Logs() {
}
public Logs(String executionId, String senderserialno, String jobname, Date startdate, Date recorddate, Date sentdate, boolean sent, boolean successful, boolean faultexception, String exceptionmessage, String modemserialnumber) {
super();
this.executionId = executionId;
this.senderSerialNo = senderserialno;
this.jobName = jobname;
this.startDate = startdate;
this.recordDate = recorddate;
this.sentDate = sentdate;
this.sent = sent;
this.successful = successful;
this.faultException = faultexception;
this.exceptionMessage = exceptionmessage;
this.modemSerialNumber = modemserialnumber;
}
public String getExecutionId() {
return executionId;
}
public void setExecutionId(String executionId) {
this.executionId = executionId;
}
public String getJobName() {
return jobName;
}
public void setJobName(String jobName) {
this.jobName = jobName;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = new Date();
}
public Date getRecordDate() {
return recordDate;
}
public void setRecordDate(Date recordDate) {
this.recordDate = new Date();
}
public Date getSentDate() {
return sentDate;
}
public void setSentDate(Date sentDate) {
this.sentDate = new Date();
}
public boolean isSent() {
return sent;
}
public void setSent(boolean sent) {
this.sent = sent;
}
public boolean isSuccessful() {
return successful;
}
public void setSuccessful(boolean successful) {
this.successful = successful;
}
public boolean isFaultException() {
return faultException;
}
public void setFaultException(boolean faultException) {
this.faultException = false;//böyle kalsın
}
public String getSenderSerialNo() {
return senderSerialNo;
}
public void setSenderSerialNo(String senderSerialNo) {
this.senderSerialNo = senderSerialNo;
}
public String getExceptionMessage() {
return exceptionMessage;
}
public void setExceptionMessage(String exceptionMessage) {
this.exceptionMessage = exceptionMessage;
}
public String getModemSerialNumber() {
return modemSerialNumber;
}
public void setModemSerialNumber(String modemSerialNumber) {
this.modemSerialNumber = modemSerialNumber;
}
}
|
package com.takshine.wxcrm.service;
import java.util.List;
import com.takshine.wxcrm.base.services.EntityService;
import com.takshine.wxcrm.domain.cache.CacheSchedule;
import com.takshine.wxcrm.message.sugar.ScheduleAdd;
import com.takshine.wxcrm.message.sugar.ScheduleComplete;
/**
* 日程前端缓存
* @author liulin
*
*/
public interface CacheScheduleService extends EntityService{
/**
* 转换
* @param add
* @return
*/
public CacheSchedule transf(String orgId, ScheduleAdd add);
/**
* update 转换
* @param add
* @return
*/
public CacheSchedule transf(String orgId, ScheduleComplete add);
/**
* 转换
* @param add
* @return
*/
public ScheduleAdd invstransf(CacheSchedule cache);
/**
* 根据rowid查找crmid
* @return
*/
public CacheSchedule getCrmIdByRowId(String rowId);
/**
* 根据crmId 查询缓存客户列表
* @param crmId
* @return
*/
public List<CacheSchedule> findCacheScheduleListByCrmId(CacheSchedule cache);
/**
* 更新可用标志
* @param cache
*/
public void updateEnabledFlag(CacheSchedule cache);
/**
* 更新相关
* @param cache
*/
public void updateScheduleParent(CacheSchedule cache);
/**
* 查找任务
* 用于微信命令字菜单
* @param cache
* @return
*/
public List<CacheSchedule> findCacheScheduleListByOpenId(CacheSchedule cache);
}
|
package com.github.arsentiy67.usereditor.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@Entity
@Table(name = "user_address", schema = "public")
public class UserAddress {
private Integer userAddressId;
private User user;
private String country;
private String city;
public UserAddress() {}
@Id
@SequenceGenerator(name="pk_user_address_id",sequenceName="user_address_id_seq", allocationSize=1)
@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="pk_user_address_id")
@Column(name = "user_address_id", unique = true, nullable = false)
public Integer getUserAddressId() {
return userAddressId;
}
public void setUserAddressId(Integer userAddressId) {
this.userAddressId = userAddressId;
}
@ManyToOne(fetch = FetchType.EAGER)
@PrimaryKeyJoinColumn
@JoinColumn(name = "user_id", nullable = false)
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
@Column(name = "country", nullable = false, length = 255)
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
@Column(name = "city", nullable = false, length = 255)
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
}
|
package BASE;
/*
* UCF COP3330 Summer 2021 Assignment 1 Solution
* Copyright 2021 Miguel Nobrega
*/
/*
Exercise 14 - Tax Calculator
You don’t always need a complex control structure to solve simple problems. Sometimes a program requires an extra step in one case, but in all other cases there’s nothing to do.
Write a simple program to compute the tax on an order amount. The program should prompt for the order amount and the state.
If the state is “WI,” then the order must be charged 5.5% tax. The program should display the subtotal, tax, and total for Wisconsin residents
but display just the total for non-residents.
Example Output
What is the order amount? 10
What is the state? WI
The subtotal is $10.00.
The tax is $0.55.
The total is $10.55.
Or
What is the order amount? 10
What is the state? MN
The total is $10.00
Constraints
Implement this program using only a simple if statement—don’t use an else clause.
Ensure that all money is rounded up to the nearest cent.
Use a single output statement at the end of the program to display the program results.
Challenges
Allow the user to enter a state abbreviation in upper, lower, or mixed case.
Also allow the user to enter the state’s full name in upper, lower, or mixed case.
*/
import java.util.Scanner;
public class App
{
static Scanner in = new Scanner(System.in);
static final double TAX = 0.055;
public static void main(String[] args)
{
App prog = new App();
//input
System.out.print("What is the order amount? ");
double order = in.nextDouble();
System.out.print("What is the state? ");
String state = in.next();
//Calculation, check and output
prog.sendOutput(state, order);
}
public double calcTax(double order)
{
return (double)order * TAX;
}
public void sendOutput(String state, double order)
{
if(state.equalsIgnoreCase("Wi") || state.equalsIgnoreCase("Wisconsin"))
{
System.out.printf("The subtotal is $%,.2f%nThe tax is $%,.2f%nThe total is %,.2f", order, calcTax(order), (calcTax(order) + order));
return;
}
System.out.printf("The total is $%,.2f", order);
}
}
|
package com.spring.shopping.product;
import java.util.ArrayList;
import java.util.List;
import com.spring.shopping.qna.QNAVO;
import com.spring.shopping.review.ReviewVO;
public interface ProductService {
public void addProduct(ProductVO productVO) throws Exception;
public void delProduct(int num) throws Exception;
public List<ProductVO> getProductList(int category, int page) throws Exception;
public List<ProductVO> getAllProductList(int page) throws Exception;
public int getCount(int category) throws Exception;
public int getSearchCount(String word) throws Exception;
public ProductVO getProduct(int num) throws Exception;
public List<ReviewVO> getReview(int num) throws Exception;
public List<QNAVO> getQNA(int num) throws Exception;
public void productLike(int num) throws Exception;
public List<ProductVO> searchProduct(String word, int order, int page) throws Exception;
public ArrayList<String> searchProductName(String word) throws Exception;
public ArrayList<ProductVO> getBestList() throws Exception;
} |
package com.guozaiss.news.fragment.reptile;
import android.widget.ImageView;
import android.widget.ListView;
import com.guozaiss.news.R;
import com.guozaiss.news.adapters.PicAdapter;
import com.guozaiss.news.core.base.view.BaseFragment;
import com.guozaiss.news.reptile.BaseReptile;
import com.guozaiss.news.reptile.PictureModel;
import com.guozaiss.news.reptile.PictureReptile;
import com.guozaiss.news.utils.AnimUtils;
import com.guozaiss.news.view.swipeLayout.SwipeRefreshLayout;
import com.guozaiss.news.view.swipeLayout.SwipeRefreshLayoutDirection;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
/**
* 新浪黄金
*/
public class SinaGoldFragment extends BaseFragment {
@BindView(R.id.img_refresh)
ImageView imgRefresh;
private String url = "http://www.zbjuran.com/mei/xinggan/";
private int index = 1;
@BindView(R.id.listView)
ListView listView;
@BindView(R.id.swipeRefreshLayout)
SwipeRefreshLayout swipeRefreshLayout;
private List<PictureModel> pictureModels = new ArrayList<>();
private PicAdapter adapter;
@Override
protected int getLayoutId() {
return R.layout.fragment_sina_gold;
}
@Override
protected void init() {
listView.setEmptyView(imgRefresh);
AnimUtils.startAnimation(getActivity(), imgRefresh);
swipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.colorAccent), getResources().getColor(R.color.colorPrimary), getResources().getColor(R.color.colorMenu));
swipeRefreshLayout.setDirection(SwipeRefreshLayoutDirection.BOTH);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh(SwipeRefreshLayoutDirection direction) {
if (direction == SwipeRefreshLayoutDirection.TOP) {
index = 1;
} else if (direction == SwipeRefreshLayoutDirection.BOTTOM) {
index++;
}
requestData();
}
});
requestData();
}
private void requestData() {
new PictureReptile().getData(url.concat("list_13_").concat(index + "").concat(".html"), new BaseReptile.CallBack<PictureModel>() {
@Override
public void pickData(List<PictureModel> modelList) {
imgRefresh.clearAnimation();
swipeRefreshLayout.setRefreshing(false);
if (index == 1) {
pictureModels.clear();
}
pictureModels.addAll(modelList);
if (adapter == null) {
adapter = new PicAdapter(getActivity(), pictureModels);
listView.setAdapter(adapter);
} else {
adapter.notifyDataSetChanged();
}
}
@Override
public void onErr() {
imgRefresh.clearAnimation();
}
});
}
} |
package com.sky.contract.util.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Created by shiqm on 2018/9/15.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface Log {
}
|
package com.example.jinliyu.shoppingapp_1.activity;
import android.content.ContentValues;
import android.content.Context;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.jinliyu.shoppingapp_1.database.MyDBHelper;
import com.example.jinliyu.shoppingapp_1.R;
import com.example.jinliyu.shoppingapp_1.data.Product;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
public class ProductDetailActivity extends AppCompatActivity {
SharedPreferences sharedPreferences;
TextView name, price,desciption;
ImageView image;
Button btn;
EditText quantityTxt;
MyDBHelper myDBHelper;
SQLiteDatabase sqLiteDatabase;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_product_detail);
name = findViewById(R.id.proname);
price = findViewById(R.id.proprice);
desciption = findViewById(R.id.prodesc);
image = findViewById(R.id.proimage);
btn = findViewById(R.id.addtocartbtn);
sharedPreferences = getSharedPreferences("UserInfo", Context.MODE_PRIVATE);
final String savedmobile = sharedPreferences.getString("mobile","");
final String savedname = sharedPreferences.getString("productname","");
final String savedprice = sharedPreferences.getString("productprice","");
final String saveddesc = sharedPreferences.getString("productdesc","");
final String savedimg = sharedPreferences.getString("productimage","");
final String savedid = sharedPreferences.getString("productid","");
name.setText(savedname);
price.setText( "$"+ savedprice);
desciption.setText(saveddesc);
Picasso.with(this).load(savedimg).into(image);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Product product = new Product(savedid,savedname,quantity,savedprice,saveddesc,savedimg);
myDBHelper = new MyDBHelper(ProductDetailActivity.this);
sqLiteDatabase = myDBHelper.getWritableDatabase();
quantityTxt = findViewById(R.id.qtxt);
final String quantity = quantityTxt.getText().toString();
if(TextUtils.isEmpty(quantity) || quantity.equals("0"))
{
Toast.makeText(getApplicationContext(), "Invalid quantity!", Toast.LENGTH_LONG).show();
}
else {
ContentValues contentValues = new ContentValues();
contentValues.put(MyDBHelper.USER_MOBILE, savedmobile);
contentValues.put(MyDBHelper.PRO_ID, savedid);
contentValues.put(MyDBHelper.PRO_NAME, savedname);
contentValues.put(MyDBHelper.PRO_PRICE, savedprice);
contentValues.put(MyDBHelper.DESCRIPTION, saveddesc);
contentValues.put(MyDBHelper.IMAGE, savedimg);
contentValues.put(MyDBHelper.QUANTITY, quantity);
sqLiteDatabase.insert(MyDBHelper.TABLE_NAME, null, contentValues);
Toast.makeText(getApplicationContext(), "Successfully Add to Cart!", Toast.LENGTH_LONG).show();
}
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();
if(this != null)
sqLiteDatabase.close();
}
}
|
package fragments;
import android.support.v4.app.Fragment;
public class HomeFragment1 extends Fragment{
}
|
package com.google.android.exoplayer2.c.c;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.c.c.u.d;
import com.google.android.exoplayer2.c.f;
import com.google.android.exoplayer2.c.i;
import com.google.android.exoplayer2.c.k;
import com.google.android.exoplayer2.i.j;
import com.tencent.map.lib.gl.model.GLIcon;
public final class m implements h {
private final String aem;
private int aft;
private long aih;
private k alX;
private String amX;
private boolean anb;
private long ann;
private final j aot;
private final i aou;
private int aov;
private boolean aow;
private int state;
public m() {
this(null);
}
public m(String str) {
this.state = 0;
this.aot = new j(4);
this.aot.data[0] = (byte) -1;
this.aou = new i();
this.aem = str;
}
public final void jX() {
this.state = 0;
this.aov = 0;
this.aow = false;
}
public final void a(f fVar, d dVar) {
dVar.kf();
this.amX = dVar.kh();
this.alX = fVar.cp(dVar.kg());
}
public final void d(long j, boolean z) {
this.aih = j;
}
public final void b(j jVar) {
while (jVar.me() > 0) {
int i;
switch (this.state) {
case 0:
byte[] bArr = jVar.data;
i = jVar.position;
int i2 = jVar.limit;
for (int i3 = i; i3 < i2; i3++) {
boolean z = (bArr[i3] & 255) == 255;
boolean z2 = this.aow && (bArr[i3] & 224) == 224;
this.aow = z;
if (z2) {
jVar.setPosition(i3 + 1);
this.aow = false;
this.aot.data[1] = bArr[i3];
this.aov = 2;
this.state = 1;
break;
}
}
jVar.setPosition(i2);
break;
case 1:
i = Math.min(jVar.me(), 4 - this.aov);
jVar.readBytes(this.aot.data, this.aov, i);
this.aov = i + this.aov;
if (this.aov < 4) {
break;
}
this.aot.setPosition(0);
if (!i.a(this.aot.readInt(), this.aou)) {
this.aov = 0;
this.state = 1;
break;
}
this.aft = this.aou.aft;
if (!this.anb) {
this.ann = (1000000 * ((long) this.aou.aiQ)) / ((long) this.aou.sampleRate);
this.alX.f(Format.a(this.amX, this.aou.mimeType, -1, GLIcon.LEFT, this.aou.channels, this.aou.sampleRate, null, null, this.aem));
this.anb = true;
}
this.aot.setPosition(0);
this.alX.a(this.aot, 4);
this.state = 2;
break;
case 2:
i = Math.min(jVar.me(), this.aft - this.aov);
this.alX.a(jVar, i);
this.aov = i + this.aov;
if (this.aov < this.aft) {
break;
}
this.alX.a(this.aih, 1, this.aft, 0, null);
this.aih += this.ann;
this.aov = 0;
this.state = 0;
break;
default:
break;
}
}
}
public final void jY() {
}
}
|
package logger.sink;
public interface ISink {
void write(String message);
}
|
package com.tingke.admin.entity;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author zhx
* @since 2020-06-01
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="FrComment对象", description="")
public class FrComment implements Serializable {
private static final long serialVersionUID=1L;
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.ID_WORKER_STR)
private String id;
@ApiModelProperty(value = "用户名")
private String name;
@ApiModelProperty(value = "管理员评论目标id")
private String targetId;
@ApiModelProperty(value = "内容")
private String content;
@ApiModelProperty(value = "管理员是否查看 0未查看 1已查看")
private Integer isCheck;
@ApiModelProperty(value = "创建时间")
@TableField(fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(value = "逻辑删除 0默认 1已删除")
@TableLogic
private Integer isDelete;
}
|
package x.java;
import org.apache.commons.lang3.StringUtils;
public class IndentService {
private final String singleIndent;
private int indent;
IndentService(String singleIndent) {
indent = 0;
this.singleIndent = singleIndent;
}
public String getCurrentIndent() {
return StringUtils.repeat(singleIndent, indent);
}
public String calculateIndentToAppendTo(NodeWrapper node) {
if (isIndentPlusTwoNeeded(node)) {
return indentPlusTwo();
} else if (isIndentPlusOneNeeded(node)) {
return indentPlusOne();
} else if (isIndentMinusTwoNeeded(node)) {
return indentMinusTwo();
} else if (isIndentMinusOneNeeded(node)) {
return indentMinusOne();
} else {
return getCurrentIndent();
}
}
private boolean isIndentPlusTwoNeeded(NodeWrapper node) {
return false;
}
private boolean isIndentMinusTwoNeeded(NodeWrapper node) {
return node.isLastNodeInSwitchStatement();
}
private boolean isIndentMinusOneNeeded(NodeWrapper node) {
if (node.isNextNodeText("}") && !node.isBlockStart()) {
return true;
}
if (!node.isDoublePointInSwitchStatement() && !node.isCurrentRuleA("methodBody") && node.isNextNodeTextOneOf("default", "case")) {
return true;
}
return false;
}
private boolean isIndentPlusOneNeeded(NodeWrapper node) {
if (node.isBlockStart() && !node.isNextNodeText("}")) {
return true;
}
if (node.isDoublePointInSwitchStatement() && !node.isNextNodeTextOneOf("default", "case")) {
return true;
}
return false;
}
private String indentPlusOne() {
return StringUtils.repeat(singleIndent, ++indent);
}
private String indentPlusTwo() {
return StringUtils.repeat(singleIndent, indent += 2);
}
private String indentMinusOne() {
return StringUtils.repeat(singleIndent, --indent);
}
private String indentMinusTwo() {
return StringUtils.repeat(singleIndent, indent -= 2);
}
} |
package com.takshine.wxcrm.service;
import java.util.Map;
import net.sf.json.JSONObject;
import com.takshine.wxcrm.base.services.EntityService;
import com.takshine.wxcrm.message.tplmsg.ValColor;
/**
* 模板消息服务
* @author liulin
*
*/
public interface TemplateMsgService extends EntityService{
/**
* 发送日程模板消息
*/
public JSONObject sendScheduleMsg(String openId, String topcolor, String url, Map<String, ValColor> map);
/**
* 审批 模板消息
*/
public JSONObject sendApproveMsg(String openId, String topcolor, String url, Map<String, ValColor> map);
/**
* 待办任务 模板消息
*/
public JSONObject sendToDoWorkMsg(String openId, String topcolor, String url, Map<String, ValColor> map);
}
|
package com.NLPProject;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.sun.javafx.collections.MappingChange.Map;
public class QueryBuilder
{
static HashMap<String, HashSet<String>> grammar = new HashMap<String, HashSet<String>>();
public static void main(String[] args) throws Exception
{
InputStream is = new FileInputStream("C:\\Users\\kpava\\workspace\\NLP_Proejct_GitHub_Sync\\trunk\\ParseTree_Part2.txt");
String s;
BufferedReader br = new BufferedReader(new InputStreamReader(is));
while((s= br.readLine())!=null)
{
buildGrammar(s);
}
System.out.println("____________________________________");
for(String rule : grammar.keySet())
{
for(String production : grammar.get(rule))
{
System.out.println( rule + " -> " + production);
}
}
}
public static void addtoGrammar(String rule, String production)
{
//HashSet<String> alreadyAddedRule = grammar.keySet();
if(!grammar.keySet().contains(rule))
{
HashSet<String> productions = new HashSet<>();
productions.add(production);
grammar.put(rule, productions);
}
else
{
HashSet<String> productions = grammar.get(rule);
productions.add(production);
grammar.put(rule, productions);
}
}
public static void buildGrammar(String tree)
{
//String rule = "(ROOT (SQ (VBZ Is) (NP (NNP Rome)) (NP (NP (DT the) (NN capital)) (PP (IN of) (NP (NNP Italy)))) (. ?)))";
String rule = tree;
List<String> rules = new ArrayList<String>();
Pattern pattern = Pattern.compile("\\([.a-zA-Z]*(\\s[.'a-zA-Z\\?0-9]*)+\\)");
String parts[];
String org = "";
System.out.println(rule);
System.out.println(" ");
while(!rule.equals("ROOT")) {
//System.out.println("-----------------------------------------------------------------------------------");
//System.out.println(rule);
rules = new ArrayList<String>();
Matcher matcher = pattern.matcher(rule);
while(matcher.find()) {
String temp = matcher.group();
org = temp.replace("(", "");
org = org.replace(")", "");
parts = org.split("\\s");
addtoGrammar(parts[0], parts[1]);
rule = rule.replace(temp, parts[0]);
rules.add(temp);
}
for(String ruleProduction: rules) {
ruleProduction = ruleProduction.replace("(", "");
ruleProduction = ruleProduction.replace(")", "");
parts = ruleProduction.split("\\s");
System.out.print(parts[0] + " -> ");
for(int i = 1; i < parts.length; ++i) {
System.out.print(parts[i] + " ");
}
System.out.println("");
}
}
}
}
|
package util;
public class NumberUtil {
public static Double toDouble(Object val){
Double res=null;
if(val instanceof Integer){
res=new Double(""+val);
}
else
if(val instanceof Double){
res=(Double) val;
}
else{
res=(Double) val;
}
return res;
}
}
|
package com.edu.miusched.service.impl;
import com.edu.miusched.dao.SectionDao;
import com.edu.miusched.domain.Section;
import com.edu.miusched.service.SectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class Sectionimpl implements SectionService {
@Autowired
SectionDao sectionDao;
@Override
public Section findSectionById(Long id) {
return sectionDao.findSectionById(id);
}
@Override
public Section SaveSection(Section section) {
return sectionDao.save(section);
}
@Override
public List<Section> getAllSection() {
return sectionDao.findAll();
}
@Override
public void deleteSectionById(Long id) {
sectionDao.deleteById(id);
}
@Override
public Section findSectionByClassRoom(String room) {
return sectionDao.findSectionByClassRoom(room);
}
}
|
// W.P. Iverson code for testing text Exercises
// mystery methods from Chapter 13
// Building Java Programs
//
// copyleft October 2016
package cs211ch13exercises;
import java.util.*;
public class Cs211ch13exercises {
public static void main(String[] args) {
List<Integer> list = new LinkedList<>();
Random r = new Random();
int N = 160000;
int[] intArray = new int[N];
long time = 0;
for (int i=0; i<N; i++) {
list.add(Math.abs(r.nextInt()));
intArray[i] = r.nextInt();
}
System.out.println("Mystery1");
for (int i = 0; i < 10; i++) {
time = System.currentTimeMillis();
mystery1(intArray);
System.out.println(System.currentTimeMillis() - time);
}
System.out.println("Mystery2");
for (int i = 0; i < 10; i++) {
time = System.currentTimeMillis();
mystery2(intArray);
System.out.println(System.currentTimeMillis() - time);
}
System.out.println("Mystery3");
for (int i = 0; i < 10; i++) {
time = System.currentTimeMillis();
mystery3(list);
System.out.println(System.currentTimeMillis() - time);
}
System.out.println("Mystery4");
for (int i=0; i<10; i++){
time = System.currentTimeMillis();
mystery4(list);
System.out.println(System.currentTimeMillis()-time);
}
}
public static int[] mystery1(int[] list) {
int[] result = new int[2 * list.length];
for (int i = 0; i < list.length; i++) {
result[2 * i] = list[i] / 2 + list[i] % 2;
result[2 * i + 1] = list[i] / 2;
}
return result;
}
public static void mystery2(int[] list) {
for (int i = 0; i < list.length / 2; i++) {
int j = list.length - 1 - i;
int temp = list[i];
list[i]= list[j];
list[j] = temp;
}
}
public static void mystery3(List<Integer> list) {
for (int i = 0; i < list.size() - 1; i += 2) {
int first = list.remove(i);
list.add(i + 1, first);
}
}
public static void mystery4(List<Integer> list) {
for (int i = 0; i < list.size() - 1; i += 2) {
Integer first = list.get(i);
list.set(i, list.get(i + 1));
list.set(i + 1, first);
}
}
}
|
package com.tencent.mm.plugin.account.ui;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
class RegByMobileVoiceVerifyUI$2 implements OnClickListener {
final /* synthetic */ RegByMobileVoiceVerifyUI eVO;
RegByMobileVoiceVerifyUI$2(RegByMobileVoiceVerifyUI regByMobileVoiceVerifyUI) {
this.eVO = regByMobileVoiceVerifyUI;
}
public final void onClick(View view) {
this.eVO.startActivityForResult(new Intent(this.eVO, RegByMobileVoiceVerifySelectUI.class).putExtra("voice_verify_code", RegByMobileVoiceVerifyUI.a(this.eVO)), 10000);
}
}
|
package com.qd.mystudy.jartest;
import org.slf4j.ILoggerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Method;
import java.net.URL;
/**
* Created by liqingdong911 on 2015/1/5.
*/
public class ClientLogger {
private static Logger log;
static {
log = createLogger("ClientLogger");
}
private static Logger createLogger(final String loggerName) {
String logConfigFilePath =
System.getProperty("client.log.configFile", System.getenv("CLIENT_LOG_CONFIGFILE"));
Boolean isloadconfig =
Boolean.parseBoolean(System.getProperty("client.log.loadconfig", "true"));
final String log4j_resource_file =
System.getProperty("client.log4j.resource.fileName", "log4j_client.xml");
final String logback_resource_file =
System.getProperty("client.logback.resource.fileName", "logback_client.xml");
if (isloadconfig) {
try {
ILoggerFactory iLoggerFactory = LoggerFactory.getILoggerFactory();
Class classType = iLoggerFactory.getClass();
if (classType.getName().equals("org.slf4j.impl.Log4jLoggerFactory")) {
Class<?> DOMConfigurator = null;
Object DOMConfiguratorObj = null;
DOMConfigurator = Class.forName("org.apache.log4j.xml.DOMConfigurator");
DOMConfiguratorObj = DOMConfigurator.newInstance();
if (null == logConfigFilePath) {
// 如果应用没有配置,则使用jar包内置配置
Method configure = DOMConfiguratorObj.getClass().getMethod("configure", URL.class);
URL url = ClientLogger.class.getClassLoader().getResource(log4j_resource_file);
configure.invoke(DOMConfiguratorObj, url);
}
else {
Method configure = DOMConfiguratorObj.getClass().getMethod("configure", String.class);
configure.invoke(DOMConfiguratorObj, logConfigFilePath);
}
}
else if (classType.getName().equals("ch.qos.logback.classic.LoggerContext")) {
Class<?> joranConfigurator = null;
Class<?> context = Class.forName("ch.qos.logback.core.Context");
Object joranConfiguratoroObj = null;
joranConfigurator = Class.forName("ch.qos.logback.classic.joran.JoranConfigurator");
joranConfiguratoroObj = joranConfigurator.newInstance();
Method setContext = joranConfiguratoroObj.getClass().getMethod("setContext", context);
setContext.invoke(joranConfiguratoroObj, iLoggerFactory);
if (null == logConfigFilePath) {
// 如果应用没有配置,则使用jar包内置配置
URL url = ClientLogger.class.getClassLoader().getResource(logback_resource_file);
Method doConfigure =
joranConfiguratoroObj.getClass().getMethod("doConfigure", URL.class);
doConfigure.invoke(joranConfiguratoroObj, url);
}
else {
Method doConfigure =
joranConfiguratoroObj.getClass().getMethod("doConfigure", String.class);
doConfigure.invoke(joranConfiguratoroObj, logConfigFilePath);
}
}
}
catch (Exception e) {
e.printStackTrace();
}
}
return LoggerFactory.getLogger(loggerName);
}
public static Logger getLog() {
return log;
}
}
|
package welcome;
import java.util.Scanner;
public class ArrayDelete {
public static void main(String[] args)
{
int arr[]={2,3,4,6,34,63,53};
int size=arr.length;
Scanner sc=new Scanner(System.in);
System.out.println("enter the position you want to delete element");
int pos=sc.nextInt();
int i=0;
while(i!=pos-1)
{
i++;
}
while(i<size-1)
{
arr[i]=arr[i+1];
i++;
}
size--;
for( i=0;i<size;i++)
{
System.out.println(arr[i]);
}
}
}
|
package eu.europeana.api2.web.controller;
import java.util.TreeMap;
import javax.annotation.Resource;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.oauth2.provider.AuthorizationRequest;
import org.springframework.security.oauth2.provider.ClientDetails;
import org.springframework.security.oauth2.provider.ClientDetailsService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.servlet.ModelAndView;
import eu.europeana.corelib.db.service.ApiKeyService;
import eu.europeana.corelib.definitions.db.entity.relational.ApiKey;
/**
* Controller for retrieving the model for and displaying the confirmation page for access to a protected resource.
*/
@Controller
@SessionAttributes(types = AuthorizationRequest.class)
public class AccessConfirmationController {
@Resource
private ApiKeyService apiKeyService;
private ClientDetailsService clientDetailsService;
@RequestMapping("/oauth/confirm_access")
public ModelAndView getAccessConfirmation(@ModelAttribute AuthorizationRequest clientAuth) throws Exception {
ClientDetails client = clientDetailsService.loadClientByClientId(clientAuth.getClientId());
ApiKey key = apiKeyService.findByID(client.getClientId());
TreeMap<String, Object> model = new TreeMap<String, Object>();
model.put("auth_request", clientAuth);
model.put("client", client);
model.put("appName", StringUtils.defaultIfBlank(key.getApplicationName(), StringUtils.defaultIfBlank(key.getUser().getCompany(), key.getId())));
return new ModelAndView("user/authorize", model);
}
//
// @RequestMapping("/login")
// public String loginForm() {
// return "user/login";
// }
@RequestMapping(value = "/login", params = "form=user")
public String loginUserForm() {
return "user/login";
}
@RequestMapping(value = "/login", params = "form=myData")
public String loginMyDataForm() {
return "mydata/login";
}
@Autowired
public void setClientDetailsService(ClientDetailsService clientDetailsService) {
this.clientDetailsService = clientDetailsService;
}
}
|
package com.koreait.mvc17.command;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.ibatis.session.SqlSession;
import org.springframework.ui.Model;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.korea.mvc17.dao.BoardDao;
public class BoardDeleteCommand implements BoardCommand {
@Override
public void execute(SqlSession sqlSession, Model model) {
BoardDao bDao = sqlSession.getMapper(BoardDao.class);
Map<String, Object> map = model.asMap();
HttpServletRequest request = (HttpServletRequest) map.get("request");
RedirectAttributes redirectAttributes = (RedirectAttributes) map.get("redirectAttributes");
redirectAttributes.addFlashAttribute("deleteResult", bDao.delete(Integer.parseInt(request.getParameter("bIdx"))));
redirectAttributes.addFlashAttribute("isDelete", "yes");
}
}
|
package Sudoku;
public class Sudoku {
public static int[][] board;
static boolean[][][] posvalues;
Sudoku() {
board = new int[9][9]; // initializing board
posvalues = new boolean[9][9][9]; // initializing options for each cell
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
for (int ii = 0; ii < 9; ii++) {
posvalues[i][j][ii] = true; // Setting all options to true
}
}
}
}
public void setvalue(int row, int column, int value) { // Puts a number in the board and sets all possible values to false showing the cell has been written to while also updating the effected row/column/square
if (value != 0) {
board[row][column] = value;
for (int j = 0; j < 9; j++) {
posvalues[row][column][j] = false;
posvalues[j][column][value - 1] = false;
posvalues[row][j][value - 1] = false;
int r = (row / 3) * 3;
int c = (column / 3) * 3;
for (int i = 0; i < 9; i++) {
posvalues[(r + (i % 3))][c + (i / 3)][value - 1] = false;
}
}
}
}
int getvalue(int row, int column) { // Checks the value in a cell
return board[row][column];
}
public int[] Getrow(int row) { // returns the row array
int[] rows = new int[9];
for (int i = 0; i < 9; i++) {
rows[i] = Sudoku.board[row][i];
}
return rows;
}
public int[] Getcol(int col) { // returns the column array
int[] cols = new int[9];
for (int i = 1; i < 10; i++) {
cols[i - 1] = Sudoku.board[i - 1][col];
}
return cols;
}
int[] getSquare(int squareval) { // returns the square array squares are defined from 0-8 going from top left to top right then down a square like a book
int firstcol = (squareval * 3) % 9;
int firstrow = (squareval / 3) * 3;
int[] square = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
for (int j = 0; j < 3; j++) {
for (int i = 0; i < 3; i++) {
square[3 * j + i] = board[firstrow + j][firstcol + i];
}
}
return square;
}
boolean[][] getSquareposvalues(int squareval) {//returns the possible values for the cells in a square
int firstcol = (squareval * 3) % 9;
int firstrow = (squareval / 3) * 3;
boolean[][] square = new boolean[9][9];
for (int ii = 0; ii < 9; ii++) {
for (int j = 0; j < 3; j++) {
for (int i = 0; i < 3; i++) {
square[3 * j + i][ii] = posvalues[firstrow + j][firstcol + i][ii];
}
}
}
return square;
}
void Printboard() { // Displays the board for the user
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
System.out.print(board[i][j] + "\t");
}
System.out.println("\n");
}
System.out.println("\n");
}
void Printvalue(int i, int j) { // Displays value in cell
System.out.print(board[i][j]);
System.out.println("\n");
}
void Printposvalues(int row, int col) { //Displays the options for the cell
for (int k = 0; k < 9; k++) {
System.out.print(posvalues[row][col][k] + "\t");
}
System.out.println("\n");
}
public boolean Elimination(int row, int col) { // Looks for only one possible option in the cell if found writes to the board and updates possible values
int j = 0;
for (int i = 0; i < 9; i++) {
if (Sudoku.posvalues[row][col][i])
j++;
}
if (j == 1) {
int ii = 0;
while (!Sudoku.posvalues[row][col][ii]) {
ii++;
}
setvalue(row, col, ii + 1);
return true;
}
return false;
}
boolean loneRanger(int row, int col) { // Looks for a number that only appears once in the possible option array. If so then it writes that value and updates possible values
boolean found;
for (int x = 0; x < 9; x++) {
found = false;
if (posvalues[row][col][x]) {
int rowstart = row / 3;
int colstart = col / 3;
for (int i = 0; i < 9; i++) {
if (posvalues[row][i][x] && i != col)
found = true;
if (posvalues[i][col][x] && i != row)
found = true;
if (posvalues[rowstart + i / 3][colstart + i % 3][x] && (rowstart + i / 3) != row
&& (colstart + i % 3) != col)
found = true;
}
if (!found) {
setvalue(row, col, x + 1);
return true;
}
}
}
return false;
}
boolean FindTwins(int index, int type) { // item can be row column or square array (defined by index and type) from the possible values variable. If finds twin numbers that only appear in two indexes and they are the same two, eliminates all other options in those cells
int counttwin1 = 0;
boolean[][] item = new boolean[9][9];
if (type == 0) { // type 0=row type 1=column type2=square
item = posvalues[index];
}
if (type == 1) {
for (int j = 0; j < 9; j++) {
item[j] = posvalues[j][index];
}
}
if (type == 2) {
item = getSquareposvalues(index);
}
int[] indextwin1 = new int[2];
for (int twin1 = 0; twin1 < 9; twin1++) {
for (int j = 0; j < 9; j++) {
if (item[j][twin1] == true) {
counttwin1++;
if (counttwin1 <= 2) {
indextwin1[counttwin1 - 1] = j;
} else {
counttwin1 = 0;
break;
}
}
}
if (counttwin1 == 2) {
boolean istwin = false;
for (int twin2 = 0; twin2 < 9; twin2++) {
if (twin2 != twin1) {
if (item[indextwin1[0]][twin2] == true) {
if (item[indextwin1[1]][twin2] == true) {
istwin = true;
for (int j = 0; j < 9; j++) {
if (j != indextwin1[0] && j != indextwin1[1] && item[j][twin2]) {
istwin = false;
break;
}
}
}
}
}
if (istwin) { // update the possible values cell based on which type it is
if (type == 0) {
for (int k = 0; k < 9; k++) {
if (k != twin1 && k != twin2) {
posvalues[index][indextwin1[0]][k] = false;
posvalues[index][indextwin1[1]][k] = false;
}
}
}
if (type == 1) {
for (int k = 0; k < 9; k++) {
if (k != twin1 && k != twin2) {
posvalues[indextwin1[0]][index][k] = false;
posvalues[indextwin1[1]][index][k] = false;
}
}
}
if (type == 2) {
for (int k = 0; k < 9; k++) {
if (k != twin1 && k != twin2) {
posvalues[(index / 3) * 3 + indextwin1[0] / 3][(index * 3) % 9
+ (indextwin1[0] % 3)][k] = false;
posvalues[(index / 3) * 3 + indextwin1[1] / 3][(index * 3) % 9
+ (indextwin1[1] % 3)][k] = false;
}
}
}
return true;
}
}
return false;
}
}
return false;
}
public static void main(String[] args) {
Sudoku a = new Sudoku();
int[][] puzzle1 = { { 0, 2, 9, 0, 0, 0, 3, 1, 0 },
{ 0, 8, 0, 0, 0, 0, 4, 0, 9 },
{ 3, 0, 6, 0, 2, 0, 0, 0, 0 },
{ 0, 6, 0, 0, 3, 1, 7, 0, 0 },
{ 0, 0, 0, 0, 5, 8, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 3, 7, 0, 0, 6, 0, 8, 0 },
{ 0, 0, 1, 0, 0, 0, 5, 0, 0 },
{ 0, 9, 0, 0, 8, 0, 0, 3, 7 } };
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
a.setvalue(i, j, puzzle1[i][j]);
}
}
a.Printboard();
/*
* boolean changedElim = true; boolean changedRanger=true;
* while(changedElim||changedRanger) { changedElim=false;
* changedRanger=false; for(int i=0;i<9;i++){ for(int j=0;j<9;j++){
* if(a.Elimination(i, j)) changedElim = true; if(a.loneRanger(i, j))
* changedRanger=true; } } }
*/
}
}
|
package questions.RotateImage_0048;
/*
* https://leetcode-cn.com/problems/rotate-image/
* */
public class Solution {
// 先转置在翻转
public static void rotate(int[][] matrix) {
int L = matrix.length;
for (int i = 0; i < L/2; i++) {
int start = i;
int end = L - i - 1;
for (int j = 0; j < end - start; j++) {
int temp = matrix[start][start + j];
matrix[start][start + j] = matrix[end - j][start];
matrix[end - j][start] = matrix[end][end - j];
matrix[end][end - j] = matrix[start + j][end];
matrix[start + j][end] = temp;
}
}
}
public static void main(String[] args) {
int[][] m = {{1,2,3},{4,5,6},{7,8,9}};
rotate(m);
for (int i = 0; i < m.length; i++) {
for (int j = 0; j < m.length; j++) {
System.out.print(m[i][j]);
}
}
}
}
|
package com.saptakdas.misc.MatrixCalculator;
import com.saptakdas.util.Menu;
public class MatrixProgram {
public static void main(String[] args) throws MatrixError {
//Ask whether to access calculator or solver
int choice= Menu.choice("---Matrix Program---\n1: Matrix Calculator\n2: Matrix Solver", 2);
if(choice==1){
MatrixCalculator calculator=new MatrixCalculator();
}else{
MatrixSolver solver=new MatrixSolver();
}
}
}
|
package com.cg.mvc.a2;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class SimpleInterestController {
@RequestMapping(value = "/index.html", method = RequestMethod.GET)
public ModelAndView getAdmissionForm() {
ModelAndView model = new ModelAndView("simpleInterest");
return model;
}
@RequestMapping(value = "/submitButton.html", method = RequestMethod.POST)
public ModelAndView submitAdmissionForm(@RequestParam("pAmount") double amount,
@RequestParam("nYears") double years, @RequestParam("rInterest") double interest) {
ModelAndView model = new ModelAndView("simpleInterest");
model.addObject("msg", "Simple Interest is : " + amount * years * interest / 100);
return model;
}
}
|
package org.vow.actos.domain.activity;
import com.google.schemaorg.JsonLdSerializer;
import com.google.schemaorg.JsonLdSyntaxException;
import com.google.schemaorg.core.*;
import org.junit.Test;
public class SpikteTest {
@Test
public void name() throws JsonLdSyntaxException {
JsonLdSerializer serializer = new JsonLdSerializer(true /* setPrettyPrinting */);
Thing aThing = CoreFactory.newThingBuilder().build();
AboutPage aboutPage = CoreFactory.newAboutPageBuilder()
.addMainEntity(aThing)
.build();
System.out.println(serializer.serialize(aboutPage));
}
@Test
public void product() throws JsonLdSyntaxException {
JsonLdSerializer serializer = new JsonLdSerializer(true /* setPrettyPrinting */);
Brand brand = CoreFactory.newBrandBuilder()
.addName("Nestlé")
.build();
Product product = CoreFactory.newProductBuilder()
.addBrand(brand)
.build();
System.out.println(serializer.serialize(product));
}
} |
package com.nuuedscore.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.nuuedscore.domain.LearningPersonality;
/**
* LearningPersonality Repository
*
* @author PATavares
* @since Feb 2021
*
*/
public interface LearningPersonalityRepository extends JpaRepository<LearningPersonality, Long> {
LearningPersonality findByName(String name);
} |
package rnmkrs.springframework.sambrewery.services;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import rnmkrs.springframework.sambrewery.web.model.CustomerDto;
import java.util.UUID;
@Slf4j
@Service
public class CustomerServiceImpl implements CustomerService {
@Override
public CustomerDto getCustomerById(UUID customerId) {
return CustomerDto.builder()
.customerId(UUID.randomUUID())
.name("Shahid")
.build();
}
@Override
public CustomerDto saveCustomer(CustomerDto customerDto) {
return CustomerDto.builder()
.customerId(UUID.randomUUID())
.build();
}
@Override
public void updateCustomerById(UUID customerId, CustomerDto customerDto) {
log.debug("Customer Updating....");
}
@Override
public void deleteCustomerById(UUID customerId) {
log.debug("Deleting Customer...");
}
}
|
public class Transactions implements Constants {
public float price, profit;
public int qty, numberOfTransactions, TransactionID;
public String companyName, InvestorName;
public boolean isSelling;
public int companyNumber;
public Transactions()
{
InvestorName = "";
companyName = "";
price = 0;
qty = 0;
companyNumber = 0;
isSelling = true;
InvestorName = "";
profit = 0;
}
public Transactions(String invName, String compName, float pr, int quant, boolean type, int compNum, float prof)
{
InvestorName = invName;
companyName = compName;
price = pr;
qty = quant;
companyNumber = compNum;
isSelling = type;
profit = prof;
}
public String getCompanyName(){
return companyName;
}
public float getPrice(){
return price;
}
public boolean getIsSelling(){
return isSelling;
}
public void setCompanyName(String name){
companyName = name;
}
public int getQty() {
return qty;
}
public void setQty(int qty) {
this.qty = qty;
}
public void setIsSelling(boolean type){
isSelling = type;
}
public void setTransactionID(int num){
TransactionID = num;
}
public void setNumberOfTransactions(int num){
numberOfTransactions = num;
}
public float getProfit() {
return profit;
}
public void setProfit(float profit) {
this.profit = profit;
}
public String getInvestorName() {
return InvestorName;
}
public void setInvestorName(String investorName) {
InvestorName = investorName;
}
public void setPrice(float price) {
this.price = price;
}
}
|
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.Label;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class PracticeTest extends JFrame{
public PracticeTest() throws Exception {
try {
DataAccess da = new DataAccess();
UiBuilder ui = new UiBuilder(da);
this.add(ui);
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
public static void main(String[] args) throws Exception{
PracticeTest frame = new PracticeTest();
frame.setSize(300, 400);
frame.pack();
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
class UiBuilder extends JPanel implements ActionListener {
private JButton btnQuery;
private JTextField tfName, tflName, tfId;
private DataAccess da;
UiBuilder(DataAccess da) {
this.da = da;
JPanel panel = new JPanel();
JPanel panel2 = new JPanel();
setLayout(new GridLayout(2, 2)); // frame
setSize(400, 400);
btnQuery = new JButton("Query");
tfName = new JTextField(20);
tflName = new JTextField(20);
tfId = new JTextField(5);
panel.setLayout(new GridLayout(3,3));
panel.add(new Label("First Name: "));
panel.add(tfName);
panel.add(new Label("Last Name: "));
panel.add(tflName);
panel.add(new Label("Id: "));
panel.add(tfId);
panel2.setLayout(new FlowLayout());
panel2.add(btnQuery);
btnQuery.addActionListener(this);
//this.setLayout(new BorderLayout());
add(panel);
add(panel2);
}
public void actionPerformed(ActionEvent ev) {
if (ev.getSource() == btnQuery) {
String id = tfId.getText();
if (id != null) {
try {
Student st = da.findStudent(id);
tfName.setText(st.getFirstName());
tflName.setText(st.getLastName());
tfId.setText(st.getId());
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
class Student {
private String firstName;
private String lastName;
private String sid;
Student(String fname, String lname, String id) throws Exception{
this.firstName=fname.trim();
this.lastName=lname.trim();
this.sid=id.trim();
Integer.parseInt(id); //this will throw exception if the id is not an integer number
}
String getId(){
return sid;
}
String getFirstName(){
return this.firstName;
}
String getLastName(){
return this.lastName;
}
}
class DataAccess {
private Statement statement;
private Connection conn;
private ResultSet resultset;
DataAccess() throws Exception{
Class.forName("oracle.jdbc.OracleDriver"); //load class
//for uid, pass, put your uid and pass
conn = DriverManager.getConnection("jdbc:oracle:thin:@oracle1.centennialcollege.ca:1521:SQLD",
"COMP228_F19_K_1", "password");
statement = conn.createStatement();
System.out.println("Connected to JDBC");
}
Student findStudent(String id) throws Exception{
String query = String.format("SELECT * FROM student WHERE sid=%s",id);
Student st = null;
resultset = statement.executeQuery(query);
if (resultset != null)
{
if (resultset.next())
{
String fname = resultset.getString(2); //using index
String lname = resultset.getString("last_name"); //using column name
st = new Student(fname, lname, id);
}
resultset.close();
return st;
}
else
{
throw new Exception("Cannot find record.");
}
}
void updateStudent(Student st) throws Exception {
String str = String.format("UPDATE student SET student.first_name= '%s', student.last_name= '%s' WHERE student.sid=%s",
st.getFirstName(),st.getLastName(),st.getId());
statement.executeUpdate(str);
}
void addStudent(Student st) throws Exception {
String str = String.format("INSERT into student values ('%s', '%s', '%s')",
st.getId(), st.getFirstName(),st.getLastName());
statement.executeUpdate(str);
}
void disonnect() throws Exception{
statement.close();
conn.close();
}
}
|
package net.julisapp.riesenkrabbe;
import android.app.Application;
import com.jakewharton.threetenabp.AndroidThreeTen;
/**
* Created by antonio on 30.03.17.
*/
public class RiesenkrabbeApp extends Application {
@Override
public void onCreate() {
super.onCreate();
AndroidThreeTen.init(this);
}
}
|
package fr.doranco.ecommerce.entity.dto;
public class CommentaireDto {
private String id;
private String texte;
private String note ;
private String article;
private String utilisateur;
public CommentaireDto() {
super();
// TODO Auto-generated constructor stub
}
public CommentaireDto(String id, String texte, String note, String article, String utilisateur) {
super();
this.id = id;
this.texte = texte;
this.note = note;
this.article = article;
this.utilisateur = utilisateur;
}
public CommentaireDto(String texte, String note, String article, String utilisateur) {
super();
this.texte = texte;
this.note = note;
this.article = article;
this.utilisateur = utilisateur;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTexte() {
return texte;
}
public void setTexte(String texte) {
this.texte = texte;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public String getArticle() {
return article;
}
public void setArticle(String article) {
this.article = article;
}
public String getUtilisateur() {
return utilisateur;
}
public void setUtilisateur(String utilisateur) {
this.utilisateur = utilisateur;
}
}
|
package alketon.kadastr.repos;
/*
import alketon.kadastr.models.Service;
import org.springframework.data.jpa.repository.JpaRepository;
public interface ServiceRepo extends JpaRepository<Service, Long> {
}*/
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package controller.user;
import entity.Banners;
import entity.Brands;
import entity.Catagories;
import entity.CatagoryDetail;
import entity.ProductComments;
import entity.ProductDetail;
import entity.ProductImages;
import entity.Products;
import entity.SearchDetail;
import entity.Sizes;
import entity.Sliders;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import model.user.UserBannersModel;
import model.user.UserBrandsModel;
import model.user.UserCatagoriesModel;
import model.user.UserProductCommentsModel;
import model.user.UserProductImageModel;
import model.user.UserProductModel;
import model.user.UserSalesModel;
import model.user.UserSizeModel;
import model.user.UserSlidersModel;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
/**
*
* @author MinhQuan
*/
@Controller
@RequestMapping(value = "/userIndexController")
public class UserIndexController extends ImageAdjust {
private UserAllController allController;
private UserCatagoriesModel catagoriesModel;
private UserSlidersModel slidersModel;
private UserBannersModel bannersModel;
private UserProductModel productModel;
private UserProductImageModel productImageModel;
private UserSalesModel saleModel;
private UserBrandsModel brandModel;
private UserProductCommentsModel productCommentsModel;
private UserSizeModel sizeModel;
public UserIndexController() {
allController = new UserAllController();
catagoriesModel = new UserCatagoriesModel();
slidersModel = new UserSlidersModel();
bannersModel = new UserBannersModel();
productModel = new UserProductModel();
productImageModel = new UserProductImageModel();
saleModel = new UserSalesModel();
brandModel = new UserBrandsModel();
productCommentsModel = new UserProductCommentsModel();
sizeModel = new UserSizeModel();
}
@RequestMapping(value = "/index")
public ModelAndView toIndex(HttpServletRequest request, HttpSession session){
ModelAndView mav = new ModelAndView("user/jsp/index");
//Tim danh sach catagory va tach catagory lon va nho
mav = allController.getHeaderAndFooter(mav,session);
//Tim danh sach slider
List<Sliders> listSliders = slidersModel.getAllSliders();
//Tim danh sach banner nho
List<Banners> listSmallBanners = bannersModel.getSmallBanners();
//Tim danh sach banner lon- gan vao upperBanner va lowerBanner
List<Banners> listBigBanners = bannersModel.getBigBanners();
Banners upperBanner = null;
Banners lowerBanner = null;
if (listBigBanners.size() == 1) {
upperBanner = listBigBanners.get(0);
} else if (listBigBanners.size() == 2) {
upperBanner = listBigBanners.get(0);
lowerBanner = listBigBanners.get(1);
}
//tim danh sach san pham New Arrival
List<ProductDetail> listNewArrival = getListSuggestProduct("new arrival");
//tim danh sach san pham Sale Product
List<ProductDetail> listSaleProduct = getListSuggestProduct("sale product");
//tim danh sach san pham Bestseliing
List<ProductDetail> listBestselling = getListSuggestProduct("bestselling");
//lay danh sach brand goi y
List<Brands> listBrands = brandModel.getThreeSuggestBrand();
String firstBrand = "";
String secondBrand = "";
String thirdBrand = "";
//gan gia tri cho cac brand goi y
if (listBrands.size() == 1) {
firstBrand = listBrands.get(0).getBrandName();
} else if (listBrands.size() == 2) {
firstBrand = listBrands.get(0).getBrandName();
secondBrand = listBrands.get(1).getBrandName();
} else if (listBrands.size() == 3) {
firstBrand = listBrands.get(0).getBrandName();
secondBrand = listBrands.get(1).getBrandName();
thirdBrand = listBrands.get(2).getBrandName();
}
//tao danh sach san pham tung brand
List<ProductDetail> listProductFirstBrand = null;
List<ProductDetail> listProductSecondBrand = null;
List<ProductDetail> listProductThirdBrand = null;
int countBrand = 1;
//gan danh sach san pham cho tung brand
for (Brands brand : listBrands) {
if (countBrand == 1) {
listProductFirstBrand = allController.getListProductDetailByListProduct(productModel.getBrandProducts(brand.getBrandId()));
} else if (countBrand == 2) {
listProductSecondBrand = allController.getListProductDetailByListProduct(productModel.getBrandProducts(brand.getBrandId()));
} else {
listProductThirdBrand = allController.getListProductDetailByListProduct(productModel.getBrandProducts(brand.getBrandId()));
}
countBrand++;
}
//lay danh sach brand
List<Brands> listBrandsShowLogo = brandModel.getBrandShowLogo();
//gui cac thong tin ra trang index
mav.addObject("listSliders", listSliders);
mav.addObject("listSmallBanners", listSmallBanners);
mav.addObject("upperBanner", upperBanner);
mav.addObject("lowerBanner", lowerBanner);
mav.addObject("listNewArrival", listNewArrival);
mav.addObject("listSaleProduct", listSaleProduct);
mav.addObject("listBestselling", listBestselling);
mav.addObject("firstBrand", firstBrand);
mav.addObject("secondBrand", secondBrand);
mav.addObject("thirdBrand", thirdBrand);
mav.addObject("listProductFirstBrand", listProductFirstBrand);
mav.addObject("listProductSecondBrand", listProductSecondBrand);
mav.addObject("listProductThirdBrand", listProductThirdBrand);
mav.addObject("listBrandsShowLogo", listBrandsShowLogo);
return mav;
}
public List<ProductDetail> getListSuggestProduct(String type) {
List<Products> rawListProduct = productModel.getSuggestProducts(type);
List<ProductDetail> listProduct = new ArrayList<>();
for (Products product : rawListProduct) {
ProductDetail suggestProduct = new ProductDetail();
//lay thong tin san pham
suggestProduct.setProduct(product);
//lay gia sau sale cua san pham
int saleId = 0;
//kiem tra saleId co ton tai khong va gan gia tri
if (product.getSales() != null) {
saleId = product.getSales().getSaleId();
}
//tinh gia sau khi giam
int salePercentage = saleModel.getPercentageBySellId(saleId);
float salePrice = (float) product.getPrice() - ((float) product.getPrice() * salePercentage / 100);
BigDecimal roundSalePrice = new BigDecimal(Float.toString(salePrice));
salePrice = roundSalePrice.setScale(2,BigDecimal.ROUND_HALF_UP).floatValue();
suggestProduct.setSalePrice(salePrice);
//lay 1 hinh anh cua san pham
ProductImages productImage = productImageModel.getOneProductImageByProductId(product.getProductId());
suggestProduct.setImage(productImage);
//lay danh sach size hien co
List<Sizes> productSize = sizeModel.getSizeByProductId(product.getProductId());
if(productSize==null){
suggestProduct.setAvailable(false);
}else{
suggestProduct.setAvailable(false);
for (Sizes size : productSize) {
if(size.getStock()>0){
suggestProduct.setAvailable(true);
break;
}
}
}
suggestProduct.setListSize(productSize);
//them vao listProduct
listProduct.add(suggestProduct);
}
return listProduct;
}
}
|
@Capsule(exportKeyword = OrderAPI.class, friends = { "assemAssist.model.factoryline.assemblyLine",
"assemAssist.model.scheduler", "assemAssist.model.order.singleTaskOrder",
"assemAssist.model.order.vehicleOrder", "assemAssist" })
package assemAssist.model.order.order;
import capsules.Capsule;
|
package ru.android.messenger.view.activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.view.View;
import ru.android.messenger.R;
import ru.android.messenger.view.adapters.FriendsFragmentPagerAdapter;
@SuppressWarnings("squid:MaximumInheritanceDepth")
public class FriendListActivity extends ActivityWithNavigationDrawer {
private ViewPager viewPager;
private TabLayout tabLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.init(R.layout.activity_friend_list);
findViews();
createFragmentPagerAdapter();
}
@Override
protected void onRestart() {
super.onRestart();
createFragmentPagerAdapter();
}
@Override
protected void configureToolbar() {
//unused method
}
public void actionButtonAddFriendClick(View view) {
Intent intent = new Intent(this, UsersSearchActivity.class);
startActivity(intent);
}
private void findViews() {
viewPager = findViewById(R.id.view_pager);
tabLayout = findViewById(R.id.tabs);
}
private void createFragmentPagerAdapter() {
FriendsFragmentPagerAdapter adapter =
new FriendsFragmentPagerAdapter(getSupportFragmentManager(), this);
if (viewPager.getAdapter() != null) {
int currentItem = viewPager.getCurrentItem();
viewPager.setAdapter(adapter);
tabLayout.setupWithViewPager(viewPager);
viewPager.setCurrentItem(currentItem);
} else {
viewPager.setAdapter(adapter);
tabLayout.setupWithViewPager(viewPager);
}
}
}
|
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.test.lib.dcmd;
import jdk.test.lib.JDKToolFinder;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import java.util.List;
/**
* Base class for Diagnostic Command Executors using the jcmd tool
*/
public abstract class JcmdExecutor extends CommandExecutor {
protected String jcmdBinary;
protected abstract List<String> createCommandLine(String cmd) throws CommandExecutorException;
protected JcmdExecutor() {
jcmdBinary = JDKToolFinder.getJDKTool("jcmd");
}
protected OutputAnalyzer executeImpl(String cmd) throws CommandExecutorException {
List<String> commandLine = createCommandLine(cmd);
try {
System.out.printf("Executing command '%s'%n", commandLine);
OutputAnalyzer output = ProcessTools.executeProcess(new ProcessBuilder(commandLine));
System.out.printf("Command returned with exit code %d%n", output.getExitValue());
return output;
} catch (Exception e) {
String message = String.format("Caught exception while executing '%s'", commandLine);
throw new CommandExecutorException(message, e);
}
}
}
|
import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.select.Elements;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.net.HttpURLConnection;
import java.net.URL;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.DOMException;
import org.xml.sax.InputSource;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Amin
*/
public class Data {
public Currency getCryptoCurrency(String name) throws IOException {
Currency currency;
if (name.equals("dollar") || name.equals("euro")) {
currency = getCurrency(name);
} else {
String url = "https://coinmarketcap.com/";
org.jsoup.nodes.Document doc = Jsoup.connect(url).get();
org.jsoup.nodes.Element content = doc.getElementById("id-" + name);
Elements links = content.getElementsByTag("td");
currency = new Currency(
name,
links.get(3).getElementsByTag("a").text(),
links.get(6).text(),
links.get(7).getElementsByTag("img").attr("abs:src"));
}
return currency;
}
public Currency getCurrency(String name) {
Currency currency = null;
try {
String url = "http://parsijoo.ir/api?serviceType=price-API&query=Currency";
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
int responseCode = con.getResponseCode();
System.out.println("Get Request Response Code: " + responseCode);
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder()
.parse(new InputSource(new StringReader(response.toString())));
NodeList nList = doc.getElementsByTagName("item");
Element eElement = null;
if (name.equals("dollar")) {
eElement = (Element) nList.item(0);
} else if (name.equals("euro")) {
eElement = (Element) nList.item(1);
}
String percent = new String(eElement.getElementsByTagName("percent").item(0).getTextContent().getBytes(), "UTF-8");
String change = new String(eElement.getElementsByTagName("change").item(0).getTextContent().getBytes(), "UTF-8");
String price = new String(eElement.getElementsByTagName("price").item(0).getTextContent().getBytes(), "UTF-8");
currency = new Currency(name, price, change + percent.replace('.', '/') + "%");
} catch (IOException | ParserConfigurationException | DOMException | SAXException e) {
System.out.println(e);
}
return currency;
}
}
|
// Sun Certified Java Programmer
// Chapter 1, P43
// Declarations and Access Control
public class Mini extends Car {
public void goUpHill() {
// Mini-specific going uphill code
}
}
|
package com.utknl.katas;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* https://www.codewars.com/kata/550554fd08b86f84fe000a58/train/java
* <p>
* Given two arrays of strings a1 and a2 return a sorted array r in lexicographical order of the strings of a1 which
* are substrings of strings of a2.
* <p>
* #Example 1: a1 = ["arp", "live", "strong"]
* <p>
* a2 = ["lively", "alive", "harp", "sharp", "armstrong"]
* <p>
* returns ["arp", "live", "strong"]
* <p>
* #Example 2: a1 = ["tarp", "mice", "bull"]
* <p>
* a2 = ["lively", "alive", "harp", "sharp", "armstrong"]
* <p>
* returns []
*/
public class WhichAreIn {
public static void main(String[] args) {
String[] array1 = new String[]{"arp", "live", "strong"};
String[] array2 = new String[]{"lively", "alive", "harp", "sharp", "armstrong"};
System.out.println(Arrays.toString(inArray(array1, array2)));
}
public static String[] inArray(String[] array1, String[] array2) {
// return Arrays.stream(array1)
// .filter(s -> Arrays.stream(array2).anyMatch(word -> word.contains(s)))
// .distinct()
// .sorted()
// .toArray(String[]::new);
List<String> results = new ArrayList<>();
for (String s : array1) {
for (String word : array2) {
if (word.contains(s)) {
results.add(s);
break;
}
}
}
Collections.sort(results);
return results.toArray(new String[0]);
}
}
|
package graphs;
public class CreateAdjacencyMatrix {
public static void main(String[] args) {
CreateAdjacencyMatrix adjacencyMatrix = new CreateAdjacencyMatrix();
int[][] createdAdjacencyMatrix = adjacencyMatrix.createAdjacencyMatrix(new int[][] {{1,0}, {2,0}, {3,1}, {3,2}}, 4);
for (int[] is : createdAdjacencyMatrix) {
for (int i : is) {
System.out.print(i + "\t");
}
System.out.println();
}
}
public int[][] createAdjacencyMatrix (int[][] edgeList, int n) {
int[][] adjacencyMatrix = new int[n][n];
final int SRC = 0;
final int DEST = 1;
for (int[] edge : edgeList)
adjacencyMatrix[edge[SRC]][edge[DEST]] = 1;
return adjacencyMatrix;
}
} |
public class BankAccount{
private String cbu;
private float balance;
public BankAccount(String cbu, float balance){
this.cbu = cbu;
this.balance = balance;
}
public void deposit(float amount){
if(amount > 0){
setBalance(getBalance() + amount);
} else {
System.out.println("Invalid amount, your balance is : " + balance);
}
}
public void withdraw(float amount){
if(amount > 0 && amount <= balance){
setBalance(getBalance() - amount);
} else {
System.out.println("Invalid amount, your balance is : " + balance);
}
}
public float getBalance(){
return balance;
}
public void setBalance(float balance){
this.balance = balance;
}
public String getCbu(){
return cbu;
}
public void setCbu(String cbu){
this.cbu = cbu;
}
} |
package com.tencent.mm.plugin.sns.ui;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import com.tencent.mm.a.g;
import com.tencent.mm.compatible.util.Exif;
import com.tencent.mm.modelsfs.FileOp;
import com.tencent.mm.modelsns.b;
import com.tencent.mm.opensdk.modelmsg.SendMessageToWX.Req;
import com.tencent.mm.opensdk.modelmsg.WXImageObject;
import com.tencent.mm.opensdk.modelmsg.WXMediaMessage;
import com.tencent.mm.plugin.mmsight.SightCaptureResult;
import com.tencent.mm.plugin.sns.i.j;
import com.tencent.mm.plugin.sns.model.af;
import com.tencent.mm.plugin.sns.model.ax;
import com.tencent.mm.plugin.sns.model.h;
import com.tencent.mm.plugin.sns.storage.s;
import com.tencent.mm.plugin.sns.ui.previewimageview.DynamicGridView;
import com.tencent.mm.plugin.sns.ui.previewimageview.e;
import com.tencent.mm.pluginsdk.ui.tools.l;
import com.tencent.mm.pointers.PInt;
import com.tencent.mm.protocal.c.arj;
import com.tencent.mm.protocal.c.boj;
import com.tencent.mm.protocal.c.bpo;
import com.tencent.mm.protocal.c.bqg;
import com.tencent.mm.sdk.platformtools.ag;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.mm.ui.MMActivity;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.b.d.i;
public final class ah extends a {
private String appId;
private String appName;
MMActivity bGc;
private String fmS;
private int nMA;
private b nMG = null;
private boolean nNY = false;
private boolean nNZ = false;
private boolean nOU = false;
private WXMediaMessage nOa = null;
b nPY = new b(this);
w nPZ;
Map<String, com.tencent.mm.compatible.util.Exif.a> nQa = new HashMap();
private Map<String, bpo> nQb = new HashMap();
private int nQc = 0;
private boolean nQd = false;
arj nQe;
class a extends h<String, Integer, Boolean> {
private ProgressDialog eHw = null;
private ax nOW;
private List<com.tencent.mm.plugin.sns.data.h> nQg;
public final /* synthetic */ Object bxI() {
long currentTimeMillis = System.currentTimeMillis();
ax axVar = this.nOW;
axVar.cj(this.nQg);
this.nOW = axVar;
x.d("MicroMsg.MMAsyncTask", "commit imp time " + (System.currentTimeMillis() - currentTimeMillis));
return Boolean.valueOf(true);
}
public final /* synthetic */ void onPostExecute(Object obj) {
super.onPostExecute((Boolean) obj);
this.eHw.dismiss();
ah.this.a(this.nOW);
}
public a(ax axVar, List<com.tencent.mm.plugin.sns.data.h> list) {
this.nOW = axVar;
this.nQg = list;
MMActivity mMActivity = ah.this.bGc;
ah.this.bGc.getString(j.app_tip);
this.eHw = com.tencent.mm.ui.base.h.a(mMActivity, ah.this.bGc.getString(j.app_loading_data), false, new 1(this, ah.this));
}
public final ag bxH() {
return af.byb();
}
}
public ah(MMActivity mMActivity) {
this.bGc = mMActivity;
}
public final void G(Bundle bundle) {
String str;
int i = 1;
this.nMG = b.p(this.bGc.getIntent());
this.nOU = this.bGc.getIntent().getBooleanExtra("Kis_take_photo", false);
this.appId = bi.aG(this.bGc.getIntent().getStringExtra("Ksnsupload_appid"), "");
this.appName = bi.aG(this.bGc.getIntent().getStringExtra("Ksnsupload_appname"), "");
this.nNY = this.bGc.getIntent().getBooleanExtra("KThrid_app", false);
this.nQd = this.bGc.getIntent().getBooleanExtra("KBlockAdd", false);
this.nNZ = this.bGc.getIntent().getBooleanExtra("KSnsAction", false);
this.nMA = this.bGc.getIntent().getIntExtra("Ksnsupload_source", 0);
this.fmS = bi.aG(this.bGc.getIntent().getStringExtra("reportSessionId"), "");
Bundle bundleExtra = this.bGc.getIntent().getBundleExtra("Ksnsupload_timeline");
if (bundleExtra != null) {
this.nOa = new Req(bundleExtra).message;
}
String stringExtra = this.bGc.getIntent().getStringExtra("sns_kemdia_path");
byte[] byteArrayExtra = this.bGc.getIntent().getByteArrayExtra("Ksnsupload_imgbuf");
if (byteArrayExtra == null && this.nOa != null && this.nOa.mediaObject != null && (this.nOa.mediaObject instanceof WXImageObject)) {
byteArrayExtra = ((WXImageObject) this.nOa.mediaObject).imageData;
}
if (!bi.oW(stringExtra) || bi.bC(byteArrayExtra)) {
str = stringExtra;
} else {
stringExtra = af.getAccSnsTmpPath() + g.u((" " + System.currentTimeMillis()).getBytes());
FileOp.deleteFile(stringExtra);
FileOp.b(stringExtra, byteArrayExtra, byteArrayExtra.length);
str = stringExtra;
}
int intExtra = this.bGc.getIntent().getIntExtra("KFilterId", 0);
if (bundle == null) {
stringExtra = null;
} else {
stringExtra = bundle.getString("sns_kemdia_path_list");
}
I(bundle);
boolean I = I(this.bGc.getIntent().getExtras());
this.nQc = 0;
com.tencent.mm.compatible.util.Exif.a location;
if (!bi.oW(stringExtra)) {
this.nPY.NU(stringExtra);
} else if (bi.oW(str)) {
ArrayList stringArrayListExtra = this.bGc.getIntent().getStringArrayListExtra("sns_kemdia_path_list");
if (stringArrayListExtra != null && stringArrayListExtra.size() > 0) {
Iterator it = stringArrayListExtra.iterator();
while (it.hasNext()) {
str = (String) it.next();
x.d("MicroMsg.PicWidget", "newPath " + str);
this.nPY.l(str, intExtra, false);
if (!I) {
location = Exif.fromFile(str).getLocation();
if (location != null) {
this.nQa.put(str, location);
}
}
try {
File file = new File(str);
bpo bpo = new bpo();
bpo.snJ = this.nOU ? 1 : 2;
bpo.snL = file.lastModified() / 1000;
bpo.snK = Exif.fromFile(str).getUxtimeDatatimeOriginal();
this.nQb.put(str, bpo);
} catch (Exception e) {
x.e("MicroMsg.PicWidget", "get report info error " + e.getMessage());
}
}
}
} else {
int i2;
String str2 = af.getAccSnsTmpPath() + "pre_temp_sns_pic" + g.u(str.getBytes());
File file2 = new File(str2);
if (!file2.getParentFile().exists()) {
file2.getParentFile().mkdirs();
}
FileOp.y(str, str2);
if (intExtra == -1) {
i2 = 0;
} else {
i2 = intExtra;
}
this.nPY.l(str2, i2, this.nOU);
if (!I) {
location = Exif.fromFile(str).getLocation();
if (location != null) {
this.nQa.put(str2, location);
}
}
try {
file2 = new File(str);
bpo bpo2 = new bpo();
if (!this.nOU) {
i = 2;
}
bpo2.snJ = i;
bpo2.snL = file2.lastModified() / 1000;
bpo2.snK = Exif.fromFile(str).getUxtimeDatatimeOriginal();
this.nQb.put(str2, bpo2);
} catch (Exception e2) {
x.e("MicroMsg.PicWidget", "get report info error " + e2.getMessage());
}
}
}
private boolean I(Bundle bundle) {
if (bundle == null) {
return false;
}
ArrayList stringArrayList = bundle.getStringArrayList("sns_media_latlong_list");
if (stringArrayList == null) {
return false;
}
Iterator it = stringArrayList.iterator();
while (it.hasNext()) {
String[] split = ((String) it.next()).split("\n");
if (3 != split.length) {
x.e("MicroMsg.PicWidget", "invalid params");
return true;
}
try {
this.nQa.put(split[0].trim(), new com.tencent.mm.compatible.util.Exif.a(bi.getDouble(split[1], 0.0d), bi.getDouble(split[2], 0.0d), 0.0d));
} catch (NumberFormatException e) {
x.e("MicroMsg.PicWidget", e.toString());
}
}
return true;
}
public final void H(Bundle bundle) {
bundle.putString("sns_kemdia_path_list", this.nPY.toString());
ArrayList arrayList = new ArrayList();
for (Entry entry : this.nQa.entrySet()) {
arrayList.add(String.format("%s\n%f\n%f", new Object[]{entry.getKey(), Double.valueOf(((com.tencent.mm.compatible.util.Exif.a) entry.getValue()).latitude), Double.valueOf(((com.tencent.mm.compatible.util.Exif.a) entry.getValue()).longitude)}));
}
bundle.putStringArrayList("sns_media_latlong_list", arrayList);
bundle.getString("contentdesc");
}
public final boolean bBU() {
if (this.nPY != null) {
b bVar = this.nPY;
boolean z = bVar.nQj != null && bVar.nQj.size() > 0;
if (z) {
return true;
}
}
return false;
}
public final View a(View view, View view2, DynamicGridView dynamicGridView, View view3) {
boolean z;
MMActivity mMActivity = this.bGc;
List list = this.nPY.nQj;
AnonymousClass1 anonymousClass1 = new com.tencent.mm.plugin.sns.ui.w.a() {
public final void xh(int i) {
x.d("MicroMsg.PicWidget", "I click");
if (i < 0) {
ah.this.bCA();
return;
}
Intent intent = new Intent();
intent.setClass(ah.this.bGc, SnsUploadBrowseUI.class);
intent.putExtra("sns_gallery_position", i);
intent.putExtra("sns_gallery_temp_paths", ah.this.nPY.nQj);
ah.this.bGc.startActivityForResult(intent, 7);
}
};
AnonymousClass2 anonymousClass2 = new com.tencent.mm.plugin.sns.ui.previewimageview.c.a() {
public final void dC(int i, int i2) {
b bVar = ah.this.nPY;
if (i != i2 && bVar.nQj.size() > i) {
String str = (String) bVar.nQj.remove(i);
if (i2 < bVar.nQj.size()) {
bVar.nQj.add(i2, str);
} else {
bVar.nQj.add(str);
}
}
ah.this.bGc.getIntent().putExtra("sns_kemdia_path_list", ah.this.nPY.nQj);
}
public final void removeItem(int i) {
b bVar = ah.this.nPY;
if (bVar.nQj.size() > i) {
bVar.nQj.remove(i);
}
if (ah.this.bGc instanceof SnsUploadUI) {
((SnsUploadUI) ah.this.bGc).bEA();
}
ah.this.bGc.getIntent().putExtra("sns_kemdia_path_list", ah.this.nPY.nQj);
((e) ah.this.nPZ).xH(ah.this.nPY.nQj.size());
}
};
if (this.nQd) {
z = false;
} else {
z = true;
}
this.nPZ = new e(view, view2, view3, mMActivity, list, dynamicGridView, anonymousClass1, anonymousClass2, z);
return this.nPZ.getView();
}
public final View bBV() {
this.nPZ = new PreviewImageView(this.bGc);
if (this.nQd) {
this.nPZ.setIsShowAddImage(false);
}
this.nPZ.setImageClick(new 3(this));
this.nPZ.setList$22875ea3(this.nPY.nQj);
return this.nPZ.getView();
}
private static ax a(ax axVar, List<com.tencent.mm.plugin.sns.data.h> list) {
axVar.cj(list);
return axVar;
}
final void a(ax axVar) {
int commit = axVar.commit();
if (this.nMG != null) {
this.nMG.iq(commit);
com.tencent.mm.plugin.sns.h.e.nxO.c(this.nMG);
}
if (!(this.nPY == null || this.nPY.nQj == null || !s.bBF())) {
com.tencent.mm.plugin.report.service.h.mEJ.h(12834, new Object[]{Integer.valueOf(this.nPY.nQj.size())});
}
Intent intent = new Intent();
intent.putExtra("sns_local_id", commit);
this.bGc.setResult(-1, intent);
this.bGc.finish();
}
public final boolean a(int i, int i2, i iVar, String str, List<String> list, arj arj, int i3, boolean z, List<String> list2, PInt pInt, String str2, int i4, int i5) {
String str3;
List<com.tencent.mm.plugin.sns.data.h> linkedList = new LinkedList();
Iterator it = this.nPY.nQj.iterator();
int i6 = 0;
while (it.hasNext()) {
str3 = (String) it.next();
com.tencent.mm.plugin.sns.data.h hVar = new com.tencent.mm.plugin.sns.data.h(str3, 2);
hVar.type = 2;
hVar.nkY = i;
if (i6 == 0) {
hVar.nkX = i2;
if (iVar != null) {
hVar.nla = iVar.token;
hVar.nlb = iVar.rWk;
}
} else {
hVar.nkX = 0;
}
int i7 = i6 + 1;
b bVar = this.nPY;
hVar.nkW = bVar.nQl.containsKey(str3) ? ((Integer) bVar.nQl.get(str3)).intValue() : 0;
hVar.desc = str;
bVar = this.nPY;
boolean booleanValue = (bi.oW(str3) || !bVar.nQk.containsKey(str3)) ? false : ((Boolean) bVar.nQk.get(str3)).booleanValue();
hVar.nld = booleanValue;
linkedList.add(hVar);
i6 = i7;
}
LinkedList linkedList2 = new LinkedList();
if (list != null) {
LinkedList linkedList3 = new LinkedList();
List Hv = com.tencent.mm.model.s.Hv();
for (String str32 : list) {
if (!Hv.contains(str32)) {
bqg bqg = new bqg();
bqg.hbL = str32;
linkedList2.add(bqg);
}
}
}
ax axVar = new ax(1);
pInt.value = axVar.afv;
if (iVar != null) {
axVar.eB(iVar.token, iVar.rWk);
}
if (i3 > com.tencent.mm.plugin.sns.c.a.nkE) {
axVar.wC(3);
}
axVar.My(str).a(arj).ag(linkedList2).wE(i).wF(i2);
if (z) {
axVar.wH(1);
} else {
axVar.wH(0);
}
if (!bi.oW(this.appId)) {
axVar.ME(this.appId);
}
if (!bi.oW(this.appName)) {
axVar.MF(bi.aG(this.appName, ""));
}
axVar.wG(this.nMA);
if (this.nNY) {
axVar.wG(5);
}
if (this.nNZ && this.nOa != null) {
axVar.Mz(this.nOa.mediaTagName);
axVar.aa(this.appId, this.nOa.messageExt, this.nOa.messageAction);
}
axVar.f(null, null, null, i4, i5);
axVar.ci(list2);
axVar.setSessionId(this.fmS);
if (!(arj == null || arj.score == 0)) {
i6 = arj.score;
String str4 = arj.rTG;
axVar.nsy.rWt = new boj();
axVar.nsy.rWt.smt = i6;
axVar.nsy.rWt.smq = str4;
}
x.i("MicroMsg.PicWidget", "commit pic size %d, browseImageCount:%d", new Object[]{Integer.valueOf(linkedList.size()), Integer.valueOf(this.nQc)});
com.tencent.mm.plugin.report.service.h.mEJ.h(11602, new Object[]{Integer.valueOf(this.nQc), Integer.valueOf(linkedList.size())});
for (com.tencent.mm.plugin.sns.data.h hVar2 : linkedList) {
x.i("MicroMsg.PicWidget", "commit path %s len: %d", new Object[]{hVar2.path, Long.valueOf(FileOp.mI(hVar2.path))});
}
for (com.tencent.mm.plugin.sns.data.h hVar22 : linkedList) {
bpo bpo;
String str5 = hVar22.path;
bpo bpo2 = (bpo) this.nQb.get(str5);
if (bpo2 == null) {
bpo = new bpo();
} else {
bpo = bpo2;
}
if (this.nQe == null || (this.nQe.rms == 0.0f && this.nQe.rmr == 0.0f)) {
bpo.snH = -1000.0f;
bpo.snI = -1000.0f;
} else {
bpo.snH = this.nQe.rms;
bpo.snI = this.nQe.rmr;
bpo.nOD = this.nQe.nOD;
bpo.biF = this.nQe.biF;
}
com.tencent.mm.compatible.util.Exif.a aVar = (com.tencent.mm.compatible.util.Exif.a) this.nQa.get(str5);
if (aVar == null || (aVar.latitude == 0.0d && aVar.longitude == 0.0d)) {
bpo.snF = -1000.0f;
bpo.snG = -1000.0f;
} else {
bpo.snF = (float) aVar.latitude;
bpo.snG = (float) aVar.longitude;
}
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("||index: " + axVar.nsy.rWo.size());
stringBuffer.append("||item poi lat " + bpo.snH + " " + bpo.snI);
stringBuffer.append("||item pic lat " + bpo.snF + " " + bpo.snG);
stringBuffer.append("||item exitime:" + bpo.snK + " filetime: " + bpo.snL);
stringBuffer.append("||item source: " + bpo.snJ);
x.i("MicroMsg.UploadPackHelper", "addSnsReportInfo item : " + stringBuffer.toString());
axVar.nsy.rWo.add(bpo);
}
if (linkedList.size() <= 1) {
a(axVar, linkedList);
a(axVar);
} else {
new a(axVar, linkedList).o(new String[]{""});
}
com.tencent.mm.kernel.g.Em().H(new 4(this));
return true;
}
protected final boolean bCA() {
com.tencent.mm.kernel.g.Ek();
if (!com.tencent.mm.kernel.g.Ei().isSDCardAvailable()) {
com.tencent.mm.ui.base.s.gH(this.bGc);
return false;
} else if (this.nPY.nQj.size() >= 9) {
com.tencent.mm.ui.base.h.i(this.bGc, j.sns_upload_litmit, j.app_tip);
return false;
} else {
try {
ba baVar = new ba(this.bGc);
baVar.ofp = new 5(this);
baVar.ofq = new 6(this);
baVar.bEo();
} catch (Exception e) {
}
return true;
}
}
public final boolean d(List<String> list, int i, boolean z) {
if (list == null || list.size() == 0) {
x.i("MicroMsg.PicWidget", "no image selected");
} else if (this.nPY.nQj.size() < 9) {
for (String str : list) {
if (FileOp.cn(str)) {
String str2 = "pre_temp_sns_pic" + g.u((str + System.currentTimeMillis()).getBytes());
s.ad(af.getAccSnsTmpPath(), str, str2);
x.d("MicroMsg.PicWidget", "newPath " + af.getAccSnsTmpPath() + str2);
this.nPY.l(af.getAccSnsTmpPath() + str2, i, z);
((e) this.nPZ).xH(this.nPY.nQj.size());
this.nPZ.setList$22875ea3(this.nPY.nQj);
this.bGc.getIntent().putExtra("sns_kemdia_path_list", this.nPY.nQj);
try {
File file = new File(str);
bpo bpo = new bpo();
bpo.snJ = z ? 1 : 2;
bpo.snL = file.lastModified() / 1000;
bpo.snK = Exif.fromFile(str).getUxtimeDatatimeOriginal();
this.nQb.put(af.getAccSnsTmpPath() + str2, bpo);
} catch (Exception e) {
x.e("MicroMsg.PicWidget", "get report info error " + e.getMessage());
}
com.tencent.mm.compatible.util.Exif.a location = Exif.fromFile(str).getLocation();
if (location != null) {
this.nQa.put(af.getAccSnsTmpPath() + str2, location);
}
}
}
}
return true;
}
public final boolean d(int i, Intent intent) {
String d;
String u;
switch (i) {
case 2:
x.d("MicroMsg.PicWidget", "onActivityResult 1");
if (intent == null) {
return false;
}
x.d("MicroMsg.PicWidget", "onActivityResult CONTEXT_CHOSE_IMAGE");
Intent intent2 = new Intent();
intent2.putExtra("CropImageMode", 4);
intent2.putExtra("CropImage_DirectlyIntoFilter", true);
intent2.putExtra("CropImage_Filter", true);
com.tencent.mm.plugin.sns.c.a.ezn.a(this.bGc, intent, intent2, af.getAccSnsTmpPath(), 4, new com.tencent.mm.ui.tools.a.a() {
public final String NT(String str) {
return af.getAccSnsTmpPath() + g.u((str + System.currentTimeMillis()).getBytes());
}
});
return true;
case 3:
x.d("MicroMsg.PicWidget", "onActivityResult 2");
d = l.d(this.bGc.getApplicationContext(), intent, af.getAccSnsTmpPath());
if (d == null) {
return true;
}
Intent intent3 = new Intent();
intent3.putExtra("CropImageMode", 4);
intent3.putExtra("CropImage_Filter", true);
intent3.putExtra("CropImage_DirectlyIntoFilter", true);
intent3.putExtra("CropImage_ImgPath", d);
u = g.u((d + System.currentTimeMillis()).getBytes());
intent3.putExtra("CropImage_OutputPath", af.getAccSnsTmpPath() + u);
com.tencent.mm.compatible.util.Exif.a location = Exif.fromFile(d).getLocation();
if (location != null) {
this.nQa.put(af.getAccSnsTmpPath() + u, location);
x.d("MicroMsg.PicWidget", "take picture lat:%f, long:%f", new Object[]{Double.valueOf(location.latitude), Double.valueOf(location.longitude)});
}
bpo bpo = new bpo();
bpo.snJ = 1;
bpo.snL = System.currentTimeMillis();
bpo.snK = bi.WV(Exif.fromFile(d).dateTime);
this.nQb.put(af.getAccSnsTmpPath() + u, bpo);
com.tencent.mm.plugin.sns.c.a.ezn.a(this.bGc, intent3, 4);
this.nOU = true;
return true;
case 4:
x.d("MicroMsg.PicWidget", "onActivityResult 3");
if (intent == null) {
return true;
}
d = intent.getStringExtra("CropImage_OutputPath");
x.d("MicroMsg.PicWidget", "REQUEST_CODE_IMAGE_SEND_COMFIRM filePath " + d);
if (d == null) {
return true;
}
if (!FileOp.cn(d)) {
return true;
}
if (this.nPY.nQj.size() >= 9) {
return true;
}
int intExtra = intent.getIntExtra("CropImage_filterId", 0);
u = "pre_temp_sns_pic" + g.u((d + System.currentTimeMillis()).getBytes());
x.i("MicroMsg.PicWidget", "onactivity result " + FileOp.mI(d) + " " + d);
FileOp.y(d, af.getAccSnsTmpPath() + u);
if (this.nQa.containsKey(d)) {
this.nQa.put(af.getAccSnsTmpPath() + u, this.nQa.get(d));
}
d = af.getAccSnsTmpPath() + u;
x.d("MicroMsg.PicWidget", "newPath " + d);
this.nPY.l(d, intExtra, false);
this.bGc.getIntent().putExtra("sns_kemdia_path_list", this.nPY.nQj);
((e) this.nPZ).xH(this.nPY.nQj.size());
this.nPZ.setList$22875ea3(this.nPY.nQj);
return true;
case 7:
if (intent == null) {
return true;
}
this.nPY.N(intent.getStringArrayListExtra("sns_gallery_temp_paths"));
this.bGc.getIntent().putExtra("sns_kemdia_path_list", this.nPY.nQj);
((e) this.nPZ).xH(this.nPY.nQj.size());
this.nPZ.setList$22875ea3(this.nPY.nQj);
this.nQc = intent.getIntExtra("sns_update_preview_image_count", 0);
return true;
case 9:
return d(intent.getStringArrayListExtra("CropImage_OutputPath_List"), intent.getIntExtra("CropImage_filterId", 0), intent.getBooleanExtra("isTakePhoto", false));
case 11:
SightCaptureResult sightCaptureResult = (SightCaptureResult) intent.getParcelableExtra("key_req_result");
if (sightCaptureResult != null) {
d = sightCaptureResult.lek;
if (!bi.oW(d)) {
return d(Collections.singletonList(d), 0, true);
}
}
break;
}
return false;
}
public final boolean bBW() {
if (this.nPZ != null) {
this.nPZ.clean();
}
return false;
}
}
|
package org.milvus.regex.fst;
import java.util.ArrayDeque;
import java.util.HashSet;
import java.util.List;
import java.util.Queue;
import java.util.Set;
import org.milvus.util.TransitiveClosure;
public abstract class NFA2DFA {
public static void eliminateEpsilonTransitions(NFA nfa) {
fixStateIndex(nfa);
List<State> states = nfa.getStates();
boolean[][] epsilonTransitionMatrix = emptyAdjacencyMatrix(states.size());
for (State q0 : states) {
List<Transition> transitions = q0.getTransitions();
for (int i = 0; i < transitions.size(); i++) {
Transition delta = transitions.get(i);
if (delta.getRange() == CharRange.getEpsilon()) {
State q1 = delta.getTarget();
epsilonTransitionMatrix[q0.getIndex()][q1.getIndex()] = true;
}
}
removeEpsilonTransitions(transitions);
}
TransitiveClosure.compute(epsilonTransitionMatrix);
for (int i = 0; i < states.size(); i++) {
for (int j = 0; j < states.size(); j++) {
// skip transitions into the state itself
if (i != j && epsilonTransitionMatrix[i][j]) {
List<Transition> transitions = states.get(j).getTransitions();
State q0 = states.get(i);
for (Transition delta : transitions) {
q0.addTransition(delta);
}
}
}
}
}
public static void eliminateUnreachableNodes(NFA nfa) {
// Build the transitive closure of the reachability relation, then eliminate all nodes not
// reachable from the start state. It is sufficient to remove the nodes themselves, as the only
// possible incoming transitions are from non-reachable nodes that will be removed themselves.
fixStateIndex(nfa);
List<State> states = nfa.getStates();
boolean[][] reachable = emptyAdjacencyMatrix(states.size());
for (State state : states) {
List<Transition> transitions = state.getTransitions();
for (Transition delta : transitions) {
State target = delta.getTarget();
reachable[state.getIndex()][target.getIndex()] = true;
}
}
TransitiveClosure.compute(reachable);
State startState = nfa.getStartState();
int startIndex = startState.getIndex();
for (State state : states) {
if (state != startState && !reachable[startIndex][state.getIndex()]) {
nfa.remove(state);
}
}
}
private static final void removeEpsilonTransitions(List<Transition> transitions) {
int i = 0;
while (i < transitions.size()) {
if (transitions.get(i).getRange() == CharRange.getEpsilon()) {
transitions.remove(i);
} else {
++i;
}
}
}
public static NFA determinize(NFA nfa) {
fixStateIndex(nfa);
StateSet stateSet = new StateSet(nfa.getStates().size());
Queue<State> stateQ = new ArrayDeque<State>();
State start = nfa.getStartState();
State newStart = new State(false);
NFA dfa = new NFA(newStart, null);
Set<State> startSet = new HashSet<State>();
startSet.add(newStart);
stateSet.addState(newStart, startSet);
stateQ.add(newStart);
while (!stateQ.isEmpty()) {
State s0 = stateQ.remove();
}
return dfa;
}
private static final boolean[][] emptyAdjacencyMatrix(int size) {
boolean[][] matrix = new boolean[size][];
for (int i = 0; i < size; i++) {
boolean[] row = new boolean[size];
for (int j = 0; j < size; j++) {
row[j] = false;
}
matrix[i] = row;
}
return matrix;
}
// Since the NFA may have been built up from previous NFAs, the states' index may be all over the
// place. This method fixes the state index so it can be used in the NFA to DFA transformations.
private static final void fixStateIndex(NFA nfa) {
List<State> states = nfa.getStates();
final int max = states.size();
for (int i = 0; i < max; i++) {
states.get(i).setIndex(i);
}
}
}
|
package com.lingnet.vocs.service.customer;
import com.lingnet.common.service.BaseService;
import com.lingnet.util.Pager;
import com.lingnet.vocs.entity.Customer;
public interface CustomerService extends BaseService<Customer, String> {
/**
* 保存或编辑VOCS客户
* @Title: saveOrUpdate
* @parm
* String girdData 前台子表表格数据
* String id 前台主表id
* @return
* String
* @author zmf
* @throws Exception
* @since 2016-8-12 V 1.0
*/
public String saveOrUpdate(String formData,String girdData) throws Exception;
public String getListData(Pager pager,String name,String key, String partnerName,String areaId);
public String getSbList(String str,String end,String id) throws Exception;
public String getSbPcxxList(Pager pager,String str,String end, String id,String year,String month);
public String getMyListData(Pager pager, String name, String key,String areaId);
public String saveUpdate(String formdata, String griddata) throws Exception;
public String getCustomerTree(String partnerId,String key,String areaId);
public String getListCustomer(Pager pager, String name, String key);
public String getQzKhData(Pager pager, String searchData);
public String getYxkhList(Pager pager, String searchData, String status);
}
|
package annotation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component("mg")
public class Manager {
@Value("#{config.pagesize}")
private String pageSize;
@Value("»¨Ç§¹Ç")
private String name;
@Override
public String toString() {
return "Manager [pageSize=" + pageSize + ", name=" + name + "]";
}
public Manager() {
System.out.println("Manager()");
}
}
|
package com.tencent.mm.plugin.sns.storage.AdLandingPagesStorage.AdLandingPageComponent.component;
import android.content.Intent;
import android.text.TextUtils;
import com.tencent.mm.bg.d;
import com.tencent.mm.plugin.sns.model.AdLandingPagesProxy.a;
import com.tencent.mm.protocal.c.mv;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
class n$2 implements a {
final /* synthetic */ n nDS;
n$2(n nVar) {
this.nDS = nVar;
}
public final void at(Object obj) {
}
public final void e(int i, int i2, Object obj) {
if (i == 0 && i2 == 0) {
mv mvVar = new mv();
try {
mvVar.aG((byte[]) obj);
} catch (Throwable e) {
x.e("MicroMsg.AdLandingPageDownloadApkBtnComp", bi.i(e));
}
if (!TextUtils.isEmpty(mvVar.rqU)) {
x.d("MicroMsg.AdLandingPageDownloadApkBtnComp", "opening url " + mvVar.rqU);
Intent intent = new Intent();
intent.putExtra("rawUrl", mvVar.rqU);
intent.putExtra("showShare", true);
d.b(this.nDS.context, "webview", ".ui.tools.WebViewUI", intent);
n.a(this.nDS).Dd(10);
return;
} else if (mvVar.rqT != null) {
n.b(this.nDS).nzT = mvVar.rqT.rqK;
n.b(this.nDS).bKg = mvVar.rqT.rqI;
n.b(this.nDS).downloadUrl = mvVar.rqT.rqJ;
n.b(this.nDS).fileSize = (long) mvVar.rqT.rqN;
n.a(this.nDS).Dd(6);
return;
} else {
x.i("MicroMsg.AdLandingPageDownloadApkBtnComp", "resp null");
n.a(this.nDS).Dd(5);
return;
}
}
n.a(this.nDS).Dd(5);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.