text
stringlengths
10
2.72M
public class Numero{ public int numero; public void setNumero(int numero){ this.numero=numero; } }
package at.ac.tuwien.sepm.groupphase.backend.endpoint.mapper; import at.ac.tuwien.sepm.groupphase.backend.endpoint.dto.OrderDto; import at.ac.tuwien.sepm.groupphase.backend.entity.Order; import org.mapstruct.Mapper; import org.springframework.stereotype.Component; import java.util.List; @Mapper @Component public interface OrderMapper { OrderDto orderToOrderDto(Order order); Order orderDtoToOrder(OrderDto dto); List<OrderDto> orderListToOrderDtoList(List<Order> orders); }
package com.weili.service; import java.sql.Connection; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.shove.base.BaseService; import com.shove.data.dao.MySQL; import com.shove.vo.PageBean; import com.weili.constants.IConstants; import com.weili.dao.ProductDetailDao; public class ProductDetailService extends BaseService { public static Log log = LogFactory.getLog(ProductDetailService.class); private ProductDetailDao productDetailDao; public Map<String,Object> addProductDetail(String name,Long productId,String content,String introduction,String image,String images,Long parentId,Integer type,Integer sortIndex,Integer status,String backImage) throws Exception{ Connection conn = null; long returnId = -1; String error = "添加失败"; Map<String,Object> map = new HashMap<String, Object>(); try{ Map<String,Object> returnMap = checkProductDetail(name, productId, content, introduction, image, images, parentId, type, sortIndex, status,backImage); returnId = ((Long)returnMap.get("returnId")); if(returnId <= 0){ error = (String)returnMap.get("error"); return map; } conn = MySQL.getConnection(); returnId = productDetailDao.addProductDetail(conn, name, productId, content, introduction, image, images, parentId, type, sortIndex, status,backImage); if(returnId < 0){ conn.rollback(); return map; } conn.commit(); error = "添加成功!"; }catch (Exception e) { if(conn!=null){ conn.rollback(); } log.error(e); e.printStackTrace(); throw e; }finally{ if(conn != null){ conn.close(); } map.put("returnId", returnId); map.put("error", error); } return map; } public Map<String,Object> updateProductDetail(long id,String name,Long productId,String content,String introduction,String image,String images,Long parentId,Integer type,Integer sortIndex,Integer status,String backImage) throws Exception{ Connection conn = null; long returnId = -1; String error = "修改失败"; Map<String,Object> map = new HashMap<String, Object>(); try{ Map<String,Object> returnMap = checkProductDetail(name, productId, content, introduction, image, images, parentId, type, sortIndex, status,backImage); returnId = ((Long)returnMap.get("returnId")); if(returnId <= 0){ error = (String)returnMap.get("error"); return map; } conn = MySQL.getConnection(); returnId = productDetailDao.updateProductDetail(conn, id, name, productId, content, introduction, image, images, parentId, type, sortIndex, status,backImage); if(returnId < 0){ conn.rollback(); return map; } conn.commit(); error = "修改成功!"; }catch (Exception e) { if(conn!=null){ conn.rollback(); } log.error(e); e.printStackTrace(); throw e; }finally{ if(conn != null){ conn.close(); } map.put("returnId", returnId); map.put("error", error); } return map; } public Map<String,Object> checkProductDetail(String name,Long productId,String content,String introduction,String image,String images,Long parentId,Integer type,Integer sortIndex,Integer status,String backImage){ Map<String,Object> map = new HashMap<String, Object>(); long returnId = -1; String error = "验证失败!"; try { /*if((parentId < 0||type == 8||type == 9||type == 12)&&(StringUtils.isBlank(name))){ error = "名称不能为空"; return map; } if(status < 0){ error = "请选择是否显示"; return map; } if(parentId < 0&&StringUtils.isBlank(backImage)){ error = "请上传背景图片"; return map; } if(type == IConstants.PRODUCT_DETAIL_TYPE_PHONE&&StringUtils.isBlank(introduction)){ error = "简介不能为空"; return map; } if(type == 3&&StringUtils.isBlank(images)){ error = "请上传图集"; return map; } if(type == 11&&StringUtils.isBlank(introduction)){ error = "简介不能为空"; return map; } if((type == 11||type == IConstants.PRODUCT_DETAIL_TYPE_PHONE||type==IConstants.PRODUCT_DETAIL_TYPE_IMAGESCHILD)&&(StringUtils.isBlank(image))){ error = "请上传图片"; return map; } if(type == 4&&StringUtils.isBlank(introduction)){ error = "请上传视频"; return map; }*/ // if((type==1||type==3||type==4||type==IConstants.PRODUCT_DETAIL_TYPE_QUESTION||type==IConstants.PRODUCT_DETAIL_TYPE_ZHEN||type==IConstants.PRODUCT_DETAIL_TYPE_IMAGESCHILD)&&(StringUtils.isBlank(content))){ // error = "内容不能为空"; // return map; // } returnId = 1; error = "验证通过!"; return map; } catch (Exception e) { returnId = -1; return map; }finally{ map.put("returnId", returnId); map.put("error", error); } } public long deleteProductDetail(String ids) throws Exception{ Connection conn = connectionManager.getConnection(); long returnId = -1; try{ returnId = productDetailDao.deleteProductDetail(conn, ids); }catch (Exception e) { log.error(e); e.printStackTrace(); throw e; }finally{ conn.close(); } return returnId; } public Map<String,String> queryProductDetailById(long id) throws Exception{ Connection conn = connectionManager.getConnection(); Map<String,String> map = new HashMap<String, String>(); try{ map = productDetailDao.queryProductDetailById(conn, id); }catch (Exception e) { log.error(e); e.printStackTrace(); throw e; }finally{ conn.close(); } return map; } public List<Map<String,Object>> queryProductDetailAll(Long productId,Long parentId) throws Exception{ Connection conn = connectionManager.getConnection(); List<Map<String,Object>> list = new ArrayList<Map<String,Object>>(); StringBuffer condition = new StringBuffer(); condition.append("1=1"); if(productId != null&&productId > 0){ condition.append(" and productId = "+productId); } if(parentId != null){ condition.append(" and parentId = "+parentId); } try{ list = productDetailDao.queryProductDetailAll(conn, "*", condition.toString(), ""); }catch (Exception e) { log.error(e); e.printStackTrace(); throw e; }finally{ conn.close(); } return list; } public List<Map<String,Object>> queryProductDetailList(Long productId) throws Exception{ Connection conn = connectionManager.getConnection(); List<Map<String,Object>> list = new ArrayList<Map<String,Object>>(); StringBuffer condition = new StringBuffer(); condition.append("1=1"); if(productId != null&&productId > 0){ condition.append(" and productId = "+productId); } condition.append(" and status = "+IConstants.STATUS_ON); try{ if(productId == null||productId < 0){ return list; } list = productDetailDao.queryProductDetailAll(conn, "*", condition.toString(), "id asc"); }catch (Exception e) { log.error(e); e.printStackTrace(); throw e; }finally{ conn.close(); } return list; } public void queryProductDetailPage(PageBean<Map<String,Object>> pageBean,String fieldList,String condition,String order,String table) throws Exception{ Connection conn = connectionManager.getConnection(); try{ dataPage(conn, pageBean, table, fieldList, order, condition.toString()); }catch (Exception e) { log.error(e); e.printStackTrace(); throw e; }finally{ conn.close(); } } public void setProductDetailDao(ProductDetailDao productDetailDao) { this.productDetailDao = productDetailDao; } }
/* * 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 bts2java; /** * * @author rlaroussi */ public interface Mortel { public String meurt(); }
package de.fred4jupiter.spring.boot.camel.csv.read.streaming; import de.fred4jupiter.spring.boot.camel.MyGlobalExceptionHandler; import de.fred4jupiter.spring.boot.camel.csv.Person; import org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat; import org.apache.camel.spring.SpringRouteBuilder; import org.springframework.stereotype.Component; @Component public class CsvStreamingRoute extends SpringRouteBuilder { @Override public void configure() { onException(Exception.class).process(MyGlobalExceptionHandler.NAME); BindyCsvDataFormat personCsvDataFormat = new BindyCsvDataFormat(Person.class); BindyCsvDataFormat greetingCsvDataFormat = new BindyCsvDataFormat(Greeting.class); from("file:{{inbox.csv.folder}}/stream") .setHeader("id", constant("streamfile")) .split() .tokenize("\r\n", 100) .streaming() .unmarshal(personCsvDataFormat) .bean(StreamProcessor.NAME) .aggregate(header("id"), new GreetingAggregationStrategy()) .completionTimeout(5000) .marshal(greetingCsvDataFormat) .to("file:{{outbox.csv.folder}}/stream", "mock:streaming-out"); } }
package kodlama.io.hrms.entities.concretes; import java.time.LocalDate; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Data @AllArgsConstructor @NoArgsConstructor @Entity @Table(name = "job_postings") public class JobPosting { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") private int id; @Column(name = "description") private String description; @Column(name = "open_position_quota") private int openPositionQuota; @Column(name = "application_deadline") private LocalDate applicationDeadline; @Column(name = "is_active") private boolean isActive; @Column(name = "is_open") private boolean isOpen; @Column(name = "is_deleted") private boolean isDeleted; @Column(name = "is_remote") private boolean isRemote; @Column(name = "created_at") private LocalDate createdDate = LocalDate.now(); @Column(name = "is_verified", columnDefinition = "boolean default false") private boolean isVerified = false; @Column(name = "published_date") private LocalDate publishedDate; @Column(name = "max_salary") private int maxSalary; @Column(name = "min_salary") private int minSalary; @ManyToOne @JoinColumn(name = "job_position_id") private JobPosition jobPosition; @ManyToOne @JoinColumn(name = "city_id") private City city; @ManyToOne @JoinColumn(name="employment_type_id") private EmploymentType employmentType; @ManyToOne @JoinColumn(name = "employer_id") private Employer employer; }
package com.cn.ouyjs.jdk.jdk; /** * @author ouyjs * @date 2019/7/26 9:41 */ public interface IBookFacade { void addBook(String name); void deleBook(); }
package com.citibank.ods.modules.client.bkrportfmgmt.form; import com.citibank.ods.common.dataset.DataSet; /** * @author Hamilton Matos * */ public class BkrPortfMgmtMovementDetailForm extends BaseBkrPortfMgmtDetailForm { // Variável utilizada no controle do botão de aprovação private String m_makerUser = ""; // Variável utilizada no controle do botão de aprovação private String m_approveButtonState = ""; // Código da operação realizada no registro: inclusão, alteração, exclusão private String m_opernCode = ""; // Coluna de código de operação private String[] m_opernCodeInBkrPortfMgmtGrid; // Resultado da Consulta de Carteiras Administradas private DataSet m_portfolioResults; // Variável de controle para ação de alteração private String m_isUpdate = ""; // Variável de controle para ação de aprovação private String m_isApprove = ""; /** * @return Returns opernCode. */ public String getOpernCode() { return m_opernCode; } /** * @param opernCode_ Field opernCode to be setted. */ public void setOpernCode( String opernCode_ ) { m_opernCode = opernCode_; } /** * @return Returns opernCodeInBkrPortfMgmtGrid. */ public String[] getOpernCodeInBkrPortfMgmtGrid() { return m_opernCodeInBkrPortfMgmtGrid; } /** * @param opernCodeInBkrPortfMgmtGrid_ Field opernCodeInBkrPortfMgmtGrid to be * setted. */ public void setOpernCodeInBkrPortfMgmtGrid( String[] opernCodeInBkrPortfMgmtGrid_ ) { m_opernCodeInBkrPortfMgmtGrid = opernCodeInBkrPortfMgmtGrid_; } /** * @return Returns approveButtonState. */ public String getApproveButtonState() { return m_approveButtonState; } /** * @param approveButtonState_ Field approveButtonState to be setted. */ public void setApproveButtonState( String approveButtonState_ ) { m_approveButtonState = approveButtonState_; } public DataSet getPortfolioResults() { return m_portfolioResults; } public void setPortfolioResults( DataSet portfolioResults_ ) { m_portfolioResults = portfolioResults_; } public String getIsApprove() { return m_isApprove; } public void setIsApprove( String isApprove_ ) { m_isApprove = isApprove_; } public String getIsUpdate() { return m_isUpdate; } public void setIsUpdate( String isUpdate_ ) { m_isUpdate = isUpdate_; } public String getMakerUser() { return m_makerUser; } public void setMakerUser( String makerUser_ ) { m_makerUser = makerUser_; } }
package com.avishai.MyShas; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import androidx.core.app.NotificationCompat; import androidx.core.content.ContextCompat; /** * A receiver to create the notification */ public class NotificationReceiver extends BroadcastReceiver { /** * A public empty constructor */ public NotificationReceiver() {} @Override public void onReceive(Context context, Intent intent) { SharedPreferences set = context.getSharedPreferences("setFile", Context.MODE_PRIVATE); NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); String NOTIFICATION_CHANNEL_ID = "Avishai_01"; Intent toOpen = new Intent(context, MainActivity.class); toOpen.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pending = PendingIntent.getActivity(context, 120, toOpen, PendingIntent.FLAG_UPDATE_CURRENT); // for remind me later (30m) Intent remindIntent = new Intent(context, ReminderReceiver.class); PendingIntent remindPending = PendingIntent.getBroadcast(context, 121, remindIntent, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Action action = new NotificationCompat.Action.Builder(R.drawable.reminder, "הזכר לי בעוד 30 דקות", remindPending).build(); // for check current page as learned Intent checkIntent = new Intent(context, CheckReceiver.class); PendingIntent checkPending = PendingIntent.getBroadcast(context, 122, checkIntent, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Action checkAction = new NotificationCompat.Action.Builder(R.drawable.reminder, "סימון הדף של היום כנלמד", checkPending).build(); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID); notificationBuilder .setAutoCancel(true) .setDefaults(Notification.DEFAULT_ALL) .setSmallIcon(R.drawable.ic_notif) .setContentIntent(pending) .setColor(ContextCompat.getColor(context, R.color.notificationText)) .setContentTitle("השס שלי - My Shas") .setContentText(set.getString("message", "לא לשכוח ללמוד דף יומי")) .addAction(checkAction) .addAction(action) .setContentInfo("Info") .setPriority(NotificationCompat.PRIORITY_HIGH); // to cancel the once notification set.edit().putBoolean("runOnce", false).apply(); notificationManager.notify(120, notificationBuilder.build()); } }
package negocio.beans; import java.io.Serializable; import javafx.scene.control.Button; public class Equipamento implements Serializable { /// Atributos private String nome; private int custo; private int fN; private double peso; private String descricao; private boolean canalizador; /// Construtor public Equipamento(String nome, int custo, int fN, double peso, String descricao, boolean canalizador) { this.nome = nome; this.custo = custo; this.fN = fN; this.peso = peso; this.descricao = descricao; this.canalizador = canalizador; } /// Métodos public String toString() { /*String str = String.format("%s\n" + "Custo: %d\n", this.nome, this.custo); if(fN > 0) { str += String.format("FN: %d\n", this.fN); } str += String.format("Peso: %.2fkg\n" + "Descrição: %s\n", this.peso, this.descricao);*/ return this.getNome(); } /// Gets e sets public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public int getCusto() { return custo; } public void setCusto(int custo) { this.custo = custo; } public int getfN() { return fN; } public void setfN(int fN) { this.fN = fN; } public double getPeso() { return peso; } public void setPeso(double peso) { this.peso = peso; } public String getDescricao() { return descricao; } public void setDescricao(String descricao) { this.descricao = descricao; } public boolean isCanalizador() { return canalizador; } public void setCanalizador(boolean canalizador) { this.canalizador = canalizador; } public static Equipamento equipamento = new Equipamento(null, 0, 0, 0, null, false); }
class FlipAndInvertImage{ public int[][] flipAndInvertImage(int[][] inputArr) { int[][] flipedImage; int left = 0; int right = inputArr.length - 1; int mid = (left + right) / 2; for (int i = 0; i < inputArr.length; i++) { //flip if (mid == left || mid == right) { continue; } else { flipedImage[i] = inputArr[right]; right++; left++; } //invert if (flipedImage[i] == 1) { flipedImage[i] = 0; } else { flipedImage[i] = 1; } } return flipedImage; } }
import java.io.*; import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; public class exercise2 { public static void main(String[] args) { int mor=1; try { File f1 = new File("file1.txt"); String[] words=null; FileReader fr = new FileReader(f1); BufferedReader br = new BufferedReader(fr); String s; try { File filebichih = new File("file2.txt"); if (filebichih.createNewFile()) { System.out.println("File created: " + filebichih.getName()); } else { System.out.println("File uussen."); } } catch (IOException e) { System.out.println("File uusgej chadsangui."); e.printStackTrace(); } while((s = br.readLine())!=null) { words = s.split(" "); for (String word : words) { if(word.charAt(0) == 'a' || word.charAt(0) == 'e' || word.charAt(0) == 'u' || word.charAt(0) == 'i' || word.charAt(0) == 'o'){ System.out.println("Мөрийн дугаар "+mor +" үг: "+ word); try { Files.write(Paths.get("file2.txt"),word.getBytes(), StandardOpenOption.APPEND); Files.write(Paths.get("file2.txt")," ".getBytes(), StandardOpenOption.APPEND); } catch (IOException e) { System.out.println("Filed bichilt hiih bolomjgui bna."); e.printStackTrace(); } } } mor++; } fr.close(); } catch (FileNotFoundException e) { System.out.println("File oldsongui."); } catch (IOException e) { System.out.println("File unshij chadsangui."); e.printStackTrace(); } } }
package org.bellatrix.data; public class FeeGroups { private Integer id; private Integer feeID; private Integer groupID; private boolean destination; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getFeeID() { return feeID; } public void setFeeID(Integer feeID) { this.feeID = feeID; } public Integer getGroupID() { return groupID; } public void setGroupID(Integer groupID) { this.groupID = groupID; } public boolean isDestination() { return destination; } public void setDestination(boolean destination) { this.destination = destination; } }
package ua.siemens.dbtool.service.impl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import ua.siemens.dbtool.dao.OperationalLogDAO; import ua.siemens.dbtool.model.auxilary.OperationalLogEntry; import ua.siemens.dbtool.service.JsonService; import ua.siemens.dbtool.service.OperationalLogService; import java.util.Collection; import java.util.Comparator; import java.util.stream.Collectors; /** * Implementation of {@link OperationalLogService} * * @author Perevoznyk Pavlo * creation date 24 October 2018 * @version 1.0 */ @Service public class OperationalLogServiceImpl implements OperationalLogService { private static final Logger LOG = LoggerFactory.getLogger(OperationalLogServiceImpl.class); private OperationalLogDAO operationalLogDAO; private JsonService jsonService; @Autowired public OperationalLogServiceImpl(OperationalLogDAO operationalLogDAO) { this.operationalLogDAO = operationalLogDAO; } @Override public OperationalLogEntry save(OperationalLogEntry entry) { LOG.debug(">> save()"); return operationalLogDAO.save(entry); } @Override public OperationalLogEntry findById(Long id) { return operationalLogDAO.findById(id); } @Override public Collection<OperationalLogEntry> findAll() { return operationalLogDAO.findAll(); } @Override public String findAllJson() { return jsonService.convertLogEntriesToJson(findAll().stream() .sorted(Comparator.comparing(OperationalLogEntry::getDateTime).reversed()) .collect(Collectors.toList())); } @Override public String findJson(Long projectId, Long wpId, Long jobId) { return jsonService.convertLogEntriesToJson(find(projectId, wpId, jobId)); } private Collection<OperationalLogEntry> find(Long projectId, Long wpId, Long jobId) { LOG.debug(">> find(), params={}/{}/{}", projectId, wpId, jobId); Collection<OperationalLogEntry> entries; if(jobId != 0){ entries = operationalLogDAO.findByJobId(jobId); } else if(wpId != 0){ entries = operationalLogDAO.findByWpId(wpId); } else { entries = operationalLogDAO.findByProjectId(projectId); } LOG.debug("entries={}", entries); return entries.stream() .sorted(Comparator.comparing(OperationalLogEntry::getDateTime).reversed()) .collect(Collectors.toList()); } @Override public void delete(Long projectId, Long wpId, Long jobId) { if(jobId != 0){ operationalLogDAO.deleteByJobId(jobId); } else if(wpId != 0){ operationalLogDAO.deleteByWpId(wpId); } else { operationalLogDAO.deleteByProjectId(projectId); } } @Autowired public void setJsonService(JsonService jsonService) { this.jsonService = jsonService; } }
package com.aidigame.hisun.imengstar.ui; import java.util.ArrayList; import android.app.Activity; import android.app.ActivityManager; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.os.Bundle; import android.os.Handler; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup.LayoutParams; import android.view.animation.Animation; import android.view.animation.Animation.AnimationListener; import android.view.animation.AnimationUtils; import android.view.animation.TranslateAnimation; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.Gallery; import android.widget.PopupWindow.OnDismissListener; import android.widget.GridView; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.PopupWindow; import android.widget.RelativeLayout; import android.widget.TextView; import com.aidigame.hisun.imengstar.PetApplication; import com.aidigame.hisun.imengstar.adapter.GalleryAdapter; import com.aidigame.hisun.imengstar.adapter.MarketRealGridViewAdapter; import com.aidigame.hisun.imengstar.adapter.OnlyShowIconAdapter; import com.aidigame.hisun.imengstar.adapter.GalleryAdapter.ClickViewListener; import com.aidigame.hisun.imengstar.bean.Animal; import com.aidigame.hisun.imengstar.bean.Gift; import com.aidigame.hisun.imengstar.constant.Constants; import com.aidigame.hisun.imengstar.http.HttpUtil; import com.aidigame.hisun.imengstar.util.HandleHttpConnectionException; import com.aidigame.hisun.imengstar.util.LogUtil; import com.aidigame.hisun.imengstar.util.StringUtil; import com.aidigame.hisun.imengstar.util.UiUtil; import com.aidigame.hisun.imengstar.view.HorizontalListView2; import com.aidigame.hisun.imengstar.view.HorizontialListView; import com.aidigame.hisun.imengstar.view.RoundImageView; import com.aidigame.hisun.imengstar.R; import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.assist.ImageScaleType; /** * 兑换界面 * @author admin * */ public class ExchangeActivity extends BaseActivity implements OnClickListener{ ImageView backIv,foodIv,showIconsIv; LinearLayout typeLayout; TextView typeTv,foodTv; GridView gridView; RoundImageView petIcon; MarketRealGridViewAdapter marketRealGridViewAdapter; ArrayList<Gift> giftList; ArrayList<Gift> giftTotalList; public static ExchangeActivity exchangeActivity; PopupWindow popupWindow; Animal animal; ArrayList<Animal> animals; Handler handler; GalleryAdapter galleryAdapter; int currentPosition; // Gallery gallery; HorizontalListView2 linearLayoutForListView; LinearLayout iconsLayout; ImageView leftIv,rightIv; RelativeLayout bottomLayout,rooLayout; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_exchange); rooLayout=(RelativeLayout)findViewById(R.id.root_layout); BitmapFactory.Options options=new BitmapFactory.Options(); options.inSampleSize=4; rooLayout.setBackgroundDrawable(new BitmapDrawable(BitmapFactory.decodeResource(getResources(), R.drawable.blur, options))); exchangeActivity=this; handler=HandleHttpConnectionException.getInstance().getHandler(this); margin=-getResources().getDimensionPixelSize(R.dimen.one_dip)*46; loadData(); initView(); } private void loadData() { // TODO Auto-generated method stub animals=new ArrayList<Animal>(); if(PetApplication.myUser!=null&&PetApplication.myUser.aniList!=null){ for(int i=0;i<PetApplication.myUser.aniList.size();i++){ if(PetApplication.myUser.userId==PetApplication.myUser.aniList.get(i).master_id){ animals.add(PetApplication.myUser.aniList.get(i)); } } } if(animals.size()>0){ animal=animals.get(0); currentPosition=0; }else{ animal=new Animal(); } new Thread(new Runnable() { @Override public void run() { // TODO Auto-generated method stub ArrayList<Gift> gifts=HttpUtil.exchangeFoodList(handler, null, ExchangeActivity.this); final ArrayList<Gift> temp=new ArrayList<Gift>(); if(gifts!=null){ for(int i=0;i<gifts.size();i++){ boolean flag=HttpUtil.giftInfo(handler, gifts.get(i), ExchangeActivity.this); if(flag){ temp.add(gifts.get(i)); } } runOnUiThread(new Runnable() { @Override public void run() { // TODO Auto-generated method stub giftList=temp; giftTotalList=new ArrayList<Gift>(); for(int i=0;i<giftList.size();i++){ giftTotalList.add(giftList.get(i)); } marketRealGridViewAdapter.updateList(temp); marketRealGridViewAdapter.notifyDataSetChanged(); } }); } } }).start(); } private void initView() { // TODO Auto-generated method stub backIv=(ImageView)findViewById(R.id.back); typeLayout=(LinearLayout)findViewById(R.id.type_layout); typeTv=(TextView)findViewById(R.id.type_tv); gridView=(GridView)findViewById(R.id.grid_view); foodTv=(TextView)findViewById(R.id.food_tv); foodIv=(ImageView)findViewById(R.id.food_iv); petIcon=(RoundImageView)findViewById(R.id.pet_icon); showIconsIv=(ImageView)findViewById(R.id.show_icons_iv); bottomLayout=(RelativeLayout)findViewById(R.id.bottom_layout); // gallery=(Gallery)findViewById(R.id.galleryview); linearLayoutForListView=(HorizontalListView2 )findViewById(R.id.galleryview); iconsLayout=(LinearLayout)findViewById(R.id.icons_layout); leftIv=(ImageView)findViewById(R.id.left_iv); rightIv=(ImageView)findViewById(R.id.right_iv); galleryAdapter=new GalleryAdapter(this, animals,0); galleryAdapter.setClickViewListener(new ClickViewListener() { @Override public void onClick(int position) { // TODO Auto-generated method stub loadIcon(animals.get(position)); currentPosition=position; } }); linearLayoutForListView.setAdapter(galleryAdapter); // gallery.setAdapter(galleryAdapter); if(animals.size()>0){ // gallery.scrollTo(gallery.getMeasuredWidth(), 0); } giftList=new ArrayList<Gift>(); marketRealGridViewAdapter=new MarketRealGridViewAdapter(this, giftList); gridView.setAdapter(marketRealGridViewAdapter); loadIcon(animal); changeFoodNum(animal.foodNum); showIconsIv.setOnClickListener(this); backIv.setOnClickListener(this); typeLayout.setOnClickListener(this); leftIv.setOnClickListener(this); rightIv.setOnClickListener(this); initListener(); new Thread(new Runnable() { @Override public void run() { // TODO Auto-generated method stub final ArrayList<Animal> anim=HttpUtil.usersKingdom(ExchangeActivity.this,PetApplication.myUser, 1, handler); if(anim!=null&&anim.size()>0){ handler.post(new Runnable() { @Override public void run() { // TODO Auto-generated method stub PetApplication.myUser.aniList=anim; animals=new ArrayList<Animal>(); if(PetApplication.myUser!=null&&PetApplication.myUser.aniList!=null){ for(int i=0;i<PetApplication.myUser.aniList.size();i++){ if(PetApplication.myUser.userId==PetApplication.myUser.aniList.get(i).master_id){ animals.add(PetApplication.myUser.aniList.get(i)); } } } galleryAdapter.update(animals); if(animals.size()>0) loadIcon(animals.get(0)); galleryAdapter.notifyDataSetChanged(); } }); } } }).start(); gridView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // TODO Auto-generated method stub Gift gift=giftList.get(position); /*if(animal.foodNum<gift.price){ Intent intent=new Intent(ExchangeActivity.this,Dialog3Activity.class); intent.putExtra("mode", 2); ExchangeActivity.this.startActivity(intent); }else{*/ Intent intent=new Intent(ExchangeActivity.this,GiftInfoActivity.class); gift.animal=animal; intent.putExtra("gift", gift); ExchangeActivity.this.startActivity(intent); // } } }); } private void initListener() { // TODO Auto-generated method stub petIcon.setOnClickListener(this); linearLayoutForListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // TODO Auto-generated method stub loadIcon(animals.get(position)); hideIcons(true); } }); } public void changeFoodNum(long num){ if(num<=0){ foodTv.setText("0"); foodIv.setImageResource(R.drawable.exchange_food_red); }else{ foodTv.setText(""+num); foodIv.setImageResource(R.drawable.exchange_food_red); } } /** * 用户,宠物头像下载 */ public void loadIcon(Animal animal) { // TODO Auto-generated method stub this.animal=animal; BitmapFactory.Options options=new BitmapFactory.Options(); options.inJustDecodeBounds=false; options.inSampleSize=8; options.inPreferredConfig=Bitmap.Config.RGB_565; options.inPurgeable=true; options.inInputShareable=true; DisplayImageOptions displayImageOptions1=new DisplayImageOptions .Builder() .showImageOnLoading(R.drawable.pet_icon) .showImageOnFail(R.drawable.pet_icon) .cacheInMemory(true) .cacheOnDisc(true) .bitmapConfig(Bitmap.Config.RGB_565) .imageScaleType(ImageScaleType.IN_SAMPLE_INT) .decodingOptions(options) .build(); ImageLoader imageLoader1=ImageLoader.getInstance(); imageLoader1.displayImage(Constants.ANIMAL_DOWNLOAD_TX+animal.pet_iconUrl, petIcon, displayImageOptions1); changeFoodNum(animal.foodNum); } public void hideIcons(final boolean isHide){ new Thread(new Runnable() { @Override public void run() { // TODO Auto-generated method stub boolean flag=true; while(flag){ RelativeLayout.LayoutParams param=(RelativeLayout.LayoutParams)bottomLayout.getLayoutParams(); if(param==null){ param=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,RelativeLayout.LayoutParams.WRAP_CONTENT); } if(isHide){ animHandler.sendEmptyMessage(1); if(param.bottomMargin==margin){ flag=false; showList=false; } }else{ animHandler.sendEmptyMessage(2); if(param.bottomMargin==0){ flag=false; showList=true; } } try { Thread.sleep(100/30); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }).start(); } int margin; Handler animHandler=new Handler(){ int speed; public void handleMessage(android.os.Message msg) { speed=(getResources().getDimensionPixelSize(R.dimen.one_dip))*46/40; RelativeLayout.LayoutParams param=(RelativeLayout.LayoutParams)bottomLayout.getLayoutParams(); if(param==null){ param=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,RelativeLayout.LayoutParams.WRAP_CONTENT); } if(msg.what==1){ param.bottomMargin-=speed; if(param.bottomMargin<=margin){ param.bottomMargin=margin; } bottomLayout.setLayoutParams(param); }else if(msg.what==2){ param.bottomMargin+=speed; if(param.bottomMargin>=0){ param.bottomMargin=0; } bottomLayout.setLayoutParams(param); } }; }; boolean showList=false; @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.show_icons_iv: break; case R.id.back: if(isTaskRoot()){ if(HomeActivity.homeActivity!=null){ ActivityManager am=(ActivityManager)getSystemService(Context.ACTIVITY_SERVICE); am.moveTaskToFront(HomeActivity.homeActivity.getTaskId(), 0); }else{ Intent intent=new Intent(this,HomeActivity.class); this.startActivity(intent); } } exchangeActivity=null; finish(); System.gc(); break; case R.id.type_layout: showType(); break; case R.id.pet_icon: if(animals.size()<=0)return; if(!showList){ hideIcons(false); }else{ hideIcons(true); } break; default: break; } } public void showType(){ View view=LayoutInflater.from(this).inflate(R.layout.popup_exchange_1, null); TextView tv1=(TextView)view.findViewById(R.id.textView1); TextView tv2=(TextView)view.findViewById(R.id.textView2); TextView tv3=(TextView)view.findViewById(R.id.textView3); TextView tv4=(TextView)view.findViewById(R.id.textView4); popupWindow=new PopupWindow(view,LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); popupWindow.setFocusable(true); popupWindow.setBackgroundDrawable(new BitmapDrawable()); popupWindow.setOutsideTouchable(true); popupWindow.showAsDropDown(typeLayout, 0, getResources().getDimensionPixelSize(R.dimen.one_dip)*10); tv1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub popupWindow.dismiss(); typeTv.setText("全部"); giftList.removeAll(giftList); Gift gift=null; for(int i=0;i<giftTotalList.size();i++){ gift=giftTotalList.get(i); giftList.add(gift); } marketRealGridViewAdapter.updateList(giftList); marketRealGridViewAdapter.notifyDataSetChanged(); } }); tv2.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub popupWindow.dismiss(); typeTv.setText("猫粮"); giftList.removeAll(giftList); Gift gift=null; for(int i=0;i<giftTotalList.size();i++){ gift=giftTotalList.get(i); if(gift.type==1){ giftList.add(gift); } } marketRealGridViewAdapter.updateList(giftList); marketRealGridViewAdapter.notifyDataSetChanged(); } }); tv3.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub popupWindow.dismiss(); typeTv.setText("狗粮"); giftList.removeAll(giftList); Gift gift=null; for(int i=0;i<giftTotalList.size();i++){ gift=giftTotalList.get(i); if(gift.type==2){ giftList.add(gift); } } marketRealGridViewAdapter.updateList(giftList); marketRealGridViewAdapter.notifyDataSetChanged(); } }); tv4.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub popupWindow.dismiss(); typeTv.setText("其他"); giftList.removeAll(giftList); Gift gift=null; for(int i=0;i<giftTotalList.size();i++){ gift=giftTotalList.get(i); if(gift.type==3){ giftList.add(gift); } } marketRealGridViewAdapter.updateList(giftList); marketRealGridViewAdapter.notifyDataSetChanged(); } }); } @Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); if(animal!=null){ foodTv.setText(""+animal.foodNum); } } }
package com.choco.manager.service; import com.choco.manager.entity.GoodsCategory; import com.choco.manager.vo.GoodsCategoryVo; import java.util.List; /** * Created by choco on 2020/12/28 22:36 */ public interface GoodsCategoryService { /** * 商品分类-新增分类-顶级分类 * * @return */ List<GoodsCategory> selectCategoryTopList(); /** * 查询二级分类 * * @param parentId * @return */ List<GoodsCategory> selectCategorySecond(short parentId); /** * 商品分类-新增分类-保存分类 */ int categorySave(GoodsCategory goodsCategory); /** * 商品分类-列表 */ List<GoodsCategoryVo> selectCategoryListVo(); /** * 查询所有的商品分类 * @return */ List<GoodsCategory> selectAllCategory(); }
package com.example.userinput; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends AppCompatActivity { TextView nameText; EditText nameEditText, mailIdEditText, stateEditText; Button submit; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); submit = findViewById(R.id.submit); nameText = findViewById(R.id.nameText); submit.setOnClickListener(view -> { nameEditText = findViewById(R.id.nameEditText); mailIdEditText = findViewById(R.id.mailEditText); stateEditText = findViewById(R.id.stateEditText); nameText.setText("Name: " + nameEditText.getText().toString() + "\n" + "Mail id: " + mailIdEditText.getText().toString() + "\n" + "State: " + stateEditText.getText().toString()); }); } }
package J2EE小组项目尝试1; import J2EE小组相关.ClientThread; import J2EE小组相关.Server; import java.io.*; import java.net.Socket; /** * @Auther: LBW * @Date: 2019/3/1 * @Description: J2EE小组项目尝试1 */ public class MyClient { ReadMessage RM = new ReadMessage(); public void client () { int port = 30000; String host = "localhost"; try { Socket so = new Socket(host , port); new Thread(new ClientThread(so)).start(); PrintStream dos = new PrintStream(so.getOutputStream()); System.out.println("连接完成!"); dos.print(RM.print()); dos.flush(); } catch(IOException e) { e.printStackTrace(); } } public static void main(String []args) { MyClient myclient = new MyClient(); System.out.println("开始运行客户端!"); myclient.client(); } }
package com.example.aniketkumar.test; import android.support.v7.widget.CardView; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; /** * Created by Aniket Kumar on 28-Jan-18. */ public class View_Holder_Cardview extends RecyclerView.ViewHolder { CardView cv; TextView title; TextView description; TextView price,sr,id,rupee; ImageView imageView; ImageButton imageButton; View_Holder_Cardview(View itemView) { super(itemView); cv = (CardView) itemView.findViewById(R.id.card); title = (TextView) itemView.findViewById(R.id.name); price=itemView.findViewById(R.id.price); id=itemView.findViewById(R.id.id); id.setVisibility(View.GONE); description = (TextView) itemView.findViewById(R.id.description); imageView = (ImageView) itemView.findViewById(R.id.image); imageButton=itemView.findViewById(R.id.vertical); } }
package org.typhon.client.model.dto; import java.util.*; import java.sql.Timestamp; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @JsonIgnoreProperties(ignoreUnknown = true) public class CustomerDTO { private String oid; private String name; private List<String > detailsObj; public void setOid (String oid){ this.oid = oid; } public String getOid(){ return oid; } public void setName (String name){ this.name = name; } public String getName(){ return name; } public List<String > getDetails(){ return detailsObj; } public void setDetails(List<String > detailsObj){ this.detailsObj = detailsObj; } }
package io.dcbn.backend.graph.services; import lombok.Getter; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; public class GraphLock { @Getter private long userId; private long expireTime; public GraphLock(long userId, long timeToExpireInMillis) { this.userId = userId; this.expireTime = System.currentTimeMillis() + timeToExpireInMillis; } public boolean isExpired() { return System.currentTimeMillis() > expireTime; } }
String reverseParentheses(String s) { String kaki = ""; String bab = ""; String zsa = ""; int len = s.length(); int n = 0; int j =0; for(int i = 0; i < len; i++) { if(s.charAt(i) == '(') n++; } int T[] = new int[n]; for(int i = 0; i < len; i++) { if(s.charAt(i) == '(') { T[j] = i; j++; } } j = 0; while(n > 0) { j = T[n-1] + 1; while(s.charAt(j) != ')') { kaki += s.charAt(j); j++; } for(int q = kaki.length()-1 ; q >= 0; q--) bab += kaki.charAt(q); zsa = s.substring(0,T[n-1]) + bab + s.substring(T[n-1]+bab.length()+2); s = zsa; n--; zsa = ""; kaki = ""; bab = ""; } return s ; }
import java.io.DataOutputStream; import java.io.IOException; public class Buffer12BitWriterClass { int bufferCapacity = 3; int currSize = 0; byte[] buffer = new byte[bufferCapacity]; DataOutputStream out; Buffer12BitWriterClass(DataOutputStream out) { this.out = out; } /** * This method is going to do many crucial things. The input integer to it * will be the value we got from the map. It will take out the least * significant 12 bits. Do some bit operations on it and split the 21 bits * into 2 bytes and hold it in buffer array. * * @param i */ public void writeData(int i) { int temp = i; if (currSize == 2) { flush(); } // store data if (currSize % 2 == 0) { temp = temp & 0x0FF0; // Of the 12 bits to be written. Get most // System.out.println(Integer.toBinaryString(temp)); // significant (MS) 8 bits temp = temp >>> 4; // Shift the bits to right buffer[currSize] = (byte) temp; currSize++; // For the remainder 4 bits temp = i; temp = temp & 0x000F; temp = temp << 4; temp = temp & 0x00F0; buffer[currSize] = (byte) temp; } else if (currSize % 2 == 1) { temp = temp & 0x0F00; // Most significant 4 bits of the 12 relevant // bits temp = temp >>> 8; buffer[currSize] = (byte) (buffer[currSize] | ((byte) temp)); currSize++; temp = i; temp = temp & 0x00FF; // LS 8 bits of the 112 relevant bits buffer[currSize] = (byte) temp; } } /** * Move all the values from the buffer to zipped file */ public void flush() { for(int i =0; i<= currSize; i++){ try { out.writeByte(buffer[i]); } catch (IOException e) { e.printStackTrace(); } } currSize = 0; buffer = new byte[bufferCapacity]; } }
package backend; import java.io.File; import java.io.FileInputStream; import java.util.Properties; import java.util.Vector; import symap.pool.DatabaseUser; import util.ErrorCount; import util.Logger; import util.Utilities; import backend.Project; /* * Parse FPC file and load data into database */ public class FPCLoadMain { public static boolean run(UpdatePool pool, Logger log, String projName) throws Exception { long startTime = System.currentTimeMillis(); log.msg("Loading FPC project " + projName); // Load properties for FPC project String projDir = "data/fpc/" + projName; SyProps props = new SyProps(log, new File(projDir + "/params")); if (props.getProperty("display_name") == null) props.setProperty("display_name", projName); if (props.getProperty("name") == null) props.setProperty("name", projName); if (props.getProperty("category") == null) props.setProperty("category", "Uncategorized"); // if (props.getProperty("group") != null && !props.getProperty("group").equals("")) // props.setProperty("category", props.getProperty("group")); if (props.getProperty("description") == null) props.setProperty("description", ""); // Create FPC project in database int projIdx = pool.getProjIdx(projName, ProjType.fpc); if (projIdx > 0) // delete existing project pool.deleteProject(projIdx); if (pool.projectExists(projName)) { System.out.println("A PSEUDO project with the same exists, please remove it first\n" + "or select a different name for this project."); return false; } pool.createProject(projName,ProjType.fpc); projIdx = pool.getProjIdx(projName, ProjType.fpc); props.uploadProjProps(pool, projIdx, new String[] { "name", "display_name", "category", "description", "grp_prefix", "grp_sort", "grp_type", "cbsize", "max_mrk_ctgs_hit", "min_mrk_clones_hit" } ); // Locate the FPC file File fpcFile = null; if (!props.containsKey("fpc_file") || props.getProperty("fpc_file").trim().equals("")) { File sdf = new File(projDir); File[] seqFiles = null; if (sdf.exists() && sdf.isDirectory()) seqFiles = sdf.listFiles(new ExtensionFilter(".fpc")); else { log.msg("Can't find fpc directory " + projDir); ErrorCount.inc(); return false; } if (seqFiles.length == 0) { log.msg("Can't find fpc file in directory " + projDir); ErrorCount.inc(); return false; } else if (seqFiles.length > 1) { log.msg("More than one fpc file in directory " + projDir); ErrorCount.inc(); return false; } fpcFile = seqFiles[0]; } else { if (props.containsKey("fpc_file")) { fpcFile = new File(props.getProperty("fpc_file")); } } if (fpcFile == null || !fpcFile.isFile()) { log.msg("Can't find fpc file "); return false; } String prefix = props.getProperty("grp_prefix"); Vector<File> besFiles = new Vector<File>(); Vector<File> mrkFiles = new Vector<File>(); addFiles(props,"bes_files",besFiles, log); addFiles(props,"marker_files",mrkFiles, log); // Set up the sort order of the groups based on param file setting GroupSorter gs = null; if (!props.getProperty("grp_order").equals("")) { String[] grpOrder = props.getProperty("grp_order").split(","); gs = new GroupSorter(grpOrder); } else if (props.getProperty("grp_sort").equals("numeric")) gs = new GroupSorter(GrpSortType.Numeric); else gs = new GroupSorter(GrpSortType.Alpha); String seqdir = projDir + "/sequence"; int maxctgs = Integer.parseInt(props.getProperty("max_mrk_ctgs_hit")); FPCData mFPC; try { mFPC = new FPCData(pool, log, fpcFile, projIdx, prefix, gs, seqdir,maxctgs,besFiles, mrkFiles); } catch (Exception e) { log.msg("Failed to parse the FPC file"); ErrorCount.inc(); return false; } try { mFPC.doUpload(); } catch (Exception e) { e.printStackTrace(); log.msg("Failed to load the FPC file"); ErrorCount.inc(); return false; } log.msg("Done: " + Utilities.getDurationString(System.currentTimeMillis()-startTime) + "\n"); return true; } private static void addFiles(Properties props, String key, Vector<File> files, Logger log) { if (!props.containsKey(key)) return; String[] fileList = props.getProperty(key).split(","); int i = 0; for (String filstr : fileList) { if (filstr == null) continue; if (filstr.trim().equals("")) continue; File f = new File(filstr); if (!f.exists()) { log.msg("Can't find sequence file " + filstr); } else if (f.isDirectory()) { for (File f2 : f.listFiles()) { files.add(f2); i++; } } else { files.add(f); i++; } } } public static void main(String[] args) { try { FileInputStream propFH = new FileInputStream(Utils.getParamsName()); Properties mDBProps = new Properties(); mDBProps.load(propFH); String dbstr = DatabaseUser.getDatabaseURL(mDBProps.getProperty("db_server"), mDBProps.getProperty("db_name")); UpdatePool pool = new UpdatePool(dbstr, mDBProps.getProperty("db_adminuser"), mDBProps.getProperty("db_adminpasswd")); run( pool, new Log("symap.log"), args[0] ); DatabaseUser.shutdown(); } catch (Exception e) { e.printStackTrace(); DatabaseUser.shutdown(); System.exit(-1); } } }
package com.artauction.domain; import java.util.Date; import lombok.Data; //구매현황, 판매현황 둘다 사용됨 @Data public class MypageBuyingVO { private int gno; private int categoryid; private String registeruserid; private String gname; private int nowprice; private int startprice; private Date startdate; private Date enddate; private char flag; private String buyinguserid; private int tradeprice; private char thumbnail; private String filename; private String uuid; private String uploadpath; }
//Java default API controls import javafx.scene.control.Alert.AlertType; import javafx.scene.control.ButtonType; import javafx.scene.control.Alert; public class AlertList{ private static AlertList instance; private static ScreenGx screen; private AlertList(){ screen = ScreenGx.getInstance(); } public static AlertList getInstance(){ if (instance == null) instance = new AlertList(); return instance; } public void IllegalMovement(String message){ Alert IllegalMovement = new Alert(AlertType.WARNING); IllegalMovement.setTitle("Invalid moviment!"); IllegalMovement.setHeaderText(message); IllegalMovement.setContentText("Select another chessman position to keep playing."); IllegalMovement.showAndWait(); } public void LeftGame(){ Alert LeftGame = new Alert(AlertType.CONFIRMATION); LeftGame.setTitle("Your game was not save."); LeftGame.setHeaderText("Leave will lost running game."); LeftGame.setContentText("Are you sur that you want to leave?"); ButtonType sure, saveBefore, cancel; sure = new ButtonType("Leave anyway"); saveBefore = new ButtonType("Save before"); cancel = new ButtonType("Nevermind"); LeftGame.getButtonTypes().setAll(sure, saveBefore, cancel); LeftGame.showAndWait().ifPresent(b ->{ if(b == sure) UX.controlStage(ScreenGx.getStage(), screen.MenuGx()); //else if(b == saveBefore) //UX.controlStage(ScreenGx.getStage(), screen.Save()); else LeftGame.close(); }); } }
package us.gibb.dev.gwt.demo.client; import us.gibb.dev.gwt.command.CommandEventBus; import us.gibb.dev.gwt.command.ResultEvent; import us.gibb.dev.gwt.command.results.StringResult; import us.gibb.dev.gwt.demo.client.command.SayHelloCommand; import us.gibb.dev.gwt.location.HasLocation; import us.gibb.dev.gwt.presenter.AbstractPresenter; import us.gibb.dev.gwt.view.WidgetView; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.HasClickHandlers; import com.google.gwt.event.dom.client.HasKeyPressHandlers; import com.google.gwt.event.dom.client.KeyPressEvent; import com.google.gwt.event.dom.client.KeyPressHandler; import com.google.gwt.user.client.ui.HasText; import com.google.inject.Inject; public class HelloPresenter extends AbstractPresenter<HelloPresenter.View, CommandEventBus> { public interface View extends WidgetView, HasLocation { HasClickHandlers getButton(); HasText getName(); HasKeyPressHandlers getNameKeys(); HasText getResult(); } @Inject protected HelloPresenter(final CommandEventBus eventBus, View view) { super(eventBus, view); getView().getButton().addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { sayHello(); }}); getView().getNameKeys().addKeyPressHandler(new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { if ((int)event.getCharCode() == 13) { //on enter key pressed sayHello(); } }}); eventBus.add(new ResultEvent.Handler<StringResult>(SayHelloCommand.class){ public void handle(ResultEvent<StringResult> event) { getView().getResult().setText(event.getResult().getString()); }}); eventBus.add(new AlertFailureEventHandler()); } private void sayHello() { eventBus.changeLocation(getView().getLocation(), getView().getName().getText()); eventBus.fire(new SayHelloCommand(getView().getName().getText())); } }
package cn.itcast.core.controller; import cn.itcast.core.common.FastDFSClient; import cn.itcast.core.pojo.entity.Result; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; @RestController @RequestMapping("/upload") public class UploadController { @Value("${FILE_SERVER_URL}") private String fileServer; /** * 文件上传 * @param file * @return */ @RequestMapping("/uploadFile") public Result uploadFile(MultipartFile file) { try { //创建fastDFS工具类对象 FastDFSClient fastDFS = new FastDFSClient("classpath:fastDFS/fdfs_client.conf"); //上传并返回文件的路径和文件名 String path = fastDFS.uploadFile(file.getBytes(), file.getOriginalFilename(), file.getSize()); //上传后返回fastDFS文件服务器地址+ 上传后的文件路径和文件名 return new Result(true, fileServer + path); } catch (Exception e) { e.printStackTrace(); return new Result(false, "上传失败!"); } } }
package org.nhnnext.restaurant.lab5.purchase.discount; import org.nhnnext.restaurant.lab5.menu.Beverage; public class CouponDiscount implements DiscountMethod { @Override public int discountPrice(Beverage beverage) { return 100; } }
package com.bunq.sdk.model.generated.endpoint; import com.bunq.sdk.http.ApiClient; import com.bunq.sdk.http.BunqResponse; import com.bunq.sdk.http.BunqResponseRaw; import com.bunq.sdk.model.core.BunqModel; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import java.util.List; import java.util.Map; /** * Aggregation of how many card payments have been done with a Green Card in the current * calendar month. */ public class MasterCardActionGreenAggregation extends BunqModel { /** * Endpoint constants. */ protected static final String ENDPOINT_URL_LISTING = "user/%s/mastercard-action-green-aggregation"; /** * Object type. */ protected static final String OBJECT_TYPE_GET = "MasterCardActionGreenAggregation"; /** * The date of the aggregation. */ @Expose @SerializedName("date") private String date; /** * The percentage of card payments that were done with a Green Card. */ @Expose @SerializedName("percentage") private String percentage; /** * */ public static BunqResponse<List<MasterCardActionGreenAggregation>> list(Map<String, String> params, Map<String, String> customHeaders) { ApiClient apiClient = new ApiClient(getApiContext()); BunqResponseRaw responseRaw = apiClient.get(String.format(ENDPOINT_URL_LISTING, determineUserId()), params, customHeaders); return fromJsonList(MasterCardActionGreenAggregation.class, responseRaw, OBJECT_TYPE_GET); } public static BunqResponse<List<MasterCardActionGreenAggregation>> list() { return list(null, null); } public static BunqResponse<List<MasterCardActionGreenAggregation>> list(Map<String, String> params) { return list(params, null); } /** * */ public static MasterCardActionGreenAggregation fromJsonReader(JsonReader reader) { return fromJsonReader(MasterCardActionGreenAggregation.class, reader); } /** * The date of the aggregation. */ public String getDate() { return this.date; } public void setDate(String date) { this.date = date; } /** * The percentage of card payments that were done with a Green Card. */ public String getPercentage() { return this.percentage; } public void setPercentage(String percentage) { this.percentage = percentage; } /** * */ public boolean isAllFieldNull() { if (this.date != null) { return false; } if (this.percentage != null) { return false; } return true; } }
package com.mtsoft.animal.activity; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import com.mtsoft.animal.R; import com.mtsoft.animal.fragmnet.FragmentAlphabet; import com.mtsoft.animal.fragmnet.FragmentAnimal; import com.mtsoft.animal.fragmnet.FragmentFruit; import com.mtsoft.animal.fragmnet.FragmentNumber; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity/* implements AdapterView.OnItemClickListener*/ { private Toolbar toolbar; private TabLayout tabLayout; private ViewPager viewPager; //Tạo cơ sở dữ liệu SQLiteDatabase database; private int[] tabIcons = { R.drawable.ic_tab_animal, R.drawable.ic_tab_number, R.drawable.ic_tab_vegetable, R.drawable.ic_tab_abc }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // toolbar = (Toolbar) findViewById(R.id.toolbar); // setSupportActionBar(toolbar); // // getSupportActionBar().setDisplayHomeAsUpEnabled(true); viewPager = (ViewPager) findViewById(R.id.viewpager); setupViewPager(viewPager); tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(viewPager); //Set icon cho tab setupTabIcons(); // database = MySQLite.initDatabase(this, "dbAnimals.sqlite"); // Cursor cursor = database.rawQuery("SELECT * FROM Number", null); // cursor.moveToFirst(); // Toast.makeText(this, cursor.getInt(1) + "", Toast.LENGTH_SHORT).show(); } //Hàm insert record vào table // private void insertRecord(){ // for (int i = 0 ; i < 104; i++){ // ContentValues contentValues = new ContentValues(); // contentValues.put("code", i); // contentValues.put("like", 0); // database.insert(TABLE_ANIMAL, null, contentValues); // } // // for (int i = 0; i < 100; i++){ // ContentValues contentValues = new ContentValues(); // contentValues.put("code", i); // contentValues.put("like", 0); // database.insert(TABLE_NUMBER, null, contentValues); // } // // for (int i = 0; i < 36; i++){ // ContentValues contentValues = new ContentValues(); // contentValues.put("code", i); // contentValues.put("like", 0); // database.insert(TABLE_FRUIT, null, contentValues); // } // // for (int i = 0; i < 26; i++){ // ContentValues contentValues = new ContentValues(); // contentValues.put("code", i); // contentValues.put("like", 0); // database.insert(TABLE_ALPHABET, null, contentValues); // } // } private void setupTabIcons() { tabLayout.getTabAt(0).setIcon(tabIcons[0]); tabLayout.getTabAt(1).setIcon(tabIcons[1]); tabLayout.getTabAt(2).setIcon(tabIcons[2]); tabLayout.getTabAt(3).setIcon(tabIcons[3]); } private void setupViewPager(ViewPager viewPager) { ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager()); adapter.addFragment(new FragmentAnimal(), "Animal"); adapter.addFragment(new FragmentNumber(), "Number"); adapter.addFragment(new FragmentFruit(), "Fruit"); adapter.addFragment(new FragmentAlphabet(), "Alphabet"); viewPager.setAdapter(adapter); } // // @Override // public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { // Intent intent = new Intent(this, SlideShow.class); // startActivity(intent); // } class ViewPagerAdapter extends FragmentPagerAdapter { private final List<Fragment> mFragmentList = new ArrayList<>(); private final List<String> mFragmentTitleList = new ArrayList<>(); public ViewPagerAdapter(FragmentManager manager) { super(manager); } @Override public Fragment getItem(int position) { return mFragmentList.get(position); } @Override public int getCount() { return mFragmentList.size(); } public void addFragment(Fragment fragment, String title) { mFragmentList.add(fragment); mFragmentTitleList.add(title); } @Override public CharSequence getPageTitle(int position) { return mFragmentTitleList.get(position); } } }
package com.jwebsite.vo; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity public class Photo { @Id @GeneratedValue private int ID; private String Tid; private String KeyWords; private String Title; private String PhotoUrl; private String PicUrls; private String PictureContent; private String Author; private String Origin; private String Rank; private String LastHitsTime; private int Hits; private int HitsByDay; private int HitsByWeek; private int HitsByMonth; private String AddDate; private String ModifyDate; private String JSID; private String TemplateID; private String Fname; private int RefreshTF; private int Recommend; private int Rolls; private int Strip; private int Popular; private int Verific; private int Comment; private int IsTop; private int Score; private int Slide; private int DelTF; private int InfoPurview; private String ArrGroupID; private int ReadPoint; private int ChargeType; private int PitchTime; private int ReadTimes; private int DividePercent; private String Inputer; private String WapTemplateID; private int ShowStyle; private int PageNum; private String MapMarker; private String SEOTitle; private String SEOKeyWord; private String SEODescript; private int Status ; private int SpecialID; public int getID() { return ID; } public void setID(int iD) { ID = iD; } public String getTid() { return Tid; } public void setTid(String tid) { Tid = tid; } public String getKeyWords() { return KeyWords; } public void setKeyWords(String keyWords) { KeyWords = keyWords; } public String getTitle() { return Title; } public void setTitle(String title) { Title = title; } public String getPhotoUrl() { return PhotoUrl; } public void setPhotoUrl(String photoUrl) { PhotoUrl = photoUrl; } public String getPicUrls() { return PicUrls; } public void setPicUrls(String picUrls) { PicUrls = picUrls; } public String getPictureContent() { return PictureContent; } public void setPictureContent(String pictureContent) { PictureContent = pictureContent; } public String getAuthor() { return Author; } public void setAuthor(String author) { Author = author; } public String getOrigin() { return Origin; } public void setOrigin(String origin) { Origin = origin; } public String getRank() { return Rank; } public void setRank(String rank) { Rank = rank; } public String getLastHitsTime() { return LastHitsTime; } public void setLastHitsTime(String lastHitsTime) { LastHitsTime = lastHitsTime; } public int getHits() { return Hits; } public void setHits(int hits) { Hits = hits; } public int getHitsByDay() { return HitsByDay; } public void setHitsByDay(int hitsByDay) { HitsByDay = hitsByDay; } public int getHitsByWeek() { return HitsByWeek; } public void setHitsByWeek(int hitsByWeek) { HitsByWeek = hitsByWeek; } public int getHitsByMonth() { return HitsByMonth; } public void setHitsByMonth(int hitsByMonth) { HitsByMonth = hitsByMonth; } public String getAddDate() { return AddDate; } public void setAddDate(String addDate) { AddDate = addDate; } public String getModifyDate() { return ModifyDate; } public void setModifyDate(String modifyDate) { ModifyDate = modifyDate; } public String getJSID() { return JSID; } public void setJSID(String jSID) { JSID = jSID; } public String getTemplateID() { return TemplateID; } public void setTemplateID(String templateID) { TemplateID = templateID; } public String getFname() { return Fname; } public void setFname(String fname) { Fname = fname; } public int getRefreshTF() { return RefreshTF; } public void setRefreshTF(int refreshTF) { RefreshTF = refreshTF; } public int getRecommend() { return Recommend; } public void setRecommend(int recommend) { Recommend = recommend; } public int getRolls() { return Rolls; } public void setRolls(int rolls) { Rolls = rolls; } public int getStrip() { return Strip; } public void setStrip(int strip) { Strip = strip; } public int getPopular() { return Popular; } public void setPopular(int popular) { Popular = popular; } public int getVerific() { return Verific; } public void setVerific(int verific) { Verific = verific; } public int getComment() { return Comment; } public void setComment(int comment) { Comment = comment; } public int getIsTop() { return IsTop; } public void setIsTop(int isTop) { IsTop = isTop; } public int getScore() { return Score; } public void setScore(int score) { Score = score; } public int getSlide() { return Slide; } public void setSlide(int slide) { Slide = slide; } public int getDelTF() { return DelTF; } public void setDelTF(int delTF) { DelTF = delTF; } public int getInfoPurview() { return InfoPurview; } public void setInfoPurview(int infoPurview) { InfoPurview = infoPurview; } public String getArrGroupID() { return ArrGroupID; } public void setArrGroupID(String arrGroupID) { ArrGroupID = arrGroupID; } public int getReadPoint() { return ReadPoint; } public void setReadPoint(int readPoint) { ReadPoint = readPoint; } public int getChargeType() { return ChargeType; } public void setChargeType(int chargeType) { ChargeType = chargeType; } public int getPitchTime() { return PitchTime; } public void setPitchTime(int pitchTime) { PitchTime = pitchTime; } public int getReadTimes() { return ReadTimes; } public void setReadTimes(int readTimes) { ReadTimes = readTimes; } public int getDividePercent() { return DividePercent; } public void setDividePercent(int dividePercent) { DividePercent = dividePercent; } public String getInputer() { return Inputer; } public void setInputer(String inputer) { Inputer = inputer; } public String getWapTemplateID() { return WapTemplateID; } public void setWapTemplateID(String wapTemplateID) { WapTemplateID = wapTemplateID; } public int getShowStyle() { return ShowStyle; } public void setShowStyle(int showStyle) { ShowStyle = showStyle; } public int getPageNum() { return PageNum; } public void setPageNum(int pageNum) { PageNum = pageNum; } public String getMapMarker() { return MapMarker; } public void setMapMarker(String mapMarker) { MapMarker = mapMarker; } public String getSEOTitle() { return SEOTitle; } public void setSEOTitle(String sEOTitle) { SEOTitle = sEOTitle; } public String getSEOKeyWord() { return SEOKeyWord; } public void setSEOKeyWord(String sEOKeyWord) { SEOKeyWord = sEOKeyWord; } public String getSEODescript() { return SEODescript; } public void setSEODescript(String sEODescript) { SEODescript = sEODescript; } public int getStatus() { return Status; } public void setStatus(int status) { Status = status; } public int getSpecialID() { return SpecialID; } public void setSpecialID(int specialID) { SpecialID = specialID; } }
class Solution { public int[] sortedSquares(int[] A) { int len = A.length; int positivePointer = 0; while (positivePointer < len && A[positivePointer] < 0) { positivePointer++; } int negativePointer = positivePointer - 1; int[] sortedSquares = new int[len]; int counter = 0; while (negativePointer >= 0 && positivePointer < len) { if (A[negativePointer] * A[negativePointer] < A[positivePointer] * A[positivePointer]) { sortedSquares[counter++] = A[negativePointer] * A[negativePointer]; negativePointer--; } else { sortedSquares[counter++] = A[positivePointer] * A[positivePointer]; positivePointer++; } } while (negativePointer >= 0 ) { sortedSquares[counter] = A[negativePointer] * A[negativePointer]; negativePointer--; counter++; } while (positivePointer < len) { sortedSquares[counter] = A[positivePointer] * A[positivePointer]; positivePointer++; counter++; } return sortedSquares; } }
package me.libraryaddict.disguise.disguisetypes.watchers; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import me.libraryaddict.disguise.disguisetypes.Disguise; import me.libraryaddict.disguise.disguisetypes.MetaIndex; import me.libraryaddict.disguise.disguisetypes.FlagWatcher; public class FireworkWatcher extends FlagWatcher { public FireworkWatcher(Disguise disguise) { super(disguise); } public ItemStack getFirework() { if (getData(MetaIndex.FIREWORK_ITEM) == null) { return new ItemStack(Material.AIR); } return (ItemStack) getData(MetaIndex.FIREWORK_ITEM); } public void setFirework(ItemStack newItem) { if (newItem == null) { newItem = new ItemStack(Material.AIR); } newItem = newItem.clone(); newItem.setAmount(1); setData(MetaIndex.FIREWORK_ITEM, newItem); sendData(MetaIndex.FIREWORK_ITEM); } public void setAttachedEntity(int entityId) { setData(MetaIndex.FIREWORK_ATTACHED_ENTITY, entityId); sendData(MetaIndex.FIREWORK_ATTACHED_ENTITY); } public int getAttachedEntity() { return getData(MetaIndex.FIREWORK_ATTACHED_ENTITY); } }
/** * * * BinaryRecursiveSearch: A Recursive Binary Search Algorithm class that implements the Practice03Search interface. * @author svahabi * */ public class BinaryRecursiveSearch implements Practice03Search { /** * search method which sets up basic variables for the recursive binsearch method * @param arr * @param target * @return 0 */ @Override public int search(int[] arr, int target) { int max = arr.length-1; int min = 0; return 0; } /** * binsearch method which runs a recursive Binary Search on the array "arr". * @param arr * @param target * @param min * @param max */ public int binsearch(int[] arr, int target, int min, int max) { int mid = (min + max / 2); if (arr[mid] == target) { return mid; } else if (arr[mid] < target) { return binsearch(arr, target, mid + 1, max); } else { return binsearch(arr, target, min, mid - 1); } } }
package edu.neu.ccs.cs5010; import java.math.BigInteger; import java.util.Random; /** * Created by wenfei on 10/29/17. */ public class RSAKeyGenerator { public static final int certainty = 1000; public static final int keyLength = 64; public static final int publicKeyIndex = 0; public static final int privateKeyIndex = 1; // The bit length is keyBit ~ 2 keyBit public BigInteger publicKey; public BigInteger privateKey; /** * Given a key generator object, return the public key and private key. * * @return the key pair */ public BigInteger[][] generateKey() { RandomNumber rand = new RandomNumber(); Random rnd = new Random(); BigInteger primeP; BigInteger primeQ; BigInteger phi; BigInteger publicN; primeP = new BigInteger(rand.getRandom(keyLength) + keyLength, certainty, rnd); primeQ = new BigInteger(rand.getRandom(keyLength) + keyLength, certainty, rnd); publicN = primeP.multiply(primeQ); phi = primeP.subtract(BigInteger.ONE).multiply(primeQ.subtract(BigInteger.ONE)); do { privateKey = new BigInteger(rand.getRandom(keyLength) + keyLength, rnd); } while (!privateKey.gcd(publicN).equals(BigInteger.ONE) || !privateKey.gcd(phi).equals(BigInteger.ONE)); do { publicKey = privateKey.modInverse(phi); } while (!publicKey.multiply(privateKey).mod(phi).equals(BigInteger.ONE)); BigInteger[][] keyPair = new BigInteger[2][2]; keyPair[publicKeyIndex][0] = publicKey; keyPair[publicKeyIndex][1] = publicN; keyPair[privateKeyIndex][0] = privateKey; keyPair[privateKeyIndex][1] = publicN; return keyPair; } }
package raceclient; import wox.serial.Easy; /** * Created by IntelliJ IDEA. * User: Administrator * Date: Mar 10, 2008 * Time: 6:27:26 PM */ public class HillClimber implements Constants { static final int evaluationRepetitions = 1; static int generations = 5000; public static void main (String[] args) throws Exception { Evaluator evaluator = new SoloDistanceEvaluator (port, address); Evolvable controller; if (args.length > 0) { controller = (Evolvable) Utils.load (args[0]); } else { controller = new MLPController (); } if (args.length > 1) { generations = Integer.parseInt (args[1]); } for (int generation = 0; generation < generations; generation++){ System.out.print (generation + ", current "); double fitness = evaluator.evaluate (controller); System.out.print (fitness + ", challenger "); Evolvable challenger = controller.copy (); challenger.mutate (); double challengerFitness = evaluator.evaluate (challenger); System.out.println(challengerFitness); if (challengerFitness >= fitness) { controller = challenger; if (challengerFitness > fitness) { Easy.save (controller, "best-climbed.xml"); } } } } }
import java.util.concurrent.atomic.AtomicInteger; class Counter { private AtomicInteger cnt; public Counter(int init) { cnt = new AtomicInteger(init); } public void increment() { cnt.incrementAndGet(); } public void decrement() { cnt.decrementAndGet(); } public AtomicInteger value() { return cnt; } }
package com.maliang.core.model; import java.beans.BeanInfo; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.sql.Timestamp; import java.util.Date; import org.bson.types.ObjectId; public class MongodbModel { protected ObjectId id; protected Date createdDate; public ObjectId getId() { return id; } public void setId(ObjectId id) { this.id = id; } // public void setId(String id) { // System.out.println("-------- setId(String id) : " + id); // try { // this.id = new ObjectId(id); // }catch(IllegalArgumentException e){ // this.id = new ObjectId(); // } // } public Date getCreatedDate() { return createdDate; } public void setCreatedDate(Date createdDate) { this.createdDate = createdDate; } public String toString(){ StringBuffer sbf = null; try { BeanInfo beanInfo = Introspector.getBeanInfo(this.getClass()); PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors(); for(PropertyDescriptor pd : pds){ String fieldName = pd.getName(); if(fieldName.equals("class"))continue; Object fieldValue = pd.getReadMethod().invoke(this); if(sbf == null){ sbf = new StringBuffer("{"); }else { sbf.append(","); } sbf.append(fieldName).append("=").append(fieldValue); } } catch (Exception e) { e.printStackTrace(); } if(sbf != null){ sbf.append("}"); return sbf.toString(); } return super.toString(); } }
package at.ac.tuwien.sepm.groupphase.backend.unittests; import at.ac.tuwien.sepm.groupphase.backend.basetest.TestData; import at.ac.tuwien.sepm.groupphase.backend.entity.Category; import at.ac.tuwien.sepm.groupphase.backend.entity.Invoice; import at.ac.tuwien.sepm.groupphase.backend.entity.InvoiceItem; import at.ac.tuwien.sepm.groupphase.backend.entity.InvoiceItemKey; import at.ac.tuwien.sepm.groupphase.backend.entity.InvoiceType; import at.ac.tuwien.sepm.groupphase.backend.entity.Product; import at.ac.tuwien.sepm.groupphase.backend.entity.TaxRate; import at.ac.tuwien.sepm.groupphase.backend.repository.CategoryRepository; import at.ac.tuwien.sepm.groupphase.backend.repository.InvoiceArchivedRepository; import at.ac.tuwien.sepm.groupphase.backend.repository.InvoiceRepository; import at.ac.tuwien.sepm.groupphase.backend.repository.ProductRepository; import at.ac.tuwien.sepm.groupphase.backend.repository.TaxRateRepository; import at.ac.tuwien.sepm.groupphase.backend.service.InvoiceArchiveService; import at.ac.tuwien.sepm.groupphase.backend.service.InvoiceService; import at.ac.tuwien.sepm.groupphase.backend.service.PdfGeneratorService; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringExtension; import java.time.LocalDateTime; import java.util.HashSet; import java.util.Set; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; @ExtendWith(SpringExtension.class) @SpringBootTest @ActiveProfiles("test") class InvoiceArchiveServiceTest implements TestData { private byte[] pdf; private String invoiceNumber; @Autowired InvoiceArchiveService invoiceArchiveService; @Autowired InvoiceService invoiceService; @Autowired private InvoiceRepository invoiceRepository; @Autowired InvoiceArchivedRepository invoiceArchivedRepository; @Autowired private CategoryRepository categoryRepository; @Autowired private TaxRateRepository taxRateRepository; @Autowired private ProductRepository productRepository; @Autowired private PdfGeneratorService pdfGeneratorService; @BeforeEach void beforeEach() { InvoiceItemKey invoiceItemKey = new InvoiceItemKey(); InvoiceItem invoiceItem = new InvoiceItem(); Invoice newInvoice = new Invoice(); Product product = new Product(); Category category = new Category(); TaxRate taxRate = new TaxRate(); invoiceRepository.deleteAll(); product.setId(0L); product.setName(TEST_PRODUCT_NAME); product.setDescription(TEST_PRODUCT_DESCRIPTION); product.setPrice(TEST_PRODUCT_PRICE); category.setId(1L); category.setName(TEST_CATEGORY_NAME); taxRate.setId(1L); taxRate.setPercentage(TEST_TAX_RATE_PERCENTAGE); taxRate.setCalculationFactor((TEST_TAX_RATE_PERCENTAGE/100)+1); // product product.setId(0L); product.setName(TEST_PRODUCT_NAME); product.setDescription(TEST_PRODUCT_DESCRIPTION); product.setPrice(TEST_PRODUCT_PRICE); product.setTaxRate(taxRateRepository.save(taxRate)); product.setCategory(categoryRepository.save(category)); // invoiceItem invoiceItemKey.setInvoiceId(null); invoiceItemKey.setProductId(product.getId()); invoiceItem.setId(invoiceItemKey); invoiceItem.setProduct(productRepository.save(product)); invoiceItem.setNumberOfItems(10); // invoiceItem to invoice Set<InvoiceItem> invoiceItemSet = new HashSet<>(); invoiceItemSet.add(invoiceItem); newInvoice.setItems(invoiceItemSet); newInvoice.setInvoiceNumber(TEST_INVOICE_NUMBER_1); newInvoice.setDate(LocalDateTime.now()); newInvoice.setAmount(TEST_INVOICE_AMOUNT); newInvoice.setInvoiceType(InvoiceType.operator); this.invoiceNumber = newInvoice.getInvoiceNumber(); this.pdf = pdfGeneratorService.createPdfInvoiceOperator(newInvoice); } @Test void createNewInvoiceArchived_thenReturnPdfAsByteArray() { invoiceArchivedRepository.deleteAll(); byte[] savedPdf = this.invoiceArchiveService.createInvoiceArchive(this.invoiceNumber, this.pdf); assertEquals(this.pdf, savedPdf); } @Test void createNewInvoiceArchivedAndFindByInvoiceNumber_thenReturnPdfAsByteArray() { invoiceArchivedRepository.deleteAll(); byte[] savedPdf = this.invoiceArchiveService.createInvoiceArchive(this.invoiceNumber, this.pdf); byte[] foundPdf = this.invoiceArchiveService.findByInvoiceNumber(this.invoiceNumber); assertEquals(this.pdf, savedPdf); assertNotNull(foundPdf); } @Test void createNewInvoiceArchivedAndCheckIfExists_thenReturnBoolean() { invoiceArchivedRepository.deleteAll(); byte[] savedPdf = this.invoiceArchiveService.createInvoiceArchive(this.invoiceNumber, this.pdf); boolean exists = this.invoiceArchiveService.invoiceExistsByInvoiceNumber(this.invoiceNumber); assertEquals(this.pdf, savedPdf); assertTrue(exists); } }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package projecteuler; import java.io.IOException; /** * * @author Sachin tripathi */ public class SumDigits { public static void main(String args[]) throws IOException { int temp = 0; int num =(int) Math.pow(2, 15); while (num != 0) { temp = temp + num % 10; num = num/10; } System.out.println(temp); } }
//jDownloader - Downloadmanager //Copyright (C) 2010 JD-Team support@jdownloader.org // //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 jd.plugins.hoster; import java.io.IOException; import jd.PluginWrapper; import jd.http.Browser.BrowserException; import jd.http.URLConnectionAdapter; import jd.nutils.encoding.Encoding; import jd.plugins.DownloadLink; import jd.plugins.DownloadLink.AvailableStatus; import jd.plugins.HostPlugin; import jd.plugins.LinkStatus; import jd.plugins.PluginException; import jd.plugins.PluginForHost; @HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "videozer.us" }, urls = { "http://(www\\.)?videozerdecrypted\\.us/[A-Za-z0-9\\-_]+\\.html" }) public class VideozerUs extends PluginForHost { public VideozerUs(PluginWrapper wrapper) { super(wrapper); } @Override public String getAGBLink() { return "http://videozer.us/pages/terms-of-agreement.html"; } private String DLLINK = null; private static final boolean supportshttps = true; private static final boolean supportshttps_FORCED = true; /* Special */ private static final boolean free_video_RESUME = true; private static final int free_video_MAXCHUNKS = 0; @SuppressWarnings("deprecation") @Override public void correctDownloadLink(final DownloadLink link) { /* link cleanup, but respect users protocol choosing or forced protocol */ if (!supportshttps) { link.setUrlDownload(link.getDownloadURL().replaceFirst("https://", "http://")); } else if (supportshttps && supportshttps_FORCED) { link.setUrlDownload(link.getDownloadURL().replaceFirst("http://", "https://")); } /* Fix decrypted links */ link.setUrlDownload(link.getDownloadURL().replaceFirst("videozerdecrypted.us/", "videozer.us/")); } @SuppressWarnings("deprecation") public AvailableStatus requestFileInformation(final DownloadLink link) throws IOException, PluginException { this.setBrowserExclusive(); br.setFollowRedirects(true); String filename = null; String filesize = null; if (link.getBooleanProperty("offline", false)) { throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND); } br.getPage(link.getDownloadURL()); if (!br.containsHTML("id=\"video\\-player\"")) { throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND); } filename = br.getRegex("itemprop=\"name\">([^<>]*?)<").getMatch(0); DLLINK = br.getRegex("file: \\'(http[^<>\"]*?)\\'").getMatch(0); if (DLLINK == null) { DLLINK = br.getRegex("(https?://(www\\.)?videozer\\.us/uploads/videos/[A-Za-z0-9\\-_]+\\.mp4)").getMatch(0); } if (filename == null || DLLINK == null) { throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT); } filename = Encoding.htmlDecode(filename).trim(); filename += ".mp4"; filename = encodeUnicode(filename); link.setFinalFileName(filename); URLConnectionAdapter con = null; try { try { try { /* @since JD2 */ con = br.openHeadConnection(DLLINK); } catch (final Throwable t) { /* Not supported in old 0.9.581 Stable */ con = br.openGetConnection(DLLINK); } } catch (final BrowserException e) { throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND); } if (!con.getContentType().contains("html")) { link.setDownloadSize(con.getLongContentLength()); } else { throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND); } } finally { try { con.disconnect(); } catch (final Throwable e) { } } return AvailableStatus.TRUE; } @Override public void handleFree(final DownloadLink downloadLink) throws Exception, PluginException { requestFileInformation(downloadLink); doFree(downloadLink); } public void doFree(final DownloadLink downloadLink) throws Exception, PluginException { dl = jd.plugins.BrowserAdapter.openDownload(br, downloadLink, DLLINK, free_video_RESUME, free_video_MAXCHUNKS); if (dl.getConnection().getContentType().contains("html")) { if (dl.getConnection().getResponseCode() == 403) { throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Server error 403", 60 * 60 * 1000l); } else if (dl.getConnection().getResponseCode() == 404) { throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Server error 404", 60 * 60 * 1000l); } logger.warning("Finallink doesnt lead to a file"); br.followConnection(); throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT); } /* Do not save finallinks for video urls. */ dl.startDownload(); } @Override public int getMaxSimultanFreeDownloadNum() { return 0; } @Override public void reset() { } @Override public void resetDownloadlink(DownloadLink link) { } }
package io.fabiandev.validator; import io.fabiandev.validator.contracts.Field; import io.fabiandev.validator.contracts.Rule; import io.fabiandev.validator.core.InputField; import io.fabiandev.validator.core.RulesManager; import io.fabiandev.validator.mock.TestRule1; import io.fabiandev.validator.mock.TestRule2; import org.junit.Before; import org.junit.Test; import java.util.HashMap; import java.util.Map; import static org.junit.Assert.*; public class RulesManagerTest { private static final String RULES_PACKAGE = "io.fabiandev.validator.mock"; @Before public void beforeEach() { RulesManager.reset(); } @Test public void testAddRule() { RulesManager.addRule(TestRule1.class); assertEquals(1, RulesManager.numRules()); assertTrue(RulesManager.hasRule("test_rule1")); } @Test public void testAddRules() { RulesManager.addRules(TestRule1.class, TestRule2.class); assertEquals(2, RulesManager.numRules()); assertTrue(RulesManager.hasRule("test_rule1")); assertTrue(RulesManager.hasRule("test_rule2")); } @Test public void testAddRulesFromPackage() { RulesManager.addRulesFromPackage(RULES_PACKAGE); assertEquals(2, RulesManager.numRules()); assertTrue(RulesManager.hasRule("test_rule1")); assertTrue(RulesManager.hasRule("test_rule2")); } @Test public void testAddRulesFromNonExistingPackage() { RulesManager.addRulesFromPackage(String.format("%s.%s", RULES_PACKAGE, "404")); assertEquals(0, RulesManager.numRules()); } @Test public void testMakeRule() { RulesManager.addRulesFromPackage(RULES_PACKAGE); Map<String, Field> inputFields = new HashMap<String, Field>(); Field field1 = new InputField("key"); Field field2 = new InputField("key", "value"); inputFields.put(field1.getKey(), field1); inputFields.put(field2.getKey(), field2); Rule rule1 = RulesManager.make("test_rule1", null, inputFields, field1.getKey()); Rule rule2 = RulesManager.make("test_rule2", "someValue", inputFields, field2.getKey(), ":field rule value is :test_rule2"); assertTrue(rule1 instanceof TestRule1); assertTrue(rule2 instanceof TestRule2); assertEquals("test_rule1", rule1.toString()); assertEquals("test_rule2", rule2.toString()); assertEquals(null, rule1.getValue()); assertEquals("someValue", rule2.getValue()); assertEquals(rule1.getDefaultMessage(), rule1.getUnparsedMessage()); assertEquals(":field rule value is :test_rule2", rule2.getUnparsedMessage()); } }
/* * SeparatePlugin.java * * Created on July 31, 2010 * */ package net.maizegenetics.analysis.data; import net.maizegenetics.dna.snp.GenotypeTable; import net.maizegenetics.dna.snp.FilterGenotypeTable; import net.maizegenetics.trait.MarkerPhenotype; import net.maizegenetics.trait.Phenotype; import net.maizegenetics.dna.map.Chromosome; import net.maizegenetics.plugindef.AbstractPlugin; import net.maizegenetics.plugindef.DataSet; import net.maizegenetics.plugindef.Datum; import net.maizegenetics.plugindef.PluginEvent; import org.apache.log4j.Logger; import javax.swing.*; import java.awt.*; import java.net.URL; import java.util.ArrayList; import java.util.List; /** * * @author terry */ public class SeparatePlugin extends AbstractPlugin { private static final Logger myLogger = Logger.getLogger(SeparatePlugin.class); private String[] myChromosomesToSeparate = null; /** * Creates a new instance of SeparatePlugin */ public SeparatePlugin(Frame parentFrame, boolean isInteractive) { super(parentFrame, isInteractive); } public DataSet performFunction(DataSet input) { try { List<Datum> inputs = input.getDataSet(); List<DataSet> result = new ArrayList<DataSet>(); for (Datum current : inputs) { Object currentValue = current.getData(); if (currentValue instanceof MarkerPhenotype) { MarkerPhenotype mp = (MarkerPhenotype) currentValue; Phenotype pheno = mp.getPhenotype(); String phenoName = current.getName() + "_pheno"; Datum phenoDatum = new Datum(phenoName, pheno, null); GenotypeTable align = mp.getAlignment(); String alignName = current.getName() + "_align"; Datum alignDatum = new Datum(alignName, align, null); DataSet tds = new DataSet(new Datum[]{phenoDatum, alignDatum}, this); result.add(tds); } else if (currentValue instanceof GenotypeTable) { List<Datum> alignments = separateAlignmentIntoLoci((GenotypeTable) currentValue, current.getName(), myChromosomesToSeparate); if (alignments.size() > 0) { DataSet tds = new DataSet(alignments, this); result.add(tds); } } } if (result.isEmpty()) { if (isInteractive()) { JOptionPane.showMessageDialog(getParentFrame(), "Nothing to Separate"); } else { myLogger.warn("performFunction: Nothing to Separate."); } return null; } else { DataSet resultDataSet = DataSet.getDataSet(result, this); fireDataSetReturned(new PluginEvent(resultDataSet, SeparatePlugin.class)); return resultDataSet; } } finally { fireProgress(100); } } public static List<Datum> separateAlignmentIntoLoci(GenotypeTable alignment, String dataSetName) { return separateAlignmentIntoLoci(alignment, dataSetName, null); } public static List<Datum> separateAlignmentIntoLoci(GenotypeTable alignment, String dataSetName, String[] chromosomesToSeparate) { List<Datum> result = new ArrayList<Datum>(); GenotypeTable[] alignments = alignment.compositeAlignments(); for (int i = 0; i < alignments.length; i++) { int[] offsets = alignments[i].chromosomesOffsets(); if (offsets.length > 1) { Chromosome[] loci = alignments[i].chromosomes(); for (int j = 0; j < offsets.length; j++) { if (alignmentInList(loci[j], chromosomesToSeparate)) { String name; if (dataSetName == null) { name = "Alignment_chrom" + loci[j]; } else { name = dataSetName + "_chrom" + loci[j]; } int endSite; try { endSite = offsets[j + 1] - 1; } catch (Exception e) { endSite = alignments[i].numberOfSites() - 1; } Datum td = new Datum(name, FilterGenotypeTable.getInstance(alignments[i], offsets[j], endSite), null); result.add(td); } } } else { if ((alignments.length > 1) && (alignmentInList(alignments[i].chromosomes()[0], chromosomesToSeparate))) { String name; if (dataSetName == null) { name = "Alignment_chrom" + alignments[i].chromosome(0); } else { name = dataSetName + "_chrom" + alignments[i].chromosome(0); } Datum td = new Datum(name, alignments[i], null); result.add(td); } } } return result; } private static boolean alignmentInList(Chromosome locus, String[] chromosomesToSeparate) { if (chromosomesToSeparate == null) { return true; } String currentChr = locus.getName(); for (int i = 0; i < chromosomesToSeparate.length; i++) { if (currentChr.equalsIgnoreCase(chromosomesToSeparate[i])) { return true; } } return false; } public void setChromosomesToSeparate(String[] chrs) { myChromosomesToSeparate = new String[chrs.length]; for (int i = 0; i < chrs.length; i++) { myChromosomesToSeparate[i] = chrs[i].trim(); } } /** * Icon for this plugin to be used in buttons, etc. * * @return ImageIcon */ @Override public ImageIcon getIcon() { URL imageURL = SeparatePlugin.class.getResource("/net/maizegenetics/analysis/images/Separate.gif"); if (imageURL == null) { return null; } else { return new ImageIcon(imageURL); } } /** * Button name for this plugin to be used in buttons, etc. * * @return String */ @Override public String getButtonName() { return "Separate"; } /** * Tool Tip Text for this plugin * * @return String */ @Override public String getToolTipText() { return "Separate Data (i.e. into Chromosomes)"; } }
import java.util.*; class shaurya { public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.println("enter the size of array"); int n=sc.nextInt(); int moves=0; int[] arr=new int[n]; arr[0]=sc.nextInt(); for(int x=1;x<n;x++) { arr[x]=sc.nextInt(); if(arr[x]<arr[x-1]) { int diff=arr[x-1]-arr[x]; moves=moves+diff; } } System.out.println(moves); } }
package com.example.tmbdmovies.Responses; import com.example.tmbdmovies.Modals.PopularMovieModal; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import java.util.List; //This class is used to getting multiple movies (movies list) -> Popular Movies list public class SearchMovieResponse { @SerializedName("total_results") @Expose() private int total_count; @SerializedName("results") @Expose() private List<PopularMovieModal> movies; public int getTotal_count() { return total_count; } public List<PopularMovieModal> getMovies() { return movies; } @Override public String toString() { return "SearchMovieResponse{" + "total_count=" + total_count + ", movies=" + movies + '}'; } }
package com.dream.activity; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Toast; import com.dream.R; public class CreateDream2Activity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dream_create2); findViewById(R.id.bt_pre).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); findViewById(R.id.bt_fb).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getApplicationContext(),"发布成功",Toast.LENGTH_SHORT).show(); finish(); } }); } }
package com.bwie.juan_mao.jingdong_kanglijuan.widget; import android.content.Context; import android.support.annotation.Nullable; import android.support.v7.widget.RecyclerView; import android.util.AttributeSet; import android.view.View; /** * Created by 卷猫~ on 2018/11/9. */ public class MyRecyclerView extends RecyclerView { public MyRecyclerView(Context context) { this(context, null); } public MyRecyclerView(Context context, @Nullable AttributeSet attrs) { this(context, attrs, 0); } public MyRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override protected void onMeasure(int widthSpec, int heightSpec) { int h = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthSpec, h); } }
package de.hdm.softwarepraktikum.shared; import java.sql.Timestamp; import java.util.ArrayList; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; import de.hdm.softwarepraktikum.shared.bo.Item; import de.hdm.softwarepraktikum.shared.bo.ListItem; import de.hdm.softwarepraktikum.shared.bo.Store; import de.hdm.softwarepraktikum.shared.bo.Group; import de.hdm.softwarepraktikum.shared.bo.Person; import de.hdm.softwarepraktikum.shared.bo.Responsibility; import de.hdm.softwarepraktikum.shared.bo.ShoppingList; import de.hdm.softwarepraktikum.shared.report.ItemsByGroupReport; import de.hdm.softwarepraktikum.shared.report.ItemsByPersonReport; /** * Interface fuer den Reportgenerator * Der ReportGenerator ist angelegt, um verschiende Reports zu erstellen, die * eine bestimmte Anzahl von Daten des Systems zweckspezifisch darstellen. * @author Luca Randecker * @version 1.0 * @see ReportGeneratorAsync */ @RemoteServiceRelativePath("reportGenerator") public interface ReportGenerator extends RemoteService { /** * @see de.hdmsoftwarepraktikum.server.report.ReportGeneratorImpl#init(); */ public void init(); /** * @see * @param id * @return * @throws IllegalArgumentException */ //public ShoppingListAdministration getShoppingListAdministration(int id) throws IllegalArgumentException; /** * Diese Methode gibt die Einkaufsstatistik f�r eine Gruppe aus. * @param a * @return alle eingekauften Produkte einer Gruppe * @throws IllegalArgumentException */ ArrayList<Item> getAllItems() throws IllegalArgumentException; /** * @see de.hdm.softwarepraktikum.server.report.ReportGeneratorImpl#getAllStores * @param id * @return * @throws IllegalArgumentException */ public ArrayList<Store> getAllStores() throws IllegalArgumentException; public ArrayList<Group> getAllGroups(Person p) throws IllegalArgumentException; public ArrayList<Person> getAllPersons() throws IllegalArgumentException; void AddImprint(); public ItemsByPersonReport getReportOfPerson(Person p, Store s, Group g) throws IllegalArgumentException; public ItemsByPersonReport getReportOfPersonBetweenDates(Person p, Store s, Group g, Timestamp from, Timestamp to) throws IllegalArgumentException; public ItemsByGroupReport getReportOfGroup(Boolean filterPerson, Person p, Group g, Store s) throws IllegalArgumentException; ItemsByGroupReport getReportOfGroupBetweenDates(Boolean filterPerson, Person p,Group g, Store s, Timestamp from, Timestamp to) throws IllegalArgumentException; }
/****************************************************************************** * __ * * <-----/@@\-----> * * <-< < \\// > >-> * * <-<-\ __ /->-> * * Data / \ Crow * * ^ ^ * * info@datacrow.net * * * * This file is part of Data Crow. * * Data Crow 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 any later version. * * * * Data Crow 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 net.datacrow.console.windows.datepicker; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.GregorianCalendar; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.DefaultComboBoxModel; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JPanel; import net.datacrow.console.ComponentFactory; import net.datacrow.core.IconLibrary; import net.datacrow.core.resources.DcResources; public class NavigationPanel extends JPanel implements ActionListener { private DatePickerDialog parent; private JComboBox monthBox; private JComboBox yearBox; private Box box; private static String[] months; private static Integer[] years; public NavigationPanel(DatePickerDialog parent) { this.parent = parent; setLayout(new BorderLayout()); JButton btPreviousYr = ComponentFactory.getIconButton(IconLibrary._icoArrowUp); btPreviousYr.setToolTipText(DcResources.getText("lblPreviousYear")); btPreviousYr.addActionListener(this); btPreviousYr.setActionCommand("prevYear"); JButton btPreviousMt = ComponentFactory.getIconButton(IconLibrary._icoArrowUp); btPreviousMt.setToolTipText(DcResources.getText("lblPreviousMonth")); btPreviousMt.addActionListener(this); btPreviousMt.setActionCommand("prevMonth"); JButton btNextMt = ComponentFactory.getIconButton(IconLibrary._icoArrowDown); btNextMt.setToolTipText(DcResources.getText("lblNextMonth")); btNextMt.addActionListener(this); btNextMt.setActionCommand("nextMonth"); JButton btNextYr = ComponentFactory.getIconButton(IconLibrary._icoArrowDown); btNextYr.setToolTipText(DcResources.getText("lblNextYear")); btNextYr.addActionListener(this); btNextYr.setActionCommand("nextYear"); Box box = new Box(BoxLayout.X_AXIS); box.add(btPreviousMt); box.add(Box.createHorizontalStrut(3)); box.add(btNextMt); add(box, BorderLayout.WEST); box = new Box(BoxLayout.X_AXIS); box.add(btPreviousYr); box.add(Box.createHorizontalStrut(3)); box.add(btNextYr); add(box, BorderLayout.EAST); setCurrentMonth(parent.getCalendar()); } public void setCurrentMonth(Calendar c) { setMonthComboBox(c); setYearComboBox(c); if(box == null) { box = new Box(BoxLayout.X_AXIS); box.add(monthBox); box.add(yearBox); add(box,BorderLayout.CENTER); } } private void setMonthComboBox(Calendar c) { if (months == null) { SimpleDateFormat mf = new SimpleDateFormat("MMMMM"); Calendar cal = Calendar.getInstance(); cal.set(Calendar.DAY_OF_MONTH, 1); months = new String[12]; for(int i = 0; i < 12; i++) { cal.set(Calendar.MONTH, i); months[i]= mf.format(cal.getTime()); } } if (monthBox == null) { monthBox = ComponentFactory.getComboBox(); monthBox.addActionListener(this); monthBox.setActionCommand("monthChanged"); } monthBox.setModel(new DefaultComboBoxModel(months)); monthBox.setSelectedIndex(c.get(Calendar.MONTH)); } private void setYearComboBox(Calendar c) { int y = c.get(Calendar.YEAR); years = new Integer[101]; for(int i = y - 50, j = 0; i <= y+50; i++, j++) { years[j] = i; } if (yearBox == null) { yearBox = ComponentFactory.getComboBox(); yearBox.addActionListener(this); yearBox.setActionCommand("yearChanged"); } yearBox.setModel(new DefaultComboBoxModel(years)); yearBox.setSelectedItem(years[50]); } public void clear() { parent = null; monthBox = null; yearBox = null; box = null; } @Override public void actionPerformed(ActionEvent e) { Object src = e.getSource(); Calendar c = new GregorianCalendar(); c.setTime(parent.getCalendar().getTime()); if (e.getSource() instanceof JButton) { if (e.getActionCommand().equals("prevMonth")) c.add(Calendar.MONTH, -1); if (e.getActionCommand().equals("nextMonth")) c.add(Calendar.MONTH, 1); if (e.getActionCommand().equals("prevYear")) c.add(Calendar.YEAR, -1); if (e.getActionCommand().equals("nextYear")) c.add(Calendar.YEAR, 1); parent.updateScreen(c); } else { if (e.getActionCommand().equals("monthChanged")) { JComboBox cb = (JComboBox)src; c.set(Calendar.MONTH, cb.getSelectedIndex()); } if (e.getActionCommand().equals("yearChanged")) { JComboBox cb = (JComboBox)src; c.set(Calendar.YEAR, years[cb.getSelectedIndex()].intValue()); setYearComboBox(c); } parent.setMonthPanel(c); } } }
package loggingServiceTest; import java.io.FileWriter; import org.junit.Test; import org.mockito.Mock; import org.mockito.Mockito.*; public class LoggingServiceTest { @Test public void addMessage_withMockedWriter_returnTrue(){ //Arrage FileWriter writer = mock(FileWriter.class); } }
package com.datastax.poc.log.utils; /** * Created by Patrick on 12/10/15. */ public abstract class Env { public static String getString(String name, String defaultValue) { String value = System.getenv(name); if (value == null) { value = defaultValue; } System.out.println(String.format("%s: %s", name, value)); return value; } public static int getInt(String name, int defaultValue) { String value = System.getenv(name); if (value == null) { value = String.valueOf(defaultValue); } System.out.println(String.format("%s: %s", name, value)); return Integer.parseInt(value); } }
/* * 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.ok.sudoku.puzzle; import java.util.Arrays; /** * * @author okan */ public class Puzzle implements Prototype { private int[][] puzzle; public Puzzle(int[][] puzzle) { this.puzzle=puzzle; } public Puzzle clone () { int[][] copy = new int[puzzle.length][]; for (int i = 0; i < puzzle.length; i++) { copy[i] = Arrays.copyOf(puzzle[i], puzzle[i].length); } return new Puzzle(copy); } public int[][] getPuzzle() { return puzzle; } public void setPuzzle(int[][] puzzle) { this.puzzle = puzzle; } }
package com.example.myapplication; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; public class PagerAdapter extends FragmentPagerAdapter { private int numeroDiTab = 2; public PagerAdapter(FragmentManager fm){ super(fm); } @Override public Fragment getItem(int position){ switch (position){ case 0 : return new FragPreferiti(); case 1 : return new FragGrafico(); default : return null; } } @Override public int getCount(){ return numeroDiTab; } public int getItemTabNameResourceId(int position){ switch(position){ case 0 : return R.string.tab_preferiti; case 1: return R.string.tab_grafico; default : return R.string.tab_unknown; } } }
package by.pvt.herzhot.pojos.impl; import by.pvt.herzhot.pojos.IEntity; import java.util.HashSet; import java.util.Set; /** * @author Herzhot * @version 1.0 * 09.05.2016 */ public class NewsCategory implements IEntity { private static final long serialVersionUID = 1L; private int id; private String category; private Set<News> newses = new HashSet<>(); public NewsCategory() { category = ""; } public NewsCategory(String category, Set<News> newses) { this.category = category; this.newses = newses; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; NewsCategory newsCategory = (NewsCategory) o; return id == newsCategory.id; } @Override public int hashCode() { return category != null ? category.hashCode() : 0; } @Override public String toString() { return "NewsCategory{" + "id=" + id + ", category='" + category + '\'' + '}'; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } public Set<News> getNewses() { return newses; } public void setNewses(Set<News> newses) { this.newses = newses; } }
package tmelo.utils; import org.springframework.util.StringUtils; /** * Utility class used to perform spelling operation on numbers. * * @author Thiago Melo * */ public class NumberSpelling { public static String spellNumber(int numberValue) { String resp = null; int div = numberValue/1000; int rem = numberValue%1000; // number less then 1000 if (div == 0) { resp = numberLessThenThousand(numberValue); } else { // if number bigger then 100 then spell thousand if (rem == 0) { resp = numberLessThenThousand(div)+" thousand"; } else { resp = numberLessThenThousand(div)+" thousand, "+numberLessThenThousand(rem); } } return StringUtils.capitalize(resp); } /** * Return text from numbers less then 20. * * @param teenNumber * @return */ private static String teenNumberText(int teenNumber) { String result = null; switch (teenNumber) { case 0: result = "zero"; break; case 1: result = "one"; break; case 2: result = "two"; break; case 3: result = "three"; break; case 4: result = "four"; break; case 5: result = "five"; break; case 6: result = "six"; break; case 7: result = "seven"; break; case 8: result = "eight"; break; case 9: result = "nine"; break; case 10: result = "ten"; break; case 11: result = "eleven"; break; case 12: result = "twelve"; break; case 13: result = "thirteen"; break; case 14: result = "fourteen"; break; case 15: result = "fifteen"; break; case 16: result = "sixteen"; break; case 17: result = "seventeen"; break; case 18: result = "eighteen"; break; case 19: result = "nineteen"; } return result; } /** * Return the tens text of the numbers. * * @param tenNumber * @return */ private static String tensNumberText(int tenNumber) { String resp = null; switch (tenNumber) { case 1: resp = "ten"; break; case 2: resp = "twenty"; break; case 3: resp = "thirty"; break; case 4: resp = "forty"; break; case 5: resp = "fifty"; break; case 6: resp = "sixty"; break; case 7: resp = "seventy"; break; case 8: resp = "eighty"; break; case 9: resp = "ninety"; break; } return resp; } public static void main(String[] args) { int[] numerosTeste = {999999, 151000, 787321, 1900, 300000}; for (int numero : numerosTeste) { System.out.println("## spelling "+numero+" ==> "+NumberSpelling.spellNumber(numero)); } } /** * Return the text of a value less then 1000. * * @param numberValue * the number (< 1000) to be spelled. * @return text of the numberValue. */ private static String numberLessThenThousand(int numberValue) { // if number is less then 20 then get the text within teenNumberText method. if (numberValue < 20) { return teenNumberText(numberValue); } else if (numberValue < 100) { // otherwise, verify number until 99 int div = numberValue / 10; int rem = numberValue % 10; if (rem == 0) { // spell only the integer part. return tensNumberText(div); } else { // spell both integer and decimal part return tensNumberText(div) + " " + teenNumberText(rem); } } else { // otherwise, verify number greater then 99 and multiplus of 100. int div = numberValue / 100; int rem = numberValue % 100; if (rem == 0) { return teenNumberText(div) + " hundred"; } else { return teenNumberText(div) + " hundred " + numberLessThenThousand(rem); } } } }
package com.blibli.oss.backend.command.exception; import lombok.Getter; import javax.validation.ConstraintViolation; import java.util.Set; public class CommandValidationException extends CommandRuntimeException { @Getter private Set<ConstraintViolation<?>> constraintViolations; public CommandValidationException(Set constraintViolations) { this(null, constraintViolations); } public CommandValidationException(String message, Set constraintViolations) { super(message); this.constraintViolations = constraintViolations; } }
package com.esum.framework.core.queue; import javax.jms.JMSException; import javax.naming.NamingException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.esum.framework.FrameworkSystemVariables; import com.esum.framework.core.component.ComponentConstants; import com.esum.framework.core.config.Configurator; import com.esum.framework.core.exception.FrameworkException; import com.esum.framework.core.queue.mq.impl.HornetQTopicHandler; /** * QueueHandlerFactory. */ public class TopicHandlerFactory { private static TopicHandlerFactory instance; public static final String CONFIG_QUEUE_HANDLER_ID = "CONFIG_QUEUE_HANDLER_ID"; private Configurator configurator; private String nodeType = ComponentConstants.LOCATION_TYPE_MAIN; public static TopicHandlerFactory getInstance(){ if(instance==null) instance = new TopicHandlerFactory(); return instance; } private TopicHandlerFactory() { nodeType = System.getProperty(FrameworkSystemVariables.NODE_TYPE); } /** * QueueHandler 생성에 있어서 현재 노드가 MAIN노드 인지를 리턴한다. */ public boolean isMainNodeType(){ return nodeType.equals(ComponentConstants.LOCATION_TYPE_MAIN); } public void setMainNodeType(String nodeType) { this.nodeType = nodeType; } public static JmsMessageHandler getTopicHandler(String topicName) throws FrameworkException, JMSException, NamingException { return getTopicHandler(CONFIG_QUEUE_HANDLER_ID, topicName); } public static JmsMessageHandler getTopicHandler(String configId, String topicName) throws FrameworkException, JMSException, NamingException { if(instance==null) instance = new TopicHandlerFactory(); return instance.createTopicHandler(configId, topicName); } /** * Create a Topic Handler. */ private synchronized JmsMessageHandler createTopicHandler(String configId, String queueName) throws FrameworkException, JMSException, NamingException { return new HornetQTopicHandler(configId, queueName); } }
public class Player { private String name; private Die[] die; private Board board; private Piece piece; public void takeTurn(){ int fv = 0; for(int i = 0 ; i<die.length ; i++){ die[i].roll(); fv+= die[i].getFaceValue(); } Square oldLoc = piece.getLocatin(); Square newLoc = board.getSquare(oldLoc,fv); piece.setLocatin(newLoc); } }
package edu.miu.model; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import lombok.ToString; import java.util.Arrays; import java.util.List; /** * @author Rimon Mostafiz */ @Data @ToString @NoArgsConstructor @AllArgsConstructor @JsonIgnoreProperties(ignoreUnknown = true) public class Credit { private Long movieId; private String title; private List<Cast> castList; private List<Crew> crewList; public static Credit of(String[] row) { Credit credit = new Credit(); try { ObjectMapper mapper = new ObjectMapper(); credit.setMovieId(Long.valueOf(row[0])); credit.setTitle(row[1]); credit.setCastList(Arrays.asList(mapper.readValue(row[2], Cast[].class))); credit.setCrewList(Arrays.asList(mapper.readValue(row[3], Crew[].class))); } catch (Exception ex) { System.out.println("Error while creating credit object {}"); ex.printStackTrace(System.out); } return credit; } }
package com.taobrother.exercise.web.advice; import com.taobrother.exercise.web.exception.InvalidUserException; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; @ControllerAdvice public class ExceptionHandlerAdvice { @ExceptionHandler(value = {InvalidUserException.class}) ResponseEntity<Object> handleInvalidUserException(InvalidUserException ex){ return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(ex.getMessage()); } }
package ua.opu.contactlist; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.Manifest; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; import android.view.View; import android.view.Window; import android.view.WindowManager; import com.google.android.material.floatingactionbutton.FloatingActionButton; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity implements ReportAdapter.DeleteItemListener { private static final int ADD_CONTACT_REQUEST_CODE = 5556; private RecyclerView mRecyclerView; private FloatingActionButton mAddContactButton; private List<Item> list = new ArrayList<>(); private ReportAdapter adapter; @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == ADD_CONTACT_REQUEST_CODE && resultCode == RESULT_OK && data != null) { String name = data.getStringExtra(Intent.EXTRA_USER); String email = data.getStringExtra(Intent.EXTRA_PHONE_NUMBER); String amount = data.getStringExtra(Intent.EXTRA_PHONE_NUMBER); list.add(new Item(name, email, amount)); adapter.notifyDataSetChanged(); } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setWindow(); mRecyclerView = findViewById(R.id.list); mAddContactButton = findViewById(R.id.fab); mAddContactButton.setOnClickListener(v -> { Intent i = new Intent(this, AddReportActivity.class); startActivityForResult(i, ADD_CONTACT_REQUEST_CODE); }); mRecyclerView = findViewById(R.id.list); mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); adapter = new ReportAdapter(getApplicationContext(), list, this); mRecyclerView.setAdapter(adapter); } private void setWindow() { // Метод устанавливает StatusBar в цвет фона Window window = this.getWindow(); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(getColor(R.color.activity_background)); View decor = getWindow().getDecorView(); decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); } private static final int REQUEST_EXTERNAL_STORAGE = 1; private static final String[] PERMISSIONS_STORAGE = { Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE }; public void verifyStoragePermissions() { // Проверяем наличие разрешения на запись во внешнее хранилище int permission = ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE); if (permission != PackageManager.PERMISSION_GRANTED) { // Запрашиваем разрешение у пользователя ActivityCompat.requestPermissions( this, PERMISSIONS_STORAGE, REQUEST_EXTERNAL_STORAGE ); } } @Override protected void onStart() { super.onStart(); verifyStoragePermissions(); } @Override public void onDeleteItem(int position) { list.remove(position); adapter.notifyDataSetChanged(); } }
/* * Copyright (C) 2016-2022 crDroid Android Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.crdroid.settings.fragments; import android.app.Activity; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.os.Bundle; import android.os.UserHandle; import android.provider.SearchIndexableResource; import android.provider.Settings; import android.view.View; import androidx.preference.ListPreference; import androidx.preference.Preference; import androidx.preference.PreferenceScreen; import androidx.preference.Preference.OnPreferenceChangeListener; import androidx.preference.SwitchPreference; import com.android.internal.logging.nano.MetricsProto; import com.android.settings.R; import com.android.settings.SettingsPreferenceFragment; import com.crdroid.settings.preferences.SystemSettingListPreference; import com.android.settings.search.BaseSearchIndexProvider; import com.android.settingslib.search.SearchIndexable; import com.crdroid.settings.fragments.statusbar.BatteryBar; import com.crdroid.settings.fragments.statusbar.Clock; import com.crdroid.settings.fragments.statusbar.NetworkTrafficSettings; import com.crdroid.settings.preferences.SystemSettingSeekBarPreference; import com.crdroid.settings.utils.DeviceUtils; import com.crdroid.settings.utils.TelephonyUtils; import lineageos.preference.LineageSystemSettingListPreference; import lineageos.providers.LineageSettings; import java.util.List; @SearchIndexable public class StatusBar extends SettingsPreferenceFragment implements Preference.OnPreferenceChangeListener { public static final String TAG = "StatusBar"; private static final String STATUS_BAR_CLOCK_STYLE = "status_bar_clock"; private static final String QUICK_PULLDOWN = "qs_quick_pulldown"; private static final String KEY_SHOW_ROAMING = "roaming_indicator_icon"; private static final String KEY_SHOW_FOURG = "show_fourg_icon"; private static final String KEY_SHOW_DATA_DISABLED = "data_disabled_icon"; private static final String KEY_USE_OLD_MOBILETYPE = "use_old_mobiletype"; private static final String KEY_STATUS_BAR_SHOW_BATTERY_PERCENT = "status_bar_show_battery_percent"; private static final String KEY_STATUS_BAR_BATTERY_STYLE = "status_bar_battery_style"; private static final String KEY_STATUS_BAR_BATTERY_TEXT_CHARGING = "status_bar_battery_text_charging"; private static final int PULLDOWN_DIR_NONE = 0; private static final int PULLDOWN_DIR_RIGHT = 1; private static final int PULLDOWN_DIR_LEFT = 2; private static final int PULLDOWN_DIR_ALWAYS = 3; private static final int BATTERY_STYLE_PORTRAIT = 0; private static final int BATTERY_STYLE_TEXT = 4; private static final int BATTERY_STYLE_HIDDEN = 5; private LineageSystemSettingListPreference mStatusBarClock; private LineageSystemSettingListPreference mQuickPulldown; private SystemSettingListPreference mBatteryPercent; private SystemSettingListPreference mBatteryStyle; private SwitchPreference mShowRoaming; private SwitchPreference mShowFourg; private SwitchPreference mDataDisabled; private SwitchPreference mOldMobileType; private SwitchPreference mBatteryTextCharging; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.crdroid_settings_statusbar); ContentResolver resolver = getActivity().getContentResolver(); Context mContext = getActivity().getApplicationContext(); final PreferenceScreen prefScreen = getPreferenceScreen(); mStatusBarClock = (LineageSystemSettingListPreference) findPreference(STATUS_BAR_CLOCK_STYLE); // Adjust status bar preferences for RTL if (getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) { if (DeviceUtils.hasCenteredCutout(mContext)) { mStatusBarClock.setEntries(R.array.status_bar_clock_position_entries_notch_rtl); mStatusBarClock.setEntryValues(R.array.status_bar_clock_position_values_notch_rtl); } else { mStatusBarClock.setEntries(R.array.status_bar_clock_position_entries_rtl); mStatusBarClock.setEntryValues(R.array.status_bar_clock_position_values_rtl); } } else if (DeviceUtils.hasCenteredCutout(mContext)) { mStatusBarClock.setEntries(R.array.status_bar_clock_position_entries_notch); mStatusBarClock.setEntryValues(R.array.status_bar_clock_position_values_notch); } mShowRoaming = (SwitchPreference) findPreference(KEY_SHOW_ROAMING); mShowFourg = (SwitchPreference) findPreference(KEY_SHOW_FOURG); mDataDisabled = (SwitchPreference) findPreference(KEY_SHOW_DATA_DISABLED); mOldMobileType = (SwitchPreference) findPreference(KEY_USE_OLD_MOBILETYPE); if (!TelephonyUtils.isVoiceCapable(getActivity())) { prefScreen.removePreference(mShowRoaming); prefScreen.removePreference(mShowFourg); prefScreen.removePreference(mDataDisabled); prefScreen.removePreference(mOldMobileType); } else { boolean mConfigUseOldMobileType = mContext.getResources().getBoolean( com.android.internal.R.bool.config_useOldMobileIcons); boolean showing = Settings.System.getIntForUser(resolver, Settings.System.USE_OLD_MOBILETYPE, mConfigUseOldMobileType ? 1 : 0, UserHandle.USER_CURRENT) != 0; mOldMobileType.setChecked(showing); } int batterystyle = Settings.System.getIntForUser(getContentResolver(), Settings.System.STATUS_BAR_BATTERY_STYLE, BATTERY_STYLE_PORTRAIT, UserHandle.USER_CURRENT); int batterypercent = Settings.System.getIntForUser(getContentResolver(), Settings.System.STATUS_BAR_SHOW_BATTERY_PERCENT, 0, UserHandle.USER_CURRENT); mBatteryStyle = (SystemSettingListPreference) findPreference(KEY_STATUS_BAR_BATTERY_STYLE); mBatteryStyle.setOnPreferenceChangeListener(this); mBatteryPercent = (SystemSettingListPreference) findPreference(KEY_STATUS_BAR_SHOW_BATTERY_PERCENT); mBatteryPercent.setEnabled( batterystyle != BATTERY_STYLE_TEXT && batterystyle != BATTERY_STYLE_HIDDEN); mBatteryPercent.setOnPreferenceChangeListener(this); mBatteryTextCharging = (SwitchPreference) findPreference(KEY_STATUS_BAR_BATTERY_TEXT_CHARGING); mBatteryTextCharging.setEnabled(batterystyle == BATTERY_STYLE_HIDDEN || (batterystyle != BATTERY_STYLE_TEXT && batterypercent != 2)); mQuickPulldown = (LineageSystemSettingListPreference) findPreference(QUICK_PULLDOWN); mQuickPulldown.setOnPreferenceChangeListener(this); updateQuickPulldownSummary(mQuickPulldown.getIntValue(0)); // Adjust status bar preferences for RTL if (getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) { mQuickPulldown.setEntries(R.array.status_bar_quick_qs_pulldown_entries_rtl); mQuickPulldown.setEntryValues(R.array.status_bar_quick_qs_pulldown_values_rtl); } } @Override public boolean onPreferenceChange(Preference preference, Object newValue) { if (preference == mBatteryStyle) { int value = Integer.parseInt((String) newValue); int batterypercent = Settings.System.getIntForUser(getContentResolver(), Settings.System.STATUS_BAR_SHOW_BATTERY_PERCENT, 0, UserHandle.USER_CURRENT); mBatteryPercent.setEnabled( value != BATTERY_STYLE_TEXT && value != BATTERY_STYLE_HIDDEN); mBatteryTextCharging.setEnabled(value == BATTERY_STYLE_HIDDEN || (value != BATTERY_STYLE_TEXT && batterypercent != 2)); return true; } else if (preference == mBatteryPercent) { int value = Integer.parseInt((String) newValue); int batterystyle = Settings.System.getIntForUser(getContentResolver(), Settings.System.STATUS_BAR_BATTERY_STYLE, BATTERY_STYLE_PORTRAIT, UserHandle.USER_CURRENT); mBatteryTextCharging.setEnabled(batterystyle == BATTERY_STYLE_HIDDEN || (batterystyle != BATTERY_STYLE_TEXT && value != 2)); return true; } else if (preference == mQuickPulldown) { int value = Integer.parseInt((String) newValue); updateQuickPulldownSummary(value); return true; } return false; } public static void reset(Context mContext) { ContentResolver resolver = mContext.getContentResolver(); boolean mConfigUseOldMobileType = mContext.getResources().getBoolean( com.android.internal.R.bool.config_useOldMobileIcons); LineageSettings.System.putIntForUser(resolver, LineageSettings.System.DOUBLE_TAP_SLEEP_GESTURE, 1, UserHandle.USER_CURRENT); LineageSettings.System.putIntForUser(resolver, LineageSettings.System.STATUS_BAR_QUICK_QS_PULLDOWN, 0, UserHandle.USER_CURRENT); LineageSettings.System.putIntForUser(resolver, LineageSettings.System.STATUS_BAR_CLOCK, 2, UserHandle.USER_CURRENT); LineageSettings.System.putIntForUser(resolver, LineageSettings.System.STATUS_BAR_BRIGHTNESS_CONTROL, 0, UserHandle.USER_CURRENT); Settings.Secure.putIntForUser(resolver, Settings.Secure.ENABLE_CAMERA_PRIVACY_INDICATOR, 1, UserHandle.USER_CURRENT); Settings.Secure.putIntForUser(resolver, Settings.Secure.ENABLE_LOCATION_PRIVACY_INDICATOR, 1, UserHandle.USER_CURRENT); Settings.Secure.putIntForUser(resolver, Settings.Secure.ENABLE_PROJECTION_PRIVACY_INDICATOR, 1, UserHandle.USER_CURRENT); Settings.System.putIntForUser(resolver, Settings.System.ROAMING_INDICATOR_ICON, 1, UserHandle.USER_CURRENT); Settings.System.putIntForUser(resolver, Settings.System.SHOW_FOURG_ICON, 0, UserHandle.USER_CURRENT); Settings.System.putIntForUser(resolver, Settings.System.DATA_DISABLED_ICON, 1, UserHandle.USER_CURRENT); Settings.System.putIntForUser(resolver, Settings.System.BLUETOOTH_SHOW_BATTERY, 1, UserHandle.USER_CURRENT); Settings.System.putIntForUser(resolver, Settings.System.STATUS_BAR_BATTERY_STYLE, BATTERY_STYLE_PORTRAIT, UserHandle.USER_CURRENT); Settings.System.putIntForUser(resolver, Settings.System.STATUS_BAR_SHOW_BATTERY_PERCENT, 0, UserHandle.USER_CURRENT); Settings.System.putIntForUser(resolver, Settings.System.STATUS_BAR_BATTERY_TEXT_CHARGING, 1, UserHandle.USER_CURRENT); Settings.System.putIntForUser(resolver, Settings.System.STATUSBAR_COLORED_ICONS, 0, UserHandle.USER_CURRENT); Settings.System.putIntForUser(resolver, Settings.System.STATUSBAR_NOTIF_COUNT, 0, UserHandle.USER_CURRENT); Settings.System.putIntForUser(resolver, Settings.System.USE_OLD_MOBILETYPE, mConfigUseOldMobileType ? 1 : 0, UserHandle.USER_CURRENT); Settings.System.putIntForUser(resolver, Settings.System.STATUS_BAR_LOGO, 0, UserHandle.USER_CURRENT); Settings.System.putIntForUser(resolver, Settings.System.STATUS_BAR_LOGO_POSITION, 0, UserHandle.USER_CURRENT); Settings.System.putIntForUser(resolver, Settings.System.STATUS_BAR_LOGO_STYLE, 0, UserHandle.USER_CURRENT); Settings.System.putIntForUser(resolver, Settings.System.SHOW_WIFI_STANDARD_ICON, 0, UserHandle.USER_CURRENT); BatteryBar.reset(mContext); Clock.reset(mContext); NetworkTrafficSettings.reset(mContext); } private void updateQuickPulldownSummary(int value) { String summary=""; switch (value) { case PULLDOWN_DIR_NONE: summary = getResources().getString( R.string.status_bar_quick_qs_pulldown_off); break; case PULLDOWN_DIR_ALWAYS: summary = getResources().getString( R.string.status_bar_quick_qs_pulldown_always); break; case PULLDOWN_DIR_LEFT: case PULLDOWN_DIR_RIGHT: summary = getResources().getString( R.string.status_bar_quick_qs_pulldown_summary, getResources().getString(value == PULLDOWN_DIR_LEFT ? R.string.status_bar_quick_qs_pulldown_summary_left : R.string.status_bar_quick_qs_pulldown_summary_right)); break; } mQuickPulldown.setSummary(summary); } @Override public int getMetricsCategory() { return MetricsProto.MetricsEvent.CRDROID_SETTINGS; } /** * For search */ public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = new BaseSearchIndexProvider(R.xml.crdroid_settings_statusbar) { @Override public List<String> getNonIndexableKeys(Context context) { List<String> keys = super.getNonIndexableKeys(context); if (!TelephonyUtils.isVoiceCapable(context)) { keys.add(KEY_SHOW_ROAMING); keys.add(KEY_SHOW_FOURG); keys.add(KEY_SHOW_DATA_DISABLED); keys.add(KEY_USE_OLD_MOBILETYPE); } return keys; } }; }
package lawscraper.client.ui.panels.rolebasedwidgets; import lawscraper.shared.proxies.UserProxy; import java.util.HashMap; import java.util.HashSet; import java.util.Set; /** * Created by erik, IT Bolaget Per & Per AB * Date: 5/16/12 * Time: 7:37 PM */ public class RoleBasedWidgetHandlerImpl implements RoleBasedWidgetHandler { HashMap<Class<?>, Set<RoleBasedWidget>> roleBasedWidgetMap = new HashMap<Class<?>, Set<RoleBasedWidget>>(); UserProxy userProxy; @Override public void handleRoleBasedViews(Class<?> widgetClass) { if (true) { return; } for (RoleBasedWidget roleBasedWidget : roleBasedWidgetMap.get(widgetClass)) { if (userProxy == null) { roleBasedWidget.configureAsNoneVisisble(null); continue; } if (roleBasedWidget.getEditRequiresRole() != null && userProxy.getUserRole().ordinal() >= roleBasedWidget.getEditRequiresRole().ordinal()) { roleBasedWidget.configureAsEditable(userProxy.getUserRole()); } else if (roleBasedWidget.getViewRequiresRole() != null && userProxy.getUserRole() .ordinal() >= roleBasedWidget .getViewRequiresRole().ordinal()) { roleBasedWidget.configureAsViewable(userProxy.getUserRole()); } else { roleBasedWidget.configureAsNoneVisisble(userProxy.getUserRole()); } } } @Override public void addRoleBaseWidget(RoleBasedWidget roleBasedWidget, Class<?> parentWidgetClass) { if (!roleBasedWidgetMap.containsKey(parentWidgetClass)) { Set<RoleBasedWidget> roleBasedWidgets = new HashSet<RoleBasedWidget>(); roleBasedWidgets.add(roleBasedWidget); roleBasedWidgetMap.put(parentWidgetClass, roleBasedWidgets); } else { Set<RoleBasedWidget> widgetSet = roleBasedWidgetMap.get(parentWidgetClass); if (!widgetSet.contains(roleBasedWidget)) { widgetSet.add(roleBasedWidget); } } } @Override public void setUserProxy(UserProxy userProxy) { this.userProxy = userProxy; } }
package network.model.response; import com.google.gson.annotations.SerializedName; /** * Created by qiaoruixiang on 13/08/2017. */ public class CategoryScoreResponse { @SerializedName("categoryID") private Long categoryID; @SerializedName("score") private int score; public CategoryScoreResponse(Long categoryID, int score) { this.categoryID = categoryID; this.score = score; } public Long getCategoryID() { return categoryID; } public void setCategoryID(Long categoryID) { this.categoryID = categoryID; } public int getScore() { return score; } public void setScore(int score) { this.score = score; } }
package cellularAutomata.util; import java.awt.GridBagConstraints; /* GBC - A convenience class to tame the GridBagLayout Copyright (C) 2002 Cay S. Horstmann (http://horstmann.com) 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 2 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ //Dave's comments: When creating constraints for the grid bag layout, the GBC //takes as arguments "new GBC(gridx, gridy)" where //gridx = column position (for the component being added) //gridy = row position // //Use .setSpan(gridwidth, gridheight) to set span of a component where //gridwidth = number of columns the component should span //gridheight = number of rows the component should span // //Use .setFill to set a constant that decides whether the component //should span/fill the cell. Can make it span vertically, horizontally, //both or neither. // //Use setWeight(weightx, weighty) to specify how much an area can grow //or shrink when resizing. 0 means no resizing of the cell area. If //all cells have the same weight, then they resize proportionally. //If one cell has half of the total weight in a whole row, then that //cell will resize twice as much as the other cells. If three cells //have weights x, y, z, then cell x will resize proportionally as //x/(x+y+z), and cell y will resize proportionally as y/(x+y+z), etc. /** * This class simplifies the use of the GridBagConstraints class. */ public class GBC extends GridBagConstraints { /** * Constructs a GBC with a given gridx and gridy position and all other grid * bag constraint values set to the default. * * @param gridx * the gridx position * @param gridy * the gridy position */ public GBC(int gridx, int gridy) { this.gridx = gridx; this.gridy = gridy; } /** * Sets the cell spans. * * @param gridwidth * the cell span in x-direction * @param gridheight * the cell span in y-direction * @return this object for further modification */ public GBC setSpan(int gridwidth, int gridheight) { this.gridwidth = gridwidth; this.gridheight = gridheight; return this; } /** * Sets the anchor. * * @param anchor * the anchor value * @return this object for further modification */ public GBC setAnchor(int anchor) { this.anchor = anchor; return this; } /** * Sets the fill direction. * * @param fill * the fill direction * @return this object for further modification */ public GBC setFill(int fill) { this.fill = fill; return this; } /** * Sets the cell weights. * * @param weightx * the cell weight in x-direction * @param weighty * the cell weight in y-direction * @return this object for further modification */ public GBC setWeight(double weightx, double weighty) { this.weightx = weightx; this.weighty = weighty; return this; } /** * Sets the insets of this cell. * * @param distance * the spacing to use in all directions * @return this object for further modification */ public GBC setInsets(int distance) { this.insets = new java.awt.Insets(distance, distance, distance, distance); return this; } /** * Sets the insets of this cell. * * @param top * the spacing to use on top * @param left * the spacing to use to the left * @param bottom * the spacing to use on the bottom * @param right * the spacing to use to the right * @return this object for further modification */ public GBC setInsets(int top, int left, int bottom, int right) { this.insets = new java.awt.Insets(top, left, bottom, right); return this; } /** * Sets the internal padding * * @param ipadx * the internal padding in x-direction * @param ipady * the internal padding in y-direction * @return this object for further modification */ public GBC setIpad(int ipadx, int ipady) { this.ipadx = ipadx; this.ipady = ipady; return this; } }
package school.lemon.changerequest.java.banking; public interface BankAccount { /** * Get account number * @return account number */ int getAccountNumber(); /** * Get current balance * @return account balance */ double getBalance(); /** * Get current rate * @return account rate */ double getRate(); /** * Set current account rate in percents * @param rate value */ void setRate(double rate); /** * Withdraw specified sum from account * @param sum to withdraw * @throws IllegalArgumentException for {@code sum < 0 || sum > balance} */ void withdraw(double sum) throws IllegalArgumentException; /** * Deposit specified sum for account * @param sum to deposit * @throws IllegalArgumentException for {@code sum < 0} */ void deposit(double sum) throws IllegalArgumentException; /** * Add interest for 1 year to balance. * E.g.: rate = 10% and balance = 200$ -> interest = 20$. So, new balance is 120$. */ void addInterest(); /** * @return account information in the following format: Account #123, ($10.32). */ String toString(); }
package com.gxtc.huchuan.adapter; import android.content.Context; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.alibaba.fastjson.serializer.BeanContext; import com.gxtc.commlibrary.base.BaseMoreTypeRecyclerAdapter; import com.gxtc.commlibrary.base.BaseRecyclerAdapter; import com.gxtc.commlibrary.helper.ImageHelper; import com.gxtc.commlibrary.utils.WindowUtil; import com.gxtc.huchuan.R; import com.gxtc.huchuan.bean.AllPurchaseListBean; import com.gxtc.huchuan.ui.mall.order.MallOrderDetailActivity; import com.gxtc.huchuan.utils.ClipboardUtil; import com.gxtc.huchuan.utils.DateUtil; import com.gxtc.huchuan.utils.StringUtil; import com.gxtc.huchuan.widget.DividerItemDecoration; import java.util.List; /** * 来自 苏修伟 on 2018/4/23. */ public class AllOrderAdapter extends BaseMoreTypeRecyclerAdapter<AllPurchaseListBean> { public AllOrderAdapter(Context mContext, List<AllPurchaseListBean> datas, int... resid) { super(mContext, datas, resid); } @Override public void bindData(BaseMoreTypeRecyclerAdapter.ViewHolder holder, int position, AllPurchaseListBean allOrderBean) { switch (allOrderBean.getType()){ case 1: noMall(holder, position, allOrderBean, "课程"); break; case 2: noMall(holder, position, allOrderBean, "系列课"); break; case 3: noMall(holder, position, allOrderBean, "圈子"); break; case 4: noMall(holder, position, allOrderBean ,"交易"); break; case 5: Mall(holder, position, allOrderBean); break; } } private void noMall(BaseMoreTypeRecyclerAdapter.ViewHolder holder, int position, AllPurchaseListBean allOrderBean,String title){ TextView name = (TextView) holder.getView(R.id.tv_name); TextView mun = (TextView) holder.getView(R.id.tv_mun); name.setText(title); TextView status = (TextView) holder.getView(R.id.tv_status); ImageView imghead = (ImageView) holder.getView(R.id.img_head); TextView price = (TextView) holder.getView(R.id.price); TextView number = (TextView) holder.getView(R.id.tv_time); TextView tvSubtitle = (TextView) holder.getView(R.id.tv_type); TextView goodsName = (TextView) holder.getView(R.id.tv_goods_name); TextView orderno = (TextView) holder.getView(R.id.tv_order_no); String textstatus = ""; String subtitle = allOrderBean.getTitle(); String subtitle2 = allOrderBean.getAssistantTitle(); String time = DateUtil.stampToDate(allOrderBean.getCreateTime() + ""); String fee = StringUtil.formatMoney(2 , allOrderBean.getFee()); String cover = allOrderBean.getCover(); final String no = allOrderBean.getOrderNo(); switch (allOrderBean.getType()){ case 1: case 2: if(allOrderBean.getIsRefund() == 3){ textstatus = "退款被拒"; }else if(allOrderBean.getIsRefund() == 2){ textstatus = "已退款"; }else if(allOrderBean.getIsRefund() == 1){ textstatus = "退款中"; }else if(allOrderBean.getIsSett() == 1){ textstatus = "已结算"; }else if(allOrderBean.getIsPay() == 1){ textstatus = "已支付"; }else{ textstatus = "未支付"; } // if(allOrderBean.getIsPay() == 1){ // textstatus = "已开始"; // }else{ // textstatus = "未开始"; // } break; case 3: if(allOrderBean.getIsSett() == 1){ textstatus = "已结算"; }else if(allOrderBean.getIsPay() == 1){ textstatus = "已支付"; }else{ textstatus = "未支付"; } break; case 4: switch (allOrderBean.getOrderStart()){ case 0: textstatus = "待卖家同意"; break; case 1: textstatus = "卖家同意"; break; case 2: textstatus = "卖家不同意"; break; case 3: textstatus = "买家支付"; break; case 4: textstatus = "卖家交付"; break; case 5: textstatus = "交易完成"; break; case 10: textstatus = "交易关闭"; break; } break; } status.setText(textstatus); tvSubtitle.setText(subtitle2); mun.setText("×" + (allOrderBean.getNumber()== 0? 1 : allOrderBean.getNumber())); // ImageHelper.loadCircle(context, imghead, bean.getFacePic()); ImageHelper.loadRound(mContext,imghead, cover, 5); goodsName.setText(subtitle); number.setText( time.substring(0, time.length() - 3)); TextView sum = (TextView) holder.getView(R.id.tv_money); sum.setText("金额:" + fee); price.setText("金额:" + fee); orderno.setText("订单号:" + no); holder.getView(R.id.order_layout).setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { ClipboardUtil.copyText(no); return false; } }); } private void Mall(BaseMoreTypeRecyclerAdapter.ViewHolder holder, int position, final AllPurchaseListBean allOrderBean){ TextView name = (TextView) holder.getView(R.id.tv_name); name.setText("商城"); TextView status = (TextView) holder.getView(R.id.tv_status); switch (allOrderBean.getOrderStart()){ case 0: status .setText("已取消"); break; case 1: status .setText("未支付"); break; case 2: status .setText("待发货"); break; case 3: status .setText("待收货"); break; case 4: status .setText("待评价"); break; case 5: status .setText("已完成"); break; } TextView order = (TextView) holder.getView(R.id.tv_order_no); TextView number = (TextView) holder.getView(R.id.tv_time); String time = DateUtil.stampToDate(allOrderBean.getCreateTime() + "", "yyyy-MM-dd HH:mm") ; number.setText(time); order.setText("订单号:" + allOrderBean.getOrderNo()); RecyclerView mRecyclerView = (RecyclerView) holder.getView(R.id.mall_list); mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext)); List<AllPurchaseListBean.Commodity> commodity = allOrderBean.getExtra(); OrderMallItemAdater adater = new OrderMallItemAdater(mContext, commodity ,R.layout.mall_order_item_layout); mRecyclerView.setAdapter(adater); mRecyclerView.addItemDecoration(new DividerItemDecoration(getContext(),DividerItemDecoration.HORIZONTAL_LIST, WindowUtil.dip2px(mContext,1),mContext.getResources().getColor(R.color.white))); TextView sum = (TextView) holder.getView(R.id.tv_money); sum.setText("金额:" + StringUtil.formatMoney(2 , allOrderBean.getFee()) ); adater.setOnReItemOnClickListener(new BaseRecyclerAdapter.OnReItemOnClickListener() { @Override public void onItemClick(View v, int position) { MallOrderDetailActivity.Companion.junmpToOrderDetailActivity(mContext,allOrderBean.getOrderNo()); } }); holder.getView(R.id.order_layout).setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { ClipboardUtil.copyText(allOrderBean.getOrderNo()); return false; } }); } @Override public int getItemViewType(int position) { if(super.getDatas().get(position).getType() == 5) return 1; return 0; } }
package com.networks.ghosttears.activities; import android.animation.Animator; import android.content.Intent; import android.os.Build; import android.os.Handler; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.Button; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.TextView; import com.chartboost.sdk.Chartboost; import com.daimajia.androidanimations.library.Techniques; import com.daimajia.androidanimations.library.YoYo; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import com.networks.ghosttears.R; import com.networks.ghosttears.fragments.GetMoreCoinsFragment; import com.networks.ghosttears.fragments.ShopPowerUpsFragment; import com.networks.ghosttears.fragments.ToolbarFragment; import com.networks.ghosttears.gameplay_package.GhostTears; import com.networks.ghosttears.gameplay_package.ManagingImages; import com.networks.ghosttears.gameplay_package.ManagingSoundService; import com.networks.ghosttears.user_profiles.GhosttearsUser; import com.networks.ghosttears.user_profiles.LevelAndExp; public class Shop extends AppCompatActivity { ManagingImages managingImages = new ManagingImages(); ManagingSoundService managingSoundService = new ManagingSoundService(); static Boolean shopIsBeingDisplayed = true; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_shop); // Setting windows features Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); ((GhostTears) this.getApplication()).setShouldPlay(false); FullScreencall(); final Button shopButton = (Button) findViewById(R.id.shop_powerups_button); final Button getMoreCoinsButton = (Button) findViewById(R.id.shop_get_more_coins_button); Fragment shopFragment = new ShopPowerUpsFragment(); Bundle bundle = getIntent().getExtras(); if(getIntent().hasExtra("fragmentToDisplay")){ if(bundle.getString("fragmentToDisplay").equalsIgnoreCase("shopFragment")){ shopFragment = new ShopPowerUpsFragment(); shopButton.setBackgroundResource(R.drawable.leaderboard_activated_button); getMoreCoinsButton.setBackgroundResource(R.drawable.leaderboard_deactivated_button); }else if(bundle.getString("fragmentToDisplay").equalsIgnoreCase("getMoreCoinsFragment")) { shopIsBeingDisplayed = false; shopFragment = new GetMoreCoinsFragment(); shopButton.setBackgroundResource(R.drawable.leaderboard_deactivated_button); getMoreCoinsButton.setBackgroundResource(R.drawable.leaderboard_activated_button); } } FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.addToBackStack(null); transaction.replace(R.id.shop_fragment, shopFragment); transaction.commit(); ImageView shopGoldCoins = (ImageView) findViewById(R.id.shop_gold_coins_imageview); managingImages.loadImageIntoImageview(R.drawable.gold_coins,shopGoldCoins); ImageView backbutton = (ImageView) findViewById(R.id.back_button); backbutton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { // Start home activity managingSoundService.playButtonClickSound(view); ((GhostTears) Shop.this.getApplication()).setShouldPlay(true); finish(); } } ); shopButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { if (!shopIsBeingDisplayed) { shopButton.setBackgroundResource(R.drawable.leaderboard_activated_button); getMoreCoinsButton.setBackgroundResource(R.drawable.leaderboard_deactivated_button); Fragment newFragment = new ShopPowerUpsFragment(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.shop_fragment, newFragment); transaction.commitAllowingStateLoss(); shopIsBeingDisplayed = true; } } } ); getMoreCoinsButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { if(shopIsBeingDisplayed) { shopButton.setBackgroundResource(R.drawable.leaderboard_deactivated_button); getMoreCoinsButton.setBackgroundResource(R.drawable.leaderboard_activated_button); Fragment newFragment = new GetMoreCoinsFragment(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.addToBackStack(null); transaction.replace(R.id.shop_fragment, newFragment); transaction.commit(); shopIsBeingDisplayed = false; } } } ); TextView amountOfCoins = (TextView) findViewById(R.id.shop_amount_Of_Coins); String amt = GhosttearsUser.currentAmountOfCoins + ""; amountOfCoins.setText(amt); backbutton.setOnTouchListener(onTouchListener()); ImageView imageView = (ImageView) findViewById(R.id.shop_gold_coins_imageview); managingImages.loadImageIntoImageview(R.drawable.gold_coins,imageView); } private View.OnTouchListener onTouchListener(){ View.OnTouchListener onTouchListener = new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { managingImages.powerupsbuttontouched(view,motionEvent); return false; } }; return onTouchListener; } @Override protected void onStart() { super.onStart(); Chartboost.onStart(this); } @Override protected void onPause() { super.onPause(); managingSoundService.pause(this,this.getApplication()); Chartboost.onPause(this); } @Override protected void onStop() { super.onPause(); Chartboost.onStop(this); } @Override protected void onResume(){ super.onResume(); managingSoundService.resume(this,this.getApplication()); Chartboost.onResume(this); FullScreencall(); } @Override public void onBackPressed(){ Intent intenthome = new Intent(this,Home.class); startActivity(intenthome); ((GhostTears) this.getApplication()).setShouldPlay(true); } public void FullScreencall() { if (Build.VERSION.SDK_INT > 11 && Build.VERSION.SDK_INT < 19) { // lower api View v = this.getWindow().getDecorView(); v.setSystemUiVisibility(View.GONE); } else if (Build.VERSION.SDK_INT >= 19) { //for new api versions. View decorView = getWindow().getDecorView(); int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; decorView.setSystemUiVisibility(uiOptions); } } }
package weily.com.schedule.activity; import android.app.ProgressDialog; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.webkit.WebView; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import okhttp3.Call; import okhttp3.Callback; import okhttp3.Response; import weily.com.schedule.R; import weily.com.schedule.util.HttpUtil; import weily.com.schedule.util.MyWebViewClient; import weily.com.schedule.util.VersionInfo; public class LoginActivity extends AppCompatActivity implements View.OnClickListener { private Button login; private EditText account; private EditText password; private EditText checkCode; private WebView checkCodeView; private String username = ""; private String pw = ""; private String loginCheckCode = ""; private ProgressDialog dialog = null; private StringBuffer cookies; private TextView changeCheckCode, logOut; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); login = (Button) findViewById(R.id.login_btn); logOut = (TextView) findViewById(R.id.log_out); account = (EditText) findViewById(R.id.account_text); password = (EditText) findViewById(R.id.password_text); checkCode = (EditText) findViewById(R.id.check_code); checkCodeView = (WebView) findViewById(R.id.checkcode_view); changeCheckCode = (TextView) findViewById(R.id.change_check_code); //获取验证码 //checkCodeView.getSettings().setJavaScriptEnabled(true); checkCodeView.setWebViewClient(new MyWebViewClient(LoginActivity.this)); //获取Cookie checkCodeView.loadUrl("http://course.xhban.com:8000/login"); changeCheckCode.setOnClickListener(this);//更换验证码 login.setOnClickListener(this); //登录 logOut.setOnClickListener(this); } private void showDialog() { if (dialog == null) { dialog = new ProgressDialog(LoginActivity.this); dialog.setMessage("正在登陆..."); dialog.setCancelable(false); } dialog.show(); } private void closeDialog() { if (dialog != null) { dialog.dismiss(); } } @Override public void onClick(View v) { switch (v.getId()) { //登录 case R.id.login_btn: username = String.valueOf(account.getText()); pw = String.valueOf(password.getText()); loginCheckCode = String.valueOf(checkCode.getText()); if (username.equals("") || pw.equals("") || loginCheckCode.equals("")) { Snackbar.make(v, "不能含有空项!", Snackbar.LENGTH_SHORT).show(); } else { loadCookie(); showDialog(); requestLogin(); saveVersionCode(); } break; case R.id.change_check_code: checkCodeView.loadUrl("http://course.xhban.com:8000/login"); break; case R.id.log_out: finish(); break; default: } } //保存版本信息 private void saveVersionCode() { SharedPreferences.Editor editor = getSharedPreferences("version", MODE_PRIVATE).edit(); editor.putString("version_name", VersionInfo.getVersionName(LoginActivity.this)); editor.putInt("version_code", Integer.parseInt(VersionInfo.getVersionCode(LoginActivity.this))); editor.apply(); } private void loadCookie() { cookies = new StringBuffer(); BufferedReader reader = null; FileInputStream in = null; try { in = openFileInput("cookies.txt"); reader = new BufferedReader(new InputStreamReader(in)); String line = ""; while ((line = reader.readLine()) != null) { cookies.append(line); } } catch (Exception e) { e.printStackTrace(); } finally { try { in.close(); reader.close(); } catch (Exception e) { e.printStackTrace(); } } } private void requestLogin() { HttpUtil.sendOkHttpRequestMethodPOST("http://www.xhban.com:8080/course/login.schedule", "", username, pw, "", new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { } }); HttpUtil.sendOkHttpRequestMethodPOST("http://course.xhban.com:8000/courses", cookies + "", username, pw, loginCheckCode, new Callback() { @Override public void onFailure(Call call, IOException e) { runOnUiThread(new Runnable() { @Override public void run() { closeDialog(); Toast.makeText(LoginActivity.this, "请求超时", Toast.LENGTH_SHORT).show(); checkCodeView.loadUrl("http://course.xhban.com:8000/login"); } }); } @Override public void onResponse(Call call, Response response) throws IOException { final String responseText = response.body().string(); runOnUiThread(new Runnable() { @Override public void run() { switch (responseText.trim().charAt(0) + "") { case "2": closeDialog(); Toast.makeText(LoginActivity.this, "验证码错误", Toast.LENGTH_SHORT).show(); checkCodeView.loadUrl("http://course.xhban.com:8000/login"); break; case "3": closeDialog(); Toast.makeText(LoginActivity.this, "账号或密码错误", Toast.LENGTH_SHORT).show(); checkCodeView.loadUrl("http://course.xhban.com:8000/login"); break; case "{": SharedPreferences.Editor editor = getSharedPreferences("course_data", MODE_PRIVATE).edit(); editor.putString("courses", responseText); editor.apply(); // Log.i("login_activity_data", responseText+""); closeDialog(); Intent intent = new Intent(LoginActivity.this, MainActivity.class); startActivity(intent); finish(); break; default: } } }); } }); } }
package se.xtremelabs.inspectr; import android.content.Intent; import android.content.SharedPreferences; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.Toast; import com.google.gson.Gson; import java.util.List; import java.util.UUID; import se.xtremelabs.models.Client; import se.xtremelabs.models.Project; //#TODO: Account to OC: http://www.finalconcept.com.au/article/view/android-account-manager-step-by-step //#TODO: http://www.finalconcept.com.au/article/view/android-account-manager-step-by-step-2 public class MainActivity extends ActionBarActivity { private final String CLASSTAG = getClass().getSimpleName(); private final String SHARED_PREFS_NAME = "se.xtremelabs.inspectr"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button b1 = (Button) findViewById(R.id.button_startinspection); Button b2 = (Button) findViewById(R.id.button_manageinspections); Button b3 = (Button) findViewById(R.id.button_setactiveproject); Button b4 = (Button) findViewById(R.id.button_settings); Button b5 = (Button) findViewById(R.id.button_debug1); SharedPreferences prefs = getSharedPreferences(SHARED_PREFS_NAME, MODE_PRIVATE); //App preference keeps the id of the active project String currP = prefs.getString("ACTIVE_PROJECT", null); if ( currP != null ) { Log.i(CLASSTAG, String.format("Current project id: %s ", currP)); } else { Log.i(CLASSTAG, "No active project in preferences."); } View.OnClickListener handler_startinspection = new View.OnClickListener() { public void onClick(View v) { Log.i(CLASSTAG, "Button press for handler_startinspection pressed"); } }; View.OnClickListener handler_manageinspections = new View.OnClickListener() { public void onClick(View v) { Log.i(CLASSTAG, "Button press for handler_manageinspections pressed."); } }; View.OnClickListener handler_setactiveproject = new View.OnClickListener() { public void onClick(View v) { Log.i(CLASSTAG, "Button press for handler_setactiveproject pressed."); Toast.makeText(getApplicationContext(), "0", Toast.LENGTH_SHORT).show(); // Intent i = new Intent(getApplicationContext(), SettingsActivity.class); // startActivity(i); } }; View.OnClickListener handler_settings = new View.OnClickListener() { public void onClick(View v) { Log.i(CLASSTAG, "Button press for handler_settings pressed."); // Intent i = new Intent(getApplicationContext(), SettingsActivity.class); // startActivity(i); } }; View.OnClickListener handler_debug1 = new View.OnClickListener() { public void onClick(View v) { Log.i(CLASSTAG, "Button press for handler_debug1 pressed."); RemoteObjectsService.startActionFetchClients(getApplicationContext(), "", ""); // List<Project> projects = Project.listAll(Project.class); // Gson gson = new Gson(); // String project_json = gson.toJson( projects.get(0) ); // Log.d(CLASSTAG, project_json); // Intent i = new Intent(getApplicationContext(), SettingsActivity.class); // startActivity(i); } }; b1.setOnClickListener( handler_startinspection ); b2.setOnClickListener( handler_manageinspections ); b3.setOnClickListener( handler_setactiveproject ); b4.setOnClickListener( handler_settings ); b5.setOnClickListener( handler_debug1 ); } }
package com.example.bbcreaderproject.dummy; import android.os.AsyncTask; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserFactory; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; public class WebHTTP extends AsyncTask<String, String, String> { private String title; private String description; private String date; private String weblink; @Override protected String doInBackground(String ... args){ URL url = null; try { url = new URL("http://feeds.bbci.co.uk/news/world/us_and_canada/rss.xml"); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); InputStream response = urlConnection.getInputStream(); XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); factory.setNamespaceAware(false); XmlPullParser xpp = factory.newPullParser(); xpp.setInput( response , "UTF-8"); int eventType = xpp.getEventType(); while(eventType != XmlPullParser.END_DOCUMENT){ while (eventType == XmlPullParser.START_TAG) { if (xpp.getName().equals(title)) { title = xpp.getAttributeValue(null, "title"); //returns “Hello”} break; } if (xpp.getName().equals("description")) { description = xpp.getAttributeValue(null, "description"); //returns “Hello”} break; } if (xpp.getName().equals("pubDate")) { date = xpp.getAttributeValue(null, "pubDate"); //returns “Hello”} break; } if (xpp.getName().equals("link")) { weblink = xpp.getAttributeValue(null, "link"); //returns “Hello”} break; } eventType = xpp.next(); } } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (XmlPullParserException e) { e.printStackTrace(); } return "Title: "+title+"\nDescription: "+description+"\nDate: "+"\nWeblink: "+weblink; } }
package p0100; import javax.swing.JFrame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; public class P0120 extends JFrame implements ActionListener { private JButton btnPrincipal; public P0120() { super("P0120"); initGUI(); } private void initGUI() { setSize(250, 200); btnPrincipal = new JButton("Click"); btnPrincipal.addActionListener(this); getContentPane().add(btnPrincipal); setDefaultCloseOperation(EXIT_ON_CLOSE); } public static void main(String[] args) { P0120 test = new P0120(); test.setVisible(true); } @Override public void actionPerformed(ActionEvent arg0) { P0120 newFrame = new P0120(); newFrame.setLocation(getX()+20, getY()+20); newFrame.setVisible(true); } }
package com.flp.ems.domain; public class Project { int ProjectId,DepartmentId; String Name,Description; public int getProjectId() { ProjectId =Name.length(); return ProjectId; } public void setProjectId(int projectId) { ProjectId = projectId; } public String getName() { return Name; } public void setName(String name) { Name = name; } public String getDescription() { return Description; } public void setDescription(String description) { Description = description; } public void setDepartmentId(int departmentId) { DepartmentId = departmentId; } }
package com.sa45team7.stockist.exception; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @SuppressWarnings("serial") @ResponseStatus(value=HttpStatus.NO_CONTENT, reason="No such User") public class UserNotFound extends Exception { }
package Encyclopedia2; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Locale; public class WordInput { protected final static BufferedReader br =new BufferedReader(new InputStreamReader(System.in)); static String readerWordInput() { String wordInput = null; try { System.out.println("Введи слово которое необходимо проверить, двоечник):"); wordInput = br.readLine().toUpperCase(Locale.ROOT); //для хранение в верхнем регистре. br.close(); } catch (IOException e) { System.err.println("Товарищ введи буквы"); e.printStackTrace(); } return wordInput; } }
package com.example.hp.cold_chain_logistic.fragment; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.PopupMenu; import com.example.hp.cold_chain_logistic.R; import com.example.hp.cold_chain_logistic.base.ConstData; import com.example.hp.cold_chain_logistic.beans.DynamicLineChartManager; import com.example.hp.cold_chain_logistic.ui.ComWidget; import com.example.hp.cold_chain_logistic.utils.HttpUtils; import com.example.hp.cold_chain_logistic.utils.Utility; import com.github.mikephil.charting.charts.LineChart; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Timer; import java.util.TimerTask; import okhttp3.Call; import okhttp3.Response; import static android.content.ContentValues.TAG; /** * @Createdby LizYang * @Version: V 1.0 * @Date: 2018/5/18 * @Description:this is show canvas class */ public class CanvasFragment extends Fragment { private LineChart mLineChart; //折线图 private ImageView iv_canvas_back; private ImageView iv_fg_canvas_setting; private DynamicLineChartManager dynamicLineChartManager; private List<Integer> integerList=new ArrayList<>(); //数据集合 private String name=new String(); //折现名字集合 private int color=R.color.colorPrimary;//折线颜色 private String url; MyTimerTask timerTask = null; Timer timer=null; Handler myHandler=new Handler(){ public void handleMessage(Message msg){ switch (msg.what){ case 1: //每隔6s进行name类型的数据请求, drawPoint(name); break; } } }; /** * get the url from ThreeShowFragment * @param url */ public void setData(String url){ this.url=url; } /** * send httpRequest get the data to draw on the canvas according to the name * @param name */ private void drawPoint(final String name) { HttpUtils.sendOkHttpRequest(url,new okhttp3.Callback() { @Override public void onFailure(Call call, IOException e) { getActivity().runOnUiThread(new Runnable() { @Override public void run() { ComWidget.ToastShow("请检查网络连接!",getActivity()); } }); } @Override public void onResponse(Call call, Response response) throws IOException { final String data=response.body().string(); final String result= Utility.isValueTure(data); final String value=Utility.getValueFromJsonArray(data,name); if(result.equals("false")){ getActivity().runOnUiThread(new Runnable() { @Override public void run() { ComWidget.ToastShow("该IMSI无实时数据!",getActivity()); } }); }else{ getActivity().runOnUiThread(new Runnable() { @Override public void run() { dynamicLineChartManager.addEntry((int)Float.parseFloat(value)); } }); } } }); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view=inflater.inflate(R.layout.fragment_canvas,container,false); mLineChart=view.findViewById(R.id.lineChart); iv_canvas_back=view.findViewById(R.id.iv_canvas_back); iv_fg_canvas_setting=view.findViewById(R.id.iv_fg_canvas_setting); timer=new Timer(true); timerTask=new MyTimerTask(); return view; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); name="bright"; dynamicLineChartManager=new DynamicLineChartManager(mLineChart,name,color); dynamicLineChartManager.setYAxis(1000, 500, 100); //返回 iv_canvas_back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getFragmentManager().popBackStack(); } }); //下拉菜单 iv_fg_canvas_setting.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { PopupMenu popupMenu = new PopupMenu(getContext(), iv_fg_canvas_setting); popupMenu.getMenuInflater().inflate(R.menu.menu_fg_canvas, popupMenu.getMenu()); popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()){ case R.id.item_fg_canvas_bright: name="bright"; dynamicLineChartManager.setYAxis(1000, 500, 100); drawPoint(name); break; case R.id.item_fg_canvas_electric: name="electric"; dynamicLineChartManager.setYAxis(100, 0, 20); drawPoint(name); break; case R.id.item_fg_canvas_temperature1: name="temperature1"; dynamicLineChartManager.setYAxis(50, 0, 5); drawPoint(name); break; case R.id.item_fg_canvas_wetness1: name="wetness1"; dynamicLineChartManager.setYAxis(50, 0, 5); drawPoint(name); break; case R.id.item_fg_canvas_acceleration: name="acceleration"; dynamicLineChartManager.setYAxis(10, 0, 1); drawPoint(name); break; case R.id.item_fg_canvas_latitude: name="latitude"; dynamicLineChartManager.setYAxis(50, 0, 5); drawPoint(name); break; case R.id.item_fg_canvas_longitude: name="longitude"; dynamicLineChartManager.setYAxis(100, 200, 10); drawPoint(name); break; case R.id.item_fg_canvas_height: name="height"; dynamicLineChartManager.setYAxis(1000, 500, 100); drawPoint(name); break; case R.id.item_fg_canvas_speed: name="electric"; dynamicLineChartManager.setYAxis(100, 0, 20); drawPoint(name); break; } return true; } }); popupMenu.show(); } }); } private class MyTimerTask extends TimerTask { @Override public void run() { Message message=new Message(); message.what=1; myHandler.sendMessage(message); } } /** * 在启动计时任务 */ private void startTimer() { if(timer==null) timer=new Timer(true); if(timerTask==null) timerTask=new MyTimerTask(); timer.schedule(timerTask,0,3000); } /** * 在当前fg在后台时停止该timer */ private void stopTimer() { if(timer!=null){ timer.cancel(); timer=null; } if(timerTask!=null){ timerTask.cancel(); timerTask=null; } } /** * 在fg进入后台模式时停止计时器 */ @Override public void onPause() { super.onPause(); stopTimer(); } /** * 在进入该fg时又重新加载定时器 */ @Override public void onStart() { super.onStart(); startTimer(); } }
package com.hr.bulletin.repository; import java.util.List; import javax.print.attribute.standard.Media; import com.hr.bulletin.model.BulEnroll; import com.hr.bulletin.model.BulLike; import com.hr.bulletin.model.BulMessage; import com.hr.bulletin.model.BulName; import com.hr.bulletin.model.Bulletin; public interface BulletinRepo { //執行新增 void insert(Bulletin bulletin); // 執行查詢單筆 Bulletin findById(int postno); // 執行查詢多筆 // List<Bulletin> findAll() ; // 執行查詢多筆 List<BulName> findAll(); // 執行修改 void update(Bulletin bulletin); // 查詢未過期多筆 List<Bulletin> findAllPosting(); void updateop(Bulletin bulletin); void delete(int postno); void insertMsg(BulMessage bulMassage); List<BulMessage> findAllMsg(int postno); void delMsg(int id); BulLike findLikeByno(String empNo, int postno); void changeLike(BulLike bulLike); BulEnroll findEnrollByno(String empNo, int postno); void insertEnroll(BulEnroll bulEnroll); List<BulEnroll> findEnrollListByNo(int postno); List<BulName> userFindAll(); List<BulName> findMyEnrollByEmpNo(String empNo); List<BulEnroll> findEnrollNumByNo(int postno); }
/* * Copyright © 2020-2022 ForgeRock AS (obst@forgerock.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package uk.org.openbanking.datamodel.payment; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; /** * This field allows a PISP to request specific SCA Exemption for a Payment Initiation. * * <p> * N.B. This enum has been created manually and should be used instead of all the equivalent enums that are created in * classes such as {@link OBWriteDomesticConsent3DataSCASupportData} or {@link OBWriteDomesticConsent4DataSCASupportData} * etc. This makes migrating to new API versions considerably easier. */ public enum OBRequestedSCAExemptionTypeEnum { BILLPAYMENT("BillPayment"), CONTACTLESSTRAVEL("ContactlessTravel"), ECOMMERCEGOODS("EcommerceGoods"), ECOMMERCESERVICES("EcommerceServices"), KIOSK("Kiosk"), PARKING("Parking"), PARTYTOPARTY("PartyToParty"); private String value; OBRequestedSCAExemptionTypeEnum(String value) { this.value = value; } @JsonValue public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } @JsonCreator public static OBRequestedSCAExemptionTypeEnum fromValue(String value) { for (OBRequestedSCAExemptionTypeEnum b : OBRequestedSCAExemptionTypeEnum.values()) { if (b.value.equals(value)) { return b; } } return null; } }
package com.oup.model; import lombok.Getter; import lombok.Setter; import javax.xml.bind.annotation.XmlElement; @Getter @Setter public class Item { private String GLAccount; @XmlElement private AmountInTransactionCurrency AmountInTransactionCurrency; @XmlElement private AmountInCompanyCodeCurrency AmountInCompanyCodeCurrency; private String DebitCreditCode; private String DocumentItemText; @XmlElement private Tax Tax; @XmlElement private AccountAssignment AccountAssignment; }
package domain; public class Menu { String menuID; public Menu() { } public Menu(Builder builder) { } public String getMenuID() { return menuID; } public void setMenuID(String menuID) { this.menuID = menuID; } public static class Builder{ private String menuID; public Builder(){} public Builder menuID(String value) { return null; } public Builder copy(Menu value) { this.menuID = value.menuID; return this; } public Menu build() { return new Menu(this); } } }
package com.slack.bot.repositories; import com.slack.bot.models.Answer; 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 java.util.List; @Repository public interface AnswerRepository extends JpaRepository<Answer, Long> { @Query(value = "SELECT * FROM answer as answ WHERE answ.answer_stage_number = :stageNr AND answ.answer_number = :answerNr", nativeQuery = true) List<Answer> getAnswerForUser(@Param("answerNr") int answerNr, @Param("stageNr") int stageNr); }
package com.lsjr.zizi.bean; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; /** * * @项目名称: SkWeiChat-Baidu * @包名: com.sk.weichat.bean.message * @作者:王阳 * @创建时间: 2015年10月12日 上午11:59:36 * @描述: TODO * @SVN版本号: $Rev$ * @修改人: $Author$ * @修改时间: $Date$ * @修改的内容: 聊天消息表, 其中会有上传字段的设置和解析字段的设置 */ public class ChatMessage extends XmppMessage implements Parcelable { public ChatMessage() { } public ChatMessage(String jsonData) { parserJsonData(jsonData); } private String fromUserId; private String fromUserName;// 发送者名称 /** * 在不同的消息类型里,代表不同的含义:<br/> * {@link XmppMessage#TYPE_TEXT} 文字 <br/> * {@link XmppMessage#TYPE_IMAGE} 图片的Url<br/> * {@link XmppMessage#TYPE_VOICE} 语音的Url <br/> * {@link XmppMessage#TYPE_LOCATION} 地理<br/> * {@link XmppMessage#TYPE_GIF} Gif图的名称 <br/> * {@link XmppMessage#TYPE_TIP} 系统提示的字<br/> * {@link XmppMessage#TYPE_FILE} 文件的url<br/> */ private String content; private String location_x;// 当为地理位置时,有效 private String location_y;// 当为地理位置时,有效 private int fileSize;// 当为图片、语音消息时,此节点有效。图片、语音文件的大小 private int timeLen;// 当为语音消息时,此节点有效。语音信息的长度 /* 本地额外存数数据 */ private int _id; private int timeReceive;// 接收到消息回执的时间 private String filePath;// 为语音视频图片文件的 本地路径(IOS端叫fileName),注意本地文件可能清除了,此节点代表的数据不一定有效 private boolean isUpload;// 当为图片和语音类型是,此节点有效,代表是否上传完成,默认false。isMySend=true,此节点有效, private boolean isDownload;// 当为图片和语音类型是,此节点有效,代表是否下载完成,默认false。isMySend=false,此节点有效 private int messageState;// 只有当消息是我发出的,此节点才有效。消息的发送状态,默认值=0,代表发送中 // 当为语音文件时,此节点代表语音是否已经读了。当为新朋友推送消息时,代表改推送消息是否已读。只在这两种情况下有效 private boolean isRead;// 默认为false 代表我未读 private int sipStatus;// 语音或者视频通话的状态,本地数据库存储即可 private int sipDuration;// 语音或者视频通话的时间,本地数据库存储即可 // //////推送特有的////// private String objectId;// 用于商务圈推送,代表哪一条公共消息 public int get_id() { return _id; } public void set_id(int _id) { this._id = _id; } public String getFromUserId() { return fromUserId; } public void setFromUserId(String fromUserId) { this.fromUserId = fromUserId; } // public String getToUserId() { // return toUserId; // } // // public void setToUserId(String toUserId) { // this.toUserId = toUserId; // } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getFilePath() { return filePath; } public void setFilePath(String filePath) { this.filePath = filePath; } public String getLocation_x() { return location_x; } public void setLocation_x(String location_x) { this.location_x = location_x; } public String getLocation_y() { return location_y; } public void setLocation_y(String location_y) { this.location_y = location_y; } public int getFileSize() { return fileSize; } public void setFileSize(int fileSize) { this.fileSize = fileSize; } public int getTimeLen() { return timeLen; } public void setTimeLen(int timeLen) { this.timeLen = timeLen; } public int getMessageState() { return messageState; } public void setRead(boolean isRead) { this.isRead = isRead; } public void setMessageState(int messageState) { this.messageState = messageState; } public boolean isRead() { return isRead; } public String getObjectId() { return objectId; } public void setObjectId(String objectId) { this.objectId = objectId; } public String getFromUserName() { return fromUserName; } public void setFromUserName(String fromUserName) { this.fromUserName = fromUserName; } public boolean isUpload() { return isUpload; } public void setUpload(boolean isUpload) { this.isUpload = isUpload; } public boolean isDownload() { return isDownload; } public void setDownload(boolean isDownload) { this.isDownload = isDownload; } public int getTimeReceive() { return timeReceive; } public void setTimeReceive(int timeReceive) { this.timeReceive = timeReceive; } /** * 解析接收到的消息 * * @param jsonData */ private void parserJsonData(String jsonData) { try { JSONObject jObject = JSON.parseObject(jsonData); type = getIntValueFromJSONObject(jObject, "type"); timeSend = getIntValueFromJSONObject(jObject, "timeSend"); fromUserId = getStringValueFromJSONObject(jObject, "fromUserId"); fromUserName = getStringValueFromJSONObject(jObject, "fromUserName"); content = getStringValueFromJSONObject(jObject, "content"); location_x = getStringValueFromJSONObject(jObject, "location_x"); location_y = getStringValueFromJSONObject(jObject, "location_y"); fileSize = getIntValueFromJSONObject(jObject, "fileSize"); timeLen = getIntValueFromJSONObject(jObject, "timeLen"); filePath=getStringValueFromJSONObject(jObject,"filePath");//增加解析文件路径 objectId=getStringValueFromJSONObject(jObject,"objectId"); // 表示未读 isRead = false; isMySend = false; isDownload = false; } catch (Exception e) { e.printStackTrace(); } } public String toJsonString(boolean isGroupChatMsg) { String msg = ""; JSONObject object = new JSONObject(); object.put("type", this.type); object.put("timeSend", this.timeSend); if (isGroupChatMsg) { object.put("fromUserId", this.fromUserId); } if (!TextUtils.isEmpty(this.fromUserName)) { object.put("fromUserName", this.fromUserName); } if (!TextUtils.isEmpty(this.content)) { object.put("content", this.content); } if (!TextUtils.isEmpty(this.location_x)) { object.put("location_x", this.location_x); } if (!TextUtils.isEmpty(this.location_y)) { object.put("location_y", this.location_y); } if (!TextUtils.isEmpty(this.objectId)) { object.put("objectId", this.objectId); } if (this.fileSize > 0) { object.put("fileSize", this.fileSize); } //增加filePath if(!TextUtils.isEmpty(this.filePath)){ object.put("filePath",this.filePath); } if (this.timeLen > 0) { object.put("timeLen", this.timeLen); } msg = object.toString(); return msg; } public boolean validate() { return type != 0 && !TextUtils.isEmpty(fromUserId) && !TextUtils.isEmpty(fromUserName) && timeSend != 0; } @Override public int describeContents() { // TODO Auto-generated method stub return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(_id); dest.writeString(content); dest.writeString(filePath); dest.writeInt(fileSize); dest.writeString(fromUserId); dest.writeString(fromUserName); dest.writeString(location_x); dest.writeString(location_y); dest.writeInt(messageState); dest.writeString(objectId); dest.writeString(packetId); dest.writeInt(sipDuration); dest.writeInt(sipStatus); dest.writeInt(timeLen); dest.writeInt(timeReceive); dest.writeInt(timeSend); dest.writeInt(type); // dest.writeBooleanArray(val); } public static final Parcelable.Creator<ChatMessage> CREATOR =new Creator<ChatMessage>() { @Override public ChatMessage createFromParcel(Parcel source) { ChatMessage message=new ChatMessage(); message._id=source.readInt(); message.content=source.readString(); message.filePath=source.readString(); message.fileSize=source.readInt(); message.fromUserId=source.readString(); message.fromUserName=source.readString(); // boolean[] val={message.isDownload,message.isMySend,message.isRead,message.isUpload}; // source.readBooleanArray(val); message.location_x=source.readString(); message.location_y=source.readString(); message.messageState=source.readInt(); message.objectId=source.readString(); message.packetId=source.readString(); message.sipDuration=source.readInt(); message.sipStatus=source.readInt(); message.timeLen=source.readInt(); message.timeReceive=source.readInt(); message.timeSend=source.readInt(); message.type=source.readInt(); return message; } @Override public ChatMessage[] newArray(int size) { return new ChatMessage[size]; } }; }
package com.rku.flowercolor; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; public class MainActivity extends AppCompatActivity { ImageView flower; Button red,green,gray; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); flower = findViewById(R.id.image_view); red = findViewById(R.id.red); green = findViewById(R.id.green); gray = findViewById(R.id.gray); red.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { flower.setImageResource(R.drawable.ic_baseline_filter_vintage_red); red.setTextColor(getResources().getColor(R.color.pink)); red.setBackgroundColor(getResources().getColor(R.color.red)); green.setTextColor(getResources().getColor(R.color.green)); green.setBackgroundColor(getResources().getColor(R.color.pink)); gray.setTextColor(getResources().getColor(R.color.gray)); gray.setBackgroundColor(getResources().getColor(R.color.pink)); } }); green.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { flower.setImageResource(R.drawable.ic_baseline_filter_vintage_green); green.setTextColor(getResources().getColor(R.color.pink)); green.setBackgroundColor(getResources().getColor(R.color.green)); red.setTextColor(getResources().getColor(R.color.red)); red.setBackgroundColor(getResources().getColor(R.color.pink)); gray.setTextColor(getResources().getColor(R.color.gray)); gray.setBackgroundColor(getResources().getColor(R.color.pink)); } }); gray.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { flower.setImageResource(R.drawable.ic_baseline_filter_vintage_gray); gray.setTextColor(getResources().getColor(R.color.pink)); gray.setBackgroundColor(getResources().getColor(R.color.gray)); green.setTextColor(getResources().getColor(R.color.green)); green.setBackgroundColor(getResources().getColor(R.color.pink)); red.setTextColor(getResources().getColor(R.color.red)); red.setBackgroundColor(getResources().getColor(R.color.pink)); } }); } }
package com.needii.dashboard.service; import java.util.List; import org.springframework.data.domain.Pageable; import com.needii.dashboard.model.City; public interface CityService { List<City> findAll(); List<City> findByName(String name, Pageable pageable); List<City> findByIdIn(List<Integer> ids); Long count(); City findOne(int 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 servlets; import java.io.IOException; import java.io.PrintWriter; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import models.Category; import models.User; import services.AccountService; import services.CategoryService; public class CategoryServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); String email = (String) session.getAttribute("currentlyLoged"); AccountService accServ = new AccountService(); User y = accServ.getUser(email); CategoryService catServ = new CategoryService(); if (email == null) { response.sendRedirect("login"); } if (y.getRole().getRoleName().equalsIgnoreCase("system admin") || y.getRole().getRoleName().equalsIgnoreCase("company admin") ) { request.setAttribute("show", email); //List <User> userList = accServ.getUsers(); List <Category> catList = catServ.getCategories(); request.setAttribute ("displayCategories", catList); String edit = request.getParameter("edit"); if(edit != null) { Category g = catServ.getCategory(Integer.valueOf(edit)); request.setAttribute("category", g); request.setAttribute("control", "Edit"); request.setAttribute("test", edit); } else { request.setAttribute("control", "Add"); } getServletContext().getRequestDispatcher("/WEB-INF/category.jsp").forward(request, response); } response.sendRedirect("login"); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { CategoryService catServ = new CategoryService(); String action = request.getParameter("option"); String categoryBox = request.getParameter("categoryBox"); String catName = request.getParameter("categoryName"); try { if(action.equals("Save")) { String categoryID = request.getParameter("edit"); catServ.update(Integer.valueOf(categoryID), categoryBox); } else if(action.equals("Add")) { catServ.insert(catName); //accServ.insert(email, fname, lname, password); } } catch(Exception e) { } response.sendRedirect("category"); } }
package pacObj; import pac.SnakeGame; public class Snake { SnakeGame main; // подключчил класс????? public int direction = 0; public int length = 2; public int snakeX[] = new int[main.WIDTH * main.HEIGHT]; // макс число // элементов // змейки public int snakeY[] = new int[main.WIDTH * main.HEIGHT]; // макс число // элементов // змейки public Snake(int x0, int y0, int x1, int y1) { // конструктор змейки snakeX[0] = x0; snakeY[0] = y0; snakeX[1] = x1; snakeY[1] = y1; } public void move() { for (int d = length; d > 0; d--) { snakeX[d] = snakeX[d - 1]; snakeY[d] = snakeY[d - 1]; } if (direction == 0) snakeX[0]++; if (direction == 1) snakeY[0]++; if (direction == 2) snakeX[0]--; if (direction == 3) snakeY[0]--; for (int d = length - 1; d > 0; d--) { if ((snakeX[0] == snakeX[d]) & (snakeY[0] == snakeY[d])) length = d - 2; } if (snakeX[0] > main.WIDTH - 1) snakeX[0] = 0; if (snakeX[0] < 0) snakeX[0] = main.WIDTH - 1; if (snakeY[0] > main.HEIGHT - 1) snakeY[0] = 0; if (snakeY[0] < 0) snakeY[0] = main.HEIGHT - 1; if (length < 2) length = 2; } }
package com.jsc.coronavirusdetails.UI.Fragment; import android.app.Dialog; import android.app.ProgressDialog; import android.content.SharedPreferences; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import androidx.annotation.Nullable; import androidx.appcompat.widget.SearchView; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.ImageButton; import android.widget.TextView; import android.widget.Toast; import com.jsc.coronavirusdetails.LocalDatabase.CoronaLDB_Details; import com.jsc.coronavirusdetails.R; import com.jsc.coronavirusdetails.UI.Adapter.CoronaRecyclerViewAdapter; import com.jsc.coronavirusdetails.UI.MainActivity; import com.jsc.coronavirusdetails.Utils.MaintainNumber; import com.jsc.coronavirusdetails.Utils.NetworkHelper; import com.jsc.coronavirusdetails.ViewModel.CoronaViewModel; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.List; import static android.content.Context.MODE_PRIVATE; /** * A simple {@link Fragment} subclass. */ public class CountryFragment extends Fragment { private CoronaRecyclerViewAdapter coronaRecyclerViewAdapter; private RecyclerView recyclerView; private CoronaViewModel coronaViewModel; private ProgressDialog progressDialog; private SearchView searchView; SwipeRefreshLayout refreshLayout; List<CoronaLDB_Details> coronaLDB_detail_local; List<String> indexNumber; TextView timeTextView; public CountryFragment() { // Required empty public constructor } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); coronaViewModel = new ViewModelProvider(this).get(CoronaViewModel.class); coronaRecyclerViewAdapter = new CoronaRecyclerViewAdapter(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_country, container, false); recyclerView = view.findViewById(R.id.recyclerViewId); refreshLayout = view.findViewById(R.id.CountrySwipeRefreshLayoutId); timeTextView = getActivity().findViewById(R.id.timeTextViewId); indexNumber = new ArrayList<>(); recyclerView.setLayoutManager(new LinearLayoutManager(view.getContext())); recyclerView.setHasFixedSize(true); /*****************Using General RecyclerView Adapter***************/ recyclerView.setAdapter(coronaRecyclerViewAdapter); searchView = view.findViewById(R.id.searchViewId); /*****************Using General RecyclerView Adapter***************/ coronaRecyclerViewAdapter = new CoronaRecyclerViewAdapter(); recyclerView.setAdapter(coronaRecyclerViewAdapter); progressDialog= ProgressDialog.show(view.getContext(), "Loading...", "Please wait...", true); coronaViewModel.getAllCoronaDetails().observe(getActivity(), new Observer<List<CoronaLDB_Details>>() { @Override public void onChanged(List<CoronaLDB_Details> coronaLDB_details) { try { setCoronaList(coronaLDB_details); } catch (Exception e) { e.printStackTrace(); } } }); /*****************Using General RecyclerView Adapter***************/ coronaRecyclerViewAdapter.setOnItemClickListener(new CoronaRecyclerViewAdapter.OnItemClickListener() { @Override public void onItemClick(CoronaLDB_Details coronaDetails) { setDialog(coronaDetails); } }); searchView.setOnQueryTextListener(listener); refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { refreshButtonClick(view); } }); return view; } private void setCoronaList(List<CoronaLDB_Details> coronaLDB_details){ coronaLDB_details.remove(0); for (int i = 1; i <= coronaLDB_details.size();i++){ indexNumber.add(String.valueOf(i)); } this.coronaLDB_detail_local = coronaLDB_details; coronaRecyclerViewAdapter.setCoronaDetails(coronaLDB_details,indexNumber); if(progressDialog!=null && progressDialog.isShowing()){ progressDialog.dismiss(); } } private void setDialog(CoronaLDB_Details coronaLDB_details){ final Dialog dialog = new Dialog(getActivity()); dialog.setContentView(R.layout.country_details_layout); dialog.setCanceledOnTouchOutside(false); ImageButton imageButton = dialog.findViewById(R.id.crossButtonId); TextView countryName = dialog.findViewById(R.id.CountryHeadingId); TextView totalInfected = dialog.findViewById(R.id.countryInfectedTextViewId); TextView activeInfected = dialog.findViewById(R.id.countryActiveInfectedTextViewId); TextView totalDeaths = dialog.findViewById(R.id.countryDeathTextViewId); TextView totalRecovered = dialog.findViewById(R.id.countryRecoveredTextViewId); TextView todayInfected = dialog.findViewById(R.id.countryTodayInfectedTextViewId); TextView todayDeaths = dialog.findViewById(R.id.countryTodayDeathTextViewId); TextView infectedPerMili = dialog.findViewById(R.id.countryInfectedPerMiTextViewId); TextView deathPerMili = dialog.findViewById(R.id.countryDeathsPerOneMilTextViewId); TextView totalTest = dialog.findViewById(R.id.countryTotalTestTextViewId); countryName.setText(coronaLDB_details.getCountry()); totalInfected.setText(MaintainNumber.getRoundOffValue(coronaLDB_details.getCases())); activeInfected.setText(MaintainNumber.getRoundOffValue(coronaLDB_details.getActive())); totalDeaths.setText(MaintainNumber.getRoundOffValue(coronaLDB_details.getDeaths())); totalRecovered.setText(MaintainNumber.getRoundOffValue(coronaLDB_details.getRecovered())); if (coronaLDB_details.getTodayCases()==0){ todayInfected.setText("Update not provided yet"); }else { todayInfected.setText(MaintainNumber.getRoundOffValue(coronaLDB_details.getTodayCases())); } if (coronaLDB_details.getTodayDeaths()==0){ todayDeaths.setText("Update not provided yet"); }else { todayDeaths.setText(MaintainNumber.getRoundOffValue(coronaLDB_details.getTodayDeaths())); } infectedPerMili.setText(MaintainNumber.getRoundOffValue(coronaLDB_details.getCasesPerOneMillion())); deathPerMili.setText(MaintainNumber.getRoundOffValue(coronaLDB_details.getDeathsPerOneMillion())); totalTest.setText(MaintainNumber.getRoundOffValue(coronaLDB_details.getTotalTests())); imageButton.setOnClickListener(v -> dialog.dismiss()); dialog.show(); Window window = dialog.getWindow(); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); } SearchView.OnQueryTextListener listener = new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String newText) { List<CoronaLDB_Details> coronaLDB_details_update = new ArrayList<>(); List<String> indexNumber_update = new ArrayList<>(); int i = 0; for(CoronaLDB_Details name : coronaLDB_detail_local){ String countryName = indexNumber.get(i)+" "+name.getCountry(); //Get every letter into same order and find the match if (countryName.toLowerCase().contains(newText.toLowerCase())){ // Added to the new List coronaLDB_details_update.add(name); indexNumber_update.add(indexNumber.get(i)); } i++; } coronaRecyclerViewAdapter.setCoronaDetails(coronaLDB_details_update,indexNumber_update); return true; } }; private void refreshButtonClick(View view) { boolean isNetworkConnected = NetworkHelper.isNetworkAvailable(view.getContext()); if (isNetworkConnected){ Calendar c = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("hh:mm aa (dd-MM-yyyy)"); String datetime = "Last Update : "+sdf.format(c.getTime()); SharedPreferences sharedPreferences = view.getContext().getSharedPreferences("sharedPreferences",MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString("time",datetime); editor.apply(); coronaViewModel.updateCoronaDetails(); String time = sharedPreferences.getString("time",null); timeTextView.setText(time); }else{ Toast.makeText(view.getContext(), "Network Unavailable", Toast.LENGTH_SHORT).show(); } refreshLayout.setRefreshing(false); } }
import java.io.*; public class CSVReader { private BufferedReader br = null; private boolean hasNextLine = true; private String nextLine; public CSVReader(String csvFile) throws IOException { try { br = new BufferedReader(new FileReader(csvFile)); nextLine = br.readLine(); //lines = br.lines(); } catch (FileNotFoundException e) { System.out.println("There was a problem with one of the files."); } } public Picture getNextPicture() throws IOException { int label; int[] pixelVector = new int[Utils.VEC_SIZE]; if (nextLine != null) { label = nextLine.charAt(0) - 48; int pixel = 0; int index = 0; for (int i = 2; i < nextLine.length(); i++) { if (nextLine.charAt(i) == ',') { pixelVector[index++] = pixel; pixel = 0; continue; } pixel *= 10; pixel += (nextLine.charAt(i) - 48); } hasNextLine = (nextLine = br.readLine()) != null; return new Picture(label, pixelVector); } else { throw new RuntimeException("no more"); } } public boolean hasNextLine() { return hasNextLine; } public void close() throws IOException { br.close(); } }
class Super1 { void prt() { System.out.println("prt Super1"); } } class Sub1 extends Super1 { @Override void prt() { System.out.println("prt!! Sub"); } } public class A6OverrideTest4 { public static void main(String[] args) { // TODO Auto-generated method stub } }
package com.tibia.facade; import java.awt.AWTException; import java.io.IOException; import java.util.List; import javax.swing.JDialog; import javax.swing.JOptionPane; import com.tibia.helper.ConstantsHelper; import com.tibia.helper.ImageHelper; import com.tibia.helper.KeyboardHelper; import com.tibia.helper.MouseHelper; import com.tibia.helper.UtilHelper; import com.tibia.helper.XMLHelper; import com.tibia.model.Item; import net.sourceforge.tess4j.TesseractException; public class Facade { private List<Item> items; private ImageHelper image; private MouseHelper mouse; private KeyboardHelper keyboard; private XMLHelper xml; private ConstantsHelper constants; private UtilHelper util; public Facade() throws AWTException { image = new ImageHelper(); mouse = new MouseHelper(); keyboard = new KeyboardHelper(); xml = new XMLHelper(); constants = new ConstantsHelper(); util = new UtilHelper(); } public void run() throws InterruptedException, AWTException, IOException, TesseractException { showMessage("Bem-vindo \n\n 1) Abra a janela do Tibia. \n 2) Aperte Alt + F8 para verificação de latência. \n 3) Abra a janela do Market. \n 4) Aperte OK. \n\n"); int currentPing = Integer.parseInt(util.normalizePing(image.getTextFromImage(constants.PING_X_TOP, constants.PING_Y_TOP, constants.PING_X_BOTTOM, constants.PING_Y_BOTTOM))); items = xml.getItemsList(); boolean isTheFirstNegotiation = true; for (int i = 0; i < items.size(); i++) { String isMarketOpened = util.normalizeId(image.getTextFromImage(constants.MARKET_TITLE_X_TOP, constants.MARKET_TITLE_Y_TOP, constants.MARKET_TITLE_X_BOTTOM, constants.MARKET_TITLE_Y_BOTTOM)); if (!isMarketOpened.equals("Market")) { isTheFirstNegotiation = true; showMessage("A janela do Market está fechada."); i--; continue; } if (currentPing > constants.MAX_ACCEPTED_LATENCY) { isTheFirstNegotiation = true; showMessage("Seu ping está muito alto para poder executar o MarketMaker."); i--; continue; } if (isTheFirstNegotiation) { mouse.clickOnAnonymous(); mouse.clickOnBuyButton(); isTheFirstNegotiation = false; } buyItem(items.get(i)); } mouse.clickOnCloseMarket(); System.exit(0); } private void removeOverpricedItems(Item item) throws InterruptedException, AWTException, IOException, TesseractException { mouse.clickOnSearchBox(); delay(500); keyboard.selectAllTextAndDelete(); delay(1000); keyboard.type(item.getName()); delay(500); mouse.clickOnFirstFound(); delay(1500); String price = util.normalizePrice(image.getTextFromImage( constants.PIECE_PRICE_X_TOP, constants.PIECE_PRICE_Y_TOP, constants.PIECE_PRICE_X_BOTTOM, constants.PIECE_PRICE_Y_BOTTOM)); if (!price.equals("")) { if (Integer.parseInt(price) > item.getPrice()) { System.out.println(item.getName() + " deletado."); xml.deleteItem(item.getName()); } } } private void removeLowTransactionsItems(Item item) throws InterruptedException, AWTException, IOException, TesseractException { mouse.clickOnSearchBox(); delay(500); keyboard.selectAllTextAndDelete(); delay(1000); keyboard.type(item.getName()); delay(500); mouse.clickOnFirstFound(); delay(1500); mouse.clickOnDetailsButton(); int numberOfTransactions = Integer.parseInt( util.normalizeNumber(image.getTextFromImage( constants.NUMBER_TRANSACTIONS_X_TOP, constants.NUMBER_TRANSACTIONS_Y_TOP, constants.NUMBER_TRANSACTIONS_X_BOTTOM, constants.NUMBER_TRANSACTIONS_Y_BOTTOM))); if (numberOfTransactions < constants.NUMBER_OF_TRANSACTIONS_REQUIRED) { xml.deleteItem(item.getName()); } } private void buyItem(Item item) throws InterruptedException, AWTException, IOException, TesseractException { mouse.clickOnSearchBox(); delay(500); keyboard.selectAllTextAndDelete(); delay(1000); keyboard.type(item.getName()); delay(500); mouse.clickOnFirstFound(); delay(2500); String id = util.normalizeId(image.getTextFromImage( constants.FIRST_SELLER_END_AT_X_TOP, constants.FIRST_SELLER_END_AT_Y_TOP, constants.FIRST_SELLER_END_AT_X_BOTTOM, constants.FIRST_SELLER_END_AT_Y_BOTTOM)); if (id.equals(item.getId())) { /** * Se já existir uma oferta. */ System.out.println("Não comprou " + item.getName() + ". Você já possui uma oferta corrente."); } else { /** * Se não existir nenhuma oferta: */ if (id.equals("")) { int firstOffer = Math.round((item.getPrice() / 2)); mouse.clickOnPiecePriceBox(); delay(500); keyboard.selectAllTextAndDelete(); delay(1000); keyboard.type(String.valueOf(firstOffer)); delay(500); for (int i = 1; i < item.getBuy(); i++) { mouse.clickOnIncreaseItemQuantity(); delay(50); } mouse.clickOnCreateOffer(); delay(1500); String createdId = util.normalizeId(image.getTextFromImage( constants.FIRST_SELLER_END_AT_X_TOP, constants.FIRST_SELLER_END_AT_Y_TOP, constants.FIRST_SELLER_END_AT_X_BOTTOM, constants.FIRST_SELLER_END_AT_Y_BOTTOM)); delay(1000); xml.updateItemId(createdId, item.getName()); System.out.println("Primeiro ao comprar " + item.getName() + " por: " + firstOffer); } else { /** * Se já existir alguma oferta: * Verificar se há alguma oferta obsoleta. */ boolean foundObsoleteOfferId = false; boolean foundObsoleteOfferRow = false; for (int f = 0; f < constants.NUMBER_OF_OFFERS_TO_CHECK; f++) { if (!foundObsoleteOfferId) { String currentRowId = util.normalizeId(image.getTextFromImage( constants.FIRST_SELLER_END_AT_X_TOP, constants.FIRST_SELLER_END_AT_Y_TOP, constants.FIRST_SELLER_END_AT_X_BOTTOM, constants.FIRST_SELLER_END_AT_Y_BOTTOM, f)); System.out.println("Janela Market Linha Atual: " + currentRowId); if (!currentRowId.equals("")) { if (item.getId().equals(currentRowId)) { System.out.println("Cancelar a oferta obsoleta que está na linha " + (f + 1) + "."); foundObsoleteOfferId = true; mouse.clickOnMyOffers(); delay(2500); int totalOfBuyOffers = Integer.parseInt(util.normalizeId(image.getTextFromImage( constants.NUMBER_OF_BUY_OFFERS_X_TOP, constants.NUMBER_OF_BUY_OFFERS_Y_TOP, constants.NUMBER_OF_BUY_OFFERS_X_BOTTOM, constants.NUMBER_OF_BUY_OFFERS_Y_BOTTOM))); int numberOfHiddenBuyOffers = totalOfBuyOffers - constants.NUMBER_OF_VISIBLE_BUY_OFFERS; mouse.clickOnFirstBuyOffer(); String currentBuyOfferId; for (int g = 0; g < constants.NUMBER_OF_VISIBLE_BUY_OFFERS; g++) { if (!foundObsoleteOfferRow) { currentBuyOfferId = util.normalizeId(image.getTextFromImage( constants.FIRST_BUY_OFFER_END_AT_X_TOP, constants.FIRST_BUY_OFFER_END_AT_Y_TOP, constants.FIRST_BUY_OFFER_END_AT_X_BOTTOM, constants.FIRST_BUY_OFFER_END_AT_Y_BOTTOM, g)); System.out.println("Janela Buy Offers Linha Atual: " + currentBuyOfferId); if (currentBuyOfferId.equals("\"?\\it;“A") || currentBuyOfferId.equals("\"\"?\\it;“A\"")) { foundObsoleteOfferRow = true; mouse.clickOnBackToMarket(); delay(2000); break; } else { if (item.getId().equals(currentBuyOfferId)) { delay(1000); mouse.clickOnCancelOffer(); delay(1000); foundObsoleteOfferRow = true; mouse.clickOnBackToMarket(); delay(2000); System.out.println("Oferta do item " + item.getName() + " com o id: " + currentBuyOfferId + ". Cancelada com sucesso."); break; } else { keyboard.type("ˇ"); delay(100); } } } } if (!foundObsoleteOfferRow) { for (int h = 0; h < numberOfHiddenBuyOffers; h++) { currentBuyOfferId = util.normalizeId(image.getTextFromImage( constants.LAST_BUY_OFFER_END_AT_X_TOP, constants.LAST_BUY_OFFER_END_AT_Y_TOP, constants.LAST_BUY_OFFER_END_AT_X_BOTTOM, constants.LAST_BUY_OFFER_END_AT_Y_BOTTOM)); System.out.println("Janela Buy Offers Linha Atual: " + currentBuyOfferId); if (currentBuyOfferId.equals("\"?\\it;“A") || currentBuyOfferId.equals("\"\"?\\it;“A\"")) { foundObsoleteOfferRow = true; mouse.clickOnBackToMarket(); delay(2000); break; } else { if (item.getId().equals(currentBuyOfferId)) { delay(1000); mouse.clickOnCancelOffer(); delay(1000); foundObsoleteOfferRow = true; mouse.clickOnBackToMarket(); delay(2000); System.out.println("Oferta do item " + item.getName() + " com o id: " + currentBuyOfferId + ". Cancelada com sucesso."); break; } else { keyboard.type("ˇ"); delay(100); } } } } } } } } /** * Iniciar o processo de compra */ int price = Integer.parseInt(util.normalizePrice(image.getTextFromImage( constants.PIECE_PRICE_X_TOP, constants.PIECE_PRICE_Y_TOP, constants.PIECE_PRICE_X_BOTTOM, constants.PIECE_PRICE_Y_BOTTOM))); price = (price + 1); /** * Se o maior preço ofertado for menor que o preço do item: */ if (price < item.getPrice()) { mouse.clickOnPiecePriceBox(); delay(500); keyboard.selectAllTextAndDelete(); delay(1000); keyboard.type(String.valueOf(price)); delay(500); for (int i = 1; i < item.getBuy(); i++) { mouse.clickOnIncreaseItemQuantity(); delay(150); } mouse.clickOnCreateOffer(); delay(1500); String createdId = util.normalizeId(image.getTextFromImage( constants.FIRST_SELLER_END_AT_X_TOP, constants.FIRST_SELLER_END_AT_Y_TOP, constants.FIRST_SELLER_END_AT_X_BOTTOM, constants.FIRST_SELLER_END_AT_Y_BOTTOM)); delay(1000); xml.updateItemId(createdId, item.getName()); System.out.println("Comprando " + item.getName() + " por: " + price + " gps."); } else { System.out.println("Não comprou " + item.getName() + ". Caro demais."); } } } delay(2000); } private void delay(int milliseconds) throws InterruptedException { Thread.sleep(milliseconds); } private void showMessage(String message) { JOptionPane jOptionPane = new JOptionPane(); jOptionPane.setMessage(message); JDialog dialog = jOptionPane.createDialog(null); dialog.setTitle(constants.PROGRAM_TITLE); dialog.setAlwaysOnTop(true); dialog.setVisible(true); } }
/** * */ package com.adobe.prj.dao; import java.util.List; import com.adobe.prj.dto.ProjectDetailsDto; /** * @author danchara * Declares methods for CRUD operations on project_employee table. */ public interface ProjectEmployeeDao { /* * Adds new project-manager assignment . Implementation must update has_project_manager * field of concerned project in project table to be true ,else inconsistency will creep in. * * @param projectId id of project which is being assigned a manager * @param managerId employee if of manager * * @return number of rows effected : 1 means successful operation , anything else * indicate failure * @throws PersistenceException * */ public int addProjectManagerAssignemnt(int projectId, int managerId) throws PersistenceException; /* * Adds new project-staff assignment . * * @param projectId id of project which is assigned a staff . * @param staffId employee id of staff member * * @return number of rows effected :1 means successful operation , anything else * indicate failure * * @throws PersistenceException */ public int addProjectStaffAssignment(int projectId, int staffId) throws PersistenceException; /* * For getting all details for a project for listing as per requirement (e). * * @param projectId id of project for which details are fetched * * @return ProjectDetailsDto : contains info such as project name ,manager , staff members . * * @throws FetchException */ public ProjectDetailsDto getProjectDetailForListing(int projectId) throws FetchException; /* * For fetching list of ProjectDetailsDto(s) . Internally calls getProjectDetailForListing(int projectId) to get Dto(s) for * individual projects and forming a list . * * @return list of ProjectDetailsDto * @throws FetchException */ public List<ProjectDetailsDto> getAllProjectsDetailsForListing() throws FetchException; }
package tarea19; public class NoMainKevin { public void registro1(String numCedula, String Nombre) { System.out.println("Bienvenido a nuestra plataforma"); System.out.println("Su numero de cedula es:"); System.out.println(numCedula); System.out.println(Nombre+" usted no esta registrado en esta plataforma"); } }
package net.lvcy.card.entity.gate.max; import net.lvcy.card.core.AbstarctCard; import net.lvcy.card.entity.CombinNine; import net.lvcy.card.entity.gate.MaxCard; import net.lvcy.card.eumn.CardType; public class SixSix extends AbstarctCard implements MaxCard, CombinNine { public SixSix() { this.type = CardType.SIX_SIX; } }
package com.example.download; import java.io.IOException; import java.util.concurrent.TimeUnit; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.Response; /** * Created by ZYB on 2017-03-13. */ public class HttpClientHelper { //用于download,提供下载进度 public static OkHttpClient getClient(final ProgressListener progressListener) { OkHttpClient okHttpClient = new OkHttpClient.Builder() .addNetworkInterceptor(new Interceptor() { @Override public Response intercept(Chain chain) throws IOException { Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder().body( new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }) .readTimeout(30, TimeUnit.SECONDS) .build(); return okHttpClient; } }
package eden.mobv.api.fei.stu.sk.mobv_eden.resources; import com.google.firebase.Timestamp; import java.util.ArrayList; import java.util.List; public class User { private static User instance; private String username; private Timestamp date; private int numberOfPosts; public List<Post> getPosts() { return posts; } public void setPosts(List<Post> posts) { this.posts = posts; } private List<Post> posts; private User() { this.posts = new ArrayList<>(); } static { instance = new User(); } public static User getInstance() { return instance; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public Timestamp getDate() { return date; } public void setDate(Timestamp date) { this.date = date; } public int getNumberOfPosts() { return numberOfPosts; } public void setNumberOfPosts(int numberOfPosts) { this.numberOfPosts = numberOfPosts; } }
package com.trump.auction.back.config.enums; import lombok.Getter; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; /** * @author Created by wangjian on 2018/01/05. * banner URL跳转类型 */ public enum BannerJumpTypeEnum { APP(1,"APP"),H5(2,"H5"); @Getter private Integer code; @Getter private String desc; BannerJumpTypeEnum(Integer code, String desc) { this.code = code; this.desc = desc; } private static Map<Integer, BannerJumpTypeEnum> codeToEnums = new HashMap<Integer, BannerJumpTypeEnum>(); static { for (BannerJumpTypeEnum e : values()) { codeToEnums.put(e.code, e); } } public static BannerJumpTypeEnum of(Integer code) { BannerJumpTypeEnum e = codeToEnums.get(code); if (e == null) { throw new IllegalArgumentException("No such enum code: " + code); } return e; } public static Map<Integer, String> getAllType() { Map<Integer, String> ALL_EXPRESSION = new LinkedHashMap<Integer, String>(); for (BannerJumpTypeEnum merchantType : values()) { ALL_EXPRESSION.put(merchantType.getCode(), merchantType.getDesc()); } return ALL_EXPRESSION; } }
package com.git.cloud.resmgt.common.dao.impl; import java.util.HashMap; import java.util.List; import java.util.Map; import com.git.cloud.common.dao.CommonDAOImpl; import com.git.cloud.common.exception.RollbackableBizException; import com.git.cloud.foundation.util.CollectionUtil; import com.git.cloud.resmgt.common.dao.ICmPasswordDAO; import com.git.cloud.resmgt.common.model.po.CmPasswordPo; import com.google.common.collect.Maps; public class CmPasswordDAO extends CommonDAOImpl implements ICmPasswordDAO { public void insertCmPassword(List<CmPasswordPo> pwdList) throws RollbackableBizException { if(CollectionUtil.hasContent(pwdList)){ this.batchInsert("cmPasswordBatchInsert",pwdList); } } public CmPasswordPo findCmPasswordByResourceId(String resourceId) throws RollbackableBizException { Map<String, Object> paramMap = new HashMap<String, Object> (); paramMap.put("resourceId", resourceId); List<CmPasswordPo> pwdList = this.findListByParam("findCmPasswordByResourceId", paramMap); CmPasswordPo pwd = null; if(pwdList != null && pwdList.size() > 0) { pwd = pwdList.get(0); } return pwd; } public CmPasswordPo findCmPasswordByResourceId(String resourceId, String userName) throws RollbackableBizException { Map<String, Object> paramMap = new HashMap<String, Object> (); paramMap.put("resourceId", resourceId); paramMap.put("userName", userName); List<CmPasswordPo> pwdList = this.findListByParam("findCmPasswordByResourceId", paramMap); CmPasswordPo pwd = null; if(pwdList != null && pwdList.size() > 0) { pwd = pwdList.get(0); } return pwd; } public CmPasswordPo findCmPasswordByResourceUser(String resourceId,String userName) throws RollbackableBizException { Map<String,String> params = Maps.newHashMap(); params.put("resourceId", resourceId); params.put("userName", userName); List<CmPasswordPo> pwdList = this.findListByParam("findCmPasswordByResourceUser", params); CmPasswordPo pwd = null; if(pwdList != null && pwdList.size() > 0) { pwd = pwdList.get(0); } return pwd; } @Override public void insertCmPassword(CmPasswordPo cmPasswordPo) throws RollbackableBizException { super.save("insertCmPassword", cmPasswordPo); } @Override public void updateCmPassword(CmPasswordPo cmPasswordPo) throws RollbackableBizException { super.update("updateCmPassword", cmPasswordPo); } public void deleteCmPassword(String resourceId) throws RollbackableBizException{ Map<String,String> param = Maps.newHashMap(); param.put("resourceId", resourceId); this.deleteForParam("cmPassword.delete", param); } }
/* * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.expression; /** * Implementers of this interface are expected to be able to locate types. * They may use a custom {@link ClassLoader} and/or deal with common * package prefixes (e.g. {@code java.lang}) however they wish. * * <p>See {@link org.springframework.expression.spel.support.StandardTypeLocator} * for an example implementation. * * @author Andy Clement * @since 3.0 */ @FunctionalInterface public interface TypeLocator { /** * Find a type by name. The name may or may not be fully qualified * (e.g. {@code String} or {@code java.lang.String}). * @param typeName the type to be located * @return the {@code Class} object representing that type * @throws EvaluationException if there is a problem finding the type */ Class<?> findType(String typeName) throws EvaluationException; }
package net.sourceforge.jFuzzyLogic.test.performance; import java.awt.BasicStroke; import java.awt.Color; import java.util.List; import net.sourceforge.jFuzzyLogic.PlotWindow; import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.xy.XYItemRenderer; import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeriesCollection; public class PerformanceChart { private String chartTitle; private int stepSize; private XYSeriesCollection xyDataset; public PerformanceChart(int stepSize, String chartTitle) { super(); this.stepSize = stepSize; xyDataset = new XYSeriesCollection(); this.chartTitle = chartTitle; } void addData(List data, String title) { int xx = 0; XYSeries series = new XYSeries(title); for( int i = 0; i < data.size(); i++, xx += stepSize ) { series.add(xx, ((Double) data.get(i)).doubleValue()); } xyDataset.addSeries(series); } void display(String windowTitle) { // Create plot and show it JFreeChart chart = ChartFactory.createXYLineChart(chartTitle, "No. of Fuzzy Inference Cycles", "Time (ms)", xyDataset, PlotOrientation.VERTICAL, true, true, true); chart.setBackgroundPaint(Color.white); final XYPlot xyPlot = chart.getXYPlot(); final XYItemRenderer renderer = xyPlot.getRenderer(); if( renderer instanceof XYLineAndShapeRenderer ) { final XYLineAndShapeRenderer rr = (XYLineAndShapeRenderer) renderer; //rr.setShapesVisible(true); // rr.setDefaultShapesFilled(false); rr.setSeriesStroke(1, new BasicStroke(1.2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 6f, 3f }, 0.0f)); rr.setSeriesStroke(2, new BasicStroke(1.2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 10f, 6f }, 0.0f)); rr.setSeriesStroke(3, new BasicStroke(1.2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 5f, 5f }, 0.0f)); rr.setSeriesPaint(0, Color.BLACK); rr.setSeriesPaint(1, Color.GREEN); rr.setSeriesPaint(2, Color.RED); rr.setSeriesPaint(3, Color.BLUE); rr.setLinesVisible(true); //rr.setSeriesShape(0, ShapeUtilities.createDiamond(5)); } PlotWindow.showIt(windowTitle, chart); } }