text stringlengths 10 2.72M |
|---|
package com.github.vinja.compiler;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import org.apache.commons.io.FilenameUtils;
import com.github.vinja.util.VjdeUtil;
public class TomcatJvmoptConf {
private static StringBuffer jvmOptsBuffer = null;
private static void loadVarsFromFile(File file) {
jvmOptsBuffer = new StringBuffer("");
if (file == null) {
return ;
}
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(file));
while (true) {
String tmp = br.readLine();
if (tmp == null) break;
if (tmp.startsWith("#")) continue;
jvmOptsBuffer.append(tmp).append(" ");
}
} catch (IOException e) {
} finally {
if (br != null) try { br.close(); } catch (Exception e) {}
}
}
public static String getJvmOptions() {
if (jvmOptsBuffer == null) {
loadVarsFromFile(getConfigFile());
}
return jvmOptsBuffer.toString();
}
private static File getConfigFile() {
String userCfgPath = FilenameUtils.concat(VjdeUtil.getToolDataHome(), "tomcat_jvmopt.cfg");
File tmpFile = new File(userCfgPath);
if (tmpFile.exists()) return tmpFile;
return null;
}
}
|
package manage.service.impl;
import manage.bean.T_user;
import manage.dao.impl.T_userDaoImpl;
public class T_userServiceImpl {
private T_userDaoImpl userDaoImpl=new T_userDaoImpl();
public T_user login(String username,String password){
return userDaoImpl.login(username, password);
}
}
|
package com.shangcai.entity.material;
import java.math.BigDecimal;
import com.irille.core.repository.orm.Column;
import com.irille.core.repository.orm.ColumnBuilder;
import com.irille.core.repository.orm.ColumnFactory;
import com.irille.core.repository.orm.ColumnTemplate;
import com.irille.core.repository.orm.Entity;
import com.irille.core.repository.orm.IColumnField;
import com.irille.core.repository.orm.IColumnTemplate;
import com.irille.core.repository.orm.Table;
import com.irille.core.repository.orm.TableFactory;
import com.shangcai.entity.common.Works;
public class Design extends Entity {
public static final Table<Design> table = TableFactory.entity(Design.class).column(T.values()).create();
public enum T implements IColumnField {
PKEY(ColumnTemplate.PKEY),
SAMPLING_PRICE(ColumnTemplate.AMT.showName("取样价")),
THEMES(ColumnTemplate.JSON.showName("主题")),
WORKS(ColumnFactory.manyToOne(Works.T.PKEY).showName("所属作品")),
;
private Column column;
T(IColumnTemplate template) {
this.column = template.builder().create(this);
}
T(ColumnBuilder builder) {
this.column = builder.create(this);
}
@Override
public Column column() {
return column;
}
}
// >>>以下是自动产生的源代码行--源代码--请保留此行用于识别>>>
// 实例变量定义-----------------------------------------
private Integer pkey; // 主键 INT(11)
private BigDecimal samplingPrice; // 取样价 DECIMAL(0)
private String themes; // 主题 JSON(0)
private Integer works; // 所属作品<表主键:Works> INT(11)
@Override
public Design init() {
super.init();
samplingPrice = new BigDecimal(1); // 取样价 DECIMAL(0)
themes = null; // 主题 JSON(0)
works = null; // 所属作品 INT(11)
return this;
}
// 方法------------------------------------------------
public Integer getPkey() {
return pkey;
}
public void setPkey(Integer pkey) {
this.pkey = pkey;
}
public BigDecimal getSamplingPrice() {
return samplingPrice;
}
public void setSamplingPrice(BigDecimal samplingPrice) {
this.samplingPrice = samplingPrice;
}
public String getThemes() {
return themes;
}
public void setThemes(String themes) {
this.themes = themes;
}
public Integer getWorks() {
return works;
}
public void setWorks(Integer works) {
this.works = works;
}
public Works gtWorks() {
return selectFrom(Works.class, getWorks());
}
public void stWorks(Works works) {
this.works = works.getPkey();
}
// <<<以上是自动产生的源代码行--源代码--请保留此行用于识别<<<
}
|
package com.paleimitations.schoolsofmagic.common.items;
import com.paleimitations.schoolsofmagic.SchoolsOfMagicMod;
import com.paleimitations.schoolsofmagic.common.data.capabilities.quest_data.IQuestData;
import com.paleimitations.schoolsofmagic.common.data.capabilities.quest_data.QuestDataProvider;
import com.paleimitations.schoolsofmagic.common.quests.Quest;
import com.paleimitations.schoolsofmagic.common.quests.QuestHelper;
import com.paleimitations.schoolsofmagic.common.registries.QuestRegistry;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.*;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
public class LetterItem extends Item {
public LetterItem(Properties properties) {
super(properties.stacksTo(1));
}
@Override
public ActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
ItemStack stack = player.getItemInHand(hand);
SchoolsOfMagicMod.getProxy().openLetter(player, stack, hand);
player.playSound(SoundEvents.BOOK_PAGE_TURN, 0.1f, 1f);
return ActionResult.success(stack);
}
}
|
package edu.kvcc.cis298.criminalintent;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.text.Editable;
import android.text.TextWatcher;
import android.text.format.DateFormat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import java.util.Date;
import java.util.UUID;
public
class CrimeFragment
extends Fragment
{
// private variables
// model variables
private static final String
ARG_CRIME_ID
= "crime_id";
private static final String
DIALOG_DATE
= "DialogDate";
private static final int
REQUEST_DATE
= 0;
private Crime
crime;
// view variables
private EditText
etTitle;
private Button
btnDate;
private CheckBox
cbSolved;
// public methods
public static
CrimeFragment newInstance(UUID crimeId)
{
Bundle
args
= new Bundle();
args.putSerializable(
ARG_CRIME_ID,
crimeId
);
CrimeFragment
fragment
= new CrimeFragment();
fragment.setArguments( args );
return fragment;
}
@Override
public
void onActivityResult(
int requestCode,
int resultCode,
Intent data
)
{
if ( resultCode
!= Activity.RESULT_OK )
{
return;
}
if ( requestCode
== REQUEST_DATE )
{
Date
date
= (Date) data
.getSerializableExtra(
DatePickerFragment.EXTRA_DATE
);
crime.setDate( date );
updateDate();
}
}
@Override
public
void onCreate(
@Nullable
Bundle savedInstanceState
)
{
super.onCreate( savedInstanceState );
UUID
crimeId
= (UUID) getArguments()
.getSerializable( ARG_CRIME_ID );
crime
= CrimeLab
.get( getActivity() )
.getCrime( crimeId );
}
@Override
public
void onPause()
{
super.onPause();
CrimeLab.get( getActivity() )
.updateCrime( crime );
}
@Nullable
@Override
public
View onCreateView(
LayoutInflater inflater,
@Nullable
ViewGroup container,
@Nullable
Bundle savedInstanceState
)
{
View
view
= inflater.inflate(
R.layout.fragment_crime,
container,
false
);
etTitle
= (EditText) view.findViewById(
R.id.fragment_crime_et_title
);
etTitle.setText( crime.getTitle() );
etTitle.addTextChangedListener(
new TextWatcher()
{
@Override
public
void beforeTextChanged(
CharSequence s,
int start,
int count,
int after
)
{
// do nothing
}
@Override
public
void onTextChanged(
CharSequence s,
int start,
int before,
int count
)
{
crime.setTitle( s.toString() );
}
@Override
public
void afterTextChanged(Editable s)
{
// do nothing
}
}
);
btnDate
= (Button) view.findViewById(
R.id.fragment_crime_btn_date
);
updateDate();
btnDate.setOnClickListener(
new View.OnClickListener()
{
@Override
public
void onClick(View view)
{
FragmentManager
fragmentManager
= getFragmentManager();
DatePickerFragment
dialog
=
DatePickerFragment
.newInstance( crime.getDate() );
dialog.setTargetFragment(
CrimeFragment.this,
REQUEST_DATE
);
dialog.show(
fragmentManager,
DIALOG_DATE
);
}
}
);
cbSolved
= (CheckBox) view.findViewById(
R.id.fragment_crime_cb_solved
);
cbSolved.setChecked( crime.isSolved() );
cbSolved.setOnCheckedChangeListener(
new CompoundButton.OnCheckedChangeListener()
{
@Override
public
void onCheckedChanged(
CompoundButton btnView,
boolean isChecked
)
{
crime.setSolved( isChecked );
}
}
);
return view;
}
public
void returnResult()
{
getActivity()
.setResult(
Activity.RESULT_OK,
null
);
}
// private methods
private
void updateDate()
{
btnDate.setText(
crime
.getDate()
.toString()
);
}
private String getCrimeReport()
{
String solved = null;
if(crime.isSolved())
{
solved = getString(
R.string.crime_report_solved
);
}
else
{
solved = getString(
R.string.crime_report_unsolved
);
}
String dateFormat = "EEE, MMM, dd";
String date = DateFormat
.format(
dateFormat,
crime.getDate()
)
.toString();
String suspect = crime.getSuspect();
if(suspect == null)
{
suspect = getString(
R.string.crime_report_no_suspect
);
}
else
{
suspect = getString(
R.string.crime_report_suspect, suspect
);
}
String report = getString(
R.string.crime_report,
crime.getTitle(),
date,
solved,
suspect
);
return report;
}
}
|
package webserver;
import java.io.File;
import java.io.IOException;
public class DirectoryBrowserGenerator {
public static byte[] generate(File givenDir, File defaultDir) throws IOException {
String relativeDirname = "";
String parentDirname = "";
String separator = File.separator;
if (!separator.equals("/")) {
separator = "\\\\";
}
String[] givenDirPathSplit = givenDir.getAbsolutePath().split(separator);
String[] defaultDirPathSplit = defaultDir.getAbsolutePath().split(separator);
for (int i = defaultDirPathSplit.length; i < givenDirPathSplit.length; i++) {
relativeDirname += "/" + givenDirPathSplit[i];
if (i == givenDirPathSplit.length - 2) {
parentDirname = relativeDirname;
}
}
if (givenDirPathSplit.length - defaultDirPathSplit.length == 1) {
parentDirname = "/";
}
String htmlContent = "<!DOCTYPE html>\n" +
"<html lang=\"en\">\n" +
"<head>\n" +
" <meta charset=\"UTF-8\">\n" +
" <title>" + givenDir.getName() + "</title>\n" +
"</head>\n" +
"<body>\n";
File[] filesInGivenDir = givenDir.listFiles();
if (!givenDir.equals(defaultDir)) {
htmlContent += "<a href=\"" + parentDirname + "\">" + "..." + "</a> \n <br>";
}
String returndir;
if (relativeDirname.equals("")) {
returndir = "/";
} else {
returndir = relativeDirname;
}
if (filesInGivenDir.length > 0) {
for (File file : filesInGivenDir) {
htmlContent += "<a href=\"" + relativeDirname + "/" + file.getName() + "\">" + file.getName() + "</a>"
+ "<a style=\"color: red;float: right\" href=\"delete" + relativeDirname + "/" + file.getName()
+ "?return=" + returndir + "\">Delete</a> <br>";
}
} else {
htmlContent += "<p>Empty directory</p>\n";
}
htmlContent += "</body>\n" + "</html>";
return htmlContent.getBytes("UTF-8");
}
}
|
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
import java.util.HashMap;
public class StudentGroupTest {
StudentGroup[] groups;
@Before
public void Init() {
groups = new StudentGroup[3];
groups[0] = new StudentGroup(StudentGroup.SubjectName.COMPUTER_SCIENCE, StudentGroup.MarkType.Double);
groups[0].addStudentProgress("John Snow", new Mark(3.9));
groups[0].addStudentProgress("Jamie Lannister", new Mark(3.75));
groups[0].addStudentProgress("Prince Dorian", new Mark(2.99));
groups[0].addStudentProgress("Ned Stark", new Mark(5.0));
groups[0].addStudentProgress("Sam Tarly", new Mark(4.95));
groups[0].addStudentProgress("Night King", new Mark(3.48));
groups[0].addStudentProgress("Deyeneris", new Mark(4.17));
groups[1] = new StudentGroup(StudentGroup.SubjectName.GEOMETRY, StudentGroup.MarkType.Integer);
groups[1].addStudentProgress("John Snow", new Mark(3));
groups[1].addStudentProgress("Tirion Lannister", new Mark(2));
groups[1].addStudentProgress("Arya Stark", new Mark(4));
groups[1].addStudentProgress("Deyeneris", new Mark(5));
groups[1].addStudentProgress("Prince Dorian", new Mark(4));
groups[1].addStudentProgress("Sam Tarly", new Mark(5));
groups[1].addStudentProgress("Teon Greyjoy", new Mark(1));
groups[2] = new StudentGroup(StudentGroup.SubjectName.HISTORY, StudentGroup.MarkType.Double);
groups[2].addStudentProgress("John Snow", new Mark(4.2));
groups[2].addStudentProgress("Jamie Lannister", new Mark(4.88));
groups[2].addStudentProgress("Tirion Lannister", new Mark(2.76));
groups[2].addStudentProgress("Arya Stark", new Mark(3.98));
groups[2].addStudentProgress("Ned Stark", new Mark(4.07));
}
@Test
public void addStudentProgress() {
assertFalse(groups[0].addStudentProgress("John Snow", new Mark(4))); // Wrong type
assertFalse(groups[1].addStudentProgress("Jamie Lannister", new Mark(3.75))); // Wrong type
}
@Test
public void getProgressByName() {
// John Snow
HashMap<StudentGroup.SubjectName, Mark> expected = new HashMap<>();
expected.put(StudentGroup.SubjectName.HISTORY, new Mark(4.2));
expected.put(StudentGroup.SubjectName.COMPUTER_SCIENCE, new Mark(3.9));
expected.put(StudentGroup.SubjectName.GEOMETRY, new Mark(3));
HashMap<StudentGroup.SubjectName, Mark> actual = StudentGroup.getProgressByName("John Snow", groups);
assertNotNull(actual);
assertEquals(expected.size(), actual.size());
actual.keySet().stream().forEach((key) -> {
assertEquals(actual.get(key).toString(), expected.get(key).toString());
});
}
} |
public class Table {
private int label;
private String text;
public int getLabel() {
return label;
}
public void setId(int label) {
this.label = label;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String toString(){
return "label = " + getLabel() + " :::: text = " + getText() + "\n";
}
}
|
/*
* 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 fizzbuzz;
import java.util.Arrays;
/**
*
* @author MHerzog
*/
public class FizzBuzz {
public static void main(String[] args) {
String[] fizzBuzz = new String[101];
for(int i = 1; i < fizzBuzz.length; i++){
fizzBuzz[i] = Integer.toString(i);
if(i%3==0){
fizzBuzz[i] = "Fizz";
}
if(i%5==0){
fizzBuzz[i] = "Buzz";
}
if(i%3==0 && i%5==0){
fizzBuzz[i] = "FizzBuzz";
}
System.out.println(fizzBuzz[i]);
}
}
}
|
package ull.patrones.estrategia;
import ull.patrones.auxilares.Fecha;
import ull.patrones.singleton.ColaSingleton;
public class Ev_emergencia implements IEvento
{
private Fecha m_fecha;
private final int m_idtipoevento = 0003;
public Ev_emergencia()
{
m_fecha = new Fecha();
}
@Override
public void run()
{
try
{
Thread.sleep(10000);
} catch (InterruptedException e)
{
e.printStackTrace();
}
ColaSingleton.getInstancia().desacolar(this);
}
@Override
public long getIdTipoEvento()
{
return m_idtipoevento;
}
@Override
public Fecha getFecha()
{
return m_fecha;
}
@Override
public String toString()
{
return "Evento: EMERGENCIA, Fecha: "+m_fecha+", con ID: "+m_idtipoevento;
}
@Override
public void start()
{
Thread t_hilo = new Thread(this);
t_hilo.start();
}
}
|
package rs.code9.taster.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import rs.code9.taster.model.Category;
/**
* Category JPA access layer interface.
*
* @author r.zuljevic
*/
@Repository
public interface CategoryRepository extends JpaRepository<Category, Long> {
}
|
package shop.jinwookoh.api.fundSupporter.domain;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "fund_supporters")
public class FundSupporter {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "fund_supporter_id")
private long fundSupporterId;
}
|
package com.mes.cep.manage;
/**
*@author Stephen Wen
*@email 872003894@qq.com
*@date 2017年4月11日
*@Version
*@Chinesename 结构管理
*/
public class StructureManagement {
}
|
/**
* Solutii Ecommerce, Automatizare, Validare si Analiza | Seava.ro
* Copyright: 2013 Nan21 Electronics SRL. All rights reserved.
* Use is subject to license terms.
*/
package seava.ad.presenter.impl.security.qb;
import seava.ad.presenter.impl.security.model.MyUser_Ds;
import seava.j4e.presenter.action.query.QueryBuilderWithJpql;
import seava.j4e.api.session.Session;
public class MyUser_DsQb
extends
QueryBuilderWithJpql<MyUser_Ds, MyUser_Ds, Object> {
@Override
public void setFilter(MyUser_Ds filter) {
filter.setCode(Session.user.get().getCode());
super.setFilter(filter);
}
}
|
package zomeapp.com.zomechat.utils;
import android.content.Context;
import android.net.Uri;
import android.util.Log;
import com.facebook.common.util.UriUtil;
import com.facebook.drawee.drawable.ScalingUtils;
import com.facebook.drawee.generic.GenericDraweeHierarchy;
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder;
import com.facebook.drawee.view.SimpleDraweeView;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import cz.msebera.android.httpclient.Header;
import zomeapp.com.zomechat.R;
/**
* Created by tkiet082187 on 12.10.15.
*/
public class RetrieveCityImage extends AsyncHttpClient {
// http://www.panoramio.com/map/get_panoramas.php?set=public&from=0&to=20&minx=-3.59&miny=37.17&maxx=-3.79&maxy=37.37&size=medium&mapfilter=true
private Context context;
private double minLat, minLng, maxLat, maxLng;
private JSONObject jsonObject;
private AsyncHttpClient asyncHttpClient = this;
private RequestParams latLngParams = new RequestParams();
public RetrieveCityImage(Context context, double lat, double lng) {
this.context = context;
this.minLat = lat - 0.01;
this.minLng = lng - 0.01;
this.maxLat = lat + 0.01;
this.maxLng = lng + 0.01;
latLngParams.put("miny", minLat);
latLngParams.put("minx", minLng);
latLngParams.put("maxy", maxLat);
latLngParams.put("maxx", maxLng);
}
public void loadFirstImageUrlFromLocation(final SimpleDraweeView draweeView) {
asyncHttpClient.get("http://www.panoramio.com/map/get_panoramas.php?set=public&from=0&to=20&size=medium&mapfilter=true",
latLngParams,
new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
Log.e("response success", new String(responseBody));
try {
jsonObject = new JSONObject(new String(responseBody));
final JSONArray array = jsonObject.getJSONArray("photos");
String firstPhotoUrl = array.getJSONObject(0).getString("photo_file_url");
Uri uri = Uri.parse(firstPhotoUrl);
if (array.getJSONObject(0).getInt("height") >= array.getJSONObject(0).getInt("width")) {
GenericDraweeHierarchyBuilder builder =
new GenericDraweeHierarchyBuilder(context.getResources());
GenericDraweeHierarchy hierarchy = builder
.setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER).build();
draweeView.setHierarchy(hierarchy);
}
draweeView.setImageURI(uri);
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
error.printStackTrace();
}
});
}
public void loadDistinctImageUrlsFromLocation(final SimpleDraweeView draweeView, final int position) {
asyncHttpClient.get("http://www.panoramio.com/map/get_panoramas.php?set=public&from=0&to=20&size=medium&mapfilter=true",
latLngParams,
new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
Log.e("response success", new String(responseBody));
try {
jsonObject = new JSONObject(new String(responseBody));
JSONArray array = jsonObject.getJSONArray("photos");
Uri uri;
if (position < array.length()) {
String photoUrl = array.getJSONObject(position).getString("photo_file_url");
uri = Uri.parse(photoUrl);
} else {
uri = new Uri.Builder()
.scheme(UriUtil.LOCAL_RESOURCE_SCHEME) // "res"
.path(String.valueOf(R.drawable.zome_logo))
.build();
}
draweeView.setImageURI(uri);
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
error.printStackTrace();
}
});
}
}
|
package com.tencent.mm.boot.svg.a.a;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Cap;
import android.graphics.Paint.Join;
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.os.Looper;
import com.tencent.mm.svg.WeChatSVGRenderC2Java;
import com.tencent.mm.svg.c;
import com.tencent.smtt.sdk.WebView;
public final class ac extends c {
private final int height = 72;
private final int width = 72;
protected final int b(int i, Object... objArr) {
switch (i) {
case 0:
return 72;
case 1:
return 72;
case 2:
Canvas canvas = (Canvas) objArr[0];
Looper looper = (Looper) objArr[1];
c.f(looper);
c.e(looper);
Paint i2 = c.i(looper);
i2.setFlags(385);
i2.setStyle(Style.FILL);
Paint i3 = c.i(looper);
i3.setFlags(385);
i3.setStyle(Style.STROKE);
i2.setColor(WebView.NIGHT_MODE_COLOR);
i3.setStrokeWidth(1.0f);
i3.setStrokeCap(Cap.BUTT);
i3.setStrokeJoin(Join.MITER);
i3.setStrokeMiter(4.0f);
i3.setPathEffect(null);
c.a(i3, looper).setStrokeWidth(1.0f);
i2 = c.a(i2, looper);
i2.setColor(-1);
canvas.save();
Paint a = c.a(i2, looper);
Path j = c.j(looper);
j.moveTo(51.487274f, 48.305294f);
j.lineTo(62.849243f, 59.667263f);
j.lineTo(59.667263f, 62.849243f);
j.lineTo(48.305294f, 51.487274f);
j.cubicTo(44.15103f, 54.930374f, 38.817215f, 57.0f, 33.0f, 57.0f);
j.cubicTo(19.745142f, 57.0f, 9.0f, 46.254856f, 9.0f, 33.0f);
j.cubicTo(9.0f, 19.745142f, 19.745142f, 9.0f, 33.0f, 9.0f);
j.cubicTo(46.254856f, 9.0f, 57.0f, 19.745142f, 57.0f, 33.0f);
j.cubicTo(57.0f, 38.817215f, 54.930374f, 44.15103f, 51.487274f, 48.305294f);
j.close();
j.moveTo(52.54228f, 33.006664f);
j.cubicTo(52.54228f, 22.237095f, 43.81185f, 13.506665f, 33.04228f, 13.506665f);
j.cubicTo(22.272707f, 13.506665f, 13.542279f, 22.237095f, 13.542279f, 33.006664f);
j.cubicTo(13.542279f, 43.776237f, 22.272707f, 52.506664f, 33.04228f, 52.506664f);
j.cubicTo(43.81185f, 52.506664f, 52.54228f, 43.776237f, 52.54228f, 33.006664f);
j.close();
WeChatSVGRenderC2Java.setFillType(j, 2);
canvas.drawPath(j, a);
canvas.restore();
c.h(looper);
break;
}
return 0;
}
}
|
package com.tencent.mm.plugin.appbrand.canvas.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff.Mode;
import android.os.HandlerThread;
import android.util.AttributeSet;
import android.view.SurfaceHolder;
import android.view.SurfaceHolder.Callback;
import android.view.SurfaceView;
import android.view.View.OnAttachStateChangeListener;
import com.tencent.mm.plugin.appbrand.canvas.d;
import com.tencent.mm.plugin.appbrand.canvas.f;
import com.tencent.mm.plugin.appbrand.canvas.widget.a.a;
import com.tencent.mm.sdk.f.e;
import com.tencent.mm.sdk.platformtools.ag;
import com.tencent.mm.sdk.platformtools.x;
import java.util.LinkedHashSet;
import java.util.Set;
import org.json.JSONArray;
public class MSurfaceView extends SurfaceView implements Callback, a {
private final d fnD = new d(this);
private final Set<OnAttachStateChangeListener> fnE = new LinkedHashSet();
private SurfaceHolder fnG;
private ag fnH;
private Runnable fnI = new 1(this);
private volatile boolean nY;
public MSurfaceView(Context context) {
super(context);
init();
}
public MSurfaceView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
init();
}
public MSurfaceView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
init();
}
private void init() {
this.fnG = getHolder();
this.fnG.addCallback(this);
this.fnG.setFormat(-3);
Paint paint = new Paint();
paint.setColor(-1);
this.fnD.getDrawContext().fnk = paint;
}
public void surfaceCreated(SurfaceHolder surfaceHolder) {
x.i("MicroMsg.MSurfaceView", "surfaceCreated(%s)", new Object[]{Integer.valueOf(hashCode())});
this.nY = false;
if (this.fnH == null) {
HandlerThread cZ = e.cZ("MSurfaceView#Rending-Thread", -19);
cZ.start();
this.fnH = new ag(cZ.getLooper());
}
}
public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i2, int i3) {
x.i("MicroMsg.MSurfaceView", "surfaceChanged(%s)", new Object[]{Integer.valueOf(hashCode())});
}
public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
x.i("MicroMsg.MSurfaceView", "surfaceDestroyed(%s)", new Object[]{Integer.valueOf(hashCode())});
this.nY = true;
this.fnH.getLooper().quit();
this.fnH = null;
}
public void draw(Canvas canvas) {
x.i("MicroMsg.MSurfaceView", "draw(%s)", new Object[]{Integer.valueOf(hashCode())});
canvas.drawColor(0, Mode.CLEAR);
super.draw(canvas);
}
public final void adk() {
m(new 2(this));
}
public final void m(Runnable runnable) {
if (this.fnH != null) {
this.fnH.post(runnable);
}
}
public f getDrawContext() {
return this.fnD.getDrawContext();
}
public final boolean d(Canvas canvas) {
return this.fnD.d(canvas);
}
public final void a(JSONArray jSONArray, a aVar) {
this.fnD.a(jSONArray, aVar);
}
public final void b(JSONArray jSONArray, a aVar) {
this.fnD.b(jSONArray, aVar);
}
public final void adl() {
this.fnD.adl();
}
public void setId(String str) {
this.fnD.setId(str);
}
public int getType() {
return 2;
}
public void addOnAttachStateChangeListener(OnAttachStateChangeListener onAttachStateChangeListener) {
if (!this.fnE.contains(onAttachStateChangeListener)) {
this.fnE.add(onAttachStateChangeListener);
super.addOnAttachStateChangeListener(onAttachStateChangeListener);
}
}
public void removeOnAttachStateChangeListener(OnAttachStateChangeListener onAttachStateChangeListener) {
this.fnE.remove(onAttachStateChangeListener);
super.removeOnAttachStateChangeListener(onAttachStateChangeListener);
}
public final void onPause() {
this.fnD.onPause();
}
public final void onResume() {
this.fnD.onResume();
}
public final boolean isPaused() {
return this.fnD.fmT;
}
public String getSessionId() {
return this.fnD.getSessionId();
}
public void setSessionId(String str) {
this.fnD.setSessionId(str);
}
public int getDrawActionCostTimeReportId() {
return 667;
}
public int getDrawCostTimeReportId() {
return 668;
}
public void setStartTime(long j) {
this.fnD.setStartTime(j);
}
public final void adm() {
this.fnD.adm();
}
}
|
//import java.util.Arrays;
//public class MyBigProgram {
//
// public static void main(String[] args) {
// int[] list = {2, 9, 14, 7, 1, 0, 56, 34};
// //selectionSort(list, 0, list.length - 1);
// insertionSort(list);
// System.out.println(Arrays.toString(list));
// int keyIndex = binarySearch(list, 34, list.length -1);
//
// }
// public static void mergeSort(int[] list) {
// if(list.length > 1) {
// int[] firstHalf = new int[list.length / 2];
// System.arraycopy(list, 0, firstHalf, 0, list.length / 2);
//
// int secondHalfLength = list.length - list.length / 2;
// int secondHalf = new int[secondHalfLength];
// }
// }
// public static void merge(int[] first, int[] second, int[] combined) {
// int cIndex1 = 0;
// int cIndex2 = 0;
// int cIndexCombined = 0;
//
//
//
// while(cIndex1 < first.length && cIndex2 < second.length) {
// if(first[cIndex1] < second[cIndex2]) {
// combined[cIndexCombined++] = second[cIndex2++];
// //cIndex2++; same way as top ++s
// //cIndexCombined++;
// }
// else {
// combined[cIndexCombined++] = second[cIndex2++];
// }
// }
// //if there are stil unmoved elements in the first list and the second list
// //you have to copy them to the combined
// while(cIndex1 < first.length) {
// combined[cIndexCombined++] = first[cIndex1++];
// }
// while(cIndex2 < second.length) {
// combined[cIndexCombined++] = second[cIndex2++];
// }
// }
// public static void insertionSort(int[] list) {
// for(int i = 1; i < list.length; i++) {
// int temp = list[i];
// int j;
// for(j = i - 1; j >= 0 && list[i] > temp; j--) {
// list[j + 1] = list[j];
// }
// list[j + 1] = temp;
// }
//
// }
// //insertion sort with recursion
// public static void insertionSortRecursion(int[] list) {
// //base case
// // inf the number of the element is 1, then, we do not need to sort
// if (numberOfElements < 1)
// return;
// else if(numberOfElements == 1)
// System.out.println(Arrays.toString(list));
// else // recursive call
// int lastElementValue = list[numberOfElements - 1];
// //find out the next value of the elemts ( one lower index # of the list)
// int prev = numberOfElements - 2;
// while(prev >= 0 && list[prev] > lastElementValue) {
// list[prev + 1] = list[prev];
// prev--;
// } list[prev + 1] = lastElementValue;
//
// }
// public static int binarySearch(int[] list, int key, int firstIndex, int lastIndex) {
// int keyIndex;
// if(firstIndex > lastIndex) {
// ???????????????
// }
// else {
// int mid = ((firstIndex + lastIndex) /2);
// if(key == list[mid]) {
// keyIndex = mid;
// }
// else if(key < list[mid]) {
// keyIndex = binarySearch(list, key, firstIndex, mid - 1);
// }
// else
// binarySearch(list, key, mid + 1, lastIndex);
// }
// return keyIndex;
// }
// public static int[] selectionSort(int[] list, int lowIndex, int highIndex) {
// if(lowIndex < highIndex) {
// int indexNumberOfMinimumNumber = lowIndex;
// int minimumNumber = list[lowIndex];
// for(int i = lowIndex + 1; i <= highIndex; i++) {
// if(list[i] < minimumNumber) {
// minimumNumber = list[i];
// indexNumberOfMinimumNumber = i;
// }
// }
// }
// list[indexNumberOfMinimumNumber] = list[lowIndex];
// list[lowIndex] = minimumNumber;
// selectionSort(list, lowIndex + 1, highIndex);
// }
//
//}
|
package util;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVRecord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import shared.Instance;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class InstanceUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(InstanceUtil.class);
public static Instance[] loadInstances(String file, int numCols, boolean isHeader, int labelPos) {
List<Instance> samples = new ArrayList<>();
try {
Reader in = new FileReader(file);
Iterable<CSVRecord> records = null;
if (isHeader) {
records = CSVFormat.EXCEL.withHeader().parse(in);
} else {
records = CSVFormat.EXCEL.parse(in);
}
int rowCnt = 0;
for (CSVRecord record : records) {
if (record.size() != numCols) {
LOGGER.error("skipping row, since cols present:{} not equal to expected:{}", record.size(),
numCols);
}
double[] sampleAttributes = new double[numCols];
for (int i = 0; i < numCols; i++) {
sampleAttributes[i] = Double.parseDouble(record.get(i));
}
Instance label = new Instance(Double.parseDouble(record.get(labelPos)));
Instance sample = new Instance(sampleAttributes);
sample.setLabel(label);
LOGGER.debug("Row:[{}] Label value={} cols:{}", rowCnt, sample.getLabel(), sample.getData().size());
samples.add(sample);
rowCnt++;
}
} catch (FileNotFoundException e) {
LOGGER.error("Err: Could not read file", e);
} catch (IOException e) {
LOGGER.error("Err: Could not parse csv");
}
return samples.toArray(new Instance[samples.size()]);
}
public static List<Instance[]> testTrainSplit(Instance[] instances, int testFraction) {
List<Instance> instanceList = Arrays.asList(instances);
Collections.shuffle(instanceList);
List<Instance> testSet = new ArrayList<>(instanceList.subList(0, instanceList.size() / testFraction +
instanceList.size() % testFraction));
List<Instance> trainSet = new ArrayList<>(instanceList.subList(instanceList.size() / testFraction +
instanceList.size() % testFraction, instanceList.size()));
LOGGER.info("Train rows:{} Test rows:{}", trainSet.size(), testSet.size());
List<Instance[]> testTrainSplit = new ArrayList<>();
testTrainSplit.add(trainSet.toArray(new Instance[trainSet.size()]));
testTrainSplit.add(testSet.toArray(new Instance[testSet.size()]));
return testTrainSplit;
}
}
|
/**
*
* Question - The Heavy Pill
* Created by Yu Zheng on 10/1/2015
*
*/
public class Solution01 {
/**
* 1. First, we can take 1 pill for #1 bottle, take 2 pills from
* #2 bottle ... take 20 pills from #20 bottle.
* 2. Originally, the total weight of pills is (1 + 20) * 20 / 2 = 210 grams
* 3. and then, we use scale check the real weight of the total pill.
* 4. we use: (real weight - 210) / 0.1, so the result is the number of bottle
*
*/
} |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.abeam.itap.framework.repository;
import java.io.Serializable;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
*
* @author smiyazawa@abeam.com
*/
public class BaseJpaRepository3<T, ID extends Serializable> implements JpaRepository<T, ID> {
//@PersistenceContext
//protected EntityManager em;
@Override
public List<T> findAll() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public List<T> findAll(Iterable<ID> ids) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public <S extends T> List<S> save(Iterable<S> entities) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void flush() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public <S extends T> S saveAndFlush(S entity) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void deleteInBatch(Iterable<T> entities) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void deleteAllInBatch() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public T getOne(ID id) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
|
package edu.umn.cs.recsys.cbf;
import it.unimi.dsi.fastutil.longs.Long2DoubleMap;
import org.grouplens.lenskit.vectors.MutableSparseVector;
import org.lenskit.api.Result;
import org.lenskit.api.ResultMap;
import org.lenskit.basic.AbstractItemScorer;
import org.lenskit.data.dao.UserEventDAO;
import org.lenskit.data.ratings.Rating;
import org.lenskit.data.history.UserHistory;
import org.lenskit.results.Results;
import org.lenskit.util.math.Vectors;
import javax.annotation.Nonnull;
import javax.inject.Inject;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* @author <a href="http://www.grouplens.org">GroupLens Research</a>
*/
public class TFIDFItemScorer extends AbstractItemScorer {
private final UserEventDAO userEventDAO;
private final TFIDFModel model;
private final UserProfileBuilder profileBuilder;
/**
* Construct a new item scorer. LensKit's dependency injector will call this constructor and
* provide the appropriate parameters.
*
* @param uedao The user-event DAO, so we can fetch a user's ratings when scoring items for them.
* @param m The precomputed model containing the item tag vectors.
* @param upb The user profile builder for building user tag profiles.
*/
@Inject
public TFIDFItemScorer(UserEventDAO uedao, TFIDFModel m, UserProfileBuilder upb) {
this.userEventDAO = uedao;
model = m;
profileBuilder = upb;
}
/**
* Generate item scores personalized for a particular user. For the TFIDF scorer, this will
* prepare a user profile and compare it to item tag vectors to produce the score.
*
* @param user The user to score for.
* @param items A collection of item ids that should be scored.
*/
@Override
public ResultMap scoreWithDetails(long user, @Nonnull Collection<Long> items){
// Get the user's ratings
UserHistory<Rating> ratings = userEventDAO.getEventsForUser(user, Rating.class);
if (ratings == null) {
// the user doesn't exist, so return an empty ResultMap
return Results.newResultMap();
}
// Create a place to store the results of our score computations
List<Result> results = new ArrayList<>();
// Get the user's profile, which is a vector with their preference score for each tag
Long2DoubleMap userVector = profileBuilder.makeUserProfile(ratings);
MutableSparseVector userVectorSv = MutableSparseVector.create(userVector);
for (Long item: items) {
double score = 0;
Long2DoubleMap iv = model.getItemVector(item);
MutableSparseVector sv = MutableSparseVector.create(iv);
// Compute the cosine between this item's tag vector and the user's profile vector, and
// store it in the double variable score (which will be added to the result set).
// HINT Take a look at the Vectors class in org.lenskit.util.math.
score = userVectorSv.norm() * sv.norm();
sv.multiply(userVectorSv);
if (score != 0) {
score = sv.sum() / score;
}
// And remove this exception to say you've implemented it
// throw new UnsupportedOperationException("stub implementation");
// Store the results of our score computation
results.add(Results.create(item, score));
}
return Results.newResultMap(results);
}
}
|
/*
* Copyright © 2016, 2018 IBM Corp. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.ibm.cloudant.kafka.connect;
import com.cloudant.client.api.Database;
import com.cloudant.client.api.model.ChangesResult;
import com.cloudant.client.api.model.ChangesResult.Row;
import com.google.gson.JsonObject;
import com.ibm.cloudant.kafka.common.InterfaceConst;
import com.ibm.cloudant.kafka.common.MessageKey;
import com.ibm.cloudant.kafka.common.utils.JavaCloudantUtil;
import com.ibm.cloudant.kafka.common.utils.ResourceBundleUtil;
import com.ibm.cloudant.kafka.schema.DocumentAsSchemaStruct;
import org.apache.kafka.common.config.ConfigException;
import org.apache.kafka.connect.data.Schema;
import org.apache.kafka.connect.data.Struct;
import org.apache.kafka.connect.errors.ConnectException;
import org.apache.kafka.connect.source.SourceRecord;
import org.apache.kafka.connect.source.SourceTask;
import org.apache.kafka.connect.storage.OffsetStorageReader;
import org.apache.log4j.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
public class CloudantSourceTask extends SourceTask {
private static Logger LOG = Logger.getLogger(CloudantSourceTask.class);
private static final long FEED_SLEEP_MILLISEC = 5000;
private static final long SHUTDOWN_DELAY_MILLISEC = 10;
private static final String DEFAULT_CLOUDANT_LAST_SEQ = "0";
private AtomicBoolean stop;
private AtomicBoolean _running;
private String url = null;
private List<String> topics = null;
private boolean generateStructSchema = false;
private boolean flattenStructSchema = false;
private boolean omitDesignDocs = false;
private String latestSequenceNumber = null;
private int batch_size = 0;
private Database cloudantDb = null;
@Override
public List<SourceRecord> poll() throws InterruptedException {
// stop will be set but can be honored only after we release
// the changes() feed
while (!stop.get()) {
_running.set(true);
// the array to be returned
ArrayList<SourceRecord> records = new ArrayList<SourceRecord>();
LOG.debug("Process lastSeq: " + latestSequenceNumber);
// the changes feed for initial processing (not continuous yet)
ChangesResult cloudantChangesResult = cloudantDb.changes()
.includeDocs(true)
.since(latestSequenceNumber)
.limit(batch_size)
.getChanges();
if (cloudantDb.changes() != null) {
// This indicates that we have exhausted the initial feed
// and can request a continuous feed next
if (cloudantChangesResult.getResults().size() == 0) {
LOG.debug("Get continuous feed for lastSeq: " + latestSequenceNumber);
// the continuous changes feed
cloudantChangesResult = cloudantDb.changes()
.includeDocs(true)
.since(latestSequenceNumber)
.limit(batch_size)
//.continuousChanges()
/*
* => Removed because of performance (waiting time)
* Requests Change notifications of feed type continuous.
* Feed notifications are accessed in an iterator style.
* This method will connect to the changes feed; any configuration
* options applied after calling it will be ignored.
*/
.heartBeat(FEED_SLEEP_MILLISEC)
.getChanges();
}
LOG.debug("Got " + cloudantChangesResult.getResults().size() + " changes");
latestSequenceNumber = cloudantChangesResult.getLastSeq();
// process the results into the array to be returned
for (ListIterator<Row> it = cloudantChangesResult.getResults().listIterator(); it
.hasNext(); ) {
Row row_ = it.next();
JsonObject doc = row_.getDoc();
Schema docSchema;
Object docValue;
if (generateStructSchema) {
Struct docStruct = DocumentAsSchemaStruct.convert(doc, flattenStructSchema);
docSchema = docStruct.schema();
docValue = docStruct;
} else {
docSchema = Schema.STRING_SCHEMA;
docValue = doc.toString();
}
String id = row_.getId();
if (!omitDesignDocs || !id.startsWith("_design/")) {
// Emit the record to every topic configured
for (String topic : topics) {
SourceRecord sourceRecord = new SourceRecord(offsetKey(url),
offsetValue(latestSequenceNumber),
topic, // topics
//Integer.valueOf(row_.getId())%3, // partition
Schema.STRING_SCHEMA, // key schema
id, // key
docSchema, // value schema
docValue); // value
records.add(sourceRecord);
}
}
}
LOG.info("Return " + records.size() / topics.size() + " records with last offset "
+ latestSequenceNumber);
cloudantChangesResult = null;
_running.set(false);
return records;
}
}
// Only in case of shutdown
return null;
}
@Override
public void start(Map<String, String> props) {
try {
CloudantSourceTaskConfig config = new CloudantSourceTaskConfig(props);
url = config.getString(InterfaceConst.URL);
String userName = config.getString(InterfaceConst.USER_NAME);
String password = config.getPassword(InterfaceConst.PASSWORD).value();
topics = config.getList(InterfaceConst.TOPIC);
omitDesignDocs = config.getBoolean(InterfaceConst.OMIT_DESIGN_DOCS);
generateStructSchema = config.getBoolean(InterfaceConst.USE_VALUE_SCHEMA_STRUCT);
flattenStructSchema = config.getBoolean(InterfaceConst.FLATTEN_VALUE_SCHEMA_STRUCT);
latestSequenceNumber = config.getString(InterfaceConst.LAST_CHANGE_SEQ);
batch_size = config.getInt(InterfaceConst.BATCH_SIZE) == null ? InterfaceConst
.DEFAULT_BATCH_SIZE : config.getInt(InterfaceConst.BATCH_SIZE);
/*if (tasks_max > 1) {
throw new ConfigException("CouchDB _changes API only supports 1 thread. Configure
tasks.max=1");
}*/
_running = new AtomicBoolean(false);
stop = new AtomicBoolean(false);
if (latestSequenceNumber == null) {
latestSequenceNumber = DEFAULT_CLOUDANT_LAST_SEQ;
OffsetStorageReader offsetReader = context.offsetStorageReader();
if (offsetReader != null) {
Map<String, Object> offset = offsetReader.offset(Collections.singletonMap
(InterfaceConst.URL, url));
if (offset != null) {
latestSequenceNumber = (String) offset.get(InterfaceConst.LAST_CHANGE_SEQ);
LOG.info("Start with current offset (last sequence): " +
latestSequenceNumber);
}
}
}
cloudantDb = JavaCloudantUtil.getDBInst(url, userName, password, false);
} catch (ConfigException e) {
throw new ConnectException(ResourceBundleUtil.get(MessageKey.CONFIGURATION_EXCEPTION)
, e);
}
}
@Override
public void stop() {
if (stop != null) {
stop.set(true);
}
// terminate the changes feed
// Careful: this is an asynchronous call
if (cloudantDb.changes() != null) {
cloudantDb.changes().stop();
// graceful shutdown
// allow the poll() method to flush records first
if (_running == null) {
return;
}
while (_running.get()) {
try {
Thread.sleep(SHUTDOWN_DELAY_MILLISEC);
} catch (InterruptedException e) {
LOG.error(e);
}
}
}
}
private Map<String, String> offsetKey(String url) {
return Collections.singletonMap(InterfaceConst.URL, url);
}
private Map<String, String> offsetValue(String lastSeqNumber) {
return Collections.singletonMap(InterfaceConst.LAST_CHANGE_SEQ, lastSeqNumber);
}
public String version() {
return new CloudantSourceConnector().version();
}
}
|
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.struts.action.ActionErrors;
public final class logon_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static java.util.List _jspx_dependants;
static {
_jspx_dependants = new java.util.ArrayList(5);
_jspx_dependants.add("/WEB-INF/struts-html.tld");
_jspx_dependants.add("/WEB-INF/struts-layout.tld");
_jspx_dependants.add("/WEB-INF/struts-template.tld");
_jspx_dependants.add("/WEB-INF/struts-bean.tld");
_jspx_dependants.add("/WEB-INF/struts-logic.tld");
}
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005ftemplate_005finsert_005ftemplate;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005ftemplate_005fput_005fname_005fdirect_005fcontent_005fnobody;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005ftemplate_005fput_005fname;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005flayout_005fform_005fstyleClass_005ffocus_005faction;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005flayout_005ffield_005ftype_005fstyleClass_005fsize_005fproperty_005fmaxlength_005fkey_005fisRequired_005fnobody;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005flayout_005fspace_005fnobody;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005flayout_005fformActions;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005flayout_005fsubmit;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005flayout_005fmessage_005fkey_005fnobody;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005flayout_005freset;
public Object getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_005fjspx_005ftagPool_005ftemplate_005finsert_005ftemplate = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005ftemplate_005fput_005fname_005fdirect_005fcontent_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005ftemplate_005fput_005fname = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005flayout_005fform_005fstyleClass_005ffocus_005faction = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005flayout_005ffield_005ftype_005fstyleClass_005fsize_005fproperty_005fmaxlength_005fkey_005fisRequired_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005flayout_005fspace_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005flayout_005fformActions = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005flayout_005fsubmit = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005flayout_005fmessage_005fkey_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005flayout_005freset = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
}
public void _jspDestroy() {
_005fjspx_005ftagPool_005ftemplate_005finsert_005ftemplate.release();
_005fjspx_005ftagPool_005ftemplate_005fput_005fname_005fdirect_005fcontent_005fnobody.release();
_005fjspx_005ftagPool_005ftemplate_005fput_005fname.release();
_005fjspx_005ftagPool_005flayout_005fform_005fstyleClass_005ffocus_005faction.release();
_005fjspx_005ftagPool_005flayout_005ffield_005ftype_005fstyleClass_005fsize_005fproperty_005fmaxlength_005fkey_005fisRequired_005fnobody.release();
_005fjspx_005ftagPool_005flayout_005fspace_005fnobody.release();
_005fjspx_005ftagPool_005flayout_005fformActions.release();
_005fjspx_005ftagPool_005flayout_005fsubmit.release();
_005fjspx_005ftagPool_005flayout_005fmessage_005fkey_005fnobody.release();
_005fjspx_005ftagPool_005flayout_005freset.release();
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
if (_jspx_meth_template_005finsert_005f0(_jspx_page_context))
return;
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
}
}
private boolean _jspx_meth_template_005finsert_005f0(PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// template:insert
org.apache.struts.taglib.template.InsertTag _jspx_th_template_005finsert_005f0 = (org.apache.struts.taglib.template.InsertTag) _005fjspx_005ftagPool_005ftemplate_005finsert_005ftemplate.get(org.apache.struts.taglib.template.InsertTag.class);
_jspx_th_template_005finsert_005f0.setPageContext(_jspx_page_context);
_jspx_th_template_005finsert_005f0.setParent(null);
_jspx_th_template_005finsert_005f0.setTemplate("/view/templates/logout.jsp");
int _jspx_eval_template_005finsert_005f0 = _jspx_th_template_005finsert_005f0.doStartTag();
if (_jspx_eval_template_005finsert_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write("\r\n");
out.write("\r\n");
out.write("\t");
out.write("\r\n");
out.write(" ");
if (_jspx_meth_template_005fput_005f0(_jspx_th_template_005finsert_005f0, _jspx_page_context))
return true;
out.write("\r\n");
out.write(" \r\n");
out.write(" ");
out.write("\r\n");
out.write(" ");
if (_jspx_meth_template_005fput_005f1(_jspx_th_template_005finsert_005f0, _jspx_page_context))
return true;
out.write("\r\n");
out.write(" \r\n");
out.write(" ");
out.write("\r\n");
out.write(" ");
if (_jspx_meth_template_005fput_005f2(_jspx_th_template_005finsert_005f0, _jspx_page_context))
return true;
out.write('\r');
out.write('\n');
int evalDoAfterBody = _jspx_th_template_005finsert_005f0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_template_005finsert_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005ftemplate_005finsert_005ftemplate.reuse(_jspx_th_template_005finsert_005f0);
return true;
}
_005fjspx_005ftagPool_005ftemplate_005finsert_005ftemplate.reuse(_jspx_th_template_005finsert_005f0);
return false;
}
private boolean _jspx_meth_template_005fput_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_template_005finsert_005f0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// template:put
org.apache.struts.taglib.template.PutTag _jspx_th_template_005fput_005f0 = (org.apache.struts.taglib.template.PutTag) _005fjspx_005ftagPool_005ftemplate_005fput_005fname_005fdirect_005fcontent_005fnobody.get(org.apache.struts.taglib.template.PutTag.class);
_jspx_th_template_005fput_005f0.setPageContext(_jspx_page_context);
_jspx_th_template_005fput_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_template_005finsert_005f0);
_jspx_th_template_005fput_005f0.setName("titlePage");
_jspx_th_template_005fput_005f0.setContent("");
_jspx_th_template_005fput_005f0.setDirect("true");
int _jspx_eval_template_005fput_005f0 = _jspx_th_template_005fput_005f0.doStartTag();
if (_jspx_th_template_005fput_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005ftemplate_005fput_005fname_005fdirect_005fcontent_005fnobody.reuse(_jspx_th_template_005fput_005f0);
return true;
}
_005fjspx_005ftagPool_005ftemplate_005fput_005fname_005fdirect_005fcontent_005fnobody.reuse(_jspx_th_template_005fput_005f0);
return false;
}
private boolean _jspx_meth_template_005fput_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_template_005finsert_005f0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// template:put
org.apache.struts.taglib.template.PutTag _jspx_th_template_005fput_005f1 = (org.apache.struts.taglib.template.PutTag) _005fjspx_005ftagPool_005ftemplate_005fput_005fname_005fdirect_005fcontent_005fnobody.get(org.apache.struts.taglib.template.PutTag.class);
_jspx_th_template_005fput_005f1.setPageContext(_jspx_page_context);
_jspx_th_template_005fput_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_template_005finsert_005f0);
_jspx_th_template_005fput_005f1.setName("title");
_jspx_th_template_005fput_005f1.setContent("Ingreso a la Aplicacion");
_jspx_th_template_005fput_005f1.setDirect("true");
int _jspx_eval_template_005fput_005f1 = _jspx_th_template_005fput_005f1.doStartTag();
if (_jspx_th_template_005fput_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005ftemplate_005fput_005fname_005fdirect_005fcontent_005fnobody.reuse(_jspx_th_template_005fput_005f1);
return true;
}
_005fjspx_005ftagPool_005ftemplate_005fput_005fname_005fdirect_005fcontent_005fnobody.reuse(_jspx_th_template_005fput_005f1);
return false;
}
private boolean _jspx_meth_template_005fput_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_template_005finsert_005f0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// template:put
org.apache.struts.taglib.template.PutTag _jspx_th_template_005fput_005f2 = (org.apache.struts.taglib.template.PutTag) _005fjspx_005ftagPool_005ftemplate_005fput_005fname.get(org.apache.struts.taglib.template.PutTag.class);
_jspx_th_template_005fput_005f2.setPageContext(_jspx_page_context);
_jspx_th_template_005fput_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_template_005finsert_005f0);
_jspx_th_template_005fput_005f2.setName("content");
int _jspx_eval_template_005fput_005f2 = _jspx_th_template_005fput_005f2.doStartTag();
if (_jspx_eval_template_005fput_005f2 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_template_005fput_005f2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_template_005fput_005f2.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_template_005fput_005f2.doInitBody();
}
do {
out.write("\r\n");
out.write(" \r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
if (_jspx_meth_layout_005fform_005f0(_jspx_th_template_005fput_005f2, _jspx_page_context))
return true;
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_template_005fput_005f2.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_template_005fput_005f2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.popBody();
}
}
if (_jspx_th_template_005fput_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005ftemplate_005fput_005fname.reuse(_jspx_th_template_005fput_005f2);
return true;
}
_005fjspx_005ftagPool_005ftemplate_005fput_005fname.reuse(_jspx_th_template_005fput_005f2);
return false;
}
private boolean _jspx_meth_layout_005fform_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_template_005fput_005f2, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// layout:form
fr.improve.struts.taglib.layout.FormTag _jspx_th_layout_005fform_005f0 = (fr.improve.struts.taglib.layout.FormTag) _005fjspx_005ftagPool_005flayout_005fform_005fstyleClass_005ffocus_005faction.get(fr.improve.struts.taglib.layout.FormTag.class);
_jspx_th_layout_005fform_005f0.setPageContext(_jspx_page_context);
_jspx_th_layout_005fform_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_template_005fput_005f2);
_jspx_th_layout_005fform_005f0.setAction("/verifyLogon.do");
_jspx_th_layout_005fform_005f0.setFocus("username");
_jspx_th_layout_005fform_005f0.setStyleClass("BODY");
int _jspx_eval_layout_005fform_005f0 = _jspx_th_layout_005fform_005f0.doStartTag();
if (_jspx_eval_layout_005fform_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write("\r\n");
out.write(" \r\n");
out.write(" \r\n");
out.write(" <input type=\"hidden\" name=\"reqCode\" value =\"start\" >\r\n");
out.write(" ");
if (_jspx_meth_layout_005ffield_005f0(_jspx_th_layout_005fform_005f0, _jspx_page_context))
return true;
out.write("\r\n");
out.write(" ");
if (_jspx_meth_layout_005ffield_005f1(_jspx_th_layout_005fform_005f0, _jspx_page_context))
return true;
out.write("\r\n");
out.write(" \r\n");
out.write("\t\t\t\t\t\t\t\r\n");
out.write("\t");
if (_jspx_meth_layout_005fspace_005f0(_jspx_th_layout_005fform_005f0, _jspx_page_context))
return true;
out.write("\r\n");
out.write("\t\r\n");
out.write(" ");
if (_jspx_meth_layout_005fformActions_005f0(_jspx_th_layout_005fform_005f0, _jspx_page_context))
return true;
out.write("\r\n");
out.write(" \r\n");
int evalDoAfterBody = _jspx_th_layout_005fform_005f0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_layout_005fform_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005flayout_005fform_005fstyleClass_005ffocus_005faction.reuse(_jspx_th_layout_005fform_005f0);
return true;
}
_005fjspx_005ftagPool_005flayout_005fform_005fstyleClass_005ffocus_005faction.reuse(_jspx_th_layout_005fform_005f0);
return false;
}
private boolean _jspx_meth_layout_005ffield_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_layout_005fform_005f0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// layout:field
fr.improve.struts.taglib.layout.FieldTag _jspx_th_layout_005ffield_005f0 = (fr.improve.struts.taglib.layout.FieldTag) _005fjspx_005ftagPool_005flayout_005ffield_005ftype_005fstyleClass_005fsize_005fproperty_005fmaxlength_005fkey_005fisRequired_005fnobody.get(fr.improve.struts.taglib.layout.FieldTag.class);
_jspx_th_layout_005ffield_005f0.setPageContext(_jspx_page_context);
_jspx_th_layout_005ffield_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_layout_005fform_005f0);
_jspx_th_layout_005ffield_005f0.setKey("prompt.username");
_jspx_th_layout_005ffield_005f0.setProperty("username");
_jspx_th_layout_005ffield_005f0.setSize("16");
_jspx_th_layout_005ffield_005f0.setMaxlength("16");
_jspx_th_layout_005ffield_005f0.setIsRequired("true");
_jspx_th_layout_005ffield_005f0.setStyleClass("LABEL");
_jspx_th_layout_005ffield_005f0.setType("text");
int _jspx_eval_layout_005ffield_005f0 = _jspx_th_layout_005ffield_005f0.doStartTag();
if (_jspx_th_layout_005ffield_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005flayout_005ffield_005ftype_005fstyleClass_005fsize_005fproperty_005fmaxlength_005fkey_005fisRequired_005fnobody.reuse(_jspx_th_layout_005ffield_005f0);
return true;
}
_005fjspx_005ftagPool_005flayout_005ffield_005ftype_005fstyleClass_005fsize_005fproperty_005fmaxlength_005fkey_005fisRequired_005fnobody.reuse(_jspx_th_layout_005ffield_005f0);
return false;
}
private boolean _jspx_meth_layout_005ffield_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_layout_005fform_005f0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// layout:field
fr.improve.struts.taglib.layout.FieldTag _jspx_th_layout_005ffield_005f1 = (fr.improve.struts.taglib.layout.FieldTag) _005fjspx_005ftagPool_005flayout_005ffield_005ftype_005fstyleClass_005fsize_005fproperty_005fmaxlength_005fkey_005fisRequired_005fnobody.get(fr.improve.struts.taglib.layout.FieldTag.class);
_jspx_th_layout_005ffield_005f1.setPageContext(_jspx_page_context);
_jspx_th_layout_005ffield_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_layout_005fform_005f0);
_jspx_th_layout_005ffield_005f1.setKey("prompt.password");
_jspx_th_layout_005ffield_005f1.setProperty("password");
_jspx_th_layout_005ffield_005f1.setSize("16");
_jspx_th_layout_005ffield_005f1.setMaxlength("16");
_jspx_th_layout_005ffield_005f1.setType("password");
_jspx_th_layout_005ffield_005f1.setStyleClass("LABEL");
_jspx_th_layout_005ffield_005f1.setIsRequired("true");
int _jspx_eval_layout_005ffield_005f1 = _jspx_th_layout_005ffield_005f1.doStartTag();
if (_jspx_th_layout_005ffield_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005flayout_005ffield_005ftype_005fstyleClass_005fsize_005fproperty_005fmaxlength_005fkey_005fisRequired_005fnobody.reuse(_jspx_th_layout_005ffield_005f1);
return true;
}
_005fjspx_005ftagPool_005flayout_005ffield_005ftype_005fstyleClass_005fsize_005fproperty_005fmaxlength_005fkey_005fisRequired_005fnobody.reuse(_jspx_th_layout_005ffield_005f1);
return false;
}
private boolean _jspx_meth_layout_005fspace_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_layout_005fform_005f0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// layout:space
fr.improve.struts.taglib.layout.EmptyTag _jspx_th_layout_005fspace_005f0 = (fr.improve.struts.taglib.layout.EmptyTag) _005fjspx_005ftagPool_005flayout_005fspace_005fnobody.get(fr.improve.struts.taglib.layout.EmptyTag.class);
_jspx_th_layout_005fspace_005f0.setPageContext(_jspx_page_context);
_jspx_th_layout_005fspace_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_layout_005fform_005f0);
int _jspx_eval_layout_005fspace_005f0 = _jspx_th_layout_005fspace_005f0.doStartTag();
if (_jspx_th_layout_005fspace_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005flayout_005fspace_005fnobody.reuse(_jspx_th_layout_005fspace_005f0);
return true;
}
_005fjspx_005ftagPool_005flayout_005fspace_005fnobody.reuse(_jspx_th_layout_005fspace_005f0);
return false;
}
private boolean _jspx_meth_layout_005fformActions_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_layout_005fform_005f0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// layout:formActions
fr.improve.struts.taglib.layout.FormActions _jspx_th_layout_005fformActions_005f0 = (fr.improve.struts.taglib.layout.FormActions) _005fjspx_005ftagPool_005flayout_005fformActions.get(fr.improve.struts.taglib.layout.FormActions.class);
_jspx_th_layout_005fformActions_005f0.setPageContext(_jspx_page_context);
_jspx_th_layout_005fformActions_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_layout_005fform_005f0);
int _jspx_eval_layout_005fformActions_005f0 = _jspx_th_layout_005fformActions_005f0.doStartTag();
if (_jspx_eval_layout_005fformActions_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write("\r\n");
out.write(" \r\n");
out.write("\t\t\t");
if (_jspx_meth_layout_005fsubmit_005f0(_jspx_th_layout_005fformActions_005f0, _jspx_page_context))
return true;
out.write("\r\n");
out.write("\r\n");
out.write(" \t\t\t");
if (_jspx_meth_layout_005freset_005f0(_jspx_th_layout_005fformActions_005f0, _jspx_page_context))
return true;
out.write("\r\n");
out.write("\t\t\t\r\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_layout_005fformActions_005f0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_layout_005fformActions_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005flayout_005fformActions.reuse(_jspx_th_layout_005fformActions_005f0);
return true;
}
_005fjspx_005ftagPool_005flayout_005fformActions.reuse(_jspx_th_layout_005fformActions_005f0);
return false;
}
private boolean _jspx_meth_layout_005fsubmit_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_layout_005fformActions_005f0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// layout:submit
fr.improve.struts.taglib.layout.SubmitTag _jspx_th_layout_005fsubmit_005f0 = (fr.improve.struts.taglib.layout.SubmitTag) _005fjspx_005ftagPool_005flayout_005fsubmit.get(fr.improve.struts.taglib.layout.SubmitTag.class);
_jspx_th_layout_005fsubmit_005f0.setPageContext(_jspx_page_context);
_jspx_th_layout_005fsubmit_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_layout_005fformActions_005f0);
int _jspx_eval_layout_005fsubmit_005f0 = _jspx_th_layout_005fsubmit_005f0.doStartTag();
if (_jspx_eval_layout_005fsubmit_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_layout_005fsubmit_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_layout_005fsubmit_005f0.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_layout_005fsubmit_005f0.doInitBody();
}
do {
out.write("\r\n");
out.write("\t\t\t\t");
if (_jspx_meth_layout_005fmessage_005f0(_jspx_th_layout_005fsubmit_005f0, _jspx_page_context))
return true;
out.write("\r\n");
out.write("\t\t\t");
int evalDoAfterBody = _jspx_th_layout_005fsubmit_005f0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_layout_005fsubmit_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.popBody();
}
}
if (_jspx_th_layout_005fsubmit_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005flayout_005fsubmit.reuse(_jspx_th_layout_005fsubmit_005f0);
return true;
}
_005fjspx_005ftagPool_005flayout_005fsubmit.reuse(_jspx_th_layout_005fsubmit_005f0);
return false;
}
private boolean _jspx_meth_layout_005fmessage_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_layout_005fsubmit_005f0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// layout:message
fr.improve.struts.taglib.layout.MessageTag _jspx_th_layout_005fmessage_005f0 = (fr.improve.struts.taglib.layout.MessageTag) _005fjspx_005ftagPool_005flayout_005fmessage_005fkey_005fnobody.get(fr.improve.struts.taglib.layout.MessageTag.class);
_jspx_th_layout_005fmessage_005f0.setPageContext(_jspx_page_context);
_jspx_th_layout_005fmessage_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_layout_005fsubmit_005f0);
_jspx_th_layout_005fmessage_005f0.setKey("button.ingresar");
int _jspx_eval_layout_005fmessage_005f0 = _jspx_th_layout_005fmessage_005f0.doStartTag();
if (_jspx_th_layout_005fmessage_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005flayout_005fmessage_005fkey_005fnobody.reuse(_jspx_th_layout_005fmessage_005f0);
return true;
}
_005fjspx_005ftagPool_005flayout_005fmessage_005fkey_005fnobody.reuse(_jspx_th_layout_005fmessage_005f0);
return false;
}
private boolean _jspx_meth_layout_005freset_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_layout_005fformActions_005f0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// layout:reset
fr.improve.struts.taglib.layout.ResetTag _jspx_th_layout_005freset_005f0 = (fr.improve.struts.taglib.layout.ResetTag) _005fjspx_005ftagPool_005flayout_005freset.get(fr.improve.struts.taglib.layout.ResetTag.class);
_jspx_th_layout_005freset_005f0.setPageContext(_jspx_page_context);
_jspx_th_layout_005freset_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_layout_005fformActions_005f0);
int _jspx_eval_layout_005freset_005f0 = _jspx_th_layout_005freset_005f0.doStartTag();
if (_jspx_eval_layout_005freset_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_layout_005freset_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_layout_005freset_005f0.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_layout_005freset_005f0.doInitBody();
}
do {
out.write("\r\n");
out.write("\t\t\t\t");
if (_jspx_meth_layout_005fmessage_005f1(_jspx_th_layout_005freset_005f0, _jspx_page_context))
return true;
out.write("\r\n");
out.write("\t\t\t");
int evalDoAfterBody = _jspx_th_layout_005freset_005f0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_layout_005freset_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.popBody();
}
}
if (_jspx_th_layout_005freset_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005flayout_005freset.reuse(_jspx_th_layout_005freset_005f0);
return true;
}
_005fjspx_005ftagPool_005flayout_005freset.reuse(_jspx_th_layout_005freset_005f0);
return false;
}
private boolean _jspx_meth_layout_005fmessage_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_layout_005freset_005f0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// layout:message
fr.improve.struts.taglib.layout.MessageTag _jspx_th_layout_005fmessage_005f1 = (fr.improve.struts.taglib.layout.MessageTag) _005fjspx_005ftagPool_005flayout_005fmessage_005fkey_005fnobody.get(fr.improve.struts.taglib.layout.MessageTag.class);
_jspx_th_layout_005fmessage_005f1.setPageContext(_jspx_page_context);
_jspx_th_layout_005fmessage_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_layout_005freset_005f0);
_jspx_th_layout_005fmessage_005f1.setKey("button.reset");
int _jspx_eval_layout_005fmessage_005f1 = _jspx_th_layout_005fmessage_005f1.doStartTag();
if (_jspx_th_layout_005fmessage_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005flayout_005fmessage_005fkey_005fnobody.reuse(_jspx_th_layout_005fmessage_005f1);
return true;
}
_005fjspx_005ftagPool_005flayout_005fmessage_005fkey_005fnobody.reuse(_jspx_th_layout_005fmessage_005f1);
return false;
}
}
|
package com.liufeng.controller;
import com.liufeng.common.annotation.PageQuery;
import com.liufeng.common.utils.ResultModel;
import com.liufeng.domian.dto.base.BaseId;
import com.liufeng.domian.dto.base.BasePageQuery;
import com.liufeng.domian.dto.request.ChangePassRequestDTO;
import com.liufeng.domian.dto.request.UserGetRequestDTO;
import com.liufeng.domian.dto.request.UserLoginRequestDTO;
import com.liufeng.domian.dto.request.UserModifyRequestDTO;
import com.liufeng.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
@RestController
@RequestMapping("user")
@Api(tags = "用户表相关操作")
public class UserController {
@Autowired
UserService userService;
@PostMapping("all")
@ApiOperation(value = "获取所有用户表数据")
@PageQuery
public ResultModel getList(@RequestBody BasePageQuery page) {
return ResultModel.success(userService.getAllList(page));
}
@PostMapping("userByPhone")
@ApiOperation(value = "根据手机号获取用户数据")
@PageQuery
public ResultModel ListByType(@RequestBody @Valid UserGetRequestDTO user) {
return ResultModel.success(userService.getUserByPhone(user.getPhone()));
}
@PostMapping("del")
@ApiOperation(value = "根据ID删除字典表数据")
public ResultModel del(@RequestBody BaseId id) {
userService.delUser(id.getId());
return ResultModel.success();
}
@PostMapping("modify")
@ApiOperation(value = "根据Type获取字典表数据")
public ResultModel listByType(@RequestBody @Valid UserModifyRequestDTO user) {
if (user.getId() == null) {
userService.addUser(user);
} else {
userService.updateUser(user);
}
return ResultModel.success();
}
@PostMapping("anon/verifyCode")
@ApiOperation(value = "发送验证码")
public ResultModel sendCode(@RequestBody @Valid UserGetRequestDTO user) {
return ResultModel.success(userService.sendVerityCode(user.getPhone()));
}
@PostMapping("anon/changePass")
@ApiOperation(value = "修改密码")
public ResultModel changePass(@RequestBody @Valid ChangePassRequestDTO user) {
userService.changePass(user);
return ResultModel.success();
}
@PostMapping("anon/login")
@ApiOperation(value = "用户登录")
public ResultModel login(@RequestBody @Valid UserLoginRequestDTO user) {
return ResultModel.success( userService.login(user));
}
}
|
package com.gzone.ecommerce.service;
import java.util.List;
import com.gzone.ecommerce.exceptions.DataException;
import com.gzone.ecommerce.exceptions.DuplicateInstanceException;
import com.gzone.ecommerce.exceptions.InstanceNotFoundException;
import com.gzone.ecommerce.model.Producto;
public interface ProductoService {
public List<Producto> findByCriteria(ProductoCriteria Producto, int startIndex, int count, String idioma)
throws DataException;
public List<Producto> findAll(int startIndex, int count, String idioma)
throws DataException;
public Producto findById(Long id, String idioma)
throws InstanceNotFoundException, DataException;
public Boolean exists(Long id)
throws DataException;
public long countAll()
throws DataException;
public Producto create(Producto p)
throws DuplicateInstanceException, DataException;
public void update(Producto p)
throws InstanceNotFoundException, DataException;
public long delete(Long integer)
throws InstanceNotFoundException, DataException;
}
|
/**
*
* @Title: FreemarkController.java
* @Package com.yqwl.controller
* @Description: TODO)
* @author zhoujiaxin
* @date 2019年4月20日
*/
package com.yqwl.controller;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.yqwl.dao.NewsMapper;
import com.yqwl.dao.WantedMapper;
import com.yqwl.dao.WelfareMapper;
import com.yqwl.pojo.Img;
import com.yqwl.pojo.Information;
import com.yqwl.pojo.News;
import com.yqwl.pojo.Text;
import com.yqwl.pojo.Wanted;
import com.yqwl.pojo.Welfare;
import com.yqwl.service.ImgService;
import com.yqwl.service.InformationService;
import com.yqwl.service.NewsService;
import com.yqwl.service.PartnerService;
import com.yqwl.service.StaticPageService;
import com.yqwl.service.TextService;
/**
*
* @Description
*
* @author zhoujiaxin
* @createDate 2019年4月20日
*/
@Controller
public class FreemarkController {
@Autowired
private StaticPageService staticPageService;
@Autowired
private TextService textService;
@Autowired
private InformationService informationService;
@Resource
private PartnerService partnerService;
@Resource
private NewsService newService; //新闻咨询方法层
@Autowired
private ImgService imgService;
@Resource
private WelfareMapper welfareMapper;
@Resource
private WantedMapper wantedMapper;
@Resource
private NewsMapper newsMapper;
/**
* @Title: staticAllPage
* @description 一键生成静态化页面
* @param @return
* @return Map<String,Object>
* @author zhoujiaxin
* @createDate 2019年4月20日
*/
@ResponseBody
@RequestMapping("/staticAllPage")
public Map<String, Object> staticAllPage() {
Map<String, Object> map = new HashMap<>();
// 01、静态化首页
// 遍历图片管理信息
List<Img> listImage = imgService.listAllImageForMain();
if (listImage.size()>0) {
for (int i = 0; i < listImage.size(); i++) {
Img img = listImage.get(i);
if (img.getImageNumber()==2001) {map.put("s2001",img.getImgUrl());}
if (img.getImageNumber()==2002) {map.put("s2002",img.getImgUrl());}
if (img.getImageNumber()==2003) {map.put("s2003",img.getImgUrl());}
if (img.getImageNumber()==2004) {map.put("s2004",img.getImgUrl());}
if (img.getImageNumber()==2005) {map.put("s2005",img.getImgUrl());}
if (img.getImageNumber()==2006) {map.put("s2006",img.getImgUrl());}
if (img.getImageNumber()==2007) {map.put("s2007",img.getImgUrl());}
if (img.getImageNumber()==2008) {map.put("s2008",img.getImgUrl());}
if (img.getImageNumber()==2009) {map.put("s2009",img.getImgUrl());}
if (img.getImageNumber()==2010) {map.put("s2010",img.getImgUrl());}
if (img.getImageNumber()==2011) {map.put("s2011",img.getImgUrl());}
if (img.getImageNumber()==2012) {map.put("s2012",img.getImgUrl());}
if (img.getImageNumber()==2013) {map.put("s2013",img.getImgUrl());}
if (img.getImageNumber()==2014) {map.put("s2014",img.getImgUrl());}
if (img.getImageNumber()==2015) {map.put("s2015",img.getImgUrl());}
if (img.getImageNumber()==2016) {map.put("s2016",img.getImgUrl());}
if (img.getImageNumber()==2017) {map.put("s2017",img.getImgUrl());}
if (img.getImageNumber()==2018) {map.put("s2018",img.getImgUrl());}
if (img.getImageNumber()==2019) {map.put("s2019",img.getImgUrl());}
if (img.getImageNumber()==2020) {map.put("s2020",img.getImgUrl());}
if (img.getImageNumber()==2021) {map.put("s2021",img.getImgUrl());}
if (img.getImageNumber()==2022) {map.put("s2022",img.getImgUrl());}
if (img.getImageNumber()==2023) {map.put("s2023",img.getImgUrl());}
if (img.getImageNumber()==2024) {map.put("s2024",img.getImgUrl());}
if (img.getImageNumber()==2025) {map.put("s2025",img.getImgUrl());}
if (img.getImageNumber()==2026) {map.put("s2026",img.getImgUrl());}
if (img.getImageNumber()==2027) {map.put("s2027",img.getImgUrl());}
if (img.getImageNumber()==2028) {map.put("s2028",img.getImgUrl());}
if (img.getImageNumber()==2029) {map.put("s2029",img.getImgUrl());}
if (img.getImageNumber()==2030) {map.put("s2030",img.getImgUrl());}
if (img.getImageNumber()==2031) {map.put("s2031",img.getImgUrl());}
if (img.getImageNumber()==2032) {map.put("s2032",img.getImgUrl());}
if (img.getImageNumber()==2033) {map.put("s2033",img.getImgUrl());}
if (img.getImageNumber()==2034) {map.put("s2034",img.getImgUrl());}
if (img.getImageNumber()==2035) {map.put("s2035",img.getImgUrl());}
if (img.getImageNumber()==2036) {map.put("s2036",img.getImgUrl());}
if (img.getImageNumber()==2037) {map.put("s2037",img.getImgUrl());}
if (img.getImageNumber()==2038) {map.put("s2038",img.getImgUrl());}
//员工风采添加三张图
if (img.getImageNumber()==2039) {map.put("s2039",img.getImgUrl());}
if (img.getImageNumber()==2040) {map.put("s2040",img.getImgUrl());}
if (img.getImageNumber()==2044) {map.put("s2044",img.getImgUrl());}
//办公环境添加三张图
if (img.getImageNumber()==2041) {map.put("s2041",img.getImgUrl());}
if (img.getImageNumber()==2042) {map.put("s2042",img.getImgUrl());}
if (img.getImageNumber()==2043) {map.put("s2043",img.getImgUrl());}
}
}
// 遍历文字管理信息
List<Text> listAllText = textService.listAllTextForMain();
if (listAllText.size()>0) {
for (int i = 0; i < listAllText.size(); i++) {
Text text = listAllText.get(i);
if (text.getTextNumber()==101) {map.put("s101",text.getTextInfo());}
if (text.getTextNumber()==1001) {map.put("s1001",text.getTextInfo());}
if (text.getTextNumber()==1002) {map.put("s1002",text.getTextInfo());}
if (text.getTextNumber()==1003) {map.put("s1003",text.getTextInfo());}
if (text.getTextNumber()==1004) {map.put("s1004",text.getTextInfo());}
if (text.getTextNumber()==1005) {map.put("s1005",text.getTextInfo());}
if (text.getTextNumber()==1006) {map.put("s1006",text.getTextInfo());}
if (text.getTextNumber()==1007) {map.put("s1007",text.getTextInfo());}
if (text.getTextNumber()==1008) {map.put("s1008",text.getTextInfo());}
if (text.getTextNumber()==1009) {map.put("s1009",text.getTextInfo());}
if (text.getTextNumber()==1010) {map.put("s1010",text.getTextInfo());}
if (text.getTextNumber()==1011) {map.put("s1011",text.getTextInfo());}
if (text.getTextNumber()==1012) {map.put("s1012",text.getTextInfo());}
if (text.getTextNumber()==1013) {map.put("s1013",text.getTextInfo());}
if (text.getTextNumber()==1014) {map.put("s1014",text.getTextInfo());}
if (text.getTextNumber()==1015) {map.put("s1015",text.getTextInfo());}
if (text.getTextNumber()==1016) {map.put("s1016",text.getTextInfo());}
if (text.getTextNumber()==1017) {map.put("s1017",text.getTextInfo());}
if (text.getTextNumber()==1018) {map.put("s1018",text.getTextInfo());}
if (text.getTextNumber()==1019) {map.put("s1019",text.getTextInfo());}
if (text.getTextNumber()==1020) {map.put("s1020",text.getTextInfo());}
if (text.getTextNumber()==1021) {map.put("s1021",text.getTextInfo());}
if (text.getTextNumber()==1022) {map.put("s1022",text.getTextInfo());}
if (text.getTextNumber()==1023) {map.put("s1023",text.getTextInfo());}
if (text.getTextNumber()==1024) {map.put("s1024",text.getTextInfo());}
if (text.getTextNumber()==1025) {map.put("s1025",text.getTextInfo());}
if (text.getTextNumber()==1026) {map.put("s1026",text.getTextInfo());}
if (text.getTextNumber()==1027) {map.put("s1027",text.getTextInfo());}
if (text.getTextNumber()==1028) {map.put("s1028",text.getTextInfo());}
if (text.getTextNumber()==1029) {map.put("s1029",text.getTextInfo());}
if (text.getTextNumber()==1030) {map.put("s1030",text.getTextInfo());}
if (text.getTextNumber()==1031) {map.put("s1031",text.getTextInfo());}
if (text.getTextNumber()==1032) {map.put("s1032",text.getTextInfo());}
if (text.getTextNumber()==1033) {map.put("s1033",text.getTextInfo());}
if (text.getTextNumber()==1034) {map.put("s1034",text.getTextInfo());}
if (text.getTextNumber()==1035) {map.put("s1035",text.getTextInfo());}
if (text.getTextNumber()==1036) {map.put("s1036",text.getTextInfo());}
if (text.getTextNumber()==1037) {map.put("s1037",text.getTextInfo());}
if (text.getTextNumber()==1038) {map.put("s1038",text.getTextInfo());}
if (text.getTextNumber()==1039) {map.put("s1039",text.getTextInfo());}
if (text.getTextNumber()==1040) {map.put("s1040",text.getTextInfo());}
if (text.getTextNumber()==1041) {map.put("s1041",text.getTextInfo());}
if (text.getTextNumber()==1042) {map.put("s1042",text.getTextInfo());}
if (text.getTextNumber()==1043) {map.put("s1043",text.getTextInfo());}
if (text.getTextNumber()==1044) {map.put("s1044",text.getTextInfo());}
if (text.getTextNumber()==1045) {map.put("s1045",text.getTextInfo());}
if (text.getTextNumber()==1046) {map.put("s1046",text.getTextInfo());}
if (text.getTextNumber()==1047) {map.put("s1047",text.getTextInfo());}
if (text.getTextNumber()==1048) {map.put("s1048",text.getTextInfo());}
if (text.getTextNumber()==1049) {map.put("s1049",text.getTextInfo());}
if (text.getTextNumber()==1050) {map.put("s1050",text.getTextInfo());}
}
}
Map<String,Object> partners = partnerService.listPartner(null, null);
List<Information> listInformation = informationService.getInformation();
map.put("information", listInformation.get(0));
map.put("listPartner", partners.get("listPartner"));
staticPageService.indexStatic(map, "index", "front/index/index");
// 02、静态化关于我们页面
staticPageService.indexStatic(map, "about", "front/about/about");
// 03、静态化案例页面
staticPageService.indexStatic(map, "case", "front/case/case");
// 04、静态化优势页面
staticPageService.indexStatic(map, "advantage", "front/advantage/advantage");
// 05、静态化团队页面
staticPageService.indexStatic(map, "team", "front/team/team");
// 07、静态化联系我们页面
staticPageService.indexStatic(map, "contactUs", "front/contactUs/contactUs");
// 09、静态化模版页面
staticPageService.indexStatic(map, "mould", "front/mould/mould");
// 06、静态化招聘页面
List<Wanted> wantedList = wantedMapper.listWanted(0, 100);
map.put("wantedList", wantedList);
List<Welfare> result = welfareMapper.listWelfare(0, 20);
map.put("welfareList", result);
staticPageService.indexStatic(map, "employeePage", "front/recruit/recruit");
// 08、静态化新闻详情页面
List<News> newsList = newsMapper.listAll(0, 500);
if (newsList.size()>0) {
for(int i = 0 ;i<newsList.size();i++){
map.put("news", newsList.get(i));
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
String str = sdf.format(newsList.get(i).getTime());
map.put("time", str);
staticPageService.indexStatic(map, "news"+newsList.get(i).getId(), "front/index/newsInfo");
}
}
Map<String, Object> map2 = new HashMap<>();
map2.put("code", 1);
return map2;
}
}
|
package com.ys.service;
import org.springframework.stereotype.Service;
import java.util.Random;
/**
* Created by yushi on 2017/3/20.
*/
@Service
public class ThreadServiceImpl extends Thread implements ThreadService {
@Override
public void run() {
String tname = Thread.currentThread().getName();
System.out.println(tname + "被调用");
Random random = new Random();
for (int i = 0; i < 20; i++) {
try {
Thread.sleep(random.nextInt(10) * 500);
System.out.println(tname );
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
/**
* start,正确开启多线程的方法
* 交替执行
* 主线程执行完成不影响线程的执行
* Thread-4被调用
Thread-5被调用
Thread-5
Thread-5
Thread-4
Thread-4
Thread-5
Thread-4
Thread-5
*/
@Override
public void getthread() {
ThreadServiceImpl thread1 = new ThreadServiceImpl();
ThreadServiceImpl thread2 = new ThreadServiceImpl();
thread1.start();
thread2.start();
}
/**
* 如果是run方法,则是普通方法的调用,没有开启多线程
* http-nio-8080-exec-2
http-nio-8080-exec-2
http-nio-8080-exec-2
http-nio-8080-exec-2
*/
@Override
public void getrin() {
ThreadServiceImpl thread1 = new ThreadServiceImpl();
ThreadServiceImpl thread2 = new ThreadServiceImpl();
thread1.run();
thread2.run();
}
}
|
package a_firstexp;
import java.util.Scanner;
public class RemoveDuplicates {
private static int count;
public static void main(String[] args) {
int i, temp, flag;
Scanner scanner = new Scanner(System.in);
System.out.println("输入数组长度 ");
count = scanner.nextInt();
int[] a = new int[count];
for (i = 0; i < count; i++) {
a[i] = scanner.nextInt();
}
//排序 从小到大 冒泡算法
for (i = count; i > 0; i--) { //count is the length of Array
flag = 0; //flag is to judge whether sort is done
for (int j = 0; j < i - 1; j++) {
if (a[j] > a[j + 1]) {
temp = a[j + 1];
a[j + 1] = a[j];
a[j] = temp;
flag++;
}
}
if (flag == 0) {
break;
}
}
//删去重复元素
for (i = 0; i < count - 1; i++) {
if (a[i] == a[i + 1]) {
for (int j = i + 1; j < count - 1; j++) {
a[j] = a[j + 1];
}
count--;
i--;
}
}
System.out.println("数组长度 " + count);
for (i = 0; i < count; i++) {
System.out.print(a[i] + " ");
}
}
}
|
package com.tencent.mm.plugin.gallery.view;
import com.tencent.mm.plugin.gallery.view.MultiGestureImageView.j;
class MultiGestureImageView$j$1 implements Runnable {
final /* synthetic */ MultiGestureImageView jFs;
final /* synthetic */ j jFt;
MultiGestureImageView$j$1(j jVar, MultiGestureImageView multiGestureImageView) {
this.jFt = jVar;
this.jFs = multiGestureImageView;
}
public final void run() {
}
}
|
package com.ddt.daoInter;
import java.util.List;
import com.ddt.bean.Userinfo;
//import Bean.UserInfo;
public interface UserDaoInter {
// 增加学生信息
public void addUser(Userinfo user);
// 查找全部学生信息
public List findAllUser();
//按条件id查找部分学生
// public Student findUserById(Student stu);
//修改学生信息
public void updateUser(Userinfo user);
//删除学生信息
public void deleteUser(Userinfo user);
//根据用户名获取用户信息
public Userinfo getUser(String username);
}
|
package br.com.teste.agenda.service.command;
import br.com.teste.agenda.dto.command.ContatoCommandDto;
public interface IContatoCommandService {
ContatoCommandDto salvar(ContatoCommandDto contato);
void remover(String idContato);
}
|
package com.tencent.mm.plugin.card.ui.view;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.widget.TextView;
import com.tencent.mm.plugin.card.a$e;
import com.tencent.mm.plugin.card.a.c;
import com.tencent.mm.plugin.card.a.d;
import com.tencent.mm.plugin.card.base.b;
import com.tencent.mm.plugin.card.d.l;
import com.tencent.mm.plugin.card.ui.a.g;
import com.tencent.mm.protocal.c.pr;
import com.tencent.mm.ui.MMActivity;
import com.tencent.mm.ui.y;
import java.util.Iterator;
import java.util.LinkedList;
public final class w extends i {
private View hIb;
private View hIc;
public final void initView() {
}
public final void update() {
b ayu = this.hHF.ayu();
g ayz = this.hHF.ayz();
pr prVar;
if (ayu.awn().rnd != null && ayu.awn().rnd.size() > 1) {
if (this.hIb == null) {
this.hIb = ((ViewStub) findViewById(d.card_secondary_field_stub)).inflate();
}
if (this.hIc != null) {
this.hIc.setVisibility(8);
}
MMActivity ayx = this.hHF.ayx();
View view = this.hIb;
OnClickListener ayy = this.hHF.ayy();
LinkedList linkedList = ayu.awn().rnd;
int xV = l.xV(ayu.awm().dxh);
((ViewGroup) view).removeAllViews();
Iterator it = linkedList.iterator();
while (it.hasNext()) {
prVar = (pr) it.next();
View inflate = y.gq(ayx).inflate(a$e.card_secondary_field_layout_item, (ViewGroup) view, false);
inflate.setId(d.card_secondary_field_view);
inflate.setTag(Integer.valueOf(linkedList.indexOf(prVar)));
inflate.setOnClickListener(ayy);
if (TextUtils.isEmpty(prVar.url)) {
inflate.setEnabled(false);
}
((TextView) inflate.findViewById(d.secondary_field_title)).setText(prVar.title);
TextView textView = (TextView) inflate.findViewById(d.secondary_field_subtitle);
textView.setText(prVar.huX);
textView.setTextColor(xV);
((ViewGroup) view).addView(inflate);
if (linkedList.indexOf(prVar) + 1 != linkedList.size()) {
((ViewGroup) view).addView(y.gq(ayx).inflate(a$e.card_secondary_field_layout_item_seperator, (ViewGroup) view, false));
}
}
if (!(!ayu.avT() || ayu.awn().rnk == null || TextUtils.isEmpty(ayu.awn().rnk.title))) {
this.hIb.setBackgroundResource(c.mm_trans);
}
if (!ayu.avT() && ayz.azv()) {
this.hIb.setBackgroundResource(c.mm_trans);
}
} else if (ayu.awn().rnd == null || ayu.awn().rnd.size() != 1) {
if (this.hIb != null) {
this.hIb.setVisibility(8);
}
if (this.hIc != null) {
this.hIc.setVisibility(8);
}
} else {
if (this.hIc == null) {
this.hIc = ((ViewStub) findViewById(d.card_secondary_field_single_stub)).inflate();
}
if (this.hIb != null) {
this.hIb.setVisibility(8);
}
View view2 = this.hIc;
OnClickListener ayy2 = this.hHF.ayy();
LinkedList linkedList2 = ayu.awn().rnd;
if (linkedList2.size() == 1) {
view2.findViewById(d.card_secondary_field_view_1).setVisibility(0);
prVar = (pr) linkedList2.get(0);
((TextView) view2.findViewById(d.secondary_field_title_1)).setText(prVar.title);
((TextView) view2.findViewById(d.secondary_field_subtitle_1)).setText(prVar.huX);
((TextView) view2.findViewById(d.secondary_field_subtitle_1)).setTextColor(l.xV(ayu.awm().dxh));
view2.findViewById(d.card_secondary_field_view_1).setOnClickListener(ayy2);
if (TextUtils.isEmpty(prVar.url)) {
view2.findViewById(d.card_secondary_field_view_1).setEnabled(false);
}
}
if (!(!ayu.avT() || ayu.awn().rnk == null || TextUtils.isEmpty(ayu.awn().rnk.title))) {
this.hIc.setBackgroundResource(c.mm_trans);
}
if (!ayu.avT() && ayz.azv()) {
this.hIc.setBackgroundResource(c.mm_trans);
}
}
}
public final void azI() {
if (this.hIb != null) {
this.hIb.setVisibility(8);
}
if (this.hIc != null) {
this.hIc.setVisibility(8);
}
}
}
|
package com.tibco.as.io.transfer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.tibco.as.io.ITransfer;
import com.tibco.as.util.log.LogFactory;
public class ParallelExecutor extends AbstractExecutor {
private Logger log = LogFactory.getLog(ParallelExecutor.class);
private Collection<ITransfer> transfers = new ArrayList<ITransfer>();
public ParallelExecutor(ITransfer... transfers) {
super(transfers);
}
@Override
protected void execute(Collection<ITransfer> transfers) {
for (ITransfer transfer : transfers) {
try {
transfer.open();
this.transfers.add(transfer);
transfer.addListener(new TransferListener(this, transfer));
} catch (Exception e) {
log.log(Level.SEVERE, "Could not open transfer", e);
}
}
ExecutorService executor = Executors.newFixedThreadPool(this.transfers
.size());
for (ITransfer transfer : this.transfers) {
executor.execute(transfer);
}
executor.shutdown();
try {
while (!executor.awaitTermination(100, TimeUnit.MILLISECONDS)) {
// do nothing
}
} catch (InterruptedException e) {
// do nothing
}
close();
}
private void close() {
for (ITransfer transfer : transfers) {
try {
transfer.close();
} catch (Exception e) {
log.log(Level.SEVERE, "Could not close transfer", e);
}
}
}
@Override
public void stop() {
close();
}
}
|
package com.ibm.ive.tools.japt.reduction.ita;
import com.ibm.ive.tools.japt.reduction.ita.MethodInvocationLocation.StackLocation;
/**
* @author sfoley
*
*/
public class MethodPotentialArrayTargets implements MethodPotentialTargets {
public String toString() {
return "potential array targets " + PropagatedObject.toIdentifier(this);// + " for " + invocation;
}
public void findStaticTargets(SpecificMethodInvocation inv) {}
public void findNewTargets(ReceivedObject received, SpecificMethodInvocation invocation) {
PropagatedObject object = received.getObject();
if(!object.isArray()) {
return;
}
Array array = (Array) object;
if(array.isPrimitiveArray()) {
return;
}
Method method = invocation.getMethod();
boolean stores = method.storesIntoArrays();
boolean loads = method.loadsFromArrays();
if(stores || loads) {
ArrayElement element;
if(!array.getType().isArray()) {
/*
* We have a generic object of type java.lang.Object,
* java.io.Serializable, or some other parent type of array classes
*/
Repository rep = invocation.getRepository();
Clazz objectArray = rep.getObjectArray();
GenericObject genericObject = (GenericObject) array;
GenericObject split = genericObject.getSplitGeneric(objectArray);
element = split.getArrayElement();
} else {
element = array.getArrayElement();
}
if(stores) {
if(handleArrayWrites(received.getLocation(), element, invocation)) {
element.setAccessed();
}
if(loads) {
if(handleArrayReads(received.getLocation(), element, invocation)) {
element.setAccessed();
}
}
} else {
if(handleArrayReads(received.getLocation(), element, invocation)) {
element.setAccessed();
}
}
}
}
private boolean handleArrayWrites(MethodInvocationLocation location, ArrayElement element, MethodInvocation invocation) {
Method method = invocation.getMethod();
if(method.useIntraProceduralAnalysis()) {
InstructionLocation writes[] = method.getArrayWrites();
boolean result = false;
for(int i=0; i<writes.length; i++) {
InstructionLocation write = writes[i];
if(method.maps(location, write, StackLocation.getSecondFromTopCellIndex())) { /* we are writing objects so no need to worry about doubles or longs on the stack */
invocation.addWrittenDataMember(new AccessedPropagator(element, write));
result = true;
}
}
return result;
} else {
invocation.addWrittenDataMember(new AccessedPropagator(element));
return true;
}
}
private boolean handleArrayReads(MethodInvocationLocation location, ArrayElement element, MethodInvocation invocation) {
Method method = invocation.getMethod();
if(method.useIntraProceduralAnalysis()) {
InstructionLocation reads[] = method.getArrayReads();
boolean result = false;
for(int i=0; i<reads.length; i++) {
InstructionLocation read = reads[i];
if(method.maps(location, read, StackLocation.getNextToTopCellIndex())) {
element.addReadingMethod(new AccessedPropagator(invocation, read));
result = true;
}
}
return result;
} else {
element.addReadingMethod(new AccessedPropagator(invocation));
return true;
}
}
}
|
/**
* @project : Argmagetron
* @file : Player.java
* @author(s) : Michael Brouchoud
* @date : 18.05.2017
*
* @brief : Use to manage a player
*
*/
package server;
import java.awt.*;
import java.util.UUID;
/**
* @class Player
*/
class Player {
private UUID uniqueId;
private String username;
private Point position;
private Point lastPosition;
private Color color;
final static short UP = 0;
final static short LEFT = 1;
final static short DOWN = 2;
final static short RIGHT = 3;
private short direction;
private boolean isAlive;
/**
* Constructor
*/
Player() {
this("test", Color.green);
}
/**
* Constructor
*
* @param username The player's user name
* @param color The player's color
*/
Player(String username, Color color) {
this(username, color, new Location());
}
/**
* Constructor
*
* @param username The player's user name
* @param color The player's color
* @param location The player's first position
*/
Player(String username, Color color, Location location) {
this.username = username;
this.uniqueId = UUID.randomUUID();
this.color = color;
//TODO Check that when the code is better
this.position = location.getPosition();
this.direction = location.getDirection();
this.isAlive = true;
this.lastPosition = position;
}
/**
* @fn Point getPosition()
*
* @brief Return the player's position
*
* @author Michael Brouchoud
*
* @return Point The player's position
*/
Point getPosition() {
return position;
}
/**
* @fn Point getLastPosition()
*
* @brief Return the player's last position
*
* @author Michael Brouchoud
*
* @return Point The player's last position
*/
Point getLastPosition(){
return lastPosition;
}
/**
* @fn private void setLastPosition(Point p)
*
* @brief Set the last position of the player
*
* @author Michael Brouchoud
*
* @param p The last position to set
*/
private void setLastPosition(Point p){
this.lastPosition = new Point(p);
}
/**
* @fn void setPosition(Point p)
*
* @brief Set the position of the player
*
* @author Michael Brouchoud
*
* @param p The position to set
*/
void setPosition(Point p){
this.position = new Point(p);
}
/**
* @fn UUID getUniqueId()
*
* @brief Get the player's UUID
*
* @author Michael Brouchoud
*
* @return UUID the player's UUID
*/
UUID getUniqueId() {
return uniqueId;
}
/**
* @fn String getUsername()
*
* @brief Get the player's username
*
* @author Michael Brouchoud
*
* @return String the player's username
*/
String getUsername() {
return username;
}
/**
* @fn Color getColor()
*
* @brief Get the player's Color
*
* @author Michael Brouchoud
*
* @return Color the player's Color
*/
Color getColor() {
return color;
}
/**
* @fn void turnLeft()
*
* @brief Set the direction of the player when turn left
*
* @author Michael Brouchoud
*/
void turnLeft() {
switch (direction) {
case UP:
direction = LEFT;
break;
case DOWN:
direction = RIGHT;
break;
case LEFT:
direction = DOWN;
break;
case RIGHT:
direction = UP;
break;
}
}
/**
* @fn void turnRight()
*
* @brief Set the direction of the player when turn right
*
* @author Michael Brouchoud
*/
void turnRight() {
switch (direction) {
case LEFT:
direction = UP;
break;
case RIGHT:
direction = DOWN;
break;
case UP:
direction = RIGHT;
break;
case DOWN:
direction = LEFT;
break;
}
}
/**
* @fn void updatePosition()
*
* @brief Update the player's position
*
* @author Michael Brouchoud
*/
void updatePosition() {
if(this.isAlive) {
this.setLastPosition(position);
switch (direction) {
case LEFT:
--position.y;
break;
case RIGHT:
++position.y;
break;
case UP:
--position.x;
break;
case DOWN:
++position.x;
break;
}
}
}
/**
* @fn boolean isAlive()
*
* @brief Indicate if the player is alive
*
* @author Michael Brouchoud
*
* @return true the player is alive
* @return false the player is dead
*/
boolean isAlive() {
return this.isAlive;
}
/**
* @fn void die()
*
* @brief Kill the player
*
* @author Michael Brouchoud
*/
void die() { this.isAlive = false; }
}
|
package com.awsp8.wizardry.Arcane.Blocks;
import com.awsp8.wizardry.Wizardry;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
public class ArcaneSlot
extends Slot{
public ArcaneSlot(IInventory inv, int par1, int par2, int par3) {
super(inv, par1, par2, par3);
}
public boolean isItemValid(ItemStack stack){
return stack.getItem() == Wizardry.condencedMagic;
}
}
|
package org.newdawn.slick.svg;
import org.newdawn.slick.geom.Shape;
import org.newdawn.slick.geom.TexCoordGenerator;
import org.newdawn.slick.geom.Transform;
import org.newdawn.slick.geom.Vector2f;
public class RadialGradientFill implements TexCoordGenerator {
private Vector2f centre;
private float radius;
private Gradient gradient;
private Shape shape;
public RadialGradientFill(Shape shape, Transform trans, Gradient gradient) {
this.gradient = gradient;
this.radius = gradient.getR();
float x = gradient.getX1();
float y = gradient.getY1();
float[] c = { x, y };
gradient.getTransform().transform(c, 0, c, 0, 1);
trans.transform(c, 0, c, 0, 1);
float[] rt = { x, y - this.radius };
gradient.getTransform().transform(rt, 0, rt, 0, 1);
trans.transform(rt, 0, rt, 0, 1);
this.centre = new Vector2f(c[0], c[1]);
Vector2f dis = new Vector2f(rt[0], rt[1]);
this.radius = dis.distance(this.centre);
}
public Vector2f getCoordFor(float x, float y) {
float u = this.centre.distance(new Vector2f(x, y));
u /= this.radius;
if (u > 0.99F)
u = 0.99F;
return new Vector2f(u, 0.0F);
}
}
/* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\org\newdawn\slick\svg\RadialGradientFill.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/ |
package com.ltpeacock.batchemailsender.exception;
/**
*
* @author LieutenantPeacock
*
*/
public class MailSendingException extends Exception {
private static final long serialVersionUID = 542446978477601320L;
private final ErrorCode errorCode;
public MailSendingException(final ErrorCode errorCode) {
this(errorCode, null, null);
}
public MailSendingException(final ErrorCode errorCode, String message) {
this(errorCode, message, null);
}
public MailSendingException(final ErrorCode errorCode, Throwable cause) {
this(errorCode, null, cause);
}
public MailSendingException(final ErrorCode errorCode, Throwable cause, boolean useCauseMessage) {
this(errorCode, null, cause, useCauseMessage);
}
public MailSendingException(final ErrorCode errorCode, String message, Throwable cause) {
this(errorCode, message, cause, false);
}
public MailSendingException(final ErrorCode errorCode, String message, Throwable cause, boolean useCauseMessage) {
super("ErrorCode[" + errorCode.getErrorCode() + "]: "
+ (message != null ?
message
: (useCauseMessage && cause != null ?
cause.getMessage()
: errorCode.getDescription())),
cause);
this.errorCode = errorCode;
}
public ErrorCode getErrorCode() {
return this.errorCode;
}
}
|
package com.shopware.test.pages.base;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONObject;
import com.shopware.test.utils.DataUtils;
public class Customer_UI {
private String firstName;
private String lastName;
private String email;
private String password;
private String salutation;
private List<Address_UI> addresses;
private String customerType;
public Customer_UI() {
super();
this.firstName = DataUtils.randomString(10);
this.lastName = DataUtils.randomString(10);
this.email = DataUtils.randomEmail("test", "yopmail.com");
this.password = "@bcd1234";
this.salutation = "Mr";
this.customerType = "Private customer";
this.addresses = new ArrayList<Address_UI>();
addresses.add(new Address_UI(this));
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getSalutation() {
return salutation;
}
public void setSalutation(String salutation) {
this.salutation = salutation;
}
public List<Address_UI> getAddresses() {
return addresses;
}
public void setAddresses(List<Address_UI> addresses) {
this.addresses = addresses;
}
public void addAddress(Address_UI address) {
this.addresses.add(address);
}
public String getCustomerType() {
return customerType;
}
public void setCustomerType(String customerType) {
this.customerType = customerType;
}
public JSONObject converToJSON() {
JSONObject jBilling = new JSONObject();
jBilling.put("firstname",addresses.get(0).getFirstName());
jBilling.put("lastname", addresses.get(0).getLastName());
jBilling.put("salutation", addresses.get(0).getSaluation().toLowerCase());
jBilling.put("street", addresses.get(0).getAddressLine());
jBilling.put("city", addresses.get(0).getCity());
jBilling.put("zipcode", addresses.get(0).getZipCode());
jBilling.put("country", 11);
JSONObject jCustomer = new JSONObject();
jCustomer.put("salutation",this.salutation.toLowerCase());
jCustomer.put("firstname", this.firstName);
jCustomer.put("lastname", this.lastName);
jCustomer.put("email", this.email);
jCustomer.put("password", this.password);
jCustomer.put("billing", jBilling);
return jCustomer;
}
}
|
package chatroom.model.message;
import java.util.List;
public class RoomUserListMessage extends Message{
private List<String> userList;
private String roomName;
public RoomUserListMessage(List<String> userList, String roomName){
this.userList = userList;
this.roomName = roomName;
type = 8;
}
public List<String> getUserList(){
return userList;
}
public String getRoomName() {
return roomName;
}
}
|
package com.game.snakesAndLadder;
import com.game.snakesAndLadder.Dice.CrookedDice;
import com.game.snakesAndLadder.Dice.NormalDice;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class UserAcceptanceTests {
private static final int BOARD_SIZE = 100;
private final Player player = new Player();
private final Dice dice = new NormalDice();
private Board board = new Board(BOARD_SIZE, player, dice);
@Test
void playerShouldMoveFromInitialPositionToNextByTheNumberOnTheDice() {
given().playerPositionIs(21)
.whenI().rollDiceBy(4)
.thenI().reachAtPosition(25);
}
@Test
void snakeShouldMovePlayerFromItsStartToEndPosition() {
given().snakePositionIs(14,7).and().playerPositionIs(12)
.whenI().rollDiceBy(2)
.thenI().reachAtPosition(7);
}
@Test
void gameCanBeInitiatedWithAnyDice() {
whenI().useDiceType(new NormalDice()).thenI().verifyDiceWorks();
whenI().useDiceType(new CrookedDice()).thenI().verifyDiceWorks();
}
private void verifyDiceWorks() {
assertDoesNotThrow(player::rollDice);
}
private UserAcceptanceTests useDiceType(Dice dice) {
board = new Board(BOARD_SIZE, player, dice);
return this;
}
private UserAcceptanceTests and() {
return this;
}
private UserAcceptanceTests snakePositionIs(int snakeStartPosition, int snakeEndPosition) {
Snake snake = new Snake(snakeStartPosition, snakeEndPosition);
board.addSnake(snake);
return this;
}
private UserAcceptanceTests playerPositionIs(int position) {
player.moveByPosition(position-1);
return this;
}
private UserAcceptanceTests given() {
return this;
}
private void reachAtPosition(int position) {
assertEquals(position, player.getPosition());
}
private UserAcceptanceTests thenI() {
return this;
}
private UserAcceptanceTests rollDiceBy(int diceNumber) {
board.diceRolled(diceNumber);
return this;
}
private UserAcceptanceTests whenI() {
return this;
}
}
|
package com.training.day20.compare;
import java.util.Arrays;
public class FirstSortArray {
public static void main(String[] args) {
String[] fruits = {"Bananana","Papaya","Apple","Orange","Mango"};
System.out.println("Before Sorting : ");
for (String fruit:fruits) {
System.out.println(fruit);
}
Arrays.sort(fruits);
System.out.println("After Sorting : ");
for (String fruit:fruits) {
System.out.println(fruit);
}
}
}
|
package com.esc.fms.service.right.impl;
import com.esc.fms.dao.UserListElementMapper;
import com.esc.fms.dao.UserMapper;
import com.esc.fms.dao.UserRefRoleMapper;
import com.esc.fms.entity.User;
import com.esc.fms.entity.UserListElement;
import com.esc.fms.entity.UserRefRole;
import com.esc.fms.service.right.UserRefRoleService;
import com.esc.fms.service.right.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* Created by tangjie on 2016/11/27.
*/
@Service("userService")
public class UserServiceImpl implements UserService {
private static final Logger logger = LoggerFactory.getLogger(UserServiceImpl.class);
@Autowired
private UserMapper userMapper;
@Autowired
private UserListElementMapper userListElementMapper;
@Autowired
private UserRefRoleService userRefRoleService;
public int insert(User user){
return userMapper.insert(user);
}
public User getUserByUserName(String userName){
return userMapper.getUserByUserName(userName);
}
public Set<String> getRolesByUserName(String userName) {
return userMapper.getRolesByUserName(userName);
}
public Set<String> getPermissionsByUserName(String userName) {
return userMapper.getPermissionsByUserName(userName);
}
public List<UserListElement> getUserList(String userName, String staffName, int offset, int pageSize) {
return userListElementMapper.getUserListByConditions(userName,staffName,offset,pageSize);
}
public Integer getCountByConditions(String userName, String staffName) {
return userListElementMapper.getCountByConditions(userName,staffName);
}
public boolean addUser(User user, List<Integer> roles) {
int count = userMapper.insert(user);
for(Integer roleID : roles)
{
UserRefRole urr = new UserRefRole();
urr.setRoleID(roleID);
urr.setUserID(user.getUserID());
userRefRoleService.insert(urr);
}
return true;
}
public User selectByPrimaryKey(Integer userID) {
return userMapper.selectByPrimaryKey(userID);
}
public boolean editUser(User user, List<Integer> oldRoles, List<Integer> newRoles) {
int count = userMapper.updateByPrimaryKeySelective(user);
List<Integer> intersection = new ArrayList<Integer>();
if(newRoles.equals(oldRoles))
{
logger.debug("用户所属角色并未发生改变!");
}
else
{
logger.debug("用户所属角色已经发生改变!");
for(Integer roleID : oldRoles)
{
if(newRoles.contains(roleID))
{
intersection.add(roleID);
}
}
oldRoles.removeAll(intersection);
if(!oldRoles.isEmpty())
{
for(Integer roleID: oldRoles){
count = userRefRoleService.deleteByUserIDRoleID(user.getUserID(),roleID);
}
}
newRoles.removeAll(intersection);
if(!newRoles.isEmpty())
{
for(Integer roleID : newRoles){
UserRefRole urr = new UserRefRole();
urr.setRoleID(roleID);
urr.setUserID(user.getUserID());
count = userRefRoleService.insert(urr);
}
}
}
return true;
}
public boolean disableUser(List<Integer> userIDs) {
int count = 0;
for(Integer userID : userIDs){
count = userMapper.disableUser(userID);
}
return true;
}
public int authenticateUser(String userName, String password) {
return userMapper.authenticateUser(userName,password);
}
public int modifyPasswordByUserName(String userName, String password) {
return userMapper.modifyPasswordByUserName(userName,password);
}
}
|
package net.somethingnew.kawatan.flower;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.GridView;
import androidx.fragment.app.Fragment;
import net.somethingnew.kawatan.flower.util.LogUtility;
import java.util.ArrayList;
import java.util.Arrays;
public class FolderFrontFragment extends Fragment {
GlobalManager globalMgr = GlobalManager.getInstance();
View mView;
ArrayList<String> pastelColorArrayList = new ArrayList<>(Arrays.asList(Constants.PASTEL_PALETTE_LIGHT_BASE));
ArrayList<Button> textColorButtonArray = new ArrayList<>();
public FolderFrontFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
LogUtility.d("onCreateView: ");
mView = inflater.inflate(R.layout.fragment_foldersetting_color, container, false);
// 文字色変更用ボタン群
for (int resourceId: Constants.TEXT_COLOR_BUTTON_RESOURCE_ID) {
Button btn = mView.findViewById(resourceId);
textColorButtonArray.add(btn);
btn.setOnClickListener(view -> {
// 単語帳の表紙の文字色を変える
int color = ((Button)view).getCurrentTextColor();
globalMgr.mFolderSettings.editTextTitle.setTextColor(color);
globalMgr.mTempFolder.setFrontTextColor(color);
globalMgr.mChangedFolderSettings = true;
});
}
// 背景パステルカラーのGridView(規定色)
PastelColorGridAdapter pastelColorGridAdapter = new PastelColorGridAdapter(
getActivity().getApplicationContext(), R.layout.gridview_item_pastel_color, pastelColorArrayList);
GridView gridViewPastel = mView.findViewById(R.id.gridViewPastel);
gridViewPastel.setAdapter(pastelColorGridAdapter);
gridViewPastel.setOnItemClickListener((parent, view, position, id) -> {
// 単語帳のおもて面の色を変える
int color = Color.parseColor(pastelColorArrayList.get(position));
globalMgr.mFolderSettings.cardView.setCardBackgroundColor(color);
globalMgr.mTempFolder.setFrontBackgroundColor(color);
globalMgr.mChangedFolderSettings = true;
changeTextColorButtonsBackground(color);
});
// ColorPickerのクリックイベントを拾ってCardの色を動的に変更する
ColorSliderView colorSliderViewHeader = mView.findViewById(R.id.colorSliderDeep);
colorSliderViewHeader.setListener((position, color) -> {
globalMgr.mFolderSettings.cardView.setCardBackgroundColor(color);
globalMgr.mTempFolder.setFrontBackgroundColor(color);
globalMgr.mChangedFolderSettings = true;
changeTextColorButtonsBackground(color);
});
ColorSliderView colorSliderViewBody = mView.findViewById(R.id.colorSliderLight);
colorSliderViewBody.setListener((position, color) -> {
globalMgr.mFolderSettings.cardView.setCardBackgroundColor(color);
globalMgr.mTempFolder.setFrontBackgroundColor(color);
globalMgr.mChangedFolderSettings = true;
changeTextColorButtonsBackground(color);
});
mView.findViewById(R.id.constraintLayoutWhole).setBackgroundColor(globalMgr.skinBodyColor);
return mView;
}
@Override
public void onDestroy() {
super.onDestroy();
LogUtility.d("onDestroy");
}
public void changeTextColorButtonsBackground(int backgroundColor) {
for (Button textButton: textColorButtonArray) {
GradientDrawable bgShape = (GradientDrawable)textButton.getBackground();
bgShape.setColor(backgroundColor);
bgShape.setStroke(1, Color.BLACK);
}
}
}
|
/**
* Javassonne
* http://code.google.com/p/javassonne/
*
* @author [Add Name Here]
* @date Mar 13, 2009
*
* Copyright 2009 Javassonne Team
* 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.javassonne.ui.panels;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import org.javassonne.messaging.Notification;
import org.javassonne.messaging.NotificationManager;
import org.javassonne.model.Player.MeepleColor;
import org.javassonne.ui.DisplayHelper;
public class HUDConfirmPlacementPanel extends AbstractHUDPanel implements
ActionListener {
JButton endTurnButton_;
JButton cancelButton_;
DragMeeplePanel placeFarmer_ = null;
DragMeeplePanel placeVillager_ = null;
MeepleColor color_;
public HUDConfirmPlacementPanel(MeepleColor c) {
super();
setLayout(null);
setSize(490, 100);
setVisible(true);
setOpaque(false);
setFocusable(false);
setBackgroundImagePath("images/hud_confirm_placement_background.jpg");
color_ = c;
// add the end turn and cancel buttons
endTurnButton_ = new JButton(new ImageIcon("images/end_turn.jpg"));
endTurnButton_.setActionCommand(Notification.END_TURN);
endTurnButton_.addActionListener(this);
endTurnButton_.setSize(103, 38);
endTurnButton_.setLocation(375, 51);
endTurnButton_.setFocusable(false);
add(endTurnButton_);
cancelButton_ = new JButton(new ImageIcon("images/cancel.jpg"));
cancelButton_.setActionCommand(Notification.UNDO_PLACE_TILE);
cancelButton_.addActionListener(this);
cancelButton_.setSize(103, 38);
cancelButton_.setLocation(375, 10);
cancelButton_.setFocusable(false);
add(cancelButton_);
// listen for the endGame notice in case we need to remove ourselves
NotificationManager.getInstance().addObserver(Notification.END_GAME,
this, "endGame");
}
public void endGame()
{
close();
}
public void attachMeeplePanels()
{
// create drag meeple panels
placeFarmer_ = new DragMeeplePanel(color_, "farmer");
Point location1 = new Point(this.getLocation().x + 50,this.getLocation().y + 16);
placeFarmer_.setResetLocation(location1);
DisplayHelper.getInstance().add(placeFarmer_, DisplayHelper.Layer.DRAG, location1);
placeVillager_ = new DragMeeplePanel(color_, "villager");
Point location2 = new Point(this.getLocation().x + 255,this.getLocation().y + 16);
placeVillager_.setResetLocation(location2);
DisplayHelper.getInstance().add(placeVillager_, DisplayHelper.Layer.DRAG, location2);
}
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if (e.getActionCommand() != "")
NotificationManager.getInstance().sendNotification(
e.getActionCommand());
close();
}
@Override
public void close()
{
super.close();
placeFarmer_.close();
placeVillager_.close();
}
}
|
package LinkRecursiveAction;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.Marker;
import org.apache.logging.log4j.MarkerManager;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.util.*;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.RecursiveAction;
import java.io.*;
import java.util.concurrent.ConcurrentLinkedQueue;
public class LinkRecursiveAction extends RecursiveAction {
private String baseLink;
private String t;
static String baseUrl = "https://lenta.ru/";
// static String baseUrl = "https://skillbox.ru/";
static ConcurrentLinkedQueue<String> queue = new ConcurrentLinkedQueue(Collections.singletonList(baseUrl));
private static Set<String> uniqueURL = new ConcurrentSkipListSet<>();
private List<LinkRecursiveAction> actionList = new CopyOnWriteArrayList<>();
private static final String USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " +
"(KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36";
private static final String REFERRER = "https://www.google.com/";
private static final Logger LOGGER = LogManager.getLogger(LinkRecursiveAction.class);
private static final Marker INVALID_LINE_MARKER = MarkerManager.getMarker("VIEW_INVALID");
private static final Marker VIEW_FILEPATH_MARKER = MarkerManager.getMarker("VIEW_FILEPATH");
public LinkRecursiveAction(String baseLink, String t){
this.baseLink = baseLink;
this.t = t;
}
public static ConcurrentLinkedQueue<String> getQueue() {
return queue;
}
public static Set<String> getUniqueURL() {
return uniqueURL;
}
@Override
protected void compute() {
parseLink(baseLink, t);
}
private void parseLink(String url, String t) {
try {
Elements links = null;
try {
links = getElements(url);
} catch (Exception e) {
e.printStackTrace();
return;
}
if (links.isEmpty()) {
return;
}
StringBuffer tab = new StringBuffer(t);
for (int i = 0; i < url.split("/").length - 2; i++) {
try {
tab.append("\t");
} catch (Exception e) {
e.printStackTrace();
}
}
uniqueURL.add(url);
// System.out.println(url);
tab.append("\t");
for (Element link : links) {
String href = link.attr("abs:href");
if (/*href.contains(baseUrl)&&*/href.contains(url)&& !uniqueURL.contains(href) && !href.contains("#") && !href.contains("?")
&& !href.contains("@")&& !href.endsWith("pdf")&& !href.contains("201")) {
uniqueURL.add(href);
Thread.sleep(100);
System.out.println(tab + href);
queue.add(tab + href);
LinkRecursiveAction action = new LinkRecursiveAction(href, tab.toString());
try {
action.fork();
} catch (Exception e) {
LOGGER.error(action + " fork - " + e + Arrays.toString(e.getStackTrace()));
LOGGER.error(INVALID_LINE_MARKER, action);
e.printStackTrace();
}
actionList.add(action);
}
}
try {
for (LinkRecursiveAction action : actionList)
try {
action.join();
} catch (Exception e) {
LOGGER.error(action + " join - " + e + Arrays.toString(e.getStackTrace()));
LOGGER.error(VIEW_FILEPATH_MARKER, action);
e.printStackTrace();
}
} catch (Exception e) {
LOGGER.error(VIEW_FILEPATH_MARKER, actionList);
}
} catch (Exception e) {
e.printStackTrace();
}
}
private static Elements getElements(String link) throws IOException {
Document doc = null;
try {
doc = Jsoup.connect(link).
userAgent(USER_AGENT).
referrer(REFERRER).get();
} catch (Exception e) {
e.printStackTrace();
}
return doc.select("a[href]");
}
}
|
package fr.lteconsulting;
import fr.lteconsulting.modele.Bibliotheque;
import fr.lteconsulting.modele.Chanson;
import fr.lteconsulting.modele.Disque;
public class Application
{
public static void main( String[] args )
{
Bibliotheque b = new Bibliotheque();
Disque d = new Disque( "La Lune" );
d.addChanson( new Chanson( "Titre", 34 ) );
d.addChanson( new Chanson( "Titre", 34 ) );
b.ajouterDisque( d );
d = new Disque( "Le soleil" );
d.addChanson( new Chanson( "Titre", 34 ) );
d.addChanson( new Chanson( "Blah", 23 ) );
d.addChanson( new Chanson( "Titre", 34 ) );
d.addChanson( new Chanson( "Titre", 34 ) );
d.addChanson( new Chanson( "Titre", 34 ) );
b.ajouterDisque( d );
InferfaceUtilisateur ui = new InferfaceUtilisateur( b );
ui.execute();
}
}
|
package Listeners;
import com.example.chrisc.bestlineaward.*;
import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
public class ServiceTextListener implements TextWatcher
{
FamilyLine line;
int id;
EditText edit;
Double service;
public ServiceTextListener(Context context, int id_count, EditText ed)
{
line = (FamilyLine) context;
id = id_count;
edit = ed;
service = 0.0;
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after)
{
}
// Convert the text to a double and add it to the respective member
@Override
public void onTextChanged(CharSequence s, int start, int before, int count)
{
edit.removeTextChangedListener(this);
String newString = s.toString();
try
{
service = Double.parseDouble(newString);
}
catch(NumberFormatException e)
{
service = 0.0;
}
edit.addTextChangedListener(this);
}
//After text change, calculate the total for both the row and the whole total.
@Override
public void afterTextChanged(Editable s)
{
line.list_of_members.get(id).setService(service);
line.calculateTotalRow(id);
}
}
|
/*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.dsl;
import java.util.Collection;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.integration.aggregator.AbstractCorrelatingMessageHandler;
import org.springframework.integration.aggregator.AggregatingMessageHandler;
import org.springframework.integration.aggregator.DefaultAggregatingMessageGroupProcessor;
import org.springframework.integration.aggregator.ResequencingMessageHandler;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.channel.FixedSubscriberChannel;
import org.springframework.integration.config.SourcePollingChannelAdapterFactoryBean;
import org.springframework.integration.core.GenericSelector;
import org.springframework.integration.core.MessageSelector;
import org.springframework.integration.dsl.channel.MessageChannelSpec;
import org.springframework.integration.dsl.core.ConsumerEndpointSpec;
import org.springframework.integration.dsl.core.MessageHandlerSpec;
import org.springframework.integration.dsl.support.BeanNameMessageProcessor;
import org.springframework.integration.dsl.support.ComponentConfigurer;
import org.springframework.integration.dsl.support.EndpointConfigurer;
import org.springframework.integration.dsl.support.FixedSubscriberChannelPrototype;
import org.springframework.integration.dsl.support.GenericHandler;
import org.springframework.integration.dsl.support.GenericRouter;
import org.springframework.integration.dsl.support.GenericSplitter;
import org.springframework.integration.dsl.support.MessageChannelReference;
import org.springframework.integration.expression.ControlBusMethodFilter;
import org.springframework.integration.filter.ExpressionEvaluatingSelector;
import org.springframework.integration.filter.MessageFilter;
import org.springframework.integration.filter.MethodInvokingSelector;
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
import org.springframework.integration.handler.BridgeHandler;
import org.springframework.integration.handler.DelayHandler;
import org.springframework.integration.handler.ExpressionCommandMessageProcessor;
import org.springframework.integration.handler.ServiceActivatingHandler;
import org.springframework.integration.router.AbstractMappingMessageRouter;
import org.springframework.integration.router.AbstractMessageRouter;
import org.springframework.integration.router.ExpressionEvaluatingRouter;
import org.springframework.integration.router.MethodInvokingRouter;
import org.springframework.integration.router.RecipientListRouter;
import org.springframework.integration.splitter.AbstractMessageSplitter;
import org.springframework.integration.splitter.DefaultMessageSplitter;
import org.springframework.integration.splitter.ExpressionEvaluatingSplitter;
import org.springframework.integration.splitter.MethodInvokingSplitter;
import org.springframework.integration.store.MessageStore;
import org.springframework.integration.transformer.ClaimCheckInTransformer;
import org.springframework.integration.transformer.ClaimCheckOutTransformer;
import org.springframework.integration.transformer.ContentEnricher;
import org.springframework.integration.transformer.ExpressionEvaluatingTransformer;
import org.springframework.integration.transformer.GenericTransformer;
import org.springframework.integration.transformer.HeaderFilter;
import org.springframework.integration.transformer.MessageTransformingHandler;
import org.springframework.integration.transformer.MethodInvokingTransformer;
import org.springframework.integration.transformer.Transformer;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandler;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
/**
* @author Artem Bilan
*/
public final class IntegrationFlowBuilder {
private final static SpelExpressionParser PARSER = new SpelExpressionParser();
private final IntegrationFlow flow = new IntegrationFlow();
private MessageChannel currentMessageChannel;
private Object currentComponent;
IntegrationFlowBuilder() {
}
IntegrationFlowBuilder addComponent(Object component) {
this.flow.addComponent(component);
return this;
}
IntegrationFlowBuilder currentComponent(Object component) {
this.currentComponent = component;
return this;
}
public IntegrationFlowBuilder fixedSubscriberChannel() {
return this.fixedSubscriberChannel(null);
}
public IntegrationFlowBuilder fixedSubscriberChannel(String messageChannelName) {
return this.channel(new FixedSubscriberChannelPrototype(messageChannelName));
}
public IntegrationFlowBuilder channel(String messageChannelName) {
return this.channel(new MessageChannelReference(messageChannelName));
}
public IntegrationFlowBuilder channel(MessageChannel messageChannel) {
Assert.notNull(messageChannel);
if (this.currentMessageChannel != null) {
this.register(new GenericEndpointSpec<BridgeHandler>(new BridgeHandler()), null);
}
this.currentMessageChannel = messageChannel;
return this.registerOutputChannelIfCan(this.currentMessageChannel);
}
public IntegrationFlowBuilder channel(MessageChannelSpec<?, ?> messageChannelSpec) {
Assert.notNull(messageChannelSpec);
return this.channel(messageChannelSpec.get());
}
public IntegrationFlowBuilder controlBus() {
return controlBus(null);
}
public IntegrationFlowBuilder controlBus(EndpointConfigurer<GenericEndpointSpec<ServiceActivatingHandler>> endpointConfigurer) {
return this.handle(new ServiceActivatingHandler(new ExpressionCommandMessageProcessor(new ControlBusMethodFilter())), endpointConfigurer);
}
public IntegrationFlowBuilder transform(String expression) {
Assert.hasText(expression);
return this.transform(new ExpressionEvaluatingTransformer(PARSER.parseExpression(expression)));
}
public <S, T> IntegrationFlowBuilder transform(GenericTransformer<S, T> genericTransformer) {
return this.transform(null, genericTransformer);
}
public <P, T> IntegrationFlowBuilder transform(Class<P> payloadType, GenericTransformer<P, T> genericTransformer) {
return this.transform(payloadType, genericTransformer, null);
}
public <S, T> IntegrationFlowBuilder transform(GenericTransformer<S, T> genericTransformer,
EndpointConfigurer<GenericEndpointSpec<MessageTransformingHandler>> endpointConfigurer) {
return this.transform(null, genericTransformer, endpointConfigurer);
}
public <P, T> IntegrationFlowBuilder transform(Class<P> payloadType, GenericTransformer<P, T> genericTransformer,
EndpointConfigurer<GenericEndpointSpec<MessageTransformingHandler>> endpointConfigurer) {
Assert.notNull(genericTransformer);
Transformer transformer = genericTransformer instanceof Transformer ? (Transformer) genericTransformer :
(isLambda(genericTransformer)
? new MethodInvokingTransformer(new LambdaMessageProcessor(genericTransformer, payloadType))
: new MethodInvokingTransformer(genericTransformer));
return addComponent(transformer)
.handle(new MessageTransformingHandler(transformer), endpointConfigurer);
}
public IntegrationFlowBuilder filter(String expression) {
Assert.hasText(expression);
return this.filter(new ExpressionEvaluatingSelector(PARSER.parseExpression(expression)));
}
public <S> IntegrationFlowBuilder filter(GenericSelector<S> genericSelector) {
return this.filter(null, genericSelector);
}
public <P> IntegrationFlowBuilder filter(Class<P> payloadType, GenericSelector<P> genericSelector) {
return this.filter(payloadType, genericSelector, null);
}
public <P> IntegrationFlowBuilder filter(GenericSelector<P> genericSelector,
EndpointConfigurer<FilterEndpointSpec> endpointConfigurer) {
return filter(null, genericSelector, endpointConfigurer);
}
public <P> IntegrationFlowBuilder filter(Class<P> payloadType, GenericSelector<P> genericSelector,
EndpointConfigurer<FilterEndpointSpec> endpointConfigurer) {
Assert.notNull(genericSelector);
MessageSelector selector = genericSelector instanceof MessageSelector ? (MessageSelector) genericSelector :
(isLambda(genericSelector)
? new MethodInvokingSelector(new LambdaMessageProcessor(genericSelector, payloadType))
: new MethodInvokingSelector(genericSelector));
return this.register(new FilterEndpointSpec(new MessageFilter(selector)), endpointConfigurer);
}
public <S extends MessageHandlerSpec<S, ? extends MessageHandler>> IntegrationFlowBuilder handle(S messageHandlerSpec) {
Assert.notNull(messageHandlerSpec);
return handle(messageHandlerSpec.get());
}
public IntegrationFlowBuilder handle(MessageHandler messageHandler) {
return this.handle(messageHandler, null);
}
public IntegrationFlowBuilder handle(String beanName, String methodName) {
return this.handle(beanName, methodName, null);
}
public IntegrationFlowBuilder handle(String beanName, String methodName,
EndpointConfigurer<GenericEndpointSpec<ServiceActivatingHandler>> endpointConfigurer) {
return this.handle(new ServiceActivatingHandler(new BeanNameMessageProcessor<Object>(beanName, methodName)),
endpointConfigurer);
}
public <P> IntegrationFlowBuilder handle(GenericHandler<P> handler) {
return this.handle(null, handler);
}
public <P> IntegrationFlowBuilder handle(GenericHandler<P> handler,
EndpointConfigurer<GenericEndpointSpec<ServiceActivatingHandler>> endpointConfigurer) {
return this.handle(null, handler, endpointConfigurer);
}
public <P> IntegrationFlowBuilder handle(Class<P> payloadType, GenericHandler<P> handler) {
return this.handle(payloadType, handler, null);
}
public <P> IntegrationFlowBuilder handle(Class<P> payloadType, GenericHandler<P> handler,
EndpointConfigurer<GenericEndpointSpec<ServiceActivatingHandler>> endpointConfigurer) {
ServiceActivatingHandler serviceActivatingHandler = null;
if (isLambda(handler)) {
serviceActivatingHandler = new ServiceActivatingHandler(new LambdaMessageProcessor(handler, payloadType));
}
else {
serviceActivatingHandler = new ServiceActivatingHandler(handler);
}
return this.handle(serviceActivatingHandler, endpointConfigurer);
}
public <H extends MessageHandler, S extends MessageHandlerSpec<S, H>>
IntegrationFlowBuilder handle(S messageHandlerSpec, EndpointConfigurer<GenericEndpointSpec<H>> endpointConfigurer) {
Assert.notNull(messageHandlerSpec);
return handle(messageHandlerSpec.get(), endpointConfigurer);
}
public <H extends MessageHandler> IntegrationFlowBuilder handle(H messageHandler,
EndpointConfigurer<GenericEndpointSpec<H>> endpointConfigurer) {
Assert.notNull(messageHandler);
return this.register(new GenericEndpointSpec<H>(messageHandler), endpointConfigurer);
}
public IntegrationFlowBuilder bridge(EndpointConfigurer<GenericEndpointSpec<BridgeHandler>> endpointConfigurer) {
return this.register(new GenericEndpointSpec<BridgeHandler>(new BridgeHandler()), endpointConfigurer);
}
public IntegrationFlowBuilder delay(String groupId, String expression) {
return this.delay(groupId, expression, null);
}
public IntegrationFlowBuilder delay(String groupId, String expression,
EndpointConfigurer<DelayerEndpointSpec> endpointConfigurer) {
DelayHandler delayHandler = new DelayHandler(groupId);
if (StringUtils.hasText(expression)) {
delayHandler.setDelayExpression(PARSER.parseExpression(expression));
}
return this.register(new DelayerEndpointSpec(delayHandler), endpointConfigurer);
}
public IntegrationFlowBuilder enrich(ComponentConfigurer<EnricherSpec> enricherConfigurer) {
return this.enrich(enricherConfigurer, null);
}
public IntegrationFlowBuilder enrich(ComponentConfigurer<EnricherSpec> enricherConfigurer,
EndpointConfigurer<GenericEndpointSpec<ContentEnricher>> endpointConfigurer) {
Assert.notNull(enricherConfigurer);
EnricherSpec enricherSpec = new EnricherSpec();
enricherConfigurer.configure(enricherSpec);
return this.handle(enricherSpec.get(), endpointConfigurer);
}
public IntegrationFlowBuilder enrichHeaders(ComponentConfigurer<HeaderEnricherSpec> headerEnricherConfigurer) {
return this.enrichHeaders(headerEnricherConfigurer, null);
}
public IntegrationFlowBuilder enrichHeaders(ComponentConfigurer<HeaderEnricherSpec> headerEnricherConfigurer,
EndpointConfigurer<GenericEndpointSpec<MessageTransformingHandler>> endpointConfigurer) {
Assert.notNull(headerEnricherConfigurer);
HeaderEnricherSpec headerEnricherSpec = new HeaderEnricherSpec();
headerEnricherConfigurer.configure(headerEnricherSpec);
return transform(headerEnricherSpec.get(), endpointConfigurer);
}
public IntegrationFlowBuilder split(EndpointConfigurer<SplitterEndpointSpec<DefaultMessageSplitter>> endpointConfigurer) {
return this.split(new DefaultMessageSplitter(), endpointConfigurer);
}
public IntegrationFlowBuilder split(String expression,
EndpointConfigurer<SplitterEndpointSpec<ExpressionEvaluatingSplitter>> endpointConfigurer) {
return this.split(new ExpressionEvaluatingSplitter(PARSER.parseExpression(expression)), endpointConfigurer);
}
public IntegrationFlowBuilder split(String beanName, String methodName) {
return this.split(beanName, methodName, null);
}
public IntegrationFlowBuilder split(String beanName, String methodName,
EndpointConfigurer<SplitterEndpointSpec<MethodInvokingSplitter>> endpointConfigurer) {
return this.split(new MethodInvokingSplitter(new BeanNameMessageProcessor<Collection<?>>(beanName, methodName)),
endpointConfigurer);
}
public <P> IntegrationFlowBuilder split(Class<P> payloadType, GenericSplitter<P> splitter) {
return this.split(payloadType, splitter, null);
}
public <T> IntegrationFlowBuilder split(GenericSplitter<T> splitter,
EndpointConfigurer<SplitterEndpointSpec<MethodInvokingSplitter>> endpointConfigurer) {
return split(null, splitter, endpointConfigurer);
}
public <P> IntegrationFlowBuilder split(Class<P> payloadType, GenericSplitter<P> splitter,
EndpointConfigurer<SplitterEndpointSpec<MethodInvokingSplitter>> endpointConfigurer) {
MethodInvokingSplitter split = isLambda(splitter)
? new MethodInvokingSplitter(new LambdaMessageProcessor(splitter, payloadType))
: new MethodInvokingSplitter(splitter, "split");
return this.split(split, endpointConfigurer);
}
public <S extends AbstractMessageSplitter> IntegrationFlowBuilder split(S splitter,
EndpointConfigurer<SplitterEndpointSpec<S>> endpointConfigurer) {
Assert.notNull(splitter);
return this.register(new SplitterEndpointSpec<S>(splitter), endpointConfigurer);
}
/**
* Provides the {@link HeaderFilter} to the current {@link IntegrationFlow}.
* @param headersToRemove the array of headers (or patterns)
* to remove from {@link org.springframework.messaging.MessageHeaders}.
* @return the {@link IntegrationFlowBuilder}.
*/
public IntegrationFlowBuilder headerFilter(String... headersToRemove) {
return this.headerFilter(new HeaderFilter(headersToRemove), null);
}
/**
* Provides the {@link HeaderFilter} to the current {@link IntegrationFlow}.
* @param headersToRemove the comma separated headers (or patterns) to remove from
* {@link org.springframework.messaging.MessageHeaders}.
* @param patternMatch the {@code boolean} flag to indicate if {@code headersToRemove}
* should be interpreted as patterns or direct header names.
* @return the {@link IntegrationFlowBuilder}.
*/
public IntegrationFlowBuilder headerFilter(String headersToRemove, boolean patternMatch) {
HeaderFilter headerFilter = new HeaderFilter(StringUtils.delimitedListToStringArray(headersToRemove, ",", " "));
headerFilter.setPatternMatch(patternMatch);
return this.headerFilter(headerFilter, null);
}
public IntegrationFlowBuilder headerFilter(HeaderFilter headerFilter,
EndpointConfigurer<GenericEndpointSpec<MessageTransformingHandler>> endpointConfigurer) {
return this.transform(headerFilter, endpointConfigurer);
}
public IntegrationFlowBuilder claimCheckIn(MessageStore messageStore) {
return this.claimCheckIn(messageStore, null);
}
public IntegrationFlowBuilder claimCheckIn(MessageStore messageStore,
EndpointConfigurer<GenericEndpointSpec<MessageTransformingHandler>> endpointConfigurer) {
return this.transform(new ClaimCheckInTransformer(messageStore), endpointConfigurer);
}
public IntegrationFlowBuilder claimCheckOut(MessageStore messageStore) {
return this.claimCheckOut(messageStore, false);
}
public IntegrationFlowBuilder claimCheckOut(MessageStore messageStore, boolean removeMessage) {
return this.claimCheckOut(messageStore, removeMessage, null);
}
public IntegrationFlowBuilder claimCheckOut(MessageStore messageStore, boolean removeMessage,
EndpointConfigurer<GenericEndpointSpec<MessageTransformingHandler>> endpointConfigurer) {
ClaimCheckOutTransformer claimCheckOutTransformer = new ClaimCheckOutTransformer(messageStore);
claimCheckOutTransformer.setRemoveMessage(removeMessage);
return this.transform(claimCheckOutTransformer, endpointConfigurer);
}
public IntegrationFlowBuilder resequence() {
return this.resequence((EndpointConfigurer<GenericEndpointSpec<ResequencingMessageHandler>>) null);
}
public IntegrationFlowBuilder resequence(EndpointConfigurer<GenericEndpointSpec<ResequencingMessageHandler>> endpointConfigurer) {
return this.handle(new ResequencerSpec().get(), endpointConfigurer);
}
public IntegrationFlowBuilder resequence(ComponentConfigurer<ResequencerSpec> resequencerConfigurer,
EndpointConfigurer<GenericEndpointSpec<ResequencingMessageHandler>> endpointConfigurer) {
Assert.notNull(resequencerConfigurer);
ResequencerSpec spec = new ResequencerSpec();
resequencerConfigurer.configure(spec);
return this.handle(spec.get(), endpointConfigurer);
}
public IntegrationFlowBuilder aggregate() {
return aggregate((EndpointConfigurer<GenericEndpointSpec<AggregatingMessageHandler>>) null);
}
public IntegrationFlowBuilder
aggregate(EndpointConfigurer<GenericEndpointSpec<AggregatingMessageHandler>> endpointConfigurer) {
return handle(new AggregatorSpec().outputProcessor(new DefaultAggregatingMessageGroupProcessor()).get(),
endpointConfigurer);
}
public IntegrationFlowBuilder aggregate(ComponentConfigurer<AggregatorSpec> aggregatorConfigurer,
EndpointConfigurer<GenericEndpointSpec<AggregatingMessageHandler>> endpointConfigurer) {
Assert.notNull(aggregatorConfigurer);
AggregatorSpec spec = new AggregatorSpec();
aggregatorConfigurer.configure(spec);
return this.handle(spec.get(), endpointConfigurer);
}
public IntegrationFlowBuilder route(String beanName, String method) {
return this.route(beanName, method, null);
}
public IntegrationFlowBuilder route(String beanName, String method,
ComponentConfigurer<RouterSpec<MethodInvokingRouter>> routerConfigurer) {
return this.route(beanName, method, routerConfigurer, null);
}
public IntegrationFlowBuilder route(String beanName, String method,
ComponentConfigurer<RouterSpec<MethodInvokingRouter>> routerConfigurer,
EndpointConfigurer<GenericEndpointSpec<MethodInvokingRouter>> endpointConfigurer) {
return this.route(new MethodInvokingRouter(new BeanNameMessageProcessor<Object>(beanName, method)),
routerConfigurer, endpointConfigurer);
}
public IntegrationFlowBuilder route(String expression) {
return this.route(expression, (ComponentConfigurer<RouterSpec<ExpressionEvaluatingRouter>>) null);
}
public IntegrationFlowBuilder route(String expression,
ComponentConfigurer<RouterSpec<ExpressionEvaluatingRouter>> routerConfigurer) {
return this.route(expression, routerConfigurer, null);
}
public IntegrationFlowBuilder route(String expression,
ComponentConfigurer<RouterSpec<ExpressionEvaluatingRouter>> routerConfigurer,
EndpointConfigurer<GenericEndpointSpec<ExpressionEvaluatingRouter>> endpointConfigurer) {
return this.route(new ExpressionEvaluatingRouter(PARSER.parseExpression(expression)), routerConfigurer,
endpointConfigurer);
}
public <S, T> IntegrationFlowBuilder route(GenericRouter<S, T> router) {
return this.route(null, router);
}
public <S, T> IntegrationFlowBuilder route(GenericRouter<S, T> router,
ComponentConfigurer<RouterSpec<MethodInvokingRouter>> routerConfigurer) {
return this.route(null, router, routerConfigurer);
}
public <P, T> IntegrationFlowBuilder route(Class<P> payloadType, GenericRouter<P, T> router) {
return this.route(payloadType, router, null, null);
}
public <P, T> IntegrationFlowBuilder route(Class<P> payloadType, GenericRouter<P, T> router,
ComponentConfigurer<RouterSpec<MethodInvokingRouter>> routerConfigurer) {
return this.route(payloadType, router, routerConfigurer, null);
}
public <S, T> IntegrationFlowBuilder route(GenericRouter<S, T> router,
ComponentConfigurer<RouterSpec<MethodInvokingRouter>> routerConfigurer,
EndpointConfigurer<GenericEndpointSpec<MethodInvokingRouter>> endpointConfigurer) {
return route(null, router, routerConfigurer, endpointConfigurer);
}
public <P, T> IntegrationFlowBuilder route(Class<P> payloadType, GenericRouter<P, T> router,
ComponentConfigurer<RouterSpec<MethodInvokingRouter>> routerConfigurer,
EndpointConfigurer<GenericEndpointSpec<MethodInvokingRouter>> endpointConfigurer) {
MethodInvokingRouter methodInvokingRouter = isLambda(router)
? new MethodInvokingRouter(new LambdaMessageProcessor(router, payloadType))
: new MethodInvokingRouter(router);
return this.route(methodInvokingRouter, routerConfigurer, endpointConfigurer);
}
public <R extends AbstractMappingMessageRouter> IntegrationFlowBuilder route(R router,
ComponentConfigurer<RouterSpec<R>> routerConfigurer,
EndpointConfigurer<GenericEndpointSpec<R>> endpointConfigurer) {
if (routerConfigurer != null) {
RouterSpec<R> routerSpec = new RouterSpec<R>(router);
routerConfigurer.configure(routerSpec);
}
return this.route(router, endpointConfigurer);
}
public IntegrationFlowBuilder recipientListRoute(ComponentConfigurer<RecipientListRouterSpec> routerConfigurer) {
return this.recipientListRoute(routerConfigurer, null);
}
public IntegrationFlowBuilder recipientListRoute(ComponentConfigurer<RecipientListRouterSpec> routerConfigurer,
EndpointConfigurer<GenericEndpointSpec<RecipientListRouter>> endpointConfigurer) {
Assert.notNull(routerConfigurer);
RecipientListRouterSpec spec = new RecipientListRouterSpec();
routerConfigurer.configure(spec);
DslRecipientListRouter recipientListRouter = (DslRecipientListRouter) spec.get();
Assert.notEmpty(recipientListRouter.getRecipients(), "recipient list must not be empty");
return this.route(recipientListRouter, endpointConfigurer);
}
public IntegrationFlowBuilder route(AbstractMessageRouter router) {
return this.route(router, null);
}
public <R extends AbstractMessageRouter> IntegrationFlowBuilder route(R router,
EndpointConfigurer<GenericEndpointSpec<R>> endpointConfigurer) {
return this.handle(router, endpointConfigurer);
}
public IntegrationFlowBuilder gateway(String requestChannel) {
return gateway(requestChannel, null);
}
public IntegrationFlowBuilder gateway(String requestChannel,
EndpointConfigurer<GatewayEndpointSpec> endpointConfigurer) {
return register(new GatewayEndpointSpec(requestChannel), endpointConfigurer);
}
public IntegrationFlowBuilder gateway(MessageChannel requestChannel) {
return gateway(requestChannel, null);
}
public IntegrationFlowBuilder gateway(MessageChannel requestChannel,
EndpointConfigurer<GatewayEndpointSpec> endpointConfigurer) {
return register(new GatewayEndpointSpec(requestChannel), endpointConfigurer);
}
private <S extends ConsumerEndpointSpec<S, ?>> IntegrationFlowBuilder register(S endpointSpec,
EndpointConfigurer<S> endpointConfigurer) {
if (endpointConfigurer != null) {
endpointConfigurer.configure(endpointSpec);
}
MessageChannel inputChannel = this.currentMessageChannel;
this.currentMessageChannel = null;
if (inputChannel == null) {
inputChannel = new DirectChannel();
this.registerOutputChannelIfCan(inputChannel);
}
if (inputChannel instanceof MessageChannelReference) {
endpointSpec.get().getT1().setInputChannelName(((MessageChannelReference) inputChannel).getName());
}
else {
if (inputChannel instanceof FixedSubscriberChannelPrototype) {
String beanName = ((FixedSubscriberChannelPrototype) inputChannel).getName();
inputChannel = new FixedSubscriberChannel(endpointSpec.get().getT2());
if (beanName != null) {
((FixedSubscriberChannel) inputChannel).setBeanName(beanName);
}
this.registerOutputChannelIfCan(inputChannel);
}
endpointSpec.get().getT1().setInputChannel(inputChannel);
}
return this.addComponent(endpointSpec).currentComponent(endpointSpec.get().getT2());
}
private IntegrationFlowBuilder registerOutputChannelIfCan(MessageChannel outputChannel) {
if (!(outputChannel instanceof FixedSubscriberChannelPrototype)) {
this.flow.addComponent(outputChannel);
if (this.currentComponent != null) {
String channelName = null;
if (outputChannel instanceof MessageChannelReference) {
channelName = ((MessageChannelReference) outputChannel).getName();
}
if (this.currentComponent instanceof AbstractReplyProducingMessageHandler) {
AbstractReplyProducingMessageHandler messageProducer =
(AbstractReplyProducingMessageHandler) this.currentComponent;
if (channelName != null) {
messageProducer.setOutputChannelName(channelName);
}
else {
messageProducer.setOutputChannel(outputChannel);
}
}
else if (this.currentComponent instanceof SourcePollingChannelAdapterSpec) {
SourcePollingChannelAdapterFactoryBean pollingChannelAdapterFactoryBean =
((SourcePollingChannelAdapterSpec) this.currentComponent).get().getT1();
if (channelName != null) {
pollingChannelAdapterFactoryBean.setOutputChannelName(channelName);
}
else {
pollingChannelAdapterFactoryBean.setOutputChannel(outputChannel);
}
}
else if (this.currentComponent instanceof AbstractCorrelatingMessageHandler) {
AbstractCorrelatingMessageHandler messageProducer =
(AbstractCorrelatingMessageHandler) this.currentComponent;
if (channelName != null) {
messageProducer.setOutputChannelName(channelName);
}
else {
messageProducer.setOutputChannel(outputChannel);
}
}
else {
throw new BeanCreationException("The 'currentComponent' (" + this.currentComponent +
") is a one-way 'MessageHandler' and it isn't appropriate to configure 'outputChannel'. " +
"This is the end of the integration flow.");
}
this.currentComponent = null;
}
}
return this;
}
public IntegrationFlow get() {
if (this.currentMessageChannel instanceof FixedSubscriberChannelPrototype) {
throw new BeanCreationException("The 'currentMessageChannel' (" + this.currentMessageChannel +
") is a prototype for FixedSubscriberChannel which can't be created without MessageHandler " +
"constructor argument. That means that '.fixedSubscriberChannel()' can't be the last EIP-method " +
"in the IntegrationFlow definition.");
}
if (this.flow.getIntegrationComponents().size() == 1) {
if (this.currentComponent != null) {
if (this.currentComponent instanceof SourcePollingChannelAdapterSpec) {
throw new BeanCreationException("The 'SourcePollingChannelAdapter' (" + this.currentComponent + ") " +
"must be configured with at least one 'MessageChanel' or 'MessageHandler'.");
}
}
else if (this.currentMessageChannel != null) {
throw new BeanCreationException("The 'IntegrationFlow' can't consist of only one 'MessageChannel'. " +
"Add at lest '.bridge()' EIP-method before the end of flow.");
}
}
return this.flow;
}
private static boolean isLambda(Object o) {
Class<?> aClass = o.getClass();
return aClass.isSynthetic() && !aClass.isAnonymousClass() && !aClass.isLocalClass();
}
}
|
package com.legalzoom.api.test.integration.ProductsService;
import org.testng.Assert;
import org.testng.annotations.Test;
import com.legalzoom.api.test.client.ResponseData;
import com.legalzoom.api.test.dto.CreateOrderSourceIdDTO;
public class CoreProductsReferencesOrderSourcesGetIT extends ProductsTest{
@Test
public void testReferencesOrderSourcesAll() throws Exception{
ResponseData responseData = coreProductsServiceClient.getCoreProductsReferencesOrderSources();
Assert.assertEquals(responseData.getStatus(), 200);
}
} |
package com.tencent.mm.plugin.sns.ui;
class bb$6 implements Runnable {
final /* synthetic */ bb ogl;
bb$6(bb bbVar) {
this.ogl = bbVar;
}
public final void run() {
1 1 = new 1(this);
if (this.ogl.nvg != null) {
this.ogl.nvg.setOnDragListener(1);
}
}
}
|
package SUT.SE61.Team07.Repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.web.bind.annotation.CrossOrigin;
import SUT.SE61.Team07.Entity.*;
@RepositoryRestResource
@CrossOrigin("http://localhost:4200")
public interface ReceiptRepository extends JpaRepository<Receipt, Long> {
} |
package com.jdroid.java.mail;
public interface MailService {
public void sendMail(String subject, String body, String sender, String recipient) throws MailException;
}
|
package net.crunchdroid.api;
import lombok.AllArgsConstructor;
import net.crunchdroid.model.ExpiredAbonnement;
import net.crunchdroid.service.ExpiredAbonnementService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/nonactive")
@AllArgsConstructor
public class ExpiredAbonnementCtrl {
private ExpiredAbonnementService expiredAbonnementService;
@PostMapping("/add")
public ResponseEntity<ExpiredAbonnement> add(@RequestBody ExpiredAbonnement expiredAbonnement) {
try {
return new ResponseEntity(expiredAbonnementService.save(expiredAbonnement), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@GetMapping({"/", ""})
public ResponseEntity<List<ExpiredAbonnement>> getAll() {
try {
return new ResponseEntity(expiredAbonnementService.findAll(), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
}
|
package snake.parts;
import snake.Tile;
import snake.util.Position;
import snake.util.PositionMap;
public class SnakeTail implements Tile {
protected Position position;
public SnakeTail(Position position) {
this.position = position;
}
@Override
public Position getPosition() {
return this.position;
}
protected void moveTo(Position position) {
this.position = position;
}
protected boolean isAt(Position position) {
if (this.position.equals(position)) {
return true;
} else {
return false;
}
}
@Override
public void print(PositionMap<Character> map) {
map.put(this.getPosition(), '~');
}
} |
/*
* Copyright 2021 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package org.skia.androidkit;
public enum TileMode {
/**
* Replicate the edge color if the shader draws outside of its
* original bounds.
*/
CLAMP,
/**
* Repeat the shader's image horizontally and vertically.
*/
REPEAT,
/**
* Repeat the shader's image horizontally and vertically, alternating
* mirror images so that adjacent images always seam.
*/
MIRROR,
/**
* Only draw within the original domain, return transparent-black everywhere else.
*/
DECAL,
}
|
public class NuclearBomb extends Bomb{
}
|
package com.legalzoom.api.test.integration.OrdersService;
import com.legalzoom.api.test.client.ResponseData;
import org.testng.Assert;
import org.testng.annotations.Test;
import com.legalzoom.api.test.dto.GetOrderDTO;
import com.legalzoom.api.test.dto.OrdersDTO;
import com.legalzoom.api.test.dto.OrdersOrderItemsDTO;
public class CoreOrdersPostIT extends OrdersTest{
@Test
public void testOrdersCustomerId_LT() throws Exception {
OrdersDTO order = new OrdersDTO();
order.setCustomerId("11579816");
order.setOrderGroupId("27610690");
order.setOrderSourceId("1"); //always be 1
OrdersOrderItemsDTO ordersOrderItems = new OrdersOrderItemsDTO();
ordersOrderItems.setProductComponentId("240");
ordersOrderItems.setProductConfigurationId("3512");
ordersOrderItems.setProcessingOrderId(" ");
ordersOrderItems.setParentOrderItemId("52619786");
ordersOrderItems.setProductTypeId("3");
ordersOrderItems.setProductName("Pour-Over Will");
ordersOrderItems.setStateId(" ");
ordersOrderItems.setCountyId(" ");
ordersOrderItems.setBasePrice("0.00");
ordersOrderItems.setExtendedPrice("0.00");
ordersOrderItems.setAdjustedPrice("0.00");
ordersOrderItems.setQuantity("1");
ordersOrderItems.setProductBasePriceReferenceId(" ");
ordersOrderItems.setProductPriceAdjustmentId(" ");
ordersOrderItems.setSourceOrderItemId(" ");
ordersOrderItems.setProcessingStatusId(" ");
ordersOrderItems.setShipMethodId(" ");
ordersOrderItems.setDisplayedOnBill(true);
order.setOrderItem(ordersOrderItems);
ResponseData responseData = coreOrdersServiceClient.postCoreOrdersOrder(order);
Assert.assertEquals(responseData.getStatus(), 200);
}
@Test
public void testOrdersCustomerId_INC() throws Exception {
OrdersDTO order = new OrdersDTO();
order.setCustomerId("11579845");
order.setOrderGroupId("27610704");
order.setOrderSourceId("1"); //always be 1
OrdersOrderItemsDTO ordersOrderItems = new OrdersOrderItemsDTO();
ordersOrderItems.setProductComponentId("570");
ordersOrderItems.setProductConfigurationId("4381");
ordersOrderItems.setProcessingOrderId("507619882");
ordersOrderItems.setParentOrderItemId("52619941");
ordersOrderItems.setProductTypeId("9");
ordersOrderItems.setProductName("Minutes Manager");
ordersOrderItems.setStateId(" ");
ordersOrderItems.setCountyId(" ");
ordersOrderItems.setBasePrice("99.00");
ordersOrderItems.setExtendedPrice("69.00");
ordersOrderItems.setAdjustedPrice("69.00");
ordersOrderItems.setQuantity("1");
ordersOrderItems.setProductBasePriceReferenceId("3444");
ordersOrderItems.setProductPriceAdjustmentId("1232");
ordersOrderItems.setSourceOrderItemId(" ");
ordersOrderItems.setProcessingStatusId(" ");
ordersOrderItems.setShipMethodId(" ");
ordersOrderItems.setDisplayedOnBill(true);
order.setOrderItem(ordersOrderItems);
ResponseData responseData = coreOrdersServiceClient.postCoreOrdersOrder(order);
Assert.assertEquals(responseData.getStatus(), 200);
}
@Test
public void testOrdersCustomerIdWithNoData() throws Exception {
OrdersDTO order = new OrdersDTO();
order.setCustomerId(" ");
order.setOrderGroupId(" ");
order.setOrderSourceId(" "); //always be 1
OrdersOrderItemsDTO ordersOrderItems = new OrdersOrderItemsDTO();
ordersOrderItems.setProductComponentId(" ");
ordersOrderItems.setProductConfigurationId(" ");
ordersOrderItems.setProcessingOrderId(" ");
ordersOrderItems.setParentOrderItemId(" ");
ordersOrderItems.setProductTypeId(" ");
ordersOrderItems.setProductName(" ");
ordersOrderItems.setStateId(" ");
ordersOrderItems.setCountyId(" ");
ordersOrderItems.setBasePrice(" ");
ordersOrderItems.setExtendedPrice(" ");
ordersOrderItems.setAdjustedPrice(" ");
ordersOrderItems.setQuantity(" ");
ordersOrderItems.setProductBasePriceReferenceId(" ");
ordersOrderItems.setProductPriceAdjustmentId(" ");
ordersOrderItems.setSourceOrderItemId(" ");
ordersOrderItems.setProcessingStatusId(" ");
ordersOrderItems.setShipMethodId(" ");
ordersOrderItems.setDisplayedOnBill(true);
order.setOrderItem(ordersOrderItems);
ResponseData responseData = coreOrdersServiceClient.postCoreOrdersOrder(order);
Assert.assertEquals(responseData.getStatus(), 400);
}
@Test
public void testOrdersCustomerIdWithBlankValue() throws Exception {
OrdersDTO order = new OrdersDTO();
/*order.setCustomerId("11579816");
order.setOrderGroupId("27610690");
order.setOrderSourceId("1"); //always be 1
*/
OrdersOrderItemsDTO ordersOrderItems = new OrdersOrderItemsDTO();
/*
ordersOrderItems.setProductComponentId("240");
ordersOrderItems.setProductConfigurationId("3512");
ordersOrderItems.setProcessingOrderId(" ");
ordersOrderItems.setParentOrderItemId("52619786");
ordersOrderItems.setProductTypeId("3");
ordersOrderItems.setProductName("Pour-Over Will");
ordersOrderItems.setStateId(" ");
ordersOrderItems.setCountyId(" ");
ordersOrderItems.setBasePrice("0.00");
ordersOrderItems.setExtendedPrice("0.00");
ordersOrderItems.setAdjustedPrice("0.00");
ordersOrderItems.setQuantity("1");
ordersOrderItems.setProductBasePriceReferenceId(" ");
ordersOrderItems.setProductPriceAdjustmentId(" ");
ordersOrderItems.setSourceOrderItemId(" ");
ordersOrderItems.setProcessingStatusId(" ");
ordersOrderItems.setShipMethodId(" ");
ordersOrderItems.setDisplayedOnBill(true);
*/
order.setOrderItem(ordersOrderItems);
ResponseData responseData = coreOrdersServiceClient.postCoreOrdersOrder(order);
Assert.assertEquals(responseData.getStatus(), 400);
}
} |
package com.wincentzzz.project.template.springhack;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringHackApplication {
public static void main(String[] args) {
SpringApplication.run(SpringHackApplication.class, args);
}
}
|
package models.rules;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Map;
import models.grid.Cell;
import models.grid.GridModel;
/**
* The class that defines the rules for the segregation simulation
* @author Weston
*
*/
public class RuleSegregation extends Rule {
// private static final int emptyID = 0;
ArrayList<Cell> myDissenters;
ArrayList<Cell> myEmpties;
int myGridShape;
GridModel myGrid;
double satisfiedPercent;
/**
*
* @param fraction of like neighbors required to be satisfied
*/
public RuleSegregation(double fraction, Map<String, Integer> aStateIdsMap){
super(aStateIdsMap);
satisfiedPercent = fraction;
}
@Override
public void calculateAndSetNextStates(GridModel grid) {
myGrid = grid;
myEmpties = new ArrayList<Cell>();
myDissenters = new ArrayList<Cell>();
for (Cell c: myGrid){
if (c.getNextStateID() != 0 && likeNeighborsPercent(c) < satisfiedPercent)
myDissenters.add(c);
else if (empty(c))
myEmpties.add(c);
}
relocateDissenters();
}
private boolean empty(Cell c){
// return c.getStateID() == emptyID;
return c.getStateID() == super.getStateId("Empty");
}
private double likeNeighborsPercent(Cell c){
Cell[] neighbors = myGrid.getNeighbors(c);
int cType = c.getStateID();
double neighborCount = 0;
double sameNeighbors = 0;
for (Cell neighbor: neighbors){
if (neighbor != null){
neighborCount++;
if (neighbor.getStateID() == cType)
sameNeighbors++;
}
}
return sameNeighbors / neighborCount;
}
private void relocateDissenters(){
Collections.shuffle(myEmpties);
Collections.shuffle(myDissenters);
int i = 0;
while (i < myEmpties.size() && i < myDissenters.size()){
myEmpties.get(i).setNextState(myDissenters.get(i).getState());
myDissenters.get(i).setNextState(myEmpties.get(i).getState());
i++;
}
}
@Override
public void updateParameter(double aPercentage) {
}
@Override
public double getParameter() {
return 0;
}
}
|
/**
* Clase que representa una tabla hash con 10 elementos como máximo
*
* @author juansedo, LizOriana1409
*/
public class TablaHash {
private int[] tabla;
public TablaHash() {
tabla = new int[10];
}
/**
* @param k Nombre de la persona
* @return Posición en la que se va a ubicar
*/
private int funcionHash(String k) {
int num = 0;
for (int i = 0; i < k.length(); i++) {
num += Math.pow( ((int)k.charAt(i))*i, 32-i);
}
return num % 10;
}
/**
* @param k Nombre de la persona
* @return Número de teléfono
*/
public int get(String k) {
return tabla[funcionHash(k)];
}
/**
* @param k Nombre de la persona
* @param v Número de teléfono
*/
public void put(String k, int v) {
tabla[funcionHash(k)] = v;
}
}
import java.util.HashMap;
/**
*
* @author juansedo, LizOriana1409
*/
class PuntosAdicionales {
public static void main(String [] args) {
/*PUNTO 2*/
HashMap<String, String> map = new HashMap<>();
map.put("Google", "Estados Unidos");
map.put("La locura", "Colombia");
map.put("Nokia", "Finlandia");
map.put("Sony", "Japón");
/*PUNTO 3*/
search_business(map, "Google");
search_business(map, "Motorola");
/*PUNTO 4*/
System.out.println("Empresa en India: ");
System.out.println(search_country(map, "India"));
System.out.println("Empresa en Estados Unidos: ");
System.out.println(search_country(map, "Estados Unidos"));
}
public static void search_business(HashMap<String, String> map, String business) {
String str = map.get(business);
if (str == null) System.out.println("No se encuentran datos de " + business + ".");
else System.out.println(business + " está en " + str);
}
public static String search_country(HashMap<String, String> map, String country) {
for (String s : map.keySet()) {
if (country.equals(map.get(s))) return s;
}
return "";
}
}
|
package com.clay.claykey.presenter;
import android.os.Bundle;
import com.clay.claykey.model.LoginService;
import com.clay.claykey.model.listener.ServiceFinishedListener;
import com.clay.claykey.object.dto.LoginResult;
import com.clay.claykey.view.fragment.LoginFragment;
/**
* Created by Mina Fayek on 1/15/2016.
*/
public class LoginPresenter extends BasePresenter<LoginFragment> {
public void login(Bundle b) {
LoginService loginService = new LoginService(new ServiceFinishedListener<LoginResult>() {
@Override
public void onServiceFinished(LoginResult result) {
if (result.getUser() == null) {
getView().showError();
}
else
{
getView().openDoorsFragment();
}
getView().hideLoading();
}
});
getView().showLoading();
loginService.startService(b);
}
}
|
package example.akka.remote.client;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
import com.typesafe.config.ConfigFactory;
public class Client {
public static void main(String[] args) {
// 1. 创建Actor系统,会加载application.conf文件
ActorSystem system = ActorSystem.create("AkkaRemoteClient", ConfigFactory.load());
// 2. 创建Actor
ActorRef client = system.actorOf(Props.create(ClientActor.class));
// 3. 发送消息
client.tell("DoCalcs", ActorRef.noSender());
System.out.println("over");
}
}
|
package edu.ssafy.root.qna;
import java.io.Serializable;
public class QNA implements Serializable{
private int seq;
private String mid;
private String category;
private String title;
private String question;
private String answer;
private String time;
public QNA() {
super();
}
public QNA(int seq, String mid, String category, String title, String question, String answer, String time) {
super();
this.seq = seq;
this.mid = mid;
this.category = category;
this.title = title;
this.question = question;
this.answer = answer;
this.time = time;
}
public QNA(String mid, String category, String title, String question) {
super();
this.mid = mid;
this.category = category;
this.title = title;
this.question = question;
}
public QNA(String mid, String category, String title, String question, String answer) {
super();
this.mid = mid;
this.category = category;
this.title = title;
this.question = question;
this.answer = answer;
}
public QNA(String mid, String category, String title, String question, String answer, String time) {
super();
this.mid = mid;
this.category = category;
this.title = title;
this.question = question;
this.answer = answer;
this.time = time;
}
public QNA(int seq, String mid, String category, String title, String question) {
super();
this.seq = seq;
this.mid = mid;
this.category = category;
this.title = title;
this.question = question;
}
public int getSeq() {
return seq;
}
public void setSeq(int seq) {
this.seq = seq;
}
public String getMid() {
return mid;
}
public void setMid(String mid) {
this.mid = mid;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getQuestion() {
return question;
}
public void setQuestion(String question) {
this.question = question;
}
public String getAnswer() {
return answer;
}
public void setAnswer(String answer) {
this.answer = answer;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
@Override
public String toString() {
return "QNA [seq=" + seq + ", mid=" + mid + ", category=" + category + ", title=" + title + ", question="
+ question + ", answer=" + answer + ", time=" + time + "]";
}
}
|
package com.skilldistillery.foodTruckProject;
public class FoodTruck {
private int id;
private String name;
private String food;
private int rating;
private int nextId = 1;
public FoodTruck() {
super();
this.id = nextId;
nextId++;
}
public FoodTruck(String name, String food, int rating) {
super();
this.name = name;
this.food = food;
this.rating = rating;
this.id = nextId;
nextId++;
}
public int getId() {
return id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFood() {
return food;
}
public void setFood(String food) {
this.food = food;
}
public int getRating() {
return rating;
}
public void setRating(int rating) {
this.rating = rating;
}
public int getNextId() {
return nextId;
}
public void setNextId(int nextId) {
this.nextId = nextId;
}
@Override
public String toString() {
return "FoodTruck [id=" + id + ", name=" + name + ", food=" + food + ", rating=" + rating + "]";
}
}
|
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package frc.robot.commands;
import edu.wpi.first.wpilibj.command.Command;
import frc.robot.OI;
import frc.robot.Robot;
import frc.robot.RobotMap;
import frc.robot.subsystems.Elevator;
public class ElevatorLevels extends Command {
enum Level{
HATCH_1, HATCH_2, HATCH_3, CARGO_1, CARGO_2, CARGO_3;
}
Level level;
int goal;
boolean up;
public ElevatorLevels(Level level) {
// Use requires() here to declare subsystem dependencies
requires(Robot.m_elevator);
this.level = level;
}
// Called just before this Command runs the first time
@Override
protected void initialize() {
switch (level) {
case HATCH_1:
goal = RobotMap.HATCH_1;
break;
case CARGO_1:
goal = RobotMap.CARGO_1;
break;
case HATCH_2:
goal = RobotMap.HATCH_2;
break;
case CARGO_2:
goal = RobotMap.CARGO_2;
break;
case HATCH_3:
goal = RobotMap.HATCH_3;
break;
case CARGO_3:
goal = RobotMap.CARGO_3;
break;
default:
System.out.println("NOT A LEVEL!");
break;
}
up = goal > Elevator.elevator.getPosition();
}
// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
if(goal > Elevator.elevator.getPosition()) Elevator.elevator.set(RobotMap.ELEVATOR_AUTON);
else if(goal < Elevator.elevator.getPosition()) Elevator.elevator.set(-RobotMap.ELEVATOR_AUTON_DOWN);
}
// Make this return true when this Command no longer needs to run execute()
@Override
protected boolean isFinished() {
if(up) return Elevator.elevator.getPosition() > goal;
return Elevator.elevator.getPosition() < goal;
}
// Called once after isFinished returns true
@Override
protected void end() {
Elevator.elevator.set(0);
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
@Override
protected void interrupted() {
}
}
|
package orukomm;
import java.awt.Image;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class CreatedPost extends javax.swing.JFrame {
private static String bildURL;
private static String textPost;
private static String textHeading;
private static String fileURL;
private static String fileURL2;
private static String fileURL3;
private ImageIcon attachedImage;
/**
* Creates new form CreatedPost
*/
public CreatedPost(String textPost, String textHeading) throws IOException {
initComponents();
bildURL = CreatePost.getBildURL();
fileURL = CreatePost.getFileURL();
fileURL2 = CreatePost.getFileURL2();
fileURL3 = CreatePost.getFileURL3();
paintPicture(lblDisplay);
this.textPost = textPost;
setTxtCreatedPost();
this.textHeading = textHeading;
setTxtHeadingPost();
setAttachedFilesTxt();
txtUserOutput.setEditable(false);
txtUserOutput.setLineWrap(true);
txtUserOutput.setWrapStyleWord(true);
}
private void setTxtCreatedPost(){
txtUserOutput.setText(textPost);
}
private void setTxtHeadingPost(){
lblHeading.setText(textHeading);
}
public void paintPicture(JLabel label)
{
resizeImage(label);
label.setIcon(resizeImage(label));
}
private ImageIcon resizeImage(JLabel label)
{
ImageIcon MyImage = new ImageIcon(bildURL);
Image img = MyImage.getImage();
Image newImg = img.getScaledInstance(label.getHeight(), label.getWidth(), Image.SCALE_SMOOTH);
ImageIcon image = new ImageIcon(img);
return image;
}
private void setAttachedFilesTxt(){
lblURL1.setText(fileURL);
lblURL2.setText(fileURL2);
lblURL3.setText(fileURL3);
}
public ImageIcon getAttachedImage() {
return attachedImage;
}
/**
* 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() {
lblBifogad1 = new javax.swing.JLabel();
lblURL1 = new javax.swing.JLabel();
lblDisplay = new javax.swing.JLabel();
lblTextOutput = new javax.swing.JLabel();
lblHeading = new javax.swing.JLabel();
lblBifogad2 = new javax.swing.JLabel();
lblBifogad3 = new javax.swing.JLabel();
lblURL2 = new javax.swing.JLabel();
lblURL3 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
txtUserOutput = new javax.swing.JTextArea();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
lblBifogad1.setText("Bifogad fil 1:");
lblTextOutput.setVerticalAlignment(javax.swing.SwingConstants.TOP);
lblHeading.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N
lblHeading.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
lblBifogad2.setText("Bifogad fil 2:");
lblBifogad3.setText("Bifogad fil 3:");
txtUserOutput.setColumns(20);
txtUserOutput.setRows(5);
jScrollPane1.setViewportView(txtUserOutput);
jButton1.setText("Nästa");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(lblTextOutput, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 113, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 218, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(106, 106, 106))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblBifogad2)
.addComponent(lblBifogad1)
.addComponent(lblBifogad3))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(lblURL2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblURL1, javax.swing.GroupLayout.PREFERRED_SIZE, 333, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblURL3, javax.swing.GroupLayout.PREFERRED_SIZE, 333, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 57, Short.MAX_VALUE)
.addComponent(jButton1))
.addComponent(lblHeading, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblDisplay, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(24, 24, 24))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(lblHeading, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lblDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(17, 17, 17)
.addComponent(lblTextOutput, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(36, 36, 36)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(28, 28, 28)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(lblBifogad1)
.addGap(27, 27, 27)
.addComponent(lblBifogad2)
.addGap(18, 18, 18)
.addComponent(lblBifogad3))
.addGroup(layout.createSequentialGroup()
.addComponent(lblURL1, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(lblURL2, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton1))
.addGap(18, 18, 18)
.addComponent(lblURL3, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(57, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
JFrame frame = new JFrame();
frame.setSize(800,800);
frame.setVisible(true);
JPanel pane;
try {
pane = new test();
frame.add(pane);
pane.setVisible(true);
} catch (IOException ex) {
Logger.getLogger(CreatedPost.class.getName()).log(Level.SEVERE, null, ex);
}
setVisible(true);
}//GEN-LAST:event_jButton1ActionPerformed
/**
* @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(CreatedPost.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(CreatedPost.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(CreatedPost.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(CreatedPost.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
try {
new CreatedPost(textPost, textHeading).setVisible(true);
}
catch (IOException e) {
}
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JLabel lblBifogad1;
private javax.swing.JLabel lblBifogad2;
private javax.swing.JLabel lblBifogad3;
private javax.swing.JLabel lblDisplay;
private javax.swing.JLabel lblHeading;
private javax.swing.JLabel lblTextOutput;
private javax.swing.JLabel lblURL1;
private javax.swing.JLabel lblURL2;
private javax.swing.JLabel lblURL3;
private javax.swing.JTextArea txtUserOutput;
// End of variables declaration//GEN-END:variables
}
|
package com.cnk.travelogix.product.holiday.master.core.jalo;
import com.cnk.travelogix.product.holiday.master.core.constants.HolidayproductmastercoreConstants;
import de.hybris.platform.jalo.JaloSession;
import de.hybris.platform.jalo.extension.ExtensionManager;
import org.apache.log4j.Logger;
@SuppressWarnings("PMD")
public class HolidayproductmastercoreManager extends GeneratedHolidayproductmastercoreManager
{
@SuppressWarnings("unused")
private static Logger log = Logger.getLogger( HolidayproductmastercoreManager.class.getName() );
public static final HolidayproductmastercoreManager getInstance()
{
ExtensionManager em = JaloSession.getCurrentSession().getExtensionManager();
return (HolidayproductmastercoreManager) em.getExtension(HolidayproductmastercoreConstants.EXTENSIONNAME);
}
}
|
package com.qcwp.carmanager.mvp.present;
import com.qcwp.carmanager.APP;
import com.qcwp.carmanager.engine.Engine;
/**
* Created by qyh on 2016/12/20.
*/
public abstract class BasePresenter {
protected APP mApp=APP.getInstance();
protected Engine mEngine=mApp.getEngine();
private int count=0;
abstract int getRequestCount();
protected void completeOnceRequest(){
count++;
if (count==getRequestCount()){
count=0;
completeAllRequest();
}
}
abstract void completeAllRequest();
}
|
package tree;
import com.google.common.collect.Maps;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.*;
public class RightSideView {
LinkedList<QNode> queue = new LinkedList<QNode>();
class QNode {
int level = 0;
TreeNode treeNode;
public QNode(TreeNode treeNode) {
this.treeNode = treeNode;
}
@Override
public String toString() {
return "QNode{" +
"level=" + level +
", treeNode=" + treeNode +
'}';
}
}
public static class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int x) {
val = x;
}
@Override
public String toString() {
return "TreeNode{" +
"val=" + val +
", left=" + left +
", right=" + right +
'}';
}
}
public List<Integer> rightSideView(TreeNode root) {
List<Integer> viewValues = new ArrayList<>();
if (root != null)
queue.add(new QNode(root));
QNode prev = null;
while (queue.peek() != null) {
QNode node = queue.removeFirst();
// System.out.println(node.treeNode.val);
int level = node.level + 1;
if (prev != null && prev.level + 1 == node.level) {
System.out.println("P: " + prev.treeNode.val);
viewValues.add(prev.treeNode.val);
viewValues.add(node.treeNode.val);
}
if (node.treeNode.left != null) {
QNode _node = new QNode(node.treeNode.left);
_node.level = level;
// System.out.println("N: " + _node.treeNode.val + " Level: " + level);
queue.add(_node);
}
if (node.treeNode.right != null) {
QNode _node = new QNode(node.treeNode.right);
_node.level = level;
// System.out.println("N: " + _node.treeNode.val + " Level: " + level);
queue.add(_node);
}
prev = node;
}
// if (prev != null)
// viewValues.add(prev.treeNode.val);
return viewValues;
}
public static void main(String[] args) {
//[1,2,3,null,5,null,4]
TreeNode root = new TreeNode(1);
root.left = new TreeNode(2);
root.right = new TreeNode(3);
root.left.left = new TreeNode(6);
root.left.right = new TreeNode(5);
root.right.left = new TreeNode(7);
root.right.right = new TreeNode(4);
root.right.left.right = new TreeNode(8);
List<Integer> integers = new RightSideView().rightTreeView(root);
System.out.println(integers);
}
public List<Integer> rightTreeView(TreeNode root) {
Map<Integer, Integer> indexNodes = Maps.newTreeMap();
this.traverse(indexNodes, root, 1);
return new ArrayList<>(indexNodes.values());
}
public void traverse(Map<Integer, Integer> indexNodes, TreeNode root, int height) {
if (root == null)
return;
traverse(indexNodes, root.left, height + 1);
indexNodes.put(height, root.val);
traverse(indexNodes, root.right, height + 1);
}
public List<Integer> rightSideViewLeetCode(TreeNode root) {
Map<Integer, Integer> rightmostValueAtDepth = new HashMap<Integer, Integer>();
int max_depth = -1;
/* These two Queues are always synchronized, providing an implicit
* association values with the same offset on each Queue. */
Queue<TreeNode> nodeQueue = new LinkedList<TreeNode>();
Queue<Integer> depthQueue = new LinkedList<Integer>();
nodeQueue.add(root);
depthQueue.add(0);
while (!nodeQueue.isEmpty()) {
TreeNode node = nodeQueue.remove();
int depth = depthQueue.remove();
if (node != null) {
max_depth = Math.max(max_depth, depth);
/* The last node that we encounter at a particular depth contains
* the correct value, so the correct value is never overwritten. */
rightmostValueAtDepth.put(depth, node.val);
nodeQueue.add(node.left);
nodeQueue.add(node.right);
depthQueue.add(depth + 1);
depthQueue.add(depth + 1);
}
}
/* Construct the solution based on the values that we end up with at the
* end. */
List<Integer> rightView = new ArrayList<Integer>();
for (int depth = 0; depth <= max_depth; depth++) {
rightView.add(rightmostValueAtDepth.get(depth));
}
return rightView;
}
}
|
package se.jaitco.queueticketapi.model;
import lombok.Builder;
import lombok.Value;
@Value
@Builder
public class TicketStatus {
long numbersBefore;
long estimatedWaitTime;
} |
package com.javano1.StudentJobMS.api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import com.javano1.StudentJobMS.mapper.RoleMapper;
import com.javano1.StudentJobMS.service.UserService;
import com.javano1.StudentJobMS.utils.ParamTestUtil;
@RestController
@RequestMapping(value = { "/admin" })
public class UserController {
@Autowired
private UserService userService;
@Autowired
private RoleMapper roleMapper;
@RequestMapping(value = { "/userList" }, method = {RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public String getUserList() {
return userService.getUserList();
}
@RequestMapping(value = { "/addUser" }, method = {RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public String addUser(String username,String password,String role,String name,String num,String classes) {
JSONObject jsonObject = new JSONObject();
try {
if(ParamTestUtil.valiUsername(username)&&ParamTestUtil.valiPassword(password)&&!ParamTestUtil.strIsEmtry(role)) {
String roleName = roleMapper.getRoleNameById(role);
if("学生".equals(roleName)) {
if(!ParamTestUtil.strIsEmtry(name)&&ParamTestUtil.isAllNum(num, 8)&&!ParamTestUtil.strIsEmtry(classes)) {
return userService.addStudentUser(username, password, role, name, num, classes);
}else {
jsonObject.put("code", "101");
}
}else if("教师".equals(roleName)){
if(!ParamTestUtil.strIsEmtry(name)&&!ParamTestUtil.strIsEmtry(num)) {
return userService.addTeacherUser(username, password, role, name, num);
}else {
jsonObject.put("code", "101");
}
}
}else {
jsonObject.put("code", "103");
}
return jsonObject.toJSONString();
}catch (Exception e) {
// TODO: handle exception
jsonObject.put("code", "102");
return jsonObject.toJSONString();
}
}
@RequestMapping(value = { "/delUser" }, method = {RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public String delUser(String userId) {
return userService.delUser(userId);
}
@RequestMapping(value = { "/modifyUserPassword" }, method = {RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public String modifyUserPassword(String userId,String password) {
return userService.modifyUserPassword(userId, password);
}
@RequestMapping(value = { "/modifyUserRole" }, method = {RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public String modifyUserRole(String userId,String role) {
return userService.modifyUserRole(userId, role);
}
@RequestMapping(value = { "/searchUser" }, method = {RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public String searchUser(String keyWord) {
return userService.searchUser(keyWord);
}
@RequestMapping(value = { "/hasUserName" }, method = {RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public String hasUserName(String username) {
return userService.hasUserName(username);
}
@RequestMapping(value = { "/hasStuNum" }, method = {RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public String hasStudentNum(String stuNum) {
return userService.hasStudentNum(stuNum);
}
@RequestMapping(value = { "/hasTchNum" }, method = {RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public String hasTchNum(String tchNum) {
return userService.hasTchNum(tchNum);
}
}
|
package com.github.sergeyskotarenko.contacts.api.service;
import com.github.sergeyskotarenko.contacts.api.dto.ContactDto;
import com.github.sergeyskotarenko.contacts.api.dto.ContactsResponseDto;
import com.github.sergeyskotarenko.contacts.api.repository.ContactsRepository;
import lombok.extern.log4j.Log4j2;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@Service
@Log4j2
public class ContactsServiceImpl implements ContactsService {
private final ContactsRepository contactsRepository;
public ContactsServiceImpl(ContactsRepository contactsRepository) {
this.contactsRepository = contactsRepository;
}
@Override
@Transactional(readOnly = true)
@Cacheable("contacts")
public ContactsResponseDto findContactsByFilter(String filter, Integer limit, Integer afterId) {
final Pattern pattern = Pattern.compile(filter);
List<ContactDto> contactDtos = contactsRepository.findAllContactsAfterId(afterId)
.filter(dto -> !pattern.matcher(dto.getName()).matches())
.limit(limit)
.collect(Collectors.toList());
int lastId = contactDtos.isEmpty() ? -1 : contactDtos.get(contactDtos.size() - 1).getId();
return ContactsResponseDto.builder()
.contacts(contactDtos)
.lastId(lastId)
.build();
}
}
|
package com.example.controller;
import com.example.entity.NhanVien;
import com.example.service.NhanVienService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Controller
@RequestMapping("dangnhap/")
public class DangNhapController {
@Autowired
NhanVienService nhanVienService;
@GetMapping
public String Default(){
return "dangnhap";
}
@PostMapping
public String DangKy(@RequestParam String email,@RequestParam String matkhau,@RequestParam String nhaplaimatkhau ,ModelMap map){
boolean ktmail = validate(email);
if(ktmail){
if(matkhau.equals(nhaplaimatkhau)){
NhanVien nhanVien = new NhanVien();
nhanVien.setEmail(email);
nhanVien.setTendangnhap(email);
nhanVien.setMatkhau(matkhau);
boolean ktThem = nhanVienService.ThemNhanVien(nhanVien);
if(ktThem){
map.addAttribute("kiemtradangnhap", "Tạo tài khoản thành công ");
}else{
map.addAttribute("kiemtradangnhap", "Tạo tài khoản thất bại ");
}
}else{
map.addAttribute("kiemtradangnhap", "Mật khẩu không trùng khớp ");
}
}else{
map.addAttribute("kiemtradangnhap", "Vui lòng nhập đúng định dạng email ");
}
return "dangnhap";
}
public static final Pattern VALID_EMAIL_ADDRESS_REGEX =
Pattern.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", Pattern.CASE_INSENSITIVE);
public static boolean validate(String emailStr) {
Matcher matcher = VALID_EMAIL_ADDRESS_REGEX .matcher(emailStr);
return matcher.find();
}
}
|
package br.com.opensig.fiscal.server.sped.blocoC;
import br.com.opensig.fiscal.server.sped.Bean;
public class DadosC110 extends Bean {
private String cod_inf;
private String txt_compl;
public DadosC110() {
reg = "C110";
}
public String getCod_inf() {
return cod_inf;
}
public void setCod_inf(String cod_inf) {
this.cod_inf = cod_inf;
}
public String getTxt_compl() {
return txt_compl;
}
public void setTxt_compl(String txt_compl) {
this.txt_compl = txt_compl;
}
}
|
public class Person{
private String Modulus;
private String Exponent;
private String P;
private String Q;
private String DP;
private String DQ;
private String InverseQ;
private String D;
public Person() {
}
public Person(String Modulus, String Exponent, String P, String Q, String DP, String DQ, String InverseQ, String D) {
this.Modulus = Modulus;
this.Exponent = Exponent;
this.P = P;
this.Q = Q;
this.DP = DP;
this.DQ = DQ;
this.InverseQ = InverseQ;
this.D = D;
}
public Person(String Modulus, String Exponent) {
this.Modulus = Modulus;
this.Exponent = Exponent;
}
public String getModulus() {
return Modulus;
}
public void setModulus(String modulus) {
Modulus = modulus;
}
public String getExponent() {
return Exponent;
}
public void setExponent(String exponent) {
Exponent = exponent;
}
public String getP() {
return P;
}
public void setP(String p) {
P = p;
}
public String getQ() {
return Q;
}
public void setQ(String q) {
Q = q;
}
public String getDP() {
return DP;
}
public void setDP(String dP) {
DP = dP;
}
public String getDQ() {
return DQ;
}
public void setDQ(String dQ) {
DQ = dQ;
}
public String getInverseQ() {
return InverseQ;
}
public void setInverseQ(String inverseQ) {
InverseQ = inverseQ;
}
public String getD() {
return D;
}
public void setD(String d) {
D = d;
}
}
|
/* Copyright (c) 2017 FIRST. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted (subject to the limitations in the disclaimer below) provided that
* the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* Neither the name of FIRST nor the names of its contributors may be used to endorse or
* promote products derived from this software without specific prior written permission.
*
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS
* LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.hardware.ColorSensor;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DistanceSensor;
@Autonomous (name = "With ColorSeSor-Crater is Behind: Auto", group = "DigiOwls")
//@Disabled
public class DOAutonomousWithColorSensorRedCraterBehind extends LinearOpMode {
DORobotOperationsDelegate robotOpsDelegate = new DORobotOperationsDelegate();
static double DRIVE_SPEED = 0.6;
static double TURN_SPEED = 0.5;
ColorSensor sensorColor;
DistanceSensor sensorDistance;
@Override
public void runOpMode() {
/*
* Initialize the drive system variables.
* The init() method of the hardware class does all the work here
*/
robotOpsDelegate.robot.init(hardwareMap);
robotOpsDelegate.robot.AllDrivesSetMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
robotOpsDelegate.robot.AllDrivesSetMode(DcMotor.RunMode.RUN_USING_ENCODER);
// get a reference to the color sensor.
sensorColor = hardwareMap.get(ColorSensor.class, "sensorColor");
sensorColor.enableLed(true);
// Wait for the game to start (driver presses PLAY)
waitForStart();
// reset the timeout time and start motion.
robotOpsDelegate.runtime.reset();
RunInToPath1();
}
private void RunInToPath1() {
telemetry.setAutoClear(false);
//Unlatch robot
// //First we move a bit up
// robotOpsDelegate.UnLatchRobot(this, DRIVE_SPEED, -0.8, 5, "Unlatching the robot");
// //Then we unlock the latch Servo
// robotOpsDelegate.unlockLatchServo(this,5);
// // then we bring down the robot
// robotOpsDelegate.UnLatchRobot(this, DRIVE_SPEED, 3.5, 5, "Unlatching the robot");
//run lateral
robotOpsDelegate.encoderDrive(this, DRIVE_SPEED,-4,4,4,-4, 5.0, "Move away (right) from notch", true);
//run forward
robotOpsDelegate.encoderDrive(this, 0.9,12,12,12,12, 5.0, "Move forward", false);
//Delegate move the robot to 3 locations, find the yellow and push it,
// then it should come back to the same place. Whereever started from. (so encoder
robotOpsDelegate.findAndPushYellow (this, sensorColor, sensorDistance);
//run lateral to left for 10inch to hit all the jewels
// //Gyanesh MoveLeftScanAndHitJewel();
//
//Turn to left
robotOpsDelegate.encoderDrive(this, DRIVE_SPEED,-20, 20, -20, 20, 5000, "Lateral left", true);
//run towards wall
robotOpsDelegate.encoderDrive(this, DRIVE_SPEED,48, 48, 48, 48, 5000, "Lateral right", false);
// //Turn slight left
robotOpsDelegate.encoderDrive(this, DRIVE_SPEED,-16, 16, -16, 16, 5000, "slight left", true);
//run towards team's zone
robotOpsDelegate.encoderDrive(this, 0.9,60, 60, 60,60, 5000, "Reaching zone", false);
//
// //Finally, go and park in crater
// robotOpsDelegate.encoderDrive(this, DRIVE_SPEED,30, 30, 30,30, 5, "Parking to carater", false);
//Start the reverse Journey
robotOpsDelegate.encoderDrive(this, 0.9,-60, -60, -60,-60, 5000, "Coming Back ", false);
//Turn slight Right
robotOpsDelegate.encoderDrive(this, DRIVE_SPEED,16, -16, 16, -16, 5000, "slight Right", true);
//run towards middle
robotOpsDelegate.encoderDrive(this, DRIVE_SPEED,-44, -44, -44, -44, 5000, "Run to Middle", false);
//Turn to crater
robotOpsDelegate.encoderDrive(this, DRIVE_SPEED,20, -20, 20, -20, 5000, "Lateral right", true);
//run forward and touch the wall of crater
robotOpsDelegate.encoderDrive(this, 0.9,30,30,30,30, 5.0, "Move forward", false);
}
} |
package communication.packets.request.admin;
import communication.enums.PacketType;
import communication.packets.AuthenticatedRequestPacket;
import communication.packets.Packet;
import communication.packets.response.admin.GetAllAttendeesResponsePacket;
import communication.wrapper.Connection;
import main.Conference;
/**
* This packet can be used by an admin to retrieve the personal data of all attendees at once.
* Responds with an {@link GetAllAttendeesResponsePacket} if the request was valid.
*/
public class GetAllAttendeesRequestPacket extends AuthenticatedRequestPacket {
public GetAllAttendeesRequestPacket() {
super(PacketType.GET_ALL_ATTENDEES_REQUEST);
}
@Override
public void handle(Conference conference, Connection connection) {
if(isPermitted(conference, connection, true)) {
Packet response = new GetAllAttendeesResponsePacket(conference.getAllAttendees());
response.send(connection);
}
}
}
|
/*
* Name: James Horton
* Date: 12/11/2018
* Assignment: Final Project
* File: Books.java
*/
package froggy.s.book.and.game.store;
/**
*
* @author jh0375800
*/
public class Books extends Product
{
private String author;
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
// do i need methods for working with these items??
// maybe a print book item and price
// need a constructor to create this object
public Books(String code, String name,String desc, double prc, String author)
{
super(code, name, desc, prc);
this.author = author;
} // end of full constructor
public void display()
{
System.out.printf("%s \t%s",getItemCode(), getItemName());
} // end of display
} // end of class Books
|
/*
* [y] hybris Platform
*
* Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package de.hybris.platform.cmsfacades.pagetypesrestrictiontypes.impl;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.when;
import de.hybris.bootstrap.annotations.UnitTest;
import de.hybris.platform.cms2.model.CMSPageTypeModel;
import de.hybris.platform.cms2.model.RestrictionTypeModel;
import de.hybris.platform.cms2.servicelayer.services.admin.CMSAdminPageService;
import de.hybris.platform.cmsfacades.data.PageTypeRestrictionTypeData;
import java.util.Arrays;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
@UnitTest
@RunWith(MockitoJUnitRunner.class)
public class DefaultPageTypeRestrictionTypeFacadeTest
{
private static final String PAGE_TYPE_ID = "ContentPage";
private static final String RESTRICTION_TYPE_ID_1 = "CMSTimeRestriction";
private static final String RESTRICTION_TYPE_ID_2 = "CMSUserGroupRestriction";
@InjectMocks
private DefaultPageTypeRestrictionTypeFacade pageTypesRestrictionTypesFacade;
@Mock
private CMSAdminPageService adminPageService;
@Mock
private CMSPageTypeModel pageType;
@Mock
private RestrictionTypeModel restrictionType1;
@Mock
private RestrictionTypeModel restrictionType2;
@Before
public void setUp()
{
final List<CMSPageTypeModel> pageTypes = Arrays.asList(pageType);
when(pageType.getCode()).thenReturn(PAGE_TYPE_ID);
when(restrictionType1.getCode()).thenReturn(RESTRICTION_TYPE_ID_1);
when(restrictionType2.getCode()).thenReturn(RESTRICTION_TYPE_ID_2);
when(adminPageService.getAllPageTypes()).thenReturn(pageTypes);
when(pageType.getRestrictionTypes()).thenReturn(Arrays.asList(restrictionType1, restrictionType2));
}
@Test
public void shouldGetRestrictionTypesByPageType()
{
final List<PageTypeRestrictionTypeData> result = pageTypesRestrictionTypesFacade.getRestrictionTypesForAllPageTypes();
assertThat(result.size(), is(2));
assertThat(result.get(0).getPageType(), is(PAGE_TYPE_ID));
assertThat(result.get(0).getRestrictionType(), is(RESTRICTION_TYPE_ID_1));
assertThat(result.get(1).getPageType(), is(PAGE_TYPE_ID));
assertThat(result.get(1).getRestrictionType(), is(RESTRICTION_TYPE_ID_2));
}
}
|
package graphana.util;
/**
* Vertex status to hold the degree in order that it can be quickly retreived without computing and the list entry of
* the corresponding DegreeList
*
* @param <VertexType> The type of the vertex
* @author Andreas Fender
*/
public class DegreeStatus<VertexType> {
public int degree;
public QuickList.Entry<VertexType> entry;
public DegreeStatus(int degree, QuickList.Entry<VertexType> entry) {
this.degree = degree;
this.entry = entry;
}
@Override
public String toString() {
return "degree: " + degree;
}
}
|
package com.test;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;
public class CollectionMain {
public static void main(String[] args) {
AbstractApplicationContext ctx = new GenericXmlApplicationContext("classpath:Collection.xml");
ListEx listobj = ctx.getBean("listTest", ListEx.class);
listobj.printList();
System.out.println("테스트 =============================");
SetEx setobj = ctx.getBean("setTest", SetEx.class);
setobj.printSet();
System.out.println("테스트 =============================");
MapEx mapobj = ctx.getBean("mapTest", MapEx.class);
mapobj.printMap();
ctx.close();
}
}
|
package com.app.shubhamjhunjhunwala.thebakingapp;
import android.appwidget.AppWidgetManager;
import android.content.ComponentName;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.CompoundButton;
import android.widget.RadioButton;
import android.widget.Toast;
import com.app.shubhamjhunjhunwala.thebakingapp.Objects.Dish;
import com.app.shubhamjhunjhunwala.thebakingapp.Widgets.IngredientsWidget;
import com.google.gson.Gson;
import org.parceler.Parcels;
import java.util.ArrayList;
/**
* Created by shubham on 20/03/18.
*/
public class SettingsActivity extends AppCompatActivity {
public RadioButton nutellaPieRadioButton;
public RadioButton brownniesRadioButton;
public RadioButton yellowCakeRadioButton;
public RadioButton cheesacakeRadioButton;
public SharedPreferences sharedPref;
public SharedPreferences.Editor sharedPrefEditor;
public ArrayList<Dish> dishes;
public int dishID = -1;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
if (savedInstanceState == null) {
dishes = Parcels.unwrap(getIntent().getParcelableExtra("Dishes"));
} else {
dishes = Parcels.unwrap(savedInstanceState.getParcelable("Dishes"));
}
nutellaPieRadioButton = (RadioButton) findViewById(R.id.nutella_pie_radio_button);
brownniesRadioButton = (RadioButton) findViewById(R.id.brownies_radio_button);
yellowCakeRadioButton = (RadioButton) findViewById(R.id.yellow_cake_radio_button);
cheesacakeRadioButton = (RadioButton) findViewById(R.id.cheesecake_radio_button);
sharedPref = getSharedPreferences("Widget Dish Ingredients", Context.MODE_PRIVATE);
sharedPrefEditor = sharedPref.edit();
dishID = sharedPref.getInt("Dish ID", 1);
if (dishID != -1 && dishID == 1) {
nutellaPieRadioButton.setChecked(true);
} else if (dishID != -1 && dishID == 2) {
brownniesRadioButton.setChecked(true);
} else if (dishID != -1 && dishID == 3) {
yellowCakeRadioButton.setChecked(true);
} else if (dishID != -1 && dishID == 4) {
cheesacakeRadioButton.setChecked(true);
} else {
Log.e("Settings Activity", "No Data in Shared Preferences");
sharedPrefEditor.putInt("Dish ID", 1).apply();
sharedPrefEditor.putString("Dish Name", "Nutella Pie").apply();
}
nutellaPieRadioButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if (b) {
sharedPrefEditor.putInt("Dish ID", 1).apply();
sharedPrefEditor.putString("Dish Name", "Nutella Pie").apply();
updateWidget();
}
}
});
brownniesRadioButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if (b) {
sharedPrefEditor.putInt("Dish ID", 2).apply();
sharedPrefEditor.putString("Dish Name", "Brownies").apply();
updateWidget();
}
}
});
yellowCakeRadioButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if (b) {
sharedPrefEditor.putInt("Dish ID", 3).apply();
sharedPrefEditor.putString("Dish Name", "Yellow Cake").apply();
updateWidget();
}
}
});
cheesacakeRadioButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if (b) {
sharedPrefEditor.putInt("Dish ID", 4).apply();
sharedPrefEditor.putString("Dish Name", "Cheesecake").apply();
updateWidget();
}
}
});
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putParcelable("Dishes", Parcels.wrap(dishes));
}
public void updateWidget() {
Intent intent = new Intent(this, IngredientsWidget.class);
intent.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
int[] ids = AppWidgetManager.getInstance(getApplication()).getAppWidgetIds(new ComponentName(getApplication(), IngredientsWidget.class));
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids);
sendBroadcast(intent);
}
}
|
package com.example.trent.brogains.Triceps;
/**
* Created by Trent on 5/10/2016.
*/
public class TricepCustomAdapter {
}
|
package egg.project000;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import egg.project000.controlers.ControlerHeader;
import egg.project000.controlers.DrugControler;
import egg.project000.controlers.MedListControler;
import egg.project000.controlers.PatientControler;
import io.javalin.Javalin;
public class App {
private static Javalin aJavalinObj;
private static final Logger aLogger = LoggerFactory.getLogger(App.class);
public static void main(String[] args) {
aLogger.info("");
aLogger.info("App has started; 874 I am a potato.");
aLogger.info("configureing Javalin Obj; 874 I am a potato.");
configureJavalin();
aLogger.info("configureing controlers; 874 I am a potato.");
configure(new PatientControler(), new DrugControler(), new MedListControler());
// TODO: addExceptionHandlers();
}
private static void configureJavalin() {
aJavalinObj = Javalin.create(config -> {
config.defaultContentType = "application/json";
config.enforceSsl = false;
config.ignoreTrailingSlashes = true;
config.enableCorsForAllOrigins();
config.enableDevLogging();
});
aJavalinObj.start(8042);
}
public static void configure(ControlerHeader... controllers) {
int i = 1;
for(ControlerHeader c : controllers) {
//aLogger.info("adding routes from controler #" + i + "; 874 I am a potato.");
c.addRoutes(aJavalinObj);
i++;
}
}
}
|
package com.zznode.opentnms.isearch.model.bo;
import java.util.HashMap;
import java.util.Map;
public class EmsGraph {
private Map<String, Zhandian> zdmap = new HashMap<String, Zhandian>();
public Map<String, Zhandian> getZdmap() {
return zdmap;
}
public void setZdmap(Map<String, Zhandian> zdmap) {
this.zdmap = zdmap;
}
}
|
package tech.adrianohrl.stile.control.bean.production.services;
import tech.adrianohrl.stile.control.bean.Service;
import tech.adrianohrl.stile.control.dao.production.PhaseDAO;
import tech.adrianohrl.stile.model.production.Phase;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.persistence.EntityManager;
/**
*
* @author Adriano Henrique Rossette Leite (contact@adrianohrl.tech)
*/
@ManagedBean
@SessionScoped
public class PhaseService extends Service<Phase> {
@Override
public String getErrorMessage() {
return "Nenhuma fase foi cadastrada ainda!!!";
}
@Override
protected List<Phase> getElements(EntityManager em) {
PhaseDAO phaseDAO = new PhaseDAO(em);
return phaseDAO.findAll();
}
public List<Phase> getPhases() {
return getElements();
}
}
|
/*
* Created on 28-nov-2004
*
*/
package es.ucm.fdi.si.modelo;
import java.awt.Graphics;
/**
* @author Alejandro Blanco, David Curieses Chamon, Oscar Ortega
*
* Proyecto Sistemas Informaticos:
*
* Herramienta CASE para diseño y prototipado de aplicaciones hipermedia
*/
public abstract class Elemento implements Comparable{
public static final int RESIZE = -2;
public static final int NINGUNO=-1;
public static final int SELECCION=0;
public static final int NEXO=1;
public static final int CONTENEDOR=2;
public static final int ACTIVADOR_NEXO=3;
public static final int CONEXION=4;
public static final int ENLACE=5;
public static final int CONEXION_SINCRO=6;
public static final int ENLACE_SINCRO=7;
// contenido
public static final int CONTENIDO_ESTATICO_GRANDE=8;
public static final int CONTENIDO_ESTATICO_PEQUEÑO=9;
public static final int CONTENIDO_DINAMICO_GRANDE=10;
public static final int CONTENIDO_DINAMICO_PEQUEÑO=11;
public static final int ANCLA_ESTATICA=12;
public static final int ANCLA_DINAMICA=13;
public static final int ENLACE_ESTATICO=14;
public static final int ENLACE_DINAMICO=15;
public static final int ENLACE_ESTATICO_NARIO=16;
public static final int ENLACE_DINAMICO_NARIO=17;
protected String nombre;
public Elemento(String nombre) {
this.nombre=nombre;
}
public abstract void pintate(Graphics g);
public abstract boolean estaDentro(int x, int y);
public abstract boolean esRelacion();
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public boolean equals(Object otro) {
return this.nombre.equals(((Elemento)otro).getNombre());
}
public int compareTo(Object otro) {
return this.nombre.compareTo(((Elemento)otro).getNombre());
}
}
|
package net.optifine.entity.model;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelCow;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderMooshroom;
import net.minecraft.entity.passive.EntityMooshroom;
public class ModelAdapterMooshroom extends ModelAdapterQuadruped {
public ModelAdapterMooshroom() {
super(EntityMooshroom.class, "mooshroom", 0.7F);
}
public ModelBase makeModel() {
return (ModelBase)new ModelCow();
}
public IEntityRenderer makeEntityRender(ModelBase modelBase, float shadowSize) {
RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
RenderMooshroom rendermooshroom = new RenderMooshroom(rendermanager);
rendermooshroom.mainModel = modelBase;
rendermooshroom.shadowSize = shadowSize;
return (IEntityRenderer)rendermooshroom;
}
}
/* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\net\optifine\entity\model\ModelAdapterMooshroom.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/ |
package com.rc.portal.service.impl;
import java.sql.SQLException;
import java.util.List;
import com.rc.portal.dao.TMemberLeaderDAO;
import com.rc.portal.service.TMemberLeaderManager;
import com.rc.portal.vo.TMemberLeader;
import com.rc.portal.vo.TMemberLeaderExample;
public class TMemberLeaderManagerImpl implements TMemberLeaderManager {
private TMemberLeaderDAO tmemberleaderdao;
public TMemberLeaderManagerImpl() {
super();
}
public void setTmemberleaderdao(TMemberLeaderDAO tmemberleaderdao){
this.tmemberleaderdao=tmemberleaderdao;
}
public TMemberLeaderDAO getTmemberleaderdao(){
return this.tmemberleaderdao;
}
public int countByExample(TMemberLeaderExample example) throws SQLException{
return tmemberleaderdao. countByExample( example);
}
public int deleteByExample(TMemberLeaderExample example) throws SQLException{
return tmemberleaderdao. deleteByExample( example);
}
public int deleteByPrimaryKey(Long id) throws SQLException{
return tmemberleaderdao. deleteByPrimaryKey( id);
}
public Long insert(TMemberLeader record) throws SQLException{
return tmemberleaderdao. insert( record);
}
public Long insertSelective(TMemberLeader record) throws SQLException{
return tmemberleaderdao. insertSelective( record);
}
public List selectByExample(TMemberLeaderExample example) throws SQLException{
return tmemberleaderdao. selectByExample( example);
}
public TMemberLeader selectByPrimaryKey(Long id) throws SQLException{
return tmemberleaderdao. selectByPrimaryKey( id);
}
public int updateByExampleSelective(TMemberLeader record, TMemberLeaderExample example) throws SQLException{
return tmemberleaderdao. updateByExampleSelective( record, example);
}
public int updateByExample(TMemberLeader record, TMemberLeaderExample example) throws SQLException{
return tmemberleaderdao. updateByExample( record, example);
}
public int updateByPrimaryKeySelective(TMemberLeader record) throws SQLException{
return tmemberleaderdao. updateByPrimaryKeySelective( record);
}
public int updateByPrimaryKey(TMemberLeader record) throws SQLException{
return tmemberleaderdao. updateByPrimaryKey( record);
}
}
|
package Menus;
public class showMenus {
public static void showMenuStart() {
System.out.println("\n\n Options:");
System.out.println("\n\t1. Owner");
System.out.println("\t2. Client");
System.out.println("\t3. Close the system");
System.out.print("\n\tChoose an option:\n");
}
public static void showMenuOwner() {
System.out.println("\n\n Options:");
System.out.println("\n\t1. Manage products");
System.out.println("\t2. Manage clients");
System.out.println("\t3. Manage orders");
System.out.println("\t4. Return to the start screen");
System.out.print("\n\tChoose an option:\n");
}
public static void showMenuProducts() {
System.out.println("\n\n Options:");
System.out.println("\n\t1. Add a new product");
System.out.println("\t2. Delete a product");
System.out.println("\t3. Add a new computer pack");
System.out.println("\t4. Show available stock");
System.out.println("\t5. Change available stock of a product");
System.out.println("\t6. Show all products which are part of any computer packs");
System.out.println("\t7. Show the product catalogue");
System.out.println("\t8. Return to the owner menu");
System.out.print("\n\tChoose an option:\n");
}
public static void showMenuClients() {
System.out.println("\n\n Options:");
System.out.println("\n\t1. Add a client");
System.out.println("\t2. Remove a client");
System.out.println("\t3. Show all the clients in the system");
System.out.println("\t4. Return to the owner menu");
System.out.print("\n\t\t\tChoose an option:\n");
}
public static void showMenuOrders() {
System.out.println("\n\n Options:");
System.out.println("\n\t1. Add a new order");
System.out.println("\t2. Show the products which appear in any of the orders");
System.out.println("\t3. Compare amount of orders of 2 products");
System.out.println("\t4. Show all the orders in the system");
System.out.println("\t5. Return to the owner menu");
System.out.print("\n\t\t\tChoose an option:\n");
}
}
|
package compilador.analisador.semantico;
import java.util.Arrays;
import compilador.estruturas.String;
public class TSLinha {
private int[] nome; // nome do simbolo
private int tipo; // tipo do simbolo: int, char, string, boolean, "struct"
private int categoria; // categoria do simbolo: VARIAVEL, FUNCAO, VETOR, MATRIZ, PARAMETRO
private String endereco; // pode ser HexaDecimal
private int tamanho; // numero de bytes do simbolo
private boolean declarado; // Se ele j‡ foi declarado antes de ser usado, s‹o setado true se est‡ numa declara¨‹o
private TSLinha[] parametros = new TSLinha[100];
private String rotulo; // se for fun¨‹o, ter‡ um r—tulo.
public TSLinha(int[] nome)
{
this.nome = nome;
for(int i = 0; i < this.parametros.length; i++)
{
this.parametros[i] = null;
}
}
public int[] getNome() {
return nome;
}
public void setNome(int[] nome) {
this.nome = nome;
}
public int getTipo() {
return tipo;
}
public void setTipo(int tipo) {
this.tipo = tipo;
}
public int getCategoria() {
return categoria;
}
public void setCategoria(int categoria) {
this.categoria = categoria;
}
public String getEndereco() {
return endereco;
}
public void setEndereco(String endereco) {
this.endereco = endereco;
}
public int getTamanho() {
return tamanho;
}
public void setTamanho(int tamanho) {
this.tamanho = tamanho;
}
public boolean isDeclarado() {
return declarado;
}
public void setDeclarado(boolean declarado) {
this.declarado = declarado;
}
public TSLinha[] getParametros() {
return parametros;
}
public void setParametros(TSLinha[] parametros) {
this.parametros = parametros;
}
public String getRotulo() {
return rotulo;
}
public void setRotulo(String rotulo) {
this.rotulo = rotulo;
}
public void addToParametros(TSLinha parametro) {
for(int i = 0; i < this.parametros.length; i++)
{
if(this.parametros[i] == null){
this.parametros[i] = parametro;
}
}
}
public int numberOfParameters()
{
for(int i = 0; i < this.parametros.length; i++)
{
if(this.parametros[i] == null){
return i;
}
}
return 0;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + categoria;
result = prime * result + (declarado ? 1231 : 1237);
result = prime * result
+ ((endereco == null) ? 0 : endereco.hashCode());
result = prime * result + Arrays.hashCode(nome);
result = prime * result + Arrays.hashCode(parametros);
result = prime * result + ((rotulo == null) ? 0 : rotulo.hashCode());
result = prime * result + tamanho;
result = prime * result + tipo;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TSLinha other = (TSLinha) obj;
if (categoria != other.categoria)
return false;
if (declarado != other.declarado)
return false;
if (endereco == null) {
if (other.endereco != null)
return false;
} else if (!endereco.equals(other.endereco))
return false;
if (!Arrays.equals(nome, other.nome))
return false;
if (!Arrays.equals(parametros, other.parametros))
return false;
if (rotulo == null) {
if (other.rotulo != null)
return false;
} else if (!rotulo.equals(other.rotulo))
return false;
if (tamanho != other.tamanho)
return false;
if (tipo != other.tipo)
return false;
return true;
}
}
|
package ru.lember.neointegrationadapter.message;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
public interface DestinationInfo {
@NonNull
DestinationType getDestinationType();
@Nullable
String getValue();
}
|
/**
*
*/
package com.shubhendu.javaworld.datastructures.mst;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import com.shubhendu.javaworld.datastructures.unionFind.UnionFind;
/**
* @author ssingh
*
*/
public class KruskalsMST {
private Queue<Edge> mst;
public KruskalsMST(EdgeWeightedGraph G) {
PriorityQueue<Edge> pq = new PriorityQueue<>((Comparator<Edge>)((a, b) -> (int) (a.getWeight() - b.getWeight())));
UnionFind uf = new UnionFind(G.numberOfVertices());
this.mst = new LinkedList<Edge>();
for (Edge e : G.edges()) {
pq.add(e);
}
while (!pq.isEmpty() && this.mst.size() < G.numberOfVertices() - 1) {
Edge e = pq.poll();
int v = e.either();
int w = e.other(v);
if (!uf.connected(v, w)) {
uf.union(v, w);
mst.add(e);
}
}
}
public Iterable<Edge> edges() {
return mst;
}
public Double weight() {
return null;
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
|
package org.tosch.neverrest.data.repositories;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.search.SearchHit;
import org.springframework.data.repository.NoRepositoryBean;
import org.tosch.neverrest.data.models.CoreDataEntity;
import org.tosch.neverrest.data.models.DataEntityPage;
import java.util.ArrayList;
import java.util.List;
@NoRepositoryBean
public interface CouchbaseElasticsearchCoreEntityRepository<D extends CoreDataEntity<String>> extends CouchbaseCoreEntityRepository<D> {
default DataEntityPage<D> getPage(Client client, String index, int offset, int limit) {
SearchResponse searchResponse = client.prepareSearch(index)
.setTypes("couchbaseDocument")
.setFrom(offset)
.setSize(limit)
.execute().actionGet();
List<String> ids = new ArrayList<>();
for (SearchHit searchHitFields : searchResponse.getHits()) {
ids.add(searchHitFields.getId());
}
DataEntityPage<D> coreDataEntityPage = new DataEntityPage<>();
coreDataEntityPage.setOffset(offset);
coreDataEntityPage.setLimit(limit);
coreDataEntityPage.setSize(searchResponse.getHits().totalHits());
coreDataEntityPage.setItems(findAllById(ids));
return coreDataEntityPage;
}
}
|
package roberth.com.applivrus.adapters;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.PopupMenu;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import java.util.List;
import roberth.com.applivrus.app.FormularioLivroActivity;
import roberth.com.applivrus.models.Livro;
import roberth.com.applivrus.app.LivrosStatus;
import roberth.com.applivrus.R;
/**
* Created by Roberth Santos on 17/02/2018.
*/
public class ListaLivrosRVAdapter extends RecyclerView.Adapter<ListaLivrosRVAdapter.ViewHolder> {
private final Context context;
private final List<Livro> livros;
@Override
public ListaLivrosRVAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
View view = inflater.inflate(R.layout.item_livros,parent,false);
ViewHolder viewHolder = new ViewHolder(view);
return viewHolder;
}
@Override
public void onBindViewHolder(ViewHolder holder, final int position) {
final Livro livro = this.livros.get(position);
holder.tvLivroNome.setText(livro.getTitulo());
/*try {
holder.tvLivroAutor.setText(livro.getAutor().getNome());
}catch (NullPointerException npe){
holder.tvLivroAutor.setText("Desconhecido");
}*/
try {
holder.pbLivroProgresso.setProgress((Integer.valueOf(livro.getPaginaAtual() * 100) / Integer.valueOf(livro.getPaginas())));
}catch (Exception npe){
holder.pbLivroProgresso.setProgress(0);
}
//holder.tvLivroGenero.setText(livro.getGenero());
holder.itemView.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
//Snackbar.make(v, "Livro: " + livro.getTitulo(), Snackbar.LENGTH_LONG).show();
Intent intent = new Intent(context, LivrosStatus.class);
intent.putExtra("livro",livro.getId());
context.startActivity(intent);
}
});
holder.itemView.setOnLongClickListener(new View.OnLongClickListener(){
@Override
public boolean onLongClick(View v) {
PopupMenu pop = new PopupMenu(context, v);
MenuInflater menuInflater = pop.getMenuInflater();
menuInflater.inflate(R.menu.popup_menu_lista_livros, pop.getMenu());
pop.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
//Deletar livro
if (item.getItemId() == R.id.item_remover_livro){
livro.delete();
ListaLivrosRVAdapter.this.livros.remove(position);
ListaLivrosRVAdapter.this.notifyItemRemoved(position);
ListaLivrosRVAdapter.this.notifyItemChanged(position,ListaLivrosRVAdapter.this.livros.size());
Toast.makeText(context,"Removido",Toast.LENGTH_SHORT).show();
}
//Editar livro
if (item.getItemId() == R.id.item_editar_livro){
Intent intent = new Intent(context, FormularioLivroActivity.class);
intent.putExtra("livro",livro.getId());
context.startActivity(intent);
}
return true;
}
});
pop.show();
return true;
}
});
}
@Override
public int getItemCount() {
return livros.size();
}
public static class ViewHolder extends RecyclerView.ViewHolder{
protected TextView tvLivroNome;
protected TextView tvLivroGenero;
//protected TextView tvLivroAutor;
protected ProgressBar pbLivroProgresso;
public ViewHolder(View itemView){
super(itemView);
tvLivroNome = (TextView) itemView.findViewById(R.id.tv_livro_nome);
//tvLivroGenero = (TextView) itemView.findViewById(R.id.tv_livro_genero);
// tvLivroAutor = (TextView) itemView.findViewById(R.id.tv_livro_autor);
pbLivroProgresso = (ProgressBar) itemView.findViewById(R.id.pb_livo);
}
}
public ListaLivrosRVAdapter(Context context, List<Livro> livros){
this.context = context;
this.livros = livros;
}
}
|
package services.inventory;
import model.domain.*;
import model.forms.GrupStocFormModel;
import model.forms.InventarFormModel;
import model.forms.StocFormModel;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@Service
public interface InventoryService {
List<Stoc> findAllItems();
List<Stoc> findItemsForUser();
Stoc save(StocFormModel entity);
Stoc edit(StocFormModel entity);
Stoc findArticol(Long idArticol);
Stoc findArticolByCodStoc(String codStoc);
List<StareStoc> findAllStari();
TranzactieStoc findLastTranzactieForArticol(Long idArticol);
List<TranzactieStoc> findAllTranzactiiForArticol(Long idArticol);
String generateBarcode(String id);
String downloadBarcode(String barcode, HttpServletResponse response);
List<Loc> findAllLocuri();
Loc saveLoc(Loc entity);
List<CategorieStoc> findAllCategorii();
List<GrupStoc> findAllTipuri();
List<GrupStoc> findTipuriByCategorieStoc(Long idCategorieStoc);
List<Persoana> findAllPersoane();
CategorieStoc saveCategorie(CategorieStoc entity);
GrupStoc saveGrup(GrupStocFormModel entity);
Stoc removeStoc(Long idStoc);
boolean iesire(InventarFormModel iesire);
boolean intrare(InventarFormModel model);
}
|
package com.ligz.a;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* 基础线程机制
* author:ligz
*/
public class ExecutorTest {
public static void main(String[] args) {
//Executor 管理多个异步任务的执行,而无需程序员显式地管理线程的生命周期。这里的异步是指多个任务的执行互不干扰,不需要进行同步操作
ExecutorService executorService = Executors.newCachedThreadPool();
for (int i = 0; i < 100; i++){
executorService.execute(new MyRunnable());
}
executorService.shutdown();
//
Thread thread = new Thread(new MyRunnable());
thread.setDaemon(true);
}
//非守护线程,主线程结束后子线程继续执行
public void no_dameon(){
Thread t = new Thread(new Runnable() {
public void run() {
// TODO Auto-generated method stub
for(int i=1 ; i<=10 ; i++){
try {
Thread.sleep(500);//线程休眠500毫秒
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("子线程执行"+i+"次");
}
}
}) ;
t.start();
for(int i=1 ; i<=5 ; i++){
System.out.println("主线程执行"+i+"次");
}
}
//守护线程,主线程结束后守护线程结束,不在执行。常见的有垃圾回收
public void dameon(){
Thread t = new Thread(new Runnable() {
public void run() {
// TODO Auto-generated method stub
for(int i=1 ; i<=10 ; i++){
try {
Thread.sleep(500);//线程休眠500毫秒
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("子线程执行"+i+"次");
}
}
}) ;
t.start();
for(int i=1 ; i<=5 ; i++){
System.out.println("主线程执行"+i+"次");
}
}
}
|
package com.sporsimdi.action.facade;
import java.util.List;
import com.sporsimdi.model.entity.Rol;
import com.sporsimdi.model.type.Status;
public interface RolFacade {
public Rol findById(long id);
public Rol findByKullanici(String kullanici);
public void persist(Rol rol);
public void merge(Rol rol);
public List<Rol> getByStatus(Status status);
public void remove(long id);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.