text
stringlengths
10
2.72M
//package com.sprmvc.web.ch5.services; // //import com.sprmvc.web.ch5.Order; //import com.sprmvc.web.ch5.Spitter; //import com.sprmvc.web.ch5.Spittle; //import org.springframework.beans.factory.annotation.Autowired; // //import java.util.List; // //public class OrderBean { // //// @Autowired // private OrderService orderService; // // @Autowired // private SpitterService spitterService; // // public void placeOrder() { // System.out.println("-- placing orders --"); // orderService.placeOrder("ABC Tablet", 2); // orderService.placeOrder("XYZ Desktop", 3); // } // // public void listOrders() { // System.out.println("-- getting order list from service --"); // List<Order> orderList = orderService.getOrderList(); // System.out.println(orderList); // } // // public void getSpittles() { // List<Spittle> orderList = spitterService.getSpittlesForSpitter(new Spitter()); // System.out.println(orderList); // } //}
package co.staruml.test; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.HashMap; import javax.swing.*; import co.staruml.awt.*; import co.staruml.core.Const; import co.staruml.core.DiagramControl; import co.staruml.core.DiagramView; import co.staruml.core.EdgeView; import co.staruml.core.NodeView; import co.staruml.core.View; import co.staruml.graphics.*; import co.staruml.handler.*; import co.staruml.uml.*; import co.staruml.views.*; public class DiagramEditorAWTTest implements SelectHandlerListener { private DiagramView diagramView; private DiagramControl editor; private ImageManager imageManager; public DiagramEditorAWTTest() { } public void test() { NodeView nodeView1 = new NodeView(); nodeView1.initialize(null, 20, 20, 120, 120); NodeView nodeView2 = new NodeView(); nodeView2.initialize(null, 110, 200, 210, 300); UMLClassView nodeView3 = new UMLClassView(); nodeView3.initialize(null, 210, 20, 310, 120); UMLActorView nodeView4 = new UMLActorView(); nodeView4.initialize(null, 310, 20, 410, 120); EdgeView edgeView1 = new EdgeView(); edgeView1.setTail(nodeView1); edgeView1.setHead(nodeView2); edgeView1.setHeadEndStyle(Const.ES_ARROW_DIAMOND); edgeView1.setTailEndStyle(Const.ES_ARROW_FILLED_DIAMOND); edgeView1.setLineStyle(Const.LS_RECTILINEAR); edgeView1.setLineColor(Color.GRAY); edgeView1.initialize(null, 30, 30, 210, 210); EdgeView edgeView2 = new EdgeView(); edgeView2.setTail(nodeView2); edgeView2.setHead(nodeView3); edgeView2.setHeadEndStyle(Const.ES_FLAT); edgeView2.setTailEndStyle(Const.ES_TRIANGLE); edgeView2.setLineStyle(Const.LS_OBLIQUE); edgeView2.setLineColor(Color.GRAY); edgeView2.initialize(null, 30, 30, 210, 210); diagramView = new DiagramView(); diagramView.addOwnedView(nodeView1); diagramView.addOwnedView(nodeView2); diagramView.addOwnedView(nodeView3); diagramView.addOwnedView(nodeView4); diagramView.addOwnedView(edgeView1); diagramView.addOwnedView(edgeView2); SelectHandler handler = new SelectHandler(); handler.setSelectHandlerListener(this); imageManager = new ImageManagerAWT(); UMLIconLoader.loadIcons(imageManager); editor = new DiagramControlAWT(imageManager); editor.setDiagramView(diagramView); editor.getCanvas().setGridFactor(new GridFactor(4, 4)); editor.getCanvas().setZoomFactor(new ZoomFactor(2, 2)); editor.getCanvas().setAntialias(Canvas.AS_ON); editor.setHandler(handler); editor.setSize(2000, 2000); editor.repaint(); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); java.awt.Container container = frame.getContentPane(); JPanel panel = new JPanel(); JButton button = new JButton("StereotypeDisplay"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int sz = editor.getDiagramView().getSelectedViews().size(); if (sz > 0) { View v = editor.getDiagramView().getSelectedViews().firstElement(); if (v instanceof UMLGeneralNodeView) { UMLGeneralNodeView gv = (UMLGeneralNodeView) v; int sd = gv.getStereotypeDisplay(); sd++; if (sd > 3) sd = 0; gv.setStereotypeDisplay(sd); editor.repaint(); } } } }); panel.add(button); JPanel panel2 = new JPanel(); panel2.setLayout(new java.awt.BorderLayout()); JScrollPane scroll = new JScrollPane(((DiagramControlAWT) editor)); panel2.add(scroll, java.awt.BorderLayout.CENTER); container.setLayout(new java.awt.BorderLayout()); container.add(panel, java.awt.BorderLayout.NORTH); container.add(panel2, java.awt.BorderLayout.CENTER); ((DiagramControlAWT) editor).setPreferredSize(new java.awt.Dimension(1000, 1000)); frame.setSize(800, 600); frame.setVisible(true); frame.repaint(); editor.repaint(); } public static void main(String[] args) { DiagramEditorAWTTest test = new DiagramEditorAWTTest(); test.test(); } public void selectArea(int x1, int y1, int x2, int y2) { diagramView.deselectAll(); diagramView.selectArea(editor.getCanvas(), x1, y1, x2, y2); editor.repaint(); } public void deselectView(View view) { } public void changeSelectedViewsContainer(int dx, int dy, View containerView) { } public void changeViewContainer(View view, int dx, int dy, View containerView) { } public void moveSelectedViews(int dx, int dy) { for (View v : diagramView.getSelectedViews()) { v.move(editor.getCanvas(), dx, dy); } editor.repaint(); } public void moveView(View view, int dx, int dy) { view.move(editor.getCanvas(), dx, dy); editor.repaint(); } public void selectAdditionalView(View view) { view.setSelected(true); editor.repaint(); } public void selectView(View view) { diagramView.deselectAll(); view.setSelected(true); editor.repaint(); } public void resizeNode(NodeView node, int left, int top, int right, int bottom) { node.setLeft(left); node.setTop(top); node.setRight(right); node.setBottom(bottom); editor.repaint(); } public void viewDoubleClicked(DiagramControl diagramControl, Canvas canvas, View view, MouseEvent e) { System.out.println("View double clicked : " + view); } public void modifyEdge(EdgeView edge, Points points) { edge.getPoints().assign(points); editor.repaint(); } public void reconnectEdge(EdgeView edge, Points points, View newParticipant, boolean isTailSide) { // TODO Auto-generated method stub } }
/* * 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 eu.stoehler.botapi.users; import eu.stoehler.botapi.data.Command; import eu.stoehler.botapi.data.Transaction; import static eu.stoehler.botapi.users.NicknameDatabase.Resolution.*; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; /** * * @author joern */ public class NicknameDatabaseImpl implements NicknameDatabase { private static final long serialVersionUID = 1L; /** * used to give handles to Users who do not want to be serialized. */ private final AtomicInteger externalIdCounter; private final Collection<Target> targets; private final Collection<Nickname> nicknames; //lower-priority nicknames public NicknameDatabaseImpl() { targets = new HashSet<>(); nicknames = new HashSet<>(); externalIdCounter = new AtomicInteger(); } /** * Get all nicknames belonging to one target. * * @param user the target * @return a stream of nicknames */ @Override public Collection<Nickname> getNicknamesOf(Target user) { return nicknames.stream().filter(n -> n.target == user).collect(Collectors.toList()); } /** * empties the database. */ protected void close() { nicknames.clear(); targets.clear(); externalIdCounter.set(0); } /** * API-function to find a user given some token and an intended level of * tolerance. * * @param token the token belonging to some user * @param resolution specifies how far the search shall go * @return the user or null */ @Override public Target findTarget(String token, Resolution resolution) { if (resolution.level >= NICKNAME.level) { Nickname nick = findExact(token); if (nick != null) { return nick.getTarget(); } } if (resolution.level >= NORMALIZED.level) { Nickname nick = findEqual(token); if (nick != null) { return nick.getTarget(); } } if (resolution.level >= STRINGDISTANCE.level) { //TODO } return null; } /** * API-function to find a user with maximal tolerance. * * @param token the token belonging to some user * @return the user or null */ private Target findTarget(String token) { return findTarget(token, Resolution.STRINGDISTANCE); } /** * API-function to find a nickname with specified tolerance. * * @param token the token belonging to some nickname. * @param resolution the level of tolerance * @return the nickname or null */ @Override public Nickname findNickname(String token, Resolution resolution) { if (resolution.level >= NICKNAME.level) { Nickname nick = findExact(token); if (nick != null) { return nick; } } if (resolution.level >= NORMALIZED.level) { Nickname nick = findEqual(token); if (nick != null) { return nick; } } if (resolution.level >= STRINGDISTANCE.level) { //TODO } return null; } /** * API-function to find a nickname. * * @param token the token belonging to some nickname. * @return the nickname or null */ private Nickname findNickname(String token) { return findNickname(token, Resolution.STRINGDISTANCE); } /** * value == value. */ private Nickname findExact(String value) { return nicknames.parallelStream().filter(n -> n.value.equals(value)).findAny().orElse(null); } /** * normalized == normalized(value). */ private List<Nickname> findEquals(String value) { String eqn = Nickname.normalize(value); return nicknames.parallelStream().filter(n -> n.normalized.equals(eqn)).collect(Collectors.toList()); } /** * normalied == normalized. Finds any such nickname. */ private Nickname findEqual(String equal) { String eqn = Nickname.normalize(equal); return nicknames.parallelStream().filter(n -> n.normalized.equals(eqn)).findAny().orElse(null); } /** * API-function to generate an External Target to wrap a Target. <br> * If a Target shall not be serialized, then use <br> null null null null {@code * // creating it the first time * Target target = ...; * ExternalTarget wrapper = addExternalTarget(target); * storeExternalId(wrapper.id); * // loading it the next time * Target target = ...; * int externalId = loadExternalId(); * ExternalTarget wrapper = connectExternalTarget(externalId, target); * * } * * @param target the target to wrap * @return an unused and guaranteed unique id */ @Override public synchronized ExternalTarget createExternalTarget(Target target) { int id = this.externalIdCounter.getAndIncrement(); return new ExternalTarget(id, target); } /** * API-function to find the external target for a given id * * @param externalId the id to look for. has to be remembered externally * @return the associated ExternalTarget or null */ @Override public synchronized ExternalTarget findExternalTarget(int externalId) { ExternalTarget wrapper = targets.stream() .filter(t -> t instanceof ExternalTarget) .map(t -> (ExternalTarget) t) .filter(t -> t.externalId == externalId) .findAny().orElse(null); return wrapper; } @Override public synchronized Command connectExternalTarget(int externalId, Target target) { return new Command.Atomic() { Target oldTarget = null; ExternalTarget wrapper = null; @Override public void execute() throws Exception { wrapper = findExternalTarget(externalId); if (wrapper == null) { throw new IllegalArgumentException("externalId '" + externalId + "' does not exist"); } oldTarget = wrapper.target; wrapper.target = target; } @Override public void undo() { wrapper.target = oldTarget; } }; } /** * API-function to check if an user already exists. * * @param target the target that might be already there * @return true if target already is registered. */ @Override public synchronized boolean hasTarget(Target target) { return targets.contains(target); } /** * API-function to determine whether a collision will occur when adding this * nickname. * * @param add the nickname to add * @return the colliding old nickname or null */ @Override public Nickname findCollision(Nickname add) { Nickname old = this.findNickname(add.value); //max resolution return old; } private void allowNicknameAdd(Nickname nick) throws NicknameCollisionException, NicknameProtectionException { if (nicknames.contains(nick)) { return; //nothing to do } // check user/usertype nick.target.allowAddNickname(nick); // check collision Nickname old = findCollision(nick); if (old != null) { throw new NicknameCollisionException(old, nick); } } /** * API-function to add an user. * * @param target the target to be added * @return a command object */ @Override public synchronized Command addTarget(Target target) { return new Command.Atomic() { boolean alreadyThere = false; @Override public void execute() throws Exception { alreadyThere = hasTarget(target); if (!alreadyThere) { targets.add(target); } } @Override public void undo() { if (alreadyThere) { return; } targets.remove(target); } }; } private Command deleteTarget(Target target) { return new Command.Atomic() { boolean alreadyThere = false; @Override public void execute() throws Exception { alreadyThere = hasTarget(target); if (!alreadyThere) { return; } target.allowDeleteUser(); targets.remove(target); } // remove all references // nicknames.removeIf(n -> n.target == target); @Override public void undo() { if (alreadyThere) { targets.add(target); } } }; } /** * API-function to create a nickname. Does not overwrite existing nickname. * * @param nick the nickname to add * @return a command object */ @Override public synchronized Command addNickname(Nickname nick) { return new Command.Atomic() { boolean alreadyThere = false; @Override public void execute() throws Exception { alreadyThere = nicknames.contains(nick); if (alreadyThere) { return; } allowNicknameAdd(nick); nicknames.add(nick); } @Override public void undo() { if (alreadyThere) { return; } nicknames.remove(nick); } }; } /** * API-function to delete a nickname * * @param nick the nickname to remove * @return a command object */ @Override public synchronized Command deleteNickname(Nickname nick) { return new Command.Atomic() { boolean alreadyThere = false; @Override public void execute() throws Exception { alreadyThere = nicknames.contains(nick); if (!alreadyThere) { return; } nick.target.allowDeleteNickname(nick); nicknames.remove(nick); } @Override public void undo() { if (!alreadyThere) { return; } nicknames.add(nick); } }; } private Command deleteReferences(Target target) { return new Command.Wrapper(() -> { Transaction T = new Transaction(); NicknameDatabaseImpl.this.nicknames.stream() .filter(n -> n.target == target) .forEach(n -> T.enqueue(this.deleteNickname(n)) ); return T; }); } /** * API-function to delete a User. * * @param target the user to delete * @return a command object */ @Override public synchronized Command deleteTargetAndReferences(Target target) { return new Transaction() .enqueue(this.deleteTarget(target)) .enqueue(this.deleteReferences(target)); } }
package com.youyan.android.headlines.utils; import android.content.Context; import android.widget.Toast; /** * Created by android on 3/21/18. * Toast类 */ public class ToastUtil { private final static boolean isShow = true; private ToastUtil(){ throw new UnsupportedOperationException("ToastUtil cannot be instantiated"); } public static void showShort(Context context, CharSequence message) { if(isShow) Toast.makeText(context,message,Toast.LENGTH_SHORT).show(); } public static void showShort(Context context, int message){ if (isShow) Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); } public static void showLong(Context context,CharSequence message) { if(isShow) Toast.makeText(context,message,Toast.LENGTH_LONG).show(); } public static void showLong(Context context,int message) { if(isShow) Toast.makeText(context,message,Toast.LENGTH_LONG).show(); } public static void show(Context context, CharSequence message, int duration) { if (isShow) Toast.makeText(context, message, duration).show(); } public static void show(Context context, int message, int duration) { if (isShow) Toast.makeText(context, message, duration).show(); } }
package com.mac.dubbo.erp.baby.mapper.order; import com.mac.dubbo.erp.baby.model.order.Order; public interface OrderMapper { /** * 根据员工号查询订单总金额 * @param employeeId * @return */ Order selectSumOrderByCustomerId(String employeeId); /** * 根据员工号查询订单个数 * @param employeeId * @return */ Order selectOrderCountByCustomerId(String employeeId); /** * 创建订单 * @param order */ void saveOrder(Order order); }
package com.wangyi.wangyi_yanxuan.mapper; import com.sun.org.glassfish.gmbal.ParameterNames; import com.wangyi.wangyi_yanxuan.domain.Grade; import org.apache.ibatis.annotations.*; import javax.annotation.PreDestroy; import java.util.List; import java.util.Map; public interface GradeMapper { //按id 删除 @Delete("DELETE from t_grade where gid=#{gid,jdbcType=INTEGER}") void deleteByPrimaryKey(Integer gid); @Select("select g.grade from t_grade g where g.gid=#{gid,jdbcType=INTEGER}") @ResultType(Integer.class) int selectdj(Integer gid); //查询上级下方是否包含下级 @Select("select COUNT(DISTINCT r.parentid)or COUNT(DISTINCT r.kindid) from t_grade g LEFT JOIN t_grade r on g.gid=r.parentid or r.kindid where g.gid=#{gid,jdbcType=INTEGER}") @ResultType(Integer.class) int selectByAll( Integer gid); //查询三级是否有对应的数据 @Select("select COUNT(DISTINCT c.cname) from t_grade g INNER JOIN t_commodity c on g.gid=c.gradeid where g.gid=#{gid,jdbcType=INTEGER}") @ResultType(Integer.class) int selectComAll(Integer gid); //查询所有分页 @Select("select * from t_grade limit #{currPage,jdbcType=INTEGER},#{limit,jdbcType=INTEGER}") @ResultType(Grade.class) List<Grade> selectAllPage(@Param("currPage") int currpage ,@Param("limit") int limit); //查询总数 @Select("select COUNT(1) from t_grade") @ResultType(Integer.class) int conutTologin(); //按id修改 @Update("UPDATE t_grade set gradename=#{gradename} where gid=#{gid}") void updateByPrimaryKey(Grade grade); //添加时查询等级 @Select("select gid,gradename from t_grade where grade=#{grade,jdbcType=INTEGER}") @ResultType(Grade.class) List<Grade> selectNumber(int grade); //商品种类添加操作 @Insert("insert into t_grade(gradename,grade,parentid,kindid) values(#{gradename,jdbcType=VARCHAR}, #{grade,jdbcType=INTEGER}, #{parentid,jdbcType=INTEGER}, #{kindid,jdbcType=INTEGER})") void insertGrade(Grade grade); //模糊搜索 @Select("select * from t_grade where gradename like CONCAT('%',#{gradename,jdbcType=VARCHAR},'%')") @ResultType(Grade.class) List<Grade> countNumber(String gradename); }
package com.mkay.scorecard; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.SupportMapFragment; import android.annotation.SuppressLint; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; @SuppressLint("NewApi") public class FragmentFour extends Fragment { private SupportMapFragment googleMapFragment; private GoogleMap googleMap; public FragmentFour() { } public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_four, container, false); initMap(); return view; } public void initMap () { FragmentManager fragmentManager = getChildFragmentManager(); googleMapFragment = (SupportMapFragment) fragmentManager.findFragmentById(R.id.map_container); // check if map is created successfully or not if (googleMapFragment == null) { googleMapFragment = SupportMapFragment.newInstance(); fragmentManager.beginTransaction().replace(R.id.map_container, googleMapFragment).commit(); } googleMap = googleMapFragment.getMap(); } }
package example.data.redis.redis.lock; import example.data.redis.SpringBootExampleDataRedisApplicationTests; import example.data.redis.lock.RedisLock; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.StringRedisTemplate; import java.util.concurrent.CountDownLatch; /** * Created by LL on 2018/7/22 0022. */ public class RedisLockTest extends SpringBootExampleDataRedisApplicationTests { // 并发的线程数 private static final int threadNum = 10; private static CountDownLatch countDownLatch = new CountDownLatch(threadNum); @Autowired private StringRedisTemplate template; private RedisLock lock = new RedisLock(template, "test:lockKey"); @Test public void contextLoads() { for (int i = 0; i < threadNum; i++) { new Thread(new PrintTask("好好学习,天天向上")).start(); countDownLatch.countDown(); System.out.println(countDownLatch.getCount()); } } class PrintTask implements Runnable { private String content; public PrintTask(String content) { this.content = content; } @Override public void run() { try { countDownLatch.await(); // 线程运行到这里等待,等待发令枪计数器变为0 } catch (InterruptedException e) { e.printStackTrace(); } lock.lock(); try { Printer.print(Thread.currentThread().getName() + "(" + content + ")"); } finally { lock.unlock(); } } } }
package cn.bs.zjzc.baidumap; import com.baidu.location.LocationClient; import com.baidu.location.LocationClientOption; /** * 百度地图定位参数设置 * Created by mgc on 2016/6/27. */ public class BaiduMapLocate { // 定位相关 private LocationClient mLocClient; public BaiduMapLocate(LocationClient mLocClient) { this.mLocClient = mLocClient; setOptions(); } private void setOptions() { /*设置定位参数*/ LocationClientOption option = new LocationClientOption(); option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy);//可选,默认高精度,设置定位模式,高精度,低功耗,仅设备 option.setCoorType("bd09ll");//可选,默认gcj02,设置返回的定位结果坐标系 option.setScanSpan(0);//可选,默认0,即仅定位一次,设置发起定位请求的间隔需要大于等于1000ms才是有效的 option.setIsNeedAddress(true);//可选,设置是否需要地址信息,默认不需要 option.setOpenGps(true);//可选,默认false,设置是否使用gps option.setLocationNotify(true);//可选,默认false,设置是否当gps有效时按照1S1次频率输出GPS结果 option.setIsNeedLocationDescribe(true);//可选,默认false,设置是否需要位置语义化结果,可以在BDLocation.getLocationDescribe里得到,结果类似于“在北京天安门附近” option.setIsNeedLocationPoiList(true);//可选,默认false,设置是否需要POI结果,可以在BDLocation.getPoiList里得到 mLocClient.setLocOption(option); } public void startLoc() { mLocClient.start(); } }
package store; import entities.Category; import entities.Purchase; import java.time.LocalDate; public class PurchaseStore implements IPurchaseStore { @Override public Purchase[] getPurchases(LocalDate startDate, LocalDate endDate) { return new Purchase[0]; } @Override public Purchase[] getPurchasesByCategory(LocalDate startDate, LocalDate endDate, int catId) { return new Purchase[0]; } @Override public Category[] getAllCategories() { return new Category[0]; } }
package com.plter.card2d; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.animation.Animation; import android.view.animation.ScaleAnimation; import android.widget.ImageView; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initProperties(); findViewById(R.id.root).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { if (imageA.getVisibility()==View.VISIBLE) { imageA.startAnimation(saTo0); }else{ imageB.startAnimation(saTo0); } } }); } private void initProperties(){ imageA = (ImageView) findViewById(R.id.ivA); imageB = (ImageView) findViewById(R.id.ivB); showImageA(); saTo0.setDuration(350); saTo1.setDuration(350); saTo0.setAnimationListener(new Animation.AnimationListener(){ @Override public void onAnimationEnd(Animation arg0) { if (imageA.getVisibility()==View.VISIBLE) { imageA.setAnimation(null); showImageB(); imageB.startAnimation(saTo1); }else{ imageB.setAnimation(null); showImageA(); imageA.startAnimation(saTo1); } } @Override public void onAnimationRepeat(Animation arg0) {} @Override public void onAnimationStart(Animation arg0) {} }); } private void showImageA(){ imageA.setVisibility(View.VISIBLE); imageB.setVisibility(View.INVISIBLE); } private void showImageB(){ imageA.setVisibility(View.INVISIBLE); imageB.setVisibility(View.VISIBLE); } private ImageView imageA; private ImageView imageB; private ScaleAnimation saTo0 = new ScaleAnimation(1, 0, 1, 1, Animation.RELATIVE_TO_PARENT, 0.5f, Animation.RELATIVE_TO_PARENT, 0.5f); private ScaleAnimation saTo1 = new ScaleAnimation(0, 1, 1, 1, Animation.RELATIVE_TO_PARENT, 0.5f, Animation.RELATIVE_TO_PARENT, 0.5f); }
package com.mtihc.minecraft.treasurechest.persistance; import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import org.bukkit.Location; import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.inventory.ItemStack; public class TChestCollection implements ConfigurationSerializable { private Map<String, TreasureChest> chests; public TChestCollection() { chests = new HashMap<String, TreasureChest>(); } public static String getChestId(Location location) { String worldName = location.getWorld().getName().replace(" ", "_"); String coordinates = location.getBlockX() + "_" + location.getBlockY() + "_" + location.getBlockZ(); return worldName + "_" + coordinates; } public Collection<TreasureChest> getChests() { return chests.values(); } public boolean isEmpty() { return chests.isEmpty(); } public int getChestTotal() { return chests.size(); } public int getChestItemTotal(String id) { int result = 0; TreasureChest chest = chests.get(id); for (ItemStack stack : chest.getContents()) { if(stack != null) { result++; } } return result; } public Collection<String> getChestIds() { return chests.keySet(); } public TreasureChest getChest(String id) { return chests.get(id); } public void setChest(TreasureChest tchest) { chests.put(getChestId(tchest.getLocation()), tchest); } public boolean hasChest(String id) { return chests.containsKey(id); } public TreasureChest removeChest(String id) { return chests.remove(id); } public TChestCollection(Map<String, Object> values) { this.chests = new HashMap<String, TreasureChest>(); Map<?, ?> chestSection = (Map<?, ?>) values.get("chests"); Set<?> entries = chestSection.entrySet(); for (Object object : entries) { Entry<?, ?> entry = (Entry<?, ?>) object; this.chests.put(entry.getKey().toString(), (TreasureChest) entry.getValue()); } } @Override public Map<String, Object> serialize() { Map<String, Object> result = new HashMap<String, Object>(); result.put("chests", chests); return result; } }
package org.crama.burrhamilton.controller; import org.crama.burrhamilton.model.Answer; import org.crama.burrhamilton.model.SocialUser; import org.crama.burrhamilton.model.Statement; import org.crama.burrhamilton.service.AnswerService; import org.crama.burrhamilton.service.StatementService; import org.crama.burrhamilton.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; @Controller public class AnswerController { @Autowired private AnswerService answerService; @Autowired private UserService userService; @Autowired private StatementService statementService; @RequestMapping(value="/answer", method=RequestMethod.POST) public @ResponseBody Answer saveAnswer(@RequestParam Long statementId, @RequestParam String answer, Model model) { System.out.println("Answer Controller - POST"); SocialUser user = userService.getPrincipal(); Statement statement = statementService.getStatement(statementId); Answer answerObj = new Answer(statement, answer, user); Answer savedAnswer = answerService.saveAnswer(answerObj); return savedAnswer; } @RequestMapping(value="/answer/vote/{answerId}", method=RequestMethod.POST) public @ResponseBody boolean saveAnswer(@PathVariable Long answerId, Model model) { SocialUser user = userService.getPrincipal(); Answer answer = answerService.getAnswer(answerId); if (answerService.checkVote(answer, user)) { System.out.println("User haven't voted yet"); answerService.vote(answer, user); return true; } else { return false; } } @RequestMapping(value="/answer/delete/{id}", method=RequestMethod.POST) public @ResponseBody boolean deleteAnswer(@PathVariable Long id) { Answer answer = answerService.getAnswer(id); return answerService.deleteAswwer(answer); } }
package com.personalloan.service; import com.personalloan.model.LoanDetails; public interface PersonalloanService { static Object createLoan(LoanDetails loanDetails, Long customerId) { // TODO Auto-generated method stub return null; } }
package nakoradio.mybad.core; import java.util.List; import lombok.Builder; import lombok.Data; import lombok.experimental.SuperBuilder; @Data @Builder public class Failure { private List<Error> errors; }
package com.tencent.mm.plugin.appbrand.jsapi.auth; import com.tencent.mm.protocal.c.bio; import java.util.LinkedList; interface JsApiLogin$LoginTask$a { void a(LinkedList<bio> linkedList, String str, String str2, String str3); void aid(); void qe(String str); }
/* * Copyright (c) 2018-2025, lxr All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the pig4cloud.com developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: lxr (wangiegie@gmail.com) */ package com.itfdms.upmsservice.service.impl; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.itfdms.upmsservice.mapper.SysRoleMenuMapper; import com.itfdms.upmsservice.model.entity.SysRoleMenu; import com.itfdms.upmsservice.service.SysRoleMenuService; import org.springframework.cache.annotation.CacheEvict; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; /** * java类简单作用描述 * * @ProjectName: * @Package: com.itfdms.upmsservice.service.impl * @ClassName: SysRoleMenuServiceImpl * @Description: 角色菜单表 服务实现类 * @Author: lxr * @CreateDate: 2018-08-30 18:53 * @UpdateUser: lxr * @UpdateDate: 2018-08-30 18:53 * @UpdateRemark: The modified content * @Version: 1.0 * Copyright: Copyright (c) 2018-08-30 **/ @Service public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRoleMenu> implements SysRoleMenuService { @Override @CacheEvict(value = "menu_details", key = "#role + '_menu'") public Boolean insertRoleMenus(String role, Integer roleId, Integer[] menuIds) { SysRoleMenu condition = new SysRoleMenu(); condition.setRoleId(roleId); this.delete(new EntityWrapper<>(condition)); List<SysRoleMenu> roleMenuList = new ArrayList<>(); for (Integer menuId : menuIds) { SysRoleMenu roleMenu = new SysRoleMenu(); roleMenu.setRoleId(roleId); roleMenu.setMenuId(menuId); roleMenuList.add(roleMenu); } return this.insertBatch(roleMenuList); } }
/* * 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 dataAccessLayer; /** * * @author Ruchi */ public class player { private String userName; private String password; private String actualPassword; private int Score; public player(String name,String password,int score){ this.userName=name; this.password=password; this.Score=score; } public player(String name,String password){ this.userName=name; this.password=password; } /** * @return the userName */ public String getUserName() { return userName; } /** * @return the password */ public String getPassword() { return password; } /** * @return the Score */ public int getScore() { return Score; } /** * @return the actualPassword */ public String getActualPassword() { return actualPassword; } /** * @param actualPassword the actualPassword to set */ public void setActualPassword(String actualPassword) { this.actualPassword = actualPassword; } public boolean validate(){ if(this.password==this.actualPassword){ return true; } else{ return false; } } }
package easy; /* Sample code to read in test cases:*/ import java.io.*; import java.util.*; import java.lang.*; public class SelfDescribingNumbers { public static void main (String[] args) throws IOException { File file = new File(args[0]); BufferedReader buffer = new BufferedReader(new FileReader(file)); String line="2020"; while ((line = buffer.readLine()) != null) { line = line.trim(); HashMap<Integer,Integer> hm = new HashMap<Integer,Integer>(); for(int i=0;i<line.length();i++){ char ch = line.charAt(i); int n = Integer.parseInt(ch+""); if(!hm.containsKey(n)){ hm.put(n,1); }else{ hm.put(n,hm.get(n)+1); } } int len=0; for(int i=0;i<line.length();i++, len++){ int n= Integer.parseInt(line.charAt(i)+""); if(hm.containsKey(i) && n != hm.get(i)){ System.out.println(0); hm.clear(); break; } } if(len == line.length()){ System.out.println(1); } } } }
package programmers; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.stream.Collectors; public class DivideNumber { public static void main(String[] args) { System.out.println(Arrays.toString(solution(new int[] {5,9,7,10}, 5))); } public static int[] solution(int[] arr, int divisor) { int[] answer = {}; ArrayList<Integer> num = new ArrayList<>(0); for(int n : arr){ if(n%divisor==0){ num.add(n); } } if(num.size()==0){ answer = new int[] {-1}; } else { answer = num.stream().mapToInt(Integer::intValue).toArray(); Arrays.sort(answer); } return answer; } }
package com.practice.imdc.movieservice.constants; public enum Genre { DRAMA("Drama"), FICTION("Fiction"), SCI_FI("Sci-fi"), COMEDY("Comedy"), ROMANCE("Romance"), ACTION("Action"); private String value; Genre(String value) { this.value = value; } }
import java.util.Iterator; import java.util.LinkedList; public class LinkedList_ { public static void main(String[] args) { LinkedList<String> array = new LinkedList<String>(); array.add("BMW"); array.add("FORD"); array.add("BMW"); Iterator <String> itr = array.iterator(); while (itr.hasNext()){ System.out.println(itr.next()); } } }
package c.t.m.g; import android.annotation.SuppressLint; import android.content.Context; import android.os.Build.VERSION; import android.provider.Settings.Global; import android.provider.Settings.System; import android.telephony.CellInfo; import android.telephony.CellLocation; import android.telephony.NeighboringCellInfo; import android.telephony.SignalStrength; import android.telephony.TelephonyManager; import android.telephony.cdma.CdmaCellLocation; import android.telephony.gsm.GsmCellLocation; import c.t.m.g.dp.a; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.eclipse.jdt.annotation.NonNull; public final class ec { public static boolean a = false; @SuppressLint({"NewApi"}) public static boolean a(Context context) { try { if (VERSION.SDK_INT >= 17) { if (Global.getInt(context.getContentResolver(), "airplane_mode_on") == 1) { return true; } return false; } else if (System.getInt(context.getContentResolver(), "airplane_mode_on") != 1) { return false; } else { return true; } } catch (Throwable th) { return false; } } @SuppressLint({"NewApi"}) public static List<dp> a(ct ctVar) { try { TelephonyManager telephonyManager = ctVar.e; if (telephonyManager != null) { List<CellInfo> allCellInfo = telephonyManager.getAllCellInfo(); if (allCellInfo == null) { return null; } List<dp> arrayList = new ArrayList(); for (CellInfo cellInfo : allCellInfo) { if (cellInfo.isRegistered()) { arrayList.add(dp.a(ctVar, cellInfo)); } } return arrayList; } } catch (Throwable th) { } return null; } /* JADX WARNING: inconsistent code. */ /* Code decompiled incorrectly, please refer to instructions dump. */ public static android.telephony.CellLocation b(c.t.m.g.ct r6) { /* r2 = 0; r1 = 1; r3 = r6.e; if (r3 == 0) goto L_0x0046; L_0x0006: r4 = r3.getCellLocation(); Catch:{ Exception -> 0x0043 } r0 = r3.getSimState(); Catch:{ Exception -> 0x0043 } r5 = 5; if (r0 != r5) goto L_0x003c; L_0x0011: r0 = r1; L_0x0012: r3 = r3.getSubscriberId(); Catch:{ Exception -> 0x0040 } r3 = android.text.TextUtils.isEmpty(r3); Catch:{ Exception -> 0x0040 } if (r3 != 0) goto L_0x003e; L_0x001c: r3 = r1; L_0x001d: if (r0 == 0) goto L_0x003a; L_0x001f: if (r3 == 0) goto L_0x003a; L_0x0021: if (r4 == 0) goto L_0x002f; L_0x0023: r0 = b(r4); Catch:{ Exception -> 0x0043 } if (r0 != 0) goto L_0x002f; L_0x0029: r0 = a(r4); Catch:{ Exception -> 0x0043 } if (r0 >= 0) goto L_0x0038; L_0x002f: r0 = r6.a; Catch:{ Exception -> 0x0043 } r0 = a(r0); Catch:{ Exception -> 0x0043 } if (r0 != 0) goto L_0x0038; L_0x0037: r2 = r1; L_0x0038: a = r2; Catch:{ Exception -> 0x0043 } L_0x003a: r0 = r4; L_0x003b: return r0; L_0x003c: r0 = r2; goto L_0x0012; L_0x003e: r3 = r2; goto L_0x001d; L_0x0040: r3 = move-exception; r3 = r1; goto L_0x001d; L_0x0043: r0 = move-exception; a = r1; L_0x0046: r0 = android.telephony.CellLocation.getEmpty(); goto L_0x003b; */ throw new UnsupportedOperationException("Method not decompiled: c.t.m.g.ec.b(c.t.m.g.ct):android.telephony.CellLocation"); } public static int a(CellLocation cellLocation) { if (cellLocation instanceof CdmaCellLocation) { return ((CdmaCellLocation) cellLocation).getBaseStationId(); } try { return ((GsmCellLocation) cellLocation).getCid(); } catch (Exception e) { return -1; } } private static boolean b(CellLocation cellLocation) { try { GsmCellLocation gsmCellLocation = (GsmCellLocation) cellLocation; if (gsmCellLocation.getCid() == 0 && gsmCellLocation.getLac() == 0) { return true; } } catch (ClassCastException e) { } return false; } public static boolean a(CellLocation cellLocation, CellLocation cellLocation2) { boolean z; if (cellLocation == null || cellLocation2 == null) { z = true; } else { z = false; } if (z || cellLocation.getClass() != cellLocation2.getClass()) { return false; } if (cellLocation instanceof GsmCellLocation) { if (((GsmCellLocation) cellLocation).getCid() == ((GsmCellLocation) cellLocation2).getCid()) { return true; } return false; } else if (!(cellLocation instanceof CdmaCellLocation)) { return false; } else { if (((CdmaCellLocation) cellLocation).getBaseStationId() == ((CdmaCellLocation) cellLocation2).getBaseStationId()) { return true; } return false; } } public static boolean a(dp dpVar) { boolean z; if (dpVar == null) { z = true; } else { z = false; } if (z) { return false; } return a(dpVar.a.ordinal(), dpVar.b, dpVar.c, dpVar.d, dpVar.e); } public static boolean a(int i, int i2, int i3, int i4, int i5) { if (b(i)) { if (i2 < 0 || i3 < 0 || i4 < 0 || i4 > 65535 || i5 <= 0 || i5 > 65535 || (i3 == 0 && i4 == 0 && i5 == 0)) { return false; } return true; } else if (i2 < 0 || i3 < 0 || i4 <= 0 || i4 >= 65535) { return false; } else { if (i5 == 268435455 || i5 == Integer.MAX_VALUE || i5 == 50594049 || i5 == 65535 || i5 <= 0) { return false; } if (i5 == 65535 || i5 <= 0) { return false; } return true; } } public static boolean a(int i, SignalStrength signalStrength, SignalStrength signalStrength2) { if (signalStrength == null || signalStrength2 == null) { return true; } int abs = Math.abs(b(i, signalStrength, signalStrength2)); if (a(i)) { if (abs <= 3) { return false; } return true; } else if (!b(i)) { return false; } else { if (abs <= 6) { return false; } return true; } } private static int b(int i, SignalStrength signalStrength, SignalStrength signalStrength2) { try { if (a(i)) { return signalStrength.getGsmSignalStrength() - signalStrength2.getGsmSignalStrength(); } if (b(i)) { return signalStrength.getCdmaDbm() - signalStrength2.getCdmaDbm(); } return 0; } catch (Throwable th) { } } private static boolean a(int i) { return i != a.c.ordinal(); } private static boolean b(int i) { return i == a.c.ordinal(); } public static void a(@NonNull TelephonyManager telephonyManager, @NonNull int[] iArr) { String networkOperator = telephonyManager.getNetworkOperator(); if (networkOperator != null && networkOperator.length() >= 5) { try { iArr[0] = Integer.parseInt(networkOperator.substring(0, 3)); iArr[1] = Integer.parseInt(networkOperator.substring(3, 5)); return; } catch (Throwable th) { th.toString(); } } iArr[0] = 460; iArr[1] = 0; } public static List<NeighboringCellInfo> c(ct ctVar) { TelephonyManager telephonyManager = ctVar.e; if (telephonyManager != null) { try { return telephonyManager.getNeighboringCellInfo(); } catch (Exception e) { } } return Collections.emptyList(); } }
package com.sula.controller; import java.util.Date; import com.fengpei.ioc.Controller; import com.jfinal.plugin.activerecord.Page; import com.jfinal.plugin.activerecord.Record; import com.sula.service.OrderService; import com.sula.util.ResultJson; import com.sula.util.Status; public class OrderController extends Controller { OrderService osi ; public void getOrderList(){ ResultJson rj = new ResultJson(); int page = getParaToInt("page") == null ? 1 : getParaToInt("page"); Page<Record> data = osi.getOrderList(page); if (data != null) { rj.setCode(Status.success); rj.setMessage(Status.message_success); rj.setResult(data); } else { rj.setCode(Status.fail); rj.setMessage(Status.message_null); } renderJson(rj); } public void getOrderInfoById(){ int id = getParaToInt("id"); ResultJson rj = new ResultJson(); Record obj = osi.getOrderInfoById(id); if (obj != null) { rj.setCode(Status.success); rj.setMessage(Status.message_success); rj.setResult(obj); } else { rj.setCode(Status.fail); rj.setMessage(Status.message_fail); } renderJson(rj); } public void sendOrder(){ int id = getParaToInt("id"); String exp = getPara("exp"); String expno = getPara("expno"); Record obj = new Record(); obj.set("id", id); obj.set("type", 3); obj.set("exp", exp); obj.set("expno", expno); obj.set("exp_time", new Date()); ResultJson rj = new ResultJson(); boolean flag = osi.sendOrder(obj); if (flag) { rj.setCode(Status.success); rj.setMessage(Status.message_success); } else { rj.setCode(Status.fail); rj.setMessage(Status.message_fail); } renderJson(rj); } public void getRefundList(){ ResultJson rj = new ResultJson(); int page = getParaToInt("page") == null ? 1 : getParaToInt("page"); Page<Record> data = osi.getRefundList(page); if (data != null) { rj.setCode(Status.success); rj.setMessage(Status.message_success); rj.setResult(data); } else { rj.setCode(Status.fail); rj.setMessage(Status.message_null); } renderJson(rj); } public void getOrderInfoBySn(){ String sn = getPara("sn"); ResultJson rj = new ResultJson(); Record obj = osi.getOrderInfoBySn(sn); if (obj != null) { rj.setCode(Status.success); rj.setMessage(Status.message_success); rj.setResult(obj); } else { rj.setCode(Status.fail); rj.setMessage(Status.message_fail); } renderJson(rj); } public void agreeRefund(){ String sn = getPara("sn"); String hf = getPara("hf"); ResultJson rj = new ResultJson(); boolean flag = osi.agreeRefund(sn, hf); if (flag) { rj.setCode(Status.success); rj.setMessage(Status.message_success); //rj.setResult(obj); } else { rj.setCode(Status.fail); rj.setMessage(Status.message_fail); } renderJson(rj); } public void refuseRefund(){ String sn = getPara("sn"); String hf = getPara("hf"); ResultJson rj = new ResultJson(); boolean flag = osi.refuseRefund(sn, hf); if (flag) { rj.setCode(Status.success); rj.setMessage(Status.message_success); //rj.setResult(obj); } else { rj.setCode(Status.fail); rj.setMessage(Status.message_fail); } renderJson(rj); } }
package org.basic.comp.abst; public interface WidgetEditObj { void editObj(Object o, int i); }
package org.ah.minecraft.machines; import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; public class BreakMachine extends Machine { private ItemStack pickaxe; public BreakMachine(Block b) { setBlock(b); build(); setType(MachineType.BREAK); setControlPanel(new MachineControlPanel(this)); getControlPanel().setPercentSpeed(60); pickaxe = new ItemStack(Material.IRON_PICKAXE); pickaxe.addEnchantment(Enchantment.SILK_TOUCH, 1); } @Override public boolean run() { getBlock().getWorld().playEffect(getBlock().getLocation(), Effect.MOBSPAWNER_FLAMES, 1); boolean done = false; Block relative = getBlock().getRelative(getDirection()); if (relative.getType() == Material.AIR) { done = false; } else { done = true; for (ItemStack itemStack : relative.getDrops(pickaxe)) { putItemInBack(itemStack); } } relative.getWorld().playEffect(relative.getLocation(), Effect.STEP_SOUND, relative.getType(), 10); relative.setType(Material.AIR); return done; } @Override public void build() { if (getBlock().getType() != Material.COMMAND) getBlock().setType(Material.COMMAND); } }
package ttyy.com.coder.scanner; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.RectF; import android.text.Layout; import android.text.StaticLayout; import android.text.TextPaint; import android.text.TextUtils; import android.util.AttributeSet; import android.view.View; import ttyy.com.coder.R; /** * author: admin * date: 2017/03/14 * version: 0 * mail: secret * desc: ScannerRectView */ public class ScannerRectView extends View { Rect mScanRectBoxFrame; Paint mRectPaint; /** * 边框 */ int mScanRectBorderWidth; int mScanRectBorderColor = Color.WHITE; int mScanRectBoxWidth, mScanRectBoxHeight; /** * 四个角 */ int mScanRectCornorBorderWidth; int mScanRectCornorWidth; int mScanRectCornorBorderColor = Color.WHITE; /** * 遮罩颜色 */ int mMaskColor = Color.parseColor("#33FFFFFF"); /** * 文字 */ StaticLayout mTipsTextLayout; String mTipsText; TextPaint mTextPaint; int mTipsTextColor = Color.parseColor("#cccccc"); int mTipsBackColor = Color.parseColor("#b0000000"); boolean mEnableTips = true; /** * 扫描线 */ int mScanLineBorderWidth; int mScanLineColor = Color.WHITE; int mScanLineTopOffset; int mScanLineStepDistance; long mRefreshDelayMillions; boolean mEnableScanLine = true; public ScannerRectView(Context context) { this(context, null); } public ScannerRectView(Context context, AttributeSet attrs) { super(context, attrs); getAttributes(attrs); } void getAttributes(AttributeSet attrs){ if(attrs != null){ TypedArray ta = getContext().obtainStyledAttributes(attrs, R.styleable.ScannerRectView); mScanRectBorderWidth = ta.getDimensionPixelOffset(R.styleable.ScannerRectView_boxBorderWidth, 0); mScanRectCornorWidth = ta.getDimensionPixelOffset(R.styleable.ScannerRectView_boxCornorWidth, 0); mScanRectCornorBorderWidth = ta.getDimensionPixelOffset(R.styleable.ScannerRectView_boxCornorBorderWidth, 0); mScanRectBoxWidth = ta.getDimensionPixelOffset(R.styleable.ScannerRectView_boxWidth, 0); mScanRectBoxHeight = ta.getDimensionPixelOffset(R.styleable.ScannerRectView_boxHeight, 0); mScanRectBorderColor = ta.getColor(R.styleable.ScannerRectView_boxBorderColor, Color.WHITE); mScanRectCornorBorderColor = ta.getColor(R.styleable.ScannerRectView_boxCornorColor, Color.WHITE); mMaskColor = ta.getColor(R.styleable.ScannerRectView_maskColor, Color.parseColor("#33FFFFFF")); mScanLineColor = ta.getColor(R.styleable.ScannerRectView_scanLineColor, Color.WHITE); mTipsTextColor = ta.getColor(R.styleable.ScannerRectView_tipsTextColor, Color.parseColor("#cccccc")); mTipsBackColor = ta.getColor(R.styleable.ScannerRectView_tipsBackColor, Color.parseColor("#b0000000")); mTipsText = ta.getString(R.styleable.ScannerRectView_tipsText); if (TextUtils.isEmpty(mTipsText)) { mTipsText = "请将二维码置于扫描框内"; } ta.recycle(); } mTextPaint = new TextPaint(); mTextPaint.setTextSize(dp2px(14)); mTextPaint.setColor(mTipsTextColor); mTextPaint.setAntiAlias(true); mTextPaint.setFilterBitmap(true); mRectPaint = new Paint(); mRectPaint.setAntiAlias(true); mRectPaint.setFilterBitmap(true); } @Override protected void onDraw(Canvas canvas) { if(mScanRectBoxFrame == null){ super.onDraw(canvas); return; } canvas.drawColor(Color.TRANSPARENT); drawMask(canvas); drawScanRect(canvas); if(mEnableTips && !TextUtils.isEmpty(mTipsText)){ drawTipsText(canvas); } if(mEnableScanLine){ drawScanLine(canvas); } } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); setScanRectBoxFrameAttribute(); } // 设置扫描框信息 void setScanRectBoxFrameAttribute(){ int width = getMeasuredWidth(); int height = getMeasuredHeight(); // 扫描框 mScanRectBoxFrame = new Rect(); if(mScanRectBoxWidth == 0){ // 启用默认设置 mScanRectBoxFrame.left = width / 4; mScanRectBoxFrame.right = 3 * width / 4; mScanRectBoxFrame.top = height / 2 - dp2px(54) - width / 4; mScanRectBoxFrame.bottom = height / 2 - dp2px(54) + width / 4; }else { // 启用用户自定义设置 mScanRectBoxFrame.left = width / 2 - mScanRectBoxWidth / 2; mScanRectBoxFrame.right = mScanRectBoxFrame.left + mScanRectBoxWidth; if(mScanRectBoxHeight <= 0){ mScanRectBoxHeight = mScanRectBoxWidth; } mScanRectBoxFrame.top = height / 2 - mScanRectBoxHeight / 2; mScanRectBoxFrame.bottom = mScanRectBoxFrame.top + mScanRectBoxHeight; } // 扫描框粗细 if(mScanRectBorderWidth <= 0){ mScanRectBorderWidth = dp2px(1); } if(mScanRectCornorBorderWidth <= 0){ mScanRectCornorBorderWidth = dp2px(5); } if(mScanRectCornorWidth <= 0){ mScanRectCornorWidth = mScanRectBoxFrame.width() / 7; } // 扫描线颜色 if(mScanLineBorderWidth <= 0){ mScanLineBorderWidth = dp2px(1); } mScanLineTopOffset = mScanRectBoxFrame.top; mScanLineStepDistance = dp2px(1.3f); mRefreshDelayMillions = mScanLineStepDistance * 2200 / mScanRectBoxFrame.height(); // 文字宽度 int mTextLayoutWidth = (int) mTextPaint.measureText(mTipsText); mTipsTextLayout = new StaticLayout(mTipsText, mTextPaint, mTextLayoutWidth, Layout.Alignment.ALIGN_CENTER, 1f, 0, true); } int dp2px(float value){ return (int) (getResources().getDisplayMetrics().density * value + 0.5f); } // 绘制遮罩 void drawMask(Canvas canvas){ mRectPaint.setColor(mMaskColor); mRectPaint.setStyle(Paint.Style.FILL); canvas.drawRect(0, 0, mScanRectBoxFrame.left, getHeight(), mRectPaint); canvas.drawRect(mScanRectBoxFrame.left, 0, getWidth(), mScanRectBoxFrame.top, mRectPaint); canvas.drawRect(mScanRectBoxFrame.left, mScanRectBoxFrame.bottom, getWidth(), getHeight(), mRectPaint); canvas.drawRect(mScanRectBoxFrame.right, mScanRectBoxFrame.top, getWidth(), mScanRectBoxFrame.bottom, mRectPaint); } // 绘制扫描框 void drawScanRect(Canvas canvas){ mRectPaint.setStyle(Paint.Style.STROKE); // 绘制扫描框 // 边框四条线 int rectOffsetLeft = mScanRectBoxFrame.left + mScanRectCornorWidth - mScanRectCornorBorderWidth / 2; int rectOffsetRight = mScanRectBoxFrame.right - mScanRectCornorWidth + mScanRectCornorBorderWidth / 2; int rectOffsetTop = mScanRectBoxFrame.top + mScanRectCornorWidth - mScanRectCornorBorderWidth / 2; int rectOffsetBottom = mScanRectBoxFrame.bottom - mScanRectCornorWidth + mScanRectCornorBorderWidth / 2; mRectPaint.setStrokeWidth(mScanRectBorderWidth); mRectPaint.setColor(mScanRectBorderColor); canvas.drawLine(rectOffsetLeft, mScanRectBoxFrame.top, rectOffsetRight, mScanRectBoxFrame.top, mRectPaint); canvas.drawLine(mScanRectBoxFrame.left, rectOffsetTop, mScanRectBoxFrame.left, rectOffsetBottom, mRectPaint); canvas.drawLine(mScanRectBoxFrame.right, rectOffsetTop, mScanRectBoxFrame.right, rectOffsetBottom, mRectPaint); canvas.drawLine(rectOffsetLeft, mScanRectBoxFrame.bottom, rectOffsetRight, mScanRectBoxFrame.bottom, mRectPaint); // 边框四个角 int cornorOffsetLeft = mScanRectBoxFrame.left - mScanRectCornorBorderWidth / 2; int cornorOffsetRight = mScanRectBoxFrame.right + mScanRectCornorBorderWidth / 2; int cornorOffsetTop = mScanRectBoxFrame.top - mScanRectCornorBorderWidth / 2; int cornorOffsetBottom = mScanRectBoxFrame.bottom + mScanRectCornorBorderWidth / 2; mRectPaint.setStrokeWidth(mScanRectCornorBorderWidth); mRectPaint.setColor(mScanRectCornorBorderColor); // 左上角 canvas.drawLine(cornorOffsetLeft, mScanRectBoxFrame.top, rectOffsetLeft, mScanRectBoxFrame.top, mRectPaint); canvas.drawLine(mScanRectBoxFrame.left, cornorOffsetTop, mScanRectBoxFrame.left, rectOffsetTop, mRectPaint); // 右上角 canvas.drawLine(rectOffsetRight, mScanRectBoxFrame.top, cornorOffsetRight, mScanRectBoxFrame.top, mRectPaint); canvas.drawLine(mScanRectBoxFrame.right, cornorOffsetTop, mScanRectBoxFrame.right, rectOffsetTop, mRectPaint); // 左下角 canvas.drawLine(cornorOffsetLeft, mScanRectBoxFrame.bottom, rectOffsetLeft, mScanRectBoxFrame.bottom, mRectPaint); canvas.drawLine( mScanRectBoxFrame.left, cornorOffsetBottom, mScanRectBoxFrame.left, rectOffsetBottom, mRectPaint); // 右下角 canvas.drawLine(rectOffsetRight, mScanRectBoxFrame.bottom, cornorOffsetRight, mScanRectBoxFrame.bottom, mRectPaint); canvas.drawLine(mScanRectBoxFrame.right, cornorOffsetBottom, mScanRectBoxFrame.right, rectOffsetBottom, mRectPaint); } void drawTipsText(Canvas canvas){ mRectPaint.setStyle(Paint.Style.FILL); mRectPaint.setColor(mTipsBackColor); RectF mTipsBackFrame = new RectF(); int radius = dp2px(5); int centerX = getWidth() / 2; int verticalPadding = dp2px(14); int horizontalPadding = dp2px(16); mTipsBackFrame.left = centerX - mTipsTextLayout.getWidth() / 2 - horizontalPadding; mTipsBackFrame.right = centerX + mTipsTextLayout.getWidth() / 2 + horizontalPadding; mTipsBackFrame.bottom = mScanRectBoxFrame.top - dp2px(22); mTipsBackFrame.top = mTipsBackFrame.bottom - mTipsTextLayout.getHeight() - verticalPadding; canvas.drawRoundRect(mTipsBackFrame, radius, radius, mRectPaint); canvas.save(); canvas.translate(mTipsBackFrame.left + horizontalPadding, mTipsBackFrame.top + verticalPadding / 2); mTipsTextLayout.draw(canvas); canvas.restore(); } // 绘制扫描线 void drawScanLine(Canvas canvas){ mRectPaint.setColor(mScanLineColor); mRectPaint.setStyle(Paint.Style.STROKE); mRectPaint.setStrokeWidth(mScanLineBorderWidth); canvas.drawLine(mScanRectBoxFrame.left, mScanLineTopOffset, mScanRectBoxFrame.right, mScanLineTopOffset, mRectPaint); mScanLineTopOffset += mScanLineStepDistance; if(mScanLineTopOffset >= mScanRectBoxFrame.bottom){ mScanLineTopOffset = mScanRectBoxFrame.top; } postInvalidateDelayed(mRefreshDelayMillions, mScanRectBoxFrame.left, mScanRectBoxFrame.top, mScanRectBoxFrame.right, mScanRectBoxFrame.bottom); } public ScannerRectView setBoxWidth(int width){ mScanRectBoxWidth = width; return this; } public ScannerRectView setBoxHeight(int height){ mScanRectBoxHeight = height; return this; } public ScannerRectView setRectBorderWidth(int strokeWidth){ mScanRectBorderWidth = strokeWidth; return this; } public ScannerRectView setRectCornorWidth(int cornorWidth){ mScanRectCornorWidth = cornorWidth; return this; } public ScannerRectView setRectCornorBorderWidth(int cornorBorderWidth){ mScanRectCornorBorderWidth = cornorBorderWidth; return this; } public ScannerRectView setRectCornorColor(int color){ mScanRectCornorBorderColor = color; return this; } public ScannerRectView setRectBorderColor(int color){ mScanRectBorderColor = color; return this; } public ScannerRectView setMaskColor(int color){ mMaskColor = color; return this; } public ScannerRectView setTipsText(String text){ mTipsText = text; return this; } public ScannerRectView setTipsTextColor(int color){ mTipsTextColor = color; return this; } public ScannerRectView setTipsBoxBackColor(int color){ mTipsBackColor = color; return this; } public void calculateBoxInfos(){ if(getMeasuredWidth() > 0){ setScanRectBoxFrameAttribute(); } } }
package com.funck.awss3.adapters.jpa; import com.funck.awss3.domain.entities.Product; import lombok.RequiredArgsConstructor; import org.modelmapper.ModelMapper; import org.springframework.stereotype.Component; import java.util.List; import java.util.stream.Collectors; @RequiredArgsConstructor @Component public class ProductMapper { private final ModelMapper mapper; public Product toDomain(ProductEntity productEntity) { return mapper.map(productEntity, Product.class); } public List<Product> toDomainList(List<ProductEntity> productEntities) { return productEntities.stream().map(this::toDomain).collect(Collectors.toList()); } public ProductEntity toJpaModel(Product product) { return mapper.map(product, ProductEntity.class); } public List<ProductEntity> toJpaModelList(List<Product> products) { return products.stream().map(this::toJpaModel).collect(Collectors.toList()); } }
package jackson; import java.util.Map; import org.junit.Assert; import org.junit.Test; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; public class AutoValueTest { public ObjectMapper getObjectMapper() throws Exception { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.disable(MapperFeature.AUTO_DETECT_CREATORS); objectMapper.disable(MapperFeature.AUTO_DETECT_FIELDS); objectMapper.disable(MapperFeature.AUTO_DETECT_SETTERS); objectMapper.disable(MapperFeature.AUTO_DETECT_GETTERS); objectMapper.disable(MapperFeature.AUTO_DETECT_IS_GETTERS); objectMapper.disable(MapperFeature.USE_GETTERS_AS_SETTERS); objectMapper.disable(MapperFeature.INFER_PROPERTY_MUTATORS); objectMapper.disable(MapperFeature.ALLOW_FINAL_FIELDS_AS_MUTATORS); return objectMapper; } @Test public void testAutoValue() throws Exception { ObjectMapper objectMapper = getObjectMapper(); AutoValueBean bean = AutoValueBean.create("a-string", 1, true); String beanResult = objectMapper.writeValueAsString(bean); Map<String, Object> result = objectMapper.readValue(beanResult, new TypeReference<Map<String, Object>>() {}); Assert.assertEquals(3, result.size()); Assert.assertTrue(result.containsKey("string")); Assert.assertTrue(result.containsKey("int")); Assert.assertTrue(result.containsKey("bool")); Assert.assertEquals("a-string", result.get("string")); Assert.assertEquals(1, ((Number) result.get("int")).intValue()); Assert.assertEquals(true, ((Boolean) result.get("bool")).booleanValue()); } @Test public void testAutoValueDisableAccessModifiers() throws Exception { ObjectMapper objectMapper = getObjectMapper(); objectMapper.disable(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS); AutoValueBean bean = AutoValueBean.create("a-string", 1, true); String beanResult = objectMapper.writeValueAsString(bean); Map<String, Object> result = objectMapper.readValue(beanResult, new TypeReference<Map<String, Object>>() {}); Assert.assertEquals(3, result.size()); Assert.assertTrue(result.containsKey("string")); Assert.assertTrue(result.containsKey("int")); Assert.assertTrue(result.containsKey("bool")); Assert.assertEquals("a-string", result.get("string")); Assert.assertEquals(1, ((Number) result.get("int")).intValue()); Assert.assertEquals(true, ((Boolean) result.get("bool")).booleanValue()); } }
package com.codingdojo.overflow.repository; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import com.codingdojo.overflow.models.TagQuestion; @Repository public interface TagQuestionRepository extends CrudRepository<TagQuestion, Long> { }
package com.dreamworks.example; import com.dreamworks.example.config.Neo4jEmbeddedConfig; import com.dreamworks.example.model.Task; import com.dreamworks.example.model.TaskVersion; import com.dreamworks.example.model.request.TaskPayload; import com.dreamworks.example.model.request.TaskVersionPayload; import com.dreamworks.example.service.TaskService; import com.dreamworks.example.service.TaskVersionService; import lombok.extern.slf4j.Slf4j; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.neo4j.ogm.session.Session; import org.neo4j.ogm.session.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; @Slf4j @ActiveProfiles("test") @ContextConfiguration(classes = { Neo4jEmbeddedConfig.class }) @RunWith(SpringRunner.class) @SpringBootTest public class TaskServiceTests { @Autowired private TaskService taskService; @Autowired private TaskVersionService taskVersionService; @Autowired private SessionFactory sessionFactory; @Before public void setUp() throws Exception {} @After public void tearDown() throws Exception { // = Clear the graph with every test final Session session = sessionFactory.openSession(); session.purgeDatabase(); } @Test public void testIssue1() throws Exception { // = We create a task. Task task = taskService.create(new TaskPayload("task")); // = We create a task version and we establish the relation with the task. TaskVersion version1 = taskService.create(task.getId(), null, new TaskVersionPayload()); // = We create a new task linked to the previous task version (version1) and also linked to the task. TaskVersion version2 = taskService.create(task.getId(), version1.getId(), new TaskVersionPayload()); // ====== Asserts on created objects. ======= // // = Ensure parent is wired up correctly. Assert.assertEquals(version1, version2.getParent()); // = Ensure the version 1 has only 1 children. Assert.assertEquals(1, version2.getParent().getChilds().size()); // = Ensure the version 2 doesnt have any children. Assert.assertEquals(0, version2.getChilds().size()); // These asserts are Ok cause we are inspecting the objects we have in memory. // Lets see what was saved in the Store... // ======= Retrieve what is in the store and Asserts again with the same checks. ======= // // = Get the task by ID (This is our generated ID and not the @GraphId). Task storedTask = taskService.get(task.getId()); // = Ensure the the task has 2 versions Assert.assertTrue(storedTask.hasVersions()); Assert.assertEquals(2, storedTask.getVersions().size()); // = Lets get what is in the store. TaskVersion storedTaskVersion2 = taskVersionService.get(version2.getId()); // = Check that parent of version2 has a child. Assert.assertEquals(1, storedTaskVersion2.getParent().getChilds().size()); // FIXME: 6/27/17 // This last assert makes the test fail and we cannot find the root cause of the issue. If we inspect the query that is executed // in line 86 we see: // MATCH (n:`VERSION`) WHERE n.`id` = "d031ffb5-a24c-4007-b029-da14604d62ca@taskVersion" WITH n MATCH p=(n)-[*0..2]-(m) RETURN p, ID(n) // If we c&p that statement in the browser we can see the results are correct and the nodes contains the relations we expect. // = Ensure there are no children versions in version2 Assert.assertEquals(0, storedTaskVersion2.getChilds().size()); } @Test public void testIssue2() throws Exception { // = We create a task. Task task = taskService.create(new TaskPayload("task")); // = We create a task version and we establish the relation with the task. TaskVersion version1 = taskService.create(task.getId(), null, new TaskVersionPayload()); // = We create a new task linked to the previous task version (version1) and also linked to the task. TaskVersion version2 = taskService.create(task.getId(), version1.getId(), new TaskVersionPayload()); // = We create a new task linked to the previous task version (version2) and also linked to the task. TaskVersion version3 = taskService.create(task.getId(), version2.getId(), new TaskVersionPayload()); // ====== Asserts on created objects. ======= // // = Ensure parent is wired up correctly. Assert.assertEquals(version2, version3.getParent()); // = Ensure the version 2 and 3 has only 1 children. // FIXME: 6/27/17 // version1 has 2 children instead of 1 (commenting out this assert) // Assert.assertEquals(1, version2.getParent().getChilds().size()); // FIXME: 6/27/17 // version2 has 2 children instead of 1 (commenting out this assert) // Assert.assertEquals(1, version3.getParent().getChilds().size()); // = Ensure the version 3 doesn't have any children. Assert.assertEquals(0, version3.getChilds().size()); // These asserts are Ok cause we are inspecting the objects we have in memory. // Lets see what was saved in the Store... // ======= Retrieve what is in the store and Asserts again with the same checks. ======= // // = Get the task by ID (This is our generated ID and not the @GraphId). Task storedTask = taskService.get(task.getId()); // = Ensure the the task has 3 versions Assert.assertTrue(storedTask.hasVersions()); Assert.assertEquals(3, storedTask.getVersions().size()); // = Lets get what is in the store. TaskVersion storedTaskVersion3 = taskVersionService.get(version3.getId()); // = Check that parent of version3 has a child. Assert.assertEquals(1, storedTaskVersion3.getParent().getChilds().size()); // FIXME: 6/27/17 // = Ensure there are no children versions in version2 // Assert.assertEquals(0, storedTaskVersion3.getChilds().size()); } @Test public void testIssue3() throws Exception { // = We create a task. Task task = taskService.create(new TaskPayload("task")); // = We create a task version and we establish the relation with the task. TaskVersion version1 = taskService.create(task.getId(), null, new TaskVersionPayload()); // = We create a new task linked to the previous task version (version1) and also linked to the task. TaskVersion version2 = taskService.create(task.getId(), version1.getId(), new TaskVersionPayload()); // = We create a new task linked to the previous task version (version2) and also linked to the task. TaskVersion version3 = taskService.create(task.getId(), version2.getId(), new TaskVersionPayload()); // = We create a new task linked to the previous task version (version3) and also linked to the task. TaskVersion version4 = taskService.create(task.getId(), version3.getId(), new TaskVersionPayload()); // ====== Asserts on created objects. ======= // // = Ensure parent is wired up correctly. Assert.assertEquals(version3, version4.getParent()); // = Ensure the version 2 and 3 has only 1 children. // FIXME: 6/27/17 // version2 now has 2 children instead of 1 (commenting out this assert) // Assert.assertEquals(1, version3.getParent().getChilds().size()); // FIXME: 6/27/17 // version3 now has 2 children instead of 1 (commenting out this assert) // Assert.assertEquals(1, version4.getParent().getChilds().size()); // = Ensure the version 4 doesn't have any children. Assert.assertEquals(0, version4.getChilds().size()); // These asserts are Ok cause we are inspecting the objects we have in memory. // Lets see what was saved in the Store... // ======= Retrieve what is in the store and Asserts again with the same checks. ======= // // = Get the task by ID (This is our generated ID and not the @GraphId). Task storedTask = taskService.get(task.getId()); // = Ensure the the task has 3 versions Assert.assertTrue(storedTask.hasVersions()); Assert.assertEquals(4, storedTask.getVersions().size()); // = Lets get what is in the store. TaskVersion storedTaskVersion4 = taskVersionService.get(version4.getId()); // = Check that parent of version4 has a child. // FIXME: 6/27/17 // version3 now has 2 children instead of 1 (commenting out this assert) // Assert.assertEquals(1, storedTaskVersion4.getParent().getChilds().size()); // = Ensure there are no children versions in version4 // FIXME: 6/27/17 // version4 shouldn't have any children. Assert.assertEquals(0, storedTaskVersion4.getChilds().size()); } }
package tech.iooo.coco.configuration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; import tech.iooo.coco.condition.CustomRequestMappingHandlerMapping; /** * Created by Ivan97 on 2017/7/28 下午4:51 */ @Configuration public class WebConfiguration extends WebMvcConfigurationSupport { @Override @Bean public RequestMappingHandlerMapping requestMappingHandlerMapping() { RequestMappingHandlerMapping handlerMapping = new CustomRequestMappingHandlerMapping(); handlerMapping.setOrder(0); handlerMapping.setInterceptors(getInterceptors()); return handlerMapping; } }
package com.instamojo.api.dao; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.hibernate.Criteria; import org.hibernate.SessionFactory; import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.Util.Util; import com.instamojo.wrapper.request.OrderListRequest; import com.ysyt.bean.AttributesMaster; import com.ysyt.bean.PercentageSplitUpMaster; import com.ysyt.bean.Transactions; import com.ysyt.bean.UserAccomodationMapping; import com.ysyt.bean.UserBillsPercentage; import com.ysyt.constants.YSYTConstants; @Repository public class TransactionDaoImpl implements ITransactionDao { @Autowired private HttpServletRequest httpRequest; @Override public Transactions createOrder(Transactions transaction, SessionFactory sessionFactory) { sessionFactory.getCurrentSession().saveOrUpdate(transaction); sessionFactory.getCurrentSession().flush(); sessionFactory.getCurrentSession().clear(); return transaction; } @Override public Transactions getOrderDetails(String orderId, SessionFactory sessionFactory) { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Transactions.class) .add(Restrictions.eq("isDeleted",false)); if(!Util.isNull(orderId)){ criteria.add(Restrictions.eq("orderId", orderId)); } return (Transactions) criteria.uniqueResult(); } @Override public UserAccomodationMapping createUpdateUserAccomodationMapping( UserAccomodationMapping userAccomodationMapping, SessionFactory sessionFactory) { sessionFactory.getCurrentSession().saveOrUpdate(userAccomodationMapping); sessionFactory.getCurrentSession().flush(); sessionFactory.getCurrentSession().clear(); return userAccomodationMapping; } @SuppressWarnings("unchecked") @Override public List<PercentageSplitUpMaster> getPercentages( SessionFactory sessionFactory) { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(PercentageSplitUpMaster.class) .add(Restrictions.eq("isDeleted",false)); return (List<PercentageSplitUpMaster>) criteria.list(); } @Override public void createUpdateSplitUp(UserBillsPercentage splits, SessionFactory sessionFactory) { sessionFactory.getCurrentSession().saveOrUpdate(splits); sessionFactory.getCurrentSession().flush(); sessionFactory.getCurrentSession().clear(); } @Override public List<Transactions> orderList(OrderListRequest request,SessionFactory sessionFactory) { List<Transactions> transactions = new ArrayList<Transactions>(); Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Transactions.class) .add(Restrictions.eq("isDeleted",false)) .add(Restrictions.eq("depositType", YSYTConstants.SECURITY_DEPOSIT)) .add(Restrictions.eq("userId", Util.getCurrentUser(httpRequest).getId())) .setFirstResult(!Util.isNull(request.getOffset())?request.getOffset():0) .setMaxResults(!Util.isNull(request.getLimit())?request.getLimit():0) .addOrder(Order.desc("createdAt")); transactions= criteria.list(); for(Transactions trans : transactions){ userAccomodationMapping(trans,sessionFactory); } return transactions; } @Override public Transactions orderDetails(String orderId,SessionFactory sessionFactory) { Transactions transactions = new Transactions(); Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Transactions.class) .add(Restrictions.eq("isDeleted",false)) .add(Restrictions.eq("depositType", YSYTConstants.SECURITY_DEPOSIT)) .add(Restrictions.eq("orderId",orderId)); transactions= (Transactions) criteria.uniqueResult(); userAccomodationMapping(transactions, sessionFactory); return transactions; } public void userAccomodationMapping(Transactions trans,SessionFactory sessionFactory){ UserAccomodationMapping userAccomodationMapping = new UserAccomodationMapping(); Criteria userMapping = sessionFactory.getCurrentSession().createCriteria(UserAccomodationMapping.class) .add(Restrictions.eq("orderId", trans.getOrderId())); userAccomodationMapping = (UserAccomodationMapping) userMapping.uniqueResult(); if(!Util.isNull(userAccomodationMapping)){ if(!Util.isNull(userAccomodationMapping.getJoinDate())){ trans.setJoinDate(userAccomodationMapping.getJoinDate()); } if(!Util.isNull(userAccomodationMapping.getVacateDate())){ trans.setVacateDate(userAccomodationMapping.getVacateDate()); } } } }
package vista; import javax.swing.*; import java.awt.*; public class RegistrarCliente extends JPanel{ JPanel panel = new JPanel(); public RegistrarCliente() { setBounds(500, 200, 1080, 800); setBackground(new Color(32, 112, 193)); iniciarComponentes(); setLayout(null); } private void iniciarComponentes(){ colocarEtiquetas(); colocarCajasDeTexto(); colocarBotones(); } private void colocarEtiquetas() { JLabel etiqueta = new JLabel("AGENCIA DE VIAJES", SwingConstants.LEFT);//crea la etiqueta add(etiqueta); etiqueta.setBounds(10, 0, 500, 50); etiqueta.setForeground(Color.white); etiqueta.setFont(new Font("arial", Font.BOLD, 30)); //nombre JLabel etiqueta2 = new JLabel("Nombre Completo"); etiqueta2.setBounds(100,100,200,100); etiqueta2.setBackground(new Color(104,205,253)); add(etiqueta2); //nro pasajeros JLabel etiqueta3 = new JLabel("Nro. de Pasajeros"); etiqueta3.setBounds(100,200,200,100); etiqueta3.setBackground(new Color(104,205,253)); add(etiqueta3); //temp de Pref. JLabel etiqueta4 = new JLabel("Temporada de Preferencia"); etiqueta4.setBounds(100,300,200,100); etiqueta4.setBackground(new Color(104,205,253)); add(etiqueta4); //nro de ID JLabel etiqueta5 = new JLabel("Nro. de Identificacion"); etiqueta5.setBounds(100,400,200,100); etiqueta5.setBackground(new Color(104,205,253)); add(etiqueta5); } private void colocarCajasDeTexto() { //caja para el nombre JTextField cajaTexto = new JTextField(); cajaTexto.setBounds(100, 160, 200, 30); add(cajaTexto); //caja para nro de pasajeros JTextField cajaTexto2 = new JTextField(); cajaTexto2.setBounds(100, 260, 200, 30); add(cajaTexto2); //caja para temporada de preferencia JTextField cajaTexto3 = new JTextField(); cajaTexto3.setBounds(100, 360, 200, 30); add(cajaTexto3); //caja para nro de identificacion JTextField cajaTexto4 = new JTextField(); cajaTexto4.setBounds(100, 460, 200, 30); add(cajaTexto4); } private void colocarBotones() { //boton 1 - boton de texto JButton boton1 = new JButton("Registrar"); boton1.setBounds(300, 600, 100, 50); boton1.setEnabled(true); add(boton1); boton1.setBackground(new Color(104,205,253)); boton1.setForeground(Color.black); boton1.setFont(new Font("cooper black", 2, 15)); } }
package headFirst.adapter.object; /** * */ public class MallarDuck implements Duck { @Override public void quack() { System.out.println("꽥, 꽥!!"); } @Override public void fly() { System.out.println("나는 6마일 날았어~"); } }
package ru.lember.neointegrationadapter.java; public interface UnaryTriFunction<T, R> extends TriFunction<T, T, T, R> { }
package br.com.walmart.krusty.exception; import javax.ejb.ApplicationException; @ApplicationException public class NoResultException extends KrustyBusinessException { private static final long serialVersionUID = -7742163129912624978L; public NoResultException() { super(); } public NoResultException(final String message) { super(message); } public NoResultException(final Throwable t) { super(t); } public NoResultException(final String message, final Throwable t) { super(message, t); } }
package pl.michalgorski.medinfo.models.repositories; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import pl.michalgorski.medinfo.models.DoctorEntity; import java.security.cert.PKIXRevocationChecker; import java.util.Arrays; import java.util.List; import java.util.Optional; @Repository public interface DoctorRepository extends CrudRepository<DoctorEntity, Integer> { List<DoctorEntity> findByCity(String city); List<DoctorEntity> findBySpecialization(String specialization); List<DoctorEntity> findByName(String name); List<DoctorEntity> findBySurname(String surname); List<DoctorEntity> findAll(); }
package com.application.service; import com.application.model.tax.ITax; import com.application.model.tax.Percent; import com.application.util.Calculator; /** * This class calculates the tax amount on provided base amount with given tax */ public class TaxCalculationService { /** * Calculates tax applied on given base value * * @param tax applied tax * @param base amount to be taxed * @return tax amount */ public double calculateTaxAmount(final ITax tax, final double base) { return Calculator.divide(Calculator.multiply(tax.getPercentage().getValue(), base), Percent.HUNDRED_PERCENT.getValue()); } }
/* Document : SME_Lending Created on : August 21, 2015, 11:56:42 AM Author : Anuj Verma */ package com.spring.service; import java.util.List; import com.spring.domain.ChequeInventory; public interface CustomerCareService { List<ChequeInventory> getChequeReport(int buyerId); }
package com.example.illuminate_me; import android.graphics.Bitmap; import android.net.Uri; public class UserImage { private ImageDescription description ; private Bitmap imageBit; private Uri imageUri; //(1) public ImageDescription getDescription (){ return description; } //(2) public void setDescription(ImageDescription description){ this.description=description; } public Bitmap getImageBit() { return imageBit; } public Uri getImageUri() { return imageUri; } public void setImageBit(Bitmap imageBit) { this.imageBit = imageBit; } public void setImageUri(Uri imageUri) { this.imageUri = imageUri; } }
package backjoon.dynamic; import java.io.*; public class Backjoon9461 { private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); private static final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); private static long[] arr; public static void main(String[] args) throws IOException { int testCnt = Integer.parseInt(br.readLine()); for(int i = 0 ; i < testCnt; i++){ int n = Integer.parseInt(br.readLine()); if(n >= 2) arr = new long[n + 1]; else arr = new long[3]; arr[1] = 1; arr[2] = 1; solve(n); } bw.close(); br.close(); } private static void solve(int n) throws IOException { for(int i = 3; i <= n; i++){ arr[i] = arr[i - 2] + arr[i - 3]; } bw.write(arr[n] + "\n"); } }
package xdpm.nhom11.angrybirdsproject.xmlbird; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.andengine.entity.IEntity; import org.andengine.util.SAXUtils; import org.andengine.util.level.EntityLoader; import org.andengine.util.level.simple.SimpleLevelEntityLoaderData; import org.andengine.util.level.simple.SimpleLevelLoader; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import android.content.ContextWrapper; import android.content.res.AssetManager; import android.util.Log; public class DAOBird { public static final String TAG_LISTWORLD = "LISTWORLD"; public static final String TAG_LISTBIRD = "LISTBIRD"; public static final String TAG_LISTPIG = "LISTPIG"; public static final String TAG_LISTBlOCK = "LISTBLOCK"; public static final String TAG_WORLD = "WORLD"; public static final String TAG_CHAPTER = "CHAPTER"; public static final String TAG_LEVEL = "LEVEL"; public static final String TAG_BACKGROUND = "BACKGROUND"; public static final String TAG_SLINGSHOT = "SLINGSHOT"; public static final String TAG_BIRD = "BIRD"; public static final String TAG_PIG = "PIG"; public static final String TAG_BLOCK = "BLOCK"; public static final String KEY_ID = "id"; public static final String KEY_LOCKED = "locked"; public static final String KEY_HIGHSCORE = "highscore"; public static final String KEY_NUMSTAR = "numstar"; public static final String KEY_WIDTH = "width"; public static final String KEY_HEIGHT = "height"; public static final String KEY_BGCOLOR = "bgcolor"; public static final String KEY_X = "x"; public static final String KEY_Y = "y"; public static final String KEY_ROTATION = "rotation"; public static final String KEY_TYPE = "type"; public static final String KEY_FINALSCORE = "finalscore"; public static final String KEY_LIFEVALUE = "lifevalue"; public static final String KEY_SCORE = "score"; public ArrayList<DTOBird> load(ContextWrapper contextwrapper) throws IOException, ParserConfigurationException, SAXException { ArrayList<DTOBird> ListBird = new ArrayList<DTOBird>(); AssetManager assetManager = contextwrapper.getAssets(); InputStream in = assetManager.open("gfx/dataxml/BIRD.xml"); DocumentBuilder builder = DocumentBuilderFactory.newInstance() .newDocumentBuilder(); Document doc = builder.parse(in, null); NodeList birds = doc.getElementsByTagName("BIRD"); for (int i = 0; i < birds.getLength(); i++) { DTOBird bird = new DTOBird(); bird.id = birds.item(i).getAttributes().getNamedItem(KEY_ID) .getNodeValue().toString(); bird.finalscore = Integer.parseInt(birds.item(i).getAttributes() .getNamedItem(KEY_FINALSCORE).getNodeValue().toString()); ListBird.add(bird); } return ListBird; } public static ArrayList<DTOBird> load(SimpleLevelLoader loader) { final ArrayList<DTOBird> ListBird = new ArrayList<DTOBird>(); loader.registerEntityLoader(new EntityLoader<SimpleLevelEntityLoaderData>( TAG_BIRD) { @Override public IEntity onLoadEntity(String pEntityName, IEntity pParent, Attributes pAttributes, SimpleLevelEntityLoaderData pEntityLoaderData) throws IOException { // TODO Auto-generated method stub DTOBird dtobird = new DTOBird(); dtobird.id = SAXUtils.getAttributeOrThrow(pAttributes, KEY_ID); dtobird.x = SAXUtils.getFloatAttribute(pAttributes, KEY_X, 0); dtobird.y = SAXUtils.getFloatAttribute(pAttributes, KEY_Y, 0); dtobird.finalscore = SAXUtils.getIntAttribute(pAttributes, KEY_FINALSCORE, 0); ListBird.add(dtobird); return null; } }); return ListBird; } }
package loadbalance; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.concurrent.Semaphore; import com.amazonaws.AmazonClientException; import com.amazonaws.AmazonServiceException; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.profile.ProfileCredentialsProvider; import com.amazonaws.services.ec2.AmazonEC2; import com.amazonaws.services.ec2.AmazonEC2ClientBuilder; import com.amazonaws.services.ec2.model.DescribeAvailabilityZonesResult; import com.amazonaws.services.ec2.model.DescribeInstanceStatusRequest; import com.amazonaws.services.ec2.model.DescribeInstancesResult; import com.amazonaws.services.ec2.model.Instance; import com.amazonaws.services.ec2.model.Reservation; import com.amazonaws.waiters.WaiterParameters; //import com.amazonaws.services.ec2.waiters.*; public class Proxyserver { public static Semaphore semaphore; public static Semaphore semaphoreAS; public static AmazonEC2 ec2; public static ArrayList<Instance> getAllInstances(){ ArrayList<Instance> toReturn = new ArrayList<Instance>(); try { DescribeAvailabilityZonesResult availabilityZonesResult = Proxyserver.ec2.describeAvailabilityZones(); System.out.println("You have access to " + availabilityZonesResult.getAvailabilityZones().size() + " Availability Zones."); /* using AWS Ireland. * TODO: Pick the zone where you have your AMI, sec group and keys */ DescribeInstancesResult describeInstancesRequest = Proxyserver.ec2.describeInstances(); List<Reservation> reservations = describeInstancesRequest.getReservations(); Set<Instance> instances = new HashSet<Instance>(); for (Reservation reservation : reservations) { instances.addAll(reservation.getInstances()); } ArrayList<String> instancesIDs = new ArrayList<String>(); for(Instance inst : instances) { if( inst.getImageId().equals("ami-308be74f") ) { //running instances //++count; instancesIDs.add(inst.getInstanceId()); } } DescribeInstanceStatusRequest d = new DescribeInstanceStatusRequest().withInstanceIds(instancesIDs); ec2.waiters().instanceStatusOk().run( new WaiterParameters().withRequest(d) // Optionally, you can tune the PollingStrategy: // .withPollingStrategy(...) ); describeInstancesRequest = Proxyserver.ec2.describeInstances(); reservations = describeInstancesRequest.getReservations(); instances = new HashSet<Instance>(); for (Reservation reservation : reservations) { instances.addAll(reservation.getInstances()); } for(Instance inst : instances) { if( inst.getImageId().equals("ami-308be74f") && inst.getState().getCode()==16 ) { //running instances //++count; toReturn.add(inst); } } System.out.println("You have " + toReturn.size() + " Amazon EC2 instance(s) running."); //return toReturn; } catch (AmazonServiceException ase) { System.out.println("Caught Exception: " + ase.getMessage()); System.out.println("Reponse Status Code: " + ase.getStatusCode()); System.out.println("Error Code: " + ase.getErrorCode()); System.out.println("Request ID: " + ase.getRequestId()); } return toReturn; } public static ArrayList<Instance> getInstances(){ ArrayList<Instance> toReturn = new ArrayList<Instance>(); try { DescribeAvailabilityZonesResult availabilityZonesResult = Proxyserver.ec2.describeAvailabilityZones(); System.out.println("You have access to " + availabilityZonesResult.getAvailabilityZones().size() + " Availability Zones."); /* using AWS Ireland. * TODO: Pick the zone where you have your AMI, sec group and keys */ DescribeInstancesResult describeInstancesRequest = Proxyserver.ec2.describeInstances(); List<Reservation> reservations = describeInstancesRequest.getReservations(); Set<Instance> instances = new HashSet<Instance>(); for (Reservation reservation : reservations) { instances.addAll(reservation.getInstances()); } //int count = 0; for(Instance inst : instances) { if( inst.getImageId().equals("ami-308be74f") && inst.getState().getCode()==16 ) { //running instances //++count; toReturn.add(inst); } } System.out.println("You have " + toReturn.size() + " Amazon EC2 instance(s) running."); //return toReturn; } catch (AmazonServiceException ase) { System.out.println("Caught Exception: " + ase.getMessage()); System.out.println("Reponse Status Code: " + ase.getStatusCode()); System.out.println("Error Code: " + ase.getErrorCode()); System.out.println("Request ID: " + ase.getRequestId()); } return toReturn; } public static void main(String[] args) { try { init(); } catch(Exception e) { e.printStackTrace(); return; } semaphore = new Semaphore(1); //loadbalancer semaphoreAS = new Semaphore(1); //loadbalancer try { semaphore.acquire(); } catch(Exception e) { e.printStackTrace(); return; } // Construct listener and select port here //Loadbalancelistener listener; try { new Loadbalancelistener(8080); } catch(Exception e) { e.printStackTrace(); return; } new Queuerequests(); new Instances(); new LoadsInInstance(); ArrayList<Instance> activeInst = getInstances(); //active instances for(int i=0; i<activeInst.size(); ++i) { Instances.insert( activeInst.get(i) );//instances in the system LoadsInInstance.insert( new InstanceLoad(Instances.getInstance(i), Instances.getInstanceID(i)) );// } new Thread( new Loadbalance() ).start(); new Thread( new Autoscaler() ).start(); } public static void init() throws Exception { /* * The ProfileCredentialsProvider will return your [default] * credential profile by reading from the credentials file located at * (~/.aws/credentials). */ AWSCredentials credentials = null; try { credentials = new ProfileCredentialsProvider().getCredentials(); } catch (Exception e) { throw new AmazonClientException( "Cannot load the credentials from the credential profiles file. " + "Please make sure that your credentials file is at the correct " + "location (~/.aws/credentials), and is in valid format.", e); } ec2 = AmazonEC2ClientBuilder.standard().withRegion("us-east-1").withCredentials(new AWSStaticCredentialsProvider(credentials)).build(); } }
package com.hqhcn.android.service.impl; import com.hqh.android.dao.ExamsiteMapper; import com.hqh.android.entity.Examsite; import com.hqh.android.entity.ExamsiteExample; import com.hqh.android.entity.Ksld; import com.hqh.android.entity.KsldExample; import com.hqh.android.service.ExamsiteService; import com.hqh.android.service.KsldService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @Service public class ExamsiteServiceImpl implements ExamsiteService { @Autowired ExamsiteMapper mapper; @Autowired KsldService ksldService; @Override public Map queryToMap(ExamsiteExample example) { List<Examsite> list_data = mapper.selectByExample(example); Map map = new HashMap(); for (Examsite entity : list_data) { map.put(entity.getKcdddh(), entity.getKcmc()); } return map; } @Override public List<Examsite> selectByExample(ExamsiteExample example) { return mapper.selectByExample(example); } @Override public int insert(Examsite entity) { return mapper.insertSelective(entity); } @Override public List selectByExampleToPage(ExamsiteExample example) { return mapper.selectByExampleToPage(example); } @Override public List getKcdddhKcmc() { List<Examsite> result = new ArrayList<>(); for (Examsite site : selectByExample(null)) { Examsite obj = new Examsite(); obj.setKcdddh(site.getKcdddh()); obj.setKcmc(site.getKcmc()); result.add(obj); } return result; } @Override public Examsite get(String kcdddh) { return mapper.selectByPrimaryKey(kcdddh); } @Override @Transactional public void update(Examsite entity) { // 如果更新了阈值中的考试三项目要及时更新考试路段 if (StringUtils.isNotEmpty(entity.getF4())) { String f4 = entity.getF4(); // 取到 3010001,里面记录了哪些 考试项目 正在使用 String ksxmsUseable = f4.substring(f4.indexOf("3010001") + "3010001".length()+1, f4.indexOf("3010002") - 1); String[] ksxms = ksxmsUseable.split(","); ksxmsUseable = ""; for (String ksxm : ksxms) { if (!"0".equals(ksxm)) { ksxmsUseable += ksxm + ","; } } ksxmsUseable = ksxmsUseable.substring(0, ksxmsUseable.length() - 1); // 更新考试路段中的考试项目 Ksld ksld = new Ksld(); ksld.setKsxmpx(ksxmsUseable); KsldExample example = new KsldExample(); example.createCriteria().andKskmEqualTo(entity.getKskm()); ksldService.update(ksld,example); }else if (StringUtils.isNotEmpty(entity.getF5())) { String f5 = entity.getF5(); // 取到 3010001,里面记录了哪些 考试项目 正在使用 String ksxmsUseable = f5.substring(f5.indexOf("1000001") + "1000001".length()+1, f5.indexOf("1000002") - 1); String[] ksxms = ksxmsUseable.split(","); ksxmsUseable = ""; for (String ksxm : ksxms) { if (!"0".equals(ksxm)) { ksxmsUseable += ksxm + ","; } } ksxmsUseable = ksxmsUseable.substring(0, ksxmsUseable.length() - 1); // 更新考试路段中的考试项目 Ksld ksld = new Ksld(); ksld.setKsxmpx(ksxmsUseable); KsldExample example = new KsldExample(); example.createCriteria().andKskmEqualTo(entity.getKskm()); ksldService.update(ksld,example); } entity.setKskm(""); mapper.updateByPrimaryKeySelective(entity); } }
package br.com.nozinho.dao; import javax.ejb.Local; import br.com.nozinho.ejb.dao.GenericDAO; import br.com.nozinho.model.FormacaoIntelectual; @Local public interface FormacaoIntelectualDAO extends GenericDAO<FormacaoIntelectual, Long> { }
package com.ibeiliao.trade.api.dto.response; import com.ibeiliao.pay.api.ApiResultBase; import com.ibeiliao.trade.api.dto.OrderVO; public class GetOrderInfoResponse extends ApiResultBase { /** * */ private static final long serialVersionUID = 7160752045816605675L; private OrderVO order; public OrderVO getOrder() { return order; } public void setOrder(OrderVO order) { this.order = order; } }
package in.hocg.plugin.task; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.EnableAsync; /** * Created by hocgin on 16-12-19. */ @EnableAsync public class AsyncTask { @Async public void demo(int param) { } }
package com.growsic.study.myquizapp; import android.content.res.AssetManager; import android.os.StrictMode; import android.util.Log; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; /** * Created by a13918 on 2015/05/07. */ public class QuestionHandler { ArrayList<String> questionJsonArray; private JSONObject questionJSONObject; private JSONArray questionJSONArray; private AssetManager mAssetManager; public QuestionHandler(String jsonFileName, AssetManager assetManager) { this.mAssetManager = assetManager; readQuizData(jsonFileName); } /** * get question data from json file. * @param jsonFileName */ public void readQuizData(String jsonFileName) { StrictMode.ThreadPolicy policy = new StrictMode. ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); InputStream inputStream = null; BufferedReader bufferedReader = null; try { // read jsonFile to inputStream inputStream = mAssetManager.open(jsonFileName); bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); StringBuilder jsonInfo = new StringBuilder(); String line; while ((line = bufferedReader.readLine()) != null) { jsonInfo.append(line); } //convert String to JSONObject questionJSONObject = new JSONObject(new String(jsonInfo)); // JSONObject を文字列に変換してログ出力します Log.d("result", questionJSONObject.toString()); questionJSONArray = questionJSONObject.getJSONArray("questions"); String loudScreaming = questionJSONObject.getJSONArray("questions").getJSONObject(1).getString("description"); Log.d("description", loudScreaming); inputStream.close(); bufferedReader.close(); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } } public JSONObject getQuestionJSONArray(int index) throws JSONException { if(index <= questionJSONArray.length()) { return questionJSONArray.getJSONObject(index); }else { Log.d("JSON NUll pointer log", "index is out of range"); return null; } } }
import java.util.*; public class voting { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s = scan.nextLine(); char[] c = s.toCharArray(); while (!(c[0] == '#')) { int num = s.length(); int y = 0, n = 0, a = 0, p = 0; for (int i = 0; i < num; i++) { if (c[i] == 'Y') y++; else if (c[i] == 'N') n++; else if (c[i] == 'A') a++; else if (c[i] == 'P') p++; } if (a >= (num+1)/2) System.out.println("need quorum"); else if (y > n) System.out.println("yes"); else if (n > y) System.out.println("no"); else System.out.println("tie"); s = scan.nextLine(); c = s.toCharArray(); } } }
/* * Sonar, open source software quality management tool. * Copyright (C) 2009 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * Sonar is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with Sonar; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ package org.sonar.plugins.sigmm; import org.junit.Test; import static org.junit.Assert.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; public class TestBridgeWithOutsideWorld { @Test public void testPluginsMetrics() { assertThat(new MMMetrics().getMetrics().size(), is(7)); } @Test public void testDefinedExtensions() { assertThat(new MMPlugin().getExtensions().size(), equalTo(4)); } @Test public void testDecoratorDependsUpon() { assertThat(new MMDecorator().dependsUpon().size(), equalTo(6)); } @Test public void testDecoratorDependedUpon() { assertThat(new MMDecorator().dependedUpon().size(), equalTo(5)); } @Test public void testDistributionDecoratorDependedUpon() { assertThat(new MMDistributionDecorator().dependedUpon().size(), equalTo(2)); } }
package com.jim.multipos.ui.admin_main_page.fragments.establishment.presenter; import com.jim.multipos.core.BaseView; import com.jim.multipos.ui.admin_main_page.fragments.establishment.model.Establishment; import com.jim.multipos.ui.admin_main_page.fragments.establishment.model.EstablishmentPos; public interface EstablishmentFragmentView extends BaseView { void setUpEditor(Establishment model); void setUpPosEditor(EstablishmentPos pos); void onAddMode(int mode); }
package com.spring.querybuilder; import java.util.List; public class QueryRequest { private Select select; public QueryRequest(Select select) { this.select = select; } public Select getSelect() { return this.select; } } class Where { List<String> fields; Limit limit; } class Limit { private String key; private String value; public Limit(String key, String value) { this.key = key; this.value = value; } public String getKey() { return key; } public String getValue() { return value; } } class Select { List<String> fields; }
package com.calc.gui.panel.buttons; import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JOptionPane; import javax.swing.JPanel; import com.calc.gui.panel.actions.SimpleCalcAct; import com.calc.gui.window.MainWindow; // JPanel to add the buttons // Singleton class public class ButtonsPanel extends JPanel implements ActionListener { /** * */ private static final long serialVersionUID = 1L; private static ButtonsPanel buttonPanel; private static SimpleCalcAct actionHandler = new SimpleCalcAct(); public JButton b0=new JButton(); public JButton b1=new JButton(); public JButton b2=new JButton(); public JButton b3=new JButton(); public JButton b4=new JButton(); public JButton b5=new JButton(); public JButton b6=new JButton(); public JButton b7=new JButton(); public JButton b8=new JButton(); public JButton b9=new JButton(); public JButton add=new JButton(); public JButton sub=new JButton(); public JButton div=new JButton(); public JButton mul=new JButton(); public JButton equal=new JButton(); public JButton clear=new JButton(); public JButton pBut=new JButton(); public JButton cE=new JButton(); private static int count; private ButtonsPanel() { Dimension laySize=getPreferredSize(); laySize=getPreferredSize(); laySize.width=250; setLayout(new GridBagLayout()); pBut.setSelected(false); GridBagConstraints gc=new GridBagConstraints(); /* * JPanel Area * ------------------------------------- * | x=0,x=1,x=2,x=3,x=4,.... | * |y=0 | * |y=1 | * |y=2 GridBagLayout Coordinate | * |y=3 System | * |y=4 | * |y=5 | * |. | * |. | * |. | * ------------------------------------- * */ // Anchor is used to align the components gc.anchor = GridBagConstraints.LINE_START; gc.anchor = GridBagConstraints.FIRST_LINE_START; gc.fill=GridBagConstraints.BOTH; // wightx and weighty is used to specify the gap between the components gc.weightx=0.1; gc.weighty=0.1; /* gridx and gridy are used to specify the * postion of the component where it should be placed * * add is used to add the components to panel */ gc.gridx=0; gc.gridy=0; b1.setText("1"); add(b1,gc); b1.setPreferredSize(new Dimension()); b1.setHideActionText(true); gc.gridx=0; gc.gridy=1; b4.setText("4"); add(b4,gc); gc.gridx=0; gc.gridy=2; b7.setText("7"); add(b7,gc); gc.gridx=1; gc.gridy=0; b2.setText("2"); add(b2,gc); gc.gridx=1; gc.gridy=1; b5.setText("5"); add(b5,gc); gc.gridx=1; gc.gridy=2; b8.setText("8"); add(b8,gc); gc.gridx=1; gc.gridy=3; b0.setText("0"); add(b0,gc); gc.gridx=2; gc.gridy=0; b3.setText("3"); add(b3,gc); gc.gridx=2; gc.gridy=1; b6.setText("6"); add(b6,gc); gc.gridx=2; gc.gridy=2; b9.setText("9"); add(b9,gc); gc.gridx=2; gc.gridy=3; pBut.setText("."); add(pBut,gc); gc.gridx=3; gc.gridy=0; gc.gridheight=3; add.setText("+"); add(add,gc); gc.gridx=4; gc.gridy=0; gc.gridheight=1; sub.setText("-"); add(sub,gc); gc.gridx=4; gc.gridy=1; div.setText("/"); add(div,gc); gc.gridx=4; gc.gridy=2; mul.setText("*"); add(mul,gc); gc.gridx=3; gc.gridy=3; gc.gridwidth=2; equal.setText("="); add(equal,gc); gc.gridx=5; gc.gridy=0; clear.setText("Clear"); add(clear,gc); gc.gridx=5; gc.gridy=1; cE.setText("CE"); add(cE,gc); Font f=new Font("arial",Font.BOLD,25); b0.setFont(f); b1.setFont(f); b2.setFont(f); b3.setFont(f); b4.setFont(f); b5.setFont(f); b6.setFont(f); b7.setFont(f); b8.setFont(f); b9.setFont(f); add.setFont(f); sub.setFont(f); mul.setFont(f); div.setFont(f); equal.setFont(f); clear.setFont(f); pBut.setFont(f); cE.setFont(f); // adding actionlisteners b0.setActionCommand("button0"); b0.addActionListener(this); b1.setActionCommand("button1"); b1.addActionListener(this); b2.setActionCommand("button2"); b2.addActionListener(this); b3.setActionCommand("button3"); b3.addActionListener(this); b4.setActionCommand("button4"); b4.addActionListener(this); b5.setActionCommand("button5"); b5.addActionListener(this); b6.setActionCommand("button6"); b6.addActionListener(this); b7.setActionCommand("button7"); b7.addActionListener(this); b8.setActionCommand("button8"); b8.addActionListener(this); b9.setActionCommand("button9"); b9.addActionListener(this); add.setActionCommand("buttonAdd"); add.addActionListener(this); sub.setActionCommand("buttonSub"); sub.addActionListener(this); mul.setActionCommand("buttonMul"); mul.addActionListener(this); div.setActionCommand("buttonDiv"); div.addActionListener(this); equal.setActionCommand("buttonEqual"); equal.addActionListener(this); clear.setActionCommand("buttonClear"); clear.addActionListener(this); pBut.setActionCommand("buttonPbut"); pBut.addActionListener(this); cE.setActionCommand("buttonCE"); cE.addActionListener(this); } public static ButtonsPanel getInstance() { if(buttonPanel == null) { buttonPanel = new ButtonsPanel(); System.out.println("Buttons Panel (JPanel) Initialized"); } return buttonPanel; } @Override public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equals("button0")) { System.out.println("Count : "+count); if(count>0){ // jta1.append("\n"); MainWindow.jta1.setText(""); count=0; MainWindow.jta1.append("0"); } else{ actionHandler.b0ActionLis(); } } else if (e.getActionCommand().equals("button1")) { actionHandler.b1ActionLis(); } else if (e.getActionCommand().equals("button2")) { actionHandler.b2ActionLis(); } else if (e.getActionCommand().equals("button3")) { actionHandler.b3ActionLis(); } else if (e.getActionCommand().equals("button4")) { actionHandler.b4ActionLis(); } else if (e.getActionCommand().equals("button5")) { actionHandler.b5ActionLis(); } else if (e.getActionCommand().equals("button6")) { actionHandler.b6ActionLis(); } else if (e.getActionCommand().equals("button7")) { actionHandler.b7ActionLis(); } else if (e.getActionCommand().equals("button8")) { actionHandler.b8ActionLis(); } else if (e.getActionCommand().equals("button9")) { actionHandler.b9ActionLis(); } else if (e.getActionCommand().equals("buttonAdd")) { actionHandler.addActionLis(); } else if (e.getActionCommand().equals("buttonSub")) { actionHandler.subActionLis(); } else if (e.getActionCommand().equals("buttonMul")) { actionHandler.mulActionLis(); } else if (e.getActionCommand().equals("buttonDiv")) { actionHandler.divActionLis(); } else if (e.getActionCommand().equals("buttonEqual")) { String strjta1=MainWindow.jta1.getText(); System.out.println("Count value : "+count); try { if(count<0) { MainWindow.jta1.setText(""); } actionHandler.equalActionLis(); count++; } catch(Exception ex) { System.out.println("*************ERROR**************"); System.out.println(ex.getMessage()); } if(strjta1.equals("")) { System.out.println("*********Error*******"); JOptionPane.showMessageDialog(null, "Please Enter a valid expression","Error",JOptionPane.WARNING_MESSAGE); } } else if (e.getActionCommand().equals("buttonClear")) { actionHandler.clearActionLis(); } else if (e.getActionCommand().equals("buttonPbut")) { actionHandler.pButActionLis(); } else if (e.getActionCommand().equals("buttonCE")) { actionHandler.cEActionLis(); } } }
package org.apache.maven.plugin.deltacoverage.change; import java.util.List; public class ClassChange { private String name; private String filename; private List<LineChange> lines; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getFilename() { return filename; } public void setFilename(String filename) { this.filename = filename; } public List<LineChange> getLines() { return lines; } public void setLines(List<LineChange> lines) { this.lines = lines; } @Override public String toString() { return "ClassChange [filename=" + filename + ", name=" + name + "]"; } }
package com.yixin.dsc.service.common; import com.yixin.dsc.dto.DscAdmittanceDto; import com.yixin.dsc.dto.DscCapitalSupportDto; import com.yixin.dsc.dto.query.DscBankInteractiveResultDto; import com.yixin.dsc.dto.query.DscMainInfoDto; import com.yixin.dsc.dto.query.DscPaymentErrorDto; import com.yixin.kepler.enity.SysDict; import java.util.List; import java.util.Map; /** * 获取资方支持的数据信息service * @author YixinCapital -- chenjiacheng * 2018年07月05日 17:37 **/ public interface DscQueryService { /** * 根据数据类型获取资方支持的数据信息 * @param queryParam 入参 * @return 结果 * @author YixinCapital -- chenjiacheng * 2018/7/5 17:43 */ DscCapitalSupportDto getCapitalSupportData(DscAdmittanceDto queryParam); /** * 银行放款状态查询 * @param applyNo 申请编号 * @return * @author YixinCapital -- wangwenlong * 2018年7月30日 下午1:25:42 */ Object loanStatusQuery(String applyNo); /** * 根据code批量查询字典项 * 由alixCode->bankCode * @param codes 入参, * Map<String,String> : key对应字典码类中的alixFiled,value对应字典码类中的alixCode,value可为空,表示只按照alixCode进行查询 * @param financeCode 资方,不用资方查询的结果集不同 * @return 字典项银行code * @author YixinCapital -- chenjiacheng * 2018/7/31 10:23 */ List<SysDict> getItemCodes(List<Map<String,String>> codes, String financeCode); /** * 通过alix字段值、code值获取对应的银行字典项 * @param dictList 字典项集合 * @param alixCode alix码值 * @param alixField alix字段值 * @return 对应的银行码值 * @author YixinCapital -- chenjiacheng * 2018/7/31 12:35 */ String getBankCode(List<SysDict> dictList, String alixCode, String alixField); /** * 查询订单银行交互信息 * @param applyNo 申请编号 * @param phaseType 阶段 * @return * @author YixinCapital -- wangwenlong * 2018年7月31日 下午1:39:22 */ DscBankInteractiveResultDto queryBankInteractive(String applyNo, String phaseType); /** * 统计一段时间内的订单量 * @param beginTime 开始时间 * @param endTime 结束时间 * @return 订单量 * @author YixinCapital -- chenjiacheng * 2018/8/23 14:25 */ Integer countOrderNums(String beginTime, String endTime); /** * 统计一段时间内的订单详情 * @param beginTime 开始时间 * @param endTime 结束时间 * @return 订单详情 * @author YixinCapital -- chenjiacheng * 2018/8/23 14:46 */ List<DscMainInfoDto> queryMainInfoList(String beginTime, String endTime); /** * 统计一段时间内请款失败的订单 * @param beginTime 开始时间 * @param endTime 结束时间 * @return 请款失败的订单详情 * @author YixinCapital -- chenjiacheng * 2018/8/23 16:39 */ List<DscPaymentErrorDto> queryPaymentErrorList(String beginTime, String endTime); /** * 银行放款状态查询 * @param applyNo 申请编号 * @return * @author YixinCapital -- wangwenlong * 2018年7月30日 下午1:25:42 */ String getVenusNoByApplyNo(String applyNo); }
package com.example.didiorder.view; import android.content.Context; import com.example.didiorder.adapter.OrderAdapter; /** * Created by qqq34 on 2016/1/20. */ public interface OrderView { void isHideSwipe(boolean isHide); Context getContext(); void setSwipEnable(boolean isEnable); void showSnackBar(String s); void SetAdapter(OrderAdapter adapter); void setViewEnable(boolean isEnable); void hideProgressbar(boolean isHide); void finishActivity(); }
package com.google.android.exoplayer2.i; public final class k { private int aCp; private int aCq; private int aCr; private byte[] data; public k(byte[] bArr, int i, int i2) { k(bArr, i, i2); } public final void k(byte[] bArr, int i, int i2) { this.data = bArr; this.aCp = i; this.aCr = i2; this.aCq = 0; md(); } public final void mk() { int i = this.aCq + 1; this.aCq = i; if (i == 8) { this.aCq = 0; this.aCp = (dc(this.aCp + 1) ? 2 : 1) + this.aCp; } md(); } public final void cX(int i) { int i2 = this.aCp; int i3 = i / 8; this.aCp += i3; this.aCq = (i - (i3 * 8)) + this.aCq; if (this.aCq > 7) { this.aCp++; this.aCq -= 8; } while (true) { i2++; if (i2 > this.aCp) { md(); return; } else if (dc(i2)) { this.aCp++; i2 += 2; } } } public final boolean db(int i) { int i2 = this.aCp; int i3 = i / 8; int i4 = this.aCp + i3; i3 = (this.aCq + i) - (i3 * 8); if (i3 > 7) { i4++; i3 -= 8; } i2++; while (i2 <= i4 && i4 < this.aCr) { if (dc(i2)) { i4++; i2 += 2; } i2++; } return i4 < this.aCr || (i4 == this.aCr && i3 == 0); } public final boolean mb() { boolean z = (this.data[this.aCp] & (128 >> this.aCq)) != 0; mk(); return z; } public final int cY(int i) { int i2 = 2; this.aCq += i; int i3 = 0; while (this.aCq > 8) { this.aCq -= 8; i3 |= (this.data[this.aCp] & 255) << this.aCq; this.aCp = (dc(this.aCp + 1) ? 2 : 1) + this.aCp; } i3 = (i3 | ((this.data[this.aCp] & 255) >> (8 - this.aCq))) & (-1 >>> (32 - i)); if (this.aCq == 8) { this.aCq = 0; int i4 = this.aCp; if (!dc(this.aCp + 1)) { i2 = 1; } this.aCp = i4 + i2; } md(); return i3; } public final boolean ml() { boolean z; int i = this.aCp; int i2 = this.aCq; int i3 = 0; while (this.aCp < this.aCr && !mb()) { i3++; } if (this.aCp == this.aCr) { z = true; } else { z = false; } this.aCp = i; this.aCq = i2; if (z || !db((i3 * 2) + 1)) { return false; } return true; } public final int mm() { int mn = mn(); return (mn % 2 == 0 ? -1 : 1) * ((mn + 1) / 2); } public final int mn() { int i = 0; int i2 = 0; while (!mb()) { i2++; } int i3 = (1 << i2) - 1; if (i2 > 0) { i = cY(i2); } return i3 + i; } private boolean dc(int i) { return 2 <= i && i < this.aCr && this.data[i] == (byte) 3 && this.data[i - 2] == (byte) 0 && this.data[i - 1] == (byte) 0; } private void md() { boolean z = this.aCp >= 0 && (this.aCp < this.aCr || (this.aCp == this.aCr && this.aCq == 0)); a.ap(z); } }
package lintcode; import lintcode.util.Interval; import java.util.Collections; import java.util.Comparator; import java.util.LinkedList; import java.util.List; /** * Created by jiajia on 2017/10/17. */ public class L156 { /* public static Comparator<Interval> comparator = new Comparator<Interval>() { @Override public int compare(Interval o1, Interval o2) { return o1.start - o2.start; } };*/ public List<Interval> merge(List<Interval> intervals) { intervals.sort(Comparator.comparing(i -> i.start)); Interval last = null; List<Interval> resultInterval = new LinkedList<>(); for (Interval interval : intervals) { if (null == last || last.end <= interval.start) { last = interval; resultInterval.add(last); } else { last.end = Math.max(last.end, interval.end); } } return resultInterval; } public List<Interval> merge1(List<Interval> intervals) { List<Pixel> pixels = new LinkedList<Pixel>(); for (Interval interval : intervals) { pixels.add(new Pixel(interval.start, 1)); pixels.add(new Pixel(interval.end, 0)); } Collections.sort(pixels); for (int i = 0; i < pixels.size(); i++) { if (1 == pixels.get(i).flag) { if (i + 1 < pixels.size()) { if (pixels.get(i).flag == pixels.get(i + 1).flag) { pixels.remove(i + 1); } } } else { if (i + 1 < pixels.size()) { if (pixels.get(i).flag == pixels.get(i + 1).flag) { pixels.remove(i); } } } } List<Interval> intervalList = new LinkedList<Interval>(); if (pixels.size() > 2) { for (int i = 1; i < pixels.size() - 1; i++) { if (pixels.get(i).value == pixels.get(i + 1).value || pixels.get(i).value + 1 == pixels.get(i + 1).value) { pixels.remove(i + 1); pixels.remove(i); } } } for (int i = 0; i < pixels.size(); i = i + 2) { intervalList.add(new Interval(pixels.get(i).value, pixels.get(i + 1).value)); System.out.println(" pixels.get(i) " + pixels.get(i).value + " pixels.get(i + 1) " + pixels.get(i + 1).value); } return intervalList; } public static void main(String[] args) { List<Interval> intervals = new LinkedList<Interval>(); intervals.add(new Interval(2, 3)); intervals.add(new Interval(4, 5)); intervals.add(new Interval(6, 7)); intervals.add(new Interval(8, 9)); intervals.add(new Interval(1, 10)); new L156().merge(intervals); } } class Pixel implements Comparable<Pixel> { int value; int flag; public Pixel(int value, int flag) { this.value = value; this.flag = flag; } @Override public int compareTo(Pixel o) { if (this.value == o.value) { return this.flag - o.flag; } else { return this.value - o.value; } } }
package org.fuusio.api.plugin; /** * {@link InjectorProvider} defines interface for objects that provide a {@link PluginInjector}. */ public interface InjectorProvider { PluginInjector getInjector(); }
package app.integro.sjbhs.adapters; import android.content.Context; import android.content.Intent; import android.net.Uri; import androidx.cardview.widget.CardView; import androidx.recyclerview.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import app.integro.sjbhs.R; import app.integro.sjbhs.models.Announcement; public class AnnouncementAdapter extends RecyclerView.Adapter<AnnouncementAdapter.MyViewHolder> { private static final String TAG = "AnnouncementAdapter"; private final ArrayList<Announcement> announcementArrayList; private final Context context; public AnnouncementAdapter(Context context, ArrayList<Announcement> announcementArrayList) { this.context = context; this.announcementArrayList = announcementArrayList; } @Override public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(context).inflate(R.layout.card_upcoming_events, parent, false); return new MyViewHolder(view); } @Override public void onBindViewHolder(MyViewHolder holder, int position) { final Announcement announcement = announcementArrayList.get(position); holder.tvTitle.setText(announcement.getTitle()); holder.tvDate.setText(announcement.getDate()); holder.tvDescription.setText(announcement.getDescription()); int itemId = Integer.parseInt(announcement.getId()); float colorValue = Integer.parseInt(String.valueOf(itemId / 2)); Log.d(TAG, "onBindViewHolder: colorValue " + colorValue); Log.d(TAG, "onBindViewHolder: itemId: " + announcement.getId()); } @Override public int getItemCount() { return announcementArrayList.size(); } public class MyViewHolder extends RecyclerView.ViewHolder { private final TextView tvTitle; private final TextView tvDescription; private final TextView tvDate; private final CardView cvAnnouncements; public MyViewHolder(View itemView) { super(itemView); tvTitle = (TextView) itemView.findViewById(R.id.tvTitle); tvDescription = (TextView) itemView.findViewById(R.id.tvDescription); tvDate = itemView.findViewById(R.id.tvDate); cvAnnouncements = itemView.findViewById(R.id.cvAnnouncements); } } }
package problem; public class BinarySearch { int searchNumber(int[] arr , int x) { int l=0,r = arr.length -1; while(l<=r) { int mid = l + (r-1)/2; if(arr[mid]==x) return mid; if(arr[mid]<x) l = mid+1; else r=mid-1; } return -1; } public static void main(String[] args) { // TODO Auto-generated method stub for(int k = 0;k<10;++k) { System.out.println(k); } int i = 10,y = 80; Integer.toBinaryString(i);Integer.toBinaryString(y); System.out.println(i); System.out.println(i<<3); BinarySearch bs = new BinarySearch(); int x =12; int[] arr = {2,6,9,12,78,98}; System.out.print("Number "+x+" is present at index : "+bs.searchNumber(arr, x)); } }
package DataStructuresTextbook.Arrays.Chapter_3.insertSort; /** * Created by Joakim on 12/02/15. */ public class InsertSortApp { public static void main(String args[]) { int maxSize = 100; // size of the array ArrayIns arr = new ArrayIns(maxSize); // create an object of class ArrayIns // insert 10 items arr.insert(77); arr.insert(99); arr.insert(44); arr.insert(55); arr.insert(22); arr.insert(88); arr.insert(11); arr.insert(00); arr.insert(66); arr.insert(33); arr.insert(1); arr.insert(2); arr.insert(3); arr.insert(4); arr.insert(5); arr.insert(6); arr.insert(7); arr.insert(8); arr.insert(9); arr.insert(10); arr.display(); // display items in the array arr.insertionSort(); // insertion-sort them arr.display(); // display them again } // end main } // end class InsertSortApp
package com.tencent.mm.ui.transmit; import com.tencent.mm.g.a.lj; import com.tencent.mm.sdk.b.a; import com.tencent.mm.ui.widget.a.c.a.b; import com.tencent.mm.y.g$a; class SelectConversationUI$7 implements b { final /* synthetic */ g$a fZg; final /* synthetic */ SelectConversationUI uEC; SelectConversationUI$7(SelectConversationUI selectConversationUI, g$a g_a) { this.uEC = selectConversationUI; this.fZg = g_a; } public final void aMV() { lj ljVar = new lj(); ljVar.bVI.context = this.uEC.mController.tml; ljVar.bVI.bJC = SelectConversationUI.i(this.uEC); ljVar.bVI.bVJ = this.fZg.dwW; ljVar.bVI.bUY = false; ljVar.bVI.scene = 7; a.sFg.m(ljVar); } }
package learn.kidsapp.learnmath; import android.content.Context; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.transition.AutoTransition; import android.transition.TransitionManager; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import babylanguage.babyapp.appscommon.services.AndroidHelper; import babylanguage.babyapp.appscommon.services.MathHelper; import data.AgeLevel; import services.AppConsts; import services.AppStateService; import services.GameHelper; public class MissingFragment extends Fragment { int startNumber; int missingIndex; int numbersInQuestion = 4; int numOfAnswers = 9; boolean bubbleAnimationOn = true; BaseActivity activity; View view; int totalRounds = -1; int numOfQuestions = 0; private OnFragmentInteractionListener mListener; public MissingFragment() { // Required empty public constructor } public static MissingFragment newInstance(BaseActivity activity) { MissingFragment fragment = new MissingFragment(); fragment.setActivity(activity); return fragment; } public static MissingFragment newInstance(BaseActivity activity, int rounds) { MissingFragment fragment = new MissingFragment(); fragment.totalRounds = rounds; fragment.setActivity(activity); return fragment; } public void setActivity(BaseActivity activity){ this.activity = activity; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment view = inflater.inflate(R.layout.fragment_missing, container, false); initBubbles(); initOnClick(); initQuestion(); return view; } private void initOnClick(){ for(int i = 0; i < numOfAnswers; i++){ View v = this.view.findViewById(AndroidHelper.getId("answer_" + i, R.id.class)); v.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { answerClicked(v); } }); } } private void initBubbles(){ for(int i = 0; i < numOfAnswers; i++){ TextView textView = this.view.findViewById(AndroidHelper.getId("answer_" + i, R.id.class)); int dimension = MathHelper.getRandomInt(null, 30, 100); int pxDimentions = (int)AndroidHelper.convertDpToPixel(dimension, this.activity); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(pxDimentions, pxDimentions); textView.setLayoutParams(params); } } private void initQuestion(){ if(totalRounds != -1 && numOfQuestions >= totalRounds){ GameHelper.sendFragmentMessage(AppConsts.fragment_game_completed, mListener); return; } numOfQuestions++; int maxNumber = AppStateService.getCurrentLevel() == AgeLevel.AGE_4_6 ? AppConsts.maxNumber : AppConsts.maxNumber_level_1; startNumber = MathHelper.getRandomInt(null, 0, maxNumber - 4); missingIndex = MathHelper.getRandomInt(null, 0, 3); for(int i = 0; i < numbersInQuestion; i++){ setQuestionNumber(i, i == missingIndex ? "?" : (startNumber + i) + "", i == missingIndex); } Integer[] answers = new Integer[numOfAnswers]; int correctAnswer = MathHelper.getRandomInt(null, 0, 8); for(int i = 0; i < answers.length; i++){ answers[i] = i == correctAnswer ? startNumber + missingIndex : MathHelper.getRandomInt(answers, 0, maxNumber); TextView textView = this.view.findViewById(AndroidHelper.getId("answer_" + i, R.id.class)); textView.setText(answers[i] + ""); textView.setTag(answers[i]); } startBubblesAnimations(); } private void setQuestionNumber(int index, String value, boolean missing){ TextView textView = this.view.findViewById(AndroidHelper.getId("number_" + index, R.id.class)); textView.setText(value); textView.setBackground(this.getResources().getDrawable(missing ? R.drawable.theme_rect_2 : R.drawable.gray_rect, this.activity.getTheme())); } private void animateBubbles(){ for(int i = 0; i < numOfAnswers; i++){ animateBubble(AndroidHelper.getId("answer_container_" + i, R.id.class)); } } private void animateBubble(int id){ LinearLayout container = this.view.findViewById(id); AutoTransition autoTransition = new AutoTransition(); autoTransition.setDuration(3000); TransitionManager.beginDelayedTransition(container, autoTransition); int top_bottom = MathHelper.getRandomInt(null, 0, 1) == 0 ? Gravity.TOP : Gravity.BOTTOM; int left_right = MathHelper.getRandomInt(null, 0, 1) == 0 ? Gravity.RIGHT : Gravity.LEFT; container.setGravity(top_bottom | left_right); } private void startBubblesAnimations(){ animateBubbles(); bubbleAnimationOn = true; AndroidHelper.setTimer(new Runnable() { @Override public void run() { if(bubbleAnimationOn){ startBubblesAnimations(); } } }, 2500); } private void stopBubblesAnimations(){ bubbleAnimationOn = false; for(int i = 0; i < numOfAnswers; i++){ LinearLayout container = this.view.findViewById(AndroidHelper.getId("answer_container_" + i, R.id.class)); TransitionManager.endTransitions(container); } } public void answerClicked(final View v){ int answer = (int)v.getTag(); if(answer == startNumber + missingIndex){ GameHelper.sendFragmentMessage(AppConsts.fragment_game_correct_answer, mListener); setQuestionNumber(missingIndex, answer + "", true); stopBubblesAnimations(); for(int i = 0; i < numOfAnswers; i++){ TextView answerView = this.view.findViewById(AndroidHelper.getId("answer_" + i, R.id.class)); AndroidHelper.showGrowAnimation(answerView, this.activity); } this.activity.mp = AndroidHelper.playSound(this.activity.mp, R.raw.success, "success", this.activity, false,null); AndroidHelper.setTimer(new Runnable() { @Override public void run() { initQuestion(); } }, 500); } else{ GameHelper.sendFragmentMessage(AppConsts.fragment_game_incorrect_answer, mListener); this.activity.mp = AndroidHelper.playSound(this.activity.mp, R.raw.failure, "failure", this.activity, false,null); AndroidHelper.showShakeAnimation(v, this.activity); AndroidHelper.setTimer(new Runnable() { @Override public void run() { animateBubble(((LinearLayout)v.getParent()).getId()); } }, 30); } } @Override public void onAttach(Context context) { super.onAttach(context); if (context instanceof OnFragmentInteractionListener) { mListener = (OnFragmentInteractionListener) context; } else { throw new RuntimeException(context.toString() + " must implement OnFragmentInteractionListener"); } } @Override public void onDetach() { super.onDetach(); mListener = null; } }
package manage.bean; public class SetClass { private int class_id; private int grade_id; private String class_name; public int getClass_id() { return class_id; } public void setClass_id(int class_id) { this.class_id = class_id; } public String getClass_name() { return class_name; } public void setClass_name(String class_name) { this.class_name = class_name; } public int getGrade_id() { return grade_id; } public void setGrade_id(int grade_id) { this.grade_id = grade_id; } @Override public String toString() { return "SetClass [class_id=" + class_id + ", grade_id=" + grade_id + ", class_name=" + class_name + "]"; } }
package com.example.recyclewithdetails; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { private static final String TAG = "MainActivity"; private String title = "Mode List"; private ArrayList<String> mNames = new ArrayList<>(); private ArrayList<String> mDesc = new ArrayList<>(); private ArrayList<String> gambarUrls = new ArrayList<>(); private ArrayList<String> penjelasan = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Log.d(TAG, "onCreate:started."); initImageBitmaps(); } private void initImageBitmaps() { gambarUrls.add("http://static.bmdstatic.com/pk/product/medium/YAMAHA-Gitar-Akustik-[FX-310]-SKU00113566_0-20140328220000.jpg"); mNames.add("Gitar"); mDesc.add("Gitar Akustic"); penjelasan.add("Gitar akustik adalah gitar yang didesain dengan badan yang berlubang bagian tengahnya. Lubang tersebut digunakan untuk menggemakan suara saat dawai dipetik, karena gitar akustik dimainkan tanpa menggunakan tenaga listrik atau manual. Kedua, adalah gitar elektrik yaitu gitar yang dimainkan dengan bantuan aliran listrik untuk mendukung suaranya. "); gambarUrls.add("https://www.audiopro.id/~img/yamaha_pacifica_pac611hfm_800x800-a0b4b-3037_573.jpg"); mNames.add("Gitar"); mDesc.add("Gitar Elektrik"); penjelasan.add("Gitar listrik adalah sejenis gitar yang menggunakan beberapa pickup untuk mengubah bunyi atau getaran dari string gitar menjadi arus listrik yang akan dikuatkan kembali dengan menggunakan seperangkat amplifier dan loud speaker."); gambarUrls.add("https://i2.wp.com/hargakatalog.id/wp-content/uploads/2018/12/Gitar-Ukulele-Bass.png?resize=650%2C654&ssl=1"); mNames.add("Ukulele"); mDesc.add("Ukulele"); penjelasan.add("Ukulele adalah alat musik petik sejenis gitar berukuran kecil, sekitar 20 inci, dan merupakan alat musik asli Hawai ditemukan sekitar tahun 1879. Sedangkan alat musik itu sendiri diperkirakan datangnya dari kepulauan Hawai kurang lebih pada abad ke 16. "); gambarUrls.add("http://2.bp.blogspot.com/-T3OnbLRKRJ0/VObmdvWpjXI/AAAAAAAAF-w/3AOcwkkS3E0/s1600/piano.jpg"); mNames.add("Piano"); mDesc.add("Piano"); penjelasan.add("Piano adalah alat musik yang dimainkan dengan jari-jemari tangan. Pemain piano disebut pianis. Piano adalah salah jenis alat musik yang populer di dunia. alat musik piano juga dapat dikategorikan sebagai alat musik tertua dan juga memiliki harga yang cukup mahal. Mungkin memang benar, alat musik piano jarang kita temui kecuali di tempat-tempat tertentu, itu karena dilihat dari harga piano yang cukup mahal. Bagi sebagian orang mungkin belum mengetahui perkembangan dan sejarah alat musik piano."); gambarUrls.add("https://pbs.twimg.com/media/C3x0kchVcAA4TVS.jpg"); mNames.add("Drum"); mDesc.add("Drum"); penjelasan.add("Drum adalah kelompok alat musik perkusi yang terdiri dari kulit yang direntangkan dan dipukul dengan tangan atau sebuah batang. Selain kulit, drum juga digunakan dari bahan lain, misalnya plastik."); gambarUrls.add("https://my-live-02.slatic.net/original/8f82273012f6ca9130c95667db2e0001.jpg"); mNames.add("Bass"); mDesc.add("Bass Electrik"); penjelasan.add("Bass atau Bas adalah jenis suara terendah penyanyi pria, biasanya mempunyai jangkauan dari nada E2 sampai E4. Walaupun demikian, beberapa penyanyi yang nada rendahnya bisa sangat ekstrem, bisa mencapai nada C2."); gambarUrls.add("https://4.bp.blogspot.com/-qmeN0JB1OsE/WGsXD0gFPRI/AAAAAAAAEsM/4Ll_UEFEwN8T55IhoLeqgjrO9XHOyeHawCLcB/s1600/Harga%2BBiola.jpg"); mNames.add("Biola"); mDesc.add("Biola"); penjelasan.add("Biola adalah sebuah alat musik dawai yang dimainkan dengan cara digesek. Biola memiliki empat senar (G-D-A-E) yang disetel berbeda satu sama lain dengan interval sempurna kelima. Nada yang paling rendah adalah G. Di antara keluarga biola, yaitu dengan biola alto, cello dan double bass atau kontra bass, biola memiliki nada yang tertinggi. Alat musik dawai yang lainnya, bas, secara teknis masuk ke dalam keluarga viol. Kertas musik untuk biola hampir selalu menggunakan atau ditulis pada kunci G."); gambarUrls.add("https://cajondg.com/wp-content/uploads/2018/01/26DrumBox.png"); mNames.add("Cajon"); mDesc.add("Drum Box"); penjelasan.add("Cajón (pengucapan bahasa Spanyol: [kaˈxon] (ka-hone), \"peti\" atau \"kotak berlubang\") adalah alat musik perkusi berbentuk kotak bersisi enam yang dimainkan dengan menepuk sisi-sisinya dengan tangan, jari, atau berbagai alat lain seperti stik atau sikat (drum)."); initRecyclerView(); } private void initRecyclerView() { RecyclerView recyclerView = findViewById(R.id.recyclerv_view); recyclerView.setHasFixedSize(false); recyclerView.setLayoutManager(new LinearLayoutManager(this)); RecycleViewAdapter adapter = new RecycleViewAdapter(this, mNames, gambarUrls, mDesc, penjelasan); recyclerView.setAdapter(adapter); } private void showRecyleList() { RecyclerView recyclerView = findViewById(R.id.recyclerv_view); recyclerView.setHasFixedSize(false); recyclerView.setLayoutManager(new LinearLayoutManager(this)); ListActivity adapter = new ListActivity(this, mNames, gambarUrls, mDesc, penjelasan); recyclerView.setAdapter(adapter); } private void showRecyclerGrid() { RecyclerView recyclerView = findViewById(R.id.recyclerv_view); recyclerView.setHasFixedSize(false); recyclerView.setLayoutManager(new GridLayoutManager(this, 2)); GridActivity adapter = new GridActivity(this, mNames, gambarUrls, mDesc, penjelasan); recyclerView.setAdapter(adapter); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_list: setActionBarTitle("Mode List"); showRecyleList(); break; case R.id.action_grid: setActionBarTitle("Mode Grid"); showRecyclerGrid(); break; case R.id.action_cardview: setActionBarTitle("Mode Card View"); initRecyclerView(); break; } return super.onOptionsItemSelected(item); } private void setActionBarTitle(String title) { getSupportActionBar().setTitle(title); } }
/* * The University of Melbourne * School of Computing and Information Systems * COMP90041 Programming and Software Development * Assignment 3 * Student Name: Dongliang Liang * Student ID: 962661 * * NimHumanPlayer contains Human player method * */ public class NimHumanPlayer extends NimPlayer{ public NimHumanPlayer(String username, String givenname,String familyname) { super(username, givenname, familyname); } public NimHumanPlayer(String username, String givenname, String familyname,int NumOfGame,int NumOfWon) { super(username, givenname, familyname,NumOfGame, NumOfWon); } @Override public int RemoveStone(String player, int total, int max){ System.out.println(player+"'s turn - remove how many?"); Integer numMove=Integer.parseInt(Nimsys.input.nextLine()); try { if(numMove<0||numMove>max||numMove>total){ if(numMove<0||numMove>max){ throw new Exception("Invalid move. You must remove between 1 and "+max+" stones."); }else{ throw new Exception("Invalid move. You must remove between 1 and "+total+" stones."); } }else{ return numMove; } } catch (Exception e) { System.out.println(); System.out.println(e.getMessage()); System.out.println(); return 0; } } public String advancedMove(boolean[] available, String lastMove) { String input=Nimsys.input.nextLine(); String[] move=input.split(" "); try { int num1=Integer.parseInt(move[0]); int num2=Integer.parseInt(move[1]); if(num2>2||num2<1||num1>12){ throw new Exception("Invalid move."); }else{ if(num2==2){ if(available[num1-1]==false||available[num1]==false){ throw new Exception("Invalid move."); }else{ return input; } }else if(num2==1 && available[num1-1]==false){ throw new Exception("Invalid move."); }else{ return input; } } } catch (Exception e) { System.out.println(); System.out.println(e.getMessage()); System.out.println(); return ""; } } }
package pl.wojtech.weather.service; import pl.wojtech.weather.model.WeatherForecastDataBundle; import pl.wojtech.weather.model.json.WeatherForecastJSON; /** * Created by Wojtech on 2018-03-01. */ public interface WeatherService { /** * Callsr remote api for data * @param location city name which data is being retrieved * @return raw json data */ WeatherForecastJSON getWeatherDataFromRemoteAPI(String location); /** * Parse and build weather forecast data ready to being cached * @param location * @return weather forecast data ready to being cached */ WeatherForecastDataBundle getWeatherForecastData(String location); }
/* * 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 ShopRent.controller; import ShopRent.modle.Building; import ShopRent.modle.TableLoad; import com.jfoenix.controls.JFXButton; import java.net.URL; import java.util.HashMap; import java.util.ResourceBundle; import javafx.beans.property.SimpleStringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.input.MouseEvent; import pojo.SrBuilding; import pojo.Ward; /** * FXML Controller class * * @author RM.LasanthaRanga@gmail.com */ public class DashboardController implements Initializable { @FXML private JFXButton btn_test; @FXML public TableView<?> tbl1; @FXML public TableColumn<?, ?> col1; @FXML public TableColumn<?, ?> col2; @FXML private JFXButton btnload; /** * Initializes the controller class. */ @Override public void initialize(URL url, ResourceBundle rb) { // TODO } @FXML private void testClick(ActionEvent event) { } public class WardTable { /** * @return the wid */ public String getWid() { return wid.get(); } /** * @return the wname */ public String getWname() { return wname.get(); } private SimpleStringProperty wid; private SimpleStringProperty wname; public WardTable(String wid, String wname) { this.wid = new SimpleStringProperty(wid); this.wname = new SimpleStringProperty(wname); } } @FXML private void loadtable(ActionEvent event) { HashMap<TableColumn, String> hashMap = new HashMap<TableColumn, String>(); hashMap.put(col1, "wid"); hashMap.put(col2, "wname"); java.util.List<pojo.Ward> list = new modle.Ward().loadWardTable(); ObservableList oList = FXCollections.observableArrayList(); for (Ward w : list) { oList.add(new WardTable(w.getIdWard()+"", w.getWardName())); } TableLoad tableLoad = new ShopRent.modle.TableLoad(); tableLoad.load(oList, tbl1, hashMap); } @FXML private void getSelected(MouseEvent event) { WardTable name = (DashboardController.WardTable) tbl1.getSelectionModel().getSelectedItem(); modle.Allert.notificationGood(name.getWname(), ""); } }
package envygram.tests.loginpage; import envygram.base.basetest.SeleniumBaseTestClass; import org.testng.annotations.Test; import pages.AuthorisationPage; import ru.yandex.qatools.allure.annotations.Description; import ru.yandex.qatools.allure.annotations.Title; import static envygram.base.testngutils.Group.smokeTest; /** * Created by Evgeny on 28.05.2016 7:58 * . */ public class EG_002_SignUpToEnvyHomePageByTwitterAccount extends SeleniumBaseTestClass { @Description("Test case sigh up to Envygram home page by using Twitter test account") @Title("EG_002_Sign up to homr page by twitter account") @Test(groups = {smokeTest}) public void EG_002_signUpByTwitterAccount() { new AuthorisationPage() .navigateToUrl("ENVY_GRAM_URL") .checkTitleOfThePage("ENVY_GRAM_TITLE_AUTHOR_PAGE") .clickOnJoinEnvygramButton() .clickOnTwitterButton() .checkTitleOfThePage("TWITTER_AUTHORISATION_PAGE") .enterUserName("TWITTER_USER_NAME") .enterPassword("TWITTER_PASSWORD") .clickSubmitButton() .checkTitleOfThePage("ENVYGRAM_HOME_PAGE"); } }
package manage.service.impl; import manage.bean.M_user; import manage.dao.impl.M_userDaoImlp; public class M_userServiceImpl { private M_userDaoImlp userDaoImpl=new M_userDaoImlp(); public M_user login(String username,String password){ return userDaoImpl.login(username, password); } }
package com.xuecheng.learning.service; import com.xuecheng.framework.domain.learning.response.GetMediaResult; import com.xuecheng.framework.domain.task.XcTask; import com.xuecheng.framework.model.response.ResponseResult; import java.util.Date; public interface ILearningService { GetMediaResult getmedia(String courseId, String teachplanId); ResponseResult addcourse(String userId, String courseId, String valid, String charge, Float price, Date startTime, Date endTime, XcTask xcTask); }
package br.com.sistemamedico; import java.io.File; import javax.servlet.ServletException; import org.apache.catalina.LifecycleException; import org.apache.catalina.startup.Tomcat; public class EmbeddedTomcat { public static void main(String[] args) throws LifecycleException, ServletException { String contextPath = "/"; String webappDir = new File("target/sistemamedico").getAbsolutePath(); Tomcat tomcat = new Tomcat(); tomcat.setBaseDir("src/main/java"); tomcat.setPort(8080); tomcat.addWebapp(contextPath, webappDir); tomcat.start(); tomcat.getServer().await(); } }
package com.handsome.qhb.ui.activity; import android.os.Bundle; import android.view.View; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import com.handsome.qhb.adapter.OrderItemAdapter; import com.handsome.qhb.application.MyApplication; import com.handsome.qhb.bean.Order; import com.handsome.qhb.bean.Products; import com.handsome.qhb.utils.LogUtils; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.List; import tab.com.handsome.handsome.R; /** * Created by zhang on 2016/3/14. */ public class OrderDetailActivity extends BaseActivity{ private TextView tv_title; //Order private Order order = new Order(); //shopcarListView private ListView lv_products; //总价格 private TextView tv_totalMoney; //状态 private TextView tv_orderStatus; //订单Id private TextView tv_orderId; //下单时间 private TextView tv_orderTime; //收货人 private TextView tv_receName; //联系方式 private TextView tv_recePhone; //地址 private TextView tv_receAddr; //返回 private LinearLayout ll_back; //Gson private Gson gson = new Gson(); //productsList private List<Products> productsList = new ArrayList<Products>(); @Override protected void onCreate(Bundle savedInstanceState) { DecimalFormat df = new DecimalFormat("#0.00"); super.onCreate(savedInstanceState); setContentView(R.layout.activity_order_details); tv_title = (TextView) findViewById(R.id.tv_title); lv_products = (ListView) findViewById(R.id.lv_products); tv_totalMoney = (TextView)findViewById(R.id.tv_totalMoney); tv_orderStatus = (TextView)findViewById(R.id.tv_orderStatus); tv_orderId = (TextView)findViewById(R.id.tv_orderId); tv_orderTime = (TextView)findViewById(R.id.tv_orderTime); tv_receName = (TextView)findViewById(R.id.tv_receName); tv_recePhone = (TextView)findViewById(R.id.tv_recePhone); tv_receAddr = (TextView)findViewById(R.id.tv_receAddr); ll_back = (LinearLayout)findViewById(R.id.ll_back); tv_title.setText("订单详情"); if(getIntent().getSerializableExtra("order")!=null){ order = (Order) getIntent().getSerializableExtra("order"); String totalMoney = getIntent().getStringExtra("totalMoney"); List<Products> productsList = new ArrayList<Products>(); productsList = gson.fromJson(order.getProducts(),new TypeToken<List<Products>>(){}.getType()); OrderItemAdapter orderItemAdapter = new OrderItemAdapter(this,productsList,R.layout.gwc_list_items, MyApplication.getmQueue()); lv_products.setAdapter(orderItemAdapter); tv_totalMoney.setText(totalMoney); if(order.getState()==0){ tv_orderStatus.setText("待收货"); }else{ tv_orderStatus.setText("已完成"); } tv_orderId.setText(String.valueOf(order.getOid())); tv_orderTime.setText(order.getTime()); tv_receName.setText(order.getReceName()); tv_recePhone.setText(order.getRecePhone()); tv_receAddr.setText(order.getReceAddr()); } ll_back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); } }
/* * Copyright 2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.sync; import lombok.AllArgsConstructor; import lombok.Data; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.RequiredArgsConstructor; import lombok.Setter; import lombok.ToString; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.hibernate.Hibernate; import org.springframework.data.domain.Persistable; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import java.io.Serializable; import java.util.Objects; /** * @author Roy Clarkson * @author Craig Walls */ @Entity @Getter @Setter @ToString @AllArgsConstructor @NoArgsConstructor public class Todo implements Serializable, Persistable<Long> { private static final long serialVersionUID = 1L; @Id // @GeneratedValue(strategy = GenerationType.AUTO) private Long id = -1L; private String description; private boolean complete; @Override public boolean equals(final Object o) { if (this == o) return true; if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false; final Todo todo = (Todo) o; return id != null && Objects.equals(id, todo.id); } @Override public int hashCode() { return HashCodeBuilder.reflectionHashCode(this); } @Override public boolean isNew() { return id == -1L; } }
package hk.edu.polyu.comp.comp2021.jungle.model; /** * Test class for GameOverListener */ public class TestGameOverListener implements GameOverListener { private boolean triggered = false; @Override public void OnTrigger(Player triggeredPlayer) { triggered = true; } /** * @return Check if it is triggered. */ public boolean isTriggered() { return triggered; } }
package com.esc.fms.entity; public class DeptRefStaff { private Integer recordID; private Integer deptID; private Integer staffRecordID; public Integer getRecordID() { return recordID; } public void setRecordID(Integer recordID) { this.recordID = recordID; } public Integer getDeptID() { return deptID; } public void setDeptID(Integer deptID) { this.deptID = deptID; } public Integer getStaffRecordID() { return staffRecordID; } public void setStaffRecordID(Integer staffRecordID) { this.staffRecordID = staffRecordID; } }
package de.fhg.iais.roberta.syntax; /** * all Phrases (at least actors) with an user defined port should implement this interface to make hardware collection esay */ public interface WithUserDefinedPort<V> { /** * @return the user defined port, may be ""; never null */ String getUserDefinedPort(); }
package com.example.shivam.erpsystem; import android.content.Context; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ProgressBar; import android.widget.TextView; import java.util.List; public class PieChartAdapter extends RecyclerView.Adapter<PieChartAdapter.MyViewHolder> { private Context mContext; private List<ProgressModel> ProgressList; @NonNull @Override public MyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { View itemView = LayoutInflater.from(viewGroup.getContext()) .inflate(R.layout.piechart, viewGroup, false); return new MyViewHolder(itemView); } public PieChartAdapter(Context context,List<ProgressModel> progressList) { this.mContext=context; this.ProgressList=progressList; } @Override public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, int i) { ProgressModel progressModel=ProgressList.get(i); myViewHolder.paidamount.setProgress(progressModel.getPaidamount()); myViewHolder.pendingamount.setProgress(progressModel.getPendingamount()); myViewHolder.percentage.setText(progressModel.getPercentage()); } @Override public int getItemCount() { return ProgressList.size(); } public class MyViewHolder extends RecyclerView.ViewHolder { public TextView percentage; public ProgressBar paidamount,pendingamount; public MyViewHolder(View view) { super(view); paidamount = view.findViewById(R.id.stats_progressbar); pendingamount=view.findViewById(R.id.background_progressbar); percentage=view.findViewById(R.id.number_of_calories); } } }
package com.pfchoice.springboot.service; import java.util.List; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.domain.Specification; import com.pfchoice.springboot.model.CPTMeasure; public interface CPTMeasureService { CPTMeasure findById(Integer id); CPTMeasure findByCode(String code); CPTMeasure findByDescription(String description); void saveCPTMeasure(CPTMeasure cptMeasure); void updateCPTMeasure(CPTMeasure cptMeasure); void deleteCPTMeasureById(Integer id); void deleteAllCPTMeasures(); List<CPTMeasure> findAllCPTMeasures(); Page<CPTMeasure> findAllCPTMeasuresByPage(Specification<CPTMeasure> spec, Pageable pageable); boolean isCPTMeasureExist(CPTMeasure cptMeasure); }
/* * Copyright (c) 2018, Lawrence Livermore National Security, LLC. Produced at the Lawrence Livermore National Laboratory * CODE-743439. * All rights reserved. * This file is part of CCT. For details, see https://github.com/LLNL/coda-calibration-tool. * * Licensed under the Apache License, Version 2.0 (the “Licensee”); 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. * * This work was performed under the auspices of the U.S. Department of Energy * by Lawrence Livermore National Laboratory under Contract DE-AC52-07NA27344. */ package gov.llnl.gnem.apps.coda.calibration.application.web; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import gov.llnl.gnem.apps.coda.common.model.domain.Event; import gov.llnl.gnem.apps.coda.common.service.api.WaveformService; @RestController @RequestMapping(value = "/api/v1/events", name = "EventsJsonController", produces = MediaType.APPLICATION_JSON_VALUE) public class EventsJsonController { private WaveformService service; @Autowired public EventsJsonController(WaveformService service) { this.service = service; } @GetMapping(name = "getEvent", path = "events/{id}") public Event getEvent(@PathVariable("id") String eventId) { return service.findEventById(eventId); } }
package com.company.dog; public class Bison implements Dog{ @Override public void introduces() { System.out.println("비쇼오오오오오오오오옹오"); } }
package sortomatic; import java.awt.FlowLayout; import java.awt.event.MouseEvent; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; public class NuevoArticulo extends JFrame{ JLabel label1; JLabel label2; JLabel label3; JLabel label4; JLabel label5; JLabel label6; JComboBox comboBox1; JTextField field1; JTextField field2; JTextField field3; JTextField field4; JTextField field5; JTextField field6; JButton boton; private Libro libro; private Disco disco; private VHS vhs; private Otro otro; private Aparador temp; private String opcion; public NuevoArticulo(Disco disc, Aparador Contenedor){ setSize(150,300); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new FlowLayout()); setVisible(true); label1 = new JLabel("Alto"); label2 = new JLabel("Título"); label3 = new JLabel("Capacidad"); field1 = new JTextField(10); field2 = new JTextField(10); field3 = new JTextField(10); comboBox1 = new javax.swing.JComboBox<>(); comboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "CD", "DVD", "Blu-Ray"})); boton = new JButton("Agregar"); add(label1); add(field1); add(label2); add(field2); add(comboBox1); add(label3); add(field3); add(boton); opcion= "DVD"; temp = Contenedor; boton.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { botonMouseClick(evt); } }); } public NuevoArticulo(Libro lib, Aparador Contenedor){ setSize(150,400); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new FlowLayout()); setVisible(true); label1 = new JLabel("Ancho"); label2 = new JLabel("Alto"); label3 = new JLabel("Título"); label4 = new JLabel("ISBN"); label5 = new JLabel("Género"); label6 = new JLabel("Portada"); field1 = new JTextField(10); field2 = new JTextField(10); field3 = new JTextField(10); field4 = new JTextField(10); field5 = new JTextField(10); field6 = new JTextField(10); boton = new JButton("Agregar"); add(label1); add(field1); add(label2); add(field2); add(label3); add(field3); add(label4); add(field4); add(label5); add(field5); add(label6); add(field6); add(boton); opcion = "lib"; boton.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { botonMouseClick(evt); }}); } public NuevoArticulo(VHS vid, Aparador Contenedor){ setSize(150,310); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new FlowLayout()); setVisible(true); label1 = new JLabel("Alto"); label2 = new JLabel("Título"); label3 = new JLabel("Duración"); label4 = new JLabel("Estado"); label5 = new JLabel("Contenido"); field1 = new JTextField(10); field2 = new JTextField(10); field3 = new JTextField(10); field4 = new JTextField(10); field5 = new JTextField(10); boton = new JButton("Agregar"); add(label1); add(field1); add(label2); add(field2); add(label3); add(field3); add(label4); add(field4); add(label5); add(field5); add(boton); temp = Contenedor; opcion = "vhs"; boton.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { botonMouseClick(evt); } }); } public NuevoArticulo(Otro xeno, Aparador Contenedor){ setSize(150,300); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new FlowLayout()); setVisible(true); label1 = new JLabel("Ancho"); label2 = new JLabel("Alto"); label3 = new JLabel("Título"); label4 = new JLabel("Tipo"); label5 = new JLabel("Descripción"); field1 = new JTextField(10); field2 = new JTextField(10); field3 = new JTextField(10); field4 = new JTextField(10); field5 = new JTextField(10); boton = new JButton("Agregar"); add(label1); add(field1); add(label2); add(field2); add(label3); add(field3); add(label4); add(field4); add(label5); add(field5); add(boton); temp= Contenedor; opcion = "xeno"; boton.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { botonMouseClick(evt); } }); } private void botonMouseClick(MouseEvent evt) { try{ if (opcion.equals("DVD")){ disco = new Disco(1,1,1,"r","r"); disco.setAlto(Double.parseDouble( field1.getText() )); disco.setTitulo( field2.getText() ); disco.setTipo((String) comboBox1.getSelectedItem()); disco.setCapacidad( Double.parseDouble( field3.getText() ) ); temp.agregarArticulo(disco); }else if (opcion.equals("lib")){ libro = new Libro("1", "1", "1",1,1,"1","1"); libro.setAlto(Double.parseDouble(field2.getText())); libro.setAncho(Double.parseDouble(field1.getText())); libro.setTitulo(field3.getText()); libro.setISBN(field4.getText()); libro.setGenero(field5.getText()); libro.setPortada(field6.getText()); temp.agregarArticulo(libro); }else if (opcion.equals("vhs")){ vhs = new VHS("1", "1","1",1,1,"1","1"); vhs.setAlto(Double.parseDouble(field1.getText())); vhs.setTitulo(field2.getText()); vhs.setDuracion(field3.getText()); vhs.setEstado(field4.getText()); vhs.setContenido(field5.getText()); temp.agregarArticulo(vhs); }else if (opcion.equals("xeno")){ otro = new Otro("1",1,1,"1","1"); otro.setAncho(Double.parseDouble(field1.getText())); otro.setAlto(Double.parseDouble(field2.getText())); otro.setTitulo(field3.getText()); otro.setTipo(field4.getText()); otro.setDescripcion(field5.getText()); temp.agregarArticulo(otro); } AgregarArticulo vent; vent = new AgregarArticulo(temp); vent.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //determinar que hacer cuando se cierre la ventana vent.setSize(400,250); //tamaño ventana vent.setVisible(true); //hacer visible dispose(); }catch(Exception e){ System.err.println(e); } } }
package com.luhc.blog.utils; import java.util.Collections; import java.util.List; public class Paging { /** * 页的最大记录数,默认为10 */ private final static int DEFAULT_MAX_RECORD = 10; /** * 页码 */ private int pageNo = 1; /** * 页的最大记录数 */ private int maxResult = DEFAULT_MAX_RECORD; /** * 当前页记录 */ private List<?> results = Collections.EMPTY_LIST; /** * 总页数 */ private int totalCount; /** * 是否统计总页数 */ private boolean count = true; public Paging(int maxResult) { this.setPageNo(1); this.setMaxResult(maxResult); } public Paging(int pageNo, int maxResult) { this.setPageNo(pageNo); this.setMaxResult(maxResult); } public int getTotalCount() { return totalCount; } public List<?> getResults() { return results; } public void setResults(List<?> results) { this.results = results; } public void setPageNo(int pageNo) { this.pageNo = (pageNo < 1 ? 1 : pageNo); } public void setMaxResult(int maxResult) { this.maxResult = (maxResult < 0 ? 1 : maxResult); } public int getPageNo() { return pageNo; } public boolean hasPre() { if (pageNo == 1) { return false; } else { return true; } } public int getPrePageNo() { if (hasPre()) { return pageNo - 1; } else { return pageNo; } } public int getNextPageNo() { return 0; } public int getMaxResult() { return maxResult; } public boolean isCount() { return count; } public void setCount(boolean count) { this.count = count; } }
package edu.tsinghua.lumaqq.test; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import edu.tsinghua.lumaqq.ui.muf.MUFModel; import edu.tsinghua.lumaqq.ui.muf.MUFModule; public class MUFModule2 extends MUFModule { public MUFModule2(MUFModel model, String id) { super(model, id); } @Override public void createContent(Composite parent) { Button btn = new Button(parent, SWT.PUSH); GridData gd = new GridData(); gd.widthHint = 500; btn.setLayoutData(gd); btn.setText("Remove Module"); btn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { container.remove(getThis()); } }); } public MUFModule getThis() { return this; } }
package gd26.asteroids; import java.awt.*; /** * Bullet class * * Created by gdorwin26 on 3/30/2017. */ public class Bullet extends GameObject { public Bullet(Vec2D pos, double theta) { setPos(pos.copy()); setVel(new Vec2D(1, 0).rot(theta).mult(Properties.BULLET_SPEED)); } @Override public void update(double deltaTime) { super.update(deltaTime); for(Asteroid asteroid : AsteroidsMain.ASTEROIDS) { if(asteroid.checkCollision(getPos())) { asteroid.destroy(); AsteroidsMain.SCORE += 5; AsteroidsMain.BULLETS_TO_REMOVE.add(this); } } } public void render(Graphics g) { Graphics2D g2d = (Graphics2D) g.create(); g2d.translate((int) getPos().getX(), (int) getPos().getY()); g2d.setColor(new Color(32, 128, 255)); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.fillOval(0, 0, 5, 5); g2d.dispose(); } }
package hackchatbot; import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JTextArea; import javax.swing.JScrollPane; import javax.swing.JLabel; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JTextField; import java.awt.Color; public class ChatBot extends JFrame { private JPanel contentPane; public JTextArea Chatarea=new JTextArea(); public JTextField Chatbox=new JTextField(); public ChatBot() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 600, 600); contentPane = new JPanel(); contentPane.setBackground(new Color(173, 216, 230)); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(49, 75, 477, 313); contentPane.add(scrollPane); Chatarea.setFont(new Font("Courier New", Font.BOLD, 18)); scrollPane.setViewportView(Chatarea); JLabel lblNewLabel = new JLabel("Click to chat with Ibot"); lblNewLabel.setFont(new Font("Courier New", Font.BOLD, 20)); lblNewLabel.setBounds(49, 448, 312, 14); contentPane.add(lblNewLabel); Chatbox.setFont(new Font("Courier New", Font.BOLD, 15)); Chatbox.setBounds(49, 483, 477, 54); contentPane.add(Chatbox); Chatbox.setColumns(10); JLabel lblNewLabel_1 = new JLabel("Ibot "); lblNewLabel_1.setFont(new Font("Courier New", Font.BOLD, 19)); lblNewLabel_1.setBounds(218, 29, 90, 22); contentPane.add(lblNewLabel_1); Chatbox.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub String gtext=Chatbox.getText().toLowerCase(); Chatarea.append("YOU--->>" + gtext + "\n" ); Chatbox.setText(""); if(gtext.contains("hi")){ bot("Welcome! \nWhich service would you like to request for? \n1.Software request. \n2.IT accessories \n3.Data Card"); } else{ bot("I DON'T UNDERSTAND YOU"); } } }); } private void bot(String string){ Chatarea.append("BOT--->>" +string+ "\n"); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { ChatBot frame = new ChatBot(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } }
package com.ojas.employee.service; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; import com.ojas.employee.model.CustomUserDetails; import com.ojas.employee.model.Employee; import com.ojas.employee.repository.EmployeeRepository; @Service public class CustomUserDetailsService implements UserDetailsService { @Autowired EmployeeRepository employeeRepository; @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { Optional<Employee> findByName = employeeRepository.findByName(username); if (findByName.isPresent()) { return new CustomUserDetails(findByName.get()); } else throw new UsernameNotFoundException("User Not Found!!!!"); } }
/* * UniTime 3.5 (University Timetabling Application) * Copyright (C) 2014, UniTime LLC, and individual contributors * as indicated by the @authors tag. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. * */ package org.unitime.timetable.gwt.client.widgets; import com.google.gwt.event.shared.GwtEvent; import com.google.gwt.event.shared.HasHandlers; /** * @author Tomas Muller */ public class CourseSelectionEvent extends GwtEvent<CourseSelectionHandler> { static Type<CourseSelectionHandler> TYPE = new Type<CourseSelectionHandler>(); private String iCourse; private boolean iValid; public CourseSelectionEvent(String course, boolean valid) { iCourse = course; iValid = valid; } public boolean isValid() { return iValid; } public String getCourse() { return iCourse; } @Override public Type<CourseSelectionHandler> getAssociatedType() { return TYPE; } public static Type<CourseSelectionHandler> getType() { return TYPE; } @Override protected void dispatch(CourseSelectionHandler handler) { handler.onCourseSelection(this); } public static void fire(HasHandlers source, String course, boolean valid) { source.fireEvent(new CourseSelectionEvent(course, valid)); } }
package gr.athena.innovation.fagi; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.*; /** * * @author nkarag */ public class FagiInstanceTest { public FagiInstanceTest() { } @BeforeClass public static void setUpClass() { try { Path leftDatasetPath = Files.createTempFile("left", ".nt"); Path rightDatasetPath = Files.createTempFile("right", ".nt"); Path linksPath = Files.createTempFile("links", ".nt"); Path config = Files.createTempFile("config", ".xml"); Path rules = Files.createTempFile("rules", ".xml"); } catch (IOException ex) { Logger.getLogger(FagiInstanceTest.class.getName()).log(Level.SEVERE, null, ex); } } @AfterClass public static void tearDownClass() { } @Before public void setUp() { } @After public void tearDown() { } /** * Test of run method, of class FagiInstance. */ @Test public void testRun() throws Exception { System.out.println("run"); //FagiInstance instance = new FagiInstance(); //instance.run(); // TODO review the generated test code and remove the default call to fail. ///fail("The test case is a prototype."); } /** * Test of computeStatistics method, of class FagiInstance. */ @Test public void testComputeStatistics() throws Exception { // System.out.println("computeStatistics"); // List<String> selected = null; // FagiInstance instance = null; // String expResult = ""; // String result = instance.computeStatistics(selected); // assertEquals(expResult, result); // TODO review the generated test code and remove the default call to fail. //fail("The test case is a prototype."); } }
import com.mayhew3.postgresobject.dataobject.DataSchema; import com.mayhew3.postgresobject.db.DatabaseEnvironment; import com.mayhew3.postgresobject.model.PostgresSchemaTest; import com.mayhew3.taskmaster.TaskMasterSchema; import com.mayhew3.taskmaster.db.DatabaseEnvironments; public class SchemaLocalTest extends PostgresSchemaTest { @Override public DataSchema getDataSchema() { return TaskMasterSchema.schema; } @Override public DatabaseEnvironment getDatabaseEnvironment() { return DatabaseEnvironments.environments.get("local"); } }
package bootcamp.test.tables; import org.openqa.selenium.WebDriver; import bootcamp.selenium.basic.LaunchBrowser; public class DynamicTable { public static void main(String[] args) { WebDriver driver = LaunchBrowser.launch("https://money.rediff.com/gainers/bse/monthly/groupall"); // rest implementation is same as Static Table } }
package org.sagebionetworks.repo.model.jdo; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Aspect; /** * This aspect allows us to check if the connection pool is being used as expected. * @author jmhill * */ @Aspect public class ConnectionPoolLogger { private static final Logger log = LogManager.getLogger(ConnectionPoolLogger.class .getName()); /** * Watch everything from the org.apache.commons.dbcp.BasicDataSource which we * are using as a connection pool. * @param pjp * @return * @throws Throwable */ // @Around("execution(* org.apache.commons.dbcp2..*.*(..))") public Object doBasicProfiling(ProceedingJoinPoint pjp) throws Throwable { if(log.isDebugEnabled()){ // log.debug(pjp.getSignature()); } return pjp.proceed(); } }
package com.tencent.mm.plugin.ac; import com.tencent.mm.bt.h.d; import com.tencent.mm.pluginsdk.model.app.i; class a$3 implements d { a$3() { } public final String[] xb() { return i.diD; } }
/* * [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.commercefacades.order.converters.populator; import de.hybris.platform.commercefacades.quote.data.QuoteData; import de.hybris.platform.commerceservices.order.CommerceOrderService; import de.hybris.platform.core.model.order.OrderModel; import de.hybris.platform.core.model.order.QuoteModel; import org.springframework.beans.factory.annotation.Required; import org.springframework.util.Assert; public class QuotePopulator extends AbstractOrderPopulator<QuoteModel, QuoteData> { private CommerceOrderService commerceOrderService; @Override public void populate(final QuoteModel source, final QuoteData target) { Assert.notNull(source, "Parameter source cannot be null."); Assert.notNull(target, "Parameter target cannot be null."); addCommon(source, target); addDetails(source, target); addTotals(source, target); addEntries(source, target); addPromotions(source, target); addComments(source, target); addQuoteInfo(source, target); target.setHasCart(Boolean.valueOf(source.getCartReference() != null)); } protected void addQuoteInfo(final QuoteModel source, final QuoteData target) { final OrderModel orderFromQuote = getCommerceOrderService().getOrderForQuote(source); if (orderFromQuote != null) { target.setOrderCode(orderFromQuote.getCode()); } } protected void addDetails(final QuoteModel source, final QuoteData target) { target.setCode(source.getCode()); target.setVersion(source.getVersion()); target.setExpirationTime(source.getExpirationTime()); target.setState(source.getState()); target.setCreationTime(source.getCreationtime()); target.setUpdatedTime(source.getModifiedtime()); target.setPreviousEstimatedTotal(createPrice(source, source.getPreviousEstimatedTotal())); } protected CommerceOrderService getCommerceOrderService() { return commerceOrderService; } @Required public void setCommerceOrderService(final CommerceOrderService commerceOrderService) { this.commerceOrderService = commerceOrderService; } }
package com.test.data.domain; import com.fasterxml.jackson.annotation.JsonIgnore; import org.neo4j.ogm.annotation.GraphId; import org.neo4j.ogm.annotation.NodeEntity; import org.neo4j.ogm.annotation.Relationship; import org.neo4j.ogm.annotation.typeconversion.DateLong; import org.springframework.format.annotation.DateTimeFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; @NodeEntity public class User { @GraphId private Long id; private String name; private String email; private Integer sex; @DateLong @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date create; @JsonIgnore @Relationship(type="拥有") List<Owner> owners = new ArrayList<>(); @JsonIgnore @Relationship(type = "隶属", direction = Relationship.INCOMING) Belong belong; public User() { } public Owner addOwner(Role role, String name){ Owner owner = new Owner(this, role, name); this.owners.add(owner); return owner; } public Belong beBelong(Unit unit, String name){ Belong belong = new Belong(name, unit, this); this.belong = belong; return belong; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public Integer getSex() { return sex; } public void setSex(Integer sex) { this.sex = sex; } public Date getCreate() { return create; } public void setCreate(Date create) { this.create = create; } public List<Owner> getOwners() { return owners; } public void setOwners(List<Owner> owners) { this.owners = owners; } public Belong getBelong() { return belong; } public void setBelong(Belong belong) { this.belong = belong; } }
package viewmodel; import android.databinding.BaseObservable; import android.databinding.BindingAdapter; import android.widget.ImageView; import model.Day; import utils.Utility; public class ItemDayViewModel extends BaseObservable { private Day day; private String imageUri; private String dateDayNumber; private String dateDayText; private String tempMorn; private String tempDay; private String tempEve; private String tempNight; private String main; public ItemDayViewModel(Day day) { this.day = day; } public String getDateDayNumber() { dateDayNumber = Utility.getTypeDateUnit(day.dt, Utility.DAY_NUMBER); String dateMonthNumber = Utility.getTypeDateUnit(day.dt, Utility.MONTH_NUMBER); return dateDayNumber+"/"+dateMonthNumber; } public String getDateDayText() { dateDayText = Utility.getTypeDateUnit(day.dt, Utility.DAY_TEXT); return dateDayText; } public String getMain() { main = day.weathers.get(0).main; return main; } public String getTempDay() { tempDay = ((int)day.temperatures.day)+ "°"; return tempDay; } public String getTempEve() { tempEve = ((int)day.temperatures.eve)+ "°"; return tempEve; } public String getTempMorn() { tempMorn = ((int)day.temperatures.morn)+ "°"; return tempMorn; } public String getTempNight() { tempNight = ((int)day.temperatures.night)+ "°"; return tempNight; } public String getImageUri() { imageUri = day.weathers.get(0).icon; return imageUri; } @BindingAdapter("android:background") public static void loadImage(ImageView view, String imageUri){ // view.setImageDrawable(Utility.getIcon(view.getContext(), imageUri)); } }
package com.smxknife.mybatis._04_shardingjdbc.algorithm; import com.google.common.collect.Range; import org.apache.shardingsphere.api.sharding.standard.PreciseShardingAlgorithm; import org.apache.shardingsphere.api.sharding.standard.PreciseShardingValue; import org.apache.shardingsphere.api.sharding.standard.RangeShardingAlgorithm; import org.apache.shardingsphere.api.sharding.standard.RangeShardingValue; import java.util.Collection; /** * 一致性hash * @author smxknife * 2021/6/28 */ public class ConsistentShardingAlgorithm implements PreciseShardingAlgorithm<Long>, RangeShardingAlgorithm<Long> { private ConsistentHashAlgorithm hashAlgorithm; public ConsistentShardingAlgorithm(ConsistentHashAlgorithm hashAlgorithm) { this.hashAlgorithm = hashAlgorithm; } @Override public String doSharding(Collection<String> availableTargetNames, PreciseShardingValue<Long> preciseShardingValue) { if (availableTargetNames.isEmpty()) { return preciseShardingValue.getLogicTableName(); } return hashAlgorithm.getTableNode(preciseShardingValue.getValue().toString()); } @Override public Collection<String> doSharding(Collection<String> availableTargetNames, RangeShardingValue<Long> rangeShardingValue) { if (availableTargetNames.isEmpty()) { return availableTargetNames; } final Range<Long> valueRange = rangeShardingValue.getValueRange(); return null; } }
package pe.egcc.pagoapp.service; import java.math.BigDecimal; import java.math.RoundingMode; import pe.egcc.pagoapp.dto.PagoDto; public class PagoService { public PagoDto calcularPago(PagoDto dto){ //variables double ingresos, renta = 0.0, neto; //proceso ingresos = dto.getHorasDia() * dto.getDias() * dto.getPagoHora(); if (ingresos > 1500.0 ){ renta = ingresos * 0.008; } neto = ingresos - renta; //reporte dto.setIngresos(RedondeaDecimal(ingresos)); dto.setRenta(RedondeaDecimal(renta)); dto.setNeto(RedondeaDecimal(neto)); return dto; } public double RedondeaDecimal (double valor) { BigDecimal bd = new BigDecimal(valor); bd = bd.setScale(2, RoundingMode.UP); return bd.doubleValue(); } }