text
stringlengths 10
2.72M
|
|---|
package com.google.android.exoplayer2.source.b;
import android.os.Handler;
import android.text.TextUtils;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.i.t;
import com.google.android.exoplayer2.source.b.a.e.b;
import com.google.android.exoplayer2.source.b.j.a;
import com.google.android.exoplayer2.source.d;
import com.google.android.exoplayer2.source.e;
import com.google.android.exoplayer2.source.h;
import com.google.android.exoplayer2.source.i;
import com.google.android.exoplayer2.source.l;
import com.google.android.exoplayer2.source.m;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.List;
public final class g implements b, a, e {
private m acW;
private e.a arL;
private final k asZ = new k();
private final com.google.android.exoplayer2.h.b asl;
private final d atN;
private final int atO;
private final com.google.android.exoplayer2.source.a.a atP;
private final IdentityHashMap<i, Integer> atQ = new IdentityHashMap();
final Handler atR = new Handler();
private int atS;
j[] atT = new j[0];
private j[] atU = new j[0];
private d atV;
final com.google.android.exoplayer2.source.b.a.e atb;
public g(com.google.android.exoplayer2.source.b.a.e eVar, d dVar, int i, com.google.android.exoplayer2.source.a.a aVar, com.google.android.exoplayer2.h.b bVar) {
this.atb = eVar;
this.atN = dVar;
this.atO = i;
this.atP = aVar;
this.asl = bVar;
}
public final void a(e.a aVar, long j) {
int i;
com.google.android.exoplayer2.source.b.a.a.a aVar2;
List list;
int i2;
int i3;
this.arL = aVar;
this.atb.avD.add(this);
com.google.android.exoplayer2.source.b.a.a aVar3 = this.atb.ats;
List arrayList = new ArrayList(aVar3.auC);
ArrayList arrayList2 = new ArrayList();
Collection arrayList3 = new ArrayList();
int i4 = 0;
while (true) {
i = i4;
if (i >= arrayList.size()) {
break;
}
aVar2 = (com.google.android.exoplayer2.source.b.a.a.a) arrayList.get(i);
if (aVar2.aep.height > 0 || a(aVar2, "avc")) {
arrayList2.add(aVar2);
} else if (a(aVar2, "mp4a")) {
arrayList3.add(aVar2);
}
i4 = i + 1;
}
if (arrayList2.isEmpty()) {
if (arrayList3.size() < arrayList.size()) {
arrayList.removeAll(arrayList3);
}
list = arrayList;
} else {
list = arrayList2;
}
List list2 = aVar3.auD;
List list3 = aVar3.auE;
this.atT = new j[((list2.size() + 1) + list3.size())];
this.atS = this.atT.length;
com.google.android.exoplayer2.i.a.ao(!list.isEmpty());
com.google.android.exoplayer2.source.b.a.a.a[] aVarArr = new com.google.android.exoplayer2.source.b.a.a.a[list.size()];
list.toArray(aVarArr);
j a = a(0, aVarArr, aVar3.auc, aVar3.atd, j);
i4 = 1;
this.atT[0] = a;
a.ak(true);
a.la();
i = 0;
while (true) {
i2 = i4;
i3 = i;
if (i3 >= list2.size()) {
break;
}
a = a(1, new com.google.android.exoplayer2.source.b.a.a.a[]{(com.google.android.exoplayer2.source.b.a.a.a) list2.get(i3)}, null, Collections.emptyList(), j);
i4 = i2 + 1;
this.atT[i2] = a;
a.la();
i = i3 + 1;
}
for (i3 = 0; i3 < list3.size(); i3++) {
a = a(3, new com.google.android.exoplayer2.source.b.a.a.a[]{(com.google.android.exoplayer2.source.b.a.a.a) list3.get(i3)}, null, Collections.emptyList(), j);
a.cL(0).f(aVar2.aep);
a.auj = true;
a.ld();
i4 = i2 + 1;
this.atT[i2] = a;
i2 = i4;
}
this.atU = this.atT;
}
public final void kx() {
for (j kC : this.atT) {
kC.kC();
}
}
public final m ky() {
return this.acW;
}
public final long a(com.google.android.exoplayer2.g.e[] eVarArr, boolean[] zArr, i[] iVarArr, boolean[] zArr2, long j) {
int i;
int[] iArr = new int[eVarArr.length];
int[] iArr2 = new int[eVarArr.length];
int i2 = 0;
while (true) {
i = i2;
if (i >= eVarArr.length) {
break;
}
if (iVarArr[i] == null) {
i2 = -1;
} else {
i2 = ((Integer) this.atQ.get(iVarArr[i])).intValue();
}
iArr[i] = i2;
iArr2[i] = -1;
if (eVarArr[i] != null) {
l lG = eVarArr[i].lG();
for (i2 = 0; i2 < this.atT.length; i2++) {
if (this.atT[i2].acW.a(lG) != -1) {
iArr2[i] = i2;
break;
}
}
}
i2 = i + 1;
}
boolean z = false;
this.atQ.clear();
Object obj = new i[eVarArr.length];
i[] iVarArr2 = new i[eVarArr.length];
com.google.android.exoplayer2.g.e[] eVarArr2 = new com.google.android.exoplayer2.g.e[eVarArr.length];
int i3 = 0;
j[] jVarArr = new j[this.atT.length];
i2 = 0;
while (true) {
i = i2;
if (i < this.atT.length) {
i2 = 0;
while (i2 < eVarArr.length) {
iVarArr2[i2] = iArr[i2] == i ? iVarArr[i2] : null;
eVarArr2[i2] = iArr2[i2] == i ? eVarArr[i2] : null;
i2++;
}
j jVar = this.atT[i];
com.google.android.exoplayer2.i.a.ap(jVar.adE);
int i4 = jVar.auk;
i2 = 0;
while (true) {
int i5 = i2;
if (i5 >= eVarArr2.length) {
break;
}
if (iVarArr2[i5] != null && (eVarArr2[i5] == null || !zArr[i5])) {
jVar.q(((i) iVarArr2[i5]).group, false);
iVarArr2[i5] = null;
}
i2 = i5 + 1;
}
Object obj2 = (z || (jVar.auu ? i4 == 0 : j != jVar.aur)) ? 1 : null;
com.google.android.exoplayer2.g.e eVar = jVar.aub.atl;
i4 = 0;
Object obj3 = obj2;
com.google.android.exoplayer2.g.e eVar2 = eVar;
while (i4 < eVarArr2.length) {
if (iVarArr2[i4] == null && eVarArr2[i4] != null) {
com.google.android.exoplayer2.g.e eVar3 = eVarArr2[i4];
int a = jVar.acW.a(eVar3.lG());
jVar.q(a, true);
if (a == jVar.aun) {
jVar.aub.atl = eVar3;
eVar2 = eVar3;
}
iVarArr2[i4] = new i(jVar, a);
zArr2[i4] = true;
if (obj3 == null) {
h hVar = jVar.auh[a];
hVar.rewind();
if (!hVar.e(j, true)) {
com.google.android.exoplayer2.source.g gVar = hVar.asn;
if (gVar.ase + gVar.asc != 0) {
obj2 = 1;
i4++;
obj3 = obj2;
}
}
obj2 = null;
i4++;
obj3 = obj2;
}
}
obj2 = obj3;
i4++;
obj3 = obj2;
}
if (jVar.auk == 0) {
jVar.aub.atg = null;
jVar.aul = null;
jVar.auf.clear();
if (jVar.aud.iD()) {
for (h kM : jVar.auh) {
kM.kM();
}
jVar.aud.lY();
} else {
jVar.lc();
}
} else {
boolean z2;
if (!(jVar.auf.isEmpty() || t.i(eVar2, eVar))) {
if (jVar.auu) {
obj2 = 1;
} else {
eVar2.kU();
obj2 = eVar2.lI() != jVar.aub.atc.j(((f) jVar.auf.getLast()).asK) ? 1 : null;
}
if (obj2 != null) {
z2 = true;
obj3 = 1;
jVar.aut = true;
if (obj3 != null) {
jVar.g(j, z2);
for (i2 = 0; i2 < iVarArr2.length; i2++) {
if (iVarArr2[i2] != null) {
zArr2[i2] = true;
}
}
}
}
}
z2 = z;
if (obj3 != null) {
jVar.g(j, z2);
for (i2 = 0; i2 < iVarArr2.length; i2++) {
if (iVarArr2[i2] != null) {
zArr2[i2] = true;
}
}
}
}
jVar.auu = true;
Object obj4 = null;
for (i2 = 0; i2 < eVarArr.length; i2++) {
if (iArr2[i2] == i) {
com.google.android.exoplayer2.i.a.ap(iVarArr2[i2] != null);
obj[i2] = iVarArr2[i2];
obj4 = 1;
this.atQ.put(iVarArr2[i2], Integer.valueOf(i));
} else if (iArr[i2] == i) {
com.google.android.exoplayer2.i.a.ap(iVarArr2[i2] == null);
}
}
if (obj4 != null) {
jVarArr[i3] = jVar;
i2 = i3 + 1;
if (i3 == 0) {
jVar.ak(true);
if (!(obj3 == null && this.atU.length != 0 && jVar == this.atU[0])) {
this.asZ.aux.clear();
z = true;
i3 = i2;
}
} else {
jVar.ak(false);
}
i3 = i2;
}
i2 = i + 1;
} else {
System.arraycopy(obj, 0, iVarArr, 0, obj.length);
this.atU = (j[]) Arrays.copyOf(jVarArr, i3);
this.atV = new d(this.atU);
return j;
}
}
}
public final void E(long j) {
for (j jVar : this.atU) {
int length = jVar.auh.length;
for (int i = 0; i < length; i++) {
h hVar = jVar.auh[i];
hVar.L(hVar.asn.f(j, jVar.aup[i]));
}
}
}
public final boolean G(long j) {
return this.atV.G(j);
}
public final long kB() {
return this.atV.kB();
}
public final long kz() {
return -9223372036854775807L;
}
public final long kA() {
return this.atV.kA();
}
public final long F(long j) {
if (this.atU.length > 0) {
boolean g = this.atU[0].g(j, false);
for (int i = 1; i < this.atU.length; i++) {
this.atU[i].g(j, g);
}
if (g) {
this.asZ.aux.clear();
}
}
return j;
}
public final void iy() {
int i = this.atS - 1;
this.atS = i;
if (i <= 0) {
int i2 = 0;
for (j jVar : this.atT) {
i2 += jVar.acW.length;
}
l[] lVarArr = new l[i2];
i2 = 0;
for (j jVar2 : this.atT) {
int i3 = jVar2.acW.length;
i = 0;
while (i < i3) {
int i4 = i2 + 1;
lVarArr[i2] = jVar2.acW.asI[i];
i++;
i2 = i4;
}
}
this.acW = new m(lVarArr);
this.arL.a(this);
}
}
public final void a(com.google.android.exoplayer2.source.b.a.a.a aVar) {
((com.google.android.exoplayer2.source.b.a.e.a) this.atb.avA.get(aVar)).lg();
}
public final void kY() {
kZ();
}
public final void b(com.google.android.exoplayer2.source.b.a.a.a aVar) {
for (j jVar : this.atT) {
c cVar = jVar.aub;
int j = cVar.atc.j(aVar.aep);
if (j != -1) {
j = cVar.atl.indexOf(j);
if (j != -1) {
cVar.atl.cU(j);
}
}
}
kZ();
}
private j a(int i, com.google.android.exoplayer2.source.b.a.a.a[] aVarArr, Format format, List<Format> list, long j) {
return new j(i, this, new c(this.atb, aVarArr, this.atN, this.asZ, list), this.asl, j, format, this.atO, this.atP);
}
private void kZ() {
if (this.acW != null) {
this.arL.a(this);
return;
}
for (j la : this.atT) {
la.la();
}
}
private static boolean a(com.google.android.exoplayer2.source.b.a.a.a aVar, String str) {
Object obj = aVar.aep.adT;
if (TextUtils.isEmpty(obj)) {
return false;
}
for (String startsWith : obj.split("(\\s*,\\s*)|(\\s*$)")) {
if (startsWith.startsWith(str)) {
return true;
}
}
return false;
}
}
|
/**
* 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.business.impl.report;
import java.util.List;
import javax.persistence.EntityManager;
import seava.ad.business.api.report.IReportService;
import seava.ad.domain.impl.report.Report;
import seava.ad.domain.impl.report.ReportServer;
import seava.j4e.api.session.Session;
import seava.j4e.business.service.entity.AbstractEntityService;
/**
* Repository functionality for {@link Report} domain entity. It contains
* finder methods based on unique keys as well as reference fields.
*
*/
public class Report_Service extends AbstractEntityService<Report>
implements
IReportService {
public Report_Service() {
super();
}
public Report_Service(EntityManager em) {
super();
this.setEntityManager(em);
}
@Override
public Class<Report> getEntityClass() {
return Report.class;
}
/**
* Find by unique key
*/
public Report findByCode(String code) {
return (Report) this
.getEntityManager()
.createNamedQuery(Report.NQ_FIND_BY_CODE)
.setParameter("clientId",
Session.user.get().getClient().getId())
.setParameter("code", code).getSingleResult();
}
/**
* Find by unique key
*/
public Report findByName(String name) {
return (Report) this
.getEntityManager()
.createNamedQuery(Report.NQ_FIND_BY_NAME)
.setParameter("clientId",
Session.user.get().getClient().getId())
.setParameter("name", name).getSingleResult();
}
/**
* Find by reference: reportServer
*/
public List<Report> findByReportServer(ReportServer reportServer) {
return this.findByReportServerId(reportServer.getId());
}
/**
* Find by ID of reference: reportServer.id
*/
public List<Report> findByReportServerId(String reportServerId) {
return (List<Report>) this
.getEntityManager()
.createQuery(
"select e from Report e where e.clientId = :clientId and e.reportServer.id = :reportServerId",
Report.class)
.setParameter("clientId",
Session.user.get().getClient().getId())
.setParameter("reportServerId", reportServerId).getResultList();
}
}
|
package edunova;
public class Stan {
}
|
package jiang.newspaper.fragment;
import android.support.annotation.IdRes;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.RadioGroup;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import org.xutils.view.annotation.ViewInject;
import org.xutils.x;
import java.util.ArrayList;
import jiang.newspaper.R;
import jiang.newspaper.activity.MainActivity;
import jiang.newspaper.adapter.MyContentPagerAdapter;
import jiang.newspaper.base.BaseFragment;
import jiang.newspaper.base.BasePager;
import jiang.newspaper.pager.HomePager;
import jiang.newspaper.pager.NewsCenterPager;
import jiang.newspaper.pager.SettingPager;
import jiang.newspaper.pager.SmartServicePager;
import jiang.newspaper.utils.LogUtil;
import jiang.newspaper.view.NoScrollViewPager;
/**
* Created by 在云端 on 2017/3/23.
*/
public class ContentFragment extends BaseFragment {
@ViewInject(R.id.rg_main)
private RadioGroup rgMain;
@ViewInject(R.id.view_pager_content)
private NoScrollViewPager viewPager;
public ArrayList<BasePager> basePagers;
@Override
public View initView() {
View view = View.inflate(context, R.layout.fragment_content, null);
//1、把视图注入到框架中,让ContentFragment.this和View关联起来
x.view().inject(ContentFragment.this, view);//Fragment类和视图关联起来
return view;
}
@Override
public void initData() {
super.initData();
LogUtil.d("初始化主视图Data");
basePagers = new ArrayList<>();
//加入五个子pager
basePagers.add(new HomePager(context));
basePagers.add(new NewsCenterPager(context));
basePagers.add(new SmartServicePager(context));
basePagers.add(new SettingPager(context));
viewPager.setAdapter(new MyContentPagerAdapter(basePagers));
rgMain.setOnCheckedChangeListener(new MyOnCheckedchangeListener());
//监听某个页面被选中,初始化对应的页面的数据
viewPager.addOnPageChangeListener(new MyaddOnPageChangeListener());
rgMain.check(R.id.rb_home);
//因为刚进入的时候第一个页面是没有初始化的,所以要在初始化数据的时候调用第一个页面的initData()
basePagers.get(0).initData();
//设置不能滑动
isEnableSlidingMenu(false);
}
class MyaddOnPageChangeListener implements ViewPager.OnPageChangeListener {
//当页面被滑动的时候被调用
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
//页面跳转完再后调用
@Override
public void onPageSelected(int position) {
basePagers.get(position).initData();
}
//状态被改变的时候调用
@Override
public void onPageScrollStateChanged(int state) {
}
}
class MyOnCheckedchangeListener implements RadioGroup.OnCheckedChangeListener {
@Override
public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) {
switch (checkedId) {
case R.id.rb_home:
viewPager.setCurrentItem(0, false);//false设置没有抖的那种动画效果
// basePagers.get(0).initData();
isEnableSlidingMenu(false);
break;
case R.id.rb_newscenter:
viewPager.setCurrentItem(1, false);
// basePagers.get(1).initData();
isEnableSlidingMenu(true);
break;
case R.id.rb_smartservic:
viewPager.setCurrentItem(2, false);
// basePagers.get(2).initData();
isEnableSlidingMenu(false);
break;
case R.id.rb_setting:
viewPager.setCurrentItem(3, false);
// basePagers.get(3).initData();
isEnableSlidingMenu(false);
break;
}
}
}
public void isEnableSlidingMenu(boolean isEnable) {
if (isEnable == true) {
MainActivity mainActivity = (MainActivity) context;
mainActivity.getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
} else {
MainActivity mainActivity = (MainActivity) context;
mainActivity.getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
}
}
public NewsCenterPager getNewsCenterPager() {
return (NewsCenterPager) basePagers.get(1);
}
}
|
package com.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
@Configuration //说明
@ComponentScan(basePackages = "com") // 扫描包下的所有文件是否需要依赖注入,生成bean,若无则不会生成的
@PropertySource(value= {"classpath:application.properties"}) // 该注解用于Environment 接口的bean 来获取资源属性
public class Mainconfig {
@Bean(name="Info")
public String getInfo() {
return "haha";
}
}
|
package sim.estoque.itemestoque;
import java.util.List;
import sim.estoque.itemmovimento.ItemMovimentoRN;
import sim.material.Material;
import sim.pedido.Pedido;
import sim.pedido.PedidoRN;
import sim.util.DAOFactory;
import sim.util.JavaMailUtil;
public class ItemEstoqueRN {
private ItemEstoqueDAO dao;
public ItemEstoqueRN() {
this.dao = DAOFactory.criarItemEstoqueDAO();
}
public void salvar(ItemEstoque itemEstoque) {
if( itemEstoque.getCodigo() == null ||
itemEstoque.getCodigo() == 0)
this.dao.salvar(itemEstoque);
else
this.dao.atualizar(itemEstoque);
}
public void excluir(ItemEstoque itemEstoque) {
this.dao.excluir(itemEstoque);
}
public ItemEstoque carregar(Integer codigo) {
return this.dao.carregar(codigo);
}
public ItemEstoque carregarPorSimbolo(String simbolo) {
return this.dao.carregarPorSimbolo(simbolo);
}
public List<ItemEstoque> listar() {
return this.dao.listar();
}
public boolean verificaAtendimentoItemEstoque(Pedido p) {
ItemEstoque itemEstoque = this.carregarPorSimbolo(p.getMaterial().getSimbolo());
ItemMovimentoRN itemMovimentoRN = new ItemMovimentoRN();
PedidoRN pedidoRN = new PedidoRN();
if(itemEstoque != null && itemEstoque.getSaldo() > p.getQuantidade()) {
return true;
}
return false;
}
public void notificaUsuario(String destinatario, String nomeDestinatario, Pedido pedido) {
ItemEstoque itemEstoque = this.carregarPorSimbolo(pedido.getMaterial().getSimbolo());
JavaMailUtil mailUtil = new JavaMailUtil();
String de = "adm@localhost";
String assunto = "Requisição aguardando retirada no estoque";
String mensagem = "Caro "+destinatario+", a Requisiçao de Material de Número "+pedido.getCodigo()+" possui saldo suficiente" +
" em estoque para o atendimento a este pedido. \n Esta RM foi enviada ao Paiol "+itemEstoque.getLocalizacao()+" que aguarda a sua retirada.\n\n\nAdministração ";
mailUtil.enviarEmail(de, destinatario, "", assunto, mensagem);
}
}
|
class Solution {
public List<List<Integer>> combinationSum(int[] candidates, int target) {
List<List<Integer>> result = new ArrayList<>();
combinationSum(candidates, target, result, new ArrayList<>(), 0);
return result;
}
public void combinationSum(int[] candidates, int target, List<List<Integer>> result,
List<Integer> temp, int start){
int sum = 0;
for(int num : temp){
sum += num;
}
if(sum > target) return ;
if(sum == target){
result.add(new ArrayList<>(temp));
return ;
}
for(int i = start; i < candidates.length; i++){
temp.add(candidates[i]);
combinationSum(candidates, target, result, temp, i);
temp.remove(temp.size() - 1);
}
}
}
|
package sokrisztian.todo.admin.logic.service;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import sokrisztian.todo.admin.persistance.domain.UserEntity;
import sokrisztian.todo.admin.persistance.repository.UserBasicRepository;
import java.io.File;
@Service
public class DeleteAvatarService {
private final UserBasicRepository repository;
public DeleteAvatarService(UserBasicRepository repository) {
this.repository = repository;
}
@Value("${app.avatars.base-path}")
private String avatarsBasePath;
@Transactional
public UserEntity deleteAvatar(UserEntity user) {
String avatar = user.getAvatar();
if (avatar != null) {
user = updateUser(user);
deleteAvatarImage(avatar);
}
return user;
}
private UserEntity updateUser(UserEntity user) {
user.setAvatar(null);
return repository.save(user);
}
private void deleteAvatarImage(String fileName) {
File avatarImage = new File(avatarsBasePath + fileName);
if (!avatarImage.delete()) {
throw new RuntimeException(String.format("Failed to delete '%s' avatar.", fileName));
}
}
}
|
package com.syzible.dublinnotifier.ui;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.syzible.dublinnotifier.R;
import com.syzible.dublinnotifier.objects.Result;
import com.syzible.dublinnotifier.objects.Stop;
/**
* Created by ed on 30/01/2017.
*/
public class CardAdapter extends RecyclerView.Adapter<CardAdapter.Holder> {
private Result result;
public CardAdapter(Result result) {
this.result = result;
}
@Override
public Holder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.element_card, parent, false);
return new Holder(view);
}
@Override
public void onBindViewHolder(final Holder holder, int position) {
Stop stop = result.getStops().get(position);
holder.tv_route.setText("Route " + stop.getRoute());
String dueTime;
if(stop.getDueTime() == 0)
dueTime = "Due";
else if(stop.getDueTime() == 1)
dueTime = stop.getDueTime() + " min";
else dueTime = stop.getDueTime() + " mins";
holder.tv_timeDue.setText(dueTime);
holder.tv_terminus.setText(stop.getDestination());
holder.tv_stopId.setText(result.getStopId());
}
@Override
public int getItemCount() {
return result.getStops().size();
}
static class Holder extends RecyclerView.ViewHolder {
TextView tv_route, tv_timeDue, tv_terminus, tv_stopId;
Holder(View view) {
super(view);
tv_route = (TextView) view.findViewById(R.id.route);
tv_timeDue = (TextView) view.findViewById(R.id.due);
tv_terminus = (TextView) view.findViewById(R.id.terminus);
tv_stopId = (TextView) view.findViewById(R.id.stop_id);
}
}
}
|
/*
* 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.milysoft.traslate;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JFrame;
/**
*
* @author DellLatitude1
*/
public class Rotacion extends JFrame{
public static void main(String [] args){
Rotacion x=new Rotacion();
x.setTitle("Rotacion");
x.setSize(600,600);
x.setVisible(true);
}
public void paint(Graphics g){
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(Color.red);
g2d.fillRect(200, 200, 80, 50);
g2d.rotate(Math.PI/10); //gira el sistema de coordenadas
g2d.fillRect(200, 200, 80, 50);
}
}
|
/*
* 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 loc.error;
/**
*
* @author hi
*/
public class LoginError {
private String userIDError, passwordError;
public LoginError() {
}
;
public LoginError(String userIDError, String passwordError) {
this.userIDError = userIDError;
this.passwordError = passwordError;
}
public String getUserIDError() {
return userIDError;
}
public void setUserIDError(String userIDError) {
this.userIDError = userIDError;
}
public String getPasswordError() {
return passwordError;
}
public void setPasswordError(String passwordError) {
this.passwordError = passwordError;
}
}
|
package devtec.co.mz.dao;
import java.util.List;
import devtec.co.mz.entity.Produto;
public interface ProdutoDao {
void save(Produto produto);
void update(Produto produto);
void delete(Long id);
Produto findById(Long id);
List<Produto> findAll();
}
|
package com.wheremyimages.nativemodules.permission.popup;
public interface OnHandleClickCta {
void onClickCta();
}
|
package task_1;
import java.util.Arrays;
import java.util.Collections;
import java.util.Random;
import java.util.Scanner;
public class Application {
public static void main(String[] args) {
System.out.println("Please enter size of array:");
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
Integer[] arr = new Integer[n];
for (int i = 0; i < n; i++) {
arr[i] = getRandomValueFromRange(1, 100);
}
System.out.println("Array before sorting");
System.out.println(Arrays.toString(arr));
Arrays.sort(arr);
System.out.println("Sorting: asc");
System.out.println(Arrays.toString(arr));
Arrays.sort(arr, Collections.reverseOrder());
System.out.println("Sorting: desc");
System.out.println(Arrays.toString(arr));
}
public static int getRandomValueFromRange(int min, int max) {
if (min > max) {
throw new IllegalArgumentException("Min value must be smaller than max value");
}
Random random = new Random();
return random.nextInt((max - min + 1) + min);
}
}
|
package calculations;
import java.util.Scanner;
public class SelfCheckout {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter the price of item 1: ");
double firstItem = scanner.nextDouble();
System.out.print("The quantity of item 1: ");
int quantityItemOne = scanner.nextInt();
System.out.print("Enter the price of item 2: ");
double secondItem = scanner.nextDouble();
System.out.print("The quantity of item 2: ");
int quantityItemTwo = scanner.nextInt();
System.out.print("Enter the price of item 3: ");
double thirdItem = scanner.nextDouble();
System.out.print("The quantity of item 3: ");
int quantityThirdItem = scanner.nextInt();
double taxRate = 5.5;
double subtotal =
(firstItem * quantityItemOne) + (secondItem * quantityItemTwo) + (thirdItem * quantityThirdItem);
double tax = (subtotal * taxRate) / 100;
double total = subtotal + tax;
System.out.println("Subtotal: $" + subtotal);
System.out.println("Tax: $" + tax);
System.out.println("Total: $" + total);
}
}
|
package com.jandir.dalip.ponginfinityfinal;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
/**
* Created by dalip on 2017-07-01.
*/
public class Player {
private Bitmap bitmap;
private int x;
private int y;
private int speed;
private boolean movingLeft;
private boolean movingRight;
private int maxX;
private int minX;
private int scX;
private int scY;
private int size;
private double divLength;
private double divHeight;
private int score = 0;
public Player(Context context, int screenX, int screenY){
divLength = 3.0;
divHeight = 1.5;
speed = screenX/40;
size = (int)(screenX/divLength);
x = screenX / 2 - size / 2;
y = (int)(screenY/divHeight);
bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.player_norm);
bitmap = Bitmap.createScaledBitmap(bitmap, size, screenX/32, true);
movingLeft = false;
movingRight = false;
minX = 0;
maxX = screenX;
scX = screenX;
scY = screenY;
}
public void moveLeft() {
movingLeft = true;
}
public void moveRight() {
movingRight = true;
}
public void stopMoving() {
movingLeft = false;
movingRight = false;
}
public void update() {
if (movingLeft == true && x > minX){
x -= speed;
}
else if (movingRight == true && x + size < maxX){
x += speed;
}
}
public void decSize (){
int oldSize = size;
divLength += 1.0;
size = (int)(scX/divLength);
bitmap = Bitmap.createScaledBitmap(bitmap, size, scX/32, true);
x = x + (oldSize - size)/2;
}
public void incHeight() {
divHeight += 0.1;
y = (int)(scY / divHeight);
}
public void increaseScore() {
score++;
}
public Bitmap getBitmap() {
return bitmap;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public int getSpeed() {
return speed;
}
public int getSize() {
return size;
}
public int getScore() {
return score;
}
public double getDivHeight() { return divHeight; }
}
|
package com.ioc.dao;
import com.ioc.anno.Bean;
import com.ioc.anno.Require;
/**
* Created by Stark on 2018/1/9.
* ClassA 需要被IOC容器实例化 名称为 class_a
*/
@Bean(name = "class_a")
public class ClassA {
public String call() {
return " I am A";
}
}
|
/*
* Created on Nov 4, 2006
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package com.ibm.ive.tools.japt.startupPerformance;
import java.util.Enumeration;
import com.ibm.jikesbt.BT_BasicBlockMarkerIns;
import com.ibm.jikesbt.BT_Class;
import com.ibm.jikesbt.BT_ExceptionTableEntry;
import com.ibm.jikesbt.BT_ExceptionTableEntryVector;
/**
* @author Sean Foley
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class Span {
public final BT_BasicBlockMarkerIns start;
public final BT_BasicBlockMarkerIns stop;
private BT_ExceptionTableEntryVector exceptionEntries;
private BT_ExceptionTableEntry finallyEntry;
private static final Enumeration emptyEnumeration = new BT_ExceptionTableEntryVector().elements();
public Span(BT_BasicBlockMarkerIns start, BT_BasicBlockMarkerIns stop) {
this.start = start;
this.stop = stop;
}
BT_ExceptionTableEntry getFinallyEntry() {
return finallyEntry;
}
Enumeration getExceptionEntries() {
if(exceptionEntries == null) {
return emptyEnumeration;
}
return exceptionEntries.elements();
}
public void addEntriesTo(BT_ExceptionTableEntryVector table) {
if(exceptionEntries != null) {
for (int n = 0; n < exceptionEntries.size(); n++) {
table.addElement(exceptionEntries.elementAt(n));
}
}
if(finallyEntry != null) {
table.addElement(finallyEntry);
}
}
public void addExceptionEntry(BT_ExceptionTableEntry newEntry) {
if(newEntry.catchType == null) {
throw new IllegalArgumentException();
}
if(exceptionEntries == null) {
exceptionEntries = new BT_ExceptionTableEntryVector();
}
exceptionEntries.addElement(newEntry);
}
public void setFinallyEntry(BT_ExceptionTableEntry newEntry) {
if(newEntry.catchType != null) {
throw new IllegalArgumentException();
}
finallyEntry = newEntry;
}
public String toString() {
String one = Integer.toString(start.byteIndex);
String two = Integer.toString(stop.byteIndex);
StringBuffer buf = new StringBuffer(one.length() + two.length() + 50);
buf.append("from ");
buf.append(one);
buf.append(" to ");
buf.append(two);
if(exceptionEntries != null) {
for(int i=0; i<exceptionEntries.size(); i++) {
buf.append("\n\tcatch ");
BT_ExceptionTableEntry entry = exceptionEntries.elementAt(i);
buf.append(entry.catchType);
buf.append(" at ");
buf.append(Integer.toString(entry.handlerTarget.byteIndex));
}
}
if(finallyEntry != null) {
buf.append("\n\tfinally at ");
buf.append(Integer.toString(finallyEntry.handlerTarget.byteIndex));
}
return buf.toString();
}
boolean catchesThrowableSubclasses(BT_Class javaLangThrowable) {
if(exceptionEntries != null) {
for(int i=0; i<exceptionEntries.size(); i++) {
BT_ExceptionTableEntry entry = exceptionEntries.elementAt(i);
BT_Class catchType = entry.catchType;
if(catchType != null && !catchType.equals(javaLangThrowable)) {
return true;
}
}
}
return false;
}
public boolean equals(Object o) {
if(o instanceof Span) {
Span other = (Span) o;
return start.byteIndex == other.start.byteIndex
&& stop.byteIndex == other.stop.byteIndex;
}
return false;
}
public boolean intersects(Span span) {
int thisStart = start.byteIndex;
int otherStart = span.start.byteIndex;
if(thisStart >= otherStart) {
int otherStop = span.stop.byteIndex;
boolean startsWithinOther = thisStart < otherStop;
return startsWithinOther;
}
return false;
}
}
|
package other;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
public class IndeedInterview {
// This is the text editor interface.
// Anything you type or change here will be seen by the other person in real time.
//3, 5, 6, 7, 8, 9, 13
//-1, 3, 9, 15, 19
//3, 3, 7, 17, 21
//m
//k
//k-most frequent integers
//k = 3, 3 most frequent integers.
//3, 7, 9
//k = 1
//3
//k = 2
//3, 7
// any valid int
// any size arrays
class MyMap {
int value;
int count;
public MyMap(int value, int count) {
this.value = value;
this.count = count;
}
}
public List<Integer> getKMostFreq(List<List<Integer>> m, int k) {
HashMap<Integer, MyMap> map = new HashMap<>();
for(List<Integer> list : m) {
for(Integer i : list) {
if(map.containsKey(i)) {
map.put(i, new MyMap(i, map.get(i).count + 1));
} else {
map.put(i, new MyMap(i, 1));
}
}
}
Iterator<Map.Entry<Integer, MyMap>> it = map.entrySet().iterator();
PriorityQueue<MyMap> heap = new PriorityQueue<MyMap>(new Comparator<MyMap>() {
@Override
public int compare(MyMap a, MyMap b) {
return a.count - b.count;
}
});
while(it.hasNext()) {
Map.Entry<Integer, MyMap> entry = it.next();
if(heap.size() >= k && heap.peek().count < entry.getValue().count) {
heap.poll();
heap.offer(entry.getValue());
} else {
heap.offer(entry.getValue());
}
System.out.println("size: " + heap.size());
}
ArrayList<Integer> result = new ArrayList<>();
while(heap.isEmpty() == false) {
result.add(heap.poll().value);
}
return result;
}
public static void main(String [] args) {
//3, 5, 6, 7, 8, 9, 13
//-1, 3, 9, 15, 19
//3, 3, 7, 17, 21
List<Integer> list1 = Arrays.asList(3, 5, 6, 7, 8, 9, 13);
List<Integer> list2 = Arrays.asList(-1, 3, 9, 15, 19);
List<Integer> list3 = Arrays.asList(3, 3, 7, 17, 21);
List<List<Integer>> allLists = Arrays.asList(list1, list2, list3);
int k = 3;
IndeedInterview s = new IndeedInterview();
List<Integer> res = s.getKMostFreq(allLists, k);
for(Integer i : res) {
System.out.println(i);
}
}
// O(m log(k))
}
|
package com.tencent.mm.plugin.video;
import android.content.Context;
import android.graphics.SurfaceTexture;
import android.util.AttributeSet;
import android.view.TextureView.SurfaceTextureListener;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.mm.ui.base.MMTextureView;
public class ObservableTextureView extends MMTextureView implements SurfaceTextureListener {
protected SurfaceTexture aCZ;
protected b oEJ;
private boolean oEK = false;
public ObservableTextureView(Context context) {
super(context);
init();
}
public ObservableTextureView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
init();
}
public ObservableTextureView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
}
private void init() {
setSurfaceTextureListener(this);
this.aCZ = getSurfaceTexture();
}
public boolean isAvailable() {
return this.oEK;
}
public void setTextureChangeCallback(b bVar) {
this.oEJ = bVar;
}
public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i2) {
x.i("MicroMsg.ObservableTextureView", "onSurfaceTextureAvailable");
crS();
this.oEK = true;
if (this.oEJ != null) {
this.oEJ.d(surfaceTexture);
}
}
public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i, int i2) {
x.d("MicroMsg.ObservableTextureView", "onSurfaceTextureSizeChanged");
}
public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
x.i("MicroMsg.ObservableTextureView", "onSurfaceTextureDestroyed");
this.oEK = false;
return false;
}
public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
}
}
|
package avipatil.database;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import java.util.ArrayList;
/**
* Created by avipatil on 4/17/2017.
*/
public class DB extends SQLiteOpenHelper
{
static String DATA_BASE_NAME="contact.db";
static String Table_Name="contacts";
Context context;
public DB(Context contex) {
super(contex,DATA_BASE_NAME,null,1);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE "+Table_Name+" (ID INTEGER PRIMARY KEY AUTOINCREMENT,NAME TEXT,PHONENUMBER TEXT )");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
public boolean insertDate(String name,String number)
{
SQLiteDatabase sqLiteDatabase=this.getWritableDatabase();
ContentValues contentValues= new ContentValues();
contentValues.put("NAME",name);
contentValues.put("PHONENUMBER",number);
sqLiteDatabase.insert(Table_Name,null,contentValues);
return true;
}
public ArrayList<ContactPojo> getAllContacts()
{
SQLiteDatabase database = getReadableDatabase();
ArrayList<ContactPojo> contactArrayList = new ArrayList<>();
String query = "select * from " +Table_Name;
Cursor cursor = database.rawQuery(query,null);
cursor.moveToFirst();
//to move to next we need a loop
while(cursor.isAfterLast()==false){
Long id = cursor.getLong(cursor.getColumnIndex("ID"));
String name = cursor.getString(cursor.getColumnIndex("NAME"));
String number = cursor.getString(cursor.getColumnIndex("PHONENUMBER")); //We can implement this if we are not sure about column number or else we can directly enter column number 1, 2 , 3 etc
// String emailid = cursor.getString(cursor.getColumnIndex("email"));
ContactPojo contact = new ContactPojo(name,number); // if we have 10 or more objects use an ArrayList
contactArrayList.add(contact);
cursor.moveToNext();
}
cursor.close();
return contactArrayList;
}
public void removeItem(int id){
SQLiteDatabase database = getWritableDatabase();
database.delete(Table_Name,"id = ' "+id + "'",null);
}
}
|
package com.top.demo.base;
import com.top.demo.common.response.CommonCode;
import com.top.demo.common.response.ResponseResult;
/**
* 渲染数据
* @author lth
* @version 1.0.0
* @date
*/
public class BaseController {
/**
* 渲染失败数据
*/
protected ResponseResult renderError(){
return new ResponseResult(CommonCode.FAIL);
}
/**
* 渲染成功数据(带数据)
*/
protected ResponseResult renderError(Object obj){
return new ResponseResult(CommonCode.FAIL,obj);
}
/**
* 渲染成功数据
*/
protected ResponseResult renderSuccess(){
return new ResponseResult(CommonCode.SUCCESS);
}
/**
* 渲染成功数据(带数据)
*/
protected ResponseResult renderSuccess(Object obj){
return new ResponseResult(CommonCode.SUCCESS,obj);
}
}
|
/*
* Copyright (C) 2007 - 2011 GeoSolutions S.A.S.
* http://www.geo-solutions.it
*
* GPLv3 + Classpath exception
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package it.geosolutions.fra2015.services;
import it.geosolutions.fra2015.server.model.user.Password;
import it.geosolutions.fra2015.server.model.user.User;
import it.geosolutions.fra2015.services.exception.BadRequestServiceEx;
import it.geosolutions.fra2015.services.exception.NotFoundServiceEx;
import java.util.List;
import java.util.logging.Level;
import junit.framework.TestCase;
import org.apache.log4j.Logger;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* Class ServiceTestBase.
*
* @author ETj (etj at geo-solutions.it)
* @author Tobia di Pisa (tobia.dipisa at geo-solutions.it)
*
*/
public class ServiceTestBase extends TestCase {
// protected static UserService userService;
// protected static ClassPathXmlApplicationContext ctx = null;
// protected final Logger log = Logger.getLogger(getClass());
//
// /**
// *
// */
// public ServiceTestBase() {
// synchronized (ServiceTestBase.class) {
// if (ctx == null) {
// String[] paths = {"classpath*:applicationContext.xml"};
// ctx = new ClassPathXmlApplicationContext(paths);
// userService = (UserService) ctx.getBean("userService");
// }
// }
// }
//
// /*
// * (non-Javadoc) @see junit.framework.TestCase#setUp()
// */
// @Override
// protected void setUp() throws Exception {
// StringBuilder sb = new StringBuilder();
//
// sb.append("Setup ").append(getClass().getSimpleName()).append("::").append(getName()).append("...");
//
// try {
// super.setUp();
// sb.append("DONE");
// } catch (Exception ex) {
// sb.append("FAILED:").append(ex);
// throw ex;
// } finally {
// log.info(sb.toString());
// }
// removeAll();
// }
//
// /**
// *
// */
// public void testCheckServices() {
//// assertNotNull(userService);
// }
//
// /**
// * @throws NotFoundServiceEx
// * @throws BadRequestServiceEx
// */
// protected void removeAll() throws NotFoundServiceEx, BadRequestServiceEx {
// log.info("***** removeAll()");
// removeAllUser();
// }
//
// /**
// * @throws BadRequestServiceEx
// */
// private void removeAllUser() throws BadRequestServiceEx {
// List<User> list = userService.getAll(null, null);
// for (User item : list) {
// log.info("Removing User: " + item.getName());
//
// try {
// userService.delete(item);
// } catch (Exception ex) {
// java.util.logging.Logger.getLogger(ServiceTestBase.class.getName()).log(Level.INFO, "unable to delete " + item, ex);
// }
//
// }
//
// assertEquals("User have not been properly deleted", 0, userService.getCount(null));
// }
//
// /**
// * @param name
// * @param role
// * @param password
// * @return long
// * @throws Exception
// */
// protected User createUser(String name, String password) throws Exception {
// User user = new User();
// user.setName(name);
// user.setPassword(new Password());
// user.getPassword().setPassword(password);
// user = userService.insert(user);
//
// log.info("User "+user.getId()+" created");
//
// return user;
// }
}
|
package com.ybg.weixinMenu;
import java.io.PrintWriter;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.web.servlet.View;
/**
* 返回的xml
* @author yonson
*/
public class XmlView implements View{
static Logger logger = Logger.getLogger(XmlView.class);
public String returnValue;
public XmlView(){
}
public XmlView(String returnValue){
this.returnValue = returnValue;
}
@Override
public String getContentType() {
// TODO Auto-generated method stub
return "text/plain;charset=UTF-8";
}
@Override
public void render(Map arg0, HttpServletRequest request,
HttpServletResponse response) throws Exception {
PrintWriter out = response.getWriter();
logger.info("服务返回的数据:"+returnValue.trim());
out.print(returnValue);
out.close();
}
public void setReturnValue(String returnValue) {
this.returnValue = returnValue;
}
}
|
package projectprogweb.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import projectprogweb.dao.UsuarioDAO;
import projectprogweb.dao.AtividadesDAO;
import projectprogweb.modelo.Usuario;
import projectprogweb.modelo.Atividade;
@Controller
public class ActivityController {
@RequestMapping(value = "criaAtividade", method = RequestMethod.GET)
public String criaAtividade() {
return "admin/criaAtividade";
}
@RequestMapping(value = "criaAtividade", method = RequestMethod.POST)
public String criaAtividade(Atividade atividade, HttpServletRequest req, Model model) {
UsuarioDAO user = new UsuarioDAO();
if (!user.estaCadastrado(atividade.getCriador())) {
model.addAttribute("msgE", "Usuario incorreto");
} else {
AtividadesDAO atvDAO = new AtividadesDAO();
atvDAO.criaAtividade(atividade);
return "/admin/index";
}
return "/admin/criaAtividade";
}
@RequestMapping(value="subscribe", method = RequestMethod.POST)
public String subscribe(Atividade atv, HttpServletRequest req, Model model){
AtividadesDAO dao = new AtividadesDAO();
dao.adicionaInscrito("," + req.getSession().getAttribute("usuario").toString(), atv.getTitulo());
return "/admin/index";
}
@RequestMapping(value = "/admin/atividade", method = RequestMethod.GET)
public String atividade() {
return "admin/atividade";
}
}
|
package za.ac.cput.Repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import za.ac.cput.Entity.Doctor;
@Repository
public interface DoctorRepository extends JpaRepository<Doctor, String>
{
}
///* Doctor.java
// Repository for the Doctor
// Author: Bheka Gumede (218223420)
// Date: 30 July 2021
// */
//
//package za.ac.cput.Repository;
//
//import za.ac.cput.Entity.Doctor;
//
//import java.util.HashSet;
//import java.util.Set;
//
//public class DoctorRepository implements IDoctorRepository
//
//{
// private static DoctorRepository repository = null;
// private Set<Doctor> databaseForDoctor = null;
//
// private DoctorRepository()
// {
// databaseForDoctor = new HashSet<Doctor>();
// }
//
// public static DoctorRepository getRepository()
// {
// if(repository == null)
// {
// repository = new DoctorRepository();
// }
// return repository;
// }
//
//
// @Override
// public Doctor create(Doctor doctor)
// {
// boolean pass = databaseForDoctor.add(doctor);
// if(!pass)
// return null;
// return doctor;
// }
//
//
// @Override
// public Doctor read(String DoctorID)
// {
// for (Doctor readDoctor : databaseForDoctor)
// if(readDoctor.getDoctorID().equals(DoctorID))
// {
// return readDoctor;
// }
// return null;
// }
//
//
// @Override
// public Doctor update(Doctor doctor)
// {
// Doctor changeDoctor = read(doctor.getDoctorID());
// if(changeDoctor != null)
// databaseForDoctor.remove(changeDoctor);
// databaseForDoctor.add(doctor);
// return null;
// }
//
//
// @Override
// public boolean delete(String doctorID)
// {
// Doctor deleteDoctor = read(doctorID);
// if(deleteDoctor != null)
// databaseForDoctor.remove(deleteDoctor);
// return true;
// }
//
//
// @Override
// public Set<Doctor> getAll()
// {
// return databaseForDoctor;
// }
//
//}
|
package com.example.admin.refreshlayoutdemo;
import android.content.Context;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.ScrollerCompat;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.widget.AbsListView;
import android.widget.FrameLayout;
import android.widget.ScrollView;
/**
* Created by admin on 2017/3/20.
*/
public class RefreshLayout extends FrameLayout {
private MyHeadView mHeadView;
private IHeadView iHeadView;
private View contentView;
private IRefreshListener mRefreshListener;
private RefreshDistanceHolder refreshDistanceHolder;
private int headMaxDistance = 500;
//event
private int pressX;
private int pressY;
private int tempPressY;
private ScrollerCompat scrollerCompat;
private int touchSlop;
private boolean isSlop;
private ScrollView scrollView;
//
private boolean isRefresh = false;
private RefreshState refreshState = RefreshState.REFRESH_NORMAL;
public RefreshLayout(Context context) {
this(context, null);
}
public RefreshLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public RefreshLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initParams(context);
}
private void initParams(Context context) {
scrollerCompat = ScrollerCompat.create(context);
touchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
isSlop = false;
refreshDistanceHolder = new RefreshDistanceHolder();
mHeadView = new MyHeadView(context);
iHeadView = (IHeadView) mHeadView;
addView(mHeadView);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
int measureHeight = 0;
int childCount = getChildCount();
int paddingLeft = getPaddingLeft();
int paddingRight = getPaddingRight();
int paddingTop = getPaddingTop();
int paddingBottom = getPaddingBottom();
for (int i = 0; i < childCount; i++) {
View childView = getChildAt(i);
if (childView.getVisibility() == View.GONE) {
continue;
}
MarginLayoutParams layoutParams = (MarginLayoutParams) childView.getLayoutParams();
int childWidthMeasure = MeasureSpec.makeMeasureSpec(width - layoutParams.leftMargin -
layoutParams.rightMargin - paddingLeft - paddingRight, MeasureSpec.EXACTLY);
int childHeightMeasure = getChildMeasureSpec(heightMeasureSpec,
layoutParams.topMargin + layoutParams.bottomMargin + paddingTop + paddingBottom,
layoutParams.height);
childView.measure(childWidthMeasure, childHeightMeasure);
if (i == 0) {
Log.d(TAG, "onMeasure第一个: " + childView.getMeasuredHeight());
}
measureHeight += childView.getMeasuredHeight() + layoutParams.topMargin + layoutParams.bottomMargin;
}
setMeasuredDimension(width, measureHeight);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
// super.onLayout(changed, left, top, right, bottom);
int childCount = getChildCount();
int topY = getPaddingTop();
for (int i = 0; i < childCount; i++) {
View childView = getChildAt(i);
MarginLayoutParams params = (MarginLayoutParams) childView.getLayoutParams();
if (i == 0) {
childView.layout(getPaddingLeft() + params.leftMargin, topY - (params.topMargin + childView.getMeasuredHeight()), childView.getMeasuredWidth(), childView.getMeasuredHeight());
// headViewHeight = childView.getMeasuredHeight();
// headView = childView;
continue;
} else if (i == 1) {
// recyclerView = (RecyclerView) childView;
contentView = childView;
childView.layout(getPaddingLeft() + params.leftMargin, topY + params.topMargin, childView.getMeasuredWidth(), childView.getMeasuredHeight());
}
// else if (i == 2) {
// childView.layout(getPaddingLeft() + params.leftMargin, topY + params.topMargin, childView.getMeasuredWidth(), childView.getMeasuredHeight());
// }
topY += params.topMargin + childView.getMeasuredHeight() + params.bottomMargin;
}
}
private MotionEvent motionEvent;
private SwipeRefreshLayout;
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
int action = ev.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
Log.d(TAG, "dispatchTouchEvent: ACTION_DOWN");
isCancelTouch = true;
pressX = (int) ev.getX();
pressY = (int) ev.getY();
tempPressY = pressY;
motionEvent = ev;
// super.dispatchTouchEvent(ev);
break;
case MotionEvent.ACTION_MOVE:
if (!isEnabled()) {
return super.dispatchTouchEvent(ev);
}
Log.d(TAG, "dispatchTouchEvent: ACTION_MOVE");
int currentX = (int) ev.getX();
int currentY = (int) ev.getY();
int distanceY = currentY - pressY;
pressY = currentY;
pressX = currentX;
if (!isSlop) {
if (Math.abs(currentY - tempPressY) > touchSlop) {
isSlop = true;
} else {
return super.dispatchTouchEvent(ev);
}
}
// if (isRefresh) {
// sendCancelTouchEvent();
// return true;
// }
if ((distanceY > 0 && refreshDistanceHolder.mOffsetY <= headMaxDistance) || distanceY < 0) {
distanceY = (int) (distanceY / 1.5f);
Log.d(TAG, "dispatchTouchEvent: ACTION_MOVE" + distanceY);
} else {
return super.dispatchTouchEvent(ev);
}
//
if ((!canChildScrollUp() && distanceY > 0) || (distanceY < 0 && refreshDistanceHolder.hasHeaderPullDown())) {
if (Math.abs(distanceY) > 100) {
} else {
sendCancelTouchEvent();
moveDistanceY(distanceY);
}
} else {
return super.dispatchTouchEvent(ev);
}
if (Math.abs(distanceY) > 0)
Log.d(TAG, "sendDownEvent___________________________");
sendDownEvent();
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
isSlop = false;
if (!isRefresh && refreshDistanceHolder.mOffsetY >= iHeadView.getHeadViewHeight()) {
isRefresh = true;
setRefreshState();
} else {
}
break;
}
return super.dispatchTouchEvent(ev);
}
private boolean isSendDown = true;
private void sendDownEvent() {
// if (!mHasSendDownEvent) {
// LogUtils.d("sendDownEvent");
// mHasSendCancelEvent = false;
// mHasSendDownEvent = true;
if (isSendDown) {
isSlop = false;
final MotionEvent last = motionEvent;
if (last == null)
return;
MotionEvent e = MotionEvent.obtain(last.getDownTime(),
last.getEventTime(), MotionEvent.ACTION_DOWN, last.getX(),
last.getY(), last.getMetaState());
super.dispatchTouchEvent(e);
}
// }
}
@Override
public void computeScroll() {
if (scrollerCompat.computeScrollOffset()) {
int lastY = refreshDistanceHolder.mOffsetY;
int dy = lastY - scrollerCompat.getCurrY();
moveDistanceY(dy);
}
// super.computeScroll();
}
private void setRefreshState() {
if (refreshDistanceHolder.mOffsetY >= iHeadView.getHeadViewHeight()) {
scrollerCompat.startScroll(0, refreshDistanceHolder.mOffsetY, 0, iHeadView.getHeadViewHeight());
iHeadView.refreshing();
} else {
scrollerCompat.startScroll(0, refreshDistanceHolder.mOffsetY, 0, 0);
}
// scrollerCompat.startScroll(0,);
// mHeadView.offsetTopAndBottom(iHeadView.getHeadViewHeight() - refreshDistanceHolder.mOffsetY);
// contentView.offsetTopAndBottom(iHeadView.getHeadViewHeight() - refreshDistanceHolder.mOffsetY);
// refreshDistanceHolder.mOffsetY = iHeadView.getHeadViewHeight();
// iHeadView.refreshing();
}
private boolean isCancelTouch = false;
private void sendCancelTouchEvent() {
if (motionEvent != null) {
if (isCancelTouch) {
isCancelTouch = false;
MotionEvent e = MotionEvent.obtain(
motionEvent.getDownTime(),
motionEvent.getEventTime()
+ ViewConfiguration.getLongPressTimeout(),
MotionEvent.ACTION_CANCEL, motionEvent.getX(), motionEvent.getY(),
motionEvent.getMetaState());
// motionEvent.setAction(MotionEvent.ACTION_CANCEL);
super.dispatchTouchEvent(e);
}
}
}
private static final String TAG = "RefreshLayout";
private void moveDistanceY(int distanceY) {
Log.d(TAG, "moveDistanceY: " + distanceY);
if (Math.abs(distanceY) > 100) {
Log.d(TAG, "moveDistanceY: 移动距离过大" + distanceY);
} else {
refreshDistanceHolder.move(distanceY);
mHeadView.offsetTopAndBottom(distanceY);
contentView.offsetTopAndBottom(distanceY);
ViewCompat.postInvalidateOnAnimation(this);
}
}
public boolean canChildScrollUp() {
if (android.os.Build.VERSION.SDK_INT < 14) {
if (contentView instanceof AbsListView) {
final AbsListView absListView = (AbsListView) contentView;
return absListView.getChildCount() > 0
&& (absListView.getFirstVisiblePosition() > 0 || absListView.getChildAt(0)
.getTop() < absListView.getPaddingTop());
} else {
return ViewCompat.canScrollVertically(contentView, -1) || contentView.getScrollY() > 0;
}
} else {
return ViewCompat.canScrollVertically(contentView, -1);
}
}
public void setmRefreshListener(IRefreshListener iRefreshListener) {
mRefreshListener = iRefreshListener;
}
public static enum RefreshState {
REFRESHING, REFRESH_NORMAL
}
}
|
import java.lang.reflect.Field;
class TestReflection
{
public static void main(String[] args) throws Exception
{
Class<?> classReflected = Class.forName(TestReflected.class.getName());
for (Field field : classReflected.getFields())
{
System.out.println(field.getName());
}
}
}
|
package team.player;
public enum PlayerPosition {
GOALKEEPER(0), CENTER_BACK(1), SIDE_BACK(2), CENTER_DEFENSIVE_MIDFIELDER(3), CENTER_ATTACKING_MIDFIELDER(4), WING(5), STRIKER(6);
private final int value;
PlayerPosition(int value){
this.value = value;
}
public int getValue(){
return value;
}
}
|
package com.joshua.addressbook.dto;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import io.swagger.annotations.ApiModel;
@ApiModel
public class CompanyDto {
@NotNull
private Integer id;
@NotEmpty
@Size(max = 20)
private String instcode;
@NotEmpty
@Size(max = 45)
private String name;
@NotNull
@Pattern(regexp = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$")
private String invoiceEmailAddress;
@NotNull
private Integer status;
public CompanyDto() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getInstcode() {
return instcode;
}
public void setInstcode(String instcode) {
this.instcode = instcode;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getInvoiceEmailAddress() {
return invoiceEmailAddress;
}
public void setInvoiceEmailAddress(String invoiceEmailAddress) {
this.invoiceEmailAddress = invoiceEmailAddress;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
@Override
public String toString() {
return "Company [id=" + id + ", instcode=" + instcode + ", name=" + name + ", invoiceEmailAddress="
+ invoiceEmailAddress + ", status=" + status + "]";
}
}
|
package cn.hrmzone.test;
import cn.hrmzone.util.OCRAction;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
/**
* @Author:张生
* @Blog:http://hrmnzone.cn,QQ:78049500
* @Organization:荆州青年教育平台(https://jzyouth.com),专注职业资格培训、学历提升
* @Description:
* @Date:19-1-11
*/
public class ActionTest {
private String path;
private String file;
private OCRAction action;
@Before
public void init() {
path="/home/neal/桌面/ao";
file="/home/neal/桌面/ao/1.jpg";
}
@Ignore
@Test
public void pathTest() {
action=new OCRAction(path);
action.actionDir();
}
@Test
public void fileTest() {
action=new OCRAction(file);
action.actionFile();
}
}
|
package com.forthorn.projecting.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
*
*/
public class DBHelper extends SQLiteOpenHelper {
public static final String DB_NAME = "Projecting.db";
public static final String TASK_TABLE = "TASK_TABLE";
public static final String TASK_DEVICE_ID = "task_device_id";
public static final String TASK_ID = "task_id";
public static final String TASK_TYPE = "task_type";
public static final String TASK_STATUS = "task_status";
public static final String TASK_RUNNING_STATUS = "task_running_status";
public static final String TASK_HOUR = "task_hour";
public static final String TASK_DURATION = "task_duration";
public static final String TASK_DATE = "task_date";
public static final String TASK_CREATE_TIME = "task_create_time";
public static final String TASK_LAST_MODIFY = "task_last_modify";
public static final String TASK_CONTENT = "task_content";
public static final String TASK_START_TIME = "task_start_time";
public static final String TASK_FINISH_TIME = "task_finish_time";
public static final String DOWNLOAD_TABLE = "DOWNLOAD_TABLE";
public static final String DOWNLOAD_ID = "download_id";
public static final String DOWNLOAD_TASK_ID = "task_id";
public static final String DOWNLOAD_STATUS = "download_status";
public static final String DOWNLOAD_URL = "download_url";
public static final String DOWNLOAD_PATH = "download_path";
public static final String DOWNLOAD_TIME = "download_time";
public static final String DOWNLOAD_FILE_SIZE = "download_file_size";
private static final String CREATE_TASK_TABLE = "CREATE TABLE IF NOT EXISTS " + TASK_TABLE
+ " ( " + TASK_ID + " integer primary key ," + TASK_DEVICE_ID + " int," + TASK_TYPE + " int," + TASK_STATUS + " int,"
+ TASK_RUNNING_STATUS + " int," + TASK_CREATE_TIME + " int," + TASK_LAST_MODIFY
+ " int," + TASK_HOUR + " int," + TASK_DURATION + " int," + TASK_DATE + " int," + TASK_CONTENT + " text,"
+ TASK_START_TIME + " int, " + TASK_FINISH_TIME + " int" + " )";
private static final String CREATE_DOWNLOAD_TABLE = "CREATE TABLE IF NOT EXISTS " + DOWNLOAD_TABLE
+ " ( " + DOWNLOAD_ID + " integer primary key ," + DOWNLOAD_TASK_ID + " int, " + DOWNLOAD_STATUS + " int,"
+ DOWNLOAD_URL + " text, " + DOWNLOAD_PATH + " text, " + DOWNLOAD_TIME + " int, " + DOWNLOAD_FILE_SIZE + " int" + " ) ";
//数据库当前版本
public static final int DB_VERSION = 1;
private static DBHelper dbHelper = null;
public DBHelper(Context context, String name, int version) {
super(context, name, null, version);
}
public static synchronized DBHelper getInstance(Context context) {
if (dbHelper == null) {
dbHelper = new DBHelper(context, DB_NAME, DB_VERSION);
}
return dbHelper;
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_TASK_TABLE);
db.execSQL(CREATE_DOWNLOAD_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
//目前是第一版,之后在此做更新操作
}
}
|
package com.smxknife.java2.classloader.serviceloader;
/**
* @author smxknife
* 2019/11/6
*/
public interface Driver {
String name();
}
|
/*
* Copyright (c) 2016. Universidad Politecnica de Madrid
*
* @author Badenes Olmedo, Carlos <cbadenes@fi.upm.es>
*
*/
package org.librairy.modeler.lda.services;
import org.apache.spark.sql.DataFrame;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.RowFactory;
import org.apache.spark.sql.SaveMode;
import org.apache.spark.sql.types.DataTypes;
import org.apache.spark.sql.types.StructField;
import org.apache.spark.sql.types.StructType;
import org.librairy.boot.storage.generator.URIGenerator;
import org.librairy.computing.cluster.ComputingContext;
import org.librairy.computing.helper.StorageHelper;
import org.librairy.modeler.lda.graph.DiscoveryPath;
import org.librairy.modeler.lda.dao.ShapesDao;
import org.librairy.modeler.lda.dao.SimilaritiesDao;
import org.librairy.modeler.lda.graph.PregelSSSP;
import org.librairy.modeler.lda.graph.ShortestPathBuilder;
import org.librairy.modeler.lda.helper.ModelingHelper;
import org.librairy.modeler.lda.models.Path;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import scala.collection.JavaConversions;
import java.time.Duration;
import java.time.Instant;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author Badenes Olmedo, Carlos <cbadenes@fi.upm.es>
*/
@Component
public class SimilarityService {
private static final Logger LOG = LoggerFactory.getLogger(SimilarityService.class);
@Autowired
ModelingHelper helper;
@Autowired
StorageHelper storageHelper;
@Autowired
ShortestPathService shortestPathService;
public Path[] getShortestPathBetween(ComputingContext context, List<String> startUris, List<String> endUris, List<String> resTypes,
List<String> sectors, Double minScore, Integer maxLength, String domainUri, Integer maxResults) throws IllegalArgumentException{
try{
LOG.info("loading nodes..");
DataFrame shapesDF = loadShapes(context, domainUri, sectors, resTypes).persist(helper.getCacheModeHelper().getLevel());
long numNodes = shapesDF.count();
LOG.info(numNodes + " nodes load!");
LOG.info("loading similarities..");
DataFrame similaritiesDF = loadSimilarities(context, domainUri, sectors, minScore, resTypes).persist(helper.getCacheModeHelper().getLevel());
long numSim = similaritiesDF.count();
LOG.info(numSim + " edges load!");
LOG.info("discovering shortest path between: '"+ startUris + "' and '"+endUris+"' in domain: '" +
domainUri+"' filtered by " + resTypes + " with min score " + minScore + " and max " + maxLength + " steps");
Path[] paths = shortestPathService.calculate(domainUri, startUris, endUris, resTypes, minScore, maxLength, shapesDF, similaritiesDF, maxResults, context.getRecommendedPartitions(), true);
shapesDF.unpersist();
similaritiesDF.unpersist();
return paths;
} catch (IllegalArgumentException e){
LOG.warn(e.getMessage());
return new Path[]{};
}
}
public Path[] getShortestPathBetweenCentroids(ComputingContext context, List<String> startUris, List<String> endUris, Double
minScore, Integer maxLength, String domainUri, Integer maxResults) throws IllegalArgumentException{
LOG.info("loading nodes..");
DataFrame nodesDF = loadCentroids(context, domainUri).persist(helper.getCacheModeHelper().getLevel());
long numNodes = nodesDF.count();
LOG.info(numNodes + " nodes load!");
LOG.info("loading edges..");
DataFrame edgesDF = loadCentroidSimilarities(context, domainUri, minScore).persist(helper.getCacheModeHelper().getLevel());
long numSim = edgesDF.count();
LOG.info(numSim + " edges load!");
LOG.info("discovering shortest path between centroids: '"+ startUris + "' and '"+endUris+"' in domain: '" + domainUri+"'" );
scala.collection.immutable.List<String> start = JavaConversions.asScalaBuffer(startUris).toList();
scala.collection.immutable.List<String> end = JavaConversions.asScalaBuffer(endUris).toList();
scala.collection.immutable.List<String> types = JavaConversions.asScalaBuffer(Collections.EMPTY_LIST).toList();
Path[] paths = DiscoveryPath.apply(start, end, minScore, maxLength, types, nodesDF, edgesDF, maxResults, context.getRecommendedPartitions());
// Path[] paths = shortestPathService.calculate(domainUri, startUris, endUris, Collections.EMPTY_LIST, minScore, maxLength, nodesDF, edgesDF, maxResults, context.getRecommendedPartitions(), false);
nodesDF.unpersist();
edgesDF.unpersist();
return paths;
}
private DataFrame loadCentroids(ComputingContext context, String domainUri) throws IllegalArgumentException {
if (!storageHelper.exists(storageHelper.path(URIGenerator.retrieveId(domainUri), "lda/similarities/centroids/nodes"))){
throw new IllegalArgumentException("No centroids found for domain: " + domainUri);
}
return loadCentroidsFromFileSystem(context, URIGenerator.retrieveId(domainUri), "nodes");
}
private DataFrame loadCentroidSimilarities(ComputingContext context, String domainUri, Double minScore) throws IllegalArgumentException {
if (!storageHelper.exists(storageHelper.path(URIGenerator.retrieveId(domainUri), "lda/similarities/centroids/edges"))){
throw new IllegalArgumentException("No centroid-similarities found for domain: " + domainUri);
}
DataFrame df = loadCentroidsFromFileSystem(context, URIGenerator.retrieveId(domainUri), "edges").filter(SimilaritiesDao.SCORE + " >= " + minScore);
Arrays.stream(df.collect()).forEach(row -> LOG.info("ROW: " + row));
return df;
}
public DataFrame loadShapes(ComputingContext context, String domainUri, List<String> sectors, List<String> types) throws IllegalArgumentException {
DataFrame df = null;
String previousSector = "";
for (String sectorId : sectors){
LOG.info("loading nodes from sector: " + sectorId + " ...");
DataFrame sectorDF = loadSubgraphFromFileSystem(context, URIGenerator.retrieveId(domainUri), "nodes", sectorId, Optional.empty(), types);
if (df == null){
df = sectorDF;
}else{
long intersection = df.intersect(sectorDF).count();
LOG.info(intersection + " nodes in both sectors: [" + previousSector + " and " + sectorId + "]");
if (intersection == 0l) {
throw new IllegalArgumentException("No intersection between [" + previousSector + " and " + sectorId + "]");
}
df = df.unionAll(sectorDF).distinct();
}
previousSector = sectorId;
}
LOG.info("all nodes loaded");
return df;
}
public DataFrame loadSimilarities(ComputingContext context, String domainUri, List<String> sectors, Double minScore, List<String> types) throws IllegalArgumentException {
DataFrame df = null;
for (String sectorId : sectors){
LOG.info("loading edges from sector: " + sectorId + " ...");
DataFrame sectorDF = loadSubgraphFromFileSystem(context, URIGenerator.retrieveId(domainUri), "edges", sectorId, Optional.of(minScore), types);
if (df == null){
df = sectorDF;
}else{
df = df.unionAll(sectorDF).distinct();
}
}
LOG.info("all edges loaded");
return df;
}
public void saveCentroids(ComputingContext context,String domainUri, DataFrame dataFrame){
try{
// Clean previous model
String id = URIGenerator.retrieveId(domainUri);
storageHelper.create(storageHelper.absolutePath(helper.getStorageHelper().path(id, "")));
String ldaPath = helper.getStorageHelper().path(id, "lda/similarities/centroids/nodes");
helper.getStorageHelper().deleteIfExists(ldaPath);
// Save the model
String absoluteModelPath = helper.getStorageHelper().absolutePath(helper.getStorageHelper().path(id, "lda/similarities/centroids/nodes"));
dataFrame
.repartition(context.getRecommendedPartitions()/2)
.write()
.mode(SaveMode.Overwrite)
.save(absoluteModelPath);
LOG.info("Saved centroids at: " + absoluteModelPath);
}catch (Exception e){
if (e instanceof java.nio.file.FileAlreadyExistsException) {
LOG.warn(e.getMessage());
}else {
LOG.error("Error saving model", e);
}
}
}
public void saveCentroidSimilarities(ComputingContext context, String domainUri, DataFrame dataFrame){
try{
// Clean previous model
String id = URIGenerator.retrieveId(domainUri);
storageHelper.create(storageHelper.absolutePath(helper.getStorageHelper().path(id, "")));
String ldaPath = helper.getStorageHelper().path(id, "lda/similarities/centroids/edges");
helper.getStorageHelper().deleteIfExists(ldaPath);
// Save the model
String absoluteModelPath = helper.getStorageHelper().absolutePath(helper.getStorageHelper().path(id,
"lda/similarities/centroids/edges"));
dataFrame
.repartition(context.getRecommendedPartitions()/2)
.write()
.mode(SaveMode.Overwrite)
.save(absoluteModelPath);
LOG.info("Saved centroids at: " + absoluteModelPath);
}catch (Exception e){
if (e instanceof java.nio.file.FileAlreadyExistsException) {
LOG.warn(e.getMessage());
}else {
LOG.error("Error saving model", e);
}
}
}
public void saveSubGraphToFileSystem(ComputingContext context,DataFrame dataFrame, String id , String label, String centroidId){
try {
helper.getStorageHelper().create(id);
// Clean previous model
String ldaPath = storageHelper.path(id, "lda/similarities/subgraphs/"+centroidId+"/"+label);
storageHelper.deleteIfExists(ldaPath);
// Save the model
String absoluteModelPath = storageHelper.absolutePath(storageHelper.path(id, "lda/similarities/subgraphs/"+centroidId+"/"+label));
dataFrame
.repartition(context.getRecommendedPartitions()/2)
.write()
.mode(SaveMode.Overwrite)
.save(absoluteModelPath);
LOG.info("Saved subgraph "+centroidId+"/"+label+" from graph-model at: " + absoluteModelPath);
}catch (Exception e){
if (e instanceof java.nio.file.FileAlreadyExistsException) {
LOG.warn(e.getMessage());
}else {
LOG.error("Error saving model", e);
}
}
}
public DataFrame loadSubgraphFromFileSystem(ComputingContext context, String id, String label, String centroidId, Optional<Double> minScore, List<String> types){
String modelPath = storageHelper.absolutePath(storageHelper.path(id, "lda/similarities/subgraphs/"+centroidId+"/"+label));
LOG.info("loading subgraph "+centroidId + "/"+ label+" from graph-model:" + modelPath);
Boolean extendedTypeFilter = (label.equalsIgnoreCase("edges"));
String typeFilter = extendedTypeFilter?
"resource_type_1 in (" + types.stream().map(t -> "'"+t+"'").collect(Collectors.joining(",")) + ")" :
" type in (" + types.stream().map(t -> "'"+t+"'").collect(Collectors.joining(",")) + ")";
String scoreFilter = (minScore.isPresent())? " score > " + minScore.get() : "";
StructType structType = (label.equalsIgnoreCase("nodes"))?
DataTypes
.createStructType(new StructField[]{
DataTypes.createStructField(ShapesDao.RESOURCE_URI, DataTypes.StringType, false),
DataTypes.createStructField(ShapesDao.RESOURCE_TYPE, DataTypes.StringType, false),
DataTypes.createStructField(ShapesDao.VECTOR, DataTypes.createArrayType(DataTypes.DoubleType), false)
}) :
DataTypes
.createStructType(new StructField[]{
DataTypes.createStructField(SimilaritiesDao.RESOURCE_URI_1, DataTypes.StringType, false),
DataTypes.createStructField(SimilaritiesDao.RESOURCE_URI_2, DataTypes.StringType, false),
DataTypes.createStructField(SimilaritiesDao.SCORE, DataTypes.DoubleType, false),
DataTypes.createStructField(SimilaritiesDao.RESOURCE_TYPE_1, DataTypes.StringType, false),
DataTypes.createStructField(SimilaritiesDao.RESOURCE_TYPE_2, DataTypes.StringType, false)
});
if (minScore.isPresent() && types.isEmpty()){
LOG.info("min score and no types filter");
return context.getSqlContext()
.read()
.schema(structType)
.load(modelPath)
.filter(scoreFilter);
}
else if (minScore.isPresent() && !types.isEmpty()){
if (extendedTypeFilter){
LOG.info("min score and types and extended type filter");
return context.getSqlContext()
.read()
.schema(structType)
.load(modelPath)
.filter(scoreFilter)
.filter(typeFilter)
.filter("resource_type_2 in (" + types.stream().map(t -> "'"+t+"'").collect(Collectors.joining(",")) + ")");
}else{
LOG.info("min score and types and not extended type filter");
return context.getSqlContext()
.read()
.schema(structType)
.load(modelPath)
.filter(scoreFilter)
.filter(typeFilter);
}
}else if (!minScore.isPresent() && types.isEmpty()){
LOG.info("no min score and types is empty");
return context.getSqlContext()
.read()
.schema(structType)
.load(modelPath);
}else{
if (extendedTypeFilter){
LOG.info("else and extended types filter");
return context.getSqlContext()
.read()
.schema(structType)
.load(modelPath)
.filter(typeFilter).filter("resource_type_2 in (" + types.stream().map(t -> "'"+t+"'").collect(Collectors.joining(",")) + ")");
}else{
LOG.info("else and else");
return context.getSqlContext()
.read()
.schema(structType)
.load(modelPath)
.filter(typeFilter);
}
}
}
public void saveToFileSystem(ComputingContext context, DataFrame dataFrame, String id , String label){
try {
helper.getStorageHelper().create(id);
// Clean previous model
String ldaPath = storageHelper.path(id, "lda/similarities/graph/"+label);
storageHelper.deleteIfExists(ldaPath);
// Save the model
String absoluteModelPath = storageHelper.absolutePath(storageHelper.path(id, "lda/similarities/graph/"+label));
dataFrame
.repartition(context.getRecommendedPartitions()/2)
.write()
.mode(SaveMode.Overwrite)
.save(absoluteModelPath);
LOG.info("Saved "+label +" from graph-model at: " + absoluteModelPath);
}catch (Exception e){
if (e instanceof java.nio.file.FileAlreadyExistsException) {
LOG.warn(e.getMessage());
}else {
LOG.error("Error saving model", e);
}
}
}
public DataFrame loadFromFileSystem(ComputingContext context, String id, String label){
String modelPath = storageHelper.absolutePath(storageHelper.path(id,"lda/similarities/graph/"+label));
LOG.info("loading "+label+" from graph-model:" + modelPath);
return context.getSqlContext().load(modelPath).repartition(context.getRecommendedPartitions());
}
public DataFrame loadCentroidsFromFileSystem(ComputingContext context, String id, String label){
String modelPath = storageHelper.absolutePath(storageHelper.path(id,"lda/similarities/centroids/"+label));
LOG.info("loading "+label+" from centroids-graph-model:" + modelPath);
StructType nodeDataType = (label.equalsIgnoreCase("nodes"))?
DataTypes
.createStructType(new StructField[]{
DataTypes.createStructField(ShapesDao.RESOURCE_URI, DataTypes.StringType, false),
DataTypes.createStructField(ShapesDao.RESOURCE_TYPE, DataTypes.StringType, false),
DataTypes.createStructField(ShapesDao.VECTOR, DataTypes.createArrayType(DataTypes.DoubleType), false)
}) :
DataTypes
.createStructType(new StructField[]{
DataTypes.createStructField(SimilaritiesDao.RESOURCE_URI_1, DataTypes.StringType, false),
DataTypes.createStructField(SimilaritiesDao.RESOURCE_URI_2, DataTypes.StringType, false),
DataTypes.createStructField(SimilaritiesDao.SCORE, DataTypes.DoubleType, false),
DataTypes.createStructField(SimilaritiesDao.RESOURCE_TYPE_1, DataTypes.StringType, false),
DataTypes.createStructField(SimilaritiesDao.RESOURCE_TYPE_2, DataTypes.StringType, false)
});
return context.getSqlContext()
.read()
.schema(nodeDataType)
.load(modelPath);
}
}
|
package Amazon;
import java.util.ArrayList;
public class TreeZigZag {
public static class Node {
int value;
Node left;
Node right;
public Node(int value, Node left, Node right) {
super();
this.value = value;
this.left = left;
this.right = right;
}
public Node() {
this.value = 0;
this.left = null;
this.right = null;
}
public Node(int value) {
super();
this.value = value;
this.left = null;
this.right = null;
}
}
public static Node root = null;
public static void main(String[] args) {
int[] elements = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
Node root = new Node(elements[0]);
root.left = new Node(elements[1]);
root.right = new Node(elements[2]);
root.left.left = new Node(elements[3]);
root.left.right = new Node(elements[4]);
root.right.left = new Node(elements[5]);
root.right.right = new Node(elements[6]);
root.left.left.left = new Node(elements[7]);
root.left.left.right = new Node(elements[8]);
System.out.print(root.value);
ArrayList<Node> children = findChildren(root);
int i = 0;
while (children.size() != 0) {
if (i % 2 == 0) {
for (int j = children.size() - 1; j >= 0; j--) {
System.out.print(children.get(j).value);
}
} else {
for (int j = 0; j < children.size(); j++) {
System.out.print(children.get(j).value);
}
}
i++;
children = findChildrenInALevel(children);
}
}
public static ArrayList<Node> findChildren(Node n) {
ArrayList<Node> child = new ArrayList<Node>();
if (n.left != null) {
child.add(n.left);
}
if (n.right != null) {
child.add(n.right);
}
return child;
}
public static ArrayList<Node> findChildrenInALevel(ArrayList<Node> x) {
ArrayList<Node> list = new ArrayList<Node>();
for (Node t : x) {
list.addAll(findChildren(t));
}
return list;
}
}
|
package leetcode;
import java.util.Arrays;
/**
* @author kangkang lou
*/
public class Main_338 {
public int[] countBits(int num) {
int[] arr = new int[num + 1];
for (int i = 1; i <= num; i++) {
arr[i] = arr[i >> 1] + (i & 1);
}
return arr;
}
public static void main(String[] args) {
System.out.println(Arrays.toString(new Main_338().countBits(6)));
}
}
|
package com.tencent.mm.plugin.fts.ui;
import android.content.Context;
import android.graphics.Bitmap;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.TextView.BufferType;
import com.tencent.mm.kernel.g;
import com.tencent.mm.plugin.fts.a.d.c;
import com.tencent.mm.plugin.fts.a.n;
import com.tencent.mm.plugin.fts.ui.n.a;
import com.tencent.mm.sdk.platformtools.ad;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.smtt.export.external.interfaces.IX5WebViewClient;
import org.json.JSONObject;
public final class m {
public static boolean a(CharSequence charSequence, TextView textView) {
if (charSequence == null || charSequence.length() == 0) {
textView.setVisibility(8);
return false;
}
textView.setText(charSequence, BufferType.SPANNABLE);
textView.setVisibility(0);
return true;
}
public static boolean a(String str, TextView textView) {
if (str == null || str.length() == 0) {
textView.setVisibility(8);
return false;
}
textView.setText(str);
textView.setVisibility(0);
return true;
}
public static void a(Context context, ImageView imageView, String str, String str2, int i) {
a(context, imageView, str, str2, i, true, 0, 0);
}
public static void a(Context context, ImageView imageView, String str, String str2, int i, boolean z, int i2, int i3) {
((n) g.n(n.class)).getFTSImageLoader().a(imageView, str, str2, z, i2, i3);
if (!bi.oW(str) || !bi.oW(str2)) {
Bitmap a = ((n) g.n(n.class)).getFTSImageLoader().a(str, str2, z, i2, i3);
if (a == null || a.isRecycled()) {
if (i > 0) {
imageView.setImageResource(i);
} else {
imageView.setImageResource(a.transparent);
}
((n) g.n(n.class)).getFTSImageLoader().a(context, imageView, str, str2, z, i2, i3);
} else {
c.a.a(context.getResources(), a, imageView);
}
imageView.setVisibility(0);
} else if (i <= 0 || (bi.oW(str) && bi.oW(str2))) {
imageView.setVisibility(8);
} else {
imageView.setImageResource(i);
}
}
public static String qm(int i) {
int i2 = 0;
switch (i) {
case IX5WebViewClient.ERROR_TOO_MANY_REQUESTS /*-15*/:
i2 = n.g.fts_header_mini_game;
break;
case IX5WebViewClient.ERROR_FILE /*-13*/:
i2 = n.g.fts_header_we_app;
break;
case IX5WebViewClient.ERROR_FAILED_SSL_HANDSHAKE /*-11*/:
i2 = n.g.fts_header_mobile_friend;
break;
case IX5WebViewClient.ERROR_TIMEOUT /*-8*/:
i2 = n.g.fts_header_top_hits;
break;
case IX5WebViewClient.ERROR_IO /*-7*/:
i2 = n.g.fts_header_focus_biz;
break;
case IX5WebViewClient.ERROR_CONNECT /*-6*/:
i2 = n.g.fts_header_feature;
break;
case IX5WebViewClient.ERROR_PROXY_AUTHENTICATION /*-5*/:
i2 = n.g.fts_header_game;
break;
case IX5WebViewClient.ERROR_AUTHENTICATION /*-4*/:
i2 = n.g.fts_header_contact;
break;
case IX5WebViewClient.ERROR_UNSUPPORTED_AUTH_SCHEME /*-3*/:
i2 = n.g.fts_header_chatroom;
break;
case IX5WebViewClient.ERROR_HOST_LOOKUP /*-2*/:
i2 = n.g.fts_header_message;
break;
case IX5WebViewClient.ERROR_UNKNOWN /*-1*/:
i2 = n.g.fts_header_favorite;
break;
}
if (i2 == 0) {
return null;
}
return ad.getContext().getString(i2);
}
/* JADX WARNING: inconsistent code. */
/* Code decompiled incorrectly, please refer to instructions dump. */
public static java.lang.CharSequence a(android.content.Context r9, java.util.List<com.tencent.mm.plugin.fts.a.a.f> r10, java.lang.String[] r11, com.tencent.mm.plugin.fts.a.a.g r12, android.text.TextPaint r13) {
/*
r3 = 0;
r8 = 1;
r0 = com.tencent.mm.plugin.fts.a.n.class;
r0 = com.tencent.mm.kernel.g.n(r0);
r0 = (com.tencent.mm.plugin.fts.a.n) r0;
r1 = new com.tencent.mm.plugin.fts.ui.m$1;
r1.<init>(r0);
java.util.Arrays.sort(r11, r1);
r4 = new android.text.SpannableStringBuilder;
r4.<init>();
r2 = r3;
L_0x0018:
r0 = r10.size();
if (r2 >= r0) goto L_0x00a1;
L_0x001e:
r0 = r10.get(r2);
r0 = (com.tencent.mm.plugin.fts.a.a.f) r0;
r1 = r0.jrP;
r5 = r11.length;
if (r1 >= r5) goto L_0x0068;
L_0x0029:
r1 = r0.jrP;
r5 = r11[r1];
r1 = com.tencent.mm.sdk.platformtools.bi.oW(r5);
if (r1 != 0) goto L_0x0068;
L_0x0033:
r1 = com.tencent.mm.plugin.messenger.foundation.a.i.class;
r1 = com.tencent.mm.kernel.g.l(r1);
r1 = (com.tencent.mm.plugin.messenger.foundation.a.i) r1;
r1 = r1.FR();
r1 = r1.Yg(r5);
if (r1 == 0) goto L_0x0068;
L_0x0045:
r5 = r1.field_username;
r6 = com.tencent.mm.model.s.a(r1, r5);
r7 = r0.jru;
switch(r7) {
case 29: goto L_0x0090;
case 30: goto L_0x008e;
case 31: goto L_0x008c;
case 32: goto L_0x009a;
case 33: goto L_0x0093;
case 34: goto L_0x007d;
case 35: goto L_0x007b;
case 36: goto L_0x0079;
case 37: goto L_0x006c;
default: goto L_0x0050;
};
L_0x0050:
r1 = r0.jrR;
r1 = com.tencent.mm.sdk.platformtools.bi.oW(r1);
if (r1 != 0) goto L_0x0068;
L_0x0058:
r1 = r0.jrR;
r5 = r12.jrV;
r1 = r1.contains(r5);
if (r1 == 0) goto L_0x0068;
L_0x0062:
r1 = r0.jrT;
r1 = r1 + 10;
r0.jrT = r1;
L_0x0068:
r0 = r2 + 1;
r2 = r0;
goto L_0x0018;
L_0x006c:
r1 = r1.wM();
r1 = com.tencent.mm.plugin.fts.a.d.cS(r5, r1);
r0.jrR = r1;
r0.jrS = r6;
goto L_0x0050;
L_0x0079:
r0.jrU = r8;
L_0x007b:
r0.jry = r8;
L_0x007d:
r5 = r1.field_nickname;
r0.jrR = r5;
r1 = r1.field_nickname;
r1 = r1.equals(r6);
if (r1 != 0) goto L_0x0050;
L_0x0089:
r0.jrS = r6;
goto L_0x0050;
L_0x008c:
r0.jrU = r8;
L_0x008e:
r0.jry = r8;
L_0x0090:
r0.jrR = r6;
goto L_0x0050;
L_0x0093:
r1 = r0.content;
r0.jrR = r1;
r0.jrS = r6;
goto L_0x0050;
L_0x009a:
r1 = r1.csT;
r0.jrR = r1;
r0.jrS = r6;
goto L_0x0050;
L_0x00a1:
r0 = new com.tencent.mm.plugin.fts.ui.m$2;
r0.<init>();
java.util.Collections.sort(r10, r0);
r0 = 0;
r1 = r3;
r2 = r0;
L_0x00ac:
r0 = r10.size();
if (r1 >= r0) goto L_0x0132;
L_0x00b2:
r0 = r12.jrX;
r0 = r0.length;
if (r1 >= r0) goto L_0x0132;
L_0x00b7:
r0 = com.tencent.mm.plugin.fts.ui.b.a.jvq;
r0 = r0 + -100;
r0 = (float) r0;
r2 = r0 - r2;
r0 = 1120403456; // 0x42c80000 float:100.0 double:5.53552857E-315;
r0 = (r2 > r0 ? 1 : (r2 == r0 ? 0 : -1));
if (r0 <= 0) goto L_0x0132;
L_0x00c4:
r0 = r10.get(r1);
r0 = (com.tencent.mm.plugin.fts.a.a.f) r0;
r5 = r0.jrR;
r6 = r13.getTextSize();
r5 = com.tencent.mm.pluginsdk.ui.d.j.a(r9, r5, r6);
r6 = r4.length();
if (r6 <= 0) goto L_0x00e0;
L_0x00da:
r6 = ", ";
r4.append(r6);
L_0x00e0:
r6 = new com.tencent.mm.plugin.fts.a.a.d;
r6.<init>();
r6.jrw = r5;
r6.jrx = r12;
r5 = r0.jry;
r6.jry = r5;
r5 = r0.jrU;
r6.jrz = r5;
r6.jrC = r2;
r6.dug = r13;
r2 = r0.jrS;
r2 = com.tencent.mm.sdk.platformtools.bi.oW(r2);
if (r2 != 0) goto L_0x011c;
L_0x00fd:
r0 = r0.jrS;
r2 = r13.getTextSize();
r0 = com.tencent.mm.pluginsdk.ui.d.j.a(r9, r0, r2);
r2 = 2;
r2 = new java.lang.CharSequence[r2];
r2[r3] = r0;
r0 = "(";
r2[r8] = r0;
r0 = android.text.TextUtils.concat(r2);
r6.jrD = r0;
r0 = ")";
r6.jrE = r0;
L_0x011c:
r0 = com.tencent.mm.plugin.fts.a.f.a(r6);
r0 = r0.jrO;
r4.append(r0);
r0 = r4.toString();
r2 = r13.measureText(r0);
r0 = r1 + 1;
r1 = r0;
goto L_0x00ac;
L_0x0132:
return r4;
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.plugin.fts.ui.m.a(android.content.Context, java.util.List, java.lang.String[], com.tencent.mm.plugin.fts.a.a.g, android.text.TextPaint):java.lang.CharSequence");
}
public static final void h(View view, boolean z) {
if (z) {
view.setBackgroundResource(n.c.comm_list_item_selector);
} else {
view.setBackgroundResource(n.c.comm_list_item_selector_no_divider);
}
}
public static final void i(View view, boolean z) {
if (z) {
view.setBackgroundResource(n.c.list_item_normal);
} else {
view.setBackgroundResource(n.c.mm_trans);
}
}
public static int a(JSONObject jSONObject, String str, Context context) {
int optInt = jSONObject == null ? 0 : jSONObject.optInt("businessType");
if (optInt != 0) {
return optInt;
}
if (str.equals(context.getString(n.g.search_education_article))) {
return 2;
}
if (str.equals(context.getString(n.g.search_education_timeline))) {
return 8;
}
if (str.equals(context.getString(n.g.search_education_biz_contact))) {
return 1;
}
x.i("MicroMsg.FTS.FTSUIApiLogic", "option " + str + " no type");
return optInt;
}
}
|
package com.satya.springfeatures.springfeaturesspi;
public interface SpringContextAware {
String getUserName();
}
|
// Sun Certified Java Programmer
// Chapter 2, P149
// Object Orientation
class TestFrog {
public static void main(String[] args) {
new Frog();
new Frog();
new Frog();
System.out.println("frogCount:" + Frog.frogCount); // Access
// static variable
}
}
|
package am.itspace.newfeaturesinjava8.service.stream;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
@Service
public class StreamFind {
private List<String> strings = Arrays.asList("Java", "Python", "C#", "JavaScript", "Ruby", "C++");
public Optional<String> getAnyMemberFromList() {
return strings.stream()
.findAny();
}
public Optional<String> getAnyMemberFromList(String word) {
return strings.stream()
.filter(s -> s.contains(word))
.findAny();
}
public Optional<String> getFirsFromList() {
return strings.stream()
.findFirst();
}
public Optional<String> getFirstFromListByLength(int length) {
return strings.stream()
.filter(string -> string.length() > length)
.findFirst();
}
}
|
package com.temple.beans;
import javax.xml.bind.annotation.XmlRootElement;
/**
* @author Mayur Jain
*
*/
@XmlRootElement(name="programType")
public class ProgramType {
private String type;
private String programDesc;
public String getType() {
return type;
}
public void setType(String programType) {
this.type = programType;
}
public String getProgramDesc() {
return programDesc;
}
public void setProgramDesc(String programDesc) {
this.programDesc = programDesc;
}
}
|
package com.test.dao;
import com.alibaba.druid.pool.DruidDataSource;
import com.test.pojo.Product;
import com.test.utils.DataSourceSql;
import org.apache.commons.dbutils.DbUtils;
import org.apache.commons.dbutils.QueryRunner;
import java.sql.Connection;
import java.sql.SQLException;
public class ProDaoTmpl implements ProDao {
private DataSourceSql dss;
private QueryRunner qr;
public ProDaoTmpl(){
this.dss = DataSourceSql.getDss();
qr = new QueryRunner();
}
@Override
public void addOnePro(Product product) {
Connection connection = dss.getConn();
String sql = "insert into product values(?,?,?,?,?,?,?,?,?)";
try{
qr.update(connection, sql, product.getPro_id(), product.getPro_name(), product.getPro_price(), product.getPro_img(), product.getPro_des(), product.getPro_stock(), product.getPro_date(), product.getPro_cate_id(), product.getPro_factory());
}catch(SQLException e){
e.printStackTrace();
}finally{
try {
DbUtils.close(connection);
}catch (SQLException e){
e.printStackTrace();
}
}
}
}
|
package week1.day1;
public class CalculatePrime {
public void getPrime(int number)
{
int j=0;
for(int i=1; i<=number; i++)
{
if(number%i==0)
{
j++;
}
}
if(j==2)
{
System.out.println(" The number is prime");
}
else
{
System.out.println(" The number is composite");
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
CalculatePrime obj = new CalculatePrime();
obj.getPrime(55);
}
}
|
package com.rc.portal.service.impl;
import java.sql.SQLException;
import java.util.List;
import com.rc.portal.dao.TGoodsPropertyDAO;
import com.rc.portal.service.TGoodsPropertyManager;
import com.rc.portal.vo.TGoodsProperty;
import com.rc.portal.vo.TGoodsPropertyExample;
public class TGoodsPropertyManagerImpl implements TGoodsPropertyManager {
private TGoodsPropertyDAO tgoodspropertydao;
public TGoodsPropertyManagerImpl() {
super();
}
public void setTgoodspropertydao(TGoodsPropertyDAO tgoodspropertydao){
this.tgoodspropertydao=tgoodspropertydao;
}
public TGoodsPropertyDAO getTgoodspropertydao(){
return this.tgoodspropertydao;
}
public int countByExample(TGoodsPropertyExample example) throws SQLException{
return tgoodspropertydao. countByExample( example);
}
public int deleteByExample(TGoodsPropertyExample example) throws SQLException{
return tgoodspropertydao. deleteByExample( example);
}
public Long insert(TGoodsProperty record) throws SQLException{
return tgoodspropertydao. insert( record);
}
public Long insertSelective(TGoodsProperty record) throws SQLException{
return tgoodspropertydao. insertSelective( record);
}
public List selectByExample(TGoodsPropertyExample example) throws SQLException{
return tgoodspropertydao. selectByExample( example);
}
public int updateByExampleSelective(TGoodsProperty record, TGoodsPropertyExample example) throws SQLException{
return tgoodspropertydao. updateByExampleSelective( record, example);
}
public int updateByExample(TGoodsProperty record, TGoodsPropertyExample example) throws SQLException{
return tgoodspropertydao. updateByExample( record, example);
}
}
|
package com.tencent.mm.plugin.product.ui;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
import com.tencent.mm.plugin.product.b.c;
import com.tencent.mm.plugin.wxpay.a$i;
import com.tencent.mm.protocal.c.bfm;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.ui.base.s;
class MallProductReceiptUI$1 implements OnMenuItemClickListener {
final /* synthetic */ MallProductReceiptUI lSZ;
MallProductReceiptUI$1(MallProductReceiptUI mallProductReceiptUI) {
this.lSZ = mallProductReceiptUI;
}
public final boolean onMenuItemClick(MenuItem menuItem) {
int i = 0;
String obj = MallProductReceiptUI.a(this.lSZ).getText().toString();
if (bi.oW(obj)) {
s.makeText(this.lSZ, a$i.mall_product_receipt_empty_tips, 0).show();
} else {
c b = MallProductReceiptUI.b(this.lSZ);
b.lQS = new bfm();
bfm bfm = b.lQS;
if (!bi.oW(obj)) {
i = 1;
}
bfm.sgM = i;
b.lQS.jQf = obj;
this.lSZ.finish();
}
return true;
}
}
|
package com.tencent.mm.ui.chatting.viewitems;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import com.tencent.mm.bg.d;
import com.tencent.mm.plugin.report.service.h;
import com.tencent.mm.sdk.platformtools.bi;
class s$4 implements OnClickListener {
final /* synthetic */ String qiU;
final /* synthetic */ s ucn;
final /* synthetic */ String val$url;
s$4(s sVar, String str, String str2) {
this.ucn = sVar;
this.val$url = str;
this.qiU = str2;
}
public final void onClick(View view) {
if (!bi.oW(this.val$url)) {
Intent intent = new Intent();
intent.putExtra("rawUrl", this.val$url);
d.b(s.b(this.ucn).tTq.getContext(), "webview", ".ui.tools.WebViewUI", intent);
h.mEJ.h(11608, new Object[]{s.d(this.ucn), this.qiU, Integer.valueOf(1)});
}
}
}
|
/**
* Copyright 2011 The Kuali Foundation Licensed under the
* Educational Community 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.osedu.org/licenses/ECL-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.kuali.mobility.events.dao;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.collections.CollectionUtils;
import org.kuali.mobility.events.entity.Category;
import org.kuali.mobility.events.entity.Event;
import org.kuali.mobility.events.entity.EventContact;
import org.kuali.mobility.events.entity.UMEvent;
import org.kuali.mobility.events.entity.UMEventReader;
import org.kuali.mobility.events.entity.UMSponsor;
import org.kuali.mobility.events.util.CategoryPredicate;
import com.thoughtworks.xstream.XStream;
public class EventsDaoUMImpl extends EventsDaoImpl {
private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger( EventsDaoUMImpl.class );
// private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@Override
public void initData( final String campus, final String categoryId ) {
this.addEvents(loadEventsForCategory (campus, categoryId));
}
public List<Event> loadEventsForCategory( final String campus, final String categoryId ) {
LOG.debug( "Loading event feed for category "+categoryId );
if( null == getEvents() || getEvents().isEmpty() )
{
LOG.debug( "Events list was empty, creating a new one." );
//setEvents( new ArrayList<Event>() );
}
if( null == getCategories() || getCategories().isEmpty() )
{
LOG.debug( "Category list was empty, initializing a new one." );
initData( campus );
}
List<Event> newEvents = new ArrayList<Event>();
Category category = (Category) CollectionUtils.find ( getCategories(), new CategoryPredicate( campus, categoryId ) );;
if ( category != null ) {
LOG.debug( "Found category object for id "+categoryId );
XStream xstream = new XStream();
xstream.processAnnotations(UMEventReader.class);
xstream.processAnnotations(UMEvent.class);
xstream.processAnnotations(UMSponsor.class);
UMEventReader eventReader = null;
try {
URL url = new URL(category.getUrlString()+"&_type=xml");
LOG.debug("Mapping events from url: " + category.getUrlString());
if (url != null) {
eventReader = (UMEventReader) xstream.fromXML(url);
}
} catch (MalformedURLException mue) {
LOG.error( mue.getLocalizedMessage() );
}
LOG.debug("check eventReader " + (eventReader == null?"null":"mnot null"));
LOG.debug("check eventReader.getEvents " + (eventReader.getEvents() == null?"null":"mnot null"));
if ( eventReader != null && eventReader.getEvents() != null) {
for ( UMEvent e : eventReader.getEvents()){
LOG.debug("processing e " + e.getTitle());
Event newEvent = (Event) getApplicationContext().getBean("event");
newEvent.setEventId(e.getId());
newEvent.setCategory(category);
newEvent.setTitle(e.getTitle());
newEvent.setDisplayStartTime(e.getTimeBegin());
//Saket's Addition
newEvent.setType(e.getType());
newEvent.setDisplayStartDate(e.getDateBegin());
newEvent.setLocation(e.getBuildingName());
newEvent.setLink(e.getUrl());
try {
if ( e.getTsBegin() != null && e.getTsBegin().isEmpty() == false) {
newEvent.setStartDate(sdf.parse(e.getTsBegin()));
}
if ( e.getTsEnd() != null && e.getTsEnd().isEmpty() == false) {
newEvent.setEndDate(sdf.parse(e.getTsEnd()));
}
} catch (ParseException e1) {
LOG.error(e1.getLocalizedMessage());
}
newEvent.setDisplayEndTime(e.getTimeEnd());
newEvent.setDisplayEndDate(e.getDateEnd());
List<String> myDescription = new ArrayList<String>();
myDescription.add(e.getDescription());
newEvent.setDescription( myDescription );
List<EventContact> myContacts = new ArrayList<EventContact>();
for ( UMSponsor f : e.getSponsors()){
EventContact newContact = (EventContact) getApplicationContext().getBean("eventContact");
newContact.setName(f.getGroupName());
newContact.setUrl(f.getWebsite());
myContacts.add(newContact);
}
newEvent.setContact(myContacts);
LOG.debug("CONTACT " + newEvent.getContact());
newEvents.add(newEvent);
}
}
}
return( newEvents );
}
}
|
package sisgelar.controller;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.List;
import sisgelar.dao.ProdutoClienteDao;
import sisgelar.model.ProdutoCliente;
/**
*
* @author Kaike Leite
*/
public abstract class ProdutoClienteController {
public static boolean cadastrar(ProdutoCliente p){
ProdutoClienteDao dao = new ProdutoClienteDao();
return dao.inserir(p);
}
public static boolean remover(ProdutoCliente p){
return new ProdutoClienteDao().excluir(p);
}
public static List<ProdutoCliente> pesquisar(String t) {
ProdutoClienteDao dao = new ProdutoClienteDao();
List<ProdutoCliente> pessoas = dao.busque(t);
return pessoas;
}
public static List<ProdutoCliente> pesquisar(int t) {
ProdutoClienteDao dao = new ProdutoClienteDao();
List<ProdutoCliente> pessoas = dao.buscar(t);
return pessoas;
}
public static List<ProdutoCliente> pesquisar(int prod, int cli) {
ProdutoClienteDao dao = new ProdutoClienteDao();
List<ProdutoCliente> pessoas = dao.buscar(prod, cli);
return pessoas;
}
public static boolean modificar(ProdutoCliente p) {
ProdutoClienteDao dao = new ProdutoClienteDao();
return dao.alterar(p);
}
}
|
package com.example.lianxi;
/*
*@auther:谷建龙
*@Date: 2019/11/17
*@Time:19:48
*@Description:
* */
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.text.TextPaint;
import android.util.AttributeSet;
import android.view.View;
import androidx.annotation.Nullable;
public class ListView extends View {
private Context context;
private int width = 0;
private int height = 0;
private Paint linePaint;
private Paint textPaint;
private Paint pointPaint;
public ListView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
this.context = context;
init();
}
private void init() {
linePaint = new Paint();
linePaint.setStyle(Paint.Style.FILL);
linePaint.setColor(Color.BLUE);
linePaint.setAntiAlias(true);
linePaint.setStrokeWidth((float) 2.0);
textPaint = new Paint();
textPaint.setStyle(Paint.Style.FILL);
textPaint.setAntiAlias(true);
textPaint.setTextAlign(Paint.Align.CENTER);
textPaint.setColor(Color.RED);
textPaint.setTextSize(20);
pointPaint = new Paint();
pointPaint.setStyle(Paint.Style.FILL);
pointPaint.setAntiAlias(true);
pointPaint.setTextAlign(Paint.Align.CENTER);
pointPaint.setColor(Color.RED);
pointPaint.setTextSize(20);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
width = MeasureSpec.getSize(widthMeasureSpec);
height = MeasureSpec.getSize(heightMeasureSpec);
setMeasuredDimension(width, height);
}
protected float[][] points = new float[][]{{1, 10}, {2, 47}, {3, 11}, {4, 38}, {5, 9}, {6, 52}, {7, 14}, {8, 37}, {9, 29}, {10, 31}};
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.translate(50, height - 50);
drawLine(canvas);
drawLineX(canvas);
drawLineY(canvas);
}
float pointX = 0;
float pointY = 0;
private void drawLine(Canvas canvas) {
float pointXTime = 0;
float pointYTime = 0;
for (int i = 0; i < points.length; i++) {
float time = points[i][0] % points.length;
if (time == 0) {
pointX = (points[i][0]) * ((width - 100) / points.length);
} else {
pointX = (points[i][0] % points.length) * ((width - 100) / points.length);
}
pointY = 0 - (points[i][1] / 60) * (height - 100);
canvas.drawCircle(pointX, pointY, 5, pointPaint);
canvas.drawText(i + 1 + "", pointX - 10, pointY - 10, pointPaint);
canvas.drawText(((int) points[i][0] + "," + (int) points[i][1]), pointX - 20, pointY - 20, textPaint);
if (i != 0) {
canvas.drawLine(pointXTime, pointYTime, pointX, pointY, linePaint);
}
pointXTime = pointX;
pointYTime = pointY;
}
}
private void drawLineY(Canvas canvas) {
int startX = 0;
int startY = 0;
int spaceing = (height - 100) / points.length;
for (int i = 0; (startY + spaceing * i) < height - 50; i++) {
canvas.drawLine(startX, startY, startX, startY - spaceing * i, linePaint);
canvas.drawCircle(startX, startY - spaceing * i, 5, linePaint);
canvas.drawText(6 * i + "", startX - 30, startY - spaceing * i, textPaint);
}
}
private void drawLineX(Canvas canvas) {
int startX = 0;
int startY = 0;
int spaceing = (width - 100) / points.length;
for (int i = 0; (startX + spaceing * i) < width - 50; i++) {
canvas.drawLine(startX, startY, startX + spaceing * i, startY, linePaint);
canvas.drawCircle(startX + spaceing * i, startY, 5, linePaint);
canvas.drawText(i + "", startX + spaceing * i, startY + 30, textPaint);
}
}
}
|
package ua.nure.timoshenko.summaryTask4.db.entity;
import java.util.Date;
/**
* Order entity.
*
* @author L.Timoshenko
*
*/
public class Order extends Entity {
private static final long serialVersionUID = -1319478949818814841L;
private int userID;
private int statusID;
private Date date;
private int amount;
public int getStatusID() {
return statusID;
}
public void setStatusID(int statusID) {
this.statusID = statusID;
}
public int getUserID() {
return userID;
}
public void setUserID(int userID) {
this.userID = userID;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public int getAmount() {
return amount;
}
public void setAmount(int amount) {
this.amount = amount;
}
@Override
public String toString() {
return "Order{" +
"userID=" + userID +
", statusID=" + statusID +
", date=" + date +
", amount=" + amount +
'}';
}
}
|
class Edge {
GamePiece fromNode;
GamePiece toNode;
int weight;
Edge(GamePiece fromNode, GamePiece toNode, int weight) {
this.fromNode = fromNode;
this.toNode = toNode;
this.weight = weight;
}
void createConnections() {
if (this.fromNode.row == this.toNode.row) {
this.fromNode.right = true;
this.toNode.left = true;
}
else {
this.fromNode.bottom = true;
this.toNode.top = true;
}
}
}
|
package utils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author marejune
* @title: HttpResult
* @projectName aops_aopc_dataflow_service
* @description: TODO
* @date 2020/10/105:18 下午
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class HttpResult {
// 响应的状态码
private int code;
// 响应的响应体
private String body;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
}
|
package com.lupan.HeadFirstDesignMode.chapter4_factory.abstractFactory.source;
/**
* TODO 面粉
*
* @author lupan
* @version 2016/3/22 0022
*/
public abstract class Dough extends Source{
}
|
package workstarter.domain;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.springframework.data.elasticsearch.annotations.Document;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* A Student.
*/
@Entity(name = "Student")
@DiscriminatorValue("Student")
@Document(indexName = "student")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Student extends User {
private static final long serialVersionUID = 1L;
@Column(name = "matrikel_nummer")
private String matrikelNummer;
@Column(name = "title")
private String title;
@Column(name = "slogan")
private String slogan;
@OneToOne
@JoinColumn(unique = true)
private Portfolio portfolio;
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private Set<Resume> resumes = new HashSet<>();
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true)
@Fetch(value = FetchMode.SUBSELECT)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private List<School> schools = new ArrayList<>();
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true)
@Fetch(value = FetchMode.SUBSELECT)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private List<Keywords> keywords = new ArrayList<>();
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true)
@Fetch(value = FetchMode.SUBSELECT)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private List<Profession> professions = new ArrayList<>();
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true)
@Fetch(value = FetchMode.SUBSELECT)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private List<Project> projects = new ArrayList<>();
public String getMatrikelNummer() {
return matrikelNummer;
}
public Student matrikelNummer(String matrikelNummer) {
this.matrikelNummer = matrikelNummer;
return this;
}
public void setMatrikelNummer(String matrikelNummer) {
this.matrikelNummer = matrikelNummer;
}
public Portfolio getPortfolio() {
return portfolio;
}
public Student portfolio(Portfolio portfolio) {
this.portfolio = portfolio;
return this;
}
public void setPortfolio(Portfolio portfolio) {
this.portfolio = portfolio;
}
public Set<Resume> getResumes() {
return resumes;
}
public Student resumes(Set<Resume> resumes) {
this.resumes = resumes;
return this;
}
public Student addResumes(Resume resume) {
this.resumes.add(resume);
return this;
}
public Student removeResumes(Resume resume) {
this.resumes.remove(resume);
return this;
}
public void setResumes(Set<Resume> resumes) {
this.resumes = resumes;
}
public List<School> getSchools() {
return schools;
}
public Student addSchools(School school) {
this.schools.add(school);
return this;
}
public Student updateSchool(School oldSchool, School school) {
int index = this.schools.indexOf(oldSchool);
this.schools.set(index, school);
return this;
}
public Student removeSchools(School schools) {
this.schools.remove(schools);
return this;
}
public void setSchools(List<School> schools) {
this.schools = schools;
}
public Student addProfessions(Profession profession) {
this.professions.add(profession);
return this;
}
public Student updateProfession(Profession oldProfession, Profession profession) {
int index = this.professions.indexOf(oldProfession);
this.professions.set(index, profession);
return this;
}
public Student removeProfession(Profession profession) {
this.professions.remove(profession);
return this;
}
public List<Profession> getProfessions() {
return professions;
}
public void setProfessions(List<Profession> professions) {
this.professions = professions;
}
public List<Project> getProjects() {
return projects;
}
public void setProjects(List<Project> projects) {
this.projects = projects;
}
public Student addProject(Project project) {
this.projects.add(project);
return this;
}
public Student updateProjects(Project oldProject, Project project) {
int index = this.projects.indexOf(oldProject);
this.projects.set(index, project);
return this;
}
public Student removeProject(Project project) {
this.projects.remove(project);
return this;
}
public List<Keywords> getKeywords() {
return keywords;
}
public Student addKeywords(Keywords keywords) {
this.keywords.add(keywords);
return this;
}
public Student removeKeywords(Keywords keywords) {
this.keywords.remove(keywords);
return this;
}
public void setKeywords(List<Keywords> keywords) {
this.keywords = keywords;
}
public String getSlogan() {
return slogan;
}
public void setSlogan(String slogan) {
this.slogan = slogan;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Override
public String toString() {
return "Student [matrikelNummer=" + matrikelNummer + ", portfolio=" + portfolio + ", resumes=" + resumes
+ ", schools=" + schools + "]";
}
}
|
package com.epam.talentland.balance.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import com.epam.talentland.balance.entity.BalanceEntity;
@Repository
public interface BalanceRepository extends JpaRepository<BalanceEntity,String>{
@Query(value = "SELECT u FROM BalanceEntity u WHERE u.user = :user and date > :d1 and date <= :d2 order by date desc")
public List<BalanceEntity> getLastThreeMonths (@Param("user") String user,@Param("d1") String d1,@Param("d2") String d2);
}
|
//$Id$
package entity;
import valueobjects.Role;
import java.util.Objects;
public class User {
private String name;
private Role role;
public User(String name) {
this.name = name;
}
public String getName() {
return name;
}
public Role getRole() {
return role;
}
public void setRole(Role role) {
this.role = role;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof User)) return false;
User user = (User) o;
return Objects.equals(name, user.name);
}
@Override
public int hashCode() {
return Objects.hash(name);
}
}
|
package com.tencent.mm.plugin.appbrand.h;
import android.os.Bundle;
import android.util.Base64;
import android.view.View;
import com.tencent.mm.kernel.g;
import com.tencent.mm.plugin.appbrand.n.d;
import com.tencent.mm.plugin.appbrand.report.AppBrandStatObject;
import com.tencent.mm.plugin.appbrand.report.c;
import com.tencent.mm.plugin.messenger.a.a;
import com.tencent.mm.sdk.platformtools.x;
class a$1 extends a {
final /* synthetic */ long dUM;
final /* synthetic */ int eeg;
final /* synthetic */ com.tencent.mm.y.a.a gjP;
final /* synthetic */ String gjQ;
final /* synthetic */ String gjR;
final /* synthetic */ a gjS;
a$1(a aVar, com.tencent.mm.y.a.a aVar2, String str, int i, long j, String str2) {
this.gjS = aVar;
this.gjP = aVar2;
this.gjQ = str;
this.eeg = i;
this.dUM = j;
this.gjR = str2;
}
public final void onClickImp(View view) {
x.i("MicroMsg.WxaSubscribeMsgService", "On Span clicked(title : %s, username : %s, path : %s, talker : %s)", new Object[]{this.gjP.content, this.gjP.username, this.gjP.path, this.gjQ});
Bundle bundle = new Bundle();
bundle.putInt("stat_scene", this.eeg);
bundle.putString("stat_msg_id", "msg_" + Long.toString(this.dUM));
bundle.putString("stat_chat_talker_username", this.gjQ);
bundle.putString("stat_send_msg_user", this.gjR);
AppBrandStatObject appBrandStatObject = new AppBrandStatObject();
appBrandStatObject.scene = 1088;
appBrandStatObject.bGG = "";
appBrandStatObject.cbB = c.h(appBrandStatObject.scene, bundle);
appBrandStatObject.cbC = c.i(appBrandStatObject.scene, bundle);
String str = "";
if (this.gjP.path != null && this.gjP.path.length() > 0) {
byte[] decode = Base64.decode(this.gjP.path, 2);
if (decode != null) {
str = new String(decode);
}
}
((d) g.l(d.class)).a(view.getContext(), this.gjP.username, null, this.gjP.type, 0, str, appBrandStatObject);
}
}
|
package com.rd.agergia.testing.dao.ibatis;
import java.util.List;
import org.springframework.stereotype.Service;
import com.rd.agergia.base.support.DaoSupport;
import com.rd.agergia.common.entity.Pager;
import com.rd.agergia.common.entity.PagerParam;
import com.rd.agergia.testing.dao.TestingDAO;
import com.rd.agergia.testing.entity.Testing;
@SuppressWarnings("rawtypes")
@Service
public class SqlMapTestingDAO extends DaoSupport implements TestingDAO{
@SuppressWarnings("unchecked")
@Override
public void saveTesting(Testing t) {
// TODO Auto-generated method stub
super.save(t);
}
@SuppressWarnings("unchecked")
@Override
public Testing findTesting(Testing t, int id) {
// TODO Auto-generated method stub
return (Testing) super.find(t, id);
}
@SuppressWarnings("unchecked")
@Override
public void deleteTesting(Testing t, int id) {
// TODO Auto-generated method stub\
super.delete(t.getClass(), id);
}
@SuppressWarnings("unchecked")
@Override
public void updateTesting(Testing t) {
// TODO Auto-generated method stub
super.update(t);
}
@SuppressWarnings("unchecked")
@Override
public Pager<Testing> pageing(Testing t, PagerParam pager) {
// TODO Auto-generated method stub
return super.getPageingData(t.getClass(), pager);
}
}
|
//
// UDPServer.java
//
// Bhojan Anand
//
package kiloboltgames;
import java.util.*;
import java.net.*;
import java.io.*;
public class UDPServer {
public static void main (String args[]) throws Exception
{
//use DatagramSocket for UDP connection
DatagramSocket socket = new DatagramSocket(9001);
byte[] incomingBuffer = new byte[1000];
while (true)
{
DatagramPacket incomingPacket = new DatagramPacket(incomingBuffer, incomingBuffer.length);
socket.receive(incomingPacket);
// convert content of packet into a string
String request = new String(incomingPacket.getData(), 0,
incomingPacket.getLength());
// convert string to uppercase
String reply = request.toUpperCase();
// convert upper-case string into array of bytes (output
// buffer)
byte[] outgoingBuffer = new byte[1000];
outgoingBuffer = reply.getBytes();
// create reply packet using output buffer.
// Note: dest address/port is retrieved from inPkt
DatagramPacket outgoingPacket = new DatagramPacket(
outgoingBuffer, outgoingBuffer.length, incomingPacket.getAddress(),
incomingPacket.getPort());
// finally, send the packet
socket.send(outgoingPacket);
}
}
}
|
package com.pangpang6.books.lambda;
import com.google.common.collect.Lists;
import org.junit.jupiter.api.Test;
import java.util.List;
import java.util.stream.Collectors;
public class FilterTest {
@Test
public void test01() {
List<String> l1 = Lists.newArrayList("1", "2", "3");
l1 = l1.stream().filter(x -> x.equals("1")).collect(Collectors.toList());
System.out.println(l1);
}
}
|
package enum_package;
public enum Example {
Kiran,
Reddy,
Bolla;
}
|
package bai_tap;
import java.util.Scanner;
public class HienThiCacLoaiHinh {
public static void menu(int choice) {
Scanner sc = new Scanner(System.in);
choice = -1;
while(choice != 4) {
System.out.println("\n1. In hinh chu nhat");
System.out.println("2. In hinh tam giac vuong");
System.out.println("3. In hinh tam giac can");
System.out.println("4. Thoat");
System.out.println("Lua chon: ");
choice = sc.nextInt();
switch (choice) {
case 1:
System.out.println("In hinh chu nhat");
System.out.print("Nhap chieu dai: ");
int cd = sc.nextInt();
System.out.print("Nhap chieu rong: ");
int cr = sc.nextInt();
for(int i = 1; i <= cr; i++)
{
for(int j = 1 ; j <= cd; j++)
System.out.print("*");
System.out.print("\n");
}
break;
case 2:
System.out.println("In hinh tam giac vuong");
for(int i = 0; i < 5; i++)
{
for(int j = 0; j < 5 ; j++)
{
if (j == 0 || i == j || i == 4)
System.out.print("*");
else
System.out.print(" ");
}
System.out.print("\n");
}
break;
case 3:
System.out.println("In hinh tam giac can");
int n = 5,q = 0;
while(n > 0)
{
for (int i = 1; i < n; i++)
System.out.print(" ");
for (int j = 0; j <= q; j++)
System.out.print("*");
n -- ;
q += 2 ;
System.out.print("\n");
}
break;
case 4:
System.out.println("GOODBYE!");
System.exit(0);
default:
System.out.println("Lua chon sai!");
}
}
}
public static void main(String[] args) {
System.out.println("Menu");
menu(-1);
}
}
|
import java.util.ArrayList;
import java.util.HashMap;
import org.apache.uima.analysis_component.JCasAnnotator_ImplBase;
import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
import org.apache.uima.cas.FSIterator;
import org.apache.uima.jcas.JCas;
/**
*
* This is an annotator that scores extraction results based on the gold standard.
*
* @author mtydykov
*
*/
public class Scorer extends JCasAnnotator_ImplBase {
@Override
public void process(JCas arg0) throws AnalysisEngineProcessException {
FSIterator itGeneMention = arg0.getAnnotationIndex(GeneMention.type).iterator();
FSIterator itGoldMention = arg0.getAnnotationIndex(GoldMention.type).iterator();
int totalPresent = 0;
// store in map to avoid n^2 comparisons
HashMap<String, ArrayList<GoldMention>> sentIdToGoldMentionMap = new HashMap<String, ArrayList<GoldMention>>();
while (itGoldMention.hasNext()) {
GoldMention currentGoldMention = (GoldMention) itGoldMention.next();
if (!sentIdToGoldMentionMap.containsKey(currentGoldMention.getSentenceId())) {
sentIdToGoldMentionMap
.put(currentGoldMention.getSentenceId(), new ArrayList<GoldMention>());
}
totalPresent++;
sentIdToGoldMentionMap.get(currentGoldMention.getSentenceId()).add(currentGoldMention);
}
int truePos = 0;
int totalRecall = 0;
while (itGeneMention.hasNext()) {
totalRecall++;
GeneMention currMention = (GeneMention) itGeneMention.next();
if (sentIdToGoldMentionMap.containsKey(currMention.getSentenceId())) {
for (GoldMention goldMention : sentIdToGoldMentionMap.get(currMention.getSentenceId())) {
if (goldMention.getMentionBegin() == currMention.getMentionBegin()
&& goldMention.getMentionEnd() == currMention.getMentionEnd()) {
truePos++;
}
}
}
}
DocStats stats = new DocStats(arg0);
stats.setRecall((double) truePos / (totalPresent));
stats.setPrecision((double) truePos / totalRecall);
stats.setF1Score((double) 2 * (stats.getRecall() * stats.getPrecision())
/ (stats.getRecall() + stats.getPrecision()));
stats.addToIndexes();
System.out.println("Recall :" + stats.getRecall());
System.out.println("Precision : " + stats.getPrecision());
System.out.println("F1-Score : " + stats.getF1Score());
}
}
|
package com.thyssenkrupp.tks.fls.qf.server.qcs.receive.xml.builder;
import com.thyssenkrupp.tks.fls.qf.server.qcs.receive.xml.LokaleSprachweltType.GB.Walzprogramm.Walzteiltafeln;
import java.io.StringWriter;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
public class LokaleSprachweltType_GB_Walzprogramm_Walzteiltafeln_Builder
{
public static String marshal(Walzteiltafeln walzteiltafeln)
throws JAXBException
{
JAXBElement<Walzteiltafeln> jaxbElement = new JAXBElement<>(new QName("TESTING"), Walzteiltafeln.class , walzteiltafeln);
StringWriter stringWriter = new StringWriter();
return stringWriter.toString();
}
public Walzteiltafeln build()
{
Walzteiltafeln result = new Walzteiltafeln();
return result;
}
}
|
package FunctionalProgramming;
import java.util.Arrays;
import java.util.Scanner;
import java.util.function.Predicate;
import java.util.function.ToIntFunction;
public class ListOfPredicates {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.nextLine());
ToIntFunction<String> mapper = str -> Integer.parseInt(str);
int[] sequence = Arrays.stream(sc.nextLine().split("\\s+"))
.mapToInt(mapper)
.toArray();
Predicate<Integer> shouldPrint = num -> {
boolean isPrintable = true;
for (int element : sequence) {
if (num % element != 0) {
isPrintable = false;
break;
}
}
return isPrintable;
};
for (int i = 1; i <= n; i++) {
if (shouldPrint.test((i))) {
System.out.print(i + " ");
}
}
}
}
|
/*
* Copyright (c) 2008-2011 by Bjoern Kolbeck, Jan Stender,
* Zuse Institute Berlin
*
* Licensed under the BSD License, see LICENSE file for details.
*
*/
package org.xtreemfs.osd.stages;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.xtreemfs.common.Capability;
import org.xtreemfs.common.xloc.XLocations;
import org.xtreemfs.foundation.LRUCache;
import org.xtreemfs.foundation.TimeSync;
import org.xtreemfs.foundation.logging.Logging;
import org.xtreemfs.foundation.logging.Logging.Category;
import org.xtreemfs.foundation.pbrpc.generatedinterfaces.RPC.ErrorType;
import org.xtreemfs.foundation.pbrpc.generatedinterfaces.RPC.MessageType;
import org.xtreemfs.foundation.pbrpc.generatedinterfaces.RPC.POSIXErrno;
import org.xtreemfs.foundation.pbrpc.generatedinterfaces.RPC.RPCHeader;
import org.xtreemfs.foundation.pbrpc.generatedinterfaces.RPC.RPCHeader.ErrorResponse;
import org.xtreemfs.foundation.pbrpc.utils.ErrorUtils;
import org.xtreemfs.foundation.pbrpc.utils.ReusableBufferInputStream;
import org.xtreemfs.foundation.util.OutputUtils;
import org.xtreemfs.osd.AdvisoryLock;
import org.xtreemfs.osd.OSDRequest;
import org.xtreemfs.osd.OSDRequestDispatcher;
import org.xtreemfs.osd.OpenFileTable;
import org.xtreemfs.osd.OpenFileTable.OpenFileTableEntry;
import org.xtreemfs.osd.operations.EventCloseFile;
import org.xtreemfs.osd.operations.EventCreateFileVersion;
import org.xtreemfs.osd.operations.OSDOperation;
import org.xtreemfs.osd.storage.CowPolicy;
import org.xtreemfs.osd.storage.CowPolicy.cowMode;
import org.xtreemfs.osd.storage.MetadataCache;
import org.xtreemfs.pbrpc.generatedinterfaces.GlobalTypes.SYSTEM_V_FCNTL;
import org.xtreemfs.pbrpc.generatedinterfaces.GlobalTypes.SnapConfig;
import org.xtreemfs.pbrpc.generatedinterfaces.OSD.Lock;
import org.xtreemfs.pbrpc.generatedinterfaces.OSDServiceConstants;
import com.google.protobuf.Message;
public class PreprocStage extends Stage {
public final static int STAGEOP_PARSE_AUTH_OFTOPEN = 1;
public final static int STAGEOP_OFT_DELETE = 2;
public final static int STAGEOP_ACQUIRE_LEASE = 3;
public final static int STAGEOP_RETURN_LEASE = 4;
public final static int STAGEOP_VERIFIY_CLEANUP = 5;
public final static int STAGEOP_ACQUIRE_LOCK = 10;
public final static int STAGEOP_CHECK_LOCK = 11;
public final static int STAGEOP_UNLOCK = 12;
public final static int STAGEOP_PING_FILE = 14;
public final static int STAGEOP_CLOSE_FILE = 15;
private final static long OFT_CLEAN_INTERVAL = 1000 * 60;
private final static long OFT_OPEN_EXTENSION = 1000 * 30;
private final Map<String, LRUCache<String, Capability>> capCache;
private final OpenFileTable oft;
// time left to next clean op
private long timeToNextOFTclean;
// last check of the OFT
private long lastOFTcheck;
private volatile long numRequests;
/**
* X-Location cache
*/
private final LRUCache<String, XLocations> xLocCache;
private final MetadataCache metadataCache;
private final OSDRequestDispatcher master;
private final boolean ignoreCaps;
private static final int MAX_CAP_CACHE = 20;
/** Creates a new instance of AuthenticationStage */
public PreprocStage(OSDRequestDispatcher master, MetadataCache metadataCache, int maxRequestsQueueLength) {
super("OSD PreProcSt", maxRequestsQueueLength);
capCache = new HashMap();
oft = new OpenFileTable();
xLocCache = new LRUCache<String, XLocations>(10000);
this.master = master;
this.metadataCache = metadataCache;
this.ignoreCaps = master.getConfig().isIgnoreCaps();
}
public void prepareRequest(OSDRequest request, ParseCompleteCallback listener) {
this.enqueueOperation(STAGEOP_PARSE_AUTH_OFTOPEN, new Object[] { request }, null, listener);
}
public static interface ParseCompleteCallback {
public void parseComplete(OSDRequest result, ErrorResponse error);
}
private void doPrepareRequest(StageRequest rq) {
final OSDRequest request = (OSDRequest) rq.getArgs()[0];
final ParseCompleteCallback callback = (ParseCompleteCallback) rq.getCallback();
numRequests++;
if (parseRequest(request) == false)
return;
if (request.getOperation().requiresCapability()) {
if (Logging.isDebug())
Logging.logMessage(Logging.LEVEL_DEBUG, Category.stage, this, "STAGEOP AUTH");
ErrorResponse err = processAuthenticate(request);
if (err != null) {
callback.parseComplete(request, err);
if (Logging.isDebug()) {
Logging.logMessage(Logging.LEVEL_DEBUG, Category.net, this,
"authentication of request failed: %s", ErrorUtils.formatError(err));
}
return;
}
}
String fileId = request.getFileId();
if (fileId != null) {
if (Logging.isDebug())
Logging.logMessage(Logging.LEVEL_DEBUG, Category.stage, this, "STAGEOP OPEN");
CowPolicy cowPolicy = CowPolicy.PolicyNoCow;
// check if snasphots are enabled and a write operation is executed;
// this is required to create new snapshots when files open for
// writing are closed, even if the same files are still open for
// reading
boolean write = request.getCapability() != null
&& request.getCapability().getSnapConfig() != SnapConfig.SNAP_CONFIG_SNAPS_DISABLED
&& ((SYSTEM_V_FCNTL.SYSTEM_V_FCNTL_H_O_RDWR.getNumber()
| SYSTEM_V_FCNTL.SYSTEM_V_FCNTL_H_O_TRUNC.getNumber() | SYSTEM_V_FCNTL.SYSTEM_V_FCNTL_H_O_WRONLY
.getNumber()) & request.getCapability().getAccessMode()) > 0;
if (oft.contains(fileId)) {
cowPolicy = oft.refresh(fileId, TimeSync.getLocalSystemTime() + OFT_OPEN_EXTENSION, write);
} else {
// find out which COW mode to use, depending on the capability
if (request.getCapability() == null
|| request.getCapability().getSnapConfig() == SnapConfig.SNAP_CONFIG_SNAPS_DISABLED)
cowPolicy = CowPolicy.PolicyNoCow;
else
cowPolicy = new CowPolicy(cowMode.COW_ONCE);
oft.openFile(fileId, TimeSync.getLocalSystemTime() + OFT_OPEN_EXTENSION, cowPolicy, write);
request.setFileOpen(true);
}
request.setCowPolicy(cowPolicy);
}
callback.parseComplete(request, null);
}
public void pingFile(String fileId) {
this.enqueueOperation(STAGEOP_PING_FILE, new Object[] { fileId }, null, null);
}
private void doPingFile(StageRequest m) {
final String fileId = (String) m.getArgs()[0];
// TODO: check if the file was opened for writing
oft.refresh(fileId, TimeSync.getLocalSystemTime() + OFT_OPEN_EXTENSION, false);
}
public void checkDeleteOnClose(String fileId, DeleteOnCloseCallback listener) {
this.enqueueOperation(STAGEOP_OFT_DELETE, new Object[] { fileId }, null, listener);
}
public static interface DeleteOnCloseCallback {
public void deleteOnCloseResult(boolean isDeleteOnClose, ErrorResponse error);
}
private void doCheckDeleteOnClose(StageRequest m) {
final String fileId = (String) m.getArgs()[0];
final DeleteOnCloseCallback callback = (DeleteOnCloseCallback) m.getCallback();
final boolean deleteOnClose = oft.contains(fileId);
if (deleteOnClose)
oft.setDeleteOnClose(fileId);
callback.deleteOnCloseResult(deleteOnClose, null);
}
public static interface LockOperationCompleteCallback {
public void parseComplete(Lock result, ErrorResponse error);
}
public void acquireLock(String clientUuid, int pid, String fileId, long offset, long length,
boolean exclusive, OSDRequest request, LockOperationCompleteCallback listener) {
this.enqueueOperation(STAGEOP_ACQUIRE_LOCK, new Object[] { clientUuid, pid, fileId, offset, length,
exclusive }, request, listener);
}
public void doAcquireLock(StageRequest m) {
final LockOperationCompleteCallback callback = (LockOperationCompleteCallback) m.getCallback();
try {
final String clientUuid = (String) m.getArgs()[0];
final Integer pid = (Integer) m.getArgs()[1];
final String fileId = (String) m.getArgs()[2];
final Long offset = (Long) m.getArgs()[3];
final Long length = (Long) m.getArgs()[4];
final Boolean exclusive = (Boolean) m.getArgs()[5];
OpenFileTableEntry e = oft.getEntry(fileId);
if (e == null) {
callback.parseComplete(null, ErrorUtils.getErrorResponse(ErrorType.INTERNAL_SERVER_ERROR, POSIXErrno.POSIX_ERROR_EIO, "no entry in OFT, programmatic error"));
return;
}
AdvisoryLock l = e.acquireLock(clientUuid, pid, offset, length, exclusive);
if (l != null) {
Lock lock = Lock.newBuilder().setClientPid(l.getClientPid()).setClientUuid(l.getClientUuid()).setLength(l.getLength()).setOffset(l.getOffset()).setExclusive(l.isExclusive()).build();
callback.parseComplete(lock, null);
}
else
callback.parseComplete(null, ErrorUtils.getErrorResponse(ErrorType.ERRNO, POSIXErrno.POSIX_ERROR_EAGAIN, "conflicting lock"));
} catch (Exception ex) {
callback.parseComplete(null, ErrorUtils.getInternalServerError(ex));
}
}
public void checkLock(String clientUuid, int pid, String fileId, long offset, long length,
boolean exclusive, OSDRequest request, LockOperationCompleteCallback listener) {
this.enqueueOperation(STAGEOP_CHECK_LOCK, new Object[] { clientUuid, pid, fileId, offset, length,
exclusive }, request, listener);
}
public void doCheckLock(StageRequest m) {
final LockOperationCompleteCallback callback = (LockOperationCompleteCallback) m.getCallback();
try {
final String clientUuid = (String) m.getArgs()[0];
final Integer pid = (Integer) m.getArgs()[1];
final String fileId = (String) m.getArgs()[2];
final Long offset = (Long) m.getArgs()[3];
final Long length = (Long) m.getArgs()[4];
final Boolean exclusive = (Boolean) m.getArgs()[5];
OpenFileTableEntry e = oft.getEntry(fileId);
if (e == null) {
callback.parseComplete(null, ErrorUtils.getErrorResponse(ErrorType.INTERNAL_SERVER_ERROR, POSIXErrno.POSIX_ERROR_EIO, "no entry in OFT, programmatic error"));
return;
}
AdvisoryLock l = e.checkLock(clientUuid, pid, offset, length, exclusive);
Lock lock = Lock.newBuilder().setClientPid(l.getClientPid()).setClientUuid(l.getClientUuid()).setLength(l.getLength()).setOffset(l.getOffset()).setExclusive(l.isExclusive()).build();
callback.parseComplete(lock, null);
} catch (Exception ex) {
callback.parseComplete(null, ErrorUtils.getInternalServerError(ex));
}
}
public void unlock(String clientUuid, int pid, String fileId, OSDRequest request,
LockOperationCompleteCallback listener) {
this.enqueueOperation(STAGEOP_UNLOCK, new Object[] { clientUuid, pid, fileId }, request, listener);
}
public void doUnlock(StageRequest m) {
final LockOperationCompleteCallback callback = (LockOperationCompleteCallback) m.getCallback();
try {
final String clientUuid = (String) m.getArgs()[0];
final Integer pid = (Integer) m.getArgs()[1];
final String fileId = (String) m.getArgs()[2];
OpenFileTableEntry e = oft.getEntry(fileId);
if (e == null) {
callback.parseComplete(null, ErrorUtils.getErrorResponse(ErrorType.INTERNAL_SERVER_ERROR, POSIXErrno.POSIX_ERROR_EIO, "no entry in OFT, programmatic error"));
return;
}
e.unlock(clientUuid, pid);
callback.parseComplete(null, null);
} catch (Exception ex) {
callback.parseComplete(null, ErrorUtils.getInternalServerError(ex));
}
}
/**
* Closing the file clears the capability cache and removes the entry for fileId from the {@link OpenFileTable} if
* it exists. <br>
* Attention: This will not trigger {@link EventCloseFile} or {@link EventCreateFileVersion} by itself.
* TODO(jdillmann): Discuss if this should trigger the event.
*
* @param fileId
* @param listener
*/
public void close(String fileId, CloseCallback listener) {
this.enqueueOperation(STAGEOP_CLOSE_FILE, new Object[] { fileId }, null, listener);
}
public static interface CloseCallback {
public void closeResult( OpenFileTableEntry entry, ErrorResponse error);
}
private void doClose(StageRequest m) {
final String fileId = (String) m.getArgs()[0];
final CloseCallback callback = (CloseCallback) m.getCallback();
OpenFileTableEntry entry = oft.close(fileId);
LRUCache<String, Capability> cachedCaps = capCache.remove(entry.getFileId());
callback.closeResult(entry, null);
}
@Override
public void run() {
notifyStarted();
// interval to check the OFT
timeToNextOFTclean = OFT_CLEAN_INTERVAL;
lastOFTcheck = TimeSync.getLocalSystemTime();
while (!quit) {
try {
final StageRequest op = q.poll(timeToNextOFTclean, TimeUnit.MILLISECONDS);
checkOpenFileTable(false);
if (op == null) {
// Logging.logMessage(Logging.LEVEL_DEBUG,this,"no request
// -- timer only");
continue;
}
processMethod(op);
} catch (InterruptedException ex) {
break;
} catch (Throwable ex) {
notifyCrashed(ex);
break;
}
}
notifyStopped();
}
/**
* Removes all open files from the {@link OpenFileTable} whose time has expired and triggers for each file
* the internal event {@link EventCloseFile} or {@link EventCreateFileVersion}.
*
* @param force
* If true, force the cleaning and do not respect the cleaning interval.
*/
private void checkOpenFileTable(boolean force) {
final long tPassed = TimeSync.getLocalSystemTime() - lastOFTcheck;
timeToNextOFTclean = timeToNextOFTclean - tPassed;
// Logging.logMessage(Logging.LEVEL_DEBUG,this,"time to next OFT:
// "+timeToNextOFTclean);
if (force || timeToNextOFTclean <= 0) {
if (Logging.isDebug())
Logging.logMessage(Logging.LEVEL_DEBUG, Category.proc, this, "OpenFileTable clean");
long currentTime = TimeSync.getLocalSystemTime();
// do OFT clean
List<OpenFileTableEntry> closedFiles = oft.clean(currentTime);
// Logging.logMessage(Logging.LEVEL_DEBUG,this,"closing
// "+closedFiles.size()+" files");
for (OpenFileTableEntry entry : closedFiles) {
if (Logging.isDebug())
Logging.logMessage(Logging.LEVEL_DEBUG, Category.stage, this,
"send internal close event for %s, deleteOnClose=%b", entry.getFileId(), entry
.isDeleteOnClose());
// Remove the cached capabilities.
capCache.remove(entry.getFileId());
// Send close event (creates a new file version if necessary).
OSDOperation closeEvent = master.getInternalEvent(EventCloseFile.class);
closeEvent.startInternalEvent(new Object[] { entry.getFileId(), entry.isDeleteOnClose(),
entry.getCowPolicy().cowEnabled(), entry.isWrite() });
}
// Check if written files need to be versioned (copied on write). If the file has been already closed it
// unnecessary to create another version because EventCloseFile already did.
List<OpenFileTableEntry> closedWrittenFiles = oft.cleanWritten(currentTime);
for (OpenFileTableEntry entry : closedWrittenFiles) {
if (!entry.isClosed() && entry.isWrite()) {
entry.clearWrite();
OSDOperation createVersionEvent = master.getInternalEvent(EventCreateFileVersion.class);
createVersionEvent.startInternalEvent(new Object[] { entry.getFileId(),
metadataCache.getFileInfo(entry.getFileId()) });
}
}
timeToNextOFTclean = OFT_CLEAN_INTERVAL;
}
lastOFTcheck = TimeSync.getLocalSystemTime();
}
@Override
protected void processMethod(StageRequest m) {
final int requestedMethod = m.getStageMethod();
switch (requestedMethod) {
case STAGEOP_PARSE_AUTH_OFTOPEN:
doPrepareRequest(m);
break;
case STAGEOP_OFT_DELETE:
doCheckDeleteOnClose(m);
break;
case STAGEOP_ACQUIRE_LOCK:
doAcquireLock(m);
break;
case STAGEOP_CHECK_LOCK:
doCheckLock(m);
break;
case STAGEOP_UNLOCK:
doUnlock(m);
break;
case STAGEOP_PING_FILE:
doPingFile(m);
break;
case STAGEOP_CLOSE_FILE:
doClose(m);
break;
default:
Logging.logMessage(Logging.LEVEL_ERROR, this, "unknown stageop called: %d", requestedMethod);
break;
}
}
private boolean parseRequest(OSDRequest rq) {
RPCHeader hdr = rq.getRpcRequest().getHeader();
if (hdr.getMessageType() != MessageType.RPC_REQUEST) {
rq.sendError(ErrorType.GARBAGE_ARGS, POSIXErrno.POSIX_ERROR_EIO, "expected RPC request message type but got "+hdr.getMessageType());
return false;
}
RPCHeader.RequestHeader rqHdr = hdr.getRequestHeader();
if (rqHdr.getInterfaceId() != OSDServiceConstants.INTERFACE_ID) {
rq.sendError(ErrorType.INVALID_INTERFACE_ID, POSIXErrno.POSIX_ERROR_EIO, "invalid interface id. Maybe wrong service address/port configured?");
if (Logging.isDebug()) {
Logging.logMessage(Logging.LEVEL_DEBUG, Category.net, this,
"invalid version requested (requested=%d avail=%d)", rqHdr.getInterfaceId(),
OSDServiceConstants.INTERFACE_ID);
}
return false;
}
// everything ok, find the right operation
OSDOperation op = master.getOperation(rqHdr.getProcId());
if (op == null) {
rq.sendError(ErrorType.INVALID_PROC_ID, POSIXErrno.POSIX_ERROR_EINVAL, "requested operation is not available on this OSD (proc # "
+ rqHdr.getProcId() + ")");
if (Logging.isDebug()) {
Logging.logMessage(Logging.LEVEL_DEBUG, Category.net, this,
"requested operation is not available on this OSD (proc #%d)", rqHdr.getProcId());
}
return false;
}
rq.setOperation(op);
try {
final Message rqPrototype = OSDServiceConstants.getRequestMessage(rqHdr.getProcId());
if (rqPrototype == null) {
rq.setRequestArgs(null);
if (Logging.isDebug())
Logging.logMessage(Logging.LEVEL_DEBUG, Category.net, this, "received request with empty message");
} else {
if (rq.getRPCRequest().getMessage() != null) {
rq.setRequestArgs(rqPrototype.newBuilderForType().mergeFrom(new ReusableBufferInputStream(rq.getRPCRequest().getMessage())).build());
if (Logging.isDebug()) {
Logging.logMessage(Logging.LEVEL_DEBUG, Category.net, this, "received request of type %s",
rq.getRequestArgs().getClass().getName());
}
} else {
rq.setRequestArgs(rqPrototype.getDefaultInstanceForType());
if (Logging.isDebug()) {
Logging.logMessage(Logging.LEVEL_DEBUG, Category.net, this, "received request of type %s (empty message)",
rq.getRequestArgs().getClass().getName());
}
}
}
ErrorResponse err = op.parseRPCMessage(rq);
if (err != null) {
rq.getRpcRequest().sendError(err);
return false;
}
} catch (Throwable ex) {
if (Logging.isDebug())
Logging.logMessage(Logging.LEVEL_DEBUG, Category.proc, this, OutputUtils
.stackTraceToString(ex));
rq.getRpcRequest().sendError(ErrorUtils.getInternalServerError(ex));
return false;
}
if (Logging.isDebug()) {
Logging.logMessage(Logging.LEVEL_DEBUG, Category.stage, this, "request parsed: %d", rq
.getRequestId());
}
return true;
}
private ErrorResponse processAuthenticate(OSDRequest rq) {
final Capability rqCap = rq.getCapability();
if (Logging.isDebug()) {
Logging.logMessage(Logging.LEVEL_DEBUG, this, "capability: %s", rqCap.getXCap().toString().replace('\n', '/'));
}
// check if the capability has valid arguments
if (rqCap.getFileId().length() == 0) {
return ErrorUtils.getErrorResponse(ErrorType.ERRNO, POSIXErrno.POSIX_ERROR_EINVAL, "invalid capability. file_id must not be empty");
}
if (rqCap.getEpochNo() < 0) {
return ErrorUtils.getErrorResponse(ErrorType.ERRNO, POSIXErrno.POSIX_ERROR_EINVAL, "invalid capability. epoch must not be < 0");
}
if (ignoreCaps)
return null;
// check if the capability is valid
boolean isValid = false;
// look in capCache
LRUCache<String, Capability> cachedCaps = capCache.get(rqCap.getFileId());
if (cachedCaps != null) {
final Capability cap = cachedCaps.get(rqCap.getSignature());
if (cap != null) {
if (Logging.isDebug()) {
Logging.logMessage(Logging.LEVEL_DEBUG, this, "using cached cap: %s %s", cap.getFileId(),
cap.getSignature());
}
isValid = !cap.hasExpired();
}
}
if (!isValid) {
isValid = rqCap.isValid();
if (isValid) {
// add to cache
if (cachedCaps == null) {
cachedCaps = new LRUCache<String, Capability>(MAX_CAP_CACHE);
capCache.put(rqCap.getFileId(), cachedCaps);
}
cachedCaps.put(rqCap.getSignature(), rqCap);
}
}
// depending on the result the event listener is sent
if (!isValid) {
if (rqCap.hasExpired())
return ErrorUtils.getErrorResponse(ErrorType.ERRNO, POSIXErrno.POSIX_ERROR_EACCES, "capability is not valid (timed out)");
if (!rqCap.hasValidSignature())
return ErrorUtils.getErrorResponse(ErrorType.ERRNO, POSIXErrno.POSIX_ERROR_EACCES, "capability is not valid (invalid signature)");
return ErrorUtils.getErrorResponse(ErrorType.ERRNO, POSIXErrno.POSIX_ERROR_EACCES, "capability is not valid (unknown cause)");
}
// check if the capability was issued for the requested file
if (!rqCap.getFileId().equals(rq.getFileId())) {
return ErrorUtils.getErrorResponse(ErrorType.ERRNO, POSIXErrno.POSIX_ERROR_EACCES, "capability was issued for another file than the one requested");
}
// check if the capability provides sufficient access rights for
// requested operation
if (rq.getOperation().getProcedureId() == OSDServiceConstants.PROC_ID_READ) {
if ((rqCap.getAccessMode() & (SYSTEM_V_FCNTL.SYSTEM_V_FCNTL_H_O_WRONLY.getNumber())) != 0)
return ErrorUtils.getErrorResponse(ErrorType.ERRNO, POSIXErrno.POSIX_ERROR_EACCES,
"capability does not allow read access to file " + rqCap.getFileId());
} else if (rq.getOperation().getProcedureId() == OSDServiceConstants.PROC_ID_WRITE) {
if ((rqCap.getAccessMode() & (SYSTEM_V_FCNTL.SYSTEM_V_FCNTL_H_O_CREAT.getNumber()
| SYSTEM_V_FCNTL.SYSTEM_V_FCNTL_H_O_WRONLY.getNumber() | SYSTEM_V_FCNTL.SYSTEM_V_FCNTL_H_O_RDWR
.getNumber())) == 0)
return ErrorUtils.getErrorResponse(ErrorType.ERRNO, POSIXErrno.POSIX_ERROR_EACCES,
"capability does not allow write access to file " + rqCap.getFileId());
} else if (rq.getOperation().getProcedureId() == OSDServiceConstants.PROC_ID_TRUNCATE) {
if ((rqCap.getAccessMode() & SYSTEM_V_FCNTL.SYSTEM_V_FCNTL_H_O_TRUNC.getNumber()) == 0)
return ErrorUtils.getErrorResponse(ErrorType.ERRNO, POSIXErrno.POSIX_ERROR_EACCES,
"capability does not allow truncate access to file " + rqCap.getFileId());
} else if (rq.getOperation().getProcedureId() == OSDServiceConstants.PROC_ID_UNLINK) {
// TODO: replace numeric flag with constant
if ((rqCap.getAccessMode() & 010000000) == 0)
return ErrorUtils.getErrorResponse(ErrorType.ERRNO, POSIXErrno.POSIX_ERROR_EACCES,
"capability does not allow delete access to file " + rqCap.getFileId());
}
return null;
}
public int getNumOpenFiles() {
return oft.getNumOpenFiles();
}
public long getNumRequests() {
return numRequests;
}
}
|
package LeetCode;
import java.util.HashSet;
import java.util.Set;
public class CommonChar {
public static void main(String[] args) {
String s="bella";
String s1="bella";
String [] s2=s.split(" ");
char[] c = s.toCharArray();
char[] c1 = s1.toCharArray();
Set set = new HashSet();
for (int i = 0; i < c.length; i++) {
for (int j = 0; i < c1.length; j++) {
if (c[i] == c1[j]) {
set.add(c[i]);
break;
}
}
}
System.out.println(set);
}
}
|
import java.util.*;
public class AncientFormula{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String E = sc.nextLine();
int answer=0;
for(int i=0;i<E.length();i++){
if(E.charAt(i)=='<')answer+=10;
if(E.charAt(i)=='/')answer++;
}
System.out.println(answer);
}
}
|
package com.suyun.vehicle.processor;
import com.suyun.common.kafka.JsonSerializer;
import com.suyun.vehicle.VehiclePartsCodes;
import com.suyun.vehicle.model.VehicleData;
import org.apache.kafka.common.serialization.Serde;
import org.apache.kafka.common.serialization.Serdes;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.apache.kafka.common.serialization.StringSerializer;
import org.apache.kafka.streams.KeyValue;
import org.apache.kafka.streams.kstream.KStream;
import org.apache.kafka.streams.kstream.KStreamBuilder;
import org.apache.kafka.streams.kstream.TimeWindows;
import org.apache.kafka.streams.kstream.Windowed;
import org.apache.kafka.streams.kstream.internals.WindowedDeserializer;
import org.apache.kafka.streams.kstream.internals.WindowedSerializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 统计处理器
*
* Created by IT on 2017/5/4.
*/
public class StatisticsProcessor extends VehicleDataProcessor {
private final static Logger LOGGER = LoggerFactory.getLogger(StatisticsProcessor.class);
private final static String TOPIC = "stat_minute";
private final static long WINDOW_SIZE = 1 * 60 * 1000l; // 1 min
private final static String STAT_STORE = "vehicle_stat_store";
StringSerializer stringSerializer = new StringSerializer();
StringDeserializer stringDeserializer = new StringDeserializer();
Serde<String> stringSerde = Serdes.serdeFrom(stringSerializer,stringDeserializer);
WindowedSerializer<String> windowedSerializer = new WindowedSerializer<>(stringSerializer);
WindowedDeserializer<String> windowedDeserializer = new WindowedDeserializer<>(stringDeserializer);
Serde<Windowed<String>> windowedSerde = Serdes.serdeFrom(windowedSerializer,windowedDeserializer);
@SuppressWarnings("unchecked")
@Override
public void process(KStream<String, byte[]> stream, KStreamBuilder builder) {
// 统计多个值.
stream
.flatMap((key, value) -> {
List<VehicleData> vehicleDatas = deserialize(value);
Stream<KeyValue<String, Double>> keyValueStream = vehicleDatas.stream()
.filter(v ->
Arrays.stream(interestCodes()).anyMatch(code ->
code.equals(v.getMetricCode())))
.map(v -> new KeyValue(v.getVehicleId() + ":" + v.getMetricCode(), v.getValue()));
return keyValueStream.collect(Collectors.toList());
})
.groupByKey(stringSerde, Serdes.Double())
.aggregate(
() -> 0.0,
(key, value, aggregate) -> {
LOGGER.info("[statics processor] agg: " + aggregate);
return (value + aggregate);
},
TimeWindows.of(WINDOW_SIZE), // tumbling windows
Serdes.Double(),
STAT_STORE
)
.mapValues(JsonSerializer::serialize)
.to(windowedSerde, Serdes.ByteArray(), TOPIC);
// DEBUG
// .map((key, value) -> {
// LOGGER.info("[StatisticsProcessor]" + key + ": " + value);
// return new KeyValue<>(key, JsonSerializer.serialize(value));
// })
// .to(stringSerde, Serdes.ByteArray(), TOPIC);
/*
// 只统计单个值.
stream
.filter((key, value) -> {
LOGGER.info("[StatisticsProcessor] ");
List<VehicleData> vehicleDatas = deserialize(value);
Optional<VehicleData> socData = getSocData(vehicleDatas);
return socData.isPresent();
})
.map((key, value) -> {
List<VehicleData> vehicleDatas = deserialize(value);
VehicleData socData = getSocData(vehicleDatas).get();
LOGGER.info("[StatisticsProcessor] receive: soc:" + socData.getValue());
return new KeyValue<>(socData.getVehicleId(), socData.getValue());
})
.groupByKey(stringSerde, Serdes.Double())
.aggregate(
() -> 0.0,
(key, value, aggregate) -> {
LOGGER.info("[statics processor] agg: " + aggregate);
return (value + aggregate);
},
TimeWindows.of(WINDOW_SIZE), // tumbling windows
Serdes.Double(),
STAT_STORE
)
.mapValues(value -> {
LOGGER.info("[StatisticsProcessor] deserilize " + value);
return JsonSerializer.serialize(value);
})
.to(windowedSerde, Serdes.ByteArray(), TOPIC);
*/
}
private Optional<VehicleData> getSocData(List<VehicleData> vehicleDataList) {
return findByCodes(vehicleDataList, VehiclePartsCodes.GB_VEH_SOC, VehiclePartsCodes.BMS_SOC);
}
private String[] interestCodes() {
return new String[] {
VehiclePartsCodes.BMS_SOC,
VehiclePartsCodes.GB_VEH_SOC,
VehiclePartsCodes.BUS_TOTAL_MILEAGE,
VehiclePartsCodes.GB_VEH_TOTAL_MILEAGE
};
}
}
|
package com.mastercom.ps.connector.examples.tests;
import java.util.AbstractMap;
import java.util.HashMap;
import java.util.Map;
import com.mastercom.ps.connector.response.domain.casefiling.FileAttachment;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.converters.Converter;
import com.thoughtworks.xstream.converters.MarshallingContext;
import com.thoughtworks.xstream.converters.UnmarshallingContext;
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
public class MapToXMLTest {
public static final String alias = "Alias";
public static void main(String[] args) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", "chris");
map.put("island", "faranga");
XStream magicApi = new XStream();
// // clear out existing permissions and set own ones
// xstream.addPermission(NoTypePermission.NONE);
// // allow some basics
// xstream.addPermission(NullPermission.NULL);
// xstream.addPermission(PrimitiveTypePermission.PRIMITIVES);
// xstream.allowTypeHierarchy(Collection.class);
// // allow any type from the same package
////
// xstream.allowTypesByWildcard(new String[] { "com.mastercom.ps.connector.**" });
XStream.setupDefaultSecurity(magicApi);
magicApi.registerConverter((Converter) new MapEntryConverter());
magicApi.alias(alias, Map.class);
String xml = magicApi.toXML(map);
System.out.println("Result of tweaked XStream toXml()");
System.out.println(xml);
@SuppressWarnings("unchecked")
Map<String, String> extractedMap = (Map<String, String>) magicApi.fromXML(xml);
assert extractedMap.get("name").equals("chris");
assert extractedMap.get("island").equals("faranga");
// List<String> order = new ArrayList<>();
// adds the same cd twice (two references to the same object)
FileAttachment fileAttachment = new FileAttachment();
// order.add(fileAttachment);
XStream xstream = new XStream();
xstream.alias(FileAttachment.class.getSimpleName(), FileAttachment.class);
System.out.println(xstream.toXML(fileAttachment));
}
public static class MapEntryConverter implements Converter {
@SuppressWarnings("rawtypes")
@Override
public boolean canConvert(Class type) {
return AbstractMap.class.isAssignableFrom(type);
}
@SuppressWarnings("unchecked")
@Override
public void marshal(Object value, HierarchicalStreamWriter writer, MarshallingContext context) {
AbstractMap<String, Object> map = (AbstractMap<String, Object>) value;
for (Object obj : map.entrySet()) {
Map.Entry<String, Object> entry = (Map.Entry<String, Object>) obj;
writer.startNode(entry.getKey().toString());
Object val = entry.getValue();
if (null != val) {
writer.setValue(val.toString());
}
writer.endNode();
}
}
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
Map<String, String> map = new HashMap<String, String>();
while (reader.hasMoreChildren()) {
reader.moveDown();
String key = reader.getNodeName(); // nodeName aka element's name
String value = reader.getValue();
map.put(key, value);
reader.moveUp();
}
return map;
}
}
}
|
package com.epam.talentland.balance.util;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
public class Util {
public static String getNowDateYYYmmDD() {
Date myDate = new Date();
return new SimpleDateFormat("yyyy-MM-dd").format(myDate);
}
public static String getNowDateYYYmmDDMonthaddSub(int month) {
Calendar cal = Calendar.getInstance();
cal.setTimeZone(TimeZone.getTimeZone("GMT"));
cal.add(Calendar.MONTH, month);
return "" + cal.get(Calendar.YEAR) +"-" +
String.format("%02d",(cal.get(Calendar.MONTH)+1)) + "-" + String.format("%02d", cal.get(Calendar.DATE));
}
}
|
package com.smxknife.graphql.ex2.domain;
import java.util.List;
public class User {
private int id;
private String account;
private String password;
private List<Role> roles;
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public List<Role> getRoles() {
return roles;
}
public void setRoles(List<Role> roles) {
this.roles = roles;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}
|
package Parser;
import Game.Player;
public class PickCommand implements VerbCommand{
@Override
public String exec(Player player,String[] input) {
if (input.length<=1)
return "You can't pick that ";
else
return player.pick(input[1]);
}
}
|
package org.mybatis.jpetstore.domain;
import java.io.Serializable;
import java.math.BigDecimal;
public class Calculate implements Serializable {
public void hello()
{
System.out.println("JPET Store Application");
System.out.println("Class name: Calculate.java");
System.out.println("Hello World");
System.out.println("Making a new Entry at Mon Jun 12 11:00:08 UTC 2017");
System.out.println("Mon Jun 12 11:00:08 UTC 2017");
System.out.println("Making a new Entry at Sat Jun 10 11:00:01 UTC 2017");
System.out.println("Sat Jun 10 11:00:01 UTC 2017");
System.out.println("Making a new Entry at Thu Jun 8 11:00:35 UTC 2017");
System.out.println("Thu Jun 8 11:00:35 UTC 2017");
System.out.println("Making a new Entry at Tue Jun 6 11:00:13 UTC 2017");
System.out.println("Tue Jun 6 11:00:13 UTC 2017");
System.out.println("Making a new Entry at Sun Jun 4 11:00:46 UTC 2017");
System.out.println("Sun Jun 4 11:00:46 UTC 2017");
System.out.println("Making a new Entry at Fri Jun 2 11:00:19 UTC 2017");
System.out.println("Fri Jun 2 11:00:19 UTC 2017");
System.out.println("Making a new Entry at Tue May 30 11:00:28 UTC 2017");
System.out.println("Tue May 30 11:00:28 UTC 2017");
System.out.println("Making a new Entry at Sun May 28 11:00:43 UTC 2017");
System.out.println("Sun May 28 11:00:43 UTC 2017");
System.out.println("Making a new Entry at Fri May 26 11:00:21 UTC 2017");
System.out.println("Fri May 26 11:00:21 UTC 2017");
System.out.println("Making a new Entry at Wed May 24 11:00:02 UTC 2017");
System.out.println("Wed May 24 11:00:02 UTC 2017");
System.out.println("Making a new Entry at Mon May 22 11:00:35 UTC 2017");
System.out.println("Mon May 22 11:00:35 UTC 2017");
System.out.println("Making a new Entry at Sat May 20 11:00:07 UTC 2017");
System.out.println("Sat May 20 11:00:07 UTC 2017");
System.out.println("Making a new Entry at Thu May 18 11:00:40 UTC 2017");
System.out.println("Thu May 18 11:00:40 UTC 2017");
System.out.println("Making a new Entry at Tue May 16 11:00:13 UTC 2017");
System.out.println("Tue May 16 11:00:13 UTC 2017");
System.out.println("Making a new Entry at Sun May 14 11:00:02 UTC 2017");
System.out.println("Sun May 14 11:00:02 UTC 2017");
System.out.println("Making a new Entry at Fri May 12 11:00:48 UTC 2017");
System.out.println("Fri May 12 11:00:48 UTC 2017");
System.out.println("Making a new Entry at Wed May 10 11:00:57 UTC 2017");
System.out.println("Wed May 10 11:00:57 UTC 2017");
System.out.println("Making a new Entry at Mon May 8 11:00:25 UTC 2017");
System.out.println("Mon May 8 11:00:25 UTC 2017");
System.out.println("Making a new Entry at Mon May 8 07:49:35 UTC 2017");
System.out.println("Mon May 8 07:49:35 UTC 2017");
System.out.println("Making a new Entry at Mon May 8 07:44:40 UTC 2017");
System.out.println("Mon May 8 07:44:40 UTC 2017");
System.out.println("Making a new Entry at Sat May 6 11:00:19 UTC 2017");
System.out.println("Sat May 6 11:00:19 UTC 2017");
System.out.println("Making a new Entry at Thu May 4 11:00:04 UTC 2017");
System.out.println("Thu May 4 11:00:04 UTC 2017");
System.out.println("Making a new Entry at Tue May 2 11:00:37 UTC 2017");
System.out.println("Tue May 2 11:00:37 UTC 2017");
System.out.println("Making a new Entry at Sun Apr 30 11:00:10 UTC 2017");
System.out.println("Sun Apr 30 11:00:10 UTC 2017");
System.out.println("Making a new Entry at Fri Apr 28 11:00:19 UTC 2017");
System.out.println("Fri Apr 28 11:00:19 UTC 2017");
System.out.println("Making a new Entry at Wed Apr 26 11:00:52 UTC 2017");
System.out.println("Wed Apr 26 11:00:52 UTC 2017");
System.out.println("Making a new Entry at Thu Apr 20 11:00:52 UTC 2017");
System.out.println("Thu Apr 20 11:00:52 UTC 2017");
System.out.println("Making a new Entry at Tue Apr 18 11:00:36 UTC 2017");
System.out.println("Tue Apr 18 11:00:36 UTC 2017");
System.out.println("Making a new Entry at Sun Apr 16 11:00:39 UTC 2017");
System.out.println("Sun Apr 16 11:00:39 UTC 2017");
System.out.println("Making a new Entry at Fri Apr 14 11:00:25 UTC 2017");
System.out.println("Fri Apr 14 11:00:25 UTC 2017");
System.out.println("Making a new Entry at Wed Apr 12 11:00:22 UTC 2017");
System.out.println("Wed Apr 12 11:00:22 UTC 2017");
System.out.println("Making a new Entry at Mon Apr 10 11:00:38 UTC 2017");
System.out.println("Mon Apr 10 11:00:38 UTC 2017");
System.out.println("Making a new Entry at Mon Apr 10 09:56:35 UTC 2017");
System.out.println("Mon Apr 10 09:56:35 UTC 2017");
System.out.println("Making a new Entry at Mon Apr 10 09:55:32 UTC 2017");
System.out.println("Mon Apr 10 09:55:32 UTC 2017");
System.out.println("Making a new Entry at Mon Apr 10 09:55:04 UTC 2017");
System.out.println("Mon Apr 10 09:55:04 UTC 2017");
System.out.println("Making a new Entry at Mon Apr 10 09:39:32 UTC 2017");
System.out.println("Mon Apr 10 09:39:32 UTC 2017");
System.out.println("Making a new Entry at Mon Apr 10 09:38:52 UTC 2017");
System.out.println("Mon Apr 10 09:38:52 UTC 2017");
System.out.println("Making a new Entry at Mon Apr 10 09:38:24 UTC 2017");
System.out.println("Mon Apr 10 09:38:24 UTC 2017");
System.out.println("Making a new Entry at Mon Apr 10 09:36:01 UTC 2017");
System.out.println("Mon Apr 10 09:36:01 UTC 2017");
System.out.println("Making a new Entry at Mon Apr 10 09:34:55 UTC 2017");
System.out.println("Mon Apr 10 09:34:55 UTC 2017");
System.out.println("Making a new Entry at Mon Apr 10 09:31:13 UTC 2017");
System.out.println("Mon Apr 10 09:31:13 UTC 2017");
System.out.println("Making a new Entry at Mon Apr 10 09:30:30 UTC 2017");
System.out.println("Mon Apr 10 09:30:30 UTC 2017");
System.out.println("Making a new Entry at Mon Apr 10 09:29:05 UTC 2017");
System.out.println("Mon Apr 10 09:29:05 UTC 2017");
System.out.println("Making a new Entry at Mon Apr 10 09:24:21 UTC 2017");
System.out.println("Mon Apr 10 09:24:21 UTC 2017");
System.out.println("Making a new Entry at Mon Apr 10 09:24:04 UTC 2017");
System.out.println("Mon Apr 10 09:24:04 UTC 2017");
System.out.println("Making a new Entry at Mon Apr 10 09:22:26 UTC 2017");
System.out.println("Mon Apr 10 09:22:26 UTC 2017");
System.out.println("Making a new Entry at Mon Apr 10 09:18:38 UTC 2017");
System.out.println("Mon Apr 10 09:18:38 UTC 2017");
System.out.println("Making a new Entry at Mon Apr 10 09:17:03 UTC 2017");
System.out.println("Mon Apr 10 09:17:03 UTC 2017");
System.out.println("Making a new Entry at Thu Mar 2 11:00:00 UTC 2017");
System.out.println("Thu Mar 2 11:00:00 UTC 2017");
System.out.println("Making a new Entry at Tue Feb 28 11:00:00 UTC 2017");
System.out.println("Tue Feb 28 11:00:00 UTC 2017");
System.out.println("Making a new Entry at Sun Feb 26 11:00:00 UTC 2017");
System.out.println("Sun Feb 26 11:00:00 UTC 2017");
System.out.println("Making a new Entry at Fri Feb 24 11:00:00 UTC 2017");
System.out.println("Fri Feb 24 11:00:00 UTC 2017");
System.out.println("Making a new Entry at Wed Feb 22 11:00:00 UTC 2017");
System.out.println("Wed Feb 22 11:00:00 UTC 2017");
System.out.println("Making a new Entry at Mon Feb 20 11:00:00 UTC 2017");
System.out.println("Mon Feb 20 11:00:00 UTC 2017");
System.out.println("Making a new Entry at Sat Feb 18 11:00:00 UTC 2017");
System.out.println("Sat Feb 18 11:00:00 UTC 2017");
System.out.println("Making a new Entry at Thu Feb 16 11:00:00 UTC 2017");
System.out.println("Thu Feb 16 11:00:00 UTC 2017");
System.out.println("Making a new Entry at Tue Feb 14 11:00:00 UTC 2017");
System.out.println("Tue Feb 14 11:00:00 UTC 2017");
System.out.println("Making a new Entry at Sun Feb 12 11:00:00 UTC 2017");
System.out.println("Sun Feb 12 11:00:00 UTC 2017");
System.out.println("Making a new Entry at Fri Feb 10 11:00:00 UTC 2017");
System.out.println("Fri Feb 10 11:00:00 UTC 2017");
System.out.println("Making a new Entry at Wed Feb 8 11:00:00 UTC 2017");
System.out.println("Wed Feb 8 11:00:00 UTC 2017");
System.out.println("Making a new Entry at Mon Feb 6 11:00:00 UTC 2017");
System.out.println("Mon Feb 6 11:00:00 UTC 2017");
System.out.println("Making a new Entry at Sat Feb 4 11:00:00 UTC 2017");
System.out.println("Sat Feb 4 11:00:00 UTC 2017");
System.out.println("Making a new Entry at Thu Feb 2 11:00:00 UTC 2017");
System.out.println("Thu Feb 2 11:00:00 UTC 2017");
System.out.println("Making a new Entry at Mon Jan 30 11:00:00 UTC 2017");
System.out.println("Mon Jan 30 11:00:00 UTC 2017");
System.out.println("Making a new Entry at Sat Jan 28 11:00:15 UTC 2017");
System.out.println("Sat Jan 28 11:00:15 UTC 2017");
System.out.println("Making a new Entry at Thu Jan 26 11:00:15 UTC 2017");
System.out.println("Thu Jan 26 11:00:15 UTC 2017");
System.out.println("Making a new Entry at Tue Jan 24 11:00:15 UTC 2017");
System.out.println("Tue Jan 24 11:00:15 UTC 2017");
System.out.println("Making a new Entry at Sun Jan 22 11:00:15 UTC 2017");
System.out.println("Sun Jan 22 11:00:15 UTC 2017");
System.out.println("Making a new Entry at Fri Jan 20 11:00:15 UTC 2017");
System.out.println("Fri Jan 20 11:00:15 UTC 2017");
System.out.println("Making a new Entry at Wed Jan 18 11:00:15 UTC 2017");
System.out.println("Wed Jan 18 11:00:15 UTC 2017");
System.out.println("Making a new Entry at Mon Jan 16 11:00:15 UTC 2017");
System.out.println("Mon Jan 16 11:00:15 UTC 2017");
System.out.println("Making a new Entry at Sat Jan 14 11:00:15 UTC 2017");
System.out.println("Sat Jan 14 11:00:15 UTC 2017");
System.out.println("Making a new Entry at Thu Jan 12 11:00:15 UTC 2017");
System.out.println("Thu Jan 12 11:00:15 UTC 2017");
System.out.println("Making a new Entry at Tue Jan 10 11:00:15 UTC 2017");
System.out.println("Tue Jan 10 11:00:15 UTC 2017");
System.out.println("Making a new Entry at Sun Jan 8 11:00:15 UTC 2017");
System.out.println("Sun Jan 8 11:00:15 UTC 2017");
System.out.println("Making a new Entry at Fri Jan 6 11:00:15 UTC 2017");
System.out.println("Fri Jan 6 11:00:15 UTC 2017");
System.out.println("Making a new Entry at Wed Jan 4 11:00:15 UTC 2017");
System.out.println("Wed Jan 4 11:00:15 UTC 2017");
System.out.println("Making a new Entry at Mon Jan 2 11:00:15 UTC 2017");
System.out.println("Mon Jan 2 11:00:15 UTC 2017");
System.out.println("Making a new Entry at Fri Dec 30 11:00:16 UTC 2016");
System.out.println("Fri Dec 30 11:00:16 UTC 2016");
System.out.println("Making a new Entry at Wed Dec 28 11:00:16 UTC 2016");
System.out.println("Wed Dec 28 11:00:16 UTC 2016");
System.out.println("Making a new Entry at Mon Dec 26 11:00:16 UTC 2016");
System.out.println("Mon Dec 26 11:00:16 UTC 2016");
System.out.println("Making a new Entry at Sat Dec 24 11:00:16 UTC 2016");
System.out.println("Sat Dec 24 11:00:16 UTC 2016");
System.out.println("Making a new Entry at Thu Dec 22 11:00:16 UTC 2016");
System.out.println("Thu Dec 22 11:00:16 UTC 2016");
System.out.println("Making a new Entry at Tue Dec 20 11:00:16 UTC 2016");
System.out.println("Tue Dec 20 11:00:16 UTC 2016");
System.out.println("Making a new Entry at Sun Dec 18 11:00:16 UTC 2016");
System.out.println("Sun Dec 18 11:00:16 UTC 2016");
System.out.println("Making a new Entry at Fri Dec 16 11:00:16 UTC 2016");
System.out.println("Fri Dec 16 11:00:16 UTC 2016");
System.out.println("Making a new Entry at Wed Dec 14 11:00:16 UTC 2016");
System.out.println("Wed Dec 14 11:00:16 UTC 2016");
System.out.println("Making a new Entry at Mon Dec 12 11:00:16 UTC 2016");
System.out.println("Mon Dec 12 11:00:16 UTC 2016");
System.out.println("Making a new Entry at Sat Dec 10 11:00:16 UTC 2016");
System.out.println("Sat Dec 10 11:00:16 UTC 2016");
System.out.println("Making a new Entry at Thu Dec 8 11:00:16 UTC 2016");
System.out.println("Thu Dec 8 11:00:16 UTC 2016");
System.out.println("Making a new Entry at Tue Dec 6 11:00:16 UTC 2016");
System.out.println("Tue Dec 6 11:00:16 UTC 2016");
System.out.println("Making a new Entry at Fri Dec 2 12:52:58 UTC 2016");
System.out.println("Fri Dec 2 12:52:58 UTC 2016");
}
}
//----------------------------------------------------
//Comment added on date:Fri Dec 2 09:45:31 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//Comment added on date:Fri Dec 2 09:55:14 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Fri Dec 2 11:34:52 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Fri Dec 2 11:35:25 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Fri Dec 2 12:32:47 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Mon Dec 5 05:39:41 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Mon Dec 5 05:41:08 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Mon Dec 5 05:41:14 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Mon Dec 5 06:05:33 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Mon Dec 5 11:00:16 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Wed Dec 7 05:08:34 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Wed Dec 7 11:00:16 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Fri Dec 9 11:00:16 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Sun Dec 11 11:00:16 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Tue Dec 13 11:00:16 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Thu Dec 15 11:00:16 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Sat Dec 17 11:00:16 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Mon Dec 19 11:00:16 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Wed Dec 21 11:00:16 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Fri Dec 23 11:00:16 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Sun Dec 25 11:00:16 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Tue Dec 27 11:00:16 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Thu Dec 29 11:00:16 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Sat Dec 31 11:00:16 UTC 2016
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Sun Jan 1 11:00:15 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Tue Jan 3 11:00:15 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Thu Jan 5 11:00:15 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Sat Jan 7 11:00:15 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Mon Jan 9 11:00:15 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Wed Jan 11 11:00:15 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Fri Jan 13 11:00:15 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Sun Jan 15 11:00:15 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Tue Jan 17 11:00:15 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Thu Jan 19 11:00:15 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Sat Jan 21 11:00:15 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Mon Jan 23 11:00:15 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Wed Jan 25 11:00:15 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Fri Jan 27 11:00:15 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Sun Jan 29 11:00:15 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Tue Jan 31 11:00:00 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Wed Feb 1 11:00:00 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Fri Feb 3 11:00:00 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Sun Feb 5 11:00:00 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Tue Feb 7 11:00:00 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Thu Feb 9 11:00:00 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Sat Feb 11 11:00:00 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Mon Feb 13 11:00:00 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Wed Feb 15 11:00:00 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Fri Feb 17 11:00:00 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Sun Feb 19 11:00:00 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Tue Feb 21 11:00:00 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Thu Feb 23 11:00:00 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Sat Feb 25 11:00:00 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Mon Feb 27 11:00:00 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Wed Mar 1 11:00:00 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Tue Apr 11 06:09:20 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Tue Apr 11 06:09:28 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Tue Apr 11 06:09:34 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Tue Apr 11 06:12:12 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Tue Apr 11 06:15:00 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Tue Apr 11 11:00:55 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Thu Apr 13 11:00:41 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Sat Apr 15 11:00:05 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Mon Apr 17 11:00:08 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Wed Apr 19 11:00:53 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Fri Apr 21 11:00:36 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Sun Apr 23 11:00:00 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Tue Apr 25 11:00:09 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Thu Apr 27 11:00:36 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Sat Apr 29 11:00:26 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Mon May 1 11:00:54 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Wed May 3 11:00:21 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Fri May 5 11:00:36 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Sun May 7 11:00:49 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Tue May 9 11:00:15 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Thu May 11 11:00:17 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Sat May 13 11:00:19 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Mon May 15 11:00:46 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Wed May 17 11:00:56 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Fri May 19 11:00:23 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Sun May 21 11:00:50 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Tue May 23 11:00:17 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Thu May 25 11:00:44 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Sat May 27 11:01:00 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Mon May 29 11:00:27 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Wed May 31 11:00:52 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Thu Jun 1 11:00:35 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Sat Jun 3 11:00:02 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Mon Jun 5 11:00:29 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Wed Jun 7 11:00:57 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Fri Jun 9 11:00:19 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
//----------------------------------------------------
//Comment added on date:Sun Jun 11 11:00:51 UTC 2017
//Author: Andrew Woods, Apoorva Rao
//Description: Adding coments for documentation
//Project: JpetStore
//Tools used: Jenkins, SonarQube, Rundeck
//----------------------------------------------------
|
package bbdd;
public class HQL {
public static String FIND_CLIENTE_BY_ID = "from Clientes c where c.id = '";
public static String FIND_CLIENTE_BY_NAME = "from Clientes c where c.nombre = '";
public static String FIND_CLIENTE_LIKE_NAME = "from Clientes c where c.nombre like '";
public static String AND_APELLIDO = " and c.apellido1 like '";
public static String FIND_CLIENTE_BY_PHONE = "from Clientes c where c.telefono = '";
public static String OR_MOVIL = " or c.movil = '";
public static String FIND_LISTA_CLIENTES = "from Clientes order by Apellido1";
public static String FIND_HISTORICOS_BY_ID = "from Historicos h where h.id = ";
public static String FIND_LISTA_CUMPLEANYOS = "from Clientes c where c.fechaNacimiento like '";
public static String FIND_LISTA_EMAILS = "from Clientes c where c.email is not null";
}
|
/*
* [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.solrfacetsearch.integration;
import de.hybris.platform.impex.jalo.ImpExException;
import de.hybris.platform.servicelayer.ServicelayerTest;
import de.hybris.platform.servicelayer.config.ConfigurationService;
import de.hybris.platform.solrfacetsearch.config.FacetSearchConfig;
import de.hybris.platform.solrfacetsearch.config.FacetSearchConfigService;
import de.hybris.platform.solrfacetsearch.config.IndexedType;
import de.hybris.platform.solrfacetsearch.config.exceptions.FacetConfigServiceException;
import de.hybris.platform.solrfacetsearch.daos.SolrFacetSearchConfigDao;
import de.hybris.platform.solrfacetsearch.enums.SolrServerModes;
import de.hybris.platform.solrfacetsearch.indexer.impl.DefaultIndexerServiceIntegrationTest;
import de.hybris.platform.solrfacetsearch.model.SolrIndexModel;
import de.hybris.platform.solrfacetsearch.model.config.SolrFacetSearchConfigModel;
import de.hybris.platform.solrfacetsearch.model.config.SolrIndexedTypeModel;
import de.hybris.platform.solrfacetsearch.solr.Index;
import de.hybris.platform.solrfacetsearch.solr.SolrClientPool;
import de.hybris.platform.solrfacetsearch.solr.SolrIndexService;
import de.hybris.platform.solrfacetsearch.solr.SolrSearchProvider;
import de.hybris.platform.solrfacetsearch.solr.SolrSearchProviderFactory;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.text.StrSubstitutor;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.rules.ExpectedException;
public abstract class AbstractIntegrationTest extends ServicelayerTest
{
protected static final String DEFAULT_ENCODING = "UTF-8";
protected static final String SOLR_SERVER_MODE = "solrfacetsearch.test.server.mode";
protected static final String SOLR_SERVER_STANDALONE_ENDPOINT = "solrfacetsearch.test.server.standalone.endpoint";
protected static final String SOLR_SERVER_CLOUD_ENDPOINT = "solrfacetsearch.test.server.cloud.endpoint";
protected static final String HW_CATALOG = "hwcatalog";
protected static final String ONLINE_CATALOG_VERSION = "Online";
protected static final String STAGED_CATALOG_VERSION = "Staged";
protected static final String PRODUCT_CODE = "HW1100-0024";
protected static final String FACET_SEARCH_CONFIG_NAME = "testFacetSearchConfig";
private String testId;
private String solrServerEndpoint;
private String solrServerMode;
@Resource
private ConfigurationService configurationService;
@Resource
private FacetSearchConfigService facetSearchConfigService;
@Resource
private SolrFacetSearchConfigDao solrFacetSearchConfigDao;
@Resource
private SolrIndexService solrIndexService;
@Resource
private SolrSearchProviderFactory solrSearchProviderFactory;
@Resource
private SolrClientPool solrClientPool;
private FacetSearchConfig facetSearchConfig;
private SolrFacetSearchConfigModel solrFacetSearchConfigModel;
private SolrIndexedTypeModel indexedTypeModel;
@Rule
public ExpectedException expectedException = ExpectedException.none();
protected String getProductCode()
{
return PRODUCT_CODE;
}
@Before
public void setUp() throws Exception
{
testId = Long.toString(Thread.currentThread().getId()) + System.currentTimeMillis();
solrServerMode = configurationService.getConfiguration().getString(SOLR_SERVER_MODE);
if (SolrServerModes.CLOUD.getCode().equals(solrServerMode))
{
solrServerEndpoint = configurationService.getConfiguration().getString(SOLR_SERVER_CLOUD_ENDPOINT);
}
else
{
solrServerEndpoint = configurationService.getConfiguration().getString(SOLR_SERVER_STANDALONE_ENDPOINT);
}
beforeLoadData();
createCoreData();
importCsv("/test/solrBasics.csv", DEFAULT_ENCODING);
importCsv("/test/solrHwcatalogStaged.csv", DEFAULT_ENCODING);
importCsv("/test/solrHwcatalogOnline.csv", DEFAULT_ENCODING);
importConfig("/test/solrConfigBase.csv");
loadData();
}
@After
public void tearDown() throws Exception
{
final FacetSearchConfig facetSearchConfig = getFacetSearchConfig();
for (final IndexedType indexedType : facetSearchConfig.getIndexConfig().getIndexedTypes().values())
{
final List<SolrIndexModel> indexes = solrIndexService.getIndexesForConfigAndType(facetSearchConfig.getName(),
indexedType.getIdentifier());
for (final SolrIndexModel index : indexes)
{
final SolrSearchProvider solrSearchProvider = solrSearchProviderFactory.getSearchProvider(facetSearchConfig,
indexedType);
final Index solrIndex = solrSearchProvider.resolveIndex(facetSearchConfig, indexedType, index.getQualifier());
solrSearchProvider.deleteIndex(solrIndex);
solrIndexService.deleteIndex(facetSearchConfig.getName(), indexedType.getIdentifier(), index.getQualifier());
}
}
solrClientPool.invalidateAll();
}
protected void beforeLoadData() throws Exception
{
// Do nothing by default
}
protected void loadData() throws Exception
{
// Do nothing by default
}
protected String getFacetSearchConfigName()
{
return FACET_SEARCH_CONFIG_NAME + testId;
}
protected FacetSearchConfig getFacetSearchConfig() throws FacetConfigServiceException
{
if (facetSearchConfig == null)
{
facetSearchConfig = facetSearchConfigService.getConfiguration(getFacetSearchConfigName());
}
return facetSearchConfig;
}
protected void importConfig(final String resource) throws IOException, ImpExException
{
importConfig(resource, Collections.emptyMap());
}
protected void importConfig(final String resource, final Map<String, String> params) throws IOException, ImpExException
{
final InputStream inputStream = DefaultIndexerServiceIntegrationTest.class.getResourceAsStream(resource);
String impexContent = IOUtils.toString(inputStream, DEFAULT_ENCODING);
final Map<String, String> impexParams = new HashMap<String, String>();
impexParams.put("testId", testId);
impexParams.put("solrServerMode", solrServerMode);
impexParams.put("solrServerEndpoint", solrServerEndpoint);
impexParams.putAll(params);
final StrSubstitutor substitutor = new StrSubstitutor(impexParams);
impexContent = substitutor.replace(impexContent);
final InputStream newInputStream = IOUtils.toInputStream(impexContent, DEFAULT_ENCODING);
importStream(newInputStream, DEFAULT_ENCODING, resource);
}
protected String readFile(final String pathName) throws IOException
{
final InputStream inputStream = AbstractIntegrationTest.class.getResourceAsStream(pathName);
final BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
final StringBuffer buffer = new StringBuffer();
String line = "";
while ((line = reader.readLine()) != null)
{
buffer.append(line);
}
return buffer.toString();
}
protected void initializeIndexedType()
{
if (indexedTypeModel == null)
{
solrFacetSearchConfigModel = solrFacetSearchConfigDao.findFacetSearchConfigByName(getFacetSearchConfigName());
indexedTypeModel = solrFacetSearchConfigModel.getSolrIndexedTypes().get(0);
}
}
public SolrIndexedTypeModel getIndexedTypeModel()
{
initializeIndexedType();
return indexedTypeModel;
}
public SolrFacetSearchConfigModel getSolrFacetSearchConfigModel()
{
return solrFacetSearchConfigModel;
}
public String getTestId()
{
return testId;
}
}
|
import java.util.ArrayList;
public class Espanyola extends Baralla {
String[] pals= {"espases","bastos","ors","copes"};
String[] noms= {"1","2","3","4","5","6","7","SOTA","CAVALL","REI"};
@Override
public void reiniciar() {
if (cartes!=null) {
cartes.clear();
} else {
cartes= new ArrayList <Carta>();
}
for (int i=0;i<pals.length;i++) {
for (int j=0;j<noms.length;j++) {
cartes.add(new Carta(pals[i],noms[j],j<7?j+1:10));
}
}
}
public Espanyola() {
super();
reiniciar();
}
}
|
package mypackage;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
public class HelloTest {
@Test
public void testDoGet() throws Exception {
// this is a fake test
assertTrue(true);
}
}
|
package com.model;
public abstract class Account {
protected int accountNumber;
protected String ownerFirstName;
protected String ownerLastName;
protected boolean underAudit;
protected double amountOfMoney;
public int getAccountNumber() {
return accountNumber;
}
public void setAccountNumber(int accouuntNumber) {
this.accountNumber = accouuntNumber;
}
public String getOwnerFirstName() {
return ownerFirstName;
}
public void setOwnerFirstName(String ownerFirstName) {
this.ownerFirstName = ownerFirstName;
}
public String getOwnerLastName() {
return ownerLastName;
}
public void setOwnerLastName(String ownerLastName) {
this.ownerLastName = ownerLastName;
}
public boolean isUnderAudit() {
return underAudit;
}
public void setUnderAudit(boolean underAudit) {
this.underAudit = underAudit;
}
public double getAmountOfMoney() {
return amountOfMoney;
}
public void setAmountOfMoney(double amountOfMoney) {
this.amountOfMoney = amountOfMoney;
}
public void depositMoney(Double amountToDeposit){
this.amountOfMoney += amountToDeposit;
}
public void withdrawMoney(Double amountToWithdraw){
if(amountOfMoney < amountToWithdraw)
System.out.println("Insufficient funds for that withdrawal");
else
this.amountOfMoney -= amountToWithdraw;
}
public void transferFunds(Account to, Account from, double amountToTransfer) {}
}
|
package com.example.healthmanage.bean.network.response;
import java.io.Serializable;
public class BaseResponse<T> implements Serializable {
private Object requestId;
private Object errorLog;
private int status;
private String message;
private T data;
public Object getRequestId() {
return requestId;
}
public void setRequestId(Object requestId) {
this.requestId = requestId;
}
public Object getErrorLog() {
return errorLog;
}
public void setErrorLog(Object errorLog) {
this.errorLog = errorLog;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
}
|
import java.util.Scanner;
public class TossOPCalculator {
/**
* @param args
*/
public static void main(String[] args) {
int zBase;
int pBase;
System.out.println("Zerg:");
System.out.println("How many bases are you on?");
Scanner keyboard = new Scanner(System.in);
zBase = keyboard.nextInt();
if (zBase > 10)
{
System.out.println("You MIGHT be able to win!");
}
else
{
System.out.println("Yeah GG bro");
}
System.out.println("Toss too imba, riot nurf");
}
}
|
package com.example.patrick.rccar;
import android.bluetooth.BluetoothSocket;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageButton;
import java.io.IOException;
import java.io.OutputStream;
public class RCCar extends AppCompatActivity {
// UUID MY_UUID = UUID.fromString("94f39d29-7d6d-437d-973b-fba39e49d4ee");
// BluetoothDevice mmDevice = null;
BluetoothSocket mmSocket = null;
OutputStream mmOutputStream;
//BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
// Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
// private static final String TAG = "RCCar";
private ImageButton button;
private Button live;
private Button rec;
private ImageButton btn_info;
private Button btn_connect;
bluetoothconnection bt = bluetoothconnection.getInstance(this);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//ToolBar Transparent
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
final class WorkerThread implements Runnable{
private String btMsg;
public WorkerThread(String msg)
{
btMsg = msg;
}
public void run(){
try {
sendBtMsg(btMsg);
} catch (IOException e) {
e.printStackTrace();
}
}
}
button =(ImageButton) findViewById(R.id.imageButtonSetting);
button.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
openSettings();
}
});
live =(Button) findViewById(R.id.livebutton);
live.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
openLive();
}
});
rec =(Button) findViewById(R.id.recbutton);
rec.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
openRec();
}
});
btn_info = (ImageButton) findViewById(R.id.info);
btn_info.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//(new Thread(new WorkerThread("starteskript"))).start();
Intent i = new Intent(getApplicationContext(), InfoActivity.class);
startActivity(i);
overridePendingTransition(R.anim.fade_in3, R.anim.fade_out);
}
});
btn_connect = (Button) findViewById(R.id.connect);
btn_connect.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v)
{
bt.onClick();
}
});
}
public void sendBtMsg(String msg2send) throws IOException {
mmSocket = bt.mmSocket;
String msg = msg2send;
mmOutputStream = mmSocket.getOutputStream();
mmOutputStream.write(msg.getBytes());
}
public void openSettings() {
Intent intent = new Intent(this, settings.class);
startActivity(intent);
overridePendingTransition(R.anim.fade_in3, R.anim.fade_out);
}
public void openLive() {
Intent intent = new Intent(this, live.class);
startActivity(intent);
overridePendingTransition(R.anim.fade_in3, R.anim.fade_out);
}
public void openRec() {
Intent intent = new Intent(this, Recording.class);
startActivity(intent);
overridePendingTransition(R.anim.fade_in3, R.anim.fade_out);
}
}
|
package com.cs4125.bookingapp.model.entities;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class Discount {
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private Integer discountId;
private String code;
private String validUsers;
private double discountPercent;
public Discount(){}
public Discount(String code, String transportTypes, double discountPercent) {
this.code = code;
this.validUsers = transportTypes;
this.discountPercent = discountPercent;
}
public Integer getDiscountId() {
return discountId;
}
public void setDiscountId(Integer discountId) {
this.discountId = discountId;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getValidUsers() {
return validUsers;
}
public void setValidUsers(String validUsers) {
this.validUsers = validUsers;
}
public double getDiscountPercent() {
return discountPercent;
}
public void setDiscountPercent(double discountPercent) {
this.discountPercent = discountPercent;
}
@Override
public String toString() {
return "Discount{" +
"discountId=" + discountId +
", code=" + code +
", validUsers=" + validUsers +
", discountPercent=" + discountPercent +
'}';
}
}
|
package com.facebook.react.modules.timepicker;
import android.app.Dialog;
import android.app.TimePickerDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.f;
public class SupportTimePickerDialogFragment extends f {
private DialogInterface.OnDismissListener mOnDismissListener;
private TimePickerDialog.OnTimeSetListener mOnTimeSetListener;
public Dialog onCreateDialog(Bundle paramBundle) {
return TimePickerDialogFragment.createDialog(getArguments(), (Context)getActivity(), this.mOnTimeSetListener);
}
public void onDismiss(DialogInterface paramDialogInterface) {
super.onDismiss(paramDialogInterface);
DialogInterface.OnDismissListener onDismissListener = this.mOnDismissListener;
if (onDismissListener != null)
onDismissListener.onDismiss(paramDialogInterface);
}
public void setOnDismissListener(DialogInterface.OnDismissListener paramOnDismissListener) {
this.mOnDismissListener = paramOnDismissListener;
}
public void setOnTimeSetListener(TimePickerDialog.OnTimeSetListener paramOnTimeSetListener) {
this.mOnTimeSetListener = paramOnTimeSetListener;
}
}
/* Location: C:\Users\august\Desktop\tik\df_rn_kit\classes.jar.jar!\com\facebook\react\modules\timepicker\SupportTimePickerDialogFragment.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 1.1.3
*/
|
import static java.lang.StrictMath.sqrt;
public class Triangle extends Figure implements Print {
static boolean inputText;
private double a,b,c;
Triangle(double a, double b, double c){
try {
if (a <= 0 || b <= 0 || c <= 0)
throw new NumberFormatException("side length must to be a positive number");
else {
this.a = a;
this.b = b;
this.c = c;
}
}
catch (NumberFormatException e)
{
System.out.println("error"+e);
}
}
double calculatePerimeter(){
return a+b+c;
}
double calculateArea(){
double p = calculatePerimeter();
p=p/2;
double Area=0;
try{
if((p-c)==0)
throw new ArithmeticException("sections of the given length do not form a triangle");
else
{
Area=sqrt((p*(p-a)*(p-b)*(p-c)));
}
}
catch (ArithmeticException e) {
System.out.println("error " + e);
}
return (Area);
}
@Override
public void print() {
System.out.println("Triangle:");
System.out.println("Perimeter: " +calculatePerimeter());
System.out.println("Area: " +calculateArea());
}
}
|
package interfaces;
public interface GameServer {
}
|
import java.util.function.Function;
import java.util.function.Predicate;
public class Task2
{
public static <T, E> Function<T, E> ternaryOperator
(Predicate < ? super T > condition, //// input predicate and functions
Function < ? super T, ? extends E > ifTrue,
Function < ? super T, ? extends E > ifFalse)
{
return t -> condition.test(t) ? ifTrue.apply(t) : ifFalse.apply(t); //// verification and execution of condition
}
}
|
package sample.loadWorkBase;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.sqlite.JDBC;
import java.io.FileInputStream;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.prefs.Preferences;
public class LoadWorksBase {
private Preferences user = Preferences.userRoot();
public void load(){
try {
Class.forName("org.sqlite.JDBC");
String path = user.get("pathToDB","");
String URL = "jdbc:sqlite:"+ path;
Connection conn = DriverManager.getConnection(URL);
Statement st = conn.createStatement();
XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream("C:\\Users\\DAPer\\IdeaProjects\\Estimates\\src\\main\\java\\sample\\loadWorkBase\\input.xlsx"));
XSSFSheet sheet = workbook.getSheet("Смета");
for(int i=1;i<479;i++){
Row row = sheet.getRow(i-1);
String N = row.getCell(0).getStringCellValue();
String work = row.getCell(1).getStringCellValue();
String unit = row.getCell(2).getStringCellValue();
st.executeUpdate("INSERT INTO main.WORKS(N,WORK_NAME, DEF_PRICE, UNIT) VALUES('"+N+"', '"+work+"', 0.0, '"+unit+"')");
}
workbook.close();
} catch (IOException | SQLException | ClassNotFoundException e) {
e.printStackTrace();
}
}
}
|
package uk.gov.companieshouse.api.testdata.model.entity;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
import java.time.Instant;
@Document(collection = "company_psc_statements")
public class CompanyPscStatement {
@Id
@Field("id")
private String id;
@Field("updated.at")
private Instant updatedAt;
@Field("company_number")
private String companyNumber;
@Field("psc_statement_id")
private String pscStatementId;
@Field("data.links")
private Links links;
@Field("data.notified_on")
private Instant notifiedOn;
@Field("data.etag")
private String etag;
@Field("data.kind")
private String kind;
@Field("data.statement")
private String statement;
@Field("created.at")
private Instant createdAt;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Instant getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Instant updatedAt) {
this.updatedAt = updatedAt;
}
public String getCompanyNumber() {
return companyNumber;
}
public void setCompanyNumber(String companyNumber) {
this.companyNumber = companyNumber;
}
public String getPscStatementId() {
return pscStatementId;
}
public void setPscStatementId(String pscStatementId) {
this.pscStatementId = pscStatementId;
}
public Links getLinks() {
return links;
}
public void setLinks(Links links) {
this.links = links;
}
public Instant getNotifiedOn() {
return notifiedOn;
}
public void setNotifiedOn(Instant notifiedOn) {
this.notifiedOn = notifiedOn;
}
public String getEtag() {
return etag;
}
public void setEtag(String etag) {
this.etag = etag;
}
public String getKind() {
return kind;
}
public void setKind(String kind) {
this.kind = kind;
}
public String getStatement() {
return statement;
}
public void setStatement(String statement) {
this.statement = statement;
}
public Instant getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Instant createdAt) {
this.createdAt = createdAt;
}
}
|
package Manufacturing.Ingredient.ConcreteIngredient;
import Manufacturing.Ingredient.BaseIngredient;
/**
* 黄桃罐头原材料
*
* @author 孟繁霖
* @date 2021/10/25 14:04
*/
public class Peach extends BaseIngredient {
public Peach() {
this.setName(
"黄桃",
"黃桃",
"Peach"
);
setCost(6.3);
}
}
|
package org.training.issuetracker.services.spring;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.training.issuetracker.dao.entities.Priority;
import org.training.issuetracker.dao.interfaces.PriorityDAO;
import org.training.issuetracker.services.PriorityService;
@Service("priorityService")
@Repository
@Transactional
public class SpringPriorityService implements PriorityService{
@Autowired
private PriorityDAO priorityDAO;
public void setPriorityDAO(PriorityDAO priorityDAO) {
this.priorityDAO = priorityDAO;
}
@Transactional
@Override
public List<Priority> getPriorities() {
return priorityDAO.getPriorities();
}
@Transactional
@Override
public Priority getPriorityById(int priorityId) {
return priorityDAO.getPriorityById(priorityId);
}
@Transactional
@Override
public boolean createPriority(Priority priority) {
return priorityDAO.createPriority(priority);
}
@Transactional
@Override
public boolean updatePriority(Priority priority) {
return priorityDAO.updatePriority(priority);
}
@Transactional
@Override
public boolean deletePriority(int priorityId) {
return priorityDAO.deletePriority(priorityId);
}
}
|
package com.kunsoftware.controller.manager;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.kunsoftware.bean.ProductIntroduceRequestBean;
import com.kunsoftware.bean.JsonBean;
import com.kunsoftware.controller.BaseController;
import com.kunsoftware.entity.Product;
import com.kunsoftware.entity.ProductIntroduce;
import com.kunsoftware.exception.KunSoftwareException;
import com.kunsoftware.service.ProductIntroduceService;
import com.kunsoftware.service.ProductService;
@Controller
@RequestMapping("/manager/productintroduce")
public class ProductIntroduceController extends BaseController {
private static Logger logger = LoggerFactory.getLogger(ProductIntroduceController.class);
@Autowired
private ProductIntroduceService service;
@Autowired
private ProductService productService;
@RequestMapping("/list")
public String listProductIntroduce(ModelMap model,Integer productId) throws KunSoftwareException {
logger.info("产品介绍列表");
Product product = productService.selectByPrimaryKey(productId);
List<ProductIntroduce> list = service.getProductIntroduceListAll(productId);
model.addAttribute("retList", list);
model.addAttribute("product", product);
return "manager/productintroduce/productintroduce-list";
}
@RequestMapping("/add")
public String addProductIntroduce(ModelMap model) throws KunSoftwareException {
logger.info("添加产品介绍");
return "manager/productintroduce/productintroduce-add";
}
@RequestMapping(value="/add.json")
@ResponseBody
public JsonBean addProductIntroduce(ProductIntroduceRequestBean requestBean) throws KunSoftwareException {
logger.info("保存产品介绍");
ProductIntroduce entity = service.insert(requestBean);
JsonBean jsonBean = new JsonBean();
jsonBean.put("id", entity.getId());
jsonBean.setMessage("操作成功");
return jsonBean;
}
@RequestMapping("/edit")
public String editProductIntroduce(ModelMap model,Integer id) throws KunSoftwareException {
logger.info("编辑产品介绍");
ProductIntroduce entity = service.selectByPrimaryKey(id);
model.addAttribute("entity", entity);
return "manager/productintroduce/productintroduce-edit";
}
@RequestMapping(value="/edit.json")
@ResponseBody
public JsonBean editProductIntroduce(ProductIntroduceRequestBean requestBean,Integer id) throws KunSoftwareException {
logger.info("编辑保存产品介绍");
service.updateByPrimaryKey(requestBean,id);
JsonBean jsonBean = new JsonBean();
jsonBean.setMessage("操作成功");
return jsonBean;
}
@RequestMapping(value="/del.json")
@ResponseBody
public JsonBean delProductIntroduce(Integer[] id) throws KunSoftwareException {
logger.info("删除产品介绍");
service.deleteByPrimaryKey(id);
JsonBean jsonBean = new JsonBean();
jsonBean.setMessage("操作成功");
return jsonBean;
}
}
|
package os.optionstrategypayout;
import os.optionstrategypayout.model.OptionLeg;
public class ExecutionClass {
private static final String CALL_OPTION = "call";
private static final String PUT_OPTION = "put";
private static final String SELL = "s";
private static final String BUY = "b";
public static void main(String[] args) {
OptionLeg legOne = new OptionLeg();
legOne.setAction("s");
legOne.setOptionPremium(43);
legOne.setOptionStrike(25300);
legOne.setOptionType("put");
OptionLeg legTwo = new OptionLeg();
legTwo.setAction("b");
legTwo.setOptionPremium(25);
legTwo.setOptionStrike(25400);
legTwo.setOptionType("put");
OptionLeg legThree = new OptionLeg();
legThree.setAction("b");
legThree.setOptionPremium(28);
legThree.setOptionStrike(25800);
legThree.setOptionType("call");
OptionLeg legFour = new OptionLeg();
legFour.setAction("s");
legFour.setOptionPremium(52);
legFour.setOptionStrike(25700);
legFour.setOptionType("call");
double currentPrice = 25600.00;
ExecutionClass es = new ExecutionClass();
double legOneValue = es.getOptionNetValue(legOne, currentPrice);
double legTwoValue = es.getOptionNetValue(legTwo, currentPrice);
double legThreeValue = es.getOptionNetValue(legThree, currentPrice);
double legFourValue = es.getOptionNetValue(legFour, currentPrice);
double payout = 0.0;
System.out.println("LEG ONE VALUE: " + legOneValue);
System.out.println("LEG TWO VALUE: " + legTwoValue);
System.out.println("LEG THREE VALUE: " + legThreeValue);
System.out.println("LEG FOUR VALUE: " + legFourValue);
System.out.println("Strategy Payout: " + (payout + legOneValue + legTwoValue + legThreeValue + legFourValue));
}
private double getOptionNetValue(OptionLeg optionLeg, double underlyingPrice) {
String action = optionLeg.getAction();
String optionType = optionLeg.getOptionType();
int optionStrike = optionLeg.getOptionStrike();
double optionPremium = optionLeg.getOptionPremium();
double optionNetValue = 0.0;
if (CALL_OPTION.equals(optionType) && BUY.equals(action)) {
optionNetValue = Math.max(0, underlyingPrice - optionStrike) - optionPremium;
} else if (PUT_OPTION.equals(optionType) && BUY.equalsIgnoreCase(action)) {
optionNetValue = Math.max(0, optionStrike - underlyingPrice) - optionPremium;
} else if (CALL_OPTION.equals(optionType) && SELL.equals(action)) {
optionNetValue = Math.min(0, optionStrike - underlyingPrice) + optionPremium;
} else if (PUT_OPTION.equals(optionType) && SELL.equals(action)) {
optionNetValue = Math.min(0, underlyingPrice - optionStrike) + optionPremium;
}
return optionNetValue;
}
}
|
package com.gsonkeno.hot.kafka;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.clients.producer.RecordMetadata;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
/**
* Created by gaosong on 2017-05-13.
*/
public class KafkaClient {
private String bootStrapServer;
private Producer<String,String> producer;
private ConsumerFactory factory = new ConsumerFactory();
public void sendMessage(ProducerRecordWrapper recordWrapper) throws ExecutionException, InterruptedException {
Future<RecordMetadata> send = producer.send(recordWrapper.getRecord());
producer.close();
}
/**
* 消费主题
* @param topicName 消费主题
* @param groupId 组id
* @param partitions 消费分组
* @param handler 消息处理器
* @param isBlock 此方法是否阻塞
* @throws InterruptedException
*/
public void consumeMessage(String topicName, String groupId,int[] partitions, IMessageHandler handler,boolean isBlock) throws InterruptedException {
String key = topicName + "-" + groupId;
if (factory.getConsumerBulk().containsKey(key)) return;
ConsumerRunner consumerRunner = new ConsumerRunner(bootStrapServer, groupId,topicName,partitions,handler);
new Thread(consumerRunner).start();
factory.getConsumerBulk().put(key,consumerRunner);
if (isBlock) new CountDownLatch(1).await();
}
/**
* 移除消费者
* @param topicName 消费主题
* @param groupId 消费组id
*/
public void removeConsumer(String topicName, String groupId){
factory.removeConsumer(topicName,groupId);
}
public KafkaClient(String bootstrapServer){
this.bootStrapServer = bootstrapServer;
ProducerConfig producerConfig = new ProducerConfig(bootstrapServer);
this.producer = new KafkaProducer<String, String>(producerConfig.getProps());
}
}
|
import java.util.List;
import java.util.ArrayList;
public class Player {
private String name;
private int rank = 1;
private int dollars = 0;
private int credits = 0;
private Set location;
private int practiceTokens = 0;
private Role currentRole;
private GameSystem game;
private boolean hasMoved = false;
public Player(String name)
{
this.name = name;
}
public int getRank()
{
return rank;
}
public int getDollars()
{
return dollars;
}
public int getCredits()
{
return credits;
}
public Set getSet()
{
return location;
}
public void setRank(int r)
{
rank = r;
}
public boolean hasRole()
{
return currentRole != null;
}
public Role getRole()
{
return currentRole;
}
public void setGame(GameSystem game)
{
this.game = game;
}
public boolean getMoved()
{
return hasMoved;
}
public void setMoved(boolean b)
{
hasMoved = b;
}
public void addDollars(int amount)
{
dollars += amount;
}
public void takeDollars(int amount)
{
dollars -= amount;
}
public void addCredits(int amount)
{
credits += amount;
}
public void takeCredits(int amount)
{
credits -= amount;
}
public void givePracticeTokens()
{
practiceTokens += 1;
}
public int getPracticeTokens()
{
return practiceTokens;
}
public void removePracticeTokens()
{
practiceTokens = 0;
}
public void changeSet(Set newLocation)
{
location = newLocation;
}
public String getName()
{
return name;
}
public void changeRole(Role newRole)
{
currentRole = newRole;
}
public void leaveRole()
{
currentRole = null;
}
public List<Action> availableActions()
{
int[] dollarsForUpgrade = {4, 10, 18, 28, 40};
int[] creditsForUpgrade = {5, 10, 15, 20, 25};
ArrayList<Action> result = new ArrayList<>();
// Act preconditions:
// player currently has a role
// player has not yet acted or rehearsed
// (acting or rehearsing automatically ends the turn, so we don't need to check for this)
if(hasRole()) {
result.add( new Act(this) );
}
// rehearse preconditions:
// player is currently in a role
// practiceTokens + rank < budget (because further rehearsals would be useless)
// player has not yet acted or rehearsed
// (acting or rehearsing automatically ends the turn, so we don't need to check for this)
if(currentRole != null &&
practiceTokens < location.getScene().getBudget()-1) {
result.add( new Rehearse(this) );
}
// TakeRole preconditions:
// player's current rank >= requested role's rank
// player's current set contains the requested role
// player is not currently in a role
// role is not currently taken
for(Role r : location.getRoles()) {
if(rank >= r.getRank() && !r.isTaken() && !hasRole()) {
result.add( new TakeRole(this, r) );
}
}
// move preconditions:
// player has not yet moved on their turn
// player is not in a role
if(currentRole == null && !hasMoved) {
for(Set s : location.getNeighbors()) {
result.add( new Move(this, s) );
}
}
// upgrade preconditions:
// player is in casting office
// player rank < 6
// player can afford to upgrade
if(location == game.getBoard().getCastingOffice()) {
for(int upgradeRank = rank; upgradeRank < 6; upgradeRank++) {
if(credits > creditsForUpgrade[upgradeRank-1]) {
result.add( new Upgrade(this, upgradeRank+1, creditsForUpgrade[upgradeRank-1], true) );
}
if(dollars > dollarsForUpgrade[upgradeRank-1]) {
result.add( new Upgrade(this, upgradeRank+1, dollarsForUpgrade[upgradeRank-1], false) );
}
}
}
// EndTurn preconditions:
// cannot end turn if both in a role, and you've not acted or rehearsed yet.
// (acting or rehearsing automatically ends the turn, so we don't need to check for this)
if( !(hasRole()) ) {
result.add( new EndTurn(this) );
}
// at this point, all actions available to the given player should be in the array list.
return result;
}
public int getScore()
{
return dollars + credits + (rank * 5);
}
public GameSystem getGame()
{
return game;
}
}
|
package com.kodilla.patterns.builder.bigmac;
public enum IngredientType {
LETTUCE("Lettuce"),
ONION("Onion"),
BACON("Bacon"),
PICKLE("Pickle"),
CHILLI("Chilli"),
MUSHROOMS("Mushrooms"),
SHRIMPS("Shrimps"),
CHEESE("Cheese");
private final String description;
IngredientType(String ingredient) {
this.description = ingredient;
}
public String getDescription() {
return description;
}
}
|
package ch2.sub2.applefilter;
public class Apple {
private Color color;
private int wight;
public Apple(Color color, int wight) {
this.color = color;
this.wight = wight;
}
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
public int getWight() {
return wight;
}
public void setWight(int wight) {
this.wight = wight;
}
@Override
public String toString() {
return "Apple{" +
"color=" + color +
", wight=" + wight +
'}';
}
}
|
package net.createk.pdftool;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class ClientList {
protected List<Client> clientList = null;
protected File listFile = null;
public ClientList(ClientList other) {
this(other.listFile);
}
public ClientList(File listFile) {
clientList = new ArrayList<Client>();
this.listFile = listFile;
try {
parse();
} catch (IOException e) {
e.printStackTrace();
}
}
public void parse() throws IOException {
if (listFile != null) {
if (!listFile.exists()) {
System.out.println("List file does not exist.");
}
InputStream in = new FileInputStream(listFile);
XSSFWorkbook workbook = new XSSFWorkbook(in);
XSSFSheet master = workbook.getSheetAt(0);
XSSFRow titleRow = master.getRow(master.getFirstRowNum());
for (int row = master.getFirstRowNum() + 1; row < master
.getLastRowNum(); row++) {
String shortName = "";
String clientName = "";
String reportName = "";
Date netAssetsDate = null;
double netAssetsUSD = 0.0;
String investmentGroup = "";
boolean managedExternalAccounts = false;
int modifier = 0;
String riskCapacity = "";
for (int cell = master.getRow(row).getFirstCellNum(); cell < master
.getRow(row).getLastCellNum(); cell++) {
String cellVal = titleRow.getCell(cell)
.getStringCellValue().trim().replace("\n", "").replace("\r", "");
if (cellVal.equalsIgnoreCase("shortname")) {
shortName = master.getRow(row).getCell(cell)
.getStringCellValue().trim();
} else if (cellVal.equalsIgnoreCase("name")) {
clientName = master.getRow(row).getCell(cell)
.getStringCellValue().trim();
} else if (cellVal.equalsIgnoreCase("client report name")) {
reportName = master.getRow(row).getCell(cell)
.getStringCellValue().trim();
} else if (cellVal.equalsIgnoreCase("net assets date")) {
netAssetsDate = HSSFDateUtil.getJavaDate(master.getRow(row).getCell(cell).getNumericCellValue());
} else if (cellVal.equalsIgnoreCase("net assets usd")) {
netAssetsUSD = master.getRow(row)
.getCell(cell).getNumericCellValue();
} else if (cellVal.equalsIgnoreCase("investment group")) {
investmentGroup = master.getRow(row).getCell(cell)
.getStringCellValue().trim();
} else if (cellVal
.equalsIgnoreCase("managed external accounts?")
&& master.getRow(row).getCell(cell)
.getStringCellValue().trim()
.equalsIgnoreCase("yes")) {
managedExternalAccounts = true;
} else if (cellVal.equalsIgnoreCase("modifier")) {
modifier = (int)(master.getRow(row).getCell(cell).getNumericCellValue());
} else if (cellVal.equalsIgnoreCase("risk capacity") || cellVal.equalsIgnoreCase("risk group")) {
riskCapacity = master.getRow(row).getCell(cell).getStringCellValue().trim();
}
}
clientList.add(new Client(shortName, clientName, reportName, netAssetsDate, netAssetsUSD, investmentGroup, managedExternalAccounts, modifier, riskCapacity));
}
in.close();
}
}
public Client getClientByShortName(String shortName) {
for (Client client : clientList) {
if (client.shortName.equals(shortName))
return client;
}
return null;
}
public Client getClientByClientName(String clientName) {
for (Client client : clientList) {
if (client.clientName.equals(clientName))
return client;
}
return null;
}
public Client getClientByReportName(String reportName) {
for (Client client : clientList) {
if (client.reportName.equals(reportName))
return client;
}
return null;
}
public void createMasterSheet(XSSFSheet sheet) {
XSSFRow titleRow = sheet.createRow(sheet.getFirstRowNum());
boolean doneTitle = false;
for (Client c : clientList) {
XSSFRow row = sheet.createRow(sheet.getLastRowNum() + 1);
c.writeColumns(row);
if (c.account != null) {
if (c.account.failed) {
row.createCell(3).setCellValue("Failed");
} else {
if (!doneTitle) {
c.writeTitles(titleRow);
c.account.writeTitles(titleRow);
doneTitle = true;
}
c.account.writeColumns(row);
}
}
}
for (int a = 0; a < titleRow.getLastCellNum(); a++)
sheet.autoSizeColumn(a);
}
public void loadClientAccounts(List<Account> accounts) {
for (Account ac : accounts) {
for (Client c : clientList) {
if (c.reportName.equalsIgnoreCase(ac.reportName)) {
c.account = ac;
ac.owner = c;
}
}
}
}
}
|
package com.lqs.hrm;
import static org.hamcrest.CoreMatchers.nullValue;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class TestList {
public static void main(String[] args) {
List<Integer> list = new ArrayList<>();
Integer integer1 = new Integer(1);
Integer integer2 = new Integer(2);
Integer integer3 = new Integer(3);
list.add(integer1);
list.add(integer2);
list.add(integer3);
list.add(integer1);
list.add(integer1);
List<Integer> newList = list.stream().distinct().collect(Collectors.toList());
for (Integer integer : newList
) {
System.out.println(integer);
}
}
}
|
package test;
public class Main {
public static void main(String[] args) {
int a[] = {-1, 0, 1, 2, -1, -4};
int index, num;
for(int i=0; i<5; i++) {
if(a[i+1] < a[i]) {
num = a[i+1];
index = i;
while(index>=0 && num<a[index]) {
a[index+1] = a[index];
index--;
}
a[index+1] = num;
}
}
for(int i=0; i<6; i++)
System.out.println(a[i]);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.