text
stringlengths 10
2.72M
|
|---|
/*
* 메인 메뉴 화면
*/
package com.example.test;
import java.lang.ref.WeakReference;
import java.net.Socket;
import com.google.android.gcm.GCMRegistrar;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
public class Mainselect extends Activity {
String id;
Socket client;
Thread thread;
LoginThread loginThread;
private final mainHandler ghandler=new mainHandler(this);
private static class mainHandler extends Handler{
private final WeakReference<Mainselect> aActivity;
public mainHandler(Mainselect activity){
aActivity = new WeakReference<Mainselect>(activity);
}
@Override
public void handleMessage(Message msg){
Mainselect activity=aActivity.get();
if(activity!=null){
activity.handleMessage(msg);
}
}
}
private void handleMessage(Message msg){
Bundle bundle = msg.getData();
int result=bundle.getInt("result");
if(result==5)
{
Log.v("태그","기기 등록 잘 됐음.");
}
}//기기등록.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mainselect);
MainActivity ma=new MainActivity();
Typeface mTypeface=Typeface.createFromAsset(getAssets(), "fonts/hun.ttf");
ViewGroup root = (ViewGroup) findViewById(android.R.id.content);
ma.setGlobalFont(root,mTypeface);
registerGcm();
Intent intent_01 = getIntent();
id = intent_01.getStringExtra("아이디");
}
public void registerGcm()
{
GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
final String regId = GCMRegistrar.getRegistrationId(this);
if(regId.equals(""))
{
GCMRegistrar.register(this, "938564819292");
}
else
{
thread = new Thread(){
public void run() {
super.run();
SocketService s=new SocketService();
client = s.getsocket();
loginThread = new LoginThread(client, ghandler, id, regId,4);
loginThread.start();
}
};
thread.start();
Log.e("id", regId);
}
}
public void select1(View v){
Intent intent=new Intent(getApplicationContext(), makeroom.class);
intent.putExtra("아이디", id);
startActivity(intent);
}//방생성 메뉴
public void select2(View v){
Intent intent=new Intent(getApplicationContext(), Selectgroup.class);
intent.putExtra("아이디", id);
startActivity(intent);
}//전체 약정방 보기 메뉴
public void select3(View v){
Intent intent=new Intent(getApplicationContext(), findmyfriend.class);
intent.putExtra("아이디", id);
startActivity(intent);
}//친구 관리 메뉴
public void select4(View v){
Intent intent=new Intent(getApplicationContext(), Settingmain.class);
intent.putExtra("아이디", id);
startActivity(intent);
}//세팅 메뉴
public void home(View v)
{
Intent intent=new Intent(getApplicationContext(), Mainselect.class);
intent.putExtra("아이디", id);
startActivity(intent);
}
public void setting(View v)
{
Intent intent=new Intent(getApplicationContext(), Settingmain.class);
intent.putExtra("아이디", id);
startActivity(intent);
}
}
|
package com.example.spring.application.annotation;
import com.example.spring.beans.ObjectA;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import java.io.IOException;
@ComponentScan(basePackages = {"com.example.lcc.basic.spring.beans"})
public class AnnotationApp {
public static void main(String[] args) throws IOException {
AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(AnnotationApp.class);
applicationContext.start();
System.out.println(applicationContext.getBean(ObjectA.class).objectB);
System.out.println(System.in.read());
}
}
|
package pl.rafalmurawski.basic_auth_h2_project.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pl.rafalmurawski.basic_auth_h2_project.service.UserService;
@RestController
@RequestMapping("/user")
public class UserApi {
@Autowired
UserService userService;
@GetMapping
public String whoIsLgged() {
return userService.whoIsLogged();
}
}
|
/*
*
* [y] hybris Platform
*
* Copyright (c) 2000-2016 SAP SE
* All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* Hybris ("Confidential Information"). You shall not disclose such
* Confidential Information and shall use it only in accordance with the
* terms of the license agreement you entered into with SAP Hybris.
*
*/
package com.cnk.travelogix.common.core.payment.criterias;
import com.cnk.travelogix.common.core.enums.ProductTypeEnum;
/**
* @author i323727
*
*/
public class OrderTicketCriteria extends AbstractOrderEntryCriteria
{
/*
* (non-Javadoc)
*
* @see com.cnk.travelogix.common.core.payment.criterias.AbstractOrderEntryCriteria#getProductType()
*/
@Override
public ProductTypeEnum getProductType()
{
return ProductTypeEnum.TICKET;
}
}
|
package com.tencent.mm.plugin.appbrand.ui;
import com.tencent.mm.plugin.appbrand.r.k.a;
import java.util.List;
public abstract class AppBrandLauncherUI$c<T> extends a {
public final List<T> guO;
public final List<T> guP;
public AppBrandLauncherUI$c(List<T> list, List<T> list2) {
this.guO = list;
this.guP = list2;
}
public final int anr() {
return this.guO == null ? 0 : this.guO.size();
}
public final int ans() {
return this.guP == null ? 0 : this.guP.size();
}
}
|
package fragments;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.GridView;
import com.example.zeky.arsamandi.DetallesEventos;
import com.example.zeky.arsamandi.R;
import java.util.ArrayList;
import Model.Evento;
import controller.MyAdapter;
public class ProximosEventos extends Fragment {
public ProximosEventos() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_proximos_eventos, container, false);
GridView listaEventos = (GridView) v.findViewById(R.id.gridView);
final ArrayList<Evento> eventos = crearEventos();
listaEventos.setAdapter(new MyAdapter(v.getContext(), eventos));
listaEventos.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent i = new Intent(view.getContext(), DetallesEventos.class);
i.putExtra("evento", eventos.get(position));
startActivity(i);
}
});
return v;
}
public ArrayList<Evento> crearEventos(){
ArrayList<Evento> eventos = new ArrayList<>();
eventos.add(new Evento("Cata de vino","solteros","Plaza de la Encarnación", R.drawable.cata, "18/06/2016", "21:30"));
eventos.add(new Evento("Crucero por el río", "solteros","Torre del Oro",R.drawable.crucero_por_el_guadalquivir, "19/06/2016", "12:30"));
eventos.add(new Evento("Casas Palacio", "solteros", "Puerta Jerez", R.drawable.casa_palacio, "25/06/2016", "12:00"));
eventos.add(new Evento("Bécquer Parque Mª Luisa", "solteros", "Glorieta de Bécquer", R.drawable.glorieta,"04/06/2016", "12:00"));
return eventos;
}
}
|
package com.link.api.service.base;
import com.jfinal.plugin.activerecord.Model;
import com.link.common.util.DataGrid;
import com.link.common.util.JqGrid;
import com.link.common.util.ResultJson;
import com.link.model.Channel;
import java.util.List;
/**
* Created by linkzz on 2017-05-26.
*/
public interface BaseServiceI {
/**
* @Description: 封装数据表格
* @author: linkzz
* @data: 2017-05-07 0:10
*/
public DataGrid dataGrid(JqGrid jqGrid, Model menu, String table);
/**
* @Description: 封装treeGrid数据
* @author: linkzz
* @data: 2017-06-06 9:27
*/
public DataGrid treeDataGrid(JqGrid jqGrid, Model t, String table);
/**
* @Description: 增删改一起做
* @author: linkzz
* @data: 2017-06-02 13:08
*/
public ResultJson saveOrUpdate(Model model, String id, String table, JqGrid jqGrid);
public List<Channel> treeChannel();
}
|
import java.awt.*; import java.awt.event.*;
public class ExitButton extends Button implements ActionListener
{ public ExitButton() { super("Exit"); addActionListener(this); }
public void actionPerformed(ActionEvent evt) { System.exit(0); }
}
|
package com.example.webproject.repository.jpa;
import com.example.webproject.models.Recipe;
import com.example.webproject.models.vm.Page;
import com.example.webproject.repository.RecipeRepositoryInterface;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
@Repository
public class RecipeRepositoryImpl implements RecipeRepositoryInterface {
private final RecipeRepository recipeRepository;
public RecipeRepositoryImpl(@Lazy RecipeRepository recipeRepository){
this.recipeRepository = recipeRepository;
}
@Override
public Recipe save(Recipe recipe) {
return recipeRepository.save(recipe);
}
@Override
public Page<Recipe> getAllRecipes(int page, int size) {
org.springframework.data.domain.Page<Recipe> result = recipeRepository.findAll(PageRequest.of(page, size));
return new Page<>(page,
result.getTotalPages(),
size,
result.getContent());
}
@Override
public Page<Recipe> findByTitle(String title, List<String> ing, int page, int size) {
org.springframework.data.domain.Page<Recipe> result = recipeRepository.findRecipeByTitleOrIngredientsContaining(title, ing, PageRequest.of(page, size));
return new Page<>(page,
result.getTotalPages(),
size,
result.getContent());
}
@Override
public List<Recipe> searchRecipes(String term, int page, int size) {
return recipeRepository.findRecipeByIngredientsContaining(term, PageRequest.of(page, size));
}
@Override
public Optional<Recipe> findById(String recipeId) {
return recipeRepository.findById(recipeId);
}
@Override
public void deleteById(String recipeId) {
recipeRepository.deleteById(recipeId);
}
}
|
package com.bingo.code.example.design.abstractfactory.dao;
public class BusinessObject {
public static void main(String[] args) {
DAOFactory df = new RdbDAOFactory();
OrderMainDAO mainDAO = df.createOrderMainDAO();
OrderDetailDAO detailDAO = df.createOrderDetailDAO();
mainDAO.saveOrderMain();
detailDAO.saveOrderDetail();
}
}
|
package be.klak.whatsthat.domain;
import com.googlecode.objectify.annotation.Embed;
@Embed
public class DrawablePiece {
private int x;
private int y;
private boolean piece;
public DrawablePiece() {
}
public DrawablePiece(int x, int y) {
this(x, y, false);
}
public DrawablePiece(int x, int y, boolean piece) {
this.x = x;
this.y = y;
this.piece = piece;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public boolean isPiece() {
return piece;
}
public void setX(int x) {
this.x = x;
}
public void setY(int y) {
this.y = y;
}
public void setPiece(boolean piece) {
this.piece = piece;
}
}
|
/*
* [y] hybris Platform
*
* Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package de.hybris.platform.cmsfacades.cmsitems.predicates;
import de.hybris.platform.core.model.type.AttributeDescriptorModel;
import java.util.function.Predicate;
/**
* Returns true if this attribute is localized as per our platform type system.
*/
public class IsLocalizedAttributePredicate implements Predicate<AttributeDescriptorModel>
{
@Override
public boolean test(final AttributeDescriptorModel attribute)
{
return attribute.getLocalized();
}
}
|
import java.util.ArrayList;
import java.util.List;
public class particularelementarraylist {
public static void main(String[] args) {
List<String> al = new ArrayList<>();
al.add("q");
al.add("w");
al.add("e");
al.add("r");
String s = al.get(3);
System.out.println(s);
}
}
|
package com.tencent.mm.plugin.card.sharecard.ui;
import android.view.View;
import android.view.View.OnClickListener;
import com.tencent.mm.plugin.card.model.am;
import com.tencent.mm.plugin.card.sharecard.a.b;
import com.tencent.mm.plugin.report.service.h;
class ShareCardListUI$3 implements OnClickListener {
final /* synthetic */ ShareCardListUI hAq;
ShareCardListUI$3(ShareCardListUI shareCardListUI) {
this.hAq = shareCardListUI;
}
public final void onClick(View view) {
ShareCardListUI.c(this.hAq);
if (b.axI()) {
ShareCardListUI.c(this.hAq);
if (b.axH()) {
ShareCardListUI.a(this.hAq, 2);
h.mEJ.h(11582, new Object[]{"OperChangeOtherCity ", Integer.valueOf(0), Integer.valueOf(0), "", "", ""});
am.axn().putValue("key_share_card_show_type", Integer.valueOf(ShareCardListUI.d(this.hAq)));
ShareCardListUI.e(this.hAq);
ShareCardListUI.f(this.hAq).aL();
ShareCardListUI.c(this.hAq);
b.hyf = true;
}
}
ShareCardListUI.c(this.hAq);
if (b.axH()) {
ShareCardListUI.a(this.hAq, 3);
}
h.mEJ.h(11582, new Object[]{"OperChangeOtherCity ", Integer.valueOf(0), Integer.valueOf(0), "", "", ""});
am.axn().putValue("key_share_card_show_type", Integer.valueOf(ShareCardListUI.d(this.hAq)));
ShareCardListUI.e(this.hAq);
ShareCardListUI.f(this.hAq).aL();
ShareCardListUI.c(this.hAq);
b.hyf = true;
}
}
|
package com.stackroute.springboot.service;
import com.stackroute.springboot.domain.Product;
import com.stackroute.springboot.exception.ProductAlreadyExistsException;
import com.stackroute.springboot.exception.ProductNotExistsException;
import java.util.List;
public interface ProductService {
public Product saveProduct(Product product) throws ProductAlreadyExistsException;
public List<Product> getAllProducts();
public Product getProductById(int prodId) throws ProductNotExistsException;
public List<Product> getProductByCategory(String prodCategory) throws ProductNotExistsException;
public void deleteProduct(int prodId) throws ProductNotExistsException;
public Product updateProduct(Product product, int id) throws ProductNotExistsException;
}
|
package it.objectmethod.dao;
import java.util.List;
import it.objectmethod.model.City;
import it.objectmethod.model.Continent;
import it.objectmethod.model.Country;
public interface CitycountryDao {
public City infoCity(String name);
public List<Country> infoCountry(String name, String continent );
public List<Continent> allContinent();
public List<Country> viewCountry(String name);
public List<City> viewCity(String cname);
}
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.vaidya.postexdiagnosis.tests;
import org.apache.hadoop.vaidya.statistics.job.JobStatistics;
import org.apache.hadoop.vaidya.statistics.job.JobStatisticsInterface.JobKeys;
import org.apache.hadoop.vaidya.statistics.job.JobStatisticsInterface.KeyDataType;
import org.apache.hadoop.vaidya.statistics.job.JobStatisticsInterface.ReduceTaskKeys;
import org.apache.hadoop.vaidya.statistics.job.ReduceTaskStatistics;
import org.apache.hadoop.vaidya.DiagnosticTest;
import org.w3c.dom.Element;
import java.util.Hashtable;
import java.util.List;
/**
*
*/
public class BalancedReducePartitioning extends DiagnosticTest {
private long totalReduces;
private long busyReducers;
private long percentReduceRecordsSize;
private double percent;
private double impact;
private JobStatistics _job;
/**
*
*/
public BalancedReducePartitioning() {
}
/*
*/
@Override
public double evaluate(JobStatistics jobExecutionStats) {
/* Set the global job variable */
this._job = jobExecutionStats;
/* If Map only job then impact is zero */
if (jobExecutionStats.getStringValue(JobKeys.JOBTYPE).equals("MAP_ONLY")) {
this.impact = 0;
return this.impact;
}
/*
* Read this rule specific input PercentReduceRecords
*/
this.percent = getInputElementDoubleValue("PercentReduceRecords", 0.90);
/*
* Get the sorted reduce task list by number of INPUT_RECORDS (ascending)
*/
List<ReduceTaskStatistics> srTaskList =
jobExecutionStats.getReduceTaskList(ReduceTaskKeys.INPUT_RECORDS, KeyDataType.LONG);
this.percentReduceRecordsSize = (long) (this.percent * jobExecutionStats.getLongValue(JobKeys.REDUCE_INPUT_RECORDS));
this.totalReduces = jobExecutionStats.getLongValue(JobKeys.TOTAL_REDUCES);
long tempReduceRecordsCount = 0;
this.busyReducers = 0;
for (int i=srTaskList.size()-1; i>-1; i--) {
tempReduceRecordsCount += srTaskList.get(i).getLongValue(ReduceTaskKeys.INPUT_RECORDS);
this.busyReducers++;
if (tempReduceRecordsCount >= this.percentReduceRecordsSize) {
break;
}
}
// Calculate Impact
return this.impact = (1 - (double)this.busyReducers/(double)this.totalReduces);
}
/*
* helper function to print specific reduce counter for all reduce tasks
*/
public void printReduceCounters (List<Hashtable<ReduceTaskKeys, String>> x, ReduceTaskKeys key) {
for (int i=0; i<x.size(); i++) {
System.out.println("ind:"+i+", Value:"+x.get(i).get(key)+":");
}
}
/*
*
*/
@Override
public String getPrescription() {
return
"* Use the appropriate partitioning function"+ "\n" +
"* For streaming job consider following partitioner and hadoop config parameters\n"+
" * org.apache.hadoop.mapred.lib.KeyFieldBasedPartitioner\n" +
" * -jobconf stream.map.output.field.separator, -jobconf stream.num.map.output.key.fields";
}
/*
*/
@Override
public String getReferenceDetails() {
String ref =
"* TotalReduceTasks: "+this.totalReduces+"\n"+
"* BusyReduceTasks processing "+this.percent+ "% of total records: " +this.busyReducers+"\n"+
"* Impact: "+truncate(this.impact);
return ref;
}
}
|
package com.lec.ex4_Object;
public class Person {
private long juminNo;// ex.980812-1234568
// 생성자
public Person(long juminNo) {
this.juminNo = juminNo;
}
@Override // equals ctrl+space
public boolean equals(Object obj) {
// Person p3;
// p1.equals(p3) -> false / p1.equals(str1) ->false
// p1.equals(p2) -->this는 p1, obj는p2
// this.juminNo와 obj.juminNo같으면 true를 return
if (obj != null && obj instanceof Person) { // 객체가 Person형이어야 한다
// juminNo == obj.juminNo 여부 return
return juminNo == ((Person) obj).juminNo;
} else {
return false;
}
}// equals
}// class
|
package com.isystk.sample.common;
/**
* 管理画面 URL
*/
public interface AdminUrl {
/**
* ---- URLs ----
**/
public static final String HOME = "/";
public static final String POST = "/post";
public static final String POST_REGIST = "/post/regist";
public static final String POST_EDIT = "/post/edit";
public static final String POST_TAG = "/post/tag";
public static final String SYSTEM_MAIL = "/system/mail";
/**
* ---- APIs ----
**/
public static final String API_V1_FILEUPLOAD = "/api/v1/fileupload";
}
|
package collection.practice;
import java.util.ArrayList;
public class StudentClient {
public static void main(String[] args) {
Student studd = new Student(108, "Golu");
Student studd1 = new Student(112, "Utkarsh");
Student studd3 = new Student(116, "Aman");
Student studd4 = new Student(120, "Abraham");
Student studd5 = new Student(124, "Lincoln");
ArrayList<Student> studds = new ArrayList<>();
studds.add(studd);
studds.add(studd1);
studds.add(studd3);
studds.add(studd5);
studds.add(studd4);
studds.add(studd5);
Student studdds = new Student(studds);
System.out.println(studd.hashSetOperation().size());
studd.iterateList();
}
}
|
package com.example.entity;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
@Entity
public class Category {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
@Column(name = "name", length = 100)
private String name;
@OneToMany
private Set<Product> poductos;
public Set<Product> getPoductos() {
return this.poductos;
}
public void setPoductos(Set<Product> poductos) {
this.poductos = poductos;
}
public Category(){};
public Category(int id, String name){
this.id=id;
this.name=name;
}
public int getId() {
return this.id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
}
|
package boj2108;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
//병합정렬
public class Main1 {
private static final int MAX = 4000;
private static BufferedReader bufferedReader;
private static BufferedWriter bufferedWriter;
private static StringBuilder stringBuilder;
private static int[] arr;
public static void main(String[] args) throws NumberFormatException, IOException {
createObjects();
createArr();
initializeArr();
doMergeSort(0,arr.length-1);
printResult();
closeIO();
}
public static void createObjects() {
bufferedReader = new BufferedReader(new InputStreamReader(System.in));
bufferedWriter = new BufferedWriter(new OutputStreamWriter(System.out));
stringBuilder = new StringBuilder();
}
public static void createArr() throws NumberFormatException, IOException {
int size = Integer.parseInt(bufferedReader.readLine());
arr = new int[size];
}
public static void initializeArr() throws NumberFormatException, IOException {
for(int i=0; i< arr.length;i++) {
arr[i] = Integer.parseInt(bufferedReader.readLine());
}
}
// 병합정렬 시작
public static void doMergeSort(int left, int right) {
if(left < right) {
int center = ( left + right )/2;
doMergeSort(left,center);
doMergeSort(center+1,right);
applyMerge(left, right);
}
}
// 병합 알고리즘
public static void applyMerge(int left, int right) {
int[] leftArr = new int[right - left + 1];
int leftSize = 0;
int center = ( right + left )/2;
int leftPointer = 0;
int rightPointer = center+1;
int arrPointer = left;
for(int i = left; i<=center; i++) {
leftArr[leftSize++] = arr[i];
}
for(arrPointer = left; arrPointer <= right; arrPointer++) {
if( leftPointer < leftSize && rightPointer <= right ) {
arr[arrPointer] = leftArr[leftPointer] < arr[rightPointer] ? leftArr[leftPointer++] : arr[rightPointer++];
}else {
break;
}
}
while(leftPointer < leftSize) {
arr[arrPointer++] = leftArr[leftPointer++];
}
}
// 결과 출력
public static void printResult() throws IOException {
stringBuilder.append(getAvg()).append("\n"); // 평균
stringBuilder.append(getMedian()).append("\n"); // 중간값
stringBuilder.append(getMaxFrequencyValue()).append("\n"); //최빈값
stringBuilder.append(getRange()).append("\n"); // 범위
bufferedWriter.write(stringBuilder.toString());
bufferedWriter.flush();
}
// 평균
public static int getAvg() {
double sum = 0;
for( int value : arr) {
sum += value;
}
return (int)Math.round(sum/arr.length);
}
// 중간값
public static int getMedian() {
return arr[arr.length/2];
}
//최빈값
public static int getMaxFrequencyValue() {
int[][] valueCountArr = new int[arr.length][2];
int valueCountPointer = initializeValueCountArr(valueCountArr);
return getMaxFrequencyValue(valueCountArr, valueCountPointer);
}
// 범위
public static int getRange() {
return arr[arr.length-1] - arr[0];
}
public static int initializeValueCountArr(int[][] valueCountArr) {
int valueCountPointer = -1;
int beforeValue = MAX + 1;
for(int value : arr) {
if( beforeValue == value ) {
valueCountArr[valueCountPointer][1]++;
}else {
valueCountPointer++;
valueCountArr[valueCountPointer][0] = value;
valueCountArr[valueCountPointer][1]++;
beforeValue = value;
}
}
return valueCountPointer;
}
public static int getMaxFrequencyValue(int[][] valueCountArr, int valueCountPointer) {
boolean second = true;
int max = 0;
int maxFrequencyValue = 0;
for(int i = 0; i <= valueCountPointer; i++) {
if( valueCountArr[i][1] > max ) {
max = valueCountArr[i][1];
maxFrequencyValue = valueCountArr[i][0];
second = true;
}else if(valueCountArr[i][1] == max ) {
if(second) {
maxFrequencyValue = valueCountArr[i][0];
second = false;
}
}
}
return maxFrequencyValue;
}
public static void closeIO() throws IOException {
bufferedWriter.close();
bufferedReader.close();
}
}
|
package com.example.test;
import com.example.test.encrypt.AesUtil;
import com.example.test.encrypt.Des3Util;
import com.example.test.encrypt.MD5Util;
import com.example.test.encrypt.RSAUtil;
import com.example.test.sm3.SM3Digest;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
/**
* Created by ouyangshen on 2017/10/28.
*/
public class EncryptActivity extends AppCompatActivity implements OnClickListener {
private final static String TAG = "EncryptActivity";
private EditText et_raw;
private TextView tv_des;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_encrypt);
et_raw = findViewById(R.id.et_raw);
tv_des = findViewById(R.id.tv_des);
findViewById(R.id.btn_md5).setOnClickListener(this);
findViewById(R.id.btn_rsa).setOnClickListener(this);
findViewById(R.id.btn_aes).setOnClickListener(this);
findViewById(R.id.btn_3des).setOnClickListener(this);
findViewById(R.id.btn_sm3).setOnClickListener(this);
}
@Override
public void onClick(View v) {
String raw = et_raw.getText().toString();
if (TextUtils.isEmpty(raw)) {
Toast.makeText(this, "请输入待加密字符串", Toast.LENGTH_LONG).show();
return;
}
if (v.getId() == R.id.btn_md5) {
String enStr = MD5Util.encrypt(raw);
tv_des.setText("MD5的加密结果是:" + enStr);
} else if (v.getId() == R.id.btn_rsa) {
String enStr = RSAUtil.encodeRSA(null, raw);
tv_des.setText("RSA的加密结果是:" + enStr);
} else if (v.getId() == R.id.btn_aes) {
try {
String seed = "a";
String enStr = AesUtil.encrypt(seed, raw);
String deStr = AesUtil.decrypt(seed, enStr);
String desc = String.format("AES的加密结果是:%s\n解密结果是:%s", enStr, deStr);
tv_des.setText(desc);
} catch (Exception e) {
e.printStackTrace();
tv_des.setText("AES加密/解密失败");
}
} else if (v.getId() == R.id.btn_3des) {
String key = "a";
String enStr = Des3Util.encrypt(key, raw);
String deStr = Des3Util.decrypt(key, enStr);
String desc = String.format("3DES的加密结果是:%s\n解密结果是:%s", enStr, new String(deStr));
tv_des.setText(desc);
} else if (v.getId() == R.id.btn_sm3) {
String enStr = SM3Digest.encrypt(raw);
tv_des.setText("SM3的加密结果是:" + enStr);
}
}
}
|
package com.smxknife.springboot._01_exception;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
* @author smxknife
* 2020/7/31
*/
@Component
@ConfigurationProperties(prefix = "unit")
public class Prop {
private Map<String, String> energy = new HashMap<>();
public Map<String, String> getEnergy() {
return energy;
}
public void setEnergy(Map<String, String> energy) {
this.energy = energy;
}
}
|
package communication;
import main.Conference;
/**
* The interface that is responsible with waiting for requests and processing them. Receives a {@link Conference} which it uses to process requests
*/
public interface CommunicationManager {
/**
* Waits for requests and generates responses using the functionality provided by the {@link Conference}.
* Should close the connection if completing the requests takes to long in order to prevent slow loris attacks.
* What exactly to long means is specified by the init function
*/
void start();
/**
* After calling this function the CommunicationManager stops processing new requests.
*/
void stop();
boolean isSecure();
}
|
/*
* 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 main;
/**
*
* @author Euller
*/
public class Contatos {
private String nome;
private int telefone;
private String email;
public Contatos(){
nome = "";
telefone = 0;
email = "";
}
public void set_nome(String nome){
this.nome = nome;
}
public void set_telefone(int telefone){
this.telefone = telefone;
}
public void set_email(String email){
this.email = email;
}
public String get_nome(){
return nome;
}
public int get_telefone(){
return telefone;
}
public String get_email(){
return email;
}
}
|
package com.apprisingsoftware.xmasrogue.entity;
import asciiPanel.AsciiPanel;
import java.awt.Color;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
public enum Entities {
// turns/
// maxHP regen char color name
PLAYER( 20, 10, '@', AsciiPanel.brightYellow, "player",
Arrays.asList(new Attack("hit", 1), new Attack("punch", 1.5), new Attack("bash", 2), new Attack("pummel", 5, 0.3)), EnumSet.noneOf(EntityAttribute.class)
),
// Rats, cats, and dogs
RAT( 5, 20, 'r', Color.LIGHT_GRAY, "rat",
Arrays.asList(new Attack("scratches", 0.5), new Attack("bites", 1), new Attack("claws", 1.5)), EnumSet.noneOf(EntityAttribute.class)
),
GIANT_RAT( 14, 20, 'r', new Color(0x622c13), "giant rat",
Arrays.asList(new Attack("scratches", 1), new Attack("bites", 2), new Attack("claws", 3)), EnumSet.noneOf(EntityAttribute.class)
),
JACKAL( 15, 20, 'j', new Color(0xde663b), "jackal",
Arrays.asList(new Attack("scratches", 1), new Attack("bites", 2), new Attack("claws", 3)), EnumSet.noneOf(EntityAttribute.class)
),
PANTHER( 16, 20, 'f', Color.DARK_GRAY, "panther",
Arrays.asList(new Attack("scratches", 1), new Attack("bites", 2), new Attack("claws", 3)), EnumSet.noneOf(EntityAttribute.class)
),
// Other real-life animals
NEWT( 4, 20, ':', new Color(0x70f000), "newt",
Arrays.asList(new Attack("bites", 1)), EnumSet.noneOf(EntityAttribute.class)
),
MONKEY( 10, 20, 'm', new Color(0xde663b), "monkey",
Arrays.asList(new Attack("scratches", 0.5), new Attack("hits", 0.75), new Attack("punches", 1.5), new Attack("bites", 2.25)), EnumSet.noneOf(EntityAttribute.class)
),
BAT( 9, 20, 'B', new Color(0x60482e), "bat",
Arrays.asList(new Attack("scratches", 0.75), new Attack("claws", 1.5), new Attack("bites", 2.25)), EnumSet.noneOf(EntityAttribute.class)
),
GIANT_BAT( 14, 20, 'B', new Color(0x53483c), "giant bat",
Arrays.asList(new Attack("scratches", 1.25), new Attack("claws", 2.5), new Attack("bites", 3.75)), EnumSet.noneOf(EntityAttribute.class)
),
VAMPIRE_BAT( 20, 5, 'V', new Color(0x8a1e1e), "vampire bat",
Arrays.asList(new Attack("scratches", 2), new Attack("claws", 4), new Attack("bites", 6)), EnumSet.noneOf(EntityAttribute.class)
),
// Humanoids et cetera
KOBOLD( 15, 20, 'k', new Color(0x6d8a1e), "kobold",
Arrays.asList(new Attack("hits", 1), new Attack("punches", 2), new Attack("bashes", 3)), EnumSet.noneOf(EntityAttribute.class)
),
GOBLIN( 20, 20, 'g', new Color(0x93a338), "goblin",
Arrays.asList(new Attack("hits", 1.25), new Attack("punches", 2.5), new Attack("bashes", 3.75)), EnumSet.noneOf(EntityAttribute.class)
),
LARGE_GOBLIN( 30, 20, 'g', new Color(0x838c4f), "large goblin",
Arrays.asList(new Attack("hits", 2), new Attack("punches", 4), new Attack("bashes", 6)), EnumSet.noneOf(EntityAttribute.class)
),
GOBLIN_WARLORD( 40, 20, 'g', new Color(0xbfb11d), "goblin warlord",
Arrays.asList(new Attack("hits", 3), new Attack("punches", 6), new Attack("bashes", 9)), EnumSet.noneOf(EntityAttribute.class)
),
GNOME( 17, 20, 'h', new Color(0x6d8a1e), "gnome",
Arrays.asList(new Attack("hits", 1.25), new Attack("punches", 2.5), new Attack("bashes", 3.75)), EnumSet.noneOf(EntityAttribute.class)
),
CORRUPT_ELF( 15, 20, 'e', new Color(0x1d8bbf), "corrupt elf",
Arrays.asList(new Attack("hits", 1.75), new Attack("punches", 3.5), new Attack("bashes", 5.25)), EnumSet.noneOf(EntityAttribute.class)
),
DARK_ELF( 30, 20, 'e', new Color(0x5c18a0), "dark elf",
Arrays.asList(new Attack("hits", 4), new Attack("punches", 8), new Attack("bashes", 12)), EnumSet.noneOf(EntityAttribute.class)
),
ZOMBIE( 30, 100, 'Z', new Color(0x5e8c40), "zombie",
Arrays.asList(new Attack("hits", 3), new Attack("punches", 5), new Attack("bashes", 7)), EnumSet.noneOf(EntityAttribute.class)
),
SKELETON( 30, 100, 'S', Color.WHITE, "skeleton",
Arrays.asList(new Attack("hits", 3.5), new Attack("punches", 5.5), new Attack("bashes", 8)), EnumSet.noneOf(EntityAttribute.class)
),
OGRE( 70, 20, 'O', Color.GRAY, "ogre",
Arrays.asList(new Attack("grazes", 4), new Attack("hits", 8), new Attack("smashes", 12), new Attack("wallops", 16.5, 0.5)), EnumSet.noneOf(EntityAttribute.class)
),
TROLL( 50, 10, 'T', Color.LIGHT_GRAY, "troll",
Arrays.asList(new Attack("grazes", 3.5), new Attack("hits", 7), new Attack("smashes", 10.5), new Attack("wallops", 15, 0.5)), EnumSet.noneOf(EntityAttribute.class)
),
NYMPH( 20, 0.00001,'n', new Color(0xff85f7), "nymph",
Arrays.asList(new Attack("smacks", 0.5), new Attack("slaps", 1), new Attack("hits", 1.5)), EnumSet.noneOf(EntityAttribute.class)
),
// Weird things
BLOB( 15, 0.1, 'b', new Color(0x52ffba), "gelatinous blob",
Arrays.asList(new Attack("smears", 1.25), new Attack("slimes", 2.5), new Attack("smothers", 3.75)), EnumSet.noneOf(EntityAttribute.class)
),
GIANT_BLOB( 35, 0.1, 'b', new Color(0x4df3ff), "giant gelatinous blob",
Arrays.asList(new Attack("smears", 3), new Attack("slimes", 6), new Attack("smothers", 8.5)), EnumSet.noneOf(EntityAttribute.class)
),
// Magical constructs
CLAY_GOLEM( 20, 100, 'G', new Color(0xf4a67c), "clay golem",
Arrays.asList(new Attack("punches", 1, 0.5), new Attack("kicks", 2), new Attack("slams", 3), new Attack("smashes", 4), new Attack("wallops", 6, 0.5)), EnumSet.noneOf(EntityAttribute.class)
),
STONE_GOLEM( 30, 100, 'G', new Color(0xb8b8b8), "stone golem",
Arrays.asList(new Attack("punches", 1.5, 0.5), new Attack("kicks", 3), new Attack("slams", 4.5), new Attack("smashes", 6), new Attack("wallops", 9, 0.5)), EnumSet.noneOf(EntityAttribute.class)
),
IRON_GOLEM( 40, 100, 'G', new Color(0x6e6e6e), "iron golem",
Arrays.asList(new Attack("punches", 2.25, 0.5), new Attack("kicks", 4.5), new Attack("slams", 6.75), new Attack("smashes", 9), new Attack("wallops", 13.5, 0.5)), EnumSet.noneOf(EntityAttribute.class)
),
STEEL_GOLEM( 50, 100, 'G', new Color(0x575757), "steel golem",
Arrays.asList(new Attack("punches", 3, 0.5), new Attack("kicks", 6), new Attack("slams", 9), new Attack("smashes", 12), new Attack("wallops", 18, 0.5)), EnumSet.noneOf(EntityAttribute.class)
),
MITHRIL_GOLEM( 100, 100, 'G', Color.WHITE, "mithril golem",
Arrays.asList(new Attack("punches", 6, 0.5), new Attack("kicks", 12), new Attack("slams", 18), new Attack("smashes", 24), new Attack("wallops", 30, 0.5)), EnumSet.noneOf(EntityAttribute.class)
),
// Legendary
DRAGON( 100, 5, 'D', Color.ORANGE, "dragon",
Arrays.asList(new Attack("claws", 10), new Attack("lacerates", 18), new Attack("bites", 10), new Attack("burns", 15), new Attack("scorches", 18)), EnumSet.noneOf(EntityAttribute.class)
),
ANCIENT_WYRM( 200, 5, 'W', new Color(0xfbff0f), "ancient wyrm",
Arrays.asList(new Attack("claws", 12), new Attack("lacerates", 20), new Attack("bites", 12), new Attack("burns", 18), new Attack("scorches", 20)), EnumSet.noneOf(EntityAttribute.class)
),
SANTABOT( 300, 1, '&', Color.RED, "Anti-Santa Sentinel NX3100",
Arrays.asList(new Attack("punches", 15, 0.5), new Attack("slices", 20), new Attack("crushes", 25), new Attack("shoots", 30)), EnumSet.noneOf(EntityAttribute.class)
),
;
private final double maxHP;
private final double turnsPerRegeneration;
private final char character;
private final String name;
private final Color color;
private final List<Attack> attacks;
private final EnumSet<EntityAttribute> attributes;
private Entities(double maxHP, double turnsPerRegeneration, char character, Color color, String name, List<Attack> attacks, EnumSet<EntityAttribute> attributes) {
this.maxHP = maxHP;
this.turnsPerRegeneration = turnsPerRegeneration;
this.character = character;
this.name = name;
this.color = color;
this.attacks = attacks;
this.attributes = attributes;
}
public Entity make() {
return new Entity(maxHP, turnsPerRegeneration, character, name, color, attacks, attributes, this);
}
public static Entities getAppropriate(int depth, double maxPlayerHealth, Random random) {
double avgPlayerDamage = 3 + 12 / (1 + Math.exp(-((depth - 5) - 10) / 2.5));
if (depth + 1 <= 3) avgPlayerDamage = 1;
Armor avgArmor = Armors.getAppropriate(depth - 5, random).make();
double avgDamage = 1/avgArmor.reduceDamage(1) * maxPlayerHealth * 0.4;
double scaling = 1 + random.nextGaussian() / 2;
double desiredDamage = avgDamage * scaling;
double smallestDifference = Double.MAX_VALUE;
Entities bestEntity = null;
for (Entities entity : values()) {
if (entity == Entities.PLAYER) continue;
double sum = 0;
for (int i=0; i<10; i++) {
double entityHealth = entity.maxHP;
while (entityHealth > 0) {
entityHealth -= avgPlayerDamage;
sum += avgArmor.reduceDamage(Attack.selectAttack(entity.attacks, random).getDamage());
}
}
double howClose = Math.abs(desiredDamage - sum / 10);
if (howClose < smallestDifference) {
smallestDifference = howClose;
bestEntity = entity;
}
}
return bestEntity;
}
}
|
package net.thumbtack.asurovenko.trainee;
import net.thumbtack.asurovenko.trainee.figures.Rectangle;
import net.thumbtack.asurovenko.trainee.generics.ArrayBox;
public class NamedArrayBox<T extends Rectangle> extends ArrayBox<T> {
private String name;
public NamedArrayBox(T[] arrayObject, String name) {
super(arrayObject);
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
|
package searching;
public class SubsetSums {
public static void main(String[] args) {
int n = 3;
int A = -1;
int B = 2;
int arr[] = { 1, -2, 3 };
System.out.println(subsetSums(arr, n, A, B));
}
static int res = 0;
static int subsetSums(int arr[], int n, int A, int B) {
calculate(0, 0, arr, n, A, B);
return res;
}
static void calculate(int i, int sum, int arr[], int n, int A, int B) {
if (i == n) {
if (sum >= A && sum <= B)
res++;
return;
}
calculate(i + 1, sum + arr[i], arr, n, A, B);
calculate(i + 1, sum, arr, n, A, B);
}
}
|
public class Egret {
private String color;
public Egret() {
this("white");
}
public Egret(String color) {
color = color;
}
public static void main(String[] args) {
Egret e = new Egret();
System.out.println("Color:" + e.color);
}
}
// A
// Color:
// B
// Color:null
// C
// Color:White
// D
// Compiler error on line 4
// E
// Compiler error on line 10
// F
// Compiler error on line 11
|
package calculation;
public class _CalculationTest {
}
|
package com.rca_gps.app.model;
import java.io.Serializable;
/**
* Created by wafer on 2016/12/6.
*/
public class HisttoryCaseInfo implements Serializable {
/**
* "pagination": null,
"isSuccess": true,
"errorCode": "None",
"errorMessage": "",
"resCode": 0,
"resDes": ""
*/
private String errorCode;
private String errorMessage;
private String resDes;
private String pagination;
private boolean isSuccess;
private int resCode;
private HistoryInfo entity;
public String getErrorCode() {
return errorCode;
}
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public String getResDes() {
return resDes;
}
public void setResDes(String resDes) {
this.resDes = resDes;
}
public String getPagination() {
return pagination;
}
public void setPagination(String pagination) {
this.pagination = pagination;
}
public boolean isSuccess() {
return isSuccess;
}
public void setSuccess(boolean success) {
isSuccess = success;
}
public int getResCode() {
return resCode;
}
public void setResCode(int resCode) {
this.resCode = resCode;
}
public HistoryInfo getEntity() {
return entity;
}
public void setEntity(HistoryInfo entity) {
this.entity = entity;
}
}
|
package com.tencent.mm.plugin.webview.ui.tools.jsapi;
import android.app.ProgressDialog;
import android.graphics.Bitmap;
import com.tencent.mm.R;
import com.tencent.mm.ak.c.c;
import com.tencent.mm.pluginsdk.model.app.f;
import com.tencent.mm.ui.base.h;
import java.util.Map;
class g$10 implements c {
final /* synthetic */ String bAd;
final /* synthetic */ String bAj;
final /* synthetic */ String dUT;
final /* synthetic */ g qiK;
final /* synthetic */ ProgressDialog qiS;
final /* synthetic */ f qiT;
final /* synthetic */ String qiU;
final /* synthetic */ String qiV;
final /* synthetic */ String qiW;
final /* synthetic */ Map qiX;
g$10(g gVar, ProgressDialog progressDialog, f fVar, String str, String str2, String str3, String str4, String str5, String str6, Map map) {
this.qiK = gVar;
this.qiS = progressDialog;
this.qiT = fVar;
this.bAj = str;
this.bAd = str2;
this.dUT = str3;
this.qiU = str4;
this.qiV = str5;
this.qiW = str6;
this.qiX = map;
}
public final void r(Bitmap bitmap) {
if (this.qiS != null) {
this.qiS.dismiss();
}
g.a(this.qiK, this.qiT, this.bAj, this.bAd, this.dUT, this.qiU, this.qiV, null, this.qiW);
if (g.j(this.qiK) != null) {
h.bA(g.j(this.qiK), g.j(this.qiK).getString(R.l.app_saved));
}
g.a(this.qiK, g.k(this.qiK), "send_app_msg:ok", this.qiX);
}
}
|
package com.tencent.mm.plugin.wallet_payu.order.ui;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.tencent.mm.ab.l;
import com.tencent.mm.plugin.wallet_payu.order.a.c;
import com.tencent.mm.plugin.wxpay.a$f;
import com.tencent.mm.plugin.wxpay.a$g;
import com.tencent.mm.plugin.wxpay.a.i;
import com.tencent.mm.protocal.c.azz;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.mm.wallet_core.ui.WalletBaseUI;
import com.tencent.mm.wallet_core.ui.e;
public class PayUMallOrderDetailUI extends WalletBaseUI {
private TextView glY;
private TextView kLE;
private String lJJ = "";
private TextView mzG;
private azz pEZ;
private LinearLayout pFa;
private LinearLayout pFb;
private LinearLayout pFc;
private LinearLayout pFd;
private LinearLayout pFe;
private LinearLayout pFf;
private LinearLayout pFg;
private TextView pFh;
private TextView pFi;
private TextView pFj;
private TextView pFk;
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
jr(1520);
this.lJJ = this.sy.getString("key_trans_id");
if (bi.oW(this.lJJ)) {
x.e("MicroMsg.PayUMallOrderDetailUI", "hy: trans id is null");
finish();
}
a(new c(this.lJJ), true, true);
this.pFa = (LinearLayout) findViewById(a$f.detail_transid);
this.pFb = (LinearLayout) findViewById(a$f.detail_appname);
this.pFc = (LinearLayout) findViewById(a$f.detail_goodsname);
this.pFd = (LinearLayout) findViewById(a$f.detail_moneyspent);
this.pFe = (LinearLayout) findViewById(a$f.detail_time);
this.pFf = (LinearLayout) findViewById(a$f.detail_status);
this.pFg = (LinearLayout) findViewById(a$f.detail_type);
this.pFh = (TextView) findViewById(a$f.detail_transid_tv);
this.pFi = (TextView) findViewById(a$f.detail_appname_tv);
this.pFj = (TextView) findViewById(a$f.detail_goodsname_tv);
this.mzG = (TextView) findViewById(a$f.detail_moneyspent_tv);
this.kLE = (TextView) findViewById(a$f.detail_time_tv);
this.glY = (TextView) findViewById(a$f.detail_status_tv);
this.pFk = (TextView) findViewById(a$f.detail_type_tv);
bRm();
}
private void bRm() {
if (this.pEZ != null) {
if (bi.oW(this.pEZ.lOE)) {
this.pFa.setVisibility(8);
} else {
this.pFa.setVisibility(0);
this.pFh.setText(this.pEZ.lOE);
}
if (bi.oW(this.pEZ.lOO)) {
this.pFb.setVisibility(8);
} else {
this.pFb.setVisibility(0);
this.pFi.setText(this.pEZ.lOO);
}
if (bi.oW(this.pEZ.lOG)) {
this.pFc.setVisibility(8);
} else {
this.pFc.setVisibility(0);
this.pFj.setText(this.pEZ.lOG);
}
if (bi.oW(this.pEZ.lOK)) {
this.pFd.setVisibility(8);
} else {
this.pFd.setVisibility(0);
this.mzG.setText(e.e(((double) this.pEZ.scI) / 100.0d, this.pEZ.lOK));
}
if (this.pEZ.lOH >= 0) {
this.pFe.setVisibility(0);
this.kLE.setText(e.hb(this.pEZ.lOH));
} else {
this.pFe.setVisibility(8);
}
if (bi.oW(this.pEZ.lOI)) {
this.pFf.setVisibility(8);
} else {
this.pFf.setVisibility(0);
this.glY.setText(this.pEZ.lOI);
}
switch (this.pEZ.lOM) {
case 3:
this.pFk.setText(i.wallet_balance_manager_save);
return;
case 5:
this.pFk.setText(i.wallet_index_ui_transfer);
return;
default:
this.pFk.setText(i.wallet_payu_detail_type_reserve);
return;
}
}
}
public final boolean d(int i, int i2, String str, l lVar) {
if (i != 0 || i2 != 0) {
return false;
}
if (lVar instanceof c) {
this.pEZ = ((c) lVar).pEY;
bRm();
}
return true;
}
public void onDestroy() {
super.onDestroy();
js(1520);
}
protected final int getLayoutId() {
return a$g.payu_mall_order_info_detail;
}
}
|
package sixkyu.spinwords;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
class SpinWordsTest {
SpinWords spinWords;
@BeforeEach
public void init() {
spinWords = new SpinWords();
}
@Test
public void givenLetterIsUnder5Characters_spinWords_shouldNotReverseWord() {
// Given
String word = "test";
// When
String result = spinWords.spinWords(word);
// Then
assertThat(result).isEqualTo("test");
}
@Test
public void givenLetterIsExactly5Characters_spinWords_shouldReverseWord() {
// Given
String word = "apple";
// When
String result = spinWords.spinWords(word);
// Then
assertThat(result).isEqualTo("elppa");
}
@Test
public void givenLetterIsAbove5Characters_spinWords_shouldReverseWord() {
// Given
String word = "banana";
// When
String result = spinWords.spinWords(word);
// Then
assertThat(result).isEqualTo("ananab");
}
@Test
public void givenSentenceWithWordsBelow5Characters_spinWords_shouldNotReverseWord() {
// Given
String sentence = "this is test";
// When
String result = spinWords.spinWords(sentence);
// Then
assertThat(result).isEqualTo("this is test");
}
@Test
public void givenSentenceWithWordsExactly5Characters_spinWords_shouldReverseWord() {
// Given
String sentence = "this is apple";
// When
String result = spinWords.spinWords(sentence);
// Then
assertThat(result).isEqualTo("this is elppa");
}
@Test
public void givenSentenceWithWordsAbove5Characters_spinWords_shouldReverseWord() {
// Given
String sentence = "this is banana";
// When
String result = spinWords.spinWords(sentence);
// Then
assertThat(result).isEqualTo("this is ananab");
}
}
|
public class ShotEntity extends Entity {
public double Speed = -300;
public DesignWindow Game;
public boolean used = false;
public ShotEntity(DesignWindow Game, String sprite, int X, int Y)
{
super(sprite,X,Y);
this.Game = Game;
SpeedY = Speed;
}
public void move(long Delta)
{
super.Move(Delta);
if(Y < -100)
{
Game.RemoveThing(this);
}
}
public void CollidedWith(Entity other)
{
if(used == true)
{
return;
}
else
{
if(other instanceof AlienEntity)
{
Game.AlienDead();
Game.RemoveThing(this);
Game.RemoveThing(other);
used = true;
}
if(other instanceof BarrierEntity)
{
Game.RemoveThing(this);
used = true;
}
}
}
}
|
package com.locadoraveiculosweb.modelo.dtos;
import java.util.Date;
import com.locadoraveiculosweb.modelo.Sexo;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class MotoristaDto extends UsuarioDto {
MotoristaDto(Long codigo, String cpf, Date dataNascimento, String password, Sexo sexo, String nome, String email, String telefone) {
super(codigo, cpf, dataNascimento, password, sexo, nome, email, telefone);
}
String cnh;
}
|
package com.spring.domain;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
@Entity
@Table(name="sme_sf_fieldview_customer")
public class DealerDetails {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "rid")
private Long rid;
@Column(name = "custom_customer_id")
private String Customer_ID__c;
@Column(name = "email")
private String Email__c;
@Column(name = "mobile")
private String Mobile_No__c;
@Column(name = "addr_ln1")
private String Customer_Address_Line1__c;
@Column(name = "addr_ln2")
private String Customer_Address_Line2__c;
@Column(name = "city")
private String City__c;
@Column(name = "state")
private String State__c;
@Column(name = "country")
private String Country__c;
@Column(name = "zip")
private String Zip_Code__c;
private String stage;
private String category_id;
@Column(name = "request_loan_amount")
private String Amount;
@Column(name = "lastreferenceddate")
private String LastReferencedDate;
@Column(name = "nextstep")
private String NextStep;
@Column(name = "lastmodifiedbyid")
private String LastModifiedById;
@Column(name = "avg_txn_value")
private String Avg_Txn_Value__c;
@Column(name = "lastmodifieddate")
private String LastModifiedDate;
@Column(name = "custname")
private String Name;
@Column(name = "lastvieweddate")
private String LastViewedDate;
@Column(name = "createdbyid")
private String CreatedById;
@Column(name = "createddate")
private String CreatedDate;
@Column(name = "orders_in_a_month")
private String Orders_in_a_Month__c;
@Column(name = "sf_dealers_id")
private String Id;
@Column(name = "closedate")
private String CloseDate;
@Transient
private transient Attributes attributes;
@Column(name = "avg_outstanding_days")
private String Avg_Outstanding_Days__c;
public Long getRid() {
return rid;
}
public void setRid(Long rid) {
this.rid = rid;
}
public String getStage() {
return stage;
}
public void setStage(String stage) {
this.stage = stage;
}
public String getCategory_id() {
return category_id;
}
public void setCategory_id(String category_id) {
this.category_id = category_id;
}
public String getAmount ()
{
return Amount;
}
public void setAmount (String Amount)
{
this.Amount = Amount;
}
public String getLastReferencedDate ()
{
return LastReferencedDate;
}
public void setLastReferencedDate (String LastReferencedDate)
{
this.LastReferencedDate = LastReferencedDate;
}
public String getNextStep ()
{
return NextStep;
}
public void setNextStep (String NextStep)
{
this.NextStep = NextStep;
}
public String getLastModifiedById ()
{
return LastModifiedById;
}
public void setLastModifiedById (String LastModifiedById)
{
this.LastModifiedById = LastModifiedById;
}
public String getAvg_Txn_Value__c ()
{
return Avg_Txn_Value__c;
}
public void setAvg_Txn_Value__c (String Avg_Txn_Value__c)
{
this.Avg_Txn_Value__c = Avg_Txn_Value__c;
}
public String getLastModifiedDate ()
{
return LastModifiedDate;
}
public void setLastModifiedDate (String LastModifiedDate)
{
this.LastModifiedDate = LastModifiedDate;
}
public String getName ()
{
return Name;
}
public void setName (String Name)
{
this.Name = Name;
}
public String getLastViewedDate ()
{
return LastViewedDate;
}
public void setLastViewedDate (String LastViewedDate)
{
this.LastViewedDate = LastViewedDate;
}
public String getCreatedById ()
{
return CreatedById;
}
public void setCreatedById (String CreatedById)
{
this.CreatedById = CreatedById;
}
public String getCreatedDate ()
{
return CreatedDate;
}
public void setCreatedDate (String CreatedDate)
{
this.CreatedDate = CreatedDate;
}
public String getOrders_in_a_Month__c ()
{
return Orders_in_a_Month__c;
}
public void setOrders_in_a_Month__c (String Orders_in_a_Month__c)
{
this.Orders_in_a_Month__c = Orders_in_a_Month__c;
}
public String getId ()
{
return Id;
}
public void setId (String Id)
{
this.Id = Id;
}
public String getCloseDate ()
{
return CloseDate;
}
public void setCloseDate (String CloseDate)
{
this.CloseDate = CloseDate;
}
public Attributes getAttributes ()
{
return attributes;
}
public void setAttributes (Attributes attributes)
{
this.attributes = attributes;
}
public String getAvg_Outstanding_Days__c ()
{
return Avg_Outstanding_Days__c;
}
public void setAvg_Outstanding_Days__c (String Avg_Outstanding_Days__c)
{
this.Avg_Outstanding_Days__c = Avg_Outstanding_Days__c;
}
public String getCustomer_ID__c() {
return Customer_ID__c;
}
public void setCustomer_ID__c(String customer_ID__c) {
Customer_ID__c = customer_ID__c;
}
public String getEmail__c() {
return Email__c;
}
public void setEmail__c(String email__c) {
Email__c = email__c;
}
public String getMobile_No__c() {
return Mobile_No__c;
}
public void setMobile_No__c(String mobile_No__c) {
Mobile_No__c = mobile_No__c;
}
public String getCustomer_Address_Line1__c() {
return Customer_Address_Line1__c;
}
public void setCustomer_Address_Line1__c(String customer_Address_Line1__c) {
Customer_Address_Line1__c = customer_Address_Line1__c;
}
public String getCustomer_Address_Line2__c() {
return Customer_Address_Line2__c;
}
public void setCustomer_Address_Line2__c(String customer_Address_Line2__c) {
Customer_Address_Line2__c = customer_Address_Line2__c;
}
public String getCity__c() {
return City__c;
}
public void setCity__c(String city__c) {
City__c = city__c;
}
public String getState__c() {
return State__c;
}
public void setState__c(String state__c) {
State__c = state__c;
}
public String getCountry__c() {
return Country__c;
}
public void setCountry__c(String country__c) {
Country__c = country__c;
}
public String getZip_Code__c() {
return Zip_Code__c;
}
public void setZip_Code__c(String zip_Code__c) {
Zip_Code__c = zip_Code__c;
}
@Override
public String toString() {
return "DealerDetails [rid=" + rid + ", Customer_ID__c=" + Customer_ID__c + ", Email__c=" + Email__c
+ ", Mobile_No__c=" + Mobile_No__c + ", Customer_Address_Line1__c=" + Customer_Address_Line1__c
+ ", Customer_Address_Line2__c=" + Customer_Address_Line2__c + ", City__c=" + City__c
+ ", State__c=" + State__c + ", Country__c=" + Country__c + ", Zip_Code__c=" + Zip_Code__c
+ ", stage=" + stage + ", category_id=" + category_id + ", Amount=" + Amount
+ ", LastReferencedDate=" + LastReferencedDate + ", NextStep=" + NextStep + ", LastModifiedById="
+ LastModifiedById + ", Avg_Txn_Value__c=" + Avg_Txn_Value__c + ", LastModifiedDate="
+ LastModifiedDate + ", Name=" + Name + ", LastViewedDate=" + LastViewedDate + ", CreatedById="
+ CreatedById + ", CreatedDate=" + CreatedDate + ", Orders_in_a_Month__c=" + Orders_in_a_Month__c
+ ", Id=" + Id + ", CloseDate=" + CloseDate + ", Avg_Outstanding_Days__c=" + Avg_Outstanding_Days__c
+ "]";
}
}
|
package gameMechanics;
import utilities.DoubleLinkedLockedList;
public class ElectricityNetwork {
private DoubleLinkedLockedList<ElectricitySubNetwork> subNetworks;
ElectricityNetwork(){
subNetworks=new utilities.DoubleLinkedLockedList<ElectricitySubNetwork>();
}
public ElectricitySubNetwork addSubNetwork() {
return new ElectricitySubNetwork(this, subNetworks);
}
public void mergeSubNetworks(ElectricitySubNetwork subNet1, ElectricitySubNetwork subNet2) {
//set the individual poles to reference to the new subnetwork
for(utilities.DoubleLinkedLockedListNode<ElectricityLvPole> i=subNet2.getPoles().getHead();i!=subNet2.getPoles().getTail();i=i.getNextNode()) {
i.getContent().associateToNewSubNetwork(subNet1);
}
//merge the two linked lists
subNet1.getPoles().addList(subNet2.getPoles());
//get rid of the now unused subnetwork
subNet2.delete();
}
}
|
package com.challenge.bibliotheque.endpoint.bean;
import java.util.List;
public class RechercherAlbumResponse {
List<AlbumResponse> listeAlbums;
public List<AlbumResponse> getListeAlbums() {
return listeAlbums;
}
public void setListeAlbums(List<AlbumResponse> listeAlbums) {
this.listeAlbums = listeAlbums;
}
}
|
package temakereso.service;
import temakereso.entity.Category;
import temakereso.entity.Department;
import temakereso.helper.ReportFilters;
import temakereso.helper.TopicDto;
import temakereso.helper.TopicType;
import java.util.List;
import java.util.Map;
public interface TopicReportService {
/**
* Returns data for the department specific report file with the given filters.
*
* @param filters filters for the report
* @return report data for the file
*/
Map<Department, List<TopicDto>> findTopicsByDepartment(ReportFilters filters);
/**
* Returns data for the topic specific report file with the given filters.
*
* @param filters filters for the report
* @return report data for the file
*/
Map<Category, List<TopicDto>> findTopicsByCategory(ReportFilters filters);
/**
* Returns data for the topic type specific report file with the given filters.
*
* @param filters filters for the report
* @return report data for the file
*/
Map<TopicType, List<TopicDto>> findTopicsByTopicType(ReportFilters filters);
}
|
package com.company.ClassRelationship;
public class Worker {
public String name;
public String type;
public Worker(String name, String type) {
this.name = name;
this.type = type;
}
public String toString() {
return name + " " + type;
}
}
|
public class Main {
public static void main(String[] args) {
// write testcode here
Counter a = new Counter(1,true);
System.out.println(a.value());
a.decrease();
System.out.println(a.value());
a.decrease();
System.out.println(a.value());
Counter c = new Counter(2,true);
c.decrease(4);
System.out.println(c.value());
}
}
|
package com.tencent.mm.plugin.appbrand.launching.b;
/* synthetic */ class e$1 {
static final /* synthetic */ int[] ghg = new int[a$a.akS().length];
static {
try {
ghg[a$a.ggZ - 1] = 1;
} catch (NoSuchFieldError e) {
}
try {
ghg[a$a.ghb - 1] = 2;
} catch (NoSuchFieldError e2) {
}
try {
ghg[a$a.gha - 1] = 3;
} catch (NoSuchFieldError e3) {
}
try {
ghg[a$a.ggY - 1] = 4;
} catch (NoSuchFieldError e4) {
}
}
}
|
package org.yggard.brokkgui.panel;
import java.util.Arrays;
import org.yggard.brokkgui.component.GuiNode;
import org.yggard.brokkgui.control.GuiFather;
import org.yggard.brokkgui.data.RelativeBindingHelper;
import org.yggard.brokkgui.data.ZLevelComparator;
import org.yggard.brokkgui.internal.IGuiRenderer;
import org.yggard.brokkgui.paint.Background;
import org.yggard.brokkgui.paint.Color;
import org.yggard.brokkgui.paint.EGuiRenderPass;
import org.yggard.brokkgui.policy.EOverflowPolicy;
import fr.ourten.teabeans.value.BaseProperty;
public class GuiPane extends GuiFather
{
private static final ZLevelComparator ZLEVEL_COMPARATOR = new ZLevelComparator();
private final EOverflowPolicy overflowPolicy;
private final BaseProperty<Integer> borderThinProperty;
private final BaseProperty<Color> borderColorProperty;
private final BaseProperty<Background> backgroundProperty;
public GuiPane()
{
super();
this.overflowPolicy = EOverflowPolicy.NONE;
this.borderThinProperty = new BaseProperty<>(0, "borderThinProperty");
this.borderColorProperty = new BaseProperty<>(Color.BLACK, "borderColorProperty");
final Background background = new Background();
background.attach(this);
this.backgroundProperty = new BaseProperty<>(background, "backgroundProperty");
this.backgroundProperty.addListener((property, oldValue, newValue) ->
{
oldValue.detach();
newValue.attach(this);
});
}
public void addChild(final GuiNode node)
{
this.getChildrensProperty().add(node);
node.setFather(this);
RelativeBindingHelper.bindToCenter(node, this);
}
public void addChilds(final GuiNode... nodes)
{
this.getChildrensProperty().addAll(Arrays.asList(nodes));
for (final GuiNode node : nodes)
{
node.setFather(this);
RelativeBindingHelper.bindToCenter(node, this);
}
}
public void removeChild(final GuiNode node)
{
this.getChildrensProperty().remove(node);
node.setFather(null);
node.getxPosProperty().unbind();
node.getyPosProperty().unbind();
}
public void clearChilds()
{
this.getChildrensProperty().getValue().forEach(node ->
{
node.setFather(null);
node.getxPosProperty().unbind();
node.getyPosProperty().unbind();
});
this.getChildrensProperty().clear();
}
public boolean hasChild(final GuiNode node)
{
return this.getChildrensProperty().contains(node);
}
@Override
public void renderNode(final IGuiRenderer renderer, final EGuiRenderPass pass, final int mouseX, final int mouseY)
{
if (pass == EGuiRenderPass.SPECIAL && this.getBorderThin() > 0 && this.getBorderColor() != Color.ALPHA)
renderer.getHelper().drawColoredEmptyRect(renderer, this.getxPos() + this.getxTranslate(),
this.getyPos() + this.getyTranslate(), this.getWidth(), this.getHeight(), this.getzLevel(),
this.getBorderColor(), this.getBorderThin());
this.getBackground().renderNode(renderer, pass, mouseX, mouseY);
super.renderNode(renderer, pass, mouseX, mouseY);
}
public BaseProperty<Integer> getBorderThinProperty()
{
return this.borderThinProperty;
}
public BaseProperty<Color> getBorderColorProperty()
{
return this.borderColorProperty;
}
public BaseProperty<Background> getBackgroundProperty()
{
return this.backgroundProperty;
}
public int getBorderThin()
{
return this.getBorderThinProperty().getValue();
}
public void setBorderThin(final int thinness)
{
this.getBorderThinProperty().setValue(thinness);
}
public Color getBorderColor()
{
return this.getBorderColorProperty().getValue();
}
public void setBorderColor(final Color color)
{
this.getBorderColorProperty().setValue(color);
}
@Override
public EOverflowPolicy getOverflowPolicy()
{
return this.overflowPolicy;
}
public Background getBackground()
{
return this.getBackgroundProperty().getValue();
}
public void setBackground(final Background background)
{
this.getBackgroundProperty().setValue(background);
}
}
|
package com.tyss.cg.jpa.mapping;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
import com.tyss.cg.jpa.beans.AddressBean;
import com.tyss.cg.jpa.beans.EmployeeInfoBean;
import lombok.extern.java.Log;
@Log
public class ManuToOneController {
public static void main(String[] args) {
EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("myPersistenceUnit");
EntityManager entityManager = entityManagerFactory.createEntityManager();
EntityTransaction entityTransaction = entityManager.getTransaction();
EmployeeInfoBean employeeInfoBean = entityManager.find(EmployeeInfoBean.class, 2020001);
AddressBean addressBean1 = new AddressBean();
addressBean1.setAddressId(1);
addressBean1.setAddressType("Home");
addressBean1.setAddressLine1("Hanumanth Nagar");
addressBean1.setAddressLine2("Basavangudi");
addressBean1.setCity("Bengalure");
addressBean1.setState("Karnataka");
addressBean1.setCountry("india");
addressBean1.setZipCode(213456);
addressBean1.setEmployeeInfoBean(employeeInfoBean);
AddressBean addressBean2 = new AddressBean();
addressBean2.setAddressId(2);
addressBean2.setAddressType("Office");
addressBean2.setAddressLine1("Phase-2");
addressBean2.setAddressLine2("Basavangudi");
addressBean2.setCity("Bengalure");
addressBean2.setCountry("india");
addressBean2.setState("Karnataka");
addressBean2.setZipCode(213478);
addressBean2.setEmployeeInfoBean(employeeInfoBean);
entityTransaction.begin();
entityManager.persist(addressBean1);
entityManager.persist(addressBean2);
entityTransaction.commit();
log.info("address entered for the employees");
entityManager.close();
entityManagerFactory.close();
}
}
|
package laserlight;
import laserlight.GameItemsListener.gameItems;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.ArrayList;
public class GameMenu extends JPanel{
private gameItems activeItem = null;
public GameMenu() {
setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
addClickAction("/images/inMenu.png", "/images/inMenu.png", null);
addClickAction("/images/freeSpace.png", "/images/freeSpace.png", null);
addClickAction("/images/mirrorLmenuRed.png", "/images/mirrorLmenu.png", gameItems.mirrorL);
addClickAction("/images/freeSpace.png", "/images/freeSpace.png", null);
addClickAction("/images/mirrorRmenuRed.png", "/images/mirrorRmenu.png", gameItems.mirrorR);
addClickAction("/images/freeSpace.png", "/images/freeSpace.png", null);
addClickAction("/images/gunRotationRed.png", "/images/gunRotation.png", gameItems.gunRotation);
addClickAction("/images/freeSpace.png", "/images/freeSpace.png", null);
addClickAction("/images/gunShootRed.png", "/images/gunShoot.png", gameItems.gunFire);
addClickAction("/images/freeSpace.png", "/images/freeSpace.png", null);
addClickAction("/images/freeSpace.png", "/images/freeSpace.png", null);
addClickAction("/images/freeSpace2.png", "/images/freeSpace2.png", null);
JButton odejit = new JButton(" Obnovit ");
odejit.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
super.mousePressed(e);
//tady vyvolame udalost jako pozadavek na vycisteni herni desky
//proto jsem pridal do rozhrani GameItemsListener metodu public void clearGameState();
//a tady jeste pridam metodu, ktera tuto udalost aktivuje fireClearGameState (je podobna jako fireItemChanged)
//repaint//
fireClearGameState();
//ted uz jen zbyva zaregistrovat posluchace teto udalosti
//to udelame v LaserLight.java v metode spustHru()
//
}
});
add(odejit);
}
private void addClickAction(String strActive, String strInactive, gameItems itemType){
BufferedImage imgActive = readImg(strActive);
BufferedImage imgInactive = readImg(strInactive);
add(new IMGButton(imgActive, imgInactive, itemType));
}
private BufferedImage readImg(String name){
try{
return ImageIO.read(getClass().getResource(name));
} catch(IOException ex){
System.out.println("Nelze nacist obrazek pro herni menu.\n" + ex.getMessage());
return null;
}
}
@Override
public Component add(Component comp) {
Component c = super.add(comp);
if(comp instanceof IMGButton){
addToListIMGButton((IMGButton)comp);
}
return c;
}
private final ArrayList<GameItemsListener> glisteners = new ArrayList<>();
public void addGameItemsListener(GameItemsListener list){
glisteners.add(list);
}
private void fireClearGameState(){
glisteners.forEach((list) -> list.clearGameState());
}
private void fireItemChanged(){
glisteners.forEach((list) -> list.itemChanged(this.activeItem));
}
private class IMGButton extends JLabel{
private final Icon iconActive, iconInactive;
private final gameItems itemType;
private boolean active;
public IMGButton(BufferedImage imgActive, BufferedImage imgInactive, gameItems itemType) {
this.iconActive = new ImageIcon(imgActive);
this.iconInactive = new ImageIcon(imgInactive);
this.itemType = itemType;
this.active = false;
addMouseListener(new MouseAdapter(){
@Override
public void mousePressed(MouseEvent e) {
super.mousePressed(e);
if(active){
deactivate();
} else {
activate();
}
fireItemChanged();
}
});
setIcon(this.iconInactive);
}
public void activate(){
deactivateAllIMGButtons();
this.active = true;
activeItem = this.itemType;
setIcon(this.iconActive);
}
public void deactivate(){
activeItem = null;
this.active = false;
setIcon(this.iconInactive);
}
public boolean isActive(){
return this.active;
}
}
private static final ArrayList<IMGButton> imgButtons = new ArrayList<>();
private static void deactivateAllIMGButtons(){
imgButtons.forEach((imgButton) -> imgButton.deactivate());
}
private static void addToListIMGButton(IMGButton mb){
imgButtons.add(mb);
}
}
|
package chapter_1_05_Extends;
public class AClass {
/**
* @param args
* @throws IllegalAccessException
* @throws InstantiationException
*/
public static void main(String[] args) throws InstantiationException, IllegalAccessException {
// TODO Auto-generated method stub
AClass a = new AClass();
System.out.println(a.getClass().getName());
System.out.println(AClass.class.getName());
System.out.println(int.class.getName());
System.out.println(double[].class.getName());
System.out.println("String instance: [" + String.class.newInstance() + "]");
}
}
|
package presentation;
import logic.Logika;
import java.util.Scanner;
public class Main {
static Logika logika = new Logika();
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (true){
System.out.println("________________________");
System.out.println("! VÍTEJ V EPICKÉ KALKULAČCE !");
System.out.println("________________________");
System.out.println("1) Sčítani");
System.out.println("2) Odečítání");
System.out.println("3) Násobení");
System.out.println("4) Dělení");
System.out.println("5) Mocniny");
System.out.println("6) Faktoriál");
System.out.println("________________________");
System.out.println("7) Ukončit aplikaci");
System.out.println("________________________");
int moznost = sc.nextInt();
while (moznost >= 8){
System.out.println("Vybral sis nespravnou moznost");
moznost=sc.nextInt();
}
if (moznost == 1){
System.out.println("Zadej prosím první číslo");
int prvnicislo = sc.nextInt();
System.out.println("Díky, teď zadej druhý číslo");
int druhycislo = sc.nextInt();
System.out.println("Výsledek je: " + logika.scitani(prvnicislo, druhycislo));
}
if (moznost == 2){
System.out.println("Zadej prosím první číslo");
int prvnicislo = sc.nextInt();
System.out.println("Díky, teď zadej druhý číslo");
int druhycislo = sc.nextInt();
System.out.println("Výsledek je: " + logika.odecitani(prvnicislo, druhycislo));
}
if (moznost == 3){
System.out.println("Zadej prosím první číslo");
int prvnicislo = sc.nextInt();
System.out.println("Díky, teď zadej druhý číslo");
int druhycislo = sc.nextInt();
System.out.println("Výsledek je: " + logika.nasobeni(prvnicislo, druhycislo));
}
if (moznost == 4){
System.out.println("Zadej prosím první číslo");
int prvnicislo = sc.nextInt();
System.out.println("Díky, teď zadej druhý číslo");
int druhycislo = sc.nextInt();
System.out.println("Výsledek je: " + logika.deleni(prvnicislo, druhycislo));
}
if (moznost == 5){
System.out.println("Zadej prosím první číslo");
int prvnicislo = sc.nextInt();
System.out.println("Díky, teď zadej číslo kterým to chceš umocnit.");
int druhycislo = sc.nextInt();
System.out.println("Výsledek je: " + logika.mocnina(prvnicislo, druhycislo));
}
if (moznost == 6){
System.out.println("Zadej prosím číslo");
int prvnicislo = sc.nextInt();
System.out.println("Výsledek je: " + logika.faktorial(prvnicislo));
}
if (moznost == 7) System.exit(0);
}
}
}
|
package com.tencent.mm.plugin.freewifi.e;
import com.tencent.mm.plugin.freewifi.a.a.a;
import com.tencent.mm.plugin.freewifi.e.j.2.1;
import com.tencent.mm.plugin.freewifi.k.b;
import com.tencent.mm.plugin.freewifi.m;
import com.tencent.mm.plugin.freewifi.ui.FreeWifiFrontPageUI;
import com.tencent.mm.plugin.freewifi.ui.FreeWifiFrontPageUI.d;
import com.tencent.mm.sdk.platformtools.x;
import java.net.HttpURLConnection;
class j$2$1$1 implements a {
final /* synthetic */ 1 jlm;
j$2$1$1(1 1) {
this.jlm = 1;
}
public final void g(HttpURLConnection httpURLConnection) {
int responseCode = httpURLConnection.getResponseCode();
FreeWifiFrontPageUI freeWifiFrontPageUI;
d dVar;
FreeWifiFrontPageUI.a aVar;
if (responseCode == 200) {
x.i("MicroMsg.FreeWifi.Protocol32", "sessionKey=%s, step=%d, method=Protocol32UI.black, desc=it still cannot get authurl and extend (now http returns 200), so it fails to connect wifi. ", new Object[]{m.E(this.jlm.jll.jlf.intent), Integer.valueOf(m.F(this.jlm.jll.jlf.intent))});
freeWifiFrontPageUI = this.jlm.jll.jlf.jkG;
dVar = d.jnj;
aVar = new FreeWifiFrontPageUI.a();
aVar.jmI = m.a(this.jlm.jll.jlf.jkI, b.jiI, 35);
freeWifiFrontPageUI.a(dVar, aVar);
j.a(this.jlm.jll.jlf, 35, "CANNOT_GET_AUTHURL_AFTER_BLACK_URL");
} else if (responseCode == 302) {
1.a(this.jlm, httpURLConnection.getHeaderField("Location"));
} else {
x.i("MicroMsg.FreeWifi.Protocol32", "sessionKey=%s, step=%d, method=Protocol32UI.black, desc=http response status code is neither 200 nor 302, so it fails to connect wifi. ", new Object[]{m.E(this.jlm.jll.jlf.intent), Integer.valueOf(m.F(this.jlm.jll.jlf.intent))});
freeWifiFrontPageUI = this.jlm.jll.jlf.jkG;
dVar = d.jnj;
aVar = new FreeWifiFrontPageUI.a();
aVar.jmI = m.a(this.jlm.jll.jlf.jkI, b.jiI, 32);
freeWifiFrontPageUI.a(dVar, aVar);
j.a(this.jlm.jll.jlf, 32, "INVALID_HTTP_RESP_CODE");
}
}
public final void j(Exception exception) {
x.i("MicroMsg.FreeWifi.Protocol32", "sessionKey=%s, step=%d, method=Protocol32UI.black, desc=exception happens during http, so it fails to connect wifi. e.getMessage()=%s,stacktrace=%s", new Object[]{m.E(this.jlm.jll.jlf.intent), Integer.valueOf(m.F(this.jlm.jll.jlf.intent)), exception.getMessage(), m.h(exception)});
FreeWifiFrontPageUI freeWifiFrontPageUI = this.jlm.jll.jlf.jkG;
d dVar = d.jnj;
FreeWifiFrontPageUI.a aVar = new FreeWifiFrontPageUI.a();
aVar.jmI = m.a(this.jlm.jll.jlf.jkI, b.jiI, m.i(exception));
freeWifiFrontPageUI.a(dVar, aVar);
j.a(this.jlm.jll.jlf, m.i(exception), m.g(exception));
}
}
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.webbeans.test.decorators.tests;
import org.apache.webbeans.exception.WebBeansConfigurationException;
import org.apache.webbeans.test.AbstractUnitTest;
import org.apache.webbeans.test.decorators.multiple.Decorator1;
import org.apache.webbeans.test.decorators.multiple.OutputProvider;
import org.apache.webbeans.test.decorators.multiple.RequestStringBuilder;
import org.junit.Assert;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Collection;
public class DecoratorConfigurationTest extends AbstractUnitTest
{
public static final String PACKAGE_NAME = DecoratorConfigurationTest.class.getPackage().getName();
@Test(expected = WebBeansConfigurationException.class)
public void testMultipleDecoratorsInSameFile()
{
Collection<String> beanXmls = new ArrayList<String>();
beanXmls.add(getXmlPath(PACKAGE_NAME, "SameDecorator_broken"));
Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
beanClasses.add(Decorator1.class);
beanClasses.add(OutputProvider.class);
startContainer(beanClasses, beanXmls, true);
Assert.fail("should have thrown a deployment error");
}
@Test
public void testMultipleDecoratorsInMultipleFiles()
{
Collection<String> beanXmls = new ArrayList<String>();
beanXmls.add(getXmlPath(PACKAGE_NAME, "SimpleDecorator_1"));
beanXmls.add(getXmlPath(PACKAGE_NAME, "SimpleDecorator_2"));
Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
beanClasses.add(Decorator1.class);
beanClasses.add(OutputProvider.class);
beanClasses.add(RequestStringBuilder.class);
startContainer(beanClasses, beanXmls, true);
OutputProvider op = getInstance(OutputProvider.class);
Assert.assertNotNull(op);
op.getOutput();
}
}
|
package com.example.a2education;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
class DatabaseHelper extends SQLiteOpenHelper {
private static final String DATABASE_NAME = "user_scores";
private static final int DATABASE_VERSION = 2;
// Constructor for the SQLiteOpenHelper
DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
// Called when database is created
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE USER_SCORES (_ID INTEGER PRIMARY KEY AUTOINCREMENT, "
+ "NAME TEXT, "
+ "SCORE INTEGER,"
+ "TIME INTEGER);");
updateDatabase(db, 0, DATABASE_VERSION);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
updateDatabase(db, oldVersion, newVersion);
}
// Called when database is being upgraded with versioning
private void updateDatabase(SQLiteDatabase db, int oldVersion, int newVersion) {
if (oldVersion < 1) {
db.execSQL("CREATE TABLE USER_SCORES (_ID INTEGER PRIMARY KEY AUTOINCREMENT, "
+ "NAME TEXT, "
+ "SCORE INTEGER,"
+ "TIME INTEGER);");
}
}
}
|
package com.ib.dtos;
import java.util.Date;
import java.util.List;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import com.ib.misc.UnixTimestampDeserializer;
/**
* RemoteWeatherData maps to the data given by remote weather data service
*
* @author ishmael
*
* <pre>
* {
* "coord": {
* "lon": 55.3,
* "lat": 25.26
* },
* "sys": {
* "type": 1,
* "id": 7100,
* "message": 0.0631,
* "country": "AE",
* "sunrise": 1409882464,
* "sunset": 1409927621
* },
* "weather": [{
* "id": 800,
* "main": "Clear",
* "description": "Sky is Clear",
* "icon": "01d"
* }],
* "base": "cmc stations",
* "main": {
* "temp": 39.52,
* "pressure": 998,
* "humidity": 22,
* "temp_min": 39,
* "temp_max": 40
* },
* "wind": {
* "speed": 5.7,
* "deg": 310
* },
* "clouds": {
* "all": 0
* },
* "dt": 1409914800,
* "id": 292223,
* "name": "Dubai",
* "cod": 200
* }
* </pre>
*/
@JsonAutoDetect(getterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
@JsonIgnoreProperties(ignoreUnknown=true)
public class RemoteWeatherData {
@JsonProperty("dt")
@JsonDeserialize(using = UnixTimestampDeserializer.class)
private Date date;
@JsonProperty("name")
private String name;
@JsonProperty("cod")
private int code;
@JsonProperty("coord")
private CoordinateDTO coordinates;
@JsonProperty("sys")
private SystemDTO system;
@JsonProperty("main")
private MainDTO main;
@JsonProperty("weather")
private List<WeatherDTO> weather;
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public CoordinateDTO getCoordinates() {
return coordinates;
}
public void setCoordinates(CoordinateDTO coordinates) {
this.coordinates = coordinates;
}
public SystemDTO getSystem() {
return system;
}
public void setSystem(SystemDTO systemDTO) {
this.system = systemDTO;
}
public MainDTO getMain() {
return main;
}
public void setMain(MainDTO mainDTO) {
this.main = mainDTO;
}
public List<WeatherDTO> getWeather() {
return weather;
}
public void setWeather(List<WeatherDTO> weatherDTO) {
this.weather = weatherDTO;
}
}
|
package Uebungsblatt4;
import java.util.ArrayList;
import java.util.Collections;
public class Bank {
private ArrayList<Kredit>list=new ArrayList<>();
public Bank(ArrayList<Kredit> list) {
super();
this.list = list;
}
public ArrayList<Kredit> getKredit()
{
Collections.sort(list);
return list;
}
public ArrayList<Kredit> getNaechsteKreditFaellig()
{
KreditoffeneJahre k=new KreditoffeneJahre();
Collections.sort(list,k);
return list;
}
public void neuerKredit(Kredit k) throws toMuchOpenCreditException
{
if(list.size()<=3)
{
list.add(k);
}
if (list.size()>3)
{
throw new toMuchOpenCreditException("nix da zu viele Kredite");
}
}
public void deductAll()
{
for (Kredit kredit : list)
{
try
{
kredit.deduct();
} catch (CreditAlreadyPaidException e)
{
System.out.println("kredit "+ kredit+" bereits abbezahlt und wurde gelöscht");
//list.remove(kredit);
list.remove(kredit);
e.printStackTrace();
}
}
}
}
|
package day27_customMethods;
public class voidMethodPractice_removeduplicate4 {
//task.write a method that can remove duplicate from the string and print out the result
//(aabbbccc)
//output(abc)
public static void main(String[] args) {
removeDuplicates("abbfhdjdyyydh");
}
public static void removeDuplicates(String a) {
String result="";
for(int i=0;i<a.length();i++) {
if(! result.contains(a.substring(i,i+1))){
result+=a.substring(i,i+1);
}
}System.out.println(result);
}
}
|
package com.tencent.mm.ui;
import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
import android.os.Bundle;
import com.tencent.mm.R;
import com.tencent.mm.model.au;
import com.tencent.mm.model.bg;
import com.tencent.mm.model.q;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.mm.ui.base.h;
import com.tencent.mm.ui.base.p;
public class JSAPIUploadLogHelperUI extends MMBaseActivity {
private static volatile boolean mIsRunning = false;
private static byte[] tkf = new byte[0];
protected void onCreate(Bundle bundle) {
boolean z;
x.i("MicroMsg.JSAPIUploadLogHelperUI", "onCreate called, isRunning:%b", new Object[]{Boolean.valueOf(mIsRunning)});
super.onCreate(bundle);
setContentView(R.i.background_transparent);
synchronized (tkf) {
if (mIsRunning) {
x.w("MicroMsg.JSAPIUploadLogHelperUI", "reentered while last one is running, finish myself.");
finish();
}
}
String stringExtra = getIntent().getStringExtra("key_user");
int intExtra = getIntent().getIntExtra("key_time", 0);
String str = "MicroMsg.JSAPIUploadLogHelperUI";
String str2 = "upload log from jsapi, in upload activity, username-recv-well:%b, time:%d";
Object[] objArr = new Object[2];
if (stringExtra == null || !stringExtra.equals(q.GF())) {
z = false;
} else {
z = true;
}
objArr[0] = Boolean.valueOf(z);
objArr[1] = Integer.valueOf(intExtra);
x.i(str, str2, objArr);
if (stringExtra == null) {
x.e("MicroMsg.JSAPIUploadLogHelperUI", "doUpload: userName is null.");
finish();
} else if (intExtra < 0) {
x.e("MicroMsg.JSAPIUploadLogHelperUI", "doUpload: illegal time value: %d", new Object[]{Integer.valueOf(intExtra)});
finish();
} else {
getString(R.l.app_tip);
p a = h.a(this, getString(R.l.wv_uploading), false, null);
au.DF().a(new bg(new 1(this, stringExtra, intExtra)), 0);
au.a(new 3(this, a, new OnDismissListener() {
public final void onDismiss(DialogInterface dialogInterface) {
if (!JSAPIUploadLogHelperUI.this.isFinishing()) {
JSAPIUploadLogHelperUI.this.finish();
}
}
}));
}
}
protected void onDestroy() {
x.i("MicroMsg.JSAPIUploadLogHelperUI", "onDestroy called, isRunning:%b", new Object[]{Boolean.valueOf(mIsRunning)});
super.onDestroy();
}
}
|
package com.tencent.mm.plugin.card.ui.view;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import com.tencent.mm.plugin.card.a.d;
import com.tencent.mm.plugin.card.a.e;
import com.tencent.mm.protocal.c.pr;
import com.tencent.mm.protocal.c.se;
import java.util.LinkedList;
class l$1 implements OnClickListener {
final /* synthetic */ se hHK;
final /* synthetic */ LinkedList hHL;
final /* synthetic */ LayoutInflater hHM;
final /* synthetic */ l hHN;
l$1(l lVar, se seVar, LinkedList linkedList, LayoutInflater layoutInflater) {
this.hHN = lVar;
this.hHK = seVar;
this.hHL = linkedList;
this.hHM = layoutInflater;
}
public final void onClick(View view) {
this.hHN.hHJ = true;
this.hHN.hHH.findViewById(d.detail_table_expand_tv).setVisibility(8);
int i = this.hHK.rvB;
while (true) {
int i2 = i;
if (i2 < this.hHL.size()) {
TextView textView = (TextView) this.hHM.inflate(e.card_table_row_item, null, false);
textView.setText(((pr) this.hHL.get(i2)).title);
this.hHN.hHI.addView(textView);
i = i2 + 1;
} else {
this.hHN.hHI.invalidate();
return;
}
}
}
}
|
/**
* Engine / Entity
*/
package edu.self.engine;
import java.awt.Color;
import java.awt.Graphics2D;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Entity Class
*/
public abstract class Entity {
/**
* Debug
*/
private static final Logger debug = Logger.getLogger(Entity.class.getName());
/**
* Engine
*/
protected Engine engine;
/**
* Properties
*/
protected Vector position;
protected Vector velocity;
protected Vector acceleration;
protected Vector gravity;
protected Vector previousPosition;
protected Vector previousVelocity;
protected Vector dimensions;
protected double mass;
protected double space;
protected double drag;
protected double restitution;
protected double staticFriction;
protected double kineticFriction;
protected List<String> layers;
protected Color color;
/**
* Constructor
*/
public Entity(Engine engine) {
this.engine = engine;
debug.setLevel(Level.INFO);
position = new Vector();
velocity = new Vector();
acceleration = new Vector();
gravity = new Vector();
previousPosition = new Vector();
previousVelocity = new Vector();
dimensions = new Vector();
mass = 0.0d;
space = 0.0d;
drag = 0.0d;
restitution = 0.0d;
staticFriction = 0.0d;
kineticFriction = 0.0d;
layers = new ArrayList<String>();
color = Color.WHITE;
}
/**
* Accessors and Modifiers
*/
// Physics Components
public Vector position() {
return position;
}
public Vector velocity() {
return velocity;
}
public Vector acceleration() {
return acceleration;
}
public Vector gravity() {
return gravity;
}
public Vector previousPosition() {
return previousPosition;
}
public Vector previousVelocity() {
return previousVelocity;
}
// Metrics
public Vector dimensions() {
return dimensions;
}
public double mass() {
return mass;
}
public double space() {
return space;
}
public double drag() {
return drag;
}
public double restitution() {
return restitution;
}
// Friction
public double staticFriction() {
return staticFriction;
}
public double kineticFriction() {
return kineticFriction;
}
// Layers
public List<String> layers() {
return (List<String>)layers;
}
// Color
public Color color() {
return color;
}
/**
* Entity Methods
*/
// Extents
public Vector extents() {
return new Vector((dimensions.x() / 2.0d), (dimensions.y() / 2.0d));
}
// Bounds
public Vector lower() {
return new Vector((position.x() - extents().x()), (position.y() - extents().y()));
}
public Vector upper() {
return new Vector((position.x() + extents().x()), (position.y() + extents().y()));
}
// Coplanar
public boolean coplanar(Entity entity) {
for(String layer : layers) {
if(entity.layers().contains(layer)) {
return true;
}
}
return false;
}
// Force
public void force(Vector force) {
force.divide(mass);
acceleration.add(force);
}
// Startup
public abstract void startup();
// Shutdown
public abstract void shutdown();
// Logic
public abstract void think(double interval);
// Rendering
public abstract void render(Graphics2D canvas);
}
|
package socks.merchant;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class Solution {
// Complete the sockMerchant function below.
static int sockMerchant(int n, int[] ar) {
HashSet<Integer> individualNumbers=new HashSet<>();
for(int i=0;i<ar.length;i++) {
individualNumbers.add(ar[i]);
}
List<Integer> allElements=new ArrayList<Integer>();
for(int i=0;i<ar.length;i++) {
allElements.add(ar[i]);
}
int count=0,sum=0;
for(int k:individualNumbers) {
for(int l:allElements) {
if(l==k) {
count++;
}
}
sum+=(count/2);
count=0;
}
return sum;
}
public static void main(String[] args) {
int n=9;
int[] socksRandom= {10, 20, 20, 10, 10, 30, 50, 10, 20};
int result=sockMerchant(n, socksRandom);
System.out.println(result);
}
}
|
package zm.gov.moh.common.submodule.form.model;
import java.io.Serializable;
public class Action implements Serializable {
//added a static field for criteria
public static final String ACTION_TYPE_CRITERIA = "criteria";
String type;
Metadata metadata;
public String getType() {
return type;
}
public Metadata getMetadata() {
return metadata;
}
public void setType(String type) {
this.type = type;
}
public void setMetadata(Metadata metadata) {
this.metadata = metadata;
}
}
|
package com.yknx4.magmarooms;
import android.util.Log;
import com.google.api.client.util.DateTime;
import com.google.api.services.calendar.model.Event;
import java.sql.Date;
import java.text.DateFormat;
/**
* Created by yknx4 on 2/19/16.
*/
public class Cleaner {
private final Event mEvent;
private Cleaner(Event event){
this.mEvent = event;
Log.d("","");
}
public static Cleaner with(Event event){
return new Cleaner(event);
}
public String getEventName(){
if(mEvent==null){
return "None";
}
return mEvent.getSummary();
}
public DateTime getStartTime(){
return mEvent.getStart().getDateTime();
}
public DateTime getFinalTime(){
return mEvent.getEnd().getDateTime();
}
public Date getStartTimeDate(){
return new Date(getStartTime().getValue());
}
public Date getEndTimeDate(){
return new Date(getFinalTime().getValue());
}
public String getEndTimeString(){
if(mEvent==null) return "";
return df.format(getEndTimeDate());
}
DateFormat df = DateFormat.getTimeInstance();
public String getTimeString(){
try{
if(mEvent==null){
return "";
}
return df.format(getStartTimeDate())+" - "+df.format(getEndTimeDate());
}
catch (Exception e){
e.printStackTrace();
return "";
}
}
public String getCurrentEventName() {
if(getEventName().equals("None"))
return "Room Available";
return getEventName();
}
}
|
package com.tencent.mm.plugin.appbrand.dynamic;
import android.os.Bundle;
import com.tencent.mm.ipcinvoker.a;
import com.tencent.mm.ipcinvoker.c;
import com.tencent.mm.modelappbrand.s;
import com.tencent.mm.sdk.platformtools.x;
class a$a implements a<Bundle, Bundle> {
private a$a() {
}
public final /* synthetic */ void a(Object obj, c cVar) {
Bundle bundle = (Bundle) obj;
String string = bundle.getString("id");
String string2 = bundle.getString("appId");
Bundle bundle2 = bundle.getBundle("extData");
c su = d.aeQ().su(string);
if (su == null) {
x.e("MicroMsg.IPCInvoke_AttachTo", "get DynamicPageViewIPCProxy(id : %s) return null.", new Object[]{string});
s.i("MicroMsg.IPCInvoke_AttachTo", "get DynamicPageViewIPCProxy(id : %s) return null.", new Object[]{string});
return;
}
b.o(new 1(this, su, string, string2, bundle2));
}
}
|
import com.sun.tools.doclets.Taglet;
import com.sun.javadoc.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
public class ExampleCodeTaglet implements Taglet {
/**
* Generates the String output for a tag
* @param tag
* @return
*/
public String toString(Tag tag) {
try {
return getString(tag);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
private String getString(Tag tag) throws IOException {
int pos = tag.text().indexOf("#");
final String pathToTest = "/src/test/java/" + tag.text().substring(0, pos).replace('.', '/').concat(".java");
final File testFile = new File(".", pathToTest).getCanonicalFile();
final String testName = tag.text().substring(pos + 1);
final Scanner scanner = new Scanner(testFile);
List<String> lines = new ArrayList<>();
while(scanner.hasNext()) {
String current = scanner.findInLine(testName);
final boolean methodStartFound = current != null;
if (methodStartFound) {
scanner.nextLine();
boolean endFound = false;
do {
current = scanner.nextLine();
endFound = current.equals(" }");
if (!endFound) {
lines.add(current);
}
} while (!endFound);
} else {
scanner.nextLine();
}
}
String res = "";
for (String s : lines) {
res += s + "\n";
}
return "<pre><code class='java'>" + res + "</code></pre>";
}
private List<String> fileToArray(File testFile) throws FileNotFoundException {
final Scanner scanner = new Scanner(testFile);
List<String> lines = new ArrayList<>();
while(scanner.hasNext()) {
lines.add(scanner.nextLine());
}
return lines;
}
public String getName() {
return "include.example";
}
public boolean inField() {
return true;
}
public boolean inConstructor() {
return true;
}
public boolean inMethod() {
return true;
}
public boolean inOverview() {
return true;
}
public boolean inPackage() {
return true;
}
public boolean inType() {
return true;
}
public boolean isInlineTag() {
return true;
}
@SuppressWarnings("unused")//used by the Javadoc tool
public static void register(Map tagletMap) {
ExampleCodeTaglet createdTaglet = new ExampleCodeTaglet();
Taglet t = (Taglet) tagletMap.get(createdTaglet.getName());
if (t != null) {
tagletMap.remove(createdTaglet.getName());
}
tagletMap.put(createdTaglet.getName(), createdTaglet);
}
//only needed for block taglets
public String toString(Tag[] tags) {
return null;
}
}
|
package org.melayjaire.boimela.data;
import android.content.ContentValues;
import android.content.Context;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteStatement;
import android.preference.PreferenceManager;
import org.melayjaire.boimela.R;
import org.melayjaire.boimela.model.Book;
import org.melayjaire.boimela.model.SearchType;
import org.melayjaire.boimela.utils.SearchCategoryMap;
import org.melayjaire.boimela.utils.SearchHelper;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.melayjaire.boimela.data.BookDatabaseHelper.AUTHOR;
import static org.melayjaire.boimela.data.BookDatabaseHelper.AUTHOR_ENGLISH;
import static org.melayjaire.boimela.data.BookDatabaseHelper.CATEGORY;
import static org.melayjaire.boimela.data.BookDatabaseHelper.DESCRIPTION;
import static org.melayjaire.boimela.data.BookDatabaseHelper.FAVORITE;
import static org.melayjaire.boimela.data.BookDatabaseHelper.ID;
import static org.melayjaire.boimela.data.BookDatabaseHelper.IS_NEW;
import static org.melayjaire.boimela.data.BookDatabaseHelper.PRICE;
import static org.melayjaire.boimela.data.BookDatabaseHelper.PUBLISHER;
import static org.melayjaire.boimela.data.BookDatabaseHelper.PUBLISHER_ENGLISH;
import static org.melayjaire.boimela.data.BookDatabaseHelper.STALL_LAT;
import static org.melayjaire.boimela.data.BookDatabaseHelper.STALL_LONG;
import static org.melayjaire.boimela.data.BookDatabaseHelper.TABLE_BOOK;
import static org.melayjaire.boimela.data.BookDatabaseHelper.TABLE_FAVORITES;
import static org.melayjaire.boimela.data.BookDatabaseHelper.TITLE;
import static org.melayjaire.boimela.data.BookDatabaseHelper.TITLE_ENGLISH;
public class BookDataSource {
private String[] allColumnsBook = {ID, TITLE, TITLE_ENGLISH, AUTHOR,
AUTHOR_ENGLISH, CATEGORY, PUBLISHER, PUBLISHER_ENGLISH, PRICE,
DESCRIPTION, STALL_LAT, STALL_LONG, FAVORITE, IS_NEW};
private String[] allColumnsFavorites = {ID, TITLE, PUBLISHER,
PUBLISHER_ENGLISH, STALL_LAT, STALL_LONG};
private SQLiteDatabase database;
private BookDatabaseHelper dbHelper;
private SearchHelper searchHelper;
private Map<SearchType, String[]> categoryColumnMap;
private SharedPreferences preferences;
private SearchCategoryMap searchCategoryMap;
private Context context;
/**
* Source class for accessing all sorts of book data through convenience
* methods. Must call {@link #open()} before accessing any data. Call {@link #close()}
* responsibly after usage
*/
public BookDataSource(Context context) {
this.context = context;
dbHelper = new BookDatabaseHelper(context);
categoryColumnMap = new HashMap<SearchType, String[]>();
createMap();
preferences = PreferenceManager.getDefaultSharedPreferences(context);
searchCategoryMap = new SearchCategoryMap(context);
}
private void createMap() {
categoryColumnMap.put(SearchType.Title, new String[]{ID,
TITLE_ENGLISH, TITLE});
categoryColumnMap.put(SearchType.Author, new String[]{ID,
AUTHOR_ENGLISH, AUTHOR});
categoryColumnMap.put(SearchType.Publisher, new String[]{ID,
PUBLISHER_ENGLISH, PUBLISHER});
categoryColumnMap.put(SearchType.Category, new String[]{ID,
CATEGORY});
categoryColumnMap.put(SearchType.NewBook, new String[]{ID,
IS_NEW});
}
public void open() throws SQLiteException {
database = dbHelper.getWritableDatabase();
}
public boolean isEmpty() {
SQLiteStatement s = database.compileStatement("SELECT count(*) FROM "
+ TABLE_BOOK);
int dataCount = (int) s.simpleQueryForLong();
s.close();
return dataCount <= 0;
}
public void close() {
dbHelper.close();
}
public void update(Book book) {
if (book.isFavorite()) {
if (addToFavorites(book))
database.update(TABLE_BOOK, book.update(new ContentValues()),
ID + "=?",
new String[]{String.valueOf(book.getId())});
} else {
if (removeFromFavorites(book))
database.update(TABLE_BOOK, book.update(new ContentValues()),
ID + "=?",
new String[]{String.valueOf(book.getId())});
}
}
public boolean addToFavorites(Book book) {
return database.insert(TABLE_FAVORITES, null,
book.addToFavorite(new ContentValues())) != -1;
}
public boolean removeFromFavorites(Book book) {
return database.delete(TABLE_FAVORITES, ID + "=?",
new String[]{String.valueOf(book.getId())}) == 1;
}
public void insert(Book book) {
book.setId(database.insert(TABLE_BOOK, null,
book.populate(new ContentValues())));
}
public void insert(List<Book> books) {
for (Book book : books) {
insert(book);
}
}
public String[] getCursorColumns(SearchType category) {
return categoryColumnMap.get(category);
}
public Cursor getSearchSuggestions(String filter) {
if (searchHelper == null)
searchHelper = new SearchHelper();
SearchType category = searchCategoryMap.obtain(preferences
.getString(
context.getString(R.string.pref_key_search_category),
context.getString(R.string.title)));
searchHelper.prepare(categoryColumnMap.get(category)[1],
getInCursor(category), filter);
return searchHelper.getSuggestions();
}
public Cursor getInCursorByPriceRange(String[] range) {
return database.query(TABLE_BOOK, allColumnsBook, PRICE + " >= ? AND "
+ PRICE + " <= ? ", range, null, null, null);
}
public Cursor getInCursor(SearchType category) {
return database.query(true, TABLE_BOOK,
categoryColumnMap.get(category), null, null,
categoryColumnMap.get(category)[1], null, null, null);
}
public Cursor getAllInCursor() {
return database.query(TABLE_BOOK, allColumnsBook, null, null, null,
null, null);
}
public List<Book> getInList(SearchType category, String filter) {
if (searchHelper == null)
searchHelper = new SearchHelper();
searchHelper.prepare(categoryColumnMap.get(category)[1],
getAllInCursor(), filter);
return searchHelper.findRelatedBooks();
}
/**
* Use this method to quickly access book data stored in FAVORITES table
* (e.g.- calculate locations of books)
*/
public List<Book> getFavorites() {
Cursor favorites = database.query(TABLE_FAVORITES, allColumnsFavorites,
null, null, null, null, null);
if (searchHelper == null)
searchHelper = new SearchHelper();
searchHelper.prepare("", favorites, null);
return searchHelper.getFavorites();
}
/**
* Special method to view favorite books in list. Needed because the
* FAVORITES table doesn't contain full book data
*/
public List<Book> getFavoritesForView() {
Cursor favorites = database.query(TABLE_BOOK, allColumnsBook, FAVORITE
+ "=?", new String[]{"1"}, null, null, null);
if (searchHelper == null)
searchHelper = new SearchHelper();
searchHelper.prepare("", favorites, null);
return searchHelper.cursorToBookList();
}
public List<Book> getNewBooks() {
Cursor new_books = database.query(TABLE_BOOK, allColumnsBook, IS_NEW
+ "=?", new String[]{"1"}, null, null, null);
if (searchHelper == null)
searchHelper = new SearchHelper();
searchHelper.prepare("", new_books, null);
return searchHelper.cursorToBookList();
}
public List<Book> getFavoritesByPublisher(String publisherNameEng) {
Cursor result = database
.query(TABLE_FAVORITES, allColumnsFavorites, PUBLISHER_ENGLISH
+ "=?", new String[]{publisherNameEng},
null, null, null);
if (searchHelper == null)
searchHelper = new SearchHelper();
searchHelper.prepare("", result, null);
return searchHelper.getFavorites();
}
}
|
package com.example.ui.pages;
import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.SelenideElement;
import io.qameta.allure.Step;
import static com.codeborne.selenide.Condition.*;
import static com.codeborne.selenide.Selenide.$;
public class LoginPage extends WebPage {
public SelenideElement loginFiled = $("input[type='email']");
public SelenideElement passwordField = $("input[type='password']");
public SelenideElement errorMessage = $(".error-messages > li");
public LoginPage(){
this.url = "/#/login";
this.title = "";
}
@Step
public LoginPage open(){
Selenide.open(this.url);
return this;
}
@Step
public LoginPage typeLogin(String login){
loginFiled.shouldBe(visible).val(login);
return this;
}
@Step
public LoginPage typePassword(String password){
passwordField.shouldBe(visible).val(password);
return this;
}
public MainPage loginWith(String email, String password){
typeLogin(email).typePassword(password).loginFiled.pressEnter();
return new MainPage();
}
}
|
package numerosprimos;
public class EvaluaNumeros
{
public static boolean esPrimo(int numero){
int contador = 2;
boolean primo=true;
while ((primo) && (contador!=numero)){
if (numero % contador == 0)
primo = false;
contador++;
}
return primo;
}
public static boolean esMultiploSiete(int numero){
boolean mul=false;
int res = ( numero % 7);
if ( res == 0 ){
return mul;
}
else{
mul = true;
return mul;
}
}
public static void limpiar(int lineas)
{
for (int i=0; i < lineas; i++)
{
System.out.println();
}
}
}
|
package com.baidu.oauth.service;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.baidu.oauth.dao.BaiduUserDao;
import com.baidu.oauth.domain.BaiduUser;
import com.baidu.oauth.qvo.BaiduUserQvo;
import com.ybg.base.jdbc.BaseMap;
@Repository
public class BaiduUserServiceImpl implements BaiduUserService {
@Autowired
BaiduUserDao baiduUserDao;
public void create(BaiduUser bean) throws Exception {
baiduUserDao.create(bean);
}
public void update(BaseMap<String, Object> updatemap, BaseMap<String, Object> wheremap) {
baiduUserDao.update(updatemap, wheremap);
}
public void remove(BaseMap<String, Object> conditionmap) {
baiduUserDao.remove(conditionmap);
}
public List<BaiduUser> query(BaiduUserQvo qvo) {
return baiduUserDao.query(qvo);
}
public BaiduUser getByUid(Long uid) {
BaiduUserQvo qvo = new BaiduUserQvo();
qvo.setUid(uid);
List<BaiduUser> list = baiduUserDao.query(qvo);
return list != null && list.size() > 0 ? list.get(0) : null;
}
@Override
public Map<String, String> getSetting() {
return baiduUserDao.getSetting();
}
}
|
package kodlamaio.hrms.core.verifications;
import org.springframework.stereotype.Repository;
@Repository
public class MailManager implements VerificationService {
@Override
public void sendEmail(String email, String code) {
System.out.println("Doğrulama kodu " + email + " adresine gönderildi. Kod: " + code);
}
}
|
package org.aion.kernel;
import java.math.BigInteger;
import org.aion.avm.core.BillingRules;
import org.aion.avm.core.util.Helpers;
import java.util.Arrays;
import java.util.Objects;
public class Transaction {
public static Transaction create(byte[] from, long nonce, BigInteger value, byte[] data, long energyLimit, long energyPrice) {
return new Transaction(Type.CREATE, from, null, nonce, value, data, energyLimit, energyPrice);
}
public static Transaction call(byte[] from, byte[] to, long nonce, BigInteger value, byte[] data, long energyLimit, long energyPrice) {
return new Transaction(Type.CALL, from, to, nonce, value, data, energyLimit, energyPrice);
}
public static Transaction balanceTransfer(byte[] from, byte[] to, long nonce, BigInteger value, long energyPrice) {
return new Transaction(Type.BALANCE_TRANSFER, from, to, nonce, value, new byte[0], BillingRules.BASIC_COST, energyPrice);
}
public static Transaction garbageCollect(byte[] target, long nonce, long energyLimit, long energyPrice) {
// This may seem a bit odd but we state that the "target" of the GC is the "sender" address.
// This is because, on a conceptual level, the GC is "sent to itself" but also allows the nonce check to be consistent.
return new Transaction(Type.GARBAGE_COLLECT, target, target, nonce, BigInteger.ZERO, new byte[0], energyLimit, energyPrice);
}
public enum Type {
/**
* The CREATE is used to deploy a new DApp.
*/
CREATE,
/**
* The CALL is used when sending an invocation to an existing DApp.
*/
CALL,
/**
* The BALANCE_TRANSFER is used when ONLY a balance transfer is requested, without a DApp call or deployment.
*/
BALANCE_TRANSFER,
/**
* The GARBAGE_COLLECT is a special transaction which asks that the target DApp's storage be deterministically collected.
* Note that this is the only transaction type which will result in a negative TransactionResult.energyUsed.
*/
GARBAGE_COLLECT,
}
Type type;
byte[] from;
byte[] to;
long nonce;
BigInteger value;
long timestamp;
byte[] data;
long energyLimit;
long energyPrice;
byte[] transactionHash;
protected Transaction(Type type, byte[] from, byte[] to, long nonce, BigInteger value, byte[] data, long energyLimit, long energyPrice) {
Objects.requireNonNull(type, "The transaction `type` can't be NULL");
Objects.requireNonNull(from, "The transaction `from` can't be NULL");
if (type == Type.CREATE) {
if (to != null) {
throw new IllegalArgumentException("The transaction `to` has to be NULL for CREATE");
}
} else {
Objects.requireNonNull(to, "The transaction `to` can't be NULL for non-CREATE");
}
this.type = type;
this.from = from;
this.to = to;
this.nonce = nonce;
this.value = value;
this.data = data;
this.energyLimit = energyLimit;
this.energyPrice = energyPrice;
//TODO: Make sure this constructor is only used for testing purpose. Kernel should always pass AVM the transaction hash.
this.transactionHash = Helpers.randomBytes(32);
}
protected Transaction(Type type, byte[] from, byte[] to, long nonce, BigInteger value, byte[] data, long energyLimit, long energyPrice, byte[] transactionHash) {
Objects.requireNonNull(type, "The transaction `type` can't be NULL");
Objects.requireNonNull(from, "The transaction `from` can't be NULL");
if (type == Type.CREATE) {
if (to != null) {
throw new IllegalArgumentException("The transaction `to` has to be NULL for CREATE");
}
} else {
Objects.requireNonNull(to, "The transaction `to` can't be NULL for non-CREATE");
}
this.type = type;
this.from = from;
this.to = to;
this.nonce = nonce;
this.value = value;
this.data = data;
this.energyLimit = energyLimit;
this.energyPrice = energyPrice;
this.transactionHash = transactionHash;
}
public long getTimestamp() {
return timestamp;
}
public Type getType() {
return type;
}
public byte[] getFrom() {
return from;
}
public byte[] getTo() {
return to;
}
public long getNonce() {
return nonce;
}
public BigInteger getValue() {
return value;
}
public byte[] getData() {
return data;
}
public long getEnergyLimit() {
return energyLimit;
}
public long getEnergyPrice() {
return energyPrice;
}
public byte[] getTransactionHash() {
return transactionHash;
}
public long getBasicCost() {
return BillingRules.getBasicTransactionCost(getData());
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
@Override
public String toString() {
return "Transaction{" +
"type=" + type +
", from=" + Helpers.bytesToHexString(Arrays.copyOf(from, 4)) +
", to=" + Helpers.bytesToHexString(Arrays.copyOf(to, 4)) +
", value=" + value +
", data=" + Helpers.bytesToHexString(data) +
", energyLimit=" + energyLimit +
", transactionHash" + Helpers.bytesToHexString(transactionHash) +
'}';
}
}
|
package chess.pkg2;
public class Pawn extends Piece {
public Pawn(int piecePosition, int alliance) {
super(piecePosition, alliance);
}
public final static int[] whitePawnEvaluator = {
0 ,0 ,0 , 0 , 0 ,0 ,0 ,0 ,
50,50,50, 50, 50,50,50,50,
10,10,20, 30, 30,20,10,10,
5 ,5 ,10, 25, 25,10,5 ,5 ,
0 ,0 ,0 , 20, 20,0 ,0 ,0 ,
5, -5,-10, 0, 0,-10,-5, 5,
5 ,10,10,-20,-20,10,10, 5,
0 ,0 ,0 , 0 , 0 ,0 ,0 , 0
};
public final static int[] blackPawnEvaluator = {
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
5 ,10,10,-20,-20,10,10,5 ,
5, -5,-10,0,0,-10, -5 ,5 ,
0 ,0 ,0 ,20 ,20 ,0 ,0 ,0 ,
5 ,5 ,10, 25,25 ,10,5 ,5 ,
10,10,20,30 ,30 ,20,10,10,
50,50,50,50 ,50 ,50,50,50,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0
};
@Override
public int getLocationPoint(int location){
if(this.getAlliance() == 0){
return whitePawnEvaluator[location];
}else{
return blackPawnEvaluator[location];
}
}
@Override
public int getPointStatic() {
return 100;
}
@Override
public String toString(){
// if(alliance == 0){
return "P";
// }else{
// return "p";
// }
}
@Override
public int[] getPossibleNextPosition(ChessPosition positionChess) {
int[] possiblePawnNextPosition = new int[4];
int testNextPosition;
int j;
j=0;
for(int i=0; i<4; ++i){
possiblePawnNextPosition[i] = 100;
}
if(alliance == 0){
if((piecePosition >= 48) && (piecePosition < 56)){
testNextPosition = piecePosition - 16;
if((positionChess.chessBoard.get(testNextPosition) == null) && (positionChess.chessBoard.get(piecePosition - 8) == null)){
possiblePawnNextPosition[j] = testNextPosition ;
j++;
}
}
testNextPosition = piecePosition-8;
if((testNextPosition >= 0) && (testNextPosition < 64)){
if(positionChess.chessBoard.get(testNextPosition) == null){
possiblePawnNextPosition[j] = testNextPosition ;
j++;
}
}
if((piecePosition % 8 != 0) && (piecePosition % 8 != 7)){
testNextPosition = piecePosition-9;
if(positionChess.chessBoard.get(testNextPosition) != null){
Piece pieceAtPosition = positionChess.chessBoard.get(testNextPosition);
if(pieceAtPosition.getAlliance() == 1){
possiblePawnNextPosition[j] = testNextPosition;
j++;
}
}
testNextPosition = piecePosition - 7;
if(positionChess.chessBoard.get(testNextPosition) != null){
Piece pieceAtPosition = positionChess.chessBoard.get(testNextPosition);
if(pieceAtPosition.getAlliance() == 1){
possiblePawnNextPosition[j] = testNextPosition ;
}
}
}else if(piecePosition % 8 != 0){
testNextPosition = piecePosition-9;
if(positionChess.chessBoard.get(testNextPosition) != null){
Piece pieceAtPosition = positionChess.chessBoard.get(testNextPosition);
if(pieceAtPosition.getAlliance() == 1){
possiblePawnNextPosition[j] = testNextPosition;
j++;
}
}
}else{
testNextPosition = piecePosition - 7;
if(positionChess.chessBoard.get(testNextPosition) != null){
Piece pieceAtPosition = positionChess.chessBoard.get(testNextPosition);
if(pieceAtPosition.getAlliance() == 1){
possiblePawnNextPosition[j] = testNextPosition ;
}
}
}
}
if(alliance == 1){
if((piecePosition >= 8) && (piecePosition < 16)){
testNextPosition = piecePosition + 16;
if((positionChess.chessBoard.get(testNextPosition) == null) && (positionChess.chessBoard.get(piecePosition + 8) == null)){
possiblePawnNextPosition[j] = testNextPosition;
j++;
}
}
testNextPosition = piecePosition + 8;
if((testNextPosition >= 0) && (testNextPosition < 64)){
if(positionChess.chessBoard.get(testNextPosition) == null){
possiblePawnNextPosition[j] = testNextPosition;
j++;
}
}
if((piecePosition % 8 != 0) && (piecePosition % 8 != 7)){
testNextPosition = piecePosition + 9;
if(positionChess.chessBoard.get(testNextPosition) != null){
Piece pieceAtPosition = positionChess.chessBoard.get(testNextPosition);
if(pieceAtPosition.getAlliance() == 0){
possiblePawnNextPosition[j] = testNextPosition;
j++;
}
}
testNextPosition = piecePosition + 7;
if(positionChess.chessBoard.get(testNextPosition) != null){
Piece pieceAtPosition = positionChess.chessBoard.get(testNextPosition);
if(pieceAtPosition.getAlliance() == 0){
possiblePawnNextPosition[j] = testNextPosition ;
}
}
}else if(piecePosition % 8 != 0){
testNextPosition = piecePosition + 7;
if(positionChess.chessBoard.get(testNextPosition) != null){
Piece pieceAtPosition = positionChess.chessBoard.get(testNextPosition);
if(pieceAtPosition.getAlliance() == 0){
possiblePawnNextPosition[j] = testNextPosition;
j++;
}
}
}else{
testNextPosition = piecePosition + 9;
if(positionChess.chessBoard.get(testNextPosition) != null){
Piece pieceAtPosition = positionChess.chessBoard.get(testNextPosition);
if(pieceAtPosition.getAlliance() == 0){
possiblePawnNextPosition[j] = testNextPosition ;
}
}
}
}
return possiblePawnNextPosition;
}
}
|
package com.pfchoice.springboot.service.impl;
import java.util.List;
import com.pfchoice.springboot.model.ICDMeasure;
import com.pfchoice.springboot.repositories.ICDMeasureRepository;
import com.pfchoice.springboot.service.ICDMeasureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service("icdMeasureService")
@Transactional
public class ICDMeasureServiceImpl implements ICDMeasureService {
@Autowired
private ICDMeasureRepository icdMeasureRepository;
public ICDMeasure findById(Integer id) {
return icdMeasureRepository.findOne(id);
}
public ICDMeasure findByCode(String code) {
return icdMeasureRepository.findByCodeIgnoreCase(code);
}
public void saveICDMeasure(ICDMeasure icdMeasure) {
icdMeasureRepository.save(icdMeasure);
}
public void updateICDMeasure(ICDMeasure icdMeasure) {
saveICDMeasure(icdMeasure);
}
public void deleteICDMeasureById(Integer id) {
icdMeasureRepository.delete(id);
}
public void deleteAllICDMeasures() {
icdMeasureRepository.deleteAll();
}
public List<ICDMeasure> findAllICDMeasures() {
return (List<ICDMeasure>) icdMeasureRepository.findAll();
}
public Page<ICDMeasure> findAllICDMeasuresByPage(Specification<ICDMeasure> spec, Pageable pageable) {
return icdMeasureRepository.findAll(spec, pageable);
}
public boolean isICDMeasureExist(ICDMeasure icdMeasure) {
return findById(icdMeasure.getId()) != null;
}
}
|
package jp.noxi.collection;
import javax.annotation.Nonnull;
final class WhereIndexCollection<TSource> extends LinqCollection<TSource> {
final IndexPredicate<TSource> mPredicate;
WhereIndexCollection(@Nonnull Iterable<TSource> iterable, @Nonnull IndexPredicate<TSource> predicate) {
super(iterable);
mPredicate = predicate;
}
@Override
@SuppressWarnings("unchecked")
public boolean hasNext(Object object) {
TSource target = (TSource) object;
if (!mPredicate.apply(target, getIndex()))
return false;
mElement = target;
return true;
}
}
|
/**
@author Chazwarp923
*/
package tech.chazwarp923.unifieditems;
import java.io.File;
import org.apache.logging.log4j.Logger;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import tech.chazwarp923.unifieditems.proxy.CommonProxy;
@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION, updateJSON = "http://chazwarp923.tech/UnifiedItems.json", acceptedMinecraftVersions = "[1.12.0], [1.12.1], [1.12.2]", guiFactory = "tech.chazwarp923.unifieditems.config.ConfigGuiFactory")
public class UnifiedItems {
public static File configFile;
public static Configuration config;
//The instance of the mod that Forge uses.
@Mod.Instance(Reference.MOD_ID)
public static UnifiedItems instance;
public static Logger logger;
//Says where the client and server 'proxy' code is loaded.
@SidedProxy(clientSide = "tech.chazwarp923.unifieditems.proxy.ClientProxy", serverSide = "tech.chazwarp923.unifieditems.proxy.CommonProxy")
public static CommonProxy proxy;
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent preInitEvent) {
logger = preInitEvent.getModLog();
proxy.preInit(preInitEvent);
}
@Mod.EventHandler
public void init(FMLInitializationEvent initEvent) {
proxy.init(initEvent);
}
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent postInitEvent) {
proxy.postInit(postInitEvent);
}
}
|
/*
* Copyright (c) 2016 Filippo Engidashet
*
* 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 kdgs.kdgroup.base;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.CallSuper;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.util.Pair;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.util.Log;
import android.widget.Toast;
import butterknife.ButterKnife;
import kdgs.kdgroup.R;
import kdgs.kdgroup.backstack.BackStackEntry;
import kdgs.kdgroup.backstack.BackStackManager;
/**
* @author Filippo Engidashet <filippo.eng@gmail.com>
* @version 1.0.0
* @since 9/24/2016
*/
public abstract class BaseActivity extends AppCompatActivity implements BaseView {
private static final String STATE_BACK_STACK_MANAGER = "back_stack_manager";
protected BackStackManager backStackManager;
private ProgressDialog mProgressDialog;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
backStackManager = new BackStackManager();
setContentView(getContentView());
ButterKnife.bind(this);
onViewReady(savedInstanceState, getIntent());
}
@CallSuper
protected void onViewReady(Bundle savedInstanceState, Intent intent) {
resolveDaggerDependency();
//To be used by child activities
}
@Override
protected void onDestroy() {
ButterKnife.bind(this);
backStackManager = null;
super.onDestroy();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putParcelable(STATE_BACK_STACK_MANAGER, backStackManager.saveState());
}
protected LinearLayoutManager getLayoutManager() {
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
return layoutManager;
}
//Backstack management
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
backStackManager.restoreState(savedInstanceState.getParcelable(STATE_BACK_STACK_MANAGER));
}
protected boolean pushFragmentToBackStack(int hostId, @NonNull Fragment fragment) {
try {
BackStackEntry entry = BackStackEntry.create(getSupportFragmentManager(), fragment);
backStackManager.push(hostId, entry);
return true;
} catch (Exception e) {
Log.e("MultiBackStack", "Failed to add fragment to back stack", e);
return false;
}
}
@Nullable
protected Fragment popFragmentFromBackStack(int hostId) {
BackStackEntry entry = backStackManager.pop(hostId);
return entry != null ? entry.toFragment(this) : null;
}
@Nullable
protected Pair<Integer, Fragment> popFragmentFromBackStack() {
Pair<Integer, BackStackEntry> pair = backStackManager.pop();
return pair != null ? Pair.create(pair.first, pair.second.toFragment(this)) : null;
}
/**
* @return false if back stack is missing.
*/
protected boolean resetBackStackToRoot(int hostId) {
return backStackManager.resetToRoot(hostId);
}
/**
* @return false if back stack is missing.
*/
protected boolean clearBackStack(int hostId) {
return backStackManager.clear(hostId);
}
@Override
public void noInternetConnectionAvailable() {
showToast(getString(R.string.noNetworkFound));
}
protected void resolveDaggerDependency() {
}
protected void showBackArrow() {
ActionBar supportActionBar = getSupportActionBar();
if (supportActionBar != null) {
supportActionBar.setDisplayHomeAsUpEnabled(true);
supportActionBar.setDisplayShowHomeEnabled(true);
}
}
public void openActivity(Class<?> calledActivity) {
Intent myIntent = new Intent(this, calledActivity);
this.startActivity(myIntent);
}
@Override
public void showProgressDialog(String title, String message) {
if (mProgressDialog == null) {
mProgressDialog = new ProgressDialog(this);
if (title != null)
mProgressDialog.setTitle(title);
mProgressDialog.setIcon(R.mipmap.ic_launcher);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
mProgressDialog.setCancelable(false);
}
if (!mProgressDialog.isShowing()) {
if (message != null)
mProgressDialog.setMessage(message);
mProgressDialog.show();
}
}
@Override
public void hideDialog() {
if (mProgressDialog != null && mProgressDialog.isShowing()) {
mProgressDialog.dismiss();
}
}
protected void showAlertDialog(String title, String msg) {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
if (title != null)
dialogBuilder.setTitle(title);
dialogBuilder.setIcon(R.mipmap.ic_launcher);
dialogBuilder.setMessage(msg);
dialogBuilder.setPositiveButton(getString(R.string.dialog_ok_btn), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
dialogBuilder.setCancelable(false);
dialogBuilder.show();
}
protected AlertDialog.Builder showConfirmationDialog(String title, String msg) {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
dialogBuilder.setTitle(title);
dialogBuilder.setIcon(R.mipmap.ic_launcher);
dialogBuilder.setMessage(msg);
dialogBuilder.setCancelable(false);
return dialogBuilder;
}
protected void showToast(String mToastMsg) {
Toast.makeText(this, mToastMsg, Toast.LENGTH_LONG).show();
}
protected abstract int getContentView();
}
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.webbeans.test.proxy.unproxyable;
import jakarta.enterprise.context.Dependent;
import jakarta.enterprise.context.RequestScoped;
import jakarta.enterprise.inject.Produces;
import jakarta.enterprise.inject.UnproxyableResolutionException;
import jakarta.inject.Inject;
import java.util.HashMap;
import org.junit.Assert;
import org.apache.webbeans.config.OpenWebBeansConfiguration;
import org.apache.webbeans.test.AbstractUnitTest;
import org.junit.Before;
import org.junit.Test;
public class AllowProxyingTest extends AbstractUnitTest
{
@Before
public void resetSettings()
{
System.setProperty(OpenWebBeansConfiguration.ALLOW_PROXYING_PARAM, "");
// there is no portable way to set environment variables from within java.
// and this is probably a good thing ;)
}
@Test(expected = UnproxyableResolutionException.class)
public void testNonProxyableException()
{
startContainer(SomeClassWithFinalMethods.class);
// should blow up with UnproxyableResolutionException wrapped in a DefinitionException
getInstance(SomeClassWithFinalMethods.class);
}
@Test
public void testAllowProxyingDefaults()
{
startContainer(ProducerOwner.class, HashMapConsumer.class);
HashMapConsumer consumer = getInstance(HashMapConsumer.class);
Assert.assertEquals("B", consumer.getA());
}
@Test
public void testAllowProxyingViaSystemProps()
{
System.setProperty(OpenWebBeansConfiguration.ALLOW_PROXYING_PARAM,
"some.other.Class," + SomeClassWithFinalMethods.class.getName());
startContainer(SomeClassWithFinalMethods.class);
// should blow up with UnproxyableResolutionException wrapped in a DefinitionException
SomeClassWithFinalMethods instance = getInstance(SomeClassWithFinalMethods.class);
Assert.assertEquals("X", instance.getX());
}
@Test
public void testAllowProxyingViaBeansXml()
{
startContainer("org/apache/webbeans/test/xml/allowproxying/allowproxying.xml", SomeClassWithFinalMethods.class);
// should blow up with UnproxyableResolutionException wrapped in a DefinitionException
SomeClassWithFinalMethods instance = getInstance(SomeClassWithFinalMethods.class);
Assert.assertEquals("X", instance.getX());
}
@Dependent
public static class ProducerOwner
{
@Produces
@RequestScoped
public HashMap produceHashMap()
{
HashMap hm = new HashMap();
hm.put("A", "B");
return hm;
}
}
@RequestScoped
public static class HashMapConsumer
{
private @Inject HashMap theHashMap;
public String getA()
{
return (String) theHashMap.get("A");
}
}
@RequestScoped
public static class SomeClassWithFinalMethods
{
public String getX()
{
return "X";
}
final void crazyFinalMethod()
{
// nothing to do
}
}
}
|
package lesson22.hw1;
public class ArrayUtils {
public static int maxElement(int[] array) {
int max = array[0];
for (int el : array) {
if (el > max)
max = el;
}
return max;
}
public static int nCount(int[] array, int n) {
int count = 0;
for (int el : array) {
if (el == n)
count++;
}
return count;
}
public static int[] sortAscending(int[] array) {
for (int i = array.length - 1; i > 0; i--) {
for (int j = 0; j < i; j++) {
if (array[j] > array[j + 1]) {
int tmp = array[j];
array[j] = array[j + 1];
array[j + 1] = tmp;
}
}
}
return array;
}
public static int[] sortDescending(int[] array) {
int temp;
for (int i = 0; i < array.length; i++) {
for (int k = i + 1; k < array.length; k++) {
if (array[i] < array[k]) {
temp = array[i];
array[i] = array[k];
array[k] = temp;
}
}
}
return array;
}
}
|
package Client.Services;
import Client.Services.*;
import Client.Services.Enums.*;
public class Management extends Worker
{
private double weeklyBenefits;
private double bonus;
public Management()
{
super();
weeklyBenefits=100.00;
bonus = 10.0;
}
public Management(String a,int b ,int c,Jobs d,double e,double f)
{
super(a,b,c,d);
setWeek(e);
setBonus(f);
}
public double benefitsCalculation(Jobs o)
{
double benefits;
if(o.equals(Jobs.ENGINEERING_MANAGER))
benefits=weeklyBenefits+1*bonus;
else if(o.equals(Jobs.ADMINISTRATIVE_MANAGER))
benefits=weeklyBenefits+0.5*bonus;
else
benefits=0.0;
return benefits;
}
public double getWeek()
{
return weeklyBenefits;
}
public double getBonus()
{
return bonus;
}
public void setWeek(double we)
{
weeklyBenefits=we;
}
public void setBonus(double bo)
{
bonus=bo;
}
public String toString()
{
String out;
out = super.toString()+"Week benefits is"+weeklyBenefits+"Bonus is"+bonus;
return out;
}
}
|
package com.tsn.service;
import com.tsn.entity.UserRole;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 用户角色表 服务类
* </p>
*
* @author tsn
* @since 2021-07-21
*/
public interface UserRoleService extends IService<UserRole> {
}
|
package com.wiipu.mall.fragment;
import java.util.ArrayList;
import android.app.Fragment;
import android.os.Bundle;
import android.support.v4.view.PagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView.ScaleType;
import cn.trinea.android.view.autoscrollviewpager.AutoScrollViewPager;
import com.android.volley.toolbox.NetworkImageView;
import com.viewpagerindicator.CirclePageIndicator;
import com.wiipu.mall.R;
import com.wiipu.mall.adapter.HomeListAdapter;
import com.wiipu.mall.model.HomeFloorData;
import com.wiipu.mall.model.ProductData;
import com.wiipu.mall.network.NetworkManager;
import com.wiipu.mall.noscrollview.NoScrollListView;
/**
* 首页Fragment
*/
public class HomeFragment extends Fragment {
/**
* 广告自动循环切换的时间间隔
*/
private static final int AUTO_SCROLL_INTERVAL = 3000;
private AutoScrollViewPager viewPager;
private CirclePageIndicator indicator;
private PagerAdapter pagerAdapter;
private ArrayList<View> viewContainer;
/**
* 广告图片的url数组
*/
private ArrayList<String> urls;
/**
* 商品列表部分
*/
private NoScrollListView listView;
private HomeListAdapter listAdapter;
private ArrayList<HomeFloorData> floorDatas;
/**
* 顶部搜索
*/
private EditText etSearch;
private ImageButton ibSearch;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_home, container, false);
initView(view);
return view;
}
/**
* 初始化视图
*/
private void initView(View view) {
// 广告位部分
viewPager = (AutoScrollViewPager) view
.findViewById(R.id.home_viewPager);
getViewImage();
pagerAdapter = new PagerAdapter() {
@Override
public void destroyItem(ViewGroup container, int position,
Object object) {
((AutoScrollViewPager) container).removeView(viewContainer
.get(position));
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
((AutoScrollViewPager) container).addView(viewContainer
.get(position));
return viewContainer.get(position);
}
@Override
public boolean isViewFromObject(View arg0, Object arg1) {
return arg0 == arg1;
}
@Override
public int getCount() {
return viewContainer.size();
}
};
viewPager.setAdapter(pagerAdapter);
indicator = (CirclePageIndicator) view
.findViewById(R.id.home_indicator);
indicator.setViewPager(viewPager);
viewPager.setInterval(AUTO_SCROLL_INTERVAL);
viewPager.startAutoScroll();
// 商品列表部分
listView = (NoScrollListView) view.findViewById(R.id.home_lv);
floorDatas = getListData();
listAdapter = new HomeListAdapter(getActivity(), floorDatas,
R.layout.item_home_lv);
listView.setAdapter(listAdapter);
listView.setDivider(null);
// 手动给ListView内容设置了高度,导致页面进入不在顶端,通过给顶端控件设置焦点的方法使view显示在顶端
viewPager.setFocusable(true);
viewPager.setFocusableInTouchMode(true);
viewPager.requestFocus();
// 顶部搜索部分
etSearch = (EditText) view.findViewById(R.id.home_top_et_search);
ibSearch = (ImageButton) view.findViewById(R.id.home_top_ib_search);
ibSearch.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// ////////////////////////////////////
// /////////向服务器发送搜索请求///////////
etSearch.getText().toString().trim();
// ////////////////////////////////////
}
});
}
/**
* 获取广告图片列表
*/
private void getViewImage() {
if (viewContainer == null) {
viewContainer = new ArrayList<View>();
}
if (urls == null) {
urls = new ArrayList<String>();
}
urls = getImageUrls();
viewContainer.clear();
for (String url : urls) {
NetworkImageView iv = new NetworkImageView(getActivity());
iv.setScaleType(ScaleType.FIT_XY);
NetworkManager.getInstance().setImageUrl(iv, url);
viewContainer.add(iv);
}
}
/**
* 获取广告位的图片资源url数组
* 每次从服务器获得url数组先做永久性存储,获取时先从本地显示之前的缓存,等获取成功之后再调用notifyDataSetChanged()
*
* @return url数组
*/
private ArrayList<String> getImageUrls() {
ArrayList<String> list = new ArrayList<String>();
// //////////////////////////////////////
// ////////////////假数据/////////////////
list.add("http://b.hiphotos.baidu.com/image/pic/item/14ce36d3d539b6006bae3d86ea50352ac65cb79a.jpg");
list.add("http://c.hiphotos.baidu.com/image/pic/item/37d12f2eb9389b503564d2638635e5dde7116e63.jpg");
list.add("http://g.hiphotos.baidu.com/image/pic/item/cf1b9d16fdfaaf517578b38e8f5494eef01f7a63.jpg");
list.add("http://f.hiphotos.baidu.com/image/pic/item/77094b36acaf2eddce917bd88e1001e93901939a.jpg");
list.add("http://g.hiphotos.baidu.com/image/pic/item/f703738da97739124dd7b750fb198618367ae20a.jpg");
// //////////////////////////////////////
return list;
}
/**
* 获取楼层列表的数据
*/
private ArrayList<HomeFloorData> getListData() {
ArrayList<HomeFloorData> list = new ArrayList<HomeFloorData>();
// ///////////////////////////////////////
// /////////////////假数据/////////////////
String imgUrl = "http://b.hiphotos.baidu.com/image/pic/item/14ce36d3d539b6006bae3d86ea50352ac65cb79a.jpg";
ArrayList<ProductData> products;
HomeFloorData floor;
ProductData product;
for (int j = 0; j < 2; j++) {
products = new ArrayList<ProductData>();
for (int i = 0; i < 10; i++) {
product = new ProductData();
product.setId(i);
product.setImgUrl(imgUrl);
product.setInfo("上岛咖啡上岛咖啡上岛咖啡上岛咖啡上岛咖啡");
product.setPrice(i * 2);
products.add(product);
}
floor = new HomeFloorData();
floor.setFloor(j + "F");
floor.setProducts(products);
list.add(floor);
}
// ///////////////////////////////////////
return list;
}
/**
* 通知ViewPager广告位数据源改变
*/
public void notifyDataSetChanged() {
if (pagerAdapter != null)
pagerAdapter.notifyDataSetChanged();
if (indicator != null)
indicator.notifyDataSetChanged();
}
}
|
package task3;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Main obj=new Main();
obj=null;
System.gc();
}
protected void finalize() {
System.out.println("hello");
}
}
|
package com.tencent.mm.plugin.emoji.ui;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import com.tencent.mm.plugin.emoji.f.g;
class EmojiStoreDetailUI$10 implements OnClickListener {
final /* synthetic */ EmojiStoreDetailUI inz;
EmojiStoreDetailUI$10(EmojiStoreDetailUI emojiStoreDetailUI) {
this.inz = emojiStoreDetailUI;
}
public final void onClick(DialogInterface dialogInterface, int i) {
EmojiStoreDetailUI.a(this.inz, new g(EmojiStoreDetailUI.a(this.inz), EmojiStoreDetailUI.B(this.inz), EmojiStoreDetailUI.C(this.inz)));
EmojiStoreDetailUI.D(this.inz);
EmojiStoreDetailUI.a(this.inz, 6);
EmojiStoreDetailUI.g(this.inz);
}
}
|
package de.zarncke.lib.init;
import java.io.File;
import java.util.jar.Manifest;
import de.zarncke.lib.err.GuardedTest;
import de.zarncke.lib.io.IOTools;
import de.zarncke.lib.io.store.FileStore;
import de.zarncke.lib.io.store.Store;
import de.zarncke.lib.io.store.StoreUtil;
public class BootTest extends GuardedTest
{
public void testSimpleBoot() throws Throwable
{
File dir = IOTools.createTempDir("boot-test");
IOTools.deleteOnExit(dir);
Store testStore = new FileStore(dir);
Manifest m = new Manifest(BootTest.class.getResourceAsStream("test-MANIFEST.MF"));
m.write(testStore.element("META-INF").element("MANIFEST.MF").getOutputStream(false));
Store bootTestClass = StoreUtil.resolvePath(testStore, BootDummy.class.getName().replaceAll("\\.", "/") + ".class", "/");
IOTools.copy(BootTest.class.getResourceAsStream("BootDummy.class"), bootTestClass.getOutputStream(false));
IOTools.copy(BootTest.class.getResourceAsStream("test.zip"), testStore.element("test.zip").getOutputStream(false));
Boot b = new Boot(testStore);
b.boot(testStore, true, ClassLoader.getSystemClassLoader());
IOTools.deleteAll(dir);
}
}
|
package laioffer.June24th;
import java.util.Comparator;
import java.util.PriorityQueue;
/**
* Created by mengzhou on 6/24/17.
*/
public class CourseSchedule {
class Interval {
public int start;
public int end;
public Interval(int start, int end) {
this.start = start;
this.end = end;
}
}
public int scheduleCourse(int[][] courses) {
if(courses.length == 0 || courses[0].length == 0) return 0;
PriorityQueue<Interval> queue = new PriorityQueue<>(new Comparator<Interval>() {
@Override
public int compare(Interval o1, Interval o2) {
if(o1.start == o2.start) return o1.end - o2.end;
return o1.start - o2.start;
}
});
int end = 0;
for(int i = 0; i < courses.length; i++) {
for (int j = 0; j < courses[0].length; j++) {
queue.add(new Interval(courses[i][0], courses[i][1]));
}
}
int res = 0;
Interval cur = new Interval(0, 0);
while(!queue.isEmpty()) {
Interval poll = queue.poll();
if(poll.start >= cur.end) {
cur = poll;
res++;
} else {
cur = new Interval(cur.start, poll.end);
}
}
return 0;
}
}
|
/*
* Copyright (C) 2019-2023 Hedera Hashgraph, LLC
*
* 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.hedera.mirror.importer.parser.record.transactionhandler;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.verifyNoInteractions;
import com.google.protobuf.ByteString;
import com.hedera.mirror.common.domain.entity.EntityId;
import com.hedera.mirror.common.domain.entity.EntityType;
import com.hederahashgraph.api.proto.java.ResponseCodeEnum;
import com.hederahashgraph.api.proto.java.ScheduleID;
import com.hederahashgraph.api.proto.java.ScheduleSignTransactionBody;
import com.hederahashgraph.api.proto.java.SignatureMap;
import com.hederahashgraph.api.proto.java.SignaturePair;
import com.hederahashgraph.api.proto.java.TransactionBody;
import com.hederahashgraph.api.proto.java.TransactionReceipt;
import org.junit.jupiter.api.Test;
class ScheduleSignTransactionHandlerTest extends AbstractTransactionHandlerTest {
@Override
protected TransactionHandler getTransactionHandler() {
return new ScheduleSignTransactionHandler();
}
@Override
protected TransactionBody.Builder getDefaultTransactionBody() {
return TransactionBody.newBuilder()
.setScheduleSign(ScheduleSignTransactionBody.newBuilder()
.setScheduleID(ScheduleID.newBuilder()
.setScheduleNum(DEFAULT_ENTITY_NUM)
.build()));
}
@Override
protected SignatureMap.Builder getDefaultSigMap() {
return SignatureMap.newBuilder()
.addSigPair(SignaturePair.newBuilder()
.setEd25519(ByteString.copyFromUtf8("Ed25519-1"))
.setPubKeyPrefix(ByteString.copyFromUtf8("PubKeyPrefix-1"))
.build())
.addSigPair(SignaturePair.newBuilder()
.setEd25519(ByteString.copyFromUtf8("Ed25519-2"))
.setPubKeyPrefix(ByteString.copyFromUtf8("PubKeyPrefix-2"))
.build())
.addSigPair(SignaturePair.newBuilder()
.setEd25519(ByteString.copyFromUtf8("Ed25519-3"))
.setPubKeyPrefix(ByteString.copyFromUtf8("PubKeyPrefix-3"))
.build());
}
@Override
protected TransactionReceipt.Builder getTransactionReceipt(ResponseCodeEnum responseCodeEnum) {
return TransactionReceipt.newBuilder()
.setStatus(responseCodeEnum)
.setScheduleID(ScheduleID.newBuilder()
.setScheduleNum(DEFAULT_ENTITY_NUM)
.build());
}
@Override
protected EntityType getExpectedEntityIdType() {
return EntityType.SCHEDULE;
}
@Test
void updateTransactionSuccessful() {
// given
var recordItem = recordItemBuilder.scheduleSign().build();
var scheduleId =
EntityId.of(recordItem.getTransactionBody().getScheduleSign().getScheduleID());
long timestamp = recordItem.getConsensusTimestamp();
var transaction = domainBuilder
.transaction()
.customize(t -> t.consensusTimestamp(timestamp).entityId(scheduleId))
.get();
// when
transactionHandler.updateTransaction(transaction, recordItem);
// then
verifyNoInteractions(entityListener);
assertThat(recordItem.getEntityTransactions())
.containsExactlyInAnyOrderEntriesOf(getExpectedEntityTransactions(recordItem, transaction));
}
}
|
package com.example.vezbepredtest001.adapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.vezbepredtest001.R;
import com.example.vezbepredtest001.db.models.Film;
import java.util.ArrayList;
import java.util.List;
public class FilmAdapter extends BaseAdapter {
private Context context;
private List<Film> films;
public FilmAdapter(Context context, List<Film> films) {
this.context = context;
this.films = films;
}
public void setFilms(List<Film> films) {
this.films = films;
}
@Override
public int getCount() {
return films.size();
}
@Override
public Object getItem(int i) {
return films.get(i);
}
@Override
public long getItemId(int i) {
return 0;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
View v;
if(view == null){
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = inflater.inflate(R.layout.filmlist_item, null);
}else{
v = view;
}
TextView tvIme = (TextView) v.findViewById(R.id.film_ime);
TextView tvZanr = (TextView) v.findViewById(R.id.film_zanr);
TextView tvGodina = (TextView) v.findViewById(R.id.film_godina);
tvIme.setText(films.get(i).getmIme());
tvZanr.setText(films.get(i).getmZanr());
tvGodina.setText(films.get(i).getmDatumIzlaska());
return v;
}
}
|
package com.example.radio.Activity;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import com.example.radio.Model.AllData;
import com.example.radio.R;
import com.example.radio.UserStatusIntetFace;
import com.google.firebase.auth.FirebaseAuth;
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 java.util.Timer;
import java.util.TimerTask;
public class SplashActivity2 extends AppCompatActivity {
DatabaseReference databaseReference12;
String selected;
boolean isRead = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
FirebaseAuth auth = FirebaseAuth.getInstance();
FirebaseUser currentUser = auth.getCurrentUser();
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
if (currentUser != null && currentUser.isEmailVerified()) {
databaseReference12 = FirebaseDatabase.getInstance().getReference().child("user").child(currentUser.getUid());
databaseReference12.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
if (snapshot.exists()) {
if (!isRead) {
String em2 = snapshot.child("mselected").getValue(String.class);
String val = snapshot.child("checkedStatus").getValue(String.class);
if (em2.equals("HR")) {
startActivity(new Intent(SplashActivity2.this, InfoHrActivity.class));
isRead = true;
finish();
} else {
if (val.equals("0")) {
startActivity(new Intent(SplashActivity2.this, DashActivity.class));
isRead = true;
// finish();
}
else
{
startActivity(new Intent(SplashActivity2.this, UserAttendenceActivity.class));
isRead = true;
// finish();
}
}
}
}
// String em2 = snapshot.child("mselected").getValue(String.class);
// String val = snapshot.child("checkedstatus").getValue(String.class);
//
// if (em2.equals("HR")) {
//
// startActivity(new Intent(SplashActivity2.this, InfoHrActivity.class));
//
// } else {
// startActivity(new Intent(SplashActivity2.this, UserAttendenceActivity.class));
//
// }
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
} else {
startActivity(new Intent(SplashActivity2.this, LogActivity.class));
}
}
}, 2000);
}
}
|
package se.ecutb.oscarjohanneson;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class AppTest
{
private HangMan testObject;
@Before
public void init() {
testObject = new HangMan("Books");
}
@Test
public void testRandomGeneratedWords()
{
//Arrange
String[] testWord = {"Books"};
RandomWord test = new RandomWord(testWord);
String actual = "Books";
//Act & Assert
Assert.assertEquals("Books", actual);
}
@Test
public void testNewGame(){
//Arrange
char[] expected = {'_','_','_','_','_'};
testObject.newGame();
//Act & Assert
Assert.assertArrayEquals(expected,testObject.getWordToGuess());
}
@Test
public void testPlayerInputContainsLetterInGameWorld(){
//Arrange
String input = "b";
testObject.inputPlayerGuess(input);
String expected = " b ";
//Act & Assert
Assert.assertEquals(expected,testObject.getStringBuilder().toString());
}
}
|
package com.admin;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import com.google.android.material.navigation.NavigationView;
import java.util.ArrayList;
import java.util.Random;
import ir.androidexception.datatable.DataTable;
import ir.androidexception.datatable.model.DataTableHeader;
import ir.androidexception.datatable.model.DataTableRow;
public class CategoryActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
private DataTable dataTable;
private DataTableRow row;
private NavigationView navigationView;
private DrawerLayout drawerLayout;
private ImageView menuView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_category);
dataTable = findViewById(R.id.data_table_category);
DataTableHeader header = new DataTableHeader.Builder()
.item("field name 1", 3)
.item("field name 2", 4)
.item("field name 3", 5)
.item("field name 4", 6)
.build();
ArrayList<DataTableRow> rows = new ArrayList<>();
// define 200 fake rows for table
for (int i = 0; i < 10; i++) {
Random r = new Random();
int random = r.nextInt(i + 1);
int randomDiscount = r.nextInt(20);
row = new DataTableRow.Builder()
.value("Product #" + i)
.value(String.valueOf(random))
.value(String.valueOf(random * 1000).concat("$"))
.value(String.valueOf(randomDiscount).concat("%"))
.build();
rows.add(row);
}
dataTable.setHeader(header);
dataTable.setRows(rows);
dataTable.inflate(getApplicationContext());
navigationView = findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
drawerLayout = findViewById(R.id.drawer_layout);
menuView = findViewById(R.id.iconMenu);
menuView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
drawerLayout.openDrawer(GravityCompat.START);
}
});
}
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_home) {
// Handle the camera action
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
} else if (id == R.id.nav_product) {
Intent intent = new Intent(this, ProductActivity.class);
startActivity(intent);
} else if (id == R.id.nav_category) {
Intent intent = new Intent(this, CategoryActivity.class);
startActivity(intent);
} else if (id == R.id.nav_message) {
Intent intent = new Intent(this, MessageActivity.class);
startActivity(intent);
} else if (id == R.id.nav_profile) {
Intent intent = new Intent(this, SettingActivity.class);
startActivity(intent);
} else if (id == R.id.nav_account) {
Intent intent = new Intent(this, AccountActivity.class);
startActivity(intent);
} else if (id == R.id.nav_order) {
Intent intent = new Intent(this, OrderActivity.class);
startActivity(intent);
}
DrawerLayout drawer = findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
}
|
/*
* Copyright: (c) 2004-2011 Mayo Foundation for Medical Education and
* Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
* triple-shield Mayo logo are trademarks and service marks of MFMER.
*
* Except as contained in the copyright notice above, or as used to identify
* MFMER as the author of this software, the trade names, trademarks, service
* marks, or product names of the copyright holder shall not be used in
* advertising, promotion or otherwise in connection with this software without
* prior written authorization of the copyright holder.
*
* 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 edu.mayo.cts2.framework.webapp.rest.controller;
import edu.mayo.cts2.framework.core.util.EncodingUtils;
import edu.mayo.cts2.framework.model.command.Page;
import edu.mayo.cts2.framework.model.command.ResolvedReadContext;
import edu.mayo.cts2.framework.model.core.*;
import edu.mayo.cts2.framework.model.directory.DirectoryResult;
import edu.mayo.cts2.framework.model.entity.*;
import edu.mayo.cts2.framework.model.exception.ExceptionFactory;
import edu.mayo.cts2.framework.model.service.core.EntityNameOrURI;
import edu.mayo.cts2.framework.model.service.core.Query;
import edu.mayo.cts2.framework.model.service.exception.UnknownEntity;
import edu.mayo.cts2.framework.model.util.ModelUtils;
import edu.mayo.cts2.framework.service.command.restriction.EntityDescriptionQueryServiceRestrictions;
import edu.mayo.cts2.framework.service.command.restriction.TaggedCodeSystemRestriction;
import edu.mayo.cts2.framework.service.profile.codesystemversion.CodeSystemVersionReadService;
import edu.mayo.cts2.framework.service.profile.entitydescription.EntityDescriptionMaintenanceService;
import edu.mayo.cts2.framework.service.profile.entitydescription.EntityDescriptionQuery;
import edu.mayo.cts2.framework.service.profile.entitydescription.EntityDescriptionQueryService;
import edu.mayo.cts2.framework.service.profile.entitydescription.EntityDescriptionReadService;
import edu.mayo.cts2.framework.service.profile.entitydescription.name.EntityDescriptionReadId;
import edu.mayo.cts2.framework.webapp.naming.CodeSystemVersionNameResolver;
import edu.mayo.cts2.framework.webapp.rest.command.QueryControl;
import edu.mayo.cts2.framework.webapp.rest.command.RestFilter;
import edu.mayo.cts2.framework.webapp.rest.command.RestReadContext;
import edu.mayo.cts2.framework.webapp.rest.query.EntityQueryBuilder;
import edu.mayo.cts2.framework.webapp.rest.util.ControllerUtils;
import edu.mayo.cts2.framework.webapp.rest.validator.EntityDescriptionValidator;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.util.Assert;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* The Class EntityDescriptionController.
*
* @author <a href="mailto:kevin.peterson@mayo.edu">Kevin Peterson</a>
*/
@Controller
public class EntityDescriptionController extends AbstractMessageWrappingController {
@Cts2Service
private EntityDescriptionQueryService entityDescriptionQueryService;
@Cts2Service
private EntityDescriptionReadService entityDescriptionReadService;
@Cts2Service
private EntityDescriptionMaintenanceService entityDescriptionMaintenanceService;
@Cts2Service
private CodeSystemVersionReadService codeSystemVersionReadService;
@Resource
private CodeSystemVersionNameResolver codeSystemVersionNameResolver;
@Resource
private EntityDescriptionValidator entityDescriptionValidator;
private final UrlTemplateBinder<EntityDescription> URL_BINDER =
new UrlTemplateBinder<EntityDescription>(){
@Override
public Map<String,String> getPathValues(EntityDescription resource) {
Map<String,String> returnMap = new HashMap<String,String>();
EntityDescriptionBase base = ModelUtils.getEntity(resource);
String codeSystemName = base.getDescribingCodeSystemVersion().getCodeSystem().getContent();
returnMap.put(VAR_CODESYSTEMID, codeSystemName);
ResolvedReadContext readContext = null;
ChangeableElementGroup group =
resource.getChangeableElementGroup();
if(group != null && group.getChangeDescription() != null){
String changeSetUri = group.getChangeDescription().getContainingChangeSet();
readContext = new ResolvedReadContext();
readContext.setChangeSetContextUri(changeSetUri);
}
returnMap.put(VAR_CODESYSTEMVERSIONID,
codeSystemVersionNameResolver.getVersionIdFromCodeSystemVersionName(
codeSystemVersionReadService,
base.getDescribingCodeSystemVersion().getVersion().getContent(),
readContext));
ScopedEntityName id = base.getEntityID();
returnMap.put(VAR_ENTITYID, EncodingUtils.encodeScopedEntityName(id));
return returnMap;
}
};
private final static MessageFactory<EntityDescription> MESSAGE_FACTORY =
new MessageFactory<EntityDescription>() {
@Override
public Message createMessage(EntityDescription resource) {
EntityDescriptionMsg msg = new EntityDescriptionMsg();
msg.setEntityDescription(resource);
return msg;
}
};
private final static MessageFactory<EntityList> ENTITY_LIST_MESSAGE_FACTORY =
new MessageFactory<EntityList>(){
@Override
public Message createMessage(EntityList resource) {
return resource;
}
};
private final static MessageFactory<EntityReference> ENTITYREFERENCE_MESSAGE_FACTORY =
new MessageFactory<EntityReference>(){
@Override
public Message createMessage(EntityReference resource) {
EntityReferenceMsg msg = new EntityReferenceMsg();
msg.setEntityReference(resource);
return msg;
}
};
/**
* Creates the entity description.
*
* @param changeseturi the changeseturi
* @param entity the entity
* @param codeSystemName the code system name
* @param codeSystemVersionName the code system version name
* @param entityName the entity name
*/
@RequestMapping(value=PATH_ENTITY_OF_CODESYSTEM_VERSION_BYID, method=RequestMethod.PUT)
public Object updateEntityDescription(
HttpServletResponse httpServletResponse,
@RequestParam(value=PARAM_CHANGESETCONTEXT, required=false) String changeseturi,
@RequestBody EntityDescription entity,
@PathVariable(VAR_CODESYSTEMID) String codeSystemName,
@PathVariable(VAR_CODESYSTEMVERSIONID) String codeSytemVersionName,
@PathVariable(VAR_ENTITYID) String entityName) {
this.entityDescriptionValidator.validateUpdateEntityDescription(
this.codeSystemVersionReadService,
codeSystemName,
codeSytemVersionName,
entity);
ScopedEntityName name = getScopedEntityName(entityName, codeSystemName);
return this.doUpdate(
httpServletResponse,
entity,
changeseturi,
new EntityDescriptionReadId(name, ModelUtils.nameOrUriFromName(codeSytemVersionName)),
this.entityDescriptionMaintenanceService);
}
@RequestMapping(value=PATH_ENTITY, method=RequestMethod.POST)
public Object createEntityDescription(
HttpServletResponse httpServletResponse,
@RequestParam(value=PARAM_CHANGESETCONTEXT, required=false) String changeseturi,
@RequestBody EntityDescription entity) {
return this.doCreate(
httpServletResponse,
entity,
changeseturi,
PATH_ENTITY_OF_CODESYSTEM_VERSION_BYID,
URL_BINDER,
this.entityDescriptionMaintenanceService);
}
@RequestMapping(value=PATH_ENTITY_OF_CODESYSTEM_VERSION_BYID, method=RequestMethod.DELETE)
public Object deleteCodeSystemVersion(
HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse,
@PathVariable(VAR_CODESYSTEMID) String codeSystemName,
@PathVariable(VAR_CODESYSTEMVERSIONID) String codeSystemVersionId,
@PathVariable(VAR_ENTITYID) String entityName,
@RequestParam(PARAM_CHANGESETCONTEXT) String changeseturi) {
ResolvedReadContext readContext = new ResolvedReadContext();
readContext.setChangeSetContextUri(changeseturi);
String codeSystemVersionName = this.codeSystemVersionNameResolver.getCodeSystemVersionNameFromVersionId(
codeSystemVersionReadService,
codeSystemName,
codeSystemVersionId,
readContext);
EntityDescriptionReadId id = new EntityDescriptionReadId(
getScopedEntityName(entityName, codeSystemName),
ModelUtils.nameOrUriFromName(codeSystemVersionName));
return this.doDelete(
httpServletResponse,
id,
changeseturi,
this.entityDescriptionMaintenanceService);
}
/**
* Gets the entity descriptions of code system version.
*
* @param httpServletRequest the http servlet request
* @param restrictions the restrictions
* @param resolvedFilter the filter
* @param page the page
* @param codeSystemName the code system name
* @param codeSystemVersionName the code system version name
* @return the entity descriptions of code system version
*/
@RequestMapping(value=PATH_ENTITIES_OF_CODESYSTEM_VERSION, method=RequestMethod.GET)
public Object getEntityDescriptionsOfCodeSystemVersion(
HttpServletRequest httpServletRequest,
QueryControl queryControl,
RestReadContext restReadContext,
EntityDescriptionQueryServiceRestrictions restrictions,
RestFilter restFilter,
Page page,
boolean list,
@PathVariable(VAR_CODESYSTEMID) String codeSystemName,
@PathVariable(VAR_CODESYSTEMVERSIONID) String codeSystemVersionId) {
return this.getEntityDescriptionsOfCodeSystemVersion(
httpServletRequest,
restReadContext,
queryControl,
null,
restrictions,
restFilter,
page,
list,
codeSystemName,
codeSystemVersionId);
}
/**
* Gets the entity descriptions of code system version.
*
* @param httpServletRequest the http servlet request
* @param query the query
* @param restrictions the restrictions
* @param resolvedFilter the filter
* @param page the page
* @param codeSystemName the code system name
* @param codeSystemVersionName the code system version name
* @return the entity descriptions of code system version
*/
@RequestMapping(value=PATH_ENTITIES_OF_CODESYSTEM_VERSION, method=RequestMethod.POST)
public Object getEntityDescriptionsOfCodeSystemVersion(
HttpServletRequest httpServletRequest,
RestReadContext restReadContext,
QueryControl queryControl,
@RequestBody Query query,
EntityDescriptionQueryServiceRestrictions restrictions,
RestFilter restFilter,
Page page,
boolean list,
@PathVariable(VAR_CODESYSTEMID) String codeSystemName,
@PathVariable(VAR_CODESYSTEMVERSIONID) String codeSystemVersionId) {
ResolvedReadContext readContext = this.resolveRestReadContext(restReadContext);
String codeSystemVersionName = this.getCodeSystemVersionNameResolver().
getCodeSystemVersionNameFromVersionId(
codeSystemVersionReadService,
codeSystemName,
codeSystemVersionId,
readContext);
restrictions.getCodeSystemVersions().add(ModelUtils.nameOrUriFromName(codeSystemVersionName));
return this.getEntityDescriptions(
httpServletRequest,
restReadContext,
queryControl,
query,
restrictions,
restFilter,
page,
list);
}
/**
* Gets the entity descriptions of code system version count.
*
* @param httpServletResponse the http servlet response
* @param query the query
* @param restrictions the restrictions
* @param resolvedFilter the filter
* @param codeSystemName the code system name
* @param codeSystemVersionName the code system version name
* @return the entity descriptions of code system version count
*/
@RequestMapping(value=PATH_ENTITIES_OF_CODESYSTEM_VERSION, method=RequestMethod.HEAD)
@ResponseBody
public void getEntityDescriptionsOfCodeSystemVersionCount(
HttpServletResponse httpServletResponse,
RestReadContext restReadContext,
Query query,
EntityDescriptionQueryServiceRestrictions restrictions,
RestFilter restFilter,
@PathVariable(VAR_CODESYSTEMID) String codeSystemName,
@PathVariable(VAR_CODESYSTEMVERSIONID) String codeSystemVersionId) {
ResolvedReadContext readContext = this.resolveRestReadContext(restReadContext);
String codeSystemVersionName = this.codeSystemVersionNameResolver.getCodeSystemVersionNameFromVersionId(
codeSystemVersionReadService,
codeSystemName,
codeSystemVersionId,
readContext);
restrictions.getCodeSystemVersions().add(ModelUtils.nameOrUriFromName(codeSystemVersionName));
this.getEntityDescriptionsCount(
httpServletResponse,
restReadContext,
query,
restrictions,
restFilter);
}
/**
* Gets the entity descriptions.
*
* @param httpServletRequest the http servlet request
* @param restrictions the restrictions
* @param resolvedFilter the filter
* @param page the page
* @return the entity descriptions
*/
@RequestMapping(value=PATH_ENTITIES, method=RequestMethod.GET)
public Object getEntityDescriptions(
HttpServletRequest httpServletRequest,
QueryControl queryControl,
RestReadContext restReadContext,
EntityDescriptionQueryServiceRestrictions restrictions,
RestFilter restFilter,
Page page,
boolean list) {
return this.getEntityDescriptions(
httpServletRequest,
restReadContext,
queryControl,
null,
restrictions,
restFilter,
page,
list);
}
/**
* Gets the entity descriptions.
*
* @param httpServletRequest the http servlet request
* @param query the query
* @param restrictions the restrictions
* @param resolvedFilter the filter
* @param page the page
* @return the entity descriptions
*/
@RequestMapping(value=PATH_ENTITIES, method=RequestMethod.POST)
public Object getEntityDescriptions(
HttpServletRequest httpServletRequest,
RestReadContext restReadContext,
QueryControl queryControl,
@RequestBody Query query,
EntityDescriptionQueryServiceRestrictions restrictions,
RestFilter restFilter,
Page page,
boolean list) {
EntityQueryBuilder builder = this.getNewResourceQueryBuilder();
EntityDescriptionQuery resourceQuery = builder.
addQuery(query).
addRestrictions(restrictions).
addRestFilter(restFilter).
addRestReadContext(restReadContext).
build();
return this.doQuery(
httpServletRequest,
list,
this.entityDescriptionQueryService,
resourceQuery,
page,
queryControl,
EntityDirectory.class,
EntityList.class);
}
/**
* Gets the entity descriptions count.
*
* @param httpServletResponse the http servlet response
* @param query the query
* @param restrictions the restrictions
* @param filterComponent the filter component
* @return the entity descriptions count
*/
@RequestMapping(value=PATH_ENTITIES, method=RequestMethod.HEAD)
@ResponseBody
public void getEntityDescriptionsCount(
HttpServletResponse httpServletResponse,
RestReadContext restReadContext,
Query query,
EntityDescriptionQueryServiceRestrictions restrictions,
RestFilter restFilter) {
EntityQueryBuilder builder = this.getNewResourceQueryBuilder();
EntityDescriptionQuery resourceQuery = builder.
addQuery(query).
addRestrictions(restrictions).
addRestFilter(restFilter).
addRestReadContext(restReadContext).
build();
int count =
this.entityDescriptionQueryService.count(resourceQuery);
this.setCount(count, httpServletResponse);
}
@RequestMapping(value=PATH_ENTITY_OF_CODESYSTEM_VERSION_BYURI, method=RequestMethod.GET)
public ModelAndView getEntityDescriptionOfCodeSystemVersionByUri(
HttpServletRequest httpServletRequest,
RestReadContext restReadContext,
@PathVariable(VAR_CODESYSTEMID) String codeSystemName,
@PathVariable(VAR_CODESYSTEMVERSIONID) String codeSystemVersionId,
@RequestParam(PARAM_URI) String uri,
@RequestParam(value="redirect", defaultValue=DEFAULT_REDIRECT) boolean redirect) {
ResolvedReadContext readContext = this.resolveRestReadContext(restReadContext);
String codeSystemVersionName = this.codeSystemVersionNameResolver.getCodeSystemVersionNameFromVersionId(
codeSystemVersionReadService,
codeSystemName,
codeSystemVersionId,
readContext);
EntityDescriptionReadId id = new EntityDescriptionReadId(
uri,
ModelUtils.nameOrUriFromName(codeSystemVersionName));
EntityDescription resource =
this.entityDescriptionReadService.read(
id,
readContext);
return this.doForward(
resource,
id.toString(),
httpServletRequest,
MESSAGE_FACTORY,
PATH_ENTITY_OF_CODESYSTEM_VERSION_BYURI,
PATH_ENTITY_OF_CODESYSTEM_VERSION_BYID,
URL_BINDER,
restReadContext,
UnknownEntity.class,
redirect);
}
/**
* Gets the entity description by name.
*
* @param httpServletRequest the http servlet request
* @param codeSystemName the code system name
* @param codeSystemVersionName the code system version name
* @param entityName the entity name
* @return the entity description by name
*/
@RequestMapping(value=PATH_ENTITY_OF_CODESYSTEM_VERSION_BYID, method=RequestMethod.GET)
public Object getEntityDescriptionOfCodeSystemVersionByName(
HttpServletRequest httpServletRequest,
RestReadContext restReadContext,
@PathVariable(VAR_CODESYSTEMID) String codeSystemName,
@PathVariable(VAR_CODESYSTEMVERSIONID) String codeSystemVersionId,
@PathVariable(VAR_ENTITYID) String entityName) {
ResolvedReadContext readContext = this.resolveRestReadContext(restReadContext);
String codeSystemVersionName = this.codeSystemVersionNameResolver.getCodeSystemVersionNameFromVersionId(
codeSystemVersionReadService,
codeSystemName,
codeSystemVersionId,
readContext);
EntityDescriptionReadId id = new EntityDescriptionReadId(
getScopedEntityName(entityName, codeSystemName),
ModelUtils.nameOrUriFromName(codeSystemVersionName));
return this.doRead(
httpServletRequest,
MESSAGE_FACTORY,
this.entityDescriptionReadService,
restReadContext,
UnknownEntity.class,
id);
}
@RequestMapping(value=PATH_ALL_DESCRIPTIONS_OF_ENTITYBYID, method=RequestMethod.GET)
public Object getAllEntityDescriptionsByName(
HttpServletRequest httpServletRequest,
RestReadContext restReadContext,
QueryControl queryControl,
@PathVariable(VAR_ENTITYID) String entityName,
Page page,
boolean list) {
ResolvedReadContext readContext = this.resolveRestReadContext(restReadContext);
EntityNameOrURI entityId =
ModelUtils.entityNameOrUriFromName(this.getScopedEntityName(entityName));
Object response = null;
if(list){
DirectoryResult<EntityListEntry> entityList =
this.entityDescriptionReadService.readEntityDescriptions(
entityId,
this.resolveSort(queryControl, this.entityDescriptionQueryService),
readContext,
page);
if(entityList != null &&
entityList.getEntries() != null &&
entityList.getEntries().size() == 1 &&
StringUtils.isNotBlank(entityList.getEntries().get(0).getHref())){
Map<String,Object> parameters =
new HashMap<String,Object>(httpServletRequest.getParameterMap());
parameters.remove(PARAM_LIST);
String queryString = this.mapToQueryString(parameters);
return new ModelAndView(
"redirect:" + entityList.getEntries().get(0).getHref() + queryString);
} else {
response = this.populateDirectory(entityList, page, httpServletRequest, EntityList.class);
}
} else {
EntityReference entityReference = this.entityDescriptionReadService.availableDescriptions(entityId, readContext);
if(entityReference != null){
if(entityReference.getKnownEntityDescription() != null &&
entityReference.getKnownEntityDescriptionCount() == 1 &&
StringUtils.isNotBlank(entityReference.getKnownEntityDescription(0).getHref())){
Map<String,Object> parameters =
new HashMap<String,Object>(httpServletRequest.getParameterMap());
String queryString = this.mapToQueryString(parameters);
return new ModelAndView(
"redirect:" + entityReference.getKnownEntityDescription(0).getHref() + queryString);
} else {
response = this.wrapMessage(
ENTITYREFERENCE_MESSAGE_FACTORY.createMessage(entityReference),
httpServletRequest);
}
}
}
if(response == null) {
throw ExceptionFactory.createUnknownResourceException(entityId.toString(), UnknownEntity.class);
} else {
return this.buildResponse(httpServletRequest, response);
}
}
/**
* Gets the entity description by uri.
*
* @param httpServletRequest the http servlet request
* @param uri the uri
* @return the entity description by uri
*/
@RequestMapping(value=PATH_ENTITYBYURI, method=RequestMethod.GET)
public Object getAllEntityDescriptionsByUri(
HttpServletRequest httpServletRequest,
RestReadContext restReadContext,
QueryControl queryControl,
@RequestParam(PARAM_URI) String uri,
Page page,
boolean list,
@RequestParam(value="redirect", defaultValue=DEFAULT_REDIRECT) boolean redirect) {
ResolvedReadContext readContext = this.resolveRestReadContext(restReadContext);
EntityNameOrURI entityId =
ModelUtils.entityNameOrUriFromUri(uri);
if(list){
DirectoryResult<EntityListEntry> entityList =
this.entityDescriptionReadService.readEntityDescriptions(
entityId,
this.resolveSort(queryControl, this.entityDescriptionQueryService),
readContext,
page);
if(entityList == null || CollectionUtils.isEmpty(entityList.getEntries())){
throw ExceptionFactory.createUnknownResourceException(entityId.toString(), UnknownEntity.class);
}
ScopedEntityName name = ModelUtils.getEntity(entityList.getEntries().get(0).getEntry()).getEntityID();
EntityList descriptions =
this.populateDirectory(entityList, page, httpServletRequest, EntityList.class);
final String id = EncodingUtils.encodeScopedEntityName(name);
return this.doForward(
descriptions,
id,
httpServletRequest,
ENTITY_LIST_MESSAGE_FACTORY,
PATH_ENTITYBYURI,
PATH_ALL_DESCRIPTIONS_OF_ENTITYBYID,
new UrlTemplateBinder<EntityList>(){
@Override
public Map<String, String> getPathValues(
EntityList resource) {
Map<String, String> map = new HashMap<String,String>();
map.put(VAR_ENTITYID, id);
return map;
}
},
restReadContext,
UnknownEntity.class,
redirect);
} else {
EntityReference descriptions = this.entityDescriptionReadService.availableDescriptions(entityId, readContext);
if(descriptions == null){
throw ExceptionFactory.createUnknownResourceException(entityId.toString(), UnknownEntity.class);
}
final String id = EncodingUtils.encodeScopedEntityName(descriptions.getName());
return this.doForward(
descriptions,
id,
httpServletRequest,
ENTITYREFERENCE_MESSAGE_FACTORY,
PATH_ENTITYBYURI,
PATH_ALL_DESCRIPTIONS_OF_ENTITYBYID,
new UrlTemplateBinder<EntityReference>(){
@Override
public Map<String, String> getPathValues(
EntityReference resource) {
Map<String, String> map = new HashMap<String,String>();
map.put(VAR_ENTITYID, id);
return map;
}
},
restReadContext,
UnknownEntity.class,
redirect);
}
}
@InitBinder
public void initEntityDescriptionRestrictionBinder(
WebDataBinder binder,
@RequestParam(value=PARAM_CODESYSTEM, required=false) List<String> codesystem,
@RequestParam(value=PARAM_CODESYSTEMVERSION, required=false) List<String> codesystemversion,
@RequestParam(value=PARAM_ENTITY, required=false) List<String> entity) {
if(binder.getTarget() instanceof EntityDescriptionQueryServiceRestrictions){
EntityDescriptionQueryServiceRestrictions restrictions =
(EntityDescriptionQueryServiceRestrictions) binder.getTarget();
if(CollectionUtils.isNotEmpty(codesystemversion)){
for(String csv : codesystemversion){
restrictions.getCodeSystemVersions().add(
ModelUtils.nameOrUriFromEither(csv));
}
}
if(CollectionUtils.isNotEmpty(entity)){
restrictions.setEntities(
ControllerUtils.idsToEntityNameOrUriSet(entity));
}
if(CollectionUtils.isNotEmpty(codesystem)){
for(String cs : codesystem){
String[] parts = StringUtils.split(cs, PARAM_SEPARATOR);
TaggedCodeSystemRestriction restriction =
new TaggedCodeSystemRestriction();
restriction.setCodeSystem(ModelUtils.nameOrUriFromEither(parts[0]));
String tagName;
if(parts.length == 2){
tagName = ControllerUtils.getReference(
parts[1],
this.entityDescriptionQueryService.getSupportedTags()).getContent();
} else {
tagName = DEFAULT_TAG;
}
restriction.setTag(tagName);
restrictions.getTaggedCodeSystems().add(restriction);
}
}
}
}
private EntityQueryBuilder getNewResourceQueryBuilder(){
return new EntityQueryBuilder(
this.entityDescriptionQueryService,
this.getFilterResolver(),
this.getReadContextResolver());
}
public EntityDescriptionQueryService getEntityDescriptionQueryService() {
return entityDescriptionQueryService;
}
public void setEntityDescriptionQueryService(
EntityDescriptionQueryService entityDescriptionQueryService) {
this.entityDescriptionQueryService = entityDescriptionQueryService;
}
public EntityDescriptionReadService getEntityDescriptionReadService() {
return entityDescriptionReadService;
}
public void setEntityDescriptionReadService(
EntityDescriptionReadService entityDescriptionReadService) {
this.entityDescriptionReadService = entityDescriptionReadService;
}
public EntityDescriptionMaintenanceService getEntityDescriptionMaintenanceService() {
return entityDescriptionMaintenanceService;
}
public void setEntityDescriptionMaintenanceService(
EntityDescriptionMaintenanceService entityDescriptionMaintenanceService) {
this.entityDescriptionMaintenanceService = entityDescriptionMaintenanceService;
}
public CodeSystemVersionReadService getCodeSystemVersionReadService() {
return codeSystemVersionReadService;
}
public void setCodeSystemVersionReadService(
CodeSystemVersionReadService codeSystemVersionReadService) {
this.codeSystemVersionReadService = codeSystemVersionReadService;
}
public CodeSystemVersionNameResolver getCodeSystemVersionNameResolver() {
return codeSystemVersionNameResolver;
}
public void setCodeSystemVersionNameResolver(
CodeSystemVersionNameResolver codeSystemVersionNameResolver) {
this.codeSystemVersionNameResolver = codeSystemVersionNameResolver;
}
public EntityDescriptionValidator getEntityDescriptionValidator() {
return entityDescriptionValidator;
}
public void setEntityDescriptionValidator(
EntityDescriptionValidator entityDescriptionValidator) {
this.entityDescriptionValidator = entityDescriptionValidator;
}
}
|
package com.tencent.mm.plugin.wallet_core.ui;
import android.view.View;
import android.view.View.OnClickListener;
import com.tencent.mm.g.a.qu;
import com.tencent.mm.plugin.wallet_core.model.Orders.ShowInfo;
import com.tencent.mm.sdk.b.a;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
class WalletOrderInfoNewUI$2 implements OnClickListener {
final /* synthetic */ WalletOrderInfoNewUI pwh;
final /* synthetic */ ShowInfo pwi;
WalletOrderInfoNewUI$2(WalletOrderInfoNewUI walletOrderInfoNewUI, ShowInfo showInfo) {
this.pwh = walletOrderInfoNewUI;
this.pwi = showInfo;
}
public final void onClick(View view) {
x.i("MicroMsg.WalletOrderInfoNewUI", "onClick jump tinyApp, linkWeApp:%s, linkAddr:%s", new Object[]{this.pwi.pqm, this.pwi.pqn});
qu quVar = new qu();
quVar.cbq.userName = this.pwi.pqm;
quVar.cbq.cbs = bi.aG(this.pwi.pqn, "");
quVar.cbq.scene = 1060;
quVar.cbq.bGG = WalletOrderInfoNewUI.l(this.pwh);
quVar.cbq.cbt = 0;
quVar.cbq.context = this.pwh;
a.sFg.m(quVar);
}
}
|
package com.fleet.exception.controller;
import com.fleet.exception.config.exception.BaseException;
import com.fleet.exception.json.R;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author April Han
*/
@RestController
public class HelloController {
@RequestMapping("/hello")
public R get() {
return R.ok("hello!!!");
}
@RequestMapping("/bex")
public R bex() {
throw new BaseException("自定义错误");
}
@RequestMapping("/ex")
public R ex() throws Exception {
throw new Exception();
}
}
|
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import soot.Local;
import soot.MethodOrMethodContext;
import soot.PackManager;
import soot.Scene;
import soot.SceneTransformer;
import soot.SootClass;
import soot.SootField;
import soot.SootMethod;
import soot.Transform;
import soot.jimple.toolkits.callgraph.CHATransformer;
import soot.jimple.toolkits.callgraph.CallGraph;
import soot.jimple.toolkits.callgraph.Targets;
import soot.options.Options;
import soot.util.Chain;
public class Loader {
public static void main(String[] args) {
// Setting the Soot ClassPath and loading the class to be analyzed.
String path = Scene.v().getSootClassPath() + ";" + "C:/Users/Dhriti/workspace_trying/InputForSootTesting/sootOutput";
Scene.v().setSootClassPath(path);
SootClass sootClass = Scene.v().loadClassAndSupport("TestJava");
//soot.options.Options.v().setPhaseOption("jb", "use-original-names:true");
sootClass.setApplicationClass();
// Printing Super Class Name
System.out.println("Class '" + sootClass.getName() + "' being analyzed...");
System.out.println("SuperClass is: " + sootClass.getSuperclass());
// Printing Implemented Interfaces
System.out.println("\nImplemented Interfaces...");
Chain<SootClass> interfaces = sootClass.getInterfaces();
Iterator<SootClass> i = interfaces.iterator();
while(i.hasNext())
{
System.out.println(i.next().getName());
}
// Printing Method Count
System.out.println("\nTotal number of methods implemented: " + sootClass.getMethodCount());
// Printing Method Information
System.out.println("\nMethod information...\n");
List<SootMethod> methods = sootClass.getMethods();
Iterator<SootMethod> m = methods.iterator();
SootMethod target=null;
while(m.hasNext())
{
SootMethod method = m.next();
System.out.println("Name: " + method.getName());
if(method.getName().equals("fact"))
target = method;
System.out.println("Signature: " + method.getSignature());
System.out.println("Return Type: " + method.getReturnType());
System.out.println("Declaration: " + method.getDeclaration());
System.out.print("Method local feilds: ");
Chain<Local> locals = method.retrieveActiveBody().getLocals();
int len = locals.size();
Iterator<Local> l = locals.iterator();
for(int j=0; j<len-1; ++j)
{
System.out.print(l.next().getName() + ", ");
}
System.out.println(l.next().getName());
if (method.isStatic())
System.out.println("Method is Static");
if(method.isPrivate())
System.out.println("Method is Private");
else if(method.isProtected())
System.out.println("Method is Protected");
else
System.out.println("Method is Public");
System.out.println("\n");
}
// Printing class fields
System.out.println("Class Fields...");
Chain<SootField> fields = sootClass.getFields();
Iterator<SootField> f = fields.iterator();
while(f.hasNext())
{
System.out.println(f.next().getName());
}
/*
List<String> sootArgs = new LinkedList();
sootArgs.add("-main-class");
sootArgs.add("C:/Users/Dhriti/workspace_trying/InputForSootTesting/bin/TestJava");
//enable whole program mode
sootArgs.add("-W");
sootArgs.add("-p");
sootArgs.add("wjop");
sootArgs.add("enabled:true");
//enable points-to analysis
sootArgs.add("-p");
sootArgs.add("cg");
sootArgs.add("enabled:true");
//enable Spark
sootArgs.add("-p");
sootArgs.add("cg.spark");
sootArgs.add("enabled:true");
Options.v().classes().add("TestJava");
String[] argsArray = sootArgs.toArray(new String[0]);
PackManager.v().getPack("wjtp").add(new Transform("wjtp.myTrans", new SceneTransformer() {
@Override
protected void internalTransform(String phaseName, Map options) {
CHATransformer.v().transform();
SootClass a = Scene.v().getSootClass("TestJava");
SootMethod src = Scene.v().getMainClass().getMethodByName("fact");
CallGraph cg = Scene.v().getCallGraph();
Iterator<MethodOrMethodContext> targets = new Targets(cg.edgesOutOf(src));
while (targets.hasNext()) {
SootMethod tgt = (SootMethod)targets.next();
System.out.println(src + " may call " + tgt);
}
}
}));
//Options.v().set_whole_program(true);
soot.Main.main(argsArray);
*/
}
}
|
package com.tencent.mm.plugin.appbrand.ui;
class h$1 implements Runnable {
final /* synthetic */ int bpX;
final /* synthetic */ String etb;
final /* synthetic */ h gwP;
h$1(h hVar, int i, String str) {
this.gwP = hVar;
this.bpX = i;
this.etb = str;
}
public final void run() {
h.a(this.gwP, this.bpX, this.etb);
}
}
|
package com.hason.dtp.message.consumer.receiver;
import com.hason.dtp.account.payload.RegistPoint;
import com.hason.dtp.core.utils.JsonMapper;
import com.hason.dtp.core.utils.result.Result;
import com.hason.dtp.message.consumer.service.MessageServiceClient;
import com.hason.dtp.message.consumer.service.PointServiceClient;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 用户积分消息消费端
*
* @author Huanghs
* @since 2.0
* @date 2017/11/12
*/
@Component
@RabbitListener(queues = "${queue.message.userPointQueue}")
public class UserPointReceiver {
@Autowired
private MessageServiceClient messageServiceClient;
@Autowired
private PointServiceClient pointServiceClient;
@RabbitHandler
public void process(String msg) {
// 这里转换成相应的对象还有问题,确保全部都是 json ?
RegistPoint payload = JsonMapper.INSTANCE.fromJson(msg, RegistPoint.class);
Result<?> result = pointServiceClient.addRegistPoint(payload.getUserId());
if (result.success()) {
// 操作成功后,删除可靠消息;失败则不处理,等待超时处理
messageServiceClient.deleteMessageByMessageId(payload.getMessageId());
}
}
}
|
package premiereleague.crawler;
/**
* This class contains a list of useful constants
* @author Andrés Sánchez
*/
public class Constants
{
public static final String USER_AGENT = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.53 Safari/525.19";
}
|
package readingmeter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.validation.constraints.NotNull;
@Entity
public class MeterReading {
@Id
@GeneratedValue
private Long id;
@NotNull
private Month month;
@JsonIgnore
@ManyToOne
private Connection connection;
@NotNull
private int meterReading;
MeterReading( ) { //jpa only
}
public MeterReading(Month month, int meterReading) {
this.month = month;
this.meterReading = meterReading;
}
public Month getMonth() {
return month;
}
public void setMonth(Month month) {
this.month = month;
}
public Connection getConnection() {
return connection;
}
public void setConnection(Connection connection) {
this.connection = connection;
}
public int getMeterReading() {
return meterReading;
}
public void setMeterReading(int meterReading) {
this.meterReading = meterReading;
}
}
|
/**
* This class ParkingMeter know
* the number of minutes of parking time that has been purchased.
*/
public class ParkingMeter
{
private int purchasedTime;
/**
* no-arg constructor, setting the variable to zero.
*/
public ParkingMeter()
{
setPurchasedTime(0);
}
/**
* constructor, setting the variable to the given value
* @param purchasedTime
*/
public ParkingMeter(int purchasedTime)
{
this.setPurchasedTime(purchasedTime);
}
/**
* @return the purchasedTime
*/
public int getPurchasedTime() {
return purchasedTime;
}
/**
* @param purchasedTime the purchasedTime to set
*/
public void setPurchasedTime(int purchasedTime) {
this.purchasedTime = purchasedTime;
}
}
|
package com.accp.service.impl;
import com.accp.entity.Sellquote;
import com.accp.dao.SellquoteDao;
import com.accp.service.ISellquoteService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author ljq
* @since 2019-08-28
*/
@Service
public class SellquoteServiceImpl extends ServiceImpl<SellquoteDao, Sellquote> implements ISellquoteService {
}
|
package com.techlab.lskov;
public class Penguin extends Bird {
public Penguin() {
super.setFlyable(false);
System.out.println("cant fly");
}
@Override
public void fly() {
// System.out.println("I'm flying high, across the mountain !");
}
}
|
package collectionpackage;
import java.util.Arrays;
public class CompareStrings {
public static void main(String[] args) {
// TODO Auto-generated method stub
String s1="Latha";
String s2="Kalaiarasan";
String s3="Murugan";
String s4="Ramamoorthy";
String [] s= {s1,s2,s3,s4};
Arrays.sort(s);
for(String a:s)
{
System.out.print(a+" ");
}
System.out.println();
MyComparator c = new MyComparator();
Arrays.sort(s, 0, 4, c);
System.out.println("Sorted with comparator");
for(String a:s)
{
System.out.print(a+" ");
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.