text
stringlengths
10
2.72M
package com.example.repository; import com.example.model.Student; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; /** * Created by wangqi on 18/4/3. */ @Repository public interface UserRepository extends CrudRepository<Student,Long> { Student findById(int id); }
package com.smartwerkz.bytecode.vm; import com.smartwerkz.bytecode.CodeDumper.Opcode; public interface ExecutionListener { void notifyFrameEntry(Frame frame); void notifyBeforeInterpret(Frame frame); void notifyBeforeOpcodeExecution(Frame frame, Opcode opCodeDesc); void notifyAfterInterpret(Frame frame, String opCode); void notifyFrameExit(Frame frame); }
package com.angelboxes.springboot.springbootapi.jpa; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.stereotype.Component; @Component public class UserCommandLineRunner implements CommandLineRunner { private static final Logger logger = LoggerFactory.getLogger(UserCommandLineRunner.class); @Autowired private UserRepository userRepository; @Override public void run(String... args) throws Exception { userRepository.save(new User("Ralph", "Admin")); userRepository.save(new User("Ringo", "User")); userRepository.save(new User("Paul", "User")); userRepository.save(new User("John", "Admin")); for (User user : userRepository.findAll()) { logger.info(user.toString()); } for (User user : userRepository.findByRole("Admin")) { logger.info(user.toString()); } } }
/* * 회원 탈퇴 */ package com.example.test; import java.io.File; import java.io.IOException; import java.lang.ref.WeakReference; import java.net.Socket; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.graphics.Typeface; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.Toast; public class removeid extends Activity { String id,pw; Socket client; Thread thread; LoginThread loginThread; private final RemoveIDHandler RIDhandler=new RemoveIDHandler(this); private static class RemoveIDHandler extends Handler{ private final WeakReference<removeid> aActivity; public RemoveIDHandler(removeid activity){ aActivity = new WeakReference<removeid>(activity); } @Override public void handleMessage(Message msg){ removeid activity=aActivity.get(); if(activity!=null){ activity.handleMessage(msg); } } } private void handleMessage(Message msg){ Bundle bundle = msg.getData(); int result=bundle.getInt("result"); if(result==1){ try { client.close(); } catch (IOException e) { e.printStackTrace(); } File myfile=getDir("myfile", Context.MODE_PRIVATE); String path= myfile.getAbsolutePath(); File file=new File(path+"/flag.txt"); file.delete(); Toast.makeText(getApplicationContext(), "탈퇴가 완료 되었습니다.", Toast.LENGTH_SHORT).show(); Intent intent=new Intent(getApplicationContext(), login.class); startActivity(intent);//첫 화면으로 }//탈퇴 완료 else if(result==2){ try { client.close(); } catch (IOException e) { e.printStackTrace(); } Toast.makeText(getApplicationContext(), "회원 정보가 맞지 않습니다.", Toast.LENGTH_SHORT).show(); }//회원 정보 오류 } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.removeid); MainActivity ma=new MainActivity(); Typeface mTypeface=Typeface.createFromAsset(getAssets(), "fonts/hun.ttf"); ViewGroup root = (ViewGroup) findViewById(android.R.id.content); ma.setGlobalFont(root,mTypeface); Intent intent_01 = getIntent(); id = intent_01.getStringExtra("아이디"); } public void removeidnot(View v){ Intent intent=new Intent(getApplicationContext(), Settingmain.class); intent.putExtra("아이디", id); startActivity(intent); }//돌아가기 public void removeidgo(View v){ EditText text_id = (EditText) findViewById(R.id.userEntry); EditText text_pw = (EditText) findViewById(R.id.passwordEntry); id = text_id.getText().toString(); pw = text_pw.getText().toString(); if(id.contains("/")==true) Toast.makeText(getApplicationContext(), "/는 들어가면 안되요.", Toast.LENGTH_SHORT).show(); if(id.length()>15){ Toast.makeText(getApplicationContext(), "아이디가 너무 길어요", Toast.LENGTH_SHORT).show(); //아이디가 너무 길때 경고메시지 } else if(id.length()<1){ Toast.makeText(getApplicationContext(), "아이디를 입력하세요", Toast.LENGTH_SHORT).show(); //아무것도 안 입력했을때 경고메시지 } if(pw.contains("/")==true) Toast.makeText(getApplicationContext(), "/는 들어가면 안되요.", Toast.LENGTH_SHORT).show(); if(pw.length()>15){ Toast.makeText(getApplicationContext(), "비밀번호가 너무 길어요", Toast.LENGTH_SHORT).show(); //비번이 길때 경고메시지 } else if(pw.length()<1){ Toast.makeText(getApplicationContext(), "비밀번호를 입력하세요", Toast.LENGTH_SHORT).show(); //아무것도 안 입력했을때 경고메시지 } else if(id.length()<=15&&id.length()>0 && id.contains("/")==false && pw.contains("/")==false){ thread = new Thread(){ public void run() { super.run(); SocketService s=new SocketService(); client = s.getsocket(); loginThread = new LoginThread(client, RIDhandler, id, pw,2); loginThread.start(); } }; thread.start(); } }//탈퇴 public void home(View v) { Intent intent=new Intent(getApplicationContext(), Mainselect.class); intent.putExtra("아이디", id); startActivity(intent); } public void setting(View v) { Intent intent=new Intent(getApplicationContext(), Settingmain.class); intent.putExtra("아이디", id); startActivity(intent); } }
package polydungeons.loot; import net.fabricmc.fabric.api.loot.v1.FabricLootPoolBuilder; import net.fabricmc.fabric.api.loot.v1.event.LootTableLoadingCallback; import net.minecraft.item.Items; import net.minecraft.loot.BinomialLootTableRange; import net.minecraft.loot.entry.ItemEntry; import net.minecraft.loot.function.ExplorationMapLootFunction; import net.minecraft.util.Identifier; import polydungeons.structures.DungeonData; public class PolyDungeonsLootTables { // Adding to Minecraft ones private static final Identifier FORTRESS = new Identifier("minecraft", "chests/nether_bridge"); public static void registerAll() { LootTableLoadingCallback.EVENT.register((resourceManager, lootManager, id, supplier, setter) -> { if(FORTRESS.equals(id)) { FabricLootPoolBuilder builder = FabricLootPoolBuilder.builder() .rolls(BinomialLootTableRange.create(1, 0.1f)) .withEntry(ItemEntry.builder(Items.MAP).build()) .withFunction(ExplorationMapLootFunction.create().withDestination(DungeonData.NETHER_DUNGEON).build()); supplier.pool(builder); } }); } }
package spring.learning.es.helper; import java.io.File; import java.io.IOException; import java.nio.file.Files; import org.springframework.core.io.ClassPathResource; import lombok.extern.slf4j.Slf4j; @Slf4j public class Utils { public static String loadAsString(final String path) { try { final File resource = new ClassPathResource(path).getFile(); return new String(Files.readAllBytes(resource.toPath())); } catch (IOException e) { log.error(e.getMessage(), e); return null; } } }
package com.example.asyncimageloader; public class Images { public final static String[] imageThumbUrls = new String[] { "http://i1.3conline.com/images/piclib/201008/09/batch/1/66486/1281325726830ll4gij1u7g_medium.jpg", "http://pic24.nipic.com/20120925/11030808_111735236178_2.jpg", "http://wenwen.soso.com/p/20111108/20111108161721-792362291.jpg", "http://p0.so.qhimg.com/t015df39cf4e1db3d1a.jpg", "http://news.replays.net/Uploads/photo/20110706/201107061228219592.jpg", "http://img5.pcpop.com/ArticleImages/0X0/2/2088/002088166.jpg", "http://wenwen.soso.com/p/20110829/20110829165504-166059321.jpg", "http://p4.so.qhimg.com/t011778013f9f96705e.jpg", "http://pic24.nipic.com/20120925/10730208_113016648100_2.jpg", "http://p6.zbjimg.com/task/2013-06/15/works/large51bbf629dcc32.jpg", "http://i5.3conline.com/images/piclib/201008/09/batch/1/66486/12813257268309sun0b02s1_medium.jpg", "http://img.131.com/www/2010/05/24/2010052417452574f.jpg", "http://img1.pcgames.com.cn/pcgames/1008/01/1966316_2_thumb.jpg", "http://img1.3lian.com/img2012/2/0206/2/d/58.jpg", "http://www.mpt8.cn/jdbz/UploadSoftPic/201402/mpt8_2014021123352564.jpg", "http://img3.3lian.com/2013/v15/59/d/54.jpg", "http://img.hb.aicdn.com/44bce7f0b9ad0ce21ff700a8b50c2bdbda56f14b52dfc-aAgU3B_fw580", "http://pic26.nipic.com/20130114/11350592_161130223000_2.jpg", "http://img04.tooopen.com/images/20131111/sy_46657541952.jpg", "http://img5.pcpop.com/ArticleImages/0X0/2/2092/002092610.jpg", "http://img6.faloo.com/Picture/0x0/0/317/317038.jpg", "http://img5.pcpop.com/ArticleImages/0X0/1/1995/001995606.jpg", "http://p6.zbjimg.com/task/2013-04/15/works/large516bfe61145e4.jpg", "http://img1.3lian.com/img2012/2/0206/2/d/56.jpg", "http://www.ok3w.net/upfiles/tupian/m/b4cdec542a04d652.jpg", "http://imga1.pic21.com/bizhi/140222/07774/s02.jpg", "http://img6.faloo.com/Picture/0x0/0/317/317001.jpg", "http://img.hb.aicdn.com/e06456d6efbe105408a224b08159738124b2b0814b401-p7QQlM_fw580", "http://img1.tgbusdata.cn/v2/thumb/jpg/ODYxYywwLDAsNCwzLDEsLTEsMCxyazUw/u/olpic.tgbusdata.cn/uploads/allimg/121115/62-121115131456.jpg", "http://www.qqtn.com/file/2012/2012-2/2012022511050086751.jpg", "http://img6.faloo.com/Picture/0x0/0/317/317040.jpg", "http://img.kumi.cn/photo/c3/66/94/c366940a61a79ddf.jpg", "http://tupian.enterdesk.com/2014/mxy/02/13/1/1.jpg.680.510.jpg", "http://s3.img.766.com/180/101230/1102/552867.jpg", "http://imga1.pic21.com/bizhi/140222/07774/s25.jpg", "http://www.qqtn.com/file/2012/2012-2/2012022511050064053.jpg", "http://www.qqtn.com/file/2012/2012-2/2012022511045861944.jpg", "http://img.131.com/www/2011/02/28/201102281202283bc.jpg", "http://s.doyo.cn/img/50/da/a3cd9e9e787c3700005f.jpg", "http://imga1.pic21.com/bizhi/140222/07774/s15.jpg", "http://imga1.pic21.com/bizhi/140222/07774/s04.jpg", "http://att.bbs.duowan.com/forum/201307/09/163600ozo4te41lko4qk4f.jpg", "http://pic29.nipic.com/20130515/12728413_140247643137_2.jpg", "http://www.qqtn.com/file/2012/2012-2/2012022511045114824.jpg", "http://www.qqtn.com/file/2012/2012-2/2012022511050048168.jpg", "http://www.qqtn.com/file/2012/2012-2/2012022511045414111.jpg", "http://res.5652.com/uploads/news/2012717/b22a12f51c17bc84e53076556d7862ac.JPG", "http://www.qqtn.com/file/2012/2012-2/2012022511045953250.jpg", "http://k.zol-img.com.cn/sjbbs/7342/a7341036_s.jpg", "http://imga1.pic21.com/bizhi/140115/06620/s11.jpg", "http://www.qqtn.com/file/2012/2012-2/2012022511045518779.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383299_1976.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383291_6518.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383291_8239.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383290_9329.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383290_1042.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383275_3977.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383265_8550.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383264_3954.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383264_4787.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383264_8243.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383248_3693.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383243_5120.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383242_3127.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383242_9576.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383242_1721.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383219_5806.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383214_7794.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383213_4418.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383213_3557.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383210_8779.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383172_4577.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383166_3407.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383166_2224.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383166_7301.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383165_7197.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383150_8410.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383131_3736.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383130_5094.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383130_7393.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383129_8813.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383100_3554.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383093_7894.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383092_2432.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383092_3071.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383091_3119.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383059_6589.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383059_8814.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383059_2237.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383058_4330.jpg", "http://img.my.csdn.net/uploads/201407/26/1406383038_3602.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382942_3079.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382942_8125.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382942_4881.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382941_4559.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382941_3845.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382924_8955.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382923_2141.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382923_8437.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382922_6166.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382922_4843.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382905_5804.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382904_3362.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382904_2312.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382904_4960.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382900_2418.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382881_4490.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382881_5935.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382880_3865.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382880_4662.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382879_2553.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382862_5375.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382862_1748.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382861_7618.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382861_8606.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382861_8949.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382841_9821.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382840_6603.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382840_2405.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382840_6354.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382839_5779.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382810_7578.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382810_2436.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382809_3883.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382809_6269.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382808_4179.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382790_8326.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382789_7174.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382789_5170.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382789_4118.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382788_9532.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382767_3184.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382767_4772.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382766_4924.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382766_5762.jpg", "http://img.my.csdn.net/uploads/201407/26/1406382765_7341.jpg" }; }
class Solution { public String countAndSay(int n) { String s="1";//初始化 for(int i=1;i<n;i++) { s=change(s);//循环下去 } return s; } static String change(String s)//对于一个输入的序列得到下一个序列 { StringBuilder res=new StringBuilder(); int length=s.length(); int count=1; char temp1=s.charAt(0); for (int i=1;i<length;i++) { if(s.charAt(i)==temp1)//判断相同计数 count++; else//判断不同,缓存 { res.append(count); res.append(temp1); temp1=s.charAt(i); count=1; } } res.append(count);//当长度为1和最后一位的数据存入缓存 res.append(temp1); return res.toString(); } }
/* * Created by JFormDesigner on Wed Sep 15 12:07:57 CEST 2010 */ package org.pmedv.core.components; import java.awt.event.*; import java.util.ResourceBundle; import javax.swing.*; import com.jgoodies.forms.layout.*; import org.jdesktop.swingx.*; /** * @author Matthias Pueski */ public class FilterPanel extends JPanel { private static final long serialVersionUID = 5616053764681382891L; public FilterPanel() { initComponents(); } private void initComponents() { ResourceBundle bundle = ResourceBundle.getBundle("org.pmedv.core.MessageResources"); // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents filterTextField = new JXSearchField(); CellConstraints cc = new CellConstraints(); //======== this ======== setLayout(new FormLayout( "131px:grow", "$lgap, default")); //---- filterTextField ---- filterTextField.setPrompt("Filter"); add(filterTextField, cc.xy(1, 2)); // JFormDesigner - End of component initialization //GEN-END:initComponents } // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables private JXSearchField filterTextField; // JFormDesigner - End of variables declaration //GEN-END:variables public JXSearchField getFilterTextField() { return filterTextField; } }
package com.lin.paper.pojo; import java.util.ArrayList; import java.util.Date; import java.util.List; public class PSubjectExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public PSubjectExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andSubjectidIsNull() { addCriterion("subjectId is null"); return (Criteria) this; } public Criteria andSubjectidIsNotNull() { addCriterion("subjectId is not null"); return (Criteria) this; } public Criteria andSubjectidEqualTo(String value) { addCriterion("subjectId =", value, "subjectid"); return (Criteria) this; } public Criteria andSubjectidNotEqualTo(String value) { addCriterion("subjectId <>", value, "subjectid"); return (Criteria) this; } public Criteria andSubjectidGreaterThan(String value) { addCriterion("subjectId >", value, "subjectid"); return (Criteria) this; } public Criteria andSubjectidGreaterThanOrEqualTo(String value) { addCriterion("subjectId >=", value, "subjectid"); return (Criteria) this; } public Criteria andSubjectidLessThan(String value) { addCriterion("subjectId <", value, "subjectid"); return (Criteria) this; } public Criteria andSubjectidLessThanOrEqualTo(String value) { addCriterion("subjectId <=", value, "subjectid"); return (Criteria) this; } public Criteria andSubjectidLike(String value) { addCriterion("subjectId like", value, "subjectid"); return (Criteria) this; } public Criteria andSubjectidNotLike(String value) { addCriterion("subjectId not like", value, "subjectid"); return (Criteria) this; } public Criteria andSubjectidIn(List<String> values) { addCriterion("subjectId in", values, "subjectid"); return (Criteria) this; } public Criteria andSubjectidNotIn(List<String> values) { addCriterion("subjectId not in", values, "subjectid"); return (Criteria) this; } public Criteria andSubjectidBetween(String value1, String value2) { addCriterion("subjectId between", value1, value2, "subjectid"); return (Criteria) this; } public Criteria andSubjectidNotBetween(String value1, String value2) { addCriterion("subjectId not between", value1, value2, "subjectid"); return (Criteria) this; } public Criteria andTeachidIsNull() { addCriterion("teachId is null"); return (Criteria) this; } public Criteria andTeachidIsNotNull() { addCriterion("teachId is not null"); return (Criteria) this; } public Criteria andTeachidEqualTo(String value) { addCriterion("teachId =", value, "teachid"); return (Criteria) this; } public Criteria andTeachidNotEqualTo(String value) { addCriterion("teachId <>", value, "teachid"); return (Criteria) this; } public Criteria andTeachidGreaterThan(String value) { addCriterion("teachId >", value, "teachid"); return (Criteria) this; } public Criteria andTeachidGreaterThanOrEqualTo(String value) { addCriterion("teachId >=", value, "teachid"); return (Criteria) this; } public Criteria andTeachidLessThan(String value) { addCriterion("teachId <", value, "teachid"); return (Criteria) this; } public Criteria andTeachidLessThanOrEqualTo(String value) { addCriterion("teachId <=", value, "teachid"); return (Criteria) this; } public Criteria andTeachidLike(String value) { addCriterion("teachId like", value, "teachid"); return (Criteria) this; } public Criteria andTeachidNotLike(String value) { addCriterion("teachId not like", value, "teachid"); return (Criteria) this; } public Criteria andTeachidIn(List<String> values) { addCriterion("teachId in", values, "teachid"); return (Criteria) this; } public Criteria andTeachidNotIn(List<String> values) { addCriterion("teachId not in", values, "teachid"); return (Criteria) this; } public Criteria andTeachidBetween(String value1, String value2) { addCriterion("teachId between", value1, value2, "teachid"); return (Criteria) this; } public Criteria andTeachidNotBetween(String value1, String value2) { addCriterion("teachId not between", value1, value2, "teachid"); return (Criteria) this; } public Criteria andSubjectnameIsNull() { addCriterion("subjectName is null"); return (Criteria) this; } public Criteria andSubjectnameIsNotNull() { addCriterion("subjectName is not null"); return (Criteria) this; } public Criteria andSubjectnameEqualTo(String value) { addCriterion("subjectName =", value, "subjectname"); return (Criteria) this; } public Criteria andSubjectnameNotEqualTo(String value) { addCriterion("subjectName <>", value, "subjectname"); return (Criteria) this; } public Criteria andSubjectnameGreaterThan(String value) { addCriterion("subjectName >", value, "subjectname"); return (Criteria) this; } public Criteria andSubjectnameGreaterThanOrEqualTo(String value) { addCriterion("subjectName >=", value, "subjectname"); return (Criteria) this; } public Criteria andSubjectnameLessThan(String value) { addCriterion("subjectName <", value, "subjectname"); return (Criteria) this; } public Criteria andSubjectnameLessThanOrEqualTo(String value) { addCriterion("subjectName <=", value, "subjectname"); return (Criteria) this; } public Criteria andSubjectnameLike(String value) { addCriterion("subjectName like", value, "subjectname"); return (Criteria) this; } public Criteria andSubjectnameNotLike(String value) { addCriterion("subjectName not like", value, "subjectname"); return (Criteria) this; } public Criteria andSubjectnameIn(List<String> values) { addCriterion("subjectName in", values, "subjectname"); return (Criteria) this; } public Criteria andSubjectnameNotIn(List<String> values) { addCriterion("subjectName not in", values, "subjectname"); return (Criteria) this; } public Criteria andSubjectnameBetween(String value1, String value2) { addCriterion("subjectName between", value1, value2, "subjectname"); return (Criteria) this; } public Criteria andSubjectnameNotBetween(String value1, String value2) { addCriterion("subjectName not between", value1, value2, "subjectname"); return (Criteria) this; } public Criteria andSubjecttypeIsNull() { addCriterion("subjectType is null"); return (Criteria) this; } public Criteria andSubjecttypeIsNotNull() { addCriterion("subjectType is not null"); return (Criteria) this; } public Criteria andSubjecttypeEqualTo(String value) { addCriterion("subjectType =", value, "subjecttype"); return (Criteria) this; } public Criteria andSubjecttypeNotEqualTo(String value) { addCriterion("subjectType <>", value, "subjecttype"); return (Criteria) this; } public Criteria andSubjecttypeGreaterThan(String value) { addCriterion("subjectType >", value, "subjecttype"); return (Criteria) this; } public Criteria andSubjecttypeGreaterThanOrEqualTo(String value) { addCriterion("subjectType >=", value, "subjecttype"); return (Criteria) this; } public Criteria andSubjecttypeLessThan(String value) { addCriterion("subjectType <", value, "subjecttype"); return (Criteria) this; } public Criteria andSubjecttypeLessThanOrEqualTo(String value) { addCriterion("subjectType <=", value, "subjecttype"); return (Criteria) this; } public Criteria andSubjecttypeLike(String value) { addCriterion("subjectType like", value, "subjecttype"); return (Criteria) this; } public Criteria andSubjecttypeNotLike(String value) { addCriterion("subjectType not like", value, "subjecttype"); return (Criteria) this; } public Criteria andSubjecttypeIn(List<String> values) { addCriterion("subjectType in", values, "subjecttype"); return (Criteria) this; } public Criteria andSubjecttypeNotIn(List<String> values) { addCriterion("subjectType not in", values, "subjecttype"); return (Criteria) this; } public Criteria andSubjecttypeBetween(String value1, String value2) { addCriterion("subjectType between", value1, value2, "subjecttype"); return (Criteria) this; } public Criteria andSubjecttypeNotBetween(String value1, String value2) { addCriterion("subjectType not between", value1, value2, "subjecttype"); return (Criteria) this; } public Criteria andSubjectstateIsNull() { addCriterion("subjectState is null"); return (Criteria) this; } public Criteria andSubjectstateIsNotNull() { addCriterion("subjectState is not null"); return (Criteria) this; } public Criteria andSubjectstateEqualTo(Integer value) { addCriterion("subjectState =", value, "subjectstate"); return (Criteria) this; } public Criteria andSubjectstateNotEqualTo(Integer value) { addCriterion("subjectState <>", value, "subjectstate"); return (Criteria) this; } public Criteria andSubjectstateGreaterThan(Integer value) { addCriterion("subjectState >", value, "subjectstate"); return (Criteria) this; } public Criteria andSubjectstateGreaterThanOrEqualTo(Integer value) { addCriterion("subjectState >=", value, "subjectstate"); return (Criteria) this; } public Criteria andSubjectstateLessThan(Integer value) { addCriterion("subjectState <", value, "subjectstate"); return (Criteria) this; } public Criteria andSubjectstateLessThanOrEqualTo(Integer value) { addCriterion("subjectState <=", value, "subjectstate"); return (Criteria) this; } public Criteria andSubjectstateIn(List<Integer> values) { addCriterion("subjectState in", values, "subjectstate"); return (Criteria) this; } public Criteria andSubjectstateNotIn(List<Integer> values) { addCriterion("subjectState not in", values, "subjectstate"); return (Criteria) this; } public Criteria andSubjectstateBetween(Integer value1, Integer value2) { addCriterion("subjectState between", value1, value2, "subjectstate"); return (Criteria) this; } public Criteria andSubjectstateNotBetween(Integer value1, Integer value2) { addCriterion("subjectState not between", value1, value2, "subjectstate"); return (Criteria) this; } public Criteria andCreateuserIsNull() { addCriterion("createUser is null"); return (Criteria) this; } public Criteria andCreateuserIsNotNull() { addCriterion("createUser is not null"); return (Criteria) this; } public Criteria andCreateuserEqualTo(String value) { addCriterion("createUser =", value, "createuser"); return (Criteria) this; } public Criteria andCreateuserNotEqualTo(String value) { addCriterion("createUser <>", value, "createuser"); return (Criteria) this; } public Criteria andCreateuserGreaterThan(String value) { addCriterion("createUser >", value, "createuser"); return (Criteria) this; } public Criteria andCreateuserGreaterThanOrEqualTo(String value) { addCriterion("createUser >=", value, "createuser"); return (Criteria) this; } public Criteria andCreateuserLessThan(String value) { addCriterion("createUser <", value, "createuser"); return (Criteria) this; } public Criteria andCreateuserLessThanOrEqualTo(String value) { addCriterion("createUser <=", value, "createuser"); return (Criteria) this; } public Criteria andCreateuserLike(String value) { addCriterion("createUser like", value, "createuser"); return (Criteria) this; } public Criteria andCreateuserNotLike(String value) { addCriterion("createUser not like", value, "createuser"); return (Criteria) this; } public Criteria andCreateuserIn(List<String> values) { addCriterion("createUser in", values, "createuser"); return (Criteria) this; } public Criteria andCreateuserNotIn(List<String> values) { addCriterion("createUser not in", values, "createuser"); return (Criteria) this; } public Criteria andCreateuserBetween(String value1, String value2) { addCriterion("createUser between", value1, value2, "createuser"); return (Criteria) this; } public Criteria andCreateuserNotBetween(String value1, String value2) { addCriterion("createUser not between", value1, value2, "createuser"); return (Criteria) this; } public Criteria andCreatetimeIsNull() { addCriterion("createTime is null"); return (Criteria) this; } public Criteria andCreatetimeIsNotNull() { addCriterion("createTime is not null"); return (Criteria) this; } public Criteria andCreatetimeEqualTo(Date value) { addCriterion("createTime =", value, "createtime"); return (Criteria) this; } public Criteria andCreatetimeNotEqualTo(Date value) { addCriterion("createTime <>", value, "createtime"); return (Criteria) this; } public Criteria andCreatetimeGreaterThan(Date value) { addCriterion("createTime >", value, "createtime"); return (Criteria) this; } public Criteria andCreatetimeGreaterThanOrEqualTo(Date value) { addCriterion("createTime >=", value, "createtime"); return (Criteria) this; } public Criteria andCreatetimeLessThan(Date value) { addCriterion("createTime <", value, "createtime"); return (Criteria) this; } public Criteria andCreatetimeLessThanOrEqualTo(Date value) { addCriterion("createTime <=", value, "createtime"); return (Criteria) this; } public Criteria andCreatetimeIn(List<Date> values) { addCriterion("createTime in", values, "createtime"); return (Criteria) this; } public Criteria andCreatetimeNotIn(List<Date> values) { addCriterion("createTime not in", values, "createtime"); return (Criteria) this; } public Criteria andCreatetimeBetween(Date value1, Date value2) { addCriterion("createTime between", value1, value2, "createtime"); return (Criteria) this; } public Criteria andCreatetimeNotBetween(Date value1, Date value2) { addCriterion("createTime not between", value1, value2, "createtime"); return (Criteria) this; } public Criteria andUpdatetimeIsNull() { addCriterion("updateTime is null"); return (Criteria) this; } public Criteria andUpdatetimeIsNotNull() { addCriterion("updateTime is not null"); return (Criteria) this; } public Criteria andUpdatetimeEqualTo(Date value) { addCriterion("updateTime =", value, "updatetime"); return (Criteria) this; } public Criteria andUpdatetimeNotEqualTo(Date value) { addCriterion("updateTime <>", value, "updatetime"); return (Criteria) this; } public Criteria andUpdatetimeGreaterThan(Date value) { addCriterion("updateTime >", value, "updatetime"); return (Criteria) this; } public Criteria andUpdatetimeGreaterThanOrEqualTo(Date value) { addCriterion("updateTime >=", value, "updatetime"); return (Criteria) this; } public Criteria andUpdatetimeLessThan(Date value) { addCriterion("updateTime <", value, "updatetime"); return (Criteria) this; } public Criteria andUpdatetimeLessThanOrEqualTo(Date value) { addCriterion("updateTime <=", value, "updatetime"); return (Criteria) this; } public Criteria andUpdatetimeIn(List<Date> values) { addCriterion("updateTime in", values, "updatetime"); return (Criteria) this; } public Criteria andUpdatetimeNotIn(List<Date> values) { addCriterion("updateTime not in", values, "updatetime"); return (Criteria) this; } public Criteria andUpdatetimeBetween(Date value1, Date value2) { addCriterion("updateTime between", value1, value2, "updatetime"); return (Criteria) this; } public Criteria andUpdatetimeNotBetween(Date value1, Date value2) { addCriterion("updateTime not between", value1, value2, "updatetime"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
package com.iflytek.sas.voice.transfer.server.controller; /** * @author: JiangPing Li * @date: 2018-08-24 10:13 */ public class Test { public static void main(String[] args) { // int result = fact(10,1); // System.out.println(result); int a = 129; byte b = (byte)a; System.out.println(b); } private static int fact(int n,int a){ if (n < 0) {return 0;} else if (n == 0){ return 1;} else if (n == 1){ return a;} else{ return fact(n - 1, n * a);} } }
package com.github.joswlv.parquet.transform; import com.github.joswlv.parquet.metadata.ParquetMetaInfo; public class TransformBuilder { public static Transform build(TransformType type, ParquetMetaInfo metaInfo) { Transform transform; switch (type) { case Value2Null: transform = new Value2Null(metaInfo); break; default: throw new UnsupportedOperationException(type + " is not support."); } return transform; } }
package statics; import game.Handler; import graphics.Animation; import graphics.Assets; import java.awt.*; public class SpeedBoost extends Boost { public static final int BOOST_DURATION = 15000; private Animation animation; public SpeedBoost(Handler pHandler, float x, float y, int pWidth, int pHeight) { super(pHandler, x, y, pWidth, pHeight); animation = new Animation(125, Assets.speed_boost_array); } @Override public void tick() { super.tick(); animation.tick(); } @Override public void render(Graphics g) { g.drawImage(animation.getCurrentFrame(),(int) (x - handler.getGameCamera().getxOffset()),(int) (y - handler.getGameCamera().getyOffset()), width, height, null); } }
package campoMinado; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; class CampoTest { private Campo campo = new Campo(3,3); @Test void testeVizinhoRealDistancia1_1() { Campo vizinho = new Campo(3,2); boolean resultado = campo.adicionarVizinho(vizinho); assertTrue(resultado); } @Test void testeVizinhoRealDistancia1_2() { Campo vizinho = new Campo(2,3); boolean resultado = campo.adicionarVizinho(vizinho); assertTrue(resultado); } @Test void testeVizinhoRealDistancia1_3() { Campo vizinho = new Campo(3,4); boolean resultado = campo.adicionarVizinho(vizinho); assertTrue(resultado); } @Test void testeVizinhoRealDistancia1_4() { Campo vizinho = new Campo(4,3); boolean resultado = campo.adicionarVizinho(vizinho); assertTrue(resultado); } @Test void testeVizinhoRealDistancia2_1() { Campo vizinho = new Campo(4,2); boolean resultado = campo.adicionarVizinho(vizinho); assertTrue(resultado); } @Test void testeVizinhoRealDistancia2_2() { Campo vizinho = new Campo(2,4); boolean resultado = campo.adicionarVizinho(vizinho); assertTrue(resultado); } @Test void testeVizinhoRealDistancia2_3() { Campo vizinho = new Campo(4,4); boolean resultado = campo.adicionarVizinho(vizinho); assertTrue(resultado); } @Test void testeVizinhoRealDistancia2_4() { Campo vizinho = new Campo(2,2); boolean resultado = campo.adicionarVizinho(vizinho); assertTrue(resultado); } @Test void testeValorPadraoMarcado() { assertFalse(campo.isMarcado()); } @Test void testeAlternarMarcacao() { campo.alternarMarcacao(); assertTrue(campo.isMarcado()); } @Test void testeAlternarMarcacaoDuasCamadas() { campo.alternarMarcacao(); campo.alternarMarcacao(); assertFalse(campo.isMarcado()); } @Test void testeAbrirNaoMinadoNaoMarcado() { assertTrue(campo.abrir()); } @Test void testeAbrirNaoMinadoMarcado() { campo.alternarMarcacao(); assertFalse(campo.abrir()); } @Test void testeAbrirMinadoMarcado() { campo.minar(); campo.alternarMarcacao(); assertFalse(campo.abrir()); } void testeAbrirMinadoNaoMarcado() { campo.minar(); assertThrows(ExplosaoException.class, () -> { campo.abrir(); }); } }
import java.util.Scanner; class removingWordFromString{ public static void main(String[] args) { Scanner inputScanner = new Scanner(System.in); System.out.print("Enter the sentence :"); String userInputSentence = inputScanner.nextLine(); System.out.print("Enter the word to be removed from the sentence :"); String userInputRemoveWord = inputScanner.nextLine(); String replacedSentence = userInputSentence.replace(wordToBeRemoved,""); System.out.println("Using replace method :"+replacedSentence); /*without replace() method*/ String crtSentence = ""; int removeWordLength = userInputRemoveWord.length(); int sentenceLength = userInputSentence.length(); for(int i=0;i<sentenceLength;i++) { if((i+removeWordLength<=sentenceLength) && userInputSentence.substring(i,i+removeWordLength).equals(userInputRemoveWord)) { i = i+removeWordLength-1; } else { crtSentence+=userInputSentence.substring(i,i+1); } } System.out.println("Removed sentence without using replace method :"+crtSentence); inputScanner.close(); } }
package com.microsilver.mrcard.basicservice.model; import java.util.ArrayList; import java.util.List; public class FxSdSysLevelsettingExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public FxSdSysLevelsettingExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; } public Criteria andIdIsNotNull() { addCriterion("id is not null"); return (Criteria) this; } public Criteria andIdEqualTo(Integer value) { addCriterion("id =", value, "id"); return (Criteria) this; } public Criteria andIdNotEqualTo(Integer value) { addCriterion("id <>", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThan(Integer value) { addCriterion("id >", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualTo(Integer value) { addCriterion("id >=", value, "id"); return (Criteria) this; } public Criteria andIdLessThan(Integer value) { addCriterion("id <", value, "id"); return (Criteria) this; } public Criteria andIdLessThanOrEqualTo(Integer value) { addCriterion("id <=", value, "id"); return (Criteria) this; } public Criteria andIdIn(List<Integer> values) { addCriterion("id in", values, "id"); return (Criteria) this; } public Criteria andIdNotIn(List<Integer> values) { addCriterion("id not in", values, "id"); return (Criteria) this; } public Criteria andIdBetween(Integer value1, Integer value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; } public Criteria andIdNotBetween(Integer value1, Integer value2) { addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } public Criteria andTotalStarScoreIsNull() { addCriterion("total_star_score is null"); return (Criteria) this; } public Criteria andTotalStarScoreIsNotNull() { addCriterion("total_star_score is not null"); return (Criteria) this; } public Criteria andTotalStarScoreEqualTo(Integer value) { addCriterion("total_star_score =", value, "totalStarScore"); return (Criteria) this; } public Criteria andTotalStarScoreNotEqualTo(Integer value) { addCriterion("total_star_score <>", value, "totalStarScore"); return (Criteria) this; } public Criteria andTotalStarScoreGreaterThan(Integer value) { addCriterion("total_star_score >", value, "totalStarScore"); return (Criteria) this; } public Criteria andTotalStarScoreGreaterThanOrEqualTo(Integer value) { addCriterion("total_star_score >=", value, "totalStarScore"); return (Criteria) this; } public Criteria andTotalStarScoreLessThan(Integer value) { addCriterion("total_star_score <", value, "totalStarScore"); return (Criteria) this; } public Criteria andTotalStarScoreLessThanOrEqualTo(Integer value) { addCriterion("total_star_score <=", value, "totalStarScore"); return (Criteria) this; } public Criteria andTotalStarScoreIn(List<Integer> values) { addCriterion("total_star_score in", values, "totalStarScore"); return (Criteria) this; } public Criteria andTotalStarScoreNotIn(List<Integer> values) { addCriterion("total_star_score not in", values, "totalStarScore"); return (Criteria) this; } public Criteria andTotalStarScoreBetween(Integer value1, Integer value2) { addCriterion("total_star_score between", value1, value2, "totalStarScore"); return (Criteria) this; } public Criteria andTotalStarScoreNotBetween(Integer value1, Integer value2) { addCriterion("total_star_score not between", value1, value2, "totalStarScore"); return (Criteria) this; } public Criteria andLevelNameIsNull() { addCriterion("level_name is null"); return (Criteria) this; } public Criteria andLevelNameIsNotNull() { addCriterion("level_name is not null"); return (Criteria) this; } public Criteria andLevelNameEqualTo(String value) { addCriterion("level_name =", value, "levelName"); return (Criteria) this; } public Criteria andLevelNameNotEqualTo(String value) { addCriterion("level_name <>", value, "levelName"); return (Criteria) this; } public Criteria andLevelNameGreaterThan(String value) { addCriterion("level_name >", value, "levelName"); return (Criteria) this; } public Criteria andLevelNameGreaterThanOrEqualTo(String value) { addCriterion("level_name >=", value, "levelName"); return (Criteria) this; } public Criteria andLevelNameLessThan(String value) { addCriterion("level_name <", value, "levelName"); return (Criteria) this; } public Criteria andLevelNameLessThanOrEqualTo(String value) { addCriterion("level_name <=", value, "levelName"); return (Criteria) this; } public Criteria andLevelNameLike(String value) { addCriterion("level_name like", value, "levelName"); return (Criteria) this; } public Criteria andLevelNameNotLike(String value) { addCriterion("level_name not like", value, "levelName"); return (Criteria) this; } public Criteria andLevelNameIn(List<String> values) { addCriterion("level_name in", values, "levelName"); return (Criteria) this; } public Criteria andLevelNameNotIn(List<String> values) { addCriterion("level_name not in", values, "levelName"); return (Criteria) this; } public Criteria andLevelNameBetween(String value1, String value2) { addCriterion("level_name between", value1, value2, "levelName"); return (Criteria) this; } public Criteria andLevelNameNotBetween(String value1, String value2) { addCriterion("level_name not between", value1, value2, "levelName"); return (Criteria) this; } public Criteria andLevelScoreIsNull() { addCriterion("level_score is null"); return (Criteria) this; } public Criteria andLevelScoreIsNotNull() { addCriterion("level_score is not null"); return (Criteria) this; } public Criteria andLevelScoreEqualTo(Integer value) { addCriterion("level_score =", value, "levelScore"); return (Criteria) this; } public Criteria andLevelScoreNotEqualTo(Integer value) { addCriterion("level_score <>", value, "levelScore"); return (Criteria) this; } public Criteria andLevelScoreGreaterThan(Integer value) { addCriterion("level_score >", value, "levelScore"); return (Criteria) this; } public Criteria andLevelScoreGreaterThanOrEqualTo(Integer value) { addCriterion("level_score >=", value, "levelScore"); return (Criteria) this; } public Criteria andLevelScoreLessThan(Integer value) { addCriterion("level_score <", value, "levelScore"); return (Criteria) this; } public Criteria andLevelScoreLessThanOrEqualTo(Integer value) { addCriterion("level_score <=", value, "levelScore"); return (Criteria) this; } public Criteria andLevelScoreIn(List<Integer> values) { addCriterion("level_score in", values, "levelScore"); return (Criteria) this; } public Criteria andLevelScoreNotIn(List<Integer> values) { addCriterion("level_score not in", values, "levelScore"); return (Criteria) this; } public Criteria andLevelScoreBetween(Integer value1, Integer value2) { addCriterion("level_score between", value1, value2, "levelScore"); return (Criteria) this; } public Criteria andLevelScoreNotBetween(Integer value1, Integer value2) { addCriterion("level_score not between", value1, value2, "levelScore"); return (Criteria) this; } public Criteria andDeliveryIdIsNull() { addCriterion("delivery_id is null"); return (Criteria) this; } public Criteria andDeliveryIdIsNotNull() { addCriterion("delivery_id is not null"); return (Criteria) this; } public Criteria andDeliveryIdEqualTo(Integer value) { addCriterion("delivery_id =", value, "deliveryId"); return (Criteria) this; } public Criteria andDeliveryIdNotEqualTo(Integer value) { addCriterion("delivery_id <>", value, "deliveryId"); return (Criteria) this; } public Criteria andDeliveryIdGreaterThan(Integer value) { addCriterion("delivery_id >", value, "deliveryId"); return (Criteria) this; } public Criteria andDeliveryIdGreaterThanOrEqualTo(Integer value) { addCriterion("delivery_id >=", value, "deliveryId"); return (Criteria) this; } public Criteria andDeliveryIdLessThan(Integer value) { addCriterion("delivery_id <", value, "deliveryId"); return (Criteria) this; } public Criteria andDeliveryIdLessThanOrEqualTo(Integer value) { addCriterion("delivery_id <=", value, "deliveryId"); return (Criteria) this; } public Criteria andDeliveryIdIn(List<Integer> values) { addCriterion("delivery_id in", values, "deliveryId"); return (Criteria) this; } public Criteria andDeliveryIdNotIn(List<Integer> values) { addCriterion("delivery_id not in", values, "deliveryId"); return (Criteria) this; } public Criteria andDeliveryIdBetween(Integer value1, Integer value2) { addCriterion("delivery_id between", value1, value2, "deliveryId"); return (Criteria) this; } public Criteria andDeliveryIdNotBetween(Integer value1, Integer value2) { addCriterion("delivery_id not between", value1, value2, "deliveryId"); return (Criteria) this; } public Criteria andServiceScoreIsNull() { addCriterion("service_score is null"); return (Criteria) this; } public Criteria andServiceScoreIsNotNull() { addCriterion("service_score is not null"); return (Criteria) this; } public Criteria andServiceScoreEqualTo(Double value) { addCriterion("service_score =", value, "serviceScore"); return (Criteria) this; } public Criteria andServiceScoreNotEqualTo(Double value) { addCriterion("service_score <>", value, "serviceScore"); return (Criteria) this; } public Criteria andServiceScoreGreaterThan(Double value) { addCriterion("service_score >", value, "serviceScore"); return (Criteria) this; } public Criteria andServiceScoreGreaterThanOrEqualTo(Double value) { addCriterion("service_score >=", value, "serviceScore"); return (Criteria) this; } public Criteria andServiceScoreLessThan(Double value) { addCriterion("service_score <", value, "serviceScore"); return (Criteria) this; } public Criteria andServiceScoreLessThanOrEqualTo(Double value) { addCriterion("service_score <=", value, "serviceScore"); return (Criteria) this; } public Criteria andServiceScoreIn(List<Double> values) { addCriterion("service_score in", values, "serviceScore"); return (Criteria) this; } public Criteria andServiceScoreNotIn(List<Double> values) { addCriterion("service_score not in", values, "serviceScore"); return (Criteria) this; } public Criteria andServiceScoreBetween(Double value1, Double value2) { addCriterion("service_score between", value1, value2, "serviceScore"); return (Criteria) this; } public Criteria andServiceScoreNotBetween(Double value1, Double value2) { addCriterion("service_score not between", value1, value2, "serviceScore"); return (Criteria) this; } public Criteria andUserIdIsNull() { addCriterion("user_id is null"); return (Criteria) this; } public Criteria andUserIdIsNotNull() { addCriterion("user_id is not null"); return (Criteria) this; } public Criteria andUserIdEqualTo(Integer value) { addCriterion("user_id =", value, "userId"); return (Criteria) this; } public Criteria andUserIdNotEqualTo(Integer value) { addCriterion("user_id <>", value, "userId"); return (Criteria) this; } public Criteria andUserIdGreaterThan(Integer value) { addCriterion("user_id >", value, "userId"); return (Criteria) this; } public Criteria andUserIdGreaterThanOrEqualTo(Integer value) { addCriterion("user_id >=", value, "userId"); return (Criteria) this; } public Criteria andUserIdLessThan(Integer value) { addCriterion("user_id <", value, "userId"); return (Criteria) this; } public Criteria andUserIdLessThanOrEqualTo(Integer value) { addCriterion("user_id <=", value, "userId"); return (Criteria) this; } public Criteria andUserIdIn(List<Integer> values) { addCriterion("user_id in", values, "userId"); return (Criteria) this; } public Criteria andUserIdNotIn(List<Integer> values) { addCriterion("user_id not in", values, "userId"); return (Criteria) this; } public Criteria andUserIdBetween(Integer value1, Integer value2) { addCriterion("user_id between", value1, value2, "userId"); return (Criteria) this; } public Criteria andUserIdNotBetween(Integer value1, Integer value2) { addCriterion("user_id not between", value1, value2, "userId"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
package Exception.BlockException; public class BlockException extends Exception{ public BlockException (String message) { super(message); } }
package com.jayqqaa12.pop; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.GridView; import com.jayqqaa12.abase.core.APopup; import com.jayqqaa12.abase.kit.ManageKit; public class MenuPop extends APopup implements OnItemClickListener { MenuAdapter adapter ; @Override protected View initView() { View view = ManageKit.getInflater().inflate(R.layout.test_menu, null); GridView gv = (GridView) view.findViewById(R.id.gv); adapter= new MenuAdapter(); gv.setAdapter(adapter); this.setAnimationStyle(R.style.AnimBottom); gv.setOnItemClickListener(this); return view; } @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { switch (adapter.getItem(position).ation) { case Menu.ATION_TOC: break; case Menu.ATION_SETTING: break; case Menu.ATION_FONT_ADD: break; case Menu.ATION_FONT_DIM: break; case Menu.ATION_NIGHT: break; case Menu.ATION_PROGRESS: break; } } }
package com.xiongge; public class CxfConfig { private String url; private String cxfInterface; private String rule; public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getCxfInterface() { return cxfInterface; } public void setCxfInterface(String cxfInterface) { this.cxfInterface = cxfInterface; } public String getRule() { return rule; } public void setRule(String rule) { this.rule = rule; } }
package com.fleet.easyexcel.listener; import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.event.AnalysisEventListener; import com.fleet.easyexcel.entity.User; import java.util.ArrayList; import java.util.List; /** * @author April Han */ public class UserListener extends AnalysisEventListener<User> { List<User> list = new ArrayList<>(); public List<User> getList() { return list; } public void setList(List<User> list) { this.list = list; } @Override public void invoke(User user, AnalysisContext analysisContext) { list.add(user); } @Override public void doAfterAllAnalysed(AnalysisContext analysisContext) { } }
package com.manning.ssia.oauth.jpa; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.test.context.TestPropertySource; import javax.persistence.EntityManager; import javax.sql.DataSource; import static org.assertj.core.api.Assertions.assertThat; @DataJpaTest @TestPropertySource(properties = { "spring.jpa.hibernate.ddl-auto=validate" }) public class UserRepositoryTest { @Autowired private DataSource dataSource; @Autowired private JdbcTemplate jdbcTemplate; @Autowired private EntityManager entityManager; @Autowired private UserRepository userRepository; @Test void injectedComponentsAreNotNull() { assertThat(dataSource).isNotNull(); assertThat(jdbcTemplate).isNotNull(); assertThat(entityManager).isNotNull(); assertThat(userRepository).isNotNull(); } @Test // @Sql("createUser.sql") void findByUsername() { User user = userRepository.findByUsername("john"); assertThat(user).isNotNull(); System.out.println("found "+user); } }
abstract class Employee { String name; int age; String address; char gender; double salary; Employee(String name, int age, String address, char gender){ this.name = name; this.age = age; this.address = address; this.gender = gender; } void showDetails() { System.out.println(); } abstract void computeSalary(); } class FTEmployee extends Employee{ FTEmployee(String name, int age, String address, char gender) { super(name, age, address, gender); } double basic; void FTEmpolyee(String name, int age, String address, char gender, double basic) { } @Override void computeSalary() { } }
package de.jmda.app.cgol.xy.fx.cdi.view.grid.shapetemplate; import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertThat; import static org.junit.Assert.fail; import java.util.Optional; import org.junit.Test; import de.jmda.app.cgol.xy.fx.cdi.view.grid.shapetemplate.CircleTemplatePopulated; import de.jmda.app.cgol.xy.fx.cdi.view.grid.shapetemplate.CircleTemplateUnpopulated; import de.jmda.app.cgol.xy.fx.cdi.view.grid.shapetemplate.ShapeTemplatePopulated; import de.jmda.app.cgol.xy.fx.cdi.view.grid.shapetemplate.ShapeTemplateUnpopulated; import javafx.scene.paint.Color; import javafx.scene.shape.Circle; import javafx.scene.shape.Shape; public class JUTShapeTemplatesCopyFrom { @Test public void copyFromShapeTemplatePopulatedDefault() { Optional<? extends Shape> copy = ShapeTemplatePopulated.DEFAULT.copyFrom(); Circle circle = (Circle) copy.get(); assertThat(circle.getRadius(), equalTo(CircleTemplatePopulated.RADIUS_DEFAULT)); assertThat(circle.getFill(), equalTo(CircleTemplatePopulated.COLOR_DEFAULT)); } @Test public void copyFromShapeTemplatePopulatedCustom() { Circle originalShape = new Circle(5, Color.BLUE); ShapeTemplatePopulated template = new CircleTemplatePopulated(originalShape); Optional<? extends Shape> copy = template.copyFrom(); Circle copiedShape = (Circle) copy.get(); assertThat(copiedShape.getRadius(), equalTo(originalShape.getRadius())); assertThat(copiedShape.getFill(), equalTo(originalShape.getFill())); } @Test public void copyFromShapeTemplateUnpopulatedCustom() { Circle originalShape = null; ShapeTemplateUnpopulated template = new CircleTemplateUnpopulated(originalShape); Optional<? extends Shape> copy = template.copyFrom(); if (copy.isPresent()) fail("copy from unpopulated template is not expected to be present"); } }
package com.lingnet.vocs.action.statistics; import com.lingnet.common.action.BaseAction; import com.lingnet.util.JsonUtil; /** * 活性炭使用记录 * * @ClassName: ActicarbonUseAction * @Description: TODO * @author xues * @date 2017年6月13日 上午8:11:48 * */ public class ActicarbonUseAction extends BaseAction { private static final long serialVersionUID = -3766217122343593564L; public String list() { return LIST; } public String getListData() { String jsonString = ""; jsonString += "[{ \"id\":\"1\", \"name\":\"设备A\", \"company\":\"客户A\",\"content\":\"2017-6-12\",\"date1\":\"20kg\", \"type\":\"5天\" }" + " ,{ \"id\":\"2\", \"name\":\"设备B\", \"company\":\"客户B\",\"content\":\"2017-6-12\",\"date1\":\"20kg\",\"type\":\"6天\"}" + "]"; return ajax(Status.success, JsonUtil.Encode(jsonString)); } }
package paqueteEvaluacion; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; class LavadoraTest { Lavadora lavadoraPrueba; Lavadora lavadoraPrueba2; @BeforeEach void setUp() throws Exception { lavadoraPrueba = new Lavadora(35, 100000, 8, "blanco", 'A'); lavadoraPrueba2 = new Lavadora(5,100000, 2, "azul", 'F'); } @Test void testPrecioFinal() { assertEquals(100020, lavadoraPrueba2.precioFinal(5, 100000)); } @Test void testGetCarga() { assertEquals(35, lavadoraPrueba.getCarga()); } }
package animatronics.utils.block.material; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; public class MaterialBase extends Material{ public MaterialBase(MapColor mapColor){ super(mapColor); } public Material setNoPushMobility(){ return super.setNoPushMobility(); } public Material setRequiresTool(){ return super.setRequiresTool(); } public Material setBurning(){ return super.setBurning(); } public Material setImmovableMobility(){ return super.setImmovableMobility(); } public Material setAdventureModeExempt(){ return super.setAdventureModeExempt(); } }
package br.edu.ifpb.splash2; import android.app.Activity; import android.app.AlarmManager; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.provider.AlarmClock; import android.provider.MediaStore; import android.provider.Settings; import android.telephony.SmsManager; import android.util.Log; import android.view.View; import android.widget.EditText; import android.widget.Toast; import com.google.android.gms.appindexing.Action; import com.google.android.gms.appindexing.AppIndex; import com.google.android.gms.common.api.GoogleApiClient; public class PrimeiraActivity extends Activity { @Override protected void onCreate(Bundle save) { super.onCreate(save); setContentView(R.layout.activity_primeira); } @Override public void onStart() { super.onStart(); // ATTENTION: This was auto-generated to implement the App Indexing API. // See https://g.co/AppIndexing/AndroidStudio for more information. client.connect(); Action viewAction = Action.newAction( Action.TYPE_VIEW, // TODO: choose an action type. "Primeira Page", // TODO: Define a title for the content shown. // TODO: If you have web page content that matches this app activity's content, // make sure this auto-generated web page URL is correct. // Otherwise, set the URL to null. Uri.parse("http://host/path"), // TODO: Make sure this auto-generated app URL is correct. Uri.parse("android-app://br.edu.ifpb.intentapplication/http/host/path") ); AppIndex.AppIndexApi.start(client, viewAction); } @Override public void onStop() { super.onStop(); // ATTENTION: This was auto-generated to implement the App Indexing API. // See https://g.co/AppIndexing/AndroidStudio for more information. Action viewAction = Action.newAction( Action.TYPE_VIEW, // TODO: choose an action type. "Primeira Page", // TODO: Define a title for the content shown. // TODO: If you have web page content that matches this app activity's content, // make sure this auto-generated web page URL is correct. // Otherwise, set the URL to null. Uri.parse("http://host/path"), // TODO: Make sure this auto-generated app URL is correct. Uri.parse("android-app://br.edu.ifpb.intentapplication/http/host/path") ); AppIndex.AppIndexApi.end(client, viewAction); client.disconnect(); } protected void onClickConf(View v) { Intent i = new Intent(Settings.ACTION_SETTINGS); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); } protected void onClickMapa(View v) { Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com/maps")); startActivity(i); } protected void onClickMusic(View v) { Intent i = new Intent(MediaStore.INTENT_ACTION_MUSIC_PLAYER); startActivity(i); } protected void onClickSMS(View v) { Intent i = new Intent(Intent.ACTION_VIEW, Uri.fromParts("sms", "989898989", null)); startActivity(i); } protected void onClickAlarme(View v) { Intent i = new Intent(AlarmClock.ACTION_SHOW_ALARMS); startActivity(i); } protected void onClickBusca(View v) { Intent i = new Intent(this, SegundaActivity.class); startActivity(i); } }
package com.github.frostyaxe.dataprovider.application; import java.util.Arrays; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.server.ConfigurableWebServerFactory; import org.springframework.boot.web.server.WebServerFactoryCustomizer; import org.springframework.context.annotation.ComponentScan; @SpringBootApplication @ComponentScan( basePackages= {"com.github.frostyaxe.dataprovider.controllers","com.github.frostyaxe.dataprovider.services"} ) public class Application implements WebServerFactoryCustomizer<ConfigurableWebServerFactory> { public static void main(String[] args) { Arrays.asList(args); SpringApplication.run(Application.class, args); } public void customize(ConfigurableWebServerFactory factory) { factory.setPort(8081); } }
package it.polimi.ingsw.GC_21.GAMECOMPONENTS; import it.polimi.ingsw.GC_21.EFFECT.Effect; import it.polimi.ingsw.GC_21.PLAYER.Player; public class OncePerTurnLeaderCard extends LeaderCard { private boolean playedThisTurn; private Effect immediateEffect; public OncePerTurnLeaderCard(String ID, String name, int numberOfVenturesRequired, int numberOfCharactersRequired, int numberOfBuildingRequired, int numberOfTerritoryRequired, Possession requirements, boolean played, Effect immediateEffect) { super(ID, name, numberOfVenturesRequired, numberOfCharactersRequired, numberOfBuildingRequired, numberOfTerritoryRequired, requirements, played); this.immediateEffect = immediateEffect; this.playedThisTurn = false; } public boolean isPlayedThisTurn() { return playedThisTurn; } public void setPlayedThisTurn(boolean playedThisTurn) { this.playedThisTurn = playedThisTurn; } public String getName() { return name; } public Effect getImmediateEffect() { return immediateEffect; } public void setImmediateEffect(Effect immediateEffect) { this.immediateEffect = immediateEffect; } public int getNumberOfVenturesRequired() { return numberOfVenturesRequired; } public void setNumberOfVenturesRequired(int numberOfVenturesRequired) { this.numberOfVenturesRequired = numberOfVenturesRequired; } public int getNumberOfCharactersRequired() { return numberOfCharactersRequired; } public void setNumberOfCharactersRequired(int numberOfCharactersRequired) { this.numberOfCharactersRequired = numberOfCharactersRequired; } public int getNumberOfBuildingRequired() { return numberOfBuildingRequired; } public void setNumberOfBuildingRequired(int numberOfBuildingRequired) { this.numberOfBuildingRequired = numberOfBuildingRequired; } public int getNumberOfTerritoryRequired() { return numberOfTerritoryRequired; } public void setNumberOfTerritoryRequired(int numberOfTerritoryRequired) { this.numberOfTerritoryRequired = numberOfTerritoryRequired; } @Override public void callEffect(Player player) { this.immediateEffect.activateEffect(player, null); } }
package pong.ldz.com.ping; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.AsyncTask; import android.preference.PreferenceManager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.util.logging.Level; import java.util.logging.Logger; import Comunicacao.Acesso; import Model.Usuario; public class MainActivity extends AppCompatActivity { Context context; Acesso acesso; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); context = this; BootReciever.endereco = "131.72.69.117"; acesso = new Acesso(BootReciever.endereco, context); BootReciever.sharedPrefs = PreferenceManager .getDefaultSharedPreferences(this); BootReciever.logado = BootReciever.sharedPrefs.getBoolean("LOGADO", false); BootReciever.cookie = BootReciever.sharedPrefs.getString("COOKIE", ""); // endereco = sharedPrefs.getString("ENDERECO", ""); if (BootReciever.logado) { Intent intent = new Intent(context, HostsActivity.class); context.startActivity(intent); finish(); } else { BootReciever.editor = BootReciever.sharedPrefs.edit(); acesso.validarCookie(BootReciever.cookie); } } }
package santa.gregfood.item; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.interfaces.IItemContainer; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; /** * @author SatanicSanta */ public enum FoodList implements IItemContainer{ //alcohol Whiskey, Perry, Mixed_Berry_Cider, //Gin, Pumpkin_Ale, //Tequila, Everclear, //used to make orange liqueur Apricot_Ale, //Margarita, //Lime_Gin, //Malt_Liquor, //Space_Bag, //Bum_Beer, //Rum_, Spiced_Rum, Brandy, //Orange_Liqueur, Irish_Coffee, //English_Coffee, Shin_Shin_Coffee, Russian_Coffee, //Absinthe, //non-alcohol drinks Pumpkin_Spice_Latte, Affogato, Caffe_Americano, Caffe_Marocchino, Steamed_Milk, Coffee_Milk, Decaf, Eggnog, Espressino, Ice_Coffee, Pear_Juice, Apple_Berry_Juice, //food Christmas_Cookie, Brownie, Gingerbread_Man, Gingerbread_Man_Demonic; private boolean isNotSet = true; private ItemStack stack; @Override public IItemContainer set(Item item){ this.isNotSet = false; if (item == null) return this; ItemStack stack0 = new ItemStack(item, 1, 0); this.stack = GT_Utility.copyAmount(1L, new Object[]{stack0}); return this; } @Override public IItemContainer set(ItemStack itemStack){ this.isNotSet = false; this.stack = GT_Utility.copyAmount(1L, new Object[]{itemStack}); return this; } @Override public boolean isStackEqual(Object stackObj){ return isStackEqual(stackObj, false, false); } @Override public boolean isStackEqual(Object stackObject, boolean wildcard, boolean ignoreNBT){ if (GT_Utility.isStackInvalid(stackObject)) return false; return GT_Utility.areUnificationsEqual((ItemStack)stackObject, wildcard ? getWildcard(1L, new Object[0]) : get(1L, new Object[0]), ignoreNBT); } @Override public ItemStack getAlmostBroken(long amount, Object[] replacements){ if (this.isNotSet) throw new IllegalAccessError("The enum " + name() + " has not been set to an item"); if (GT_Utility.isStackInvalid(this.stack)) return GT_Utility.copyAmount(amount, replacements); return GT_Utility.copyAmountAndMetaData(amount, this.stack.getMaxDamage() - 1, new Object[] { GT_OreDictUnificator.get(this.stack) }); } @Override public ItemStack getWithCharge(long amount, int energy, Object[] replacements){ ItemStack itemStack = get(1L, replacements); if (GT_Utility.isStackInvalid(itemStack)) return null; GT_ModHandler.chargeElectricItem(itemStack, energy, 2147483647, true, false); return GT_Utility.copyAmount(amount, new Object[] { itemStack }); } @Override public ItemStack getWildcard(long amount, Object[] replacements){ if (this.isNotSet) throw new IllegalAccessError("The enum " + name() + " has not been set to an item"); if (GT_Utility.isStackInvalid(this.stack)) return GT_Utility.copyAmount(amount, replacements); return GT_Utility.copyAmountAndMetaData(amount, 32767L, new Object[] { GT_OreDictUnificator.get(this.stack) }); } @Override public Item getItem(){ if (this.isNotSet) throw new IllegalAccessError("The enum " + name() + " has not been set to an item"); if (GT_Utility.isStackInvalid(this.stack)) return null; return this.stack.getItem(); } @Override public Block getBlock(){ if (this.isNotSet) throw new IllegalAccessError("The enum " + name() + " has not been set to an item"); return GT_Utility.getBlockFromStack(getItem()); } @Override public final boolean hasBeenSet(){ return !this.isNotSet; } @Override public IItemContainer registerWildcardAsOre(Object[] ores){ if (this.isNotSet) throw new IllegalAccessError("The enum " + name() + " has not been set to an item"); for (Object oreName : ores) GT_OreDictUnificator.registerOre(oreName, getWildcard(1L, new Object[0])); return this; } @Override public ItemStack getUndamaged(long amount, Object[] replacements){ if (this.isNotSet) throw new IllegalAccessError("The enum " + name() + " has not been set to an item"); if (GT_Utility.isStackInvalid(this.stack)) return GT_Utility.copyAmount(amount, replacements); return GT_Utility.copyAmountAndMetaData(amount, 0L, new Object[] { GT_OreDictUnificator.get(this.stack) }); } @Override public ItemStack get(long amount, Object[] replacements){ if (this.isNotSet) throw new IllegalAccessError("The enum " + name() + " has not been set to an item"); if (GT_Utility.isStackInvalid(this.stack)) return GT_Utility.copyAmount(amount, replacements); return GT_Utility.copyAmount(amount, new Object[] { GT_OreDictUnificator.get(this.stack) }); } @Override public ItemStack getWithName(long amount, String name, Object[] replacements){ ItemStack itemStack = get(1L, replacements); if (GT_Utility.isStackInvalid(itemStack)) return null; itemStack.setStackDisplayName(name); return GT_Utility.copyAmount(amount, new Object[] { itemStack }); } @Override public ItemStack getWithDamage(long amount, long meta, Object[] replacements) { if (this.isNotSet) throw new IllegalAccessError("The enum " + name() + " has not been set to an item"); if (GT_Utility.isStackInvalid(this.stack)) return GT_Utility.copyAmount(amount, replacements); return GT_Utility.copyAmountAndMetaData(amount, meta, new Object[] { GT_OreDictUnificator.get(this.stack) }); } @Override public IItemContainer registerOre(Object[] oreNames) { if (this.isNotSet) throw new IllegalAccessError("The enum " + name() + " has not been set to an item"); for (Object oreName : oreNames) GT_OreDictUnificator.registerOre(oreName, get(1L, new Object[0])); return this; } }
package arun.problems.ds.string; /** * @author akumars * */ public abstract class StringPatternSearch { /** * @param stringToBeSearched * @param stringToSearch * @return */ public abstract boolean searchPattern(final String stringToBeSearched, final String stringToSearch); /** * @param stringToBeSearched * @param stringToSearch * @return */ public abstract int firstStartingIndex(final String stringToBeSearched, final String stringToSearch); /** * @param stringToBeSearched * @param stringToSearch * @return */ public abstract int[] findAllMatchingIndexes(final String stringToBeSearched, final String stringToSearch); /** * @param stringToBeSearched * @param stringToSearch * @return */ public abstract int repeatationCount(final String stringToBeSearched, final String stringToSearch); /** * @param stringToBeSearched * @param stringToSearch * @return */ protected boolean canStringBeSubString(final String stringToBeSearched, final String stringToSearch) { if(stringToBeSearched == null || stringToSearch == null || stringToBeSearched.equals("") || stringToSearch.equals("")) return false; if(stringToSearch.length() > stringToBeSearched.length()) return false; return true; } }
package ict.kosovo.growth.ora_7; public class DeckOfCards { public static void main(String[] args) { String [] rank = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"}; String [] suit = {":clubs:", ":diamonds:", ":hearts:", ":spades:"}; String [] deck = new String[52]; for (int j = 0; j < suit.length; j++){ for (int i = 0; i < deck.length; i++){ deck[i + 13 * j] = rank[i] + suit[j]; } for (int i = 0; i < deck.length; i ++) System.out.println(deck[i] + " "); } System.out.println(); } }
package tw.skyarrow.ehreader.app.search; import android.app.ActionBar; import android.app.SearchManager; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.provider.SearchRecentSuggestions; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.view.MenuItem; import tw.skyarrow.ehreader.R; import tw.skyarrow.ehreader.app.main.MainDrawerActivity; import tw.skyarrow.ehreader.app.main.MainFragmentWeb; import tw.skyarrow.ehreader.provider.SearchSuggestionProvider; import tw.skyarrow.ehreader.util.ActionBarHelper; /** * Created by SkyArrow on 2014/1/28. */ public class SearchActivity extends MainDrawerActivity { private static final String TAG = "SearchActivity"; private String query; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setupDrawer(); setDrawerIndicatorEnabled(false); Intent intent = getIntent(); ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); boolean loggedIn = preferences.getBoolean(getString(R.string.pref_logged_in), false); if (Intent.ACTION_SEARCH.equals(intent.getAction()) && savedInstanceState == null) { FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); Fragment fragment = new MainFragmentWeb(); Bundle bundle = new Bundle(); query = intent.getStringExtra(SearchManager.QUERY); SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, SearchSuggestionProvider.AUTHORITY, SearchSuggestionProvider.MODE); bundle.putString("base", ActionBarHelper.buildSearchUrl(query, loggedIn)); fragment.setArguments(bundle); suggestions.saveRecentQuery(query, null); if (actionBar != null) { actionBar.setTitle(query); } ft.replace(R.id.container, fragment); ft.commit(); } } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: ActionBarHelper.upNavigation(this); return true; } return super.onOptionsItemSelected(item); } }
package com.hmammon.photointerface; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; /** * 网络状态API * Created by Xcfh on 2014/10/23. */ public class NetStateApi { private static NetStateApi instance; private Context context; private NetStateApi(Context context) { this.context = context; } public static NetStateApi getInstance(Context context) { if (instance == null) instance = new NetStateApi(context); return instance; } public NetStateInfo getNetStateInfo() { NetStateInfo netStateInfo = new NetStateInfo(); ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo[] networkInfos = connectivityManager.getAllNetworkInfo(); for (NetworkInfo networkInfo : networkInfos) { if (networkInfo.isAvailable() && networkInfo.isConnected()) { netStateInfo.setNetAvailable(true); netStateInfo.setNetType(networkInfo.getType()); if (networkInfo.getType() == ConnectivityManager.TYPE_WIFI) { break; } } } return netStateInfo; } public class NetStateInfo { private boolean netAvailable = false; private int netType; public boolean isNetAvailable() { return netAvailable; } public void setNetAvailable(boolean netAvailable) { this.netAvailable = netAvailable; } public int getNetType() { return netType; } public void setNetType(int netType) { this.netType = netType; } } }
/* * Copyright by Deppon and the original author or authors. * * This document only allow internal use ,Any of your behaviors using the file * not internal will pay legal responsibility. * * You may learn more information about Deppon from * * * http://www.deppon.com * */ package com.goodhealth.framework.session; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.goodhealth.comm.util.CookiesUtil; import com.goodhealth.comm.util.SpringBeanUtil; import com.goodhealth.comm.util.StringUtil; import com.goodhealth.framework.entity.user.IUser; import com.goodhealth.framework.entity.user.UserContextEntity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import com.goodhealth.comm.util.redis.RedisService; import com.goodhealth.comm.util.restful.HttpUtil; import com.goodhealth.comm.util.token.JwtUtil; import javax.servlet.http.HttpServletRequest; /** * 无状态session */ public class DefaultSession { private Logger LoggerUtil = LoggerFactory.getLogger(this.getClass()); public static final String TOKEN = "token"; private HttpServletRequest request; private String token; private SessionInfo sessionInfo; /** * 当前浏览器session * @param */ DefaultSession() { // 获取当前request this.request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); // 读取token this.readToken(); if (StringUtil.isNotEmpty(this.token)) { this.current(); } if(!this.active()){ // session信息无效 创建新的 this.create(); } //重置session过期时间 this.resetTimeout(); } /** * 读取token */ void readToken(){ if(StringUtil.isBlank(this.token)) { this.token = this.request.getHeader(TOKEN); } if(StringUtil.isBlank(this.token)){ this.token = this.request.getHeader(TOKEN); } // 请求头中找不到时去cookie中寻找 if(StringUtil.isBlank(this.token)) { this.token = CookiesUtil.readCookie(TOKEN); } if (StringUtil.isBlank(this.token)) { this.token = CookiesUtil.readCookie(TOKEN); } } /** * 创建session * */ void create() { try{ String ip = HttpUtil.getUserClientIp(request); // 生成token this.token = JwtUtil.generateTonken(); LoggerUtil.debug("=========================================\r\n create session token:"+token); // 创建sessionInfo this.sessionInfo = SessionInfo.create(request); // 缓存操作 this.getRedisService().hset(getHashKeyOfSession(), "key", JSON.toJSONString(this.sessionInfo)); }catch (Exception e) { LoggerUtil.error("ecosession init error", e); } } /** * 获取session信息解析成SessionInfo */ void current(){ try{ if(this.getRedisService().hexists(getHashKeyOfSession(), "key")){ //缓存中获取session信息 String sessionInfoJson = this.getRedisService().hget(getHashKeyOfSession(), "key"); // 从缓存中解析当前sessionInfo this.sessionInfo = SessionInfo.conversionFromJson(sessionInfoJson); } }catch (Exception e) { LoggerUtil.error("session init error", e); } } /** * 重置token */ public void resetToken(){ try{ // 当前key String oldkey = getHashKeyOfSession(); // 重新生成token this.token = JwtUtil.generateTonken(); // 新key String newkey = getHashKeyOfSession(); // 重命名eco_session缓存key this.getRedisService().rename(oldkey, newkey); // 将token写入cookie CookiesUtil.writeCookie(TOKEN, this.token, this.sessionInfo.getTimeout(), true); }catch (Exception e) { LoggerUtil.error("ecosession restToken error", e); } } /** * 是否可用 SessionInfo存在并且有效 * @return */ public boolean active(){ try{ if(this.sessionInfo==null){ return false; } // 是否session过期 if(!sessionInfo.isTimeout()){ return true; } }catch (Exception e) { LoggerUtil.error("ecosession active method error", e); } return false; } /** * 重置session过期时间 * @return */ public void resetTimeout(){ this.resetTimeout(this.sessionInfo.getTimeout()); } /** * 重置session过期时间 * @return */ public void resetTimeout(int timeout){ //写入cookie CookiesUtil.writeCookie(TOKEN, this.token, timeout, true); // 设置sessionInfo超时时间 this.sessionInfo.setTimeout(timeout); // 设置最后使用时间为当前时间 this.sessionInfo.updateLastUseTime(); // 修改缓存中 session 信息 if(this.getRedisService().hexists(getHashKeyOfSession(), "key")){ this.getRedisService().hset(getHashKeyOfSession(), "key", JSON.toJSONString(this.sessionInfo)); } // 重设缓存信息的过期时间 this.getRedisService().expire(getHashKeyOfSession(), timeout); } /** * 获取session属性 * @param key * @return */ public String get(String key){ return (String) this.getRedisService().hget(getHashKeyOfSession(), key); } /** * 设置session属性 * @param key * @param json */ public void set(String key, String json) { this.getRedisService().hset(getHashKeyOfSession(), key, json); } /** * 保存sessions属性 * @param key * @param obj */ public void set(String key, Object obj){ String json = JSONObject.toJSONString(obj).toString(); set(key, json); } /** * 删除session中属性 * @param fields */ public void remove(Object ...fields){ this.getRedisService().hdel(getHashKeyOfSession(), fields); } /** * session中保存当前登录用户 * @param userContextEntity */ public void setCurrentUser(UserContextEntity userContextEntity){ this.set("key", userContextEntity); } /** * 清除session中保存当前登录用户 * */ public void clearCurrentUser(){ this.getRedisService().hdel(getHashKeyOfSession(), "key"); } /** * 当前session中的登录用户 * * @param clazz * @return */ UserContextEntity getCurrentUserContext(Class<? extends IUser> clazz){ String json = (String) this.getRedisService().hget(getHashKeyOfSession(), "key"); UserContextEntity userContextEntity = null; if(StringUtil.isNotEmpty(json)){ try{ JSONObject jsonObject = JSONObject.parseObject(json); userContextEntity = JSONObject.parseObject(json, UserContextEntity.class); // user信息单独解析 if(clazz!=null && userContextEntity!=null && jsonObject.getJSONObject(UserContextEntity.JSON_FIELD_USER)!=null) { IUser user = JSONObject.parseObject(jsonObject.get(UserContextEntity.JSON_FIELD_USER).toString(),clazz); userContextEntity.setUser(user); userContextEntity.setId(user.getId()); } }catch (Exception e) { LoggerUtil.error("getCurrentUser出现异常",e); } } return userContextEntity; } /** * 获取当前token * * @return */ public String getToken() { return token; } /** * sentToken * * @param token */ public void setToken(String token) { this.token = token; } /** * 获取缓存中用户信息,存储的key * @return */ public String getHashKeyOfSession(){ return "key" + this.token; } /** * 返回redisSrvice * @return */ private RedisService getRedisService(){ return SpringBeanUtil.getBean(RedisService.class); } public SessionInfo getSessionInfo(){ return this.sessionInfo; } }
package com.xxx; import java.io.IOException; import org.apache.http.HttpHost; import org.elasticsearch.action.delete.DeleteRequest; import org.elasticsearch.action.delete.DeleteResponse; import org.elasticsearch.action.update.UpdateRequest; import org.elasticsearch.action.update.UpdateResponse; import org.elasticsearch.client.RestClient; import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; /** * @author xujunming * Created on 2020-03-22 */ public class Main06 { public static void main(String[] args) throws IOException { RestHighLevelClient client = new RestHighLevelClient( RestClient.builder( // 指定 ElasticSearch 集群各个节点的地址和端口号 new HttpHost("localhost", 9200, "http"))); XContentBuilder builder = XContentFactory.jsonBuilder(); builder.startObject(); { builder.field("age", 30); builder.field("message", "update Test"); } builder.endObject(); // 创建 UpdateReques请求 UpdateRequest request = new UpdateRequest("skywalking", "type","1").doc(builder); // 发送请求 UpdateResponse updateResponse = client.update(request); System.out.println(updateResponse); } }
package threadPooledServer; import java.io.BufferedOutputStream; import java.io.IOException; import java.io.InterruptedIOException; import java.math.BigInteger; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; /** * Created by Lenovo T420 on 19-1-2018. */ public class BinaryFileWriter implements Runnable{ private final Integer messages; private List<String> content; private List<List<String>> contents; private String filePath; BinaryFileWriter(List<String> content, String filePath, int messages) { this.messages = messages; this.content = content; this.filePath = filePath; } /** * Write raw data to file using BufferedOutputStream */ public void run() { Path fileP = Paths.get(filePath); try (BufferedOutputStream outputStream = new BufferedOutputStream(Files.newOutputStream(fileP))) { String aantBericht = messages.toString(); while(aantBericht.length()<3){aantBericht+=" ";} outputStream.write(aantBericht.getBytes()); for (String line : content) { outputStream.write(line.getBytes()); } outputStream.close(); } catch (IOException e) { e.printStackTrace(); }finally { } } }
package org.xgame.commons.thread; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.concurrent.atomic.AtomicLong; /** * @Name: AbstractThread.class * @Description: // * @Create: DerekWu on 2018/9/22 0:29 * @Version: V1.0 */ public abstract class AbstractThread<T> implements Runnable { private final Logger LOG = LogManager.getLogger(getClass()); protected final String threadName; protected volatile boolean shutDown; private Thread thread; private final boolean daemon; private AtomicLong countNum = new AtomicLong(0); protected AbstractThread(String threadName) { this.threadName = threadName; this.shutDown = false; this.thread = null; this.daemon = false; } protected AbstractThread(String threadName, boolean isDaemon) { this.threadName = threadName; this.shutDown = false; this.thread = null; this.daemon = isDaemon; } public synchronized void shutdown() { this.shutDown = true; if (this.thread == null) { throw new Error("Thread not exsit! "); } LOG.info(this.threadName + " thread begin shutdown..."); } public synchronized void start() { if (this.thread != null) { throw new Error("Thread is run!"); } this.thread = new Thread(this, this.threadName); if (this.daemon) { //是否守护进程 this.thread.setDaemon(true); } this.thread.start(); LOG.info(this.threadName + " thread started..."); } public String getThreadName() { return threadName; } public boolean isShutDown() { return shutDown; } public boolean isDaemon() { return daemon; } public long incrCountNum() { return this.countNum.incrementAndGet(); } public long decrCountNum() { return this.countNum.decrementAndGet(); } public long getCountNum() { return this.countNum.get(); } protected void execute(T t) throws Exception {} }
/** * Spring Data JPA repositories. */ package com.faizalsidek.inventory.repository;
package com.DoAn.HairStyle.respositiry; import com.DoAn.HairStyle.dto.Response; import com.DoAn.HairStyle.entity.OrderEntity; import com.DoAn.HairStyle.entity.UserEntity; import org.springframework.data.jpa.repository.JpaRepository; import javax.transaction.Transactional; import java.util.Optional; public interface UserRespository extends JpaRepository<UserEntity, String> { UserEntity findByToken(String token); UserEntity findByNumberPhone(String numberPhone); @Transactional void deleteByToken(String token); }
package cn.neepu.po; public class B2 { private Integer id; private String nd; private String sd; private String bzr; private String zzz; private String shnr; private String spr; private String wj; private String bz; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getNd() { return nd; } public void setNd(String nd) { this.nd = nd == null ? null : nd.trim(); } public String getSd() { return sd; } public void setSd(String sd) { this.sd = sd == null ? null : sd.trim(); } public String getBzr() { return bzr; } public void setBzr(String bzr) { this.bzr = bzr == null ? null : bzr.trim(); } public String getZzz() { return zzz; } public void setZzz(String zzz) { this.zzz = zzz == null ? null : zzz.trim(); } public String getShnr() { return shnr; } public void setShnr(String shnr) { this.shnr = shnr == null ? null : shnr.trim(); } public String getSpr() { return spr; } public void setSpr(String spr) { this.spr = spr == null ? null : spr.trim(); } public String getWj() { return wj; } public void setWj(String wj) { this.wj = wj == null ? null : wj.trim(); } public String getBz() { return bz; } public void setBz(String bz) { this.bz = bz == null ? null : bz.trim(); } }
package com.example.demo; import java.io.Serializable; public class IntroToInterfaces implements DemoInterface, Serializable { /* Things not in Interface bodies in the interface methods constructors must not create an object Things in an interface methods are public an abstract static exist but isn't practical you can implement various interfaces */ @Override public void bruh() { System.out.println("Bruh!"); } public static void main(String[] args){ DemoInterface.printInfo(); } } interface DemoInterface{ void bruh(); public static void printInfo(){ System.out.println("son"); } }
package com.smartup.manageorderapplication.services; import java.util.List; import com.smartup.manageorderapplication.dto.ClientDto; public interface ClientService { public List<ClientDto> getClients(); public ClientDto getClient(Long id); public ClientDto createClient(ClientDto inDto); }
package com.inventoryManagement.Proj.dao; import org.springframework.data.jpa.repository.JpaRepository; import com.inventoryManagement.Proj.model.Order; public interface OrderDao extends JpaRepository<Order, Integer> { }
package Dessert; import org.springframework.beans.factory.annotation.Qualifier; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Created by Jared Ramirez on 4/4/2015. * Byte-Pushers */ public class Annotations { @Target({ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Qualifier public @interface Special { } }
package top.kylewang.bos.dao.take_delivery; import org.springframework.data.jpa.repository.JpaRepository; import top.kylewang.bos.domain.take_delivery.Order; /** * @author Kyle.Wang * 2018/1/7 0007 19:44 */ public interface OrderRepository extends JpaRepository<Order,Integer> { /** * 根据订单号查询订单 * @param orderNum * @return */ Order findByOrderNum(String orderNum); }
package quiz21; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class ArrayListQuiz03 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); List<User> list = new ArrayList<>(); a:while(true) { System.out.println("[1.등록 | 2.회원정보보기| 3.회원정보검색| 4.회원정보삭제| 5.종료]"); System.out.print("> "); int menu = scan.nextInt(); switch (menu) { case 1: System.out.print("이름 > "); String name = scan.next(); System.out.print("나이 > "); int age = scan.nextInt(); //스캐너로 이름, 나이를 받고 User객체에 저장, list에 추가 User u = new User(name,age); list.add(u); System.out.println(list.toString()); break; case 2: //list길이 만큼 회전하면서 모든 회원정보 출력 System.out.print("["); for (int i = 0; i < list.size(); i++) { System.out.print(" 이름 : " +list.get(i).getName()+", 나이 : "+list.get(i).getAge()+" "); } System.out.print("]"); System.out.println(); break; case 3: System.out.print("찾을 이름 > "); String findName = scan.next(); String info; for (int i = 0; i < args.length; i++) { if(list.get(i).getName().equals(findName) ) { System.out.println("이름 : "+list.get(i).getName() + ", 나이 : "+list.get(i).getAge()); break; } if(i == list.size()-1) System.out.println(findName+"님은 목록에 없습니다"); } //찾을 이름을 입력 받고, 이름이 있다면 이름, 나이 출력 //찾는 이름이 없으면, ~~님은 목록에 없습니다 출력 break; case 4: System.out.print("목록에서 삭제 할 이름 : "); name = scan.next(); for (int i = 0; i < list.size(); i++) { if(list.get(i).getName().equals(name)) { list.remove(i); System.out.println(name+"이 삭제 되었습니다."); break; }else System.out.println("입력하신 이름은 목록에 없습니다."); break; } //삭제할 이름을 입력받고, 입력받은 이름과 동일하면 User를 삭제 break; case 5: System.out.println("종료합니다"); break a; default: System.out.println("다시 입력하세요"); break; } } } }
package ashman; import java.io.Serializable; public class LevelPreferences implements Serializable{ public int level, ashStartX, ashStartY, numOfGhosts, ghostSpeed; public LevelPreferences(int level){ ashStartX = 0; ashStartY = 0; this.level = level; if(level == 1){ numOfGhosts = 2; ghostSpeed = 2; } else{ numOfGhosts = 4; ghostSpeed = 1; } } public LevelPreferences(int level, int ashStartX, int ashStartY, int numOfGhosts, int ghostSpeed){ this.level = level; this.ashStartX = ashStartX; this.ashStartY = ashStartY; this.numOfGhosts = numOfGhosts; this.ghostSpeed = ghostSpeed; } int[] toArray() { return new int[] {level, ashStartX, ashStartY, numOfGhosts, ghostSpeed}; } }
package com.tt.miniapp.webbridge.sync; import android.content.Context; import android.view.View; import android.widget.EditText; import com.tt.miniapp.AppbrandApplicationImpl; import com.tt.miniapp.WebViewManager; import com.tt.miniapp.component.nativeview.Input; import com.tt.miniapp.component.nativeview.NativeViewManager; import com.tt.miniapp.util.InputMethodUtil; import com.tt.miniapp.webbridge.WebEventHandler; import com.tt.miniapphost.AppBrandLogger; import com.tt.miniapphost.AppbrandContext; import com.tt.miniapphost.util.CharacterUtils; import com.tt.miniapphost.util.JsonBuilder; import org.json.JSONObject; public class HideKeyBoardHandler extends WebEventHandler { public HideKeyBoardHandler(WebViewManager.IRender paramIRender, String paramString, int paramInt) { super(paramIRender, paramString, paramInt); } public String act() { try { final int inputId = (new JSONObject(this.mArgs)).optInt("inputId"); if (this.mRender == null) return makeFailMsg("current render is null"); NativeViewManager nativeViewManager = this.mRender.getNativeViewManager(); if (nativeViewManager == null) return makeFailMsg("native view manager is null"); if (i <= 0) return makeFailMsg("input id error"); final View view = nativeViewManager.getView(i); if (view instanceof EditText) { InputMethodUtil.hideSoftKeyboard((EditText)view, (Context)AppbrandContext.getInst().getApplicationContext()); AppbrandContext.mainHandler.post(new Runnable() { public void run() { View view = view; if (view instanceof Input) { Input input = (Input)view; JSONObject jSONObject = (new JsonBuilder()).put("inputId", Integer.valueOf(inputId)).put("cursor", Integer.valueOf(input.getCursor())).put("value", input.getValue()).build(); WebViewManager webViewManager = AppbrandApplicationImpl.getInst().getWebViewManager(); if (webViewManager != null) { webViewManager.publishDirectly(HideKeyBoardHandler.this.mRender.getWebViewId(), "onKeyboardConfirm", jSONObject.toString()); webViewManager.publishDirectly(HideKeyBoardHandler.this.mRender.getWebViewId(), "onKeyboardComplete", jSONObject.toString()); } HideKeyBoardHandler.this.mRender.getNativeViewManager().removeView(inputId, null); } } }); return CharacterUtils.empty(); } return makeFailMsg("input id error"); } catch (Exception exception) { AppBrandLogger.e("tma_HideKeyBoardHandler", new Object[] { "", exception }); return makeFailMsg(exception); } } public String getApiName() { return "hideKeyboard"; } } /* Location: C:\Users\august\Desktop\tik\df_miniapp\classes.jar!\com\tt\miniapp\webbridge\sync\HideKeyBoardHandler.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.1.3 */
package com.ibeiliao.pay.web.open.notify; import com.ibeiliao.pay.api.ApiResultBase; import com.ibeiliao.pay.api.dto.request.PaymentNotifyRequest; import com.ibeiliao.pay.api.dto.response.PaymentNotifyResponse; import com.ibeiliao.pay.api.provider.PaymentNotifyProvider; import com.ibeiliao.pay.common.utils.IpAddressUtils; import com.ibeiliao.pay.common.utils.JsonUtil; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.OutputStream; import java.util.*; /** * 支付宝回调通知 * @author linyi 2016/8/13 */ @Controller @RequestMapping("/open/alipay") public class AlipayNotifyController { private static final Logger logger = LoggerFactory.getLogger(AlipayNotifyController.class); @Autowired private PaymentNotifyProvider paymentNotifyProvider; /** * 处理支付宝的回调通知。 * 支付宝进行异步通知的条件: * <pre> * 触发条件名 触发条件描述 备注 * TRADE_FINISHED 交易成功 true(触发通知) * TRADE_SUCCESS 支付成功 true(触发通知) * WAIT_BUYER_PAY 交易创建 true(触发通知) * TRADE_CLOSED 交易关闭 false(不触发通知) * </pre> * 正常情况下,支付宝应该是 post。 * 处理成功返回 "success" 给支付宝为成功(不包含双引号),其他为失败。 * @param request * @param response */ @RequestMapping(value = "notify.do") // , method = RequestMethod.POST public void notify(HttpServletRequest request, HttpServletResponse response) throws IOException { /* * doc: * https://doc.open.alipay.com/doc2/detail?treeId=59&articleId=103666&docType=1 */ Map<String, String[]> reqParams = request.getParameterMap(); String clientIp = IpAddressUtils.getClientIpAddr(request); logParams(reqParams, clientIp); String result = "fail"; if (reqParams != null && reqParams.size() > 0) { PaymentNotifyRequest req = new PaymentNotifyRequest("", reqParams, clientIp); try { PaymentNotifyResponse resp = paymentNotifyProvider.alipayNotify(req); logger.info("支付宝通知处理结果 | response: {}", JsonUtil.toJSONString(resp)); if (ApiResultBase.isSuccess(resp)) { result = "success"; } } catch (Exception e) { logger.error("支付宝通知处理失败", e); } } OutputStream out = response.getOutputStream(); out.write(result.getBytes()); out.flush(); out.close(); } // ------- private methods /** * log 支付宝的回调参数表 * * @param reqParams 参数表 * @param clientIp 调用者IP */ private void logParams(Map<String, String[]> reqParams, String clientIp) { if (reqParams != null && reqParams.size() > 0) { Iterator<Map.Entry<String, String[]>> iter = reqParams.entrySet().iterator(); StringBuilder buf = new StringBuilder(reqParams.size() * 16 + 16); while (iter.hasNext()) { Map.Entry<String, String[]> entry = iter.next(); // 不记录敏感信息 if (entry.getKey().indexOf("buyer") < 0 && entry.getKey().indexOf("seller") < 0) { buf.append(entry.getKey()).append(": "); if (entry.getValue() == null) { buf.append("null"); } else { buf.append(StringUtils.join(entry.getValue(), ',')); } buf.append(", "); } } logger.info("支付宝充值回调 | clientIp: {}, params: {}", clientIp, buf.toString()); } else { logger.info("支付宝充值回调参数为空 | clientIp: {}", clientIp); } } /** * 转换参数为 String -&gt; String * @param params HttpServletRequest参数 * @return */ private Map<String, String> convert(Map<String, String[]> params) { Map<String, String> paramsMap = new HashMap<String, String>(params.size() * 4 / 3 + 1); for (Map.Entry<String, String[]> entry : params.entrySet()) { paramsMap.put(entry.getKey(), StringUtils.join(entry.getValue())); } return paramsMap; } /** * 将回调请求的参数装载到parameters * * @param reqParams 请求参数 */ private SortedMap<String, String> initRequestParams(Map<String, String[]> reqParams) { SortedMap<String, String> parameters = new TreeMap<String, String>(); Iterator it = reqParams.keySet().iterator(); while (it.hasNext()) { String k = (String) it.next(); String v = (reqParams.get(k))[0]; if (StringUtils.isNotBlank(v)) { parameters.put(k, v.trim()); } } return parameters; } }
package seava.ad.business.ext.system.delegate; import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collection; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import seava.j4e.api.Constants; import seava.j4e.api.action.impex.IImportDataPackage; import seava.j4e.api.exceptions.BusinessException; import seava.j4e.api.exceptions.ErrorCode; import seava.j4e.commons.security.AppClient; import seava.j4e.commons.security.AppUser; import seava.j4e.commons.security.AppWorkspace; import seava.j4e.api.session.IClient; import seava.j4e.api.session.IUser; import seava.j4e.api.session.IWorkspace; import seava.j4e.api.service.business.IImportDataPackageService; import seava.j4e.api.session.Session; import seava.j4e.business.service.AbstractBusinessDelegate; import seava.ad.domain.impl.security.Role; import seava.ad.domain.impl.security.User; import seava.ad.domain.impl.system.Client; public class Client_Bd extends AbstractBusinessDelegate { final static Logger logger = LoggerFactory.getLogger(Client_Bd.class); /** * Create a new client with an administrator user and initial data import * from the specified location. * * Executed in a system-user context * * @param client * @param userCode * @param userName * @param loginName * @param password * @param importJob * @param importPath * @throws BusinessException */ public void createClientWithAdminUserAndSetup(Client client, String userCode, String userName, String loginName, String password, IImportDataPackage dataPackage) throws BusinessException { this.setupNewClient(client, userCode, userName, loginName, password, dataPackage); } /** * Create a new client with an administrator user. * * Executed in a system-user context * * @param client * @param userCode * @param userName * @param password * @throws BusinessException */ public void createClientWithAdminUser(Client client, String userCode, String userName, String loginName, String password) throws BusinessException { this.setupNewClient(client, userCode, userName, loginName, password, null); } /** * Private worker method. * * Client is created in the current system-user context, then the initial * data-import is executed in the context of the newly created administrator * user of the new client. * * @param client * @param userCode * @param userName * @param password * @param importJob * @throws BusinessException */ private void setupNewClient(Client client, String userCode, String userName, String loginName, String password, IImportDataPackage dataPackage) throws BusinessException { client.setAdminRole(Constants.ROLE_ADMIN_CODE); client.setActive(true); this.getEntityManager().persist(client); IUser su = Session.user.get(); IClient c = new AppClient(client.getId(), client.getCode(), client.getName()); IWorkspace ws = new AppWorkspace(client.getWorkspacePath()); IUser newUser = new AppUser(su.getCode(), su.getName(), su.getLoginName(), "", null, null, c, su.getSettings(), su.getProfile(), ws, false); try { Session.user.set(newUser); Role radmin = new Role(); radmin.setCode(Constants.ROLE_ADMIN_CODE); radmin.setName(Constants.ROLE_ADMIN_NAME); radmin.setDescription(Constants.ROLE_ADMIN_DESC); radmin.setActive(true); this.getEntityManager().persist(radmin); Role ruser = new Role(); ruser.setCode(Constants.ROLE_USER_CODE); ruser.setName(Constants.ROLE_USER_NAME); ruser.setDescription(Constants.ROLE_USER_DESC); ruser.setActive(true); this.getEntityManager().persist(ruser); Collection<Role> roles = new ArrayList<Role>(); roles.add(radmin); roles.add(ruser); User u = new User(); u.setCode(userCode); u.setName(userName); u.setLoginName(loginName); u.setActive(true); MessageDigest messageDigest; try { messageDigest = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { throw new BusinessException(ErrorCode.G_RUNTIME_ERROR, "No MD5 algrorithm available", e); } messageDigest.update(password.getBytes(), 0, password.length()); String hashedPass = new BigInteger(1, messageDigest.digest()) .toString(16); if (hashedPass.length() < 32) { hashedPass = "0" + hashedPass; } u.setPassword(hashedPass); u.setRoles(roles); this.getEntityManager().persist(u); if (dataPackage != null) { this.getApplicationContext() .getBean(IImportDataPackageService.class) .doExecute(dataPackage); } } catch (Exception e) { throw new BusinessException(ErrorCode.G_RUNTIME_ERROR, e.getMessage(), e); } finally { Session.user.set(su); } } }
package com.exercise; public class Exer2_Main { public static void main(String[] args) { Class1 cls = null; try { cls.firstMethod(); } catch (Exception e) { System.out.println(e); } } }
package com.tianlang.service.handler; import com.tianlang.service.UsbSell; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; //代理类,实现代理类的功能(调用目标方法、功能增强) public class SellHandler implements InvocationHandler { public Object target = null; // 活动的,传入谁,就给谁创建代理 public SellHandler(Object target) { this.target = target; } @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Object res = null; //float price = factory.sell(amount); 原方式调用目标函数 res = method.invoke(target,args); //动态代理的方式 // price = price + 20; 原方式实现功能增强 if (res != null){ Float price = (Float)res; price = price + 20; res = price; } return res; } }
package com.ssm.wechatpro.dao; import java.util.List; import java.util.Map; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; /** * 商品类型的dao操作 * @author administrator * */ public interface WechatProductTypeMapper { //获取所有商品类型(分页使用) public List<Map<String, Object>> getProductTypeList(Map<String, Object> map, PageBounds pageBounds) throws Exception; //获取所有的商品类型(普通使用) public List<Map<String, Object>> getProductTypeList(Map<String, Object> map) throws Exception; //根据id获取一个商品类型 public Map<String, Object> getProductTypeById(Map<String, Object> map) throws Exception; //根据typeName获取一个商品类型 public Map<String, Object> getProductTypeByName(Map<String, Object> map) throws Exception; //添加一个商品类型 public void addProductType(Map<String, Object> map) throws Exception; //修改一个商品类型 public void upateProductType(Map<String, Object > map) throws Exception; //查询所有商品的种类,并按照id递增顺序排列 public List<Map<String, Object>> selectProductType() throws Exception; //获取当前商品种类优先级别最高的 public Map<String, Object> getMaxTypePriority() throws Exception; }
package com.example.service; import com.example.entity.Category; import java.util.List; public interface ICategoryService { public List<Category> findAll(); public Category findCategoryById(Integer id); public Category saveCategory(Category category); public String deleteCategory(Integer id); public String updateCategory(Category category); }
package gameMechanics; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; public abstract class Building extends MapObject{ //A class for all buildings on the map which the player controls private utilities.DoubleLinkedLockedListNode<Building> node;//node which corresponds to the position in the list of all buildings where this building is saved public Building(){ } protected Building(Map map, int x, int y, int angle, utilities.DoubleLinkedLockedList<Building> list) { super(map, x, y, angle); node=list.addNode(this);//Add the building to the list and remember where it is saved } //What happens each time a production tick occurs public void onProductionTick(){ } //called to delete the building public void delete(){ node.remove(); } protected void updateSpot(Spot spot){ spot.setBuilding(this); } public boolean areResourcesAvailable(Map map){ return map.resources.possibleToRemResByNames(getCostItemNames(), getCostItemAmounts()); } public boolean isBuildable(Map map, int x, int y, int angle){ return map.resources.possibleToRemResByNames(getCostItemNames(), getCostItemAmounts()) && isPlacable(map, x, y, angle); } public int build(Map map, int x, int y, int angle, utilities.DoubleLinkedLockedList<Building> list){ if(!areResourcesAvailable(map)){ return 2;//Code for not enough resources }else if(!isPlacable(map, x, y, angle)){ return 3;//Code for unsuitable terrain }else{ try { System.out.println(this.getClass().getConstructors()[1]); this.getClass().getConstructor(Map.class, int.class, int.class, int.class, utilities.DoubleLinkedLockedList.class).newInstance(map, x, y, angle, list); } catch (InstantiationException e) { e.printStackTrace(); return 1;//Code for unknown error } catch (IllegalAccessException e) { e.printStackTrace(); return 1;//Code for unknown error } catch (IllegalArgumentException e) { e.printStackTrace(); return 1;//Code for unknown error } catch (InvocationTargetException e) { e.printStackTrace(); return 1;//Code for unknown error } catch (NoSuchMethodException e) { e.printStackTrace(); return 1;//Code for unknown error } catch (SecurityException e) { e.printStackTrace(); return 1;//Code for unknown error } return 0;//Code for successful placement } } //Getter methods //Abstract methods //Abstract getter methods public abstract ArrayList<String> getCostItemNames(); public abstract ArrayList<Integer> getCostItemAmounts(); //Abstract setter methods }
// $Id: fibo.java,v 1.2 2000/12/24 19:10:50 doug Exp $ // http://www.bagley.org/~doug/shootout/ package com.harris.mobihoc; public class fibo implements Runnable{ private boolean contin = false; private int N = 10; public fibo(boolean contin, int N){ this.contin = contin; this.N = N; } @Override public void run(){ //int N = Integer.parseInt(args[0]); System.out.println(fib(N)); if(contin){ try{ Thread trial = new Thread(new hash(contin, N)); trial.start(); }catch(Exception e){ e.printStackTrace(); } } } public static int fib(int n) { if (n < 2) return(1); return( fib(n-2) + fib(n-1) ); } }
package tr.edu.fsm.javaprogramingapp.quiz; /** * Created by erol on 12.04.2017. */ public class Quiz { String quiz; String soru; String cevap; String title; public Quiz(String title, String soru, String cevap) { this.soru = soru; this.cevap = cevap; this.title = title; } public Quiz(String quiz){ this.quiz = quiz; } public String getQuiz(){ return this.quiz; } }
package controllers; import junit.framework.TestCase; import model.Field; import org.mockito.Mockito; import services.FieldService; import java.util.Collections; /** * @author D.Tolpekin */ public class ApplicationTest extends TestCase { public void testHaveFields() throws Exception { FieldService mock = Mockito.mock(FieldService.class); Mockito.when(mock.getActualFields()).thenReturn(Collections.singletonList(new Field())); Application app = new Application(mock, null); assertTrue(app.haveFields()); } }
package Impl; import java.util.ArrayList; import java.util.List; import Dao.AdminDao; import entity.Admin; public class AdminDaoImpl implements AdminDao{ List<Admin> adminlist=new ArrayList<Admin>(); public void init(){ Admin adm1=new Admin(1,"admin","123456"); adminlist.add(adm1); } @Override public List<Admin> AdminList() { return adminlist; } @Override public boolean insert(Admin admin) { return adminlist.add(admin); } }
import controller.Manager; import models.*; import utils.*; import java.io.*; import java.util.*; public class app { private static int money; // Status de las rooms. private static Set<String> statusRoom = new HashSet<>(); // Create hash from Customers, Workers and Rooms. public static HashMap<Integer, Customer> customers = new HashMap<>(); private static HashMap<Integer, Worker> workers = new HashMap<>(); private static HashMap<String, Room> rooms = new HashMap<>(); public static void main(String[] args) { // start app with 1000 of money money = 1000; //initialize status rooms for checkout later. setStatusRoom(); // We watch data to import from Mar. watchDataMar(); // now start speak with customers. startPlay(); } private static void startPlay() { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { // igual que en Mar pero con for. for (String chain = br.readLine(); chain != null; chain = br.readLine()) { Manager.checkMoney(money); String[] lines = chain.split(" "); menu(lines); } br.close(); } catch (IOException iox) { System.out.println("Error: " + iox.getMessage()); } } private static void watchDataMar() { File dates = new File("Enunciado/P3_load_data.txt"); FileReader fr; try { fr = new FileReader(dates); BufferedReader br = new BufferedReader(fr); String chain; while ((chain = br.readLine()) != null) { String[] lines = chain.split(" "); menu(lines); } br.close(); } catch (IOException ex) { System.out.println("Error leer: " + ex.getMessage()); } } private static void menu(String[] lines) { try { switch (lines[0].toLowerCase()) { case "room": if (lines.length == 4) { String[] servicesRoom = lines[3].toLowerCase().split(","); makeRoom(lines[1], lines[2], servicesRoom); System.out.println(Manager.printBlue("--> new Room added " + lines[1] + " <--")); break; } else { throw new MiExcepcion("[ Wrong number of arguments ]"); } case "worker": if (lines.length == 4) { String[] skills = lines[3].toLowerCase().split(","); int dni = Integer.parseInt(lines[1]); makeWorker(dni, lines[2], skills); System.out.println(Manager.printBlue("--> new Worker added " + lines[1] + " <--")); break; } else { throw new MiExcepcion("[ Wrong number of arguments ]"); } case "reservation": if (lines.length == 4) { String[] servicesCustomer = lines[3].toLowerCase().split(","); int dni = Integer.parseInt(lines[1]); makeCustomer(dni, lines[2], servicesCustomer); break; } else { throw new MiExcepcion("[ Wrong number of arguments ]"); } case "hotel": System.out.println(Colors.BLUE + "==> ROOMS <=="); for (Room room : rooms.values()) { System.out.println(room.toString()); } System.out.println("==> WORKERS <=="); for (Worker worker : workers.values()) { System.out.println(worker.toString()); } System.out.println(Colors.RESET); break; case "problem": if (lines.length == 2) { rooms.get(lines[1]).setStatus("BROKEN"); System.out.println(Manager.printBlue("--> Room set as BROKEN <--")); if (rooms.get(lines[1]).getCustomer() != null) { moveCustomer(lines[1]); } } else { throw new MiExcepcion("[ Wrong number of arguments ]"); } break; case "request": if (lines.length == 3) { String[] servicesBroken = lines[2].split(","); setWorker(lines[1], servicesBroken); } else { throw new MiExcepcion("[ Wrong number of arguments ]"); } break; case "finish": if (lines.length == 2) { for (Worker worker : workers.values()) { if (worker.getRoom() != null) { if (worker.getRoom().getNumRoom().equals(lines[1])) { worker.setRoom(null); } } } System.out.println(Manager.printBlue("--> Services finished in room: " + lines[1])); } else { throw new MiExcepcion("[ Wrong number of arguments ]"); } case "leave": if (lines.length == 2) { Room roomLeave = rooms.get(lines[1]); if (roomLeave.getCustomer() != null) { roomLeave.setStatus("UNCLEAN"); //todo: FALLA aaaa Customer customerLeave = roomLeave.getCustomer(); if (customerLeave.getServicesRequest().size() == 0) { money += 100; } else { money -= 50; } roomLeave.setCustomer(null); } else { throw new MiExcepcion("[ This room no have reservation ]"); } } else { throw new MiExcepcion("[ Wrong number of arguments ]"); } break; case "money": if (lines.length == 1) { System.out.println(Colors.PURPLE + "================================"); System.out.println("==> MONEY : " + money + " $ <=="); System.out.println("================================" + Colors.RESET); System.out.println("================================" + Colors.RESET); break; } else { throw new MiExcepcion("[ Wrong number of arguments ]"); } case "exit": if (lines.length == 1) { System.exit(0); break; } else { throw new MiExcepcion("[ Wrong number of arguments ]"); } default: throw new MiExcepcion("[ Wrong Service ]"); } } catch (MiExcepcion mx) { System.out.println(Colors.RED + mx.getMessage() + Colors.RESET); } } private static void setWorker(String numberRoom, String[] services) { Room roomBroken = rooms.get(numberRoom); Set<String> servicesBroken = new HashSet<>(Arrays.asList(services)); boolean chivato; for (String service : servicesBroken) { chivato = false; Worker worker = searchWorker(service); if (worker != null) { worker.setRoom(roomBroken); workers.get(worker.getDni()).setRoom(roomBroken); System.out.println(Manager.printBlue("--> Worker " + worker.getName() + " assigned to Room " + roomBroken.getNumRoom() + " <--")); } else { chivato = true; } if (chivato) { //todo: ESTO NO FUNCIONA ABRA QUE PENSAR MEJOR! Customer noHappy1 = rooms.get(roomBroken.getNumRoom()).getCustomer(); System.out.println(noHappy1.getDni()); noHappy1.setOneServiceRequest(service); } } } private static Worker searchWorker(String service) { for (Worker worker : workers.values()) { if (worker.getRoom() == null) { if (worker.getSkills().contains(service)) { return worker; } } } return null; } private static void moveCustomer(String numRoom) throws MiExcepcion { Customer moveCustomer = rooms.get(numRoom).getCustomer(); rooms.get(numRoom).setCustomer(null); setCustomerToRoom(moveCustomer); } private static void setCustomerToRoom(Customer moveCustomer) throws MiExcepcion { Room goodRoom = null; boolean breac = false; for (Room room : rooms.values()) { if (!breac) { if (room.getStatus().equals("CLEAN")) { if (room.getServices().containsAll(moveCustomer.getServicesWanted())) { if (room.getNumCustomers() == moveCustomer.getNumCustomers()) { goodRoom = room; breac = true; } else { if (room.getNumCustomers() > moveCustomer.getNumCustomers() && goodRoom != null) { if (goodRoom.getNumCustomers() > room.getNumCustomers()) { goodRoom = room; } } else if (room.getNumCustomers() > moveCustomer.getNumCustomers()) { goodRoom = room; } } } } } } if (goodRoom == null) { money -= 100; throw new MiExcepcion("[ There isn't any room available. Custome not asigned. You've lost 100$ ]"); } else { customers.get(moveCustomer.getDni()); rooms.get(goodRoom.getNumRoom()).setStatus("RESERVED"); rooms.get(goodRoom.getNumRoom()).setCustomer(moveCustomer); System.out.println(Manager.printBlue("--> reassigned " + moveCustomer.getDni() + " to Room " + goodRoom.getNumRoom() + " <--")); } } private static void makeCustomer(int dni, String nCustomers, String[] services) throws MiExcepcion { try { int numCustomers = Integer.parseInt(nCustomers); Set<String> servicesWanted = new HashSet<>(Arrays.asList(services)); if (customers.get(dni) == null) { Room goodRoom = null; boolean breac = false; for (Room room : rooms.values()) { if (!breac) { if (room.getStatus().equals("CLEAN")) { if (room.getServices().containsAll(servicesWanted)) { if (room.getNumCustomers() == numCustomers) { goodRoom = room; breac = true; } else { if (room.getNumCustomers() > numCustomers && goodRoom != null) { if (goodRoom.getNumCustomers() > room.getNumCustomers()) { goodRoom = room; } } else if (room.getNumCustomers() > numCustomers) { goodRoom = room; } } } } } } if (goodRoom == null) { money -= 100; throw new MiExcepcion("[ There isn't any room available. Custome not asigned. You've lost 100$ ]"); } else { Customer nCustomer = new Customer(dni, numCustomers, servicesWanted); customers.put(dni, nCustomer); rooms.get(goodRoom.getNumRoom()).setStatus("RESERVED"); rooms.get(goodRoom.getNumRoom()).setCustomer(nCustomer); System.out.println(Manager.printBlue("--> assigned " + dni + " to Room " + goodRoom.getNumRoom() + " <--")); } } else { throw new MiExcepcion("[ Customer already exists ]"); } } catch (NumberFormatException ex) { System.out.println(Colors.RED + "[ Wrong dni or number customers ]" + Colors.RESET); } } private static void makeWorker(int dni, String name, String[] skills) throws MiExcepcion { try { Set<String> skillsGood = new HashSet<>(Arrays.asList(skills)); if (workers.get(dni) == null) { workers.put(dni, new Worker(dni, name, skillsGood)); } else { throw new MiExcepcion("[ Worker already exists ]"); } } catch (NumberFormatException ex) { System.out.println(Colors.RED + "[ Wrong dni ]" + Colors.RESET); } } private static void makeRoom(String numRoom, String numCustomers, String[] services) throws MiExcepcion { int nCustomers = Integer.parseInt(numCustomers); Set<String> servicesGood = new HashSet<>(Arrays.asList(services)); if (rooms.get(numRoom) == null) { rooms.put(numRoom, new Room(numRoom, nCustomers, servicesGood)); } else { throw new MiExcepcion("[ Room already exists ]"); } } private static void setStatusRoom() { // Status from Rooms. statusRoom.add("CLEAN"); statusRoom.add("UNCLEAN"); statusRoom.add("BROKEN"); statusRoom.add("RESERVED"); } }
package com.ulman.currencyrate.fragment; import android.graphics.Typeface; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.design.widget.FloatingActionButton; import android.text.Editable; import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.widget.TextView; import com.ulman.currencyrate.R; import com.ulman.currencyrate.model.CurrencyConverter; import com.ulman.currencyrate.network.CurrencyService; import com.ulman.currencyrate.network.ServiceGenerator; import com.ulman.currencyrate.network.response.cbr.CbrCurrencyRateModelRes; import com.ulman.currencyrate.network.response.cbr.EUR; import com.ulman.currencyrate.network.response.cbr.USD; import com.ulman.currencyrate.preference.CurrencyRatePreference; import com.ulman.currencyrate.preference.DataManager; import com.ulman.currencyrate.utils.NetworkChecker; import com.ulman.currencyrate.utils.SwissKnife; import com.rengwuxian.materialedittext.MaterialEditText; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class CurrencyRateFragment extends BaseFragment { private TextView usdRate, eurRate, descriptionUsdRate, descriptionEurRate, rateUpdateTimeTextView, differenceRateUsdTextView, differenceRateEurTextView; private MaterialEditText converterRubleEditText, converterDollarEditText, converterEuroEditText; private FloatingActionButton updateFloatingActionButton; private float todayExchangeUsdRate; private float todayExchangeEurRate; private boolean eurCurrentFocusFlag; private boolean usdCurrentFocusFlag; private boolean rubleCurrentFocusFlag; public static CurrencyRateFragment newInstance() { Bundle args = new Bundle(); CurrencyRateFragment fragment = new CurrencyRateFragment(); fragment.setArguments(args); return fragment; } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); View view = inflater.inflate(R.layout.fragment_currency_rate, container, false); usdRate = (TextView) view.findViewById(R.id.rate_usd_text_view); eurRate = (TextView) view.findViewById(R.id.rate_eur_text_view); descriptionUsdRate = (TextView) view.findViewById(R.id.description_rate_usd_text_view); descriptionEurRate = (TextView) view.findViewById(R.id.description_rate_eur_text_view); rateUpdateTimeTextView = (TextView) view.findViewById(R.id.rate_update_time_text_view); differenceRateEurTextView = (TextView) view.findViewById(R.id.rate_difference_eur_text_view); differenceRateUsdTextView = (TextView) view.findViewById(R.id.rate_difference_usd_text_view); converterRubleEditText = (MaterialEditText) view.findViewById(R.id.converter_ruble_edit_text); converterDollarEditText = (MaterialEditText) view.findViewById(R.id.converter_dollar_edit_text); converterEuroEditText = (MaterialEditText) view.findViewById(R.id.converter_euro_edit_text); converterEuroEditText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { if (converterEuroEditText.equals(getActivity().getCurrentFocus())) { eurCurrentFocusFlag = true; rubleCurrentFocusFlag = false; usdCurrentFocusFlag = false; } } @Override public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void afterTextChanged(Editable editable) { if (eurCurrentFocusFlag) { try { if (!editable.toString().equals("")) { float value = Float.parseFloat(editable.toString()); String usdResult = String.valueOf(CurrencyConverter.convertCurrency(value, todayExchangeEurRate, todayExchangeUsdRate)); String rubResult = String.valueOf(CurrencyConverter.convertToRub(value, todayExchangeEurRate)); converterDollarEditText.setText(usdResult); converterRubleEditText.setText(rubResult); } else { converterDollarEditText.setText(""); converterRubleEditText.setText(""); } converterEuroEditText.setError(""); } catch (NumberFormatException e) { converterEuroEditText.setError(getString(R.string.converter_input_error_message)); } } } }); converterDollarEditText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { if (converterDollarEditText.equals(getActivity().getCurrentFocus())) { eurCurrentFocusFlag = false; rubleCurrentFocusFlag = false; usdCurrentFocusFlag = true; } } @Override public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void afterTextChanged(Editable editable) { if (usdCurrentFocusFlag) { try { if (!editable.toString().equals("")) { float value = Float.parseFloat(editable.toString()); String usdResult = String.valueOf(CurrencyConverter.convertCurrency(value, todayExchangeUsdRate, todayExchangeEurRate)); String rubResult = String.valueOf(CurrencyConverter.convertToRub(value, todayExchangeUsdRate)); converterEuroEditText.setText(usdResult); converterRubleEditText.setText(rubResult); } else { converterEuroEditText.setText(""); converterRubleEditText.setText(""); } converterDollarEditText.setError(""); } catch (NumberFormatException e) { converterDollarEditText.setError(getString(R.string.converter_input_error_message)); } } } }); converterRubleEditText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { if (converterRubleEditText.equals(getActivity().getCurrentFocus())) { eurCurrentFocusFlag = false; rubleCurrentFocusFlag = true; usdCurrentFocusFlag = false; } } @Override public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void afterTextChanged(Editable editable) { if (rubleCurrentFocusFlag) { try { if (!editable.toString().equals("")) { float value = Float.parseFloat(editable.toString()); String usdResult = String.valueOf(CurrencyConverter.convertRubToCurrency(value, todayExchangeUsdRate)); String eurResult = String.valueOf(CurrencyConverter.convertRubToCurrency(value, todayExchangeEurRate)); converterDollarEditText.setText(usdResult); converterEuroEditText.setText(eurResult); } else { converterDollarEditText.setText(""); converterEuroEditText.setText(""); } converterRubleEditText.setError(""); } catch (NumberFormatException e) { converterRubleEditText.setError(getString(R.string.converter_input_error_message)); } } } }); updateFloatingActionButton = (FloatingActionButton) view.findViewById(R.id.update_floating_action_button); usdRate.setTypeface(Typeface.SANS_SERIF); eurRate.setTypeface(Typeface.SANS_SERIF); descriptionUsdRate.setTypeface(Typeface.SANS_SERIF); descriptionEurRate.setTypeface(Typeface.SANS_SERIF); updateData(); updateRate(); updateFloatingActionButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { updateRate(); } }); return view; } private void updateRate() { if (NetworkChecker.isNetworkAvailable(getActivity())) { if (!SwissKnife.isMonday()) { loadCurrencyRate(); } else { showToast(getString(R.string.description_update_rate)); } } else { showToast(getString(R.string.description_network_error)); } } private void updateData() { DataManager manager = DataManager.getInstance(); CurrencyRatePreference sharedPreference = manager.getPreference(); String nextDateRateString = sharedPreference.loadRateNextDate(); String usdDifference; String eurDifference; String todayExchangeEurRateString; String todayExchangeUsdRateString; if (nextDateRateString.equals(SwissKnife.getTodayDate())) { rateUpdateTimeTextView.setText(getString(R.string.description_rate_update_time,SwissKnife.getTodayDate())); todayExchangeEurRateString = sharedPreference.loadEurRate(); todayExchangeUsdRateString = sharedPreference.loadUsdRate(); usdRate.setText(todayExchangeUsdRateString); eurRate.setText(todayExchangeEurRateString); usdDifference = sharedPreference.loadNextDifferenceInUsdRate(); eurDifference = sharedPreference.loadNextDifferenceInEurRate(); savePreviousDifferenceInRate(usdDifference, eurDifference); todayExchangeUsdRate = Float.parseFloat(todayExchangeUsdRateString); todayExchangeEurRate = Float.parseFloat(todayExchangeEurRateString); differenceRateUsdTextView.setText(usdDifference); differenceRateEurTextView.setText(eurDifference); } else if (SwissKnife.isSunday()) { rateUpdateTimeTextView.setText(getString(R.string.description_rate_update_time,SwissKnife.getTodayDate())); todayExchangeEurRateString = sharedPreference.loadEurRate(); todayExchangeUsdRateString = sharedPreference.loadUsdRate(); usdRate.setText(todayExchangeUsdRateString); eurRate.setText(todayExchangeEurRateString); usdDifference = sharedPreference.loadNextDifferenceInUsdRate(); eurDifference = sharedPreference.loadNextDifferenceInEurRate(); savePreviousDifferenceInRate(usdDifference, eurDifference); savePreviousRate(todayExchangeUsdRateString, todayExchangeEurRateString); saveRatePreviousDate(nextDateRateString); todayExchangeUsdRate = Float.parseFloat(todayExchangeUsdRateString); todayExchangeEurRate = Float.parseFloat(todayExchangeEurRateString); differenceRateUsdTextView.setText(usdDifference); differenceRateEurTextView.setText(eurDifference); } else { rateUpdateTimeTextView.setText(getString(R.string.description_rate_update_time,SwissKnife.getTodayDate())); todayExchangeUsdRateString = sharedPreference.loadUsdPreviousRate(); todayExchangeEurRateString = sharedPreference.loadEurPreviousRate(); usdRate.setText(todayExchangeUsdRateString); eurRate.setText(todayExchangeEurRateString); usdDifference = sharedPreference.loadPreviousDifferenceInUsdRate(); eurDifference = sharedPreference.loadPreviousDifferenceInEurRate(); todayExchangeUsdRate = Float.parseFloat(todayExchangeUsdRateString); todayExchangeEurRate = Float.parseFloat(todayExchangeEurRateString); differenceRateUsdTextView.setText(usdDifference); differenceRateEurTextView.setText(eurDifference); } if (usdDifference.contains("+")) { differenceRateUsdTextView.setTextColor(getResources().getColor(R.color.green)); } else { differenceRateUsdTextView.setTextColor(getResources().getColor(R.color.red)); } if (eurDifference.contains("+")) { differenceRateEurTextView.setTextColor(getResources().getColor(R.color.green)); } else { differenceRateEurTextView.setTextColor(getResources().getColor(R.color.red)); } // Log.i("PREFERENCE", "======TODAY======"); // Log.i("PREFERENCE", "USD " + sharedPreference.loadUsdRate()); // Log.i("PREFERENCE", "EUR " + sharedPreference.loadEurRate()); // Log.i("PREFERENCE", "DATE " + sharedPreference.loadRateNextDate()); // Log.i("PREFERENCE", "DIFFERENCE IN USD " + sharedPreference.loadNextDifferenceInUsdRate()); // Log.i("PREFERENCE", "DIFFERENCE IN EUR " + sharedPreference.loadNextDifferenceInEurRate()); // Log.i("PREFERENCE", "======YESTERDAY======"); // Log.i("PREFERENCE", "USD " + sharedPreference.loadUsdPreviousRate()); // Log.i("PREFERENCE", "EUR " + sharedPreference.loadEurPreviousRate()); // Log.i("PREFERENCE", "DATE " + sharedPreference.loadRatePreviousDate()); // Log.i("PREFERENCE", "DIFFERENCE IN USD " + sharedPreference.loadPreviousDifferenceInUsdRate()); // Log.i("PREFERENCE", "DIFFERENCE IN EUR " + sharedPreference.loadPreviousDifferenceInEurRate()); // Log.i("PREFERENCE","======END======"); } public void loadCurrencyRate() { final CurrencyService currencyService = ServiceGenerator.createService(CurrencyService.class); Call<CbrCurrencyRateModelRes> call = currencyService.getCurrencyRate(); call.enqueue(new Callback<CbrCurrencyRateModelRes>() { @Override public void onResponse(Call<CbrCurrencyRateModelRes> call, Response<CbrCurrencyRateModelRes> response) { if (response.code() == 200) { loginSuccess(response.body()); updateData(); showToast(getString(R.string.description_update_rate)); } } @Override public void onFailure(Call<CbrCurrencyRateModelRes> call, Throwable t) { } }); } private void loginSuccess(CbrCurrencyRateModelRes model) { USD usd = model.valute.uSD; EUR eur = model.valute.eUR; float todayExchangeEurRate = eur.value; float todayExchangeUsdRate = usd.value; float yesterdayExchangeEurRate = eur.previous; float yesterdayExchangeUsdRate = usd.previous; float differenceInUsdRate = todayExchangeUsdRate - yesterdayExchangeUsdRate; float differenceInEurRate = todayExchangeEurRate - yesterdayExchangeEurRate; String eurRateString = SwissKnife.roundDigit("#####0.00", String.valueOf(todayExchangeEurRate)); String usdRateString = SwissKnife.roundDigit("#####0.00", String.valueOf(todayExchangeUsdRate)); String previousRateUsdString = SwissKnife.roundDigit("#####0.00", String.valueOf(yesterdayExchangeUsdRate)); String previousRateEurString = SwissKnife.roundDigit("#####0.00", String.valueOf(yesterdayExchangeEurRate)); String differenceEurRateString = SwissKnife.roundDigit("#####0.00", String.valueOf(differenceInEurRate)); String differenceUsdRateString = SwissKnife.roundDigit("#####0.00", String.valueOf(differenceInUsdRate)); differenceEurRateString = differenceInEurRate > 0 ? "+" + differenceEurRateString : differenceEurRateString; differenceUsdRateString = differenceInUsdRate > 0 ? "+" + differenceUsdRateString : differenceUsdRateString; String nextDate = SwissKnife.getDateString(model.date); String previousDate = SwissKnife.getDateString(model.previousDate); saveRate(usdRateString, eurRateString); savePreviousRate(previousRateUsdString, previousRateEurString); saveNextDifferenceInRate(differenceUsdRateString, differenceEurRateString); saveRateNextDate(nextDate); saveRatePreviousDate(previousDate); } private void saveRate(String usdRate, String eurRate) { DataManager dataManager = DataManager.getInstance(); CurrencyRatePreference sharedPreferences = dataManager.getPreference(); sharedPreferences.saveUsdRate(usdRate); sharedPreferences.saveEurRate(eurRate); } private void savePreviousRate(String previousUsdRate, String previousEurRate) { DataManager dataManager = DataManager.getInstance(); CurrencyRatePreference sharedPreferences = dataManager.getPreference(); sharedPreferences.saveUsdPreviousRate(previousUsdRate); sharedPreferences.saveEurPreviousRate(previousEurRate); } private void saveNextDifferenceInRate(String difUsd, String difEur) { DataManager dataManager = DataManager.getInstance(); CurrencyRatePreference sharedPreferences = dataManager.getPreference(); sharedPreferences.saveNextDifferenceInUsdRate(difUsd); sharedPreferences.saveNextDifferenceInEurRate(difEur); } private void saveRateNextDate(String updateTime) { DataManager dataManager = DataManager.getInstance(); CurrencyRatePreference sharedPreferences = dataManager.getPreference(); sharedPreferences.saveRateNextDate(updateTime); } private void saveRatePreviousDate(String previousDate) { DataManager dataManager = DataManager.getInstance(); CurrencyRatePreference sharedPreferences = dataManager.getPreference(); sharedPreferences.saveRatePreviousDate(previousDate); } private void savePreviousDifferenceInRate(String difUsd, String difEur) { DataManager dataManager = DataManager.getInstance(); CurrencyRatePreference sharedPreferences = dataManager.getPreference(); sharedPreferences.savePreviousDifferenceInUsdRate(difUsd); sharedPreferences.savePreviousDifferenceInEurRate(difEur); } }
package com.stark.netty.section_2.charpter_2_1; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; /** * Created by Stark on 2018/1/13. * 同步阻塞式IO创建TimeServer */ public class TimeServer { public static void main(String[] args) { try (ServerSocket server = new ServerSocket(8080)) { System.out.println("Time Server Started!"); Socket socket; TimeServerHandlerExcutePool pool = new TimeServerHandlerExcutePool(10, 1000); while (true) { socket = server.accept();//阻塞监听 //使用线程池优化 pool.execute(new TimeServerHandler(socket)); //new Thread(new TimeServerHandler(socket)).start(); } } catch (IOException e) { e.printStackTrace(); } } }
package view; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import model.Poruka; public class TabelaPregledOdabranihPoruka extends TableView<Poruka> { public ObservableList<Poruka> data = FXCollections.observableArrayList(); private TableColumn kolona1 = new TableColumn("Primalac"); private TableColumn kolona2 = new TableColumn("Posiljalac"); private TableColumn kolona3 = new TableColumn("Datum slanja"); private TableColumn kolona4 = new TableColumn("Naslov"); public TabelaPregledOdabranihPoruka() { getColumns().addAll(kolona1, kolona2, kolona3, kolona4); kolona1.prefWidthProperty().bind(this.widthProperty().multiply(0.3)); kolona2.prefWidthProperty().bind(this.widthProperty().multiply(0.3)); kolona3.prefWidthProperty().bind(this.widthProperty().multiply(0.2)); kolona4.prefWidthProperty().bind(this.widthProperty().multiply(0.2)); kolona1.setCellValueFactory(new PropertyValueFactory<Poruka, String>("primalac")); kolona2.setCellValueFactory(new PropertyValueFactory<Poruka, String>("posiljalac")); kolona3.setCellValueFactory(new PropertyValueFactory<Poruka, String>("datumSlanjaPoruke")); kolona4.setCellValueFactory(new PropertyValueFactory<Poruka, String>("naslovPoruke")); setItems(data); } }
package com.facebook.react.bridge; import com.facebook.jni.HybridData; public class CxxModuleWrapperBase implements NativeModule { private HybridData mHybridData; protected CxxModuleWrapperBase(HybridData paramHybridData) { this.mHybridData = paramHybridData; } public boolean canOverrideExistingModule() { return false; } public native String getName(); public void initialize() {} public void onCatalystInstanceDestroy() { this.mHybridData.resetNative(); } protected void resetModule(HybridData paramHybridData) { HybridData hybridData = this.mHybridData; if (paramHybridData != hybridData) { hybridData.resetNative(); this.mHybridData = paramHybridData; } } } /* Location: C:\Users\august\Desktop\tik\df_rn_kit\classes.jar.jar!\com\facebook\react\bridge\CxxModuleWrapperBase.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.1.3 */
import java.awt.*; class WindowText extends Frame { TextField text1, text2; WindowText(String s) { super(s); setLayout(new FlowLayout()); text1 = new TextField("输入密码:", 10); text1.setEditable(false); text2 = new TextField(10); text2.setEchoChar('*'); add(text1); add(text2); setBounds(100, 100, 200, 150); setVisible(true); validate(); } } public class ep6_14 { public static void main(String args[]) { WindowText win = new WindowText("添加了文本框的窗口"); } }
// Exercícios no link: https://www.slideshare.net/loianeg/curso-java-bsico-exerccios-aulas-11-12-13 package exerciciosAula13; import java.util.Scanner; public class Exercicio_04_MediaFinal { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Informe as notas do 1º, 2º, 3º e 4º bimestres: "); double nota1 = scan.nextDouble(); double nota2 = scan.nextDouble(); double nota3 = scan.nextDouble(); double nota4 = scan.nextDouble(); double media = (nota1 + nota2 + nota3 + nota4)/4; System.out.println("As sua nota no 1º bimestre foi: " + nota1 + "\nAs sua nota no 2º bimestre foi: " + nota2 + "\nAs sua nota no 3º bimestre foi: " + nota3 + "\nAs sua nota no 4º bimestre foi: " + nota4 + "\nAs sua média final é: " + media); scan.close(); } }
package br.com.Falcao.PontoInteligente.api.dtos; import java.util.Optional; public class EmpresaDto { /* Não tem ação de validação pois essa classe estara ligada somente a ações do tipo Get */ private Optional<Long> id = Optional.empty(); private String nome; private String razaoSocial; private String cnpj; //private String caminhoFoto; private String descricao; private String dataCriacao; /* Construtor */ public EmpresaDto() {} public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getRazaoSocial() { return razaoSocial; } public void setRazaoSocial(String razaoSocial) { this.razaoSocial = razaoSocial; } public String getCnpj() { return cnpj; } public void setCnpj(String cnpj) { this.cnpj = cnpj; } public String getDescricao() { return descricao; } public void setDescricao(String descricao) { this.descricao = descricao; } public Optional<Long> getId() { return id; } public void setId(Optional<Long> id) { this.id = id; } /*public String getCaminhoFoto() { return caminhoFoto; } public void setCaminhoFoto(String caminhoFoto) { this.caminhoFoto = caminhoFoto; }*/ @Override public String toString() { return "EmpresaDto [id=" + id + ", razaoSocial=" + razaoSocial + ", cnpj=" + cnpj + "]"; } public String getDataCriacao() { return dataCriacao; } public void setDataCriacao(String dataCriacao) { this.dataCriacao = dataCriacao; } }
package com.nsp.test.jedis; import java.util.Arrays; import java.util.List; import org.junit.Ignore; import org.junit.Test; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisShardInfo; import redis.clients.jedis.Pipeline; import redis.clients.jedis.ShardedJedis; import redis.clients.jedis.Transaction; public class JedisApiTest { public void testTransaction() { Jedis jedis = new Jedis("127.0.0.1", 6379); Transaction transaction = jedis.multi(); } @Test @Ignore public void testNormal1() { Jedis jedis = new Jedis("127.0.0.1"); long start = System.currentTimeMillis(); for (int i = 0; i < 100000; i++) { String result = jedis.set("n" + i, "n" + i); } long end = System.currentTimeMillis(); System.out.println("Simple SET: " + ((end - start)/1000.0) + " seconds"); jedis.disconnect(); } @Test @Ignore /** * redis的事务保证,一个client发起的事务中的命令可以连续的执行,<p> * 中间不会插入其他client的命令.事务中某个操作失败,并不会回滚其他操作 */ public void test2Trans() { Jedis jedis = new Jedis("127.0.0.1"); long start = System.currentTimeMillis(); Transaction transaction = jedis.multi(); for (int i = 0; i < 100000; i++) { transaction.set("t" + i, "t" + i); } List<Object> results = transaction.exec(); long end = System.currentTimeMillis(); System.out.println("Transaction SET: " + ((end - start)/1000.0) + " seconds"); jedis.disconnect(); } @Test @Ignore public void test3Pipelined() { Jedis jedis = new Jedis("127.0.0.1"); Pipeline pipeline = jedis.pipelined(); long start = System.currentTimeMillis(); for (int i = 0; i < 100000; i++) { pipeline.set("p" + i, "p" + i); } List<Object> result = pipeline.syncAndReturnAll(); long end = System.currentTimeMillis(); System.out.println("Pipelined SET: " + ((end - start)/1000.0) + " seconds"); jedis.disconnect(); } @Test @Ignore public void test4combPipelineTrans() { Jedis jedis = new Jedis("127.0.0.1"); long start = System.currentTimeMillis(); Pipeline pipeline = jedis.pipelined(); pipeline.multi(); for (int i = 0; i < 100000; i++) { pipeline.set("" + i, "" + i); } pipeline.exec(); List<Object> results = pipeline.syncAndReturnAll(); long end = System.currentTimeMillis(); System.out.println("Pipelined transaction: " + ((end - start)/1000.0) + " seconds"); jedis.disconnect(); } @Test public void test5shardNormal() { List<JedisShardInfo> jedisShardInfoList = Arrays.asList( new JedisShardInfo("127.0.0.1", 6379), new JedisShardInfo( "127.0.0.1", 6380)); ShardedJedis shardedJedis = new ShardedJedis(jedisShardInfoList); long start = System.currentTimeMillis(); for (int i = 0; i < 100000; i++) { String result = shardedJedis.set("sn" + i, "n" + i); } } }
package co.nos.noswallet.network.nosModel; import com.google.gson.annotations.SerializedName; import java.io.Serializable; public class NeuroHistoryRequest implements Serializable { @SerializedName("action") public String action = "account_history"; @SerializedName("account") public String account; @SerializedName("count") public String count; public NeuroHistoryRequest() { } public NeuroHistoryRequest(String account, String count) { this.account = account; this.count = count; } }
package pt.ist.sonet.exception; public abstract class SonetException extends RuntimeException { private static final long serialVersionUID = 1L; public SonetException() {} public abstract String toString(); }
package Project; //___________________________IMPORTACIONES______________________________________ import com.toedter.calendar.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.security.*; import java.sql.*; import java.text.*; import java.util.logging.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.filechooser.*; import javax.swing.table.*; //______________________________________________________________________________ public class Container extends javax.swing.JFrame { //_____________________________ATRIBUTOS________________________________________ IngresarConductor Conductor; IngresarAccidente Accidente; Reporte Reporte; IngresarVehiculo Vehiculo; Opciones Opciones; String Usuario, Contrasena, sql; int count = 0; int tamanio = 0; String clave = ""; int caracter = 0; String a, b; Usuario u = new Usuario(this, true); //_____________________________CONSTRUCTOR______________________________________ public Container() { initComponents(); setLocationRelativeTo(null); setResizable(false); this.setIconImage(Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("Logo_Cooperativa.png"))); setTitle("Siconacci - Coop. Trans. Occidente"); pnlLogin(); desactivarMenu(); fecha(); lblIdDocumentos.setVisible(false); jLabel16.setText(""); dcFechaDocumentos.setVisible(false); } //________________________________METODOS_______________________________________ //______________________________________________________________________________ private void desactivarMenu() { menOpciones.setEnabled(false); menRepor.setEnabled(false); menUsuarios.setVisible(false); menDoc.setEnabled(false); //______________________________________________________________________________ } private void ocultarColumnas() { tablaDocumentos.getColumnModel().getColumn(2).setMaxWidth(0); tablaDocumentos.getColumnModel().getColumn(2).setMinWidth(0); tablaDocumentos.getColumnModel().getColumn(2).setPreferredWidth(0); tablaDocumentos.getColumnModel().getColumn(2).setResizable(false); } //______________________________________________________________________________ private void activarMenu() { menOpciones.setEnabled(true); menRepor.setEnabled(true); menDoc.setEnabled(true); } //______________________________________________________________________________ private void pnlLogin() { pnlContenedorLogin.setLayout(new BorderLayout()); pnlContenedorLogin.removeAll(); pnlContenedorLogin.add(pnlLogin, "West"); pnlContenedorLogin.updateUI(); pnlContenedorLogin.setVisible(true); } //______________________________________________________________________________ private void agregarConductor() { Conductor = new IngresarConductor(); pnlContenedor.setLayout(new BorderLayout()); pnlContenedor.removeAll(); pnlContenedor.add(Conductor, "West"); pnlContenedor.updateUI(); pnlContenedor.setVisible(true); } //______________________________________________________________________________ private void agregarAccidente() { Accidente = new IngresarAccidente(); pnlContenedor.setLayout(new BorderLayout()); pnlContenedor.removeAll(); pnlContenedor.add(Accidente, "West"); pnlContenedor.updateUI(); pnlContenedor.setVisible(true); } //______________________________________________________________________________ private void agregarVehiculo() { Vehiculo = new IngresarVehiculo(); pnlContenedor.setLayout(new BorderLayout()); pnlContenedor.removeAll(); pnlContenedor.add(Vehiculo, "West"); pnlContenedor.updateUI(); pnlContenedor.setVisible(true); } //______________________________________________________________________________ private void agregarOpciones() { Opciones = new Opciones(); pnlContenedor.setLayout(new BorderLayout()); pnlContenedor.removeAll(); pnlContenedor.add(Opciones, "West"); pnlContenedor.updateUI(); pnlContenedor.setVisible(true); } //______________________________________________________________________________ private void extraerDocumento() throws SQLException, IOException { BaseDeDatos.conectarse(); if (tablaDocumentos.getSelectedRows().length < 1) { JOptionPane.showMessageDialog(null, "Seleccione el documento que desea guardar", "Error", JOptionPane.ERROR_MESSAGE); } else { Statement s = BaseDeDatos.con.createStatement(); String idDoc = "" + tablaDocumentos.getValueAt(tablaDocumentos.getSelectedRow(), 2); String nomDoc = "" + tablaDocumentos.getValueAt(tablaDocumentos.getSelectedRow(), 0); sql = "SELECT binario, nombre FROM documentos where id=" + idDoc + " and nombre='" + nomDoc + "'"; ResultSet rs = s.executeQuery(sql); String nombre; int indice; indice = nomDoc.lastIndexOf("."); String extension = nomDoc.substring(indice, nomDoc.length()); String nomDocFin = nomDoc.substring(0, indice); System.out.println(extension); FileNameExtensionFilter Filtro = new FileNameExtensionFilter("*" + extension + "", "" + extension + ""); JFileChooser ruta = new JFileChooser(); ruta.setFileFilter(Filtro); ruta.setSelectedFile(new File("" + nomDocFin)); int confirmar = ruta.showSaveDialog(this); String path = ruta.getSelectedFile().getAbsolutePath(); if (confirmar != JFileChooser.CANCEL_OPTION) { try { rs.next(); nombre = rs.getString("nombre"); String pathname = path; File file = new File(pathname + extension); FileOutputStream output = new FileOutputStream(file); byte[] archivo = rs.getBytes("binario"); ByteArrayInputStream inStream = new ByteArrayInputStream(archivo); int leer = 0; byte[] buffer = new byte[1024]; while ((leer = inStream.read(buffer)) != -1) { output.write(buffer, 0, leer); } output.close(); } catch (Exception ioe) { throw new IOException(ioe.getMessage()); } } } } //______________________________________________________________________________ private void limpiarPanel() { pnlContenedor.removeAll(); pnlContenedor.updateUI(); pnlContenedor.setVisible(true); } //______________________________________________________________________________ private void llamarContainer() { this.dispose(); new Container().setVisible(true); } //______________________________________________________________________________ private void tamanoTabla() { int ancho = 849; int anchoColumna = 0; TableColumnModel modeloColumna = tablaDocumentos.getColumnModel(); TableColumn columnaTabla; for (int i = 0; i < tablaDocumentos.getColumnCount(); i++) { columnaTabla = modeloColumna.getColumn(i); switch (i) { case 0: anchoColumna = (40 * ancho) / 100; break; case 1: anchoColumna = (25 * ancho) / 100; break; } columnaTabla.setPreferredWidth(anchoColumna); } } //______________________________________________________________________________ private void llenarDocumentos(String Valor) { BaseDeDatos.conectarse(); try { String consulta = "SELECT documentos.nombre, accidente.fecha, documentos.id AS documentos FROM documentos JOIN accidente ON (documentos.id_accidente = accidente.id)"; int Valor_dos = cbxFiltrarDocumentos.getSelectedIndex(); if (Valor_dos == 0) { sql = consulta + " WHERE documentos.nombre ILIKE '" + Valor + "%' ORDER BY documentos.nombre"; } else if (Valor_dos == 1) { sql = consulta + " WHERE TO_CHAR(accidente.fecha,'YYYY-MM-DD') = '" + Valor + "' ORDER BY accidente.fecha"; } DefaultTableModel modelo = new DefaultTableModel(); tablaDocumentos.setModel(modelo); modelo.addColumn("DOCUMENTO"); modelo.addColumn("FECHA"); modelo.addColumn("ID"); Statement s = BaseDeDatos.con.createStatement(); ResultSet rs = s.executeQuery(sql); while (rs.next()) { // Se crea un array que será una de las filas de la tabla. Object[] fila = new Object[3]; // Hay 2 columnas en la tabla // Se rellena cada posición del array con una de las columnas de la tabla en base de datos. for (int i = 0; i < 3; i++) { fila[i] = rs.getObject(i + 1); // El primer indice en rs es el 1, no el cero, por eso se suma 1. } // Se añade al modelo la fila completa. modelo.addRow(fila); } tablaDocumentos.setModel(modelo); BaseDeDatos.desconectarse(); tamanoTabla(); ocultarColumnas(); } catch (SQLException e) { JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } //______________________________________________________________________________ public static String md5(String clear) throws Exception { MessageDigest md = MessageDigest.getInstance("MD5"); byte[] b = md.digest(clear.getBytes()); int size = b.length; StringBuilder h = new StringBuilder(size); //algoritmo y arreglo md5 for (int i = 0; i < size; i++) { int u = b[i] & 255; if (u < 16) { h.append("0").append(Integer.toHexString(u)); } else { h.append(Integer.toHexString(u)); } } //clave encriptada return h.toString(); } //______________________________________________________________________________ private void Acceder() { BaseDeDatos.conectarse(); try { Usuario = txtUsuario.getText().trim(); try { Contrasena = md5(txtContrasena.getText().trim()); } catch (Exception ex) { Logger.getLogger(Container.class.getName()).log(Level.SEVERE, null, ex); } sql = "SELECT usuario, contrasena, privilegio_id FROM usuarios WHERE usuario = '" + Usuario.toLowerCase() + "' AND contrasena = '" + Contrasena + "'"; Statement s = BaseDeDatos.con.createStatement(); ResultSet rs = s.executeQuery(sql); while (rs.next()) { count = count + 1; a = rs.getString("privilegio_id"); lblPrivilegio.setText(a); } if (count == 1) { JOptionPane.showMessageDialog(pnlContenedorLogin, "Bienvenido al sistema"); if (lblPrivilegio.getText().equals("1")) { menUsuarios.setVisible(true); activarMenu(); limpiarPanel(); } else { activarMenu(); limpiarPanel(); } } else { System.out.print(sql); JOptionPane.showMessageDialog(pnlContenedorLogin, "Usuario o Contraseña Incorrectos", "Error", JOptionPane.ERROR_MESSAGE); } BaseDeDatos.desconectarse(); } catch (SQLException e) { System.out.print(sql); JOptionPane.showMessageDialog(pnlContenedorLogin, "Se a producido una Exepcion " + e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } //______________________________________________________________________________ private void mayusActivado() { boolean value = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); if (value == true) { jLabel16.setText("Bloq Mayús Activado"); } else if (value == false) { jLabel16.setText(""); } } //______________________________________________________________________________ private void fecha() { ((JTextFieldDateEditor) dcFechaDocumentos.getDateEditor()).addCaretListener(new javax.swing.event.CaretListener() { @Override public void caretUpdate(javax.swing.event.CaretEvent evt) { dcFechaCaretUpdate(evt); } private void dcFechaCaretUpdate(CaretEvent evt) { if (dcFechaDocumentos.getDate() != null) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-d"); java.util.Date date = dcFechaDocumentos.getDate(); txtBuscarDocumentos.setText(sdf.format(date)); } } }); } //______________________________________________________________________________ private void eliminarDocumento() { BaseDeDatos.conectarse(); if (tablaDocumentos.getSelectedRows().length < 1) { JOptionPane.showMessageDialog(null, "Seleccione un documento", "Error", JOptionPane.ERROR_MESSAGE); } else if (JOptionPane.showConfirmDialog(null, "Esta seguro de que desea eliminar este documento", "Advertencia", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_NO_OPTION) { try { lblIdDocumentos.setText("" + tablaDocumentos.getValueAt(tablaDocumentos.getSelectedRow(), 2)); String d = lblIdDocumentos.getText(); sql = "delete from documentos where id=" + d; int resultado = BaseDeDatos.stmt.executeUpdate(sql); if (resultado == 1) { JOptionPane.showMessageDialog(null, "El documento a sido eliminado", "Info", JOptionPane.INFORMATION_MESSAGE); } } catch (SQLException | HeadlessException e) { JOptionPane.showMessageDialog(null, "El documento no se pudo borrar", "Error", JOptionPane.ERROR_MESSAGE); } } BaseDeDatos.desconectarse(); llenarDocumentos(""); } // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { pnlLogin = new javax.swing.JPanel(); jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jPanel2 = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); txtUsuario = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); btnIngresar = new javax.swing.JButton(); txtContrasena = new javax.swing.JPasswordField(); jLabel16 = new javax.swing.JLabel(); dlgAbout = new javax.swing.JDialog(); jLabel7 = new javax.swing.JLabel(); jPanel3 = new javax.swing.JPanel(); jLabel11 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); lblPrivilegio = new javax.swing.JLabel(); dlgDocumentos = new javax.swing.JDialog(); cbxFiltrarDocumentos = new javax.swing.JComboBox(); jLabel17 = new javax.swing.JLabel(); txtBuscarDocumentos = new javax.swing.JTextField(); jScrollPane1 = new javax.swing.JScrollPane(); tablaDocumentos = new javax.swing.JTable(){ public boolean isCellEditable(int rowIndex, int colIndex) { return false; //Disallow the editing of any cell } }; btnAbrir = new javax.swing.JButton(); btnEliminarDocumento = new javax.swing.JButton(); dcFechaDocumentos = new com.toedter.calendar.JDateChooser(); lblIdDocumentos = new javax.swing.JLabel(); pnlContenedor = new javax.swing.JPanel(); pnlContenedorLogin = new javax.swing.JPanel(); jLabel6 = new javax.swing.JLabel(); jMenuBar1 = new javax.swing.JMenuBar(); menOpciones = new javax.swing.JMenu(); menConductor = new javax.swing.JMenuItem(); menVehiculo = new javax.swing.JMenuItem(); menAccidente = new javax.swing.JMenuItem(); menMasOpciones = new javax.swing.JMenuItem(); cerrarSesion = new javax.swing.JMenuItem(); menRepor = new javax.swing.JMenu(); menRepGra = new javax.swing.JMenuItem(); menRepComp = new javax.swing.JMenuItem(); jMenuItem1 = new javax.swing.JMenuItem(); menRepPdf = new javax.swing.JMenuItem(); menUsuarios = new javax.swing.JMenu(); menCrearUsuario = new javax.swing.JMenuItem(); menModificar = new javax.swing.JMenuItem(); menDoc = new javax.swing.JMenu(); menDocumento = new javax.swing.JMenuItem(); menAyuda = new javax.swing.JMenu(); menAbout = new javax.swing.JMenuItem(); pnlLogin.setMaximumSize(new java.awt.Dimension(364, 235)); pnlLogin.setMinimumSize(new java.awt.Dimension(364, 235)); jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); jPanel1.setMaximumSize(new java.awt.Dimension(344, 213)); jPanel1.setMinimumSize(new java.awt.Dimension(344, 213)); jLabel1.setFont(new java.awt.Font("Arial", 1, 36)); // NOI18N jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setText("ENTRAR"); jLabel3.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel3.setText("Cooperativa de Transportadores de Occidente"); jPanel2.setMaximumSize(new java.awt.Dimension(322, 117)); jPanel2.setMinimumSize(new java.awt.Dimension(322, 117)); jLabel4.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N jLabel4.setText("Usuario:"); txtUsuario.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N txtUsuario.setText("superuser"); txtUsuario.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); txtUsuario.setMargin(new java.awt.Insets(0, 5, 0, 5)); txtUsuario.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { txtUsuarioFocusGained(evt); } }); jLabel5.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N jLabel5.setText("Contraseña:"); btnIngresar.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N btnIngresar.setText("Ingresar"); btnIngresar.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); btnIngresar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnIngresarActionPerformed(evt); } }); txtContrasena.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N txtContrasena.setText("superuser"); txtContrasena.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); txtContrasena.setMargin(new java.awt.Insets(0, 5, 0, 5)); txtContrasena.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { txtContrasenaFocusGained(evt); } }); txtContrasena.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { txtContrasenaKeyPressed(evt); } }); jLabel16.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N jLabel16.setForeground(new java.awt.Color(255, 0, 0)); jLabel16.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, 72, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 226, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtContrasena, javax.swing.GroupLayout.PREFERRED_SIZE, 226, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(btnIngresar, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addContainerGap()) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(txtUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtContrasena, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(btnIngresar, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) .addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap()) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); javax.swing.GroupLayout pnlLoginLayout = new javax.swing.GroupLayout(pnlLogin); pnlLogin.setLayout(pnlLoginLayout); pnlLoginLayout.setHorizontalGroup( pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlLoginLayout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pnlLoginLayout.setVerticalGroup( pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlLoginLayout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); dlgAbout.setTitle("Acerca de"); dlgAbout.setMinimumSize(new java.awt.Dimension(517, 250)); dlgAbout.setModal(true); dlgAbout.setResizable(false); jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/logo_pequeño.png"))); // NOI18N jPanel3.setBorder(new javax.swing.border.MatteBorder(null)); jLabel11.setText("SICONACCI - Sistema para el control de accidentes"); jLabel10.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel10.setText("Informacion:"); jLabel8.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel8.setText("Creadores:"); jLabel12.setText("DeveSoft."); jLabel9.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel9.setText("Version:"); jLabel14.setText("develsoft01@gmail.com"); jLabel13.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel13.setText("Correo:"); jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/devesoft.jpg"))); // NOI18N jLabel15.setText("1.2 Beta Rev.154"); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel12) .addGroup(jPanel3Layout.createSequentialGroup() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel14) .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel2)) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel11) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap()))) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel9) .addGap(0, 0, Short.MAX_VALUE)))) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel2) .addGroup(jPanel3Layout.createSequentialGroup() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(5, 5, 5) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(5, 5, 5) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(5, 5, 5) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel15)))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); javax.swing.GroupLayout dlgAboutLayout = new javax.swing.GroupLayout(dlgAbout.getContentPane()); dlgAbout.getContentPane().setLayout(dlgAboutLayout); dlgAboutLayout.setHorizontalGroup( dlgAboutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(dlgAboutLayout.createSequentialGroup() .addContainerGap() .addGroup(dlgAboutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); dlgAboutLayout.setVerticalGroup( dlgAboutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(dlgAboutLayout.createSequentialGroup() .addContainerGap() .addComponent(jLabel7) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); lblPrivilegio.setText("jLabel15"); dlgDocumentos.setTitle("Documentos"); dlgDocumentos.setMinimumSize(new java.awt.Dimension(581, 464)); dlgDocumentos.setModal(true); dlgDocumentos.setResizable(false); cbxFiltrarDocumentos.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N cbxFiltrarDocumentos.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Nombre", "Fecha" })); cbxFiltrarDocumentos.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); cbxFiltrarDocumentos.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { cbxFiltrarDocumentosItemStateChanged(evt); } }); jLabel17.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N jLabel17.setText("Filtrar por:"); txtBuscarDocumentos.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N txtBuscarDocumentos.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); txtBuscarDocumentos.addCaretListener(new javax.swing.event.CaretListener() { public void caretUpdate(javax.swing.event.CaretEvent evt) { txtBuscarDocumentosCaretUpdate(evt); } }); tablaDocumentos.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N tablaDocumentos.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { } )); tablaDocumentos.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); tablaDocumentos.setEditingRow(0); tablaDocumentos.setRowHeight(24); tablaDocumentos.getTableHeader().setResizingAllowed(false); tablaDocumentos.getTableHeader().setReorderingAllowed(false); jScrollPane1.setViewportView(tablaDocumentos); btnAbrir.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N btnAbrir.setText("Guardar..."); btnAbrir.setBorder(null); btnAbrir.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnAbrirActionPerformed(evt); } }); btnEliminarDocumento.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N btnEliminarDocumento.setText("Eliminar"); btnEliminarDocumento.setBorder(null); btnEliminarDocumento.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnEliminarDocumentoActionPerformed(evt); } }); dcFechaDocumentos.setDateFormatString("yyyy-MM-d"); dcFechaDocumentos.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N lblIdDocumentos.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); javax.swing.GroupLayout dlgDocumentosLayout = new javax.swing.GroupLayout(dlgDocumentos.getContentPane()); dlgDocumentos.getContentPane().setLayout(dlgDocumentosLayout); dlgDocumentosLayout.setHorizontalGroup( dlgDocumentosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(dlgDocumentosLayout.createSequentialGroup() .addGap(10, 10, 10) .addGroup(dlgDocumentosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(dlgDocumentosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 553, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(dlgDocumentosLayout.createSequentialGroup() .addComponent(jLabel17) .addGap(10, 10, 10) .addComponent(cbxFiltrarDocumentos, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(dcFechaDocumentos, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txtBuscarDocumentos))) .addGroup(dlgDocumentosLayout.createSequentialGroup() .addComponent(btnAbrir, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(10, 10, 10) .addComponent(btnEliminarDocumento, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblIdDocumentos, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); dlgDocumentosLayout.setVerticalGroup( dlgDocumentosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(dlgDocumentosLayout.createSequentialGroup() .addGap(10, 10, 10) .addGroup(dlgDocumentosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(dlgDocumentosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(cbxFiltrarDocumentos, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtBuscarDocumentos, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(dcFechaDocumentos, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(10, 10, 10) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 340, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(dlgDocumentosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnAbrir, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btnEliminarDocumento, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblIdDocumentos, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(11, 11, 11)) ); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Siconacci"); setMinimumSize(new java.awt.Dimension(973, 684)); setResizable(false); pnlContenedor.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); pnlContenedor.setMaximumSize(new java.awt.Dimension(973, 662)); pnlContenedor.setMinimumSize(new java.awt.Dimension(973, 662)); pnlContenedorLogin.setBorder(new javax.swing.border.MatteBorder(null)); pnlContenedorLogin.setMaximumSize(new java.awt.Dimension(364, 230)); pnlContenedorLogin.setMinimumSize(new java.awt.Dimension(364, 230)); pnlContenedorLogin.setPreferredSize(new java.awt.Dimension(364, 230)); javax.swing.GroupLayout pnlContenedorLoginLayout = new javax.swing.GroupLayout(pnlContenedorLogin); pnlContenedorLogin.setLayout(pnlContenedorLoginLayout); pnlContenedorLoginLayout.setHorizontalGroup( pnlContenedorLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE) ); pnlContenedorLoginLayout.setVerticalGroup( pnlContenedorLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE) ); jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/devesoft.jpg"))); // NOI18N javax.swing.GroupLayout pnlContenedorLayout = new javax.swing.GroupLayout(pnlContenedor); pnlContenedor.setLayout(pnlContenedorLayout); pnlContenedorLayout.setHorizontalGroup( pnlContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlContenedorLayout.createSequentialGroup() .addContainerGap(316, Short.MAX_VALUE) .addGroup(pnlContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlContenedorLayout.createSequentialGroup() .addComponent(jLabel6) .addContainerGap()) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlContenedorLayout.createSequentialGroup() .addComponent(pnlContenedorLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 345, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(310, 310, 310)))) ); pnlContenedorLayout.setVerticalGroup( pnlContenedorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlContenedorLayout.createSequentialGroup() .addContainerGap(209, Short.MAX_VALUE) .addComponent(pnlContenedorLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(158, 158, 158) .addComponent(jLabel6) .addContainerGap()) ); jMenuBar1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); jMenuBar1.setAlignmentY(0.5F); menOpciones.setText("Opciones"); menOpciones.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N menConductor.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N menConductor.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/empleado.png"))); // NOI18N menConductor.setText("Ingresar Conductor"); menConductor.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menConductorActionPerformed(evt); } }); menOpciones.add(menConductor); menVehiculo.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N menVehiculo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/vehiculo.png"))); // NOI18N menVehiculo.setText("Ingresar Vehiculo"); menVehiculo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menVehiculoActionPerformed(evt); } }); menOpciones.add(menVehiculo); menAccidente.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N menAccidente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/accidente.png"))); // NOI18N menAccidente.setText("Ingresar Accidente"); menAccidente.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menAccidenteActionPerformed(evt); } }); menOpciones.add(menAccidente); menMasOpciones.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N menMasOpciones.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/opciones.png"))); // NOI18N menMasOpciones.setText("Mas Opciones..."); menMasOpciones.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menMasOpcionesActionPerformed(evt); } }); menOpciones.add(menMasOpciones); cerrarSesion.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N cerrarSesion.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/cerrar_sesion.png"))); // NOI18N cerrarSesion.setText("Cerrar Sesión"); cerrarSesion.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cerrarSesionActionPerformed(evt); } }); menOpciones.add(cerrarSesion); jMenuBar1.add(menOpciones); menRepor.setText("Reporte"); menRepor.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N menRepGra.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N menRepGra.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/graficas.png"))); // NOI18N menRepGra.setText("Generar Graficas Generales"); menRepGra.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menRepGraActionPerformed(evt); } }); menRepor.add(menRepGra); menRepComp.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N menRepComp.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/graph-icon.png"))); // NOI18N menRepComp.setText("Generar Reportes de Comparación"); menRepComp.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menRepCompActionPerformed(evt); } }); menRepor.add(menRepComp); jMenuItem1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/especificos.png"))); // NOI18N jMenuItem1.setText("Generar Reportes Específicos"); jMenuItem1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem1ActionPerformed(evt); } }); menRepor.add(jMenuItem1); menRepPdf.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N menRepPdf.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/reporte.png"))); // NOI18N menRepPdf.setText("Generar Reportes en *.pdf, *.xls, *.csv ..."); menRepPdf.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menRepPdfActionPerformed(evt); } }); menRepor.add(menRepPdf); jMenuBar1.add(menRepor); menUsuarios.setText("Usuarios"); menUsuarios.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N menCrearUsuario.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N menCrearUsuario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/new_user.png"))); // NOI18N menCrearUsuario.setText("Crear Usuario"); menCrearUsuario.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menCrearUsuarioActionPerformed(evt); } }); menUsuarios.add(menCrearUsuario); menModificar.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N menModificar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/user_delete.png"))); // NOI18N menModificar.setText("Modifica y Eliminar"); menModificar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menModificarActionPerformed(evt); } }); menUsuarios.add(menModificar); jMenuBar1.add(menUsuarios); menDoc.setText("Registros"); menDoc.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N menDocumento.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N menDocumento.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/documentos.png"))); // NOI18N menDocumento.setText("Documentos"); menDocumento.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menDocumentoActionPerformed(evt); } }); menDoc.add(menDocumento); jMenuBar1.add(menDoc); menAyuda.setText("Ayuda"); menAyuda.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N menAyuda.setPreferredSize(new java.awt.Dimension(46, 19)); menAbout.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.CTRL_MASK)); menAbout.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N menAbout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/about.png"))); // NOI18N menAbout.setText("Acerca de"); menAbout.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menAboutActionPerformed(evt); } }); menAyuda.add(menAbout); jMenuBar1.add(menAyuda); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(pnlContenedor, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(pnlContenedor, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents //______________________________________________________________________________ private void menConductorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menConductorActionPerformed agregarConductor(); }//GEN-LAST:event_menConductorActionPerformed //______________________________________________________________________________ private void menVehiculoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menVehiculoActionPerformed agregarVehiculo(); }//GEN-LAST:event_menVehiculoActionPerformed //______________________________________________________________________________ private void menAccidenteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menAccidenteActionPerformed agregarAccidente(); }//GEN-LAST:event_menAccidenteActionPerformed //______________________________________________________________________________ private void menMasOpcionesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menMasOpcionesActionPerformed agregarOpciones(); }//GEN-LAST:event_menMasOpcionesActionPerformed //______________________________________________________________________________ private void menAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menAboutActionPerformed dlgAbout.setLocationRelativeTo(null); dlgAbout.setVisible(true); }//GEN-LAST:event_menAboutActionPerformed //______________________________________________________________________________ private void btnIngresarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnIngresarActionPerformed Acceder(); }//GEN-LAST:event_btnIngresarActionPerformed //______________________________________________________________________________ private void menRepPdfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menRepPdfActionPerformed Reporte reporte = new Reporte(this, true); reporte.setVisible(true); }//GEN-LAST:event_menRepPdfActionPerformed //______________________________________________________________________________ private void menRepGraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menRepGraActionPerformed ReporteGrafi reportegra = new ReporteGrafi(this, true); reportegra.setVisible(true); }//GEN-LAST:event_menRepGraActionPerformed //______________________________________________________________________________ private void cerrarSesionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cerrarSesionActionPerformed llamarContainer(); }//GEN-LAST:event_cerrarSesionActionPerformed //______________________________________________________________________________ private void menRepCompActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menRepCompActionPerformed ReporteGrafCompa reporteComp = new ReporteGrafCompa(this, true); reporteComp.setVisible(true); }//GEN-LAST:event_menRepCompActionPerformed //______________________________________________________________________________ private void menCrearUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menCrearUsuarioActionPerformed u.setLocationRelativeTo(this); u.setVisible(true); }//GEN-LAST:event_menCrearUsuarioActionPerformed //______________________________________________________________________________ private void menModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menModificarActionPerformed u.llenarUsuarios(); u.dlgTablaUsuarios.setLocationRelativeTo(this); u.dlgTablaUsuarios.setVisible(true); }//GEN-LAST:event_menModificarActionPerformed //______________________________________________________________________________ private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed ReporteEspeci reporteEsp = new ReporteEspeci(this, true); reporteEsp.setVisible(true); }//GEN-LAST:event_jMenuItem1ActionPerformed //______________________________________________________________________________ private void txtContrasenaFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtContrasenaFocusGained mayusActivado(); }//GEN-LAST:event_txtContrasenaFocusGained //______________________________________________________________________________ private void txtContrasenaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtContrasenaKeyPressed if (evt.getKeyCode() == KeyEvent.VK_CAPS_LOCK) { mayusActivado(); }else if(evt.getKeyCode() == KeyEvent.VK_ENTER){ Acceder(); } }//GEN-LAST:event_txtContrasenaKeyPressed //______________________________________________________________________________ private void txtUsuarioFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtUsuarioFocusGained jLabel16.setText(""); }//GEN-LAST:event_txtUsuarioFocusGained //______________________________________________________________________________ private void menDocumentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menDocumentoActionPerformed tablaDocumentos.setAutoCreateRowSorter(true); dlgDocumentos.setLocationRelativeTo(null); ((JTextFieldDateEditor) dcFechaDocumentos.getDateEditor()).setEditable(false); tamanoTabla(); //ocultarColumnas(); llenarDocumentos(""); dlgDocumentos.setVisible(true); }//GEN-LAST:event_menDocumentoActionPerformed //______________________________________________________________________________ private void cbxFiltrarDocumentosItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbxFiltrarDocumentosItemStateChanged int Valor_dos = cbxFiltrarDocumentos.getSelectedIndex(); if (Valor_dos == 1) { dcFechaDocumentos.setDate(null); txtBuscarDocumentos.setVisible(false); dcFechaDocumentos.setVisible(true); txtBuscarDocumentos.setText(""); } else if (Valor_dos == 0) { dcFechaDocumentos.setDate(null); txtBuscarDocumentos.setVisible(true); dcFechaDocumentos.setVisible(false); txtBuscarDocumentos.setText(""); } }//GEN-LAST:event_cbxFiltrarDocumentosItemStateChanged //______________________________________________________________________________ private void txtBuscarDocumentosCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_txtBuscarDocumentosCaretUpdate if (txtBuscarDocumentos.getText() == null) { llenarDocumentos(""); } else { llenarDocumentos(txtBuscarDocumentos.getText()); } }//GEN-LAST:event_txtBuscarDocumentosCaretUpdate //______________________________________________________________________________ private void btnAbrirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAbrirActionPerformed try { extraerDocumento(); } catch (IOException | SQLException ex) { ex.printStackTrace(); } }//GEN-LAST:event_btnAbrirActionPerformed //______________________________________________________________________________ private void btnEliminarDocumentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarDocumentoActionPerformed eliminarDocumento(); }//GEN-LAST:event_btnEliminarDocumentoActionPerformed //______________________________________________________________________________ // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnAbrir; private javax.swing.JButton btnEliminarDocumento; private javax.swing.JButton btnIngresar; private javax.swing.JComboBox cbxFiltrarDocumentos; private javax.swing.JMenuItem cerrarSesion; private com.toedter.calendar.JDateChooser dcFechaDocumentos; private javax.swing.JDialog dlgAbout; private javax.swing.JDialog dlgDocumentos; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel16; private javax.swing.JLabel jLabel17; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JMenuItem jMenuItem1; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JLabel lblIdDocumentos; public static javax.swing.JLabel lblPrivilegio; private javax.swing.JMenuItem menAbout; private javax.swing.JMenuItem menAccidente; private javax.swing.JMenu menAyuda; private javax.swing.JMenuItem menConductor; private javax.swing.JMenuItem menCrearUsuario; private javax.swing.JMenu menDoc; private javax.swing.JMenuItem menDocumento; private javax.swing.JMenuItem menMasOpciones; private javax.swing.JMenuItem menModificar; private javax.swing.JMenu menOpciones; private javax.swing.JMenuItem menRepComp; private javax.swing.JMenuItem menRepGra; private javax.swing.JMenuItem menRepPdf; private javax.swing.JMenu menRepor; private javax.swing.JMenu menUsuarios; private javax.swing.JMenuItem menVehiculo; private javax.swing.JPanel pnlContenedor; private javax.swing.JPanel pnlContenedorLogin; private javax.swing.JPanel pnlLogin; private javax.swing.JTable tablaDocumentos; private javax.swing.JTextField txtBuscarDocumentos; private javax.swing.JPasswordField txtContrasena; private javax.swing.JTextField txtUsuario; // End of variables declaration//GEN-END:variables }
package com.laoji.business.controller; import com.github.pagehelper.PageInfo; import com.laoji.business.BusinessException; import com.laoji.business.BusinessStatus; import com.laoji.commons.dto.ResponseResult; import com.laoji.provider.api.PmsProductService; import com.laoji.provider.domain.PmsProduct; import org.apache.dubbo.config.annotation.Reference; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * * @author: laoji * @date:2020/4/13 16:59 */ @RestController @RequestMapping(value = "/product") public class ProductController { @Reference PmsProductService pmsProductService; @GetMapping("/getList") @PreAuthorize("hasAuthority('pms:product:read')") public ResponseResult<PageInfo> getList(Integer pageSize, Integer pageNum){ if(pageSize==null||pageNum==null){ pageSize=1; pageNum=10; } PageInfo<PmsProduct> pageInfo = pmsProductService.getAll(pageSize, pageNum); if(pageInfo==null){ throw new BusinessException(BusinessStatus.DATA_NOT_FOUNT); } return new ResponseResult<PageInfo>(ResponseResult.OK,"查询成功",pageInfo); } }
/* * CorporateTaxServlet.java * This file was last modified at 2018.12.03 20:05 by Victor N. Skurikhin. * $Id$ * This is free and unencumbered software released into the public domain. * For more information, please refer to <http://unlicense.org> */ package ru.otus.soap.wservice.corptax; import ru.otus.soap.wsclient.corptax.CorporateTaxProvider; import ru.otus.soap.wsclient.corptax.CorporateTaxWebService; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.ws.WebServiceRef; import java.io.PrintWriter; import static ru.otus.gwt.shared.Constants.REQUEST_CORPORATE_TAX; @WebServlet("/" + REQUEST_CORPORATE_TAX) public class CorporateTaxServlet extends HttpServlet { @WebServiceRef private CorporateTaxWebService service; private static final Logger LOGGER = LogManager.getLogger(CorporateTaxServlet.class.getName()); @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) { LOGGER.info("doGet"); resp.setHeader("Content-Type", "application/json; charset=UTF-8"); resp.setHeader("Access-Control-Allow-Origin", "*"); resp.setHeader("Access-Control-Allow-Methods", "GET"); try (PrintWriter pw = resp.getWriter()) { CorporateTaxProvider port = service.getCorporateTaxProviderPort(); Double taxRateReportingPeriod = port.getCurrentTax(1000000.0, 200000.0, 20.0); pw.write(String.format("{ 'tax-rate-reporting-period' : %.2f }", taxRateReportingPeriod)); LOGGER.info("{ tax-rate-reporting-period: {} }", taxRateReportingPeriod); } catch (Exception e) { LOGGER.error(e); } } } /* vim: syntax=java:fileencoding=utf-8:fileformat=unix:tw=78:ts=4:sw=4:sts=4:et */ //EOF
public class MuralMessageContent { private int senderID; private String senderUsername; private String message; public MuralMessageContent() { } public MuralMessageContent(int senderID, String senderUsername, String message) { this.senderID = senderID; this.senderUsername = senderUsername; this.message = message; } public int getSenderID() { return this.senderID; } public void setSenderID(int senderID) { this.senderID = senderID; } public String getSenderUsername() { return this.senderUsername; } public void setSenderUsername(String senderUsername) { this.senderUsername = senderUsername; } public String getMessage() { return this.message; } public void setMessage(String message) { this.message = message; } @Override public String toString() { return "-------------------------------------\n" + senderUsername + " disse:\n" + message +"\n" + "-------------------------------------\n"; } }
package test; import java.util.ArrayList; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import edu.uci.ics.sdcl.firefly.util.MethodMatcher; public class MethodMatcherTest { //Rejectable ArrayList<String> rejectList = new ArrayList<String>(); //Acceptable ArrayList<String> acceptList = new ArrayList<String>(); //Method name to be found String original = "Code"; @Before public void setup(){ rejectList.add("MyCode"); rejectList.add("CodeCode"); rejectList.add("_Code"); rejectList.add("1Code"); rejectList.add("0Code"); rejectList.add("9Code"); rejectList.add("Code."); rejectList.add("'Code"); rejectList.add("Code'"); acceptList.add(" Code"); acceptList.add(" Code"); //a tab before the method call. acceptList.add("Code "); acceptList.add("Code "); //a tab after acceptList.add("Code("); acceptList.add(".Code"); acceptList.add(")Code"); acceptList.add("=Code"); acceptList.add("+Code"); acceptList.add("-Code"); acceptList.add("*Code"); acceptList.add("/Code"); acceptList.add("?Code"); acceptList.add("&Code"); acceptList.add("^Code"); acceptList.add("!Code"); acceptList.add(";Code"); acceptList.add("]Code"); acceptList.add("[Code"); acceptList.add("}Code"); acceptList.add("{Code"); acceptList.add("|Code"); acceptList.add("~Code"); } @Test public void testRejectable() { for(String methodName: rejectList){ boolean isDifferentMethod = MethodMatcher.containsDifferentMethod(methodName, original); Assert.assertTrue("methodName: "+ methodName+" shouldn't contain the method "+original, isDifferentMethod); } } @Test public void testAcceptable() { for(String methodName: acceptList){ boolean isDifferentMethod = MethodMatcher.containsDifferentMethod(methodName, original); Assert.assertFalse("methodName: "+ methodName+" should contain the method "+original, isDifferentMethod); } } }
package cn.bs.zjzc.model.impl; import java.util.List; import cn.bs.zjzc.App; import cn.bs.zjzc.model.IOrderPayModel; import cn.bs.zjzc.model.callback.HttpTaskCallback; import cn.bs.zjzc.model.response.OrderAmountResponse; import cn.bs.zjzc.model.response.OrderCouponResponse; import cn.bs.zjzc.model.response.OrderPayResponse; import cn.bs.zjzc.net.GsonCallback; import cn.bs.zjzc.net.PostHttpTask; import cn.bs.zjzc.net.RequestUrl; /** * Created by mgc on 2016/7/1. */ public class OrderPayModel implements IOrderPayModel { /** * 获取订单总费用--支付前 * * @param order_id * @param coupon_id 优惠券 * @param httpTaskCallback */ @Override public void getOrderAmount(String order_id, String coupon_id, final HttpTaskCallback<OrderAmountResponse.DataBean> httpTaskCallback) { String url = RequestUrl.getRequestPath(RequestUrl.SubPaths.getOrderAmount); final PostHttpTask<OrderAmountResponse> httpTask = new PostHttpTask<>(url); httpTask.addParams("token", App.LOGIN_USER.getToken()) .addParams("order_id", order_id) .addParams("coupon_id", coupon_id) .execute(new GsonCallback<OrderAmountResponse>() { @Override public void onFailed(String errorInfo) { httpTaskCallback.onTaskFailed(errorInfo); } @Override public void onSuccess(OrderAmountResponse response) { httpTaskCallback.onTaskSuccess(response.data); } }); } /** * 订单可用优惠券 * * @param city_id * @param httpTaskCallback */ @Override public void getOrderCoupon(String city_id, final HttpTaskCallback<List<OrderCouponResponse.DataBean>> httpTaskCallback) { String url = RequestUrl.getRequestPath(RequestUrl.SubPaths.orderCoupon); final PostHttpTask<OrderCouponResponse> httpTask = new PostHttpTask<>(url); httpTask.addParams("token", App.LOGIN_USER.getToken()) .addParams("city_id", city_id) .execute(new GsonCallback<OrderCouponResponse>() { @Override public void onFailed(String errorInfo) { httpTaskCallback.onTaskFailed(errorInfo); } @Override public void onSuccess(OrderCouponResponse response) { httpTaskCallback.onTaskSuccess(response.data); } }); } /** * @param type 支付类型(1 支付宝,2 微信,3 余额,4 支付宝+余额,5 微信+余额) * @param order_id * @param coupon_id * @param callback */ @Override public void createPayment(String type, String order_id, String coupon_id, final HttpTaskCallback<OrderPayResponse> callback) { String url = RequestUrl.getRequestPath(RequestUrl.SubPaths.orderPay); PostHttpTask<OrderPayResponse> httpTask = new PostHttpTask<>(url); httpTask.addParams("token", App.LOGIN_USER.getToken()) .addParams("type", type) .addParams("order_id", order_id) .addParams("coupon_id", coupon_id) .execute(new GsonCallback<OrderPayResponse>() { @Override public void onFailed(String errorInfo) { callback.onTaskFailed(errorInfo); } @Override public void onSuccess(OrderPayResponse response) { callback.onTaskSuccess(response); } }); } }
package com.study.jpa.service; import com.study.jpa.entity.Composite; import com.study.jpa.repository.CompositeRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * Created by francis on 2015. 12. 2.. */ @Service public class CompositeService { private @Autowired CompositeRepository compositeRepository; public void save(Composite composite){ compositeRepository.save(composite); } public void delete(Composite composite){ compositeRepository.delete(composite); } }
package in.hocg.app.dao; import in.hocg.app.bean.WxUserBean; import in.hocg.defaults.base.dao.SoftDeletedDao; import org.hibernate.criterion.DetachedCriteria; import org.hibernate.criterion.Restrictions; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import java.util.Date; /** * Created by hocgin on 16-12-23. */ @Repository @Transactional public class WxUserDao extends SoftDeletedDao<WxUserBean> { /** * 按openId查找用户 * * @param openId * @return */ public WxUserBean fetchAll(String openId) { DetachedCriteria criteria = criteria().add(Restrictions.eq("openId", openId)); return (WxUserBean) uniqueCriteria(criteria); } /** * 按openId查找用户 * * @param openId * @return */ public WxUserBean fetchOpenId(String openId) { DetachedCriteria criteria = criteria().add(Restrictions.eq("openId", openId)) .add(Restrictions.isNull("deleteAt")); return (WxUserBean) uniqueCriteria(criteria); } /** * 删除 */ public void deleteAt(WxUserBean userBean) { userBean.setDeleteAt(new Date()); update(userBean); } }
package esir.dom11.nsoc.datactrl.dao.model.sqlite; import esir.dom11.nsoc.datactrl.dao.connection.ConnectionDbSQLite; import esir.dom11.nsoc.datactrl.dao.dao.LogDAO; import esir.dom11.nsoc.model.Log; import esir.dom11.nsoc.model.LogLevel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.UUID; public class LogDAOSQLite implements LogDAO { /* * Class Attributes */ private static Logger logger = LoggerFactory.getLogger(LogDAOSQLite.class.getName()); /* * Attributes */ private ConnectionDbSQLite _connection; /* * Constructors */ public LogDAOSQLite(ConnectionDbSQLite connectionDbSQLite) { _connection = connectionDbSQLite; } /* * Overrides */ @Override public Log create(Log log) { Log newLog = retrieve(log.getId()); if (newLog.getId().toString().compareTo("00000000-0000-0000-0000-000000000000")==0) { try { String statement = "INSERT INTO logs (`id`, `date`, `from`, `message`, `log_level`)" + " VALUES('" + log.getId() + "'," + " '" + new Timestamp(log.getDate().getTime()) + "'," + " '" + log.getFrom() + "'," + " '" + log.getMessage() + "'," + " '" + log.getLogLevel() + "')"; PreparedStatement prepare = _connection.getConnection() .prepareStatement(statement); prepare.executeUpdate(); newLog = retrieve(log.getId()); } catch (SQLException exception) { System.out.println("Log insert error"+ exception); } } return newLog; } @Override public Log retrieve(UUID id) { Log log = new Log(); try { ResultSet result = _connection.getConnection() .createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY) .executeQuery("SELECT * FROM logs WHERE id = '" + id + "'"); if(result.next()) { DateFormat df = new SimpleDateFormat("YYYY-MM-DD HH:MM:SS.SSS"); log = new Log(id, df.parse(result.getString("date")), result.getString("from"), result.getString("message"), LogLevel.valueOf(result.getString("log_level"))); } } catch (SQLException exception) { logger.error("Log retrieve error", exception); System.out.println("Log retrieve error"+ exception); } catch (ParseException exception) { logger.error("Log retrieve error", exception); System.out.println("Log retrieve error"+ exception); } return log; } @Override public Log update(Log log) { return retrieve(log.getId()); } @Override public boolean delete(UUID id) { try { _connection.getConnection() .createStatement() .executeUpdate("DELETE FROM logs WHERE id = '" + id + "'"); return true; } catch (SQLException exception) { logger.error("Log delete error",exception); } return false; } }
package array; //给定正整数数组 A,A[i] 表示第 i 个观光景点的评分,并且两个景点 i 和 j 之间的距离为 j - i。 // // 一对景点(i < j)组成的观光组合的得分为(A[i] + A[j] + i - j):景点的评分之和减去它们两者之间的距离。 // // 返回一对观光景点能取得的最高分。 // // // // 示例: // // 输入:[8,1,5,2,6] //输出:11 //解释:i = 0, j = 2, A[i] + A[j] + i - j = 8 + 5 + 0 - 2 = 11 // // // // // 提示: // // // 2 <= A.length <= 50000 // 1 <= A[i] <= 1000 // // Related Topics 数组 //leetcode submit region begin(Prohibit modification and deletion) class MaxScoreSightseeingPair { public int maxScoreSightseeingPair(int[] A) { int ret = 0; int maxI = A[0] + 0; for(int j = 1; j < A.length; j++){ ret = Math.max(ret,maxI+A[j]-j); maxI = Math.max(maxI,A[j]+j); } return ret; } } //leetcode submit region end(Prohibit modification and deletion)
/** * */ package pt.mleiria.mlalgo.functions; import junit.framework.TestCase; /** * @author manuel * */ public class ExpFunctionTest extends TestCase { public void testExpFunction() { final Double[] z = new Double[]{1., 2., 3., 4., 5., 6., 7., 8., 9.}; final OneVarFunction<Double[], Double[]> exp = new SigmoidFunction(); final Double[] res = exp.value(z); assertEquals(0.7310585786300049, res[0]); assertEquals(0.9998766054240137, res[8]); assertEquals(z.length, res.length); } }
package com.example.base.mapper; import com.example.base.BaseDto; import com.example.base.BaseEntity; import org.mapstruct.TargetType; import org.springframework.stereotype.Component; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; @Component public class ReferenceMapper { @PersistenceContext private EntityManager entityManager; public <T extends BaseEntity> T resolve(BaseDto reference, @TargetType Class<T> entityClass) { return reference != null ? entityManager.find( entityClass, reference.getId() ) : null; } public BaseDto toReference(BaseEntity entity) { BaseDto dto = new BaseDto() {}; dto.setId(entity != null ? entity.getId() : null); return dto; } }
package com.tt.miniapp.manager; import android.content.Context; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.text.TextUtils; import com.storage.async.Action; import com.storage.async.Scheduler; import com.tt.miniapp.AppbrandApplicationImpl; import com.tt.miniapp.AppbrandServiceManager; import com.tt.miniapp.base.ui.viewwindow.ViewWindow; import com.tt.miniapp.route.PageRouter; import com.tt.miniapp.thread.ThreadUtil; import com.tt.miniapphost.AppBrandLogger; import com.tt.miniapphost.LaunchThreadPool; import com.tt.miniapphost.process.HostProcessBridge; import com.tt.miniapphost.process.callback.IpcCallback; import com.tt.miniapphost.process.data.CrossProcessDataEntity; public class HostSnapShotManager extends AppbrandServiceManager.ServiceBase { private volatile boolean mFirstUpdateSnapshot = true; private boolean mNeedUpdateSnapshotWhenOnStart; private volatile boolean mTriggeredHomeOrRecentApp; public Runnable mUpdateSnapshotRunnable; public HostSnapShotManager(AppbrandApplicationImpl paramAppbrandApplicationImpl) { super(paramAppbrandApplicationImpl); } public void clearSwipeBackground() { ThreadUtil.runOnUIThread(new Runnable() { public void run() { HostSnapShotManager.this.getHomeViewWindow().getRoot().getContainer().setBackground(null); } }); } public ViewWindow getHomeViewWindow() { return (ViewWindow)((PageRouter)AppbrandApplicationImpl.getInst().getService(PageRouter.class)).getViewWindowRoot().getAppbrandHomePage(); } public boolean isNeedUpdateSnapshotWhenOnStart() { return this.mNeedUpdateSnapshotWhenOnStart; } public boolean isTriggeredHomeOrRecentApp() { return this.mTriggeredHomeOrRecentApp; } public void notifyUpdateSnapShot() { if (AppbrandApplicationImpl.getInst().getMiniAppLaunchConfig().isLaunchWithFloatStyle()) return; boolean bool = AppbrandApplicationImpl.getInst().getForeBackgroundManager().isBackground(); AppBrandLogger.i("HostSnapShotManager", new Object[] { "notifyUpdateSnapShot isBackground:", Boolean.valueOf(bool) }); if (bool) { clearSwipeBackground(); this.mNeedUpdateSnapshotWhenOnStart = true; return; } updateSnapShotView(); } public void setNeedUpdateSnapshotWhenOnStart(boolean paramBoolean) { this.mNeedUpdateSnapshotWhenOnStart = paramBoolean; } public void setTriggeredHomeOrRecentApp(boolean paramBoolean) { this.mTriggeredHomeOrRecentApp = paramBoolean; } public void updateSnapShotView() { updateSnapShotView(this.mApp.getMiniAppContext().getApplicationContext(), false); } public void updateSnapShotView(final Context context, boolean paramBoolean) { final long delayUpdateTime; if (this.mTriggeredHomeOrRecentApp) { AppBrandLogger.i("HostSnapShotManager", new Object[] { "updateSnapShotView mTriggeredHomeOrRecentApp" }); return; } final ViewWindow homeViewWindow = getHomeViewWindow(); if (this.mFirstUpdateSnapshot) { l = 100L; } else { l = 0L; } this.mFirstUpdateSnapshot = false; AppBrandLogger.i("HostSnapShotManager", new Object[] { "updateSnapShotView getSnapshot" }); HostProcessBridge.getSnapshot(paramBoolean, new IpcCallback() { public void onIpcCallback(final CrossProcessDataEntity callbackData) { AppBrandLogger.d("HostSnapShotManager", new Object[] { "getSnapshot callback callbackData:", callbackData }); finishListenIpcCallback(); ThreadUtil.runOnWorkThread(new Action() { public void act() { CrossProcessDataEntity crossProcessDataEntity = callbackData; if (crossProcessDataEntity != null) { String str = crossProcessDataEntity.getString("snapshot"); } else { crossProcessDataEntity = null; } if (TextUtils.isEmpty((CharSequence)crossProcessDataEntity)) { AppBrandLogger.e("HostSnapShotManager", new Object[] { "getSnapshot callback null snapshotFilePath" }); return; } try { ThreadUtil.cancelUIRunnable(HostSnapShotManager.this.mUpdateSnapshotRunnable); if (!homeViewWindow.isDragEnabled()) { AppBrandLogger.i("HostSnapShotManager", new Object[] { "!swipeBackLayout.isEnableGesture() onIpcCallback" }); return; } final BitmapDrawable snapshotDrawable = SnapshotManager.getSnapshotDrawableFromFile(context.getResources(), (String)crossProcessDataEntity); if (bitmapDrawable == null) { AppBrandLogger.e("HostSnapShotManager", new Object[] { "getSnapshot snapshotDrawable error" }); return; } HostSnapShotManager.this.mUpdateSnapshotRunnable = new Runnable() { public void run() { homeViewWindow.getRoot().getContainer().setBackground((Drawable)snapshotDrawable); } }; ThreadUtil.runOnUIThread(HostSnapShotManager.this.mUpdateSnapshotRunnable, delayUpdateTime); return; } catch (Exception exception) { AppBrandLogger.eWithThrowable("HostSnapShotManager", "setSnapshotAsBackground", exception); return; } } }(Scheduler)LaunchThreadPool.getInst(), false); } public void onIpcConnectError() { AppBrandLogger.i("HostSnapShotManager", new Object[] { "updateSnapShotView HostProcessNotExist clearSwipeBackground" }); HostSnapShotManager.this.clearSwipeBackground(); } }); } } /* Location: C:\Users\august\Desktop\tik\df_miniapp\classes.jar!\com\tt\miniapp\manager\HostSnapShotManager.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.1.3 */
package com.shubhendu.javaworld.datastructures.tries; public class TriePrefix { private TrieNode root; private static final int R = 26; private class TrieNode { TrieNode[] childrens; boolean isLastCharInWord; int count; public TrieNode() { this.childrens = new TrieNode[R]; } } private int getCharIndex(char c) { return c - 'a'; } public void add(String name) { if (name == null) return; root = put(root, name, 0); } public int find(String partial) { TrieNode partialNode = get(root, partial, 0); if (partialNode == null) return 0; return partialNode.count; } private TrieNode put(TrieNode node, String str, int pos) { if (node == null) node = new TrieNode(); if (pos == str.length()) { node.isLastCharInWord = true; node.count = node.count + 1; return node; } char c = str.charAt(pos); TrieNode childNode = put(node.childrens[getCharIndex(c)], str, pos + 1); node.childrens[getCharIndex(c)] = childNode; node.count = node.count + 1; return node; } public boolean get(String str) { TrieNode x = get(root, str, 0); if (x == null) return false; return x.isLastCharInWord; } private TrieNode get(TrieNode x, String str, int pos) { if (x == null) return null; if (pos == str.length()) return x; char c = str.charAt(pos); return get(x.childrens[getCharIndex(c)], str, pos + 1); } public static void main(String[] args) { TriePrefix trie = new TriePrefix(); trie.add("cars"); trie.add("car"); trie.add("cab"); trie.add("bartender"); trie.add("bar"); trie.add("bars"); trie.add("baring"); trie.add("batsmen"); System.out.println("cars: " + trie.find("cars")); System.out.println("ca: " + trie.find("ca")); System.out.println("c: " + trie.find("c")); System.out.println("b: " + trie.find("b")); System.out.println("bar: " + trie.find("bar")); // Scanner sc = new Scanner(System.in); // int n = sc.nextInt(); // // for (int i = 0; i < n; i++) { // String op = sc.next(); // String word = sc.next(); // if (op.equals("add")) { // trie.add(word); // } else { // System.out.println(trie.find(word)); // } // } // sc.close(); } }
package com.marshalchen.ultimaterecyclerview.demo.scrollableobservable; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.marshalchen.ultimaterecyclerview.ObservableScrollViewCallbacks; import com.marshalchen.ultimaterecyclerview.UltimateRecyclerView; import com.marshalchen.ultimaterecyclerview.demo.R; /** * Created by hesk on 12/6/15. */ public class ViewPagerFragmentListSingle extends BaseFragment { protected ObservableScrollViewCallbacks parent_fragment; public static String TAG = "thisWork"; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View view = inflater.inflate(R.layout.listurv, container, false); final UltimateRecyclerView recyclerView = (UltimateRecyclerView) view.findViewById(R.id.scroll); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerView.setHasFixedSize(false); recyclerView.setRefreshing(false); setDummyData(recyclerView); ViewPagerTabFragmentParentFragment parentFragment = (ViewPagerTabFragmentParentFragment) getParentFragment(); ViewGroup parentFView = (ViewGroup) parentFragment.getView(); if (parentFragment != null) { recyclerView.setTouchInterceptionViewGroup((ViewGroup) parentFView.findViewById(R.id.container)); if (parentFragment instanceof ObservableScrollViewCallbacks) { recyclerView.setScrollViewCallbacks(parentFragment); Log.d(TAG, "this is ObservableScrollViewCallbacks"); } } return view; } }
package com.bingo.code.example.design.visitor.composite; /** * ����ṹ,ͨ���������Ԫ�ض�����б������÷������ܷ��ʵ����е�Ԫ�� */ public class ObjectStructure { /** * ��ʾ����ṹ��������һ����Ͻṹ */ private Component root = null; /** * �ṩ���ͻ��˲����ĸ߲�ӿ� * @param visitor �ͻ�����Ҫʹ�õķ����� */ public void handleRequest(Visitor visitor){ //����϶���ṹ�еĸ�Ԫ�أ����ܷ��� //����϶���ṹ���Ѿ�ʵ����Ԫ�صı��� if(root!=null){ root.accept(visitor); } } /** * ������϶���ṹ * @param ele ��϶���ṹ */ public void setRoot(Component ele){ this.root = ele; } }
/** * */ package com.supconit.kqfx.web.xtgl.controllers; import hc.base.domains.AjaxMessage; import hc.base.domains.Pagination; import hc.mvc.annotations.FormBean; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import jodd.util.StringUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.ModelAttribute; 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; import com.supconit.honeycomb.business.authorization.entities.Menu; import com.supconit.honeycomb.business.authorization.services.MenuService; import com.supconit.kqfx.web.util.OperateType; import com.supconit.kqfx.web.xtgl.entities.ExtPerson; import com.supconit.kqfx.web.xtgl.entities.SystemLog; import com.supconit.kqfx.web.xtgl.services.ExtPersonService; import com.supconit.kqfx.web.xtgl.services.SystemLogService; /** ========================== 自定义区域结束 ========================== **/ /** * 系统日志控制层。 * * @author * @create 2014-04-09 15:46:42 * @since * */ @Controller("xtgl_systemLog_controller") @RequestMapping("/xtgl/system-log") public class SystemLogController { /** * 日志服务。 */ private transient static final Logger logger = LoggerFactory.getLogger(SystemLogController.class); private static final String IP_WIN7_VALUE = "0:0:0:0:0:0:0:1"; private static final String IP_LOCAL_VALUE = "127.0.0.1"; /** * 注入服务。 */ @Autowired private SystemLogService systemLogService; @Autowired private MenuService menuService; @Autowired private ExtPersonService extPersonService; /** * 准备实体对象。 * * @return */ @ModelAttribute("prepareSystemLog") public SystemLog prepareSystemLog() { return new SystemLog(); } /** * 列表展现。 * * @param model * @return */ @RequestMapping(value = "list", method = RequestMethod.GET) public String list(ModelMap model) { model.put("operateType", OperateType.values()); return "/business/systemManage/systemLog/list"; } /** * AJAX获取列表数据。 * * @param pager * 分页信息 * @param condition * 查询条件 * @return */ @ResponseBody @RequestMapping(value = "list", method = RequestMethod.POST) public Pagination<SystemLog> list(Pagination<SystemLog> pager, @FormBean(value = "condition", modelCode = "prepareSystemLog") SystemLog condition) { try { /* Validate Pager Parameters */ if (pager.getPageNo() < 1 || pager.getPageSize() < 1 || pager.getPageSize() > Pagination.MAX_PAGE_SIZE) return pager; if(StringUtil.isNotBlank(condition.getModuleCode()) && StringUtil.isNotEmpty(condition.getModuleCode())){ Menu menu = this.menuService.getByCode(condition.getModuleCode()); condition.setMenu(menu); } this.systemLogService.find(pager, condition); //获取分页查询结果 Map<Long, ExtPerson> personMap = new HashMap<Long, ExtPerson>(); Set<Long> personIdsSet = new HashSet<Long>(); for (SystemLog systemLog : pager) { if(null != systemLog.getUser()){ if(null != systemLog.getUser().getPersonId()){ personIdsSet.add(systemLog.getUser().getPersonId()); } } } List<ExtPerson> personList = this.extPersonService.findByIds(personIdsSet); for (ExtPerson extPerson : personList) { personMap.put(extPerson.getId(), extPerson); } for (SystemLog systemLog : pager) { systemLog.setModuleStr(getMenuList(systemLog.getModuleCode())); systemLog.setOperateTypeStr(OperateType.getDescByCode(systemLog.getOperateType())); if (IP_WIN7_VALUE.equals(systemLog.getOperateIp())) { systemLog.setOperateIp(IP_LOCAL_VALUE); } if(StringUtil.isBlank(systemLog.getModuleStr())){ systemLog.setModuleStr(systemLog.getModuleCode()); } if(null != systemLog.getUser()){ if(null != systemLog.getUser().getPersonId()){ ExtPerson aPerson = personMap.get(systemLog.getUser().getPersonId()); systemLog.setPerson(aPerson); systemLog.setName(aPerson.getName()); systemLog.setUserName(systemLog.getUser().getUsername()); } } } } catch (Exception e) { logger.error(e.getMessage(), e); } return pager; } /** * 新增展示。 * * @param id * @param model * @return */ @RequestMapping(value = "add", method = RequestMethod.GET) public String edit(ModelMap model) { return "/business/systemManage/systemLog/add"; } /** * 编辑展示。 * * @param id * @param model * @return */ @RequestMapping(value = "edit", method = RequestMethod.GET) public String edit(@RequestParam(required = true) String id, ModelMap model) { model.put("systemLog", this.systemLogService.getById(id)); return "/business/systemManage/systemLog/edit"; } /** * 保存编辑内容。 * * @param equipment * @return */ @ResponseBody @RequestMapping(value = {"add", "edit"}, method = RequestMethod.POST) public AjaxMessage doEdit(@FormBean(value = "systemLog", modelCode = "prepareSystemLog") SystemLog systemLog) { // TODO Validate try { this.systemLogService.save(systemLog); return AjaxMessage.success(systemLog.getId()); } catch (Exception e) { logger.error(e.getMessage(), e); return AjaxMessage.error(e.getMessage()); } } /** * 删除一条记录。 * * @param systemLog * @return */ @ResponseBody @RequestMapping(value = "delete", method = RequestMethod.POST) public AjaxMessage doDelete(SystemLog systemLog) { try { if (null == systemLog || null == systemLog.getId()) return AjaxMessage.error("错误的参数。"); this.systemLogService.delete(systemLog); return AjaxMessage.success(systemLog.getId()); } catch (Exception e) { logger.error(e.getMessage(), e); return AjaxMessage.error(e.getMessage()); } } /** * 查看展示。 * * @param id * @param model * @return */ @RequestMapping(value = "view", method = RequestMethod.GET) public String view(@RequestParam(required = true) String id, ModelMap model) { model.put("systemLog", this.systemLogService.getById(id)); return "/business/systemManage/systemLog/view"; } /** ========================== 自定义区域开始 ========================== **/ /************************* 自定义区域内容不会被覆盖 *************************/ private String getMenuList(String code){ List<Menu> menuList = new ArrayList<Menu>(); MenuNext(code, menuList); if(menuList.size() > 0){ Collections.reverse(menuList); String moduleStr = ""; for (Menu menu : menuList) { moduleStr += " > "+ menu.getName(); } return moduleStr.substring(2); }else{ return ""; } } private void MenuNext(String code,List<Menu> menuList){ Menu menu = menuService.getByCode(code); if(menu != null){ menuList.add(menu); Menu parent = menuService.getById(menu.getPid()); if(!Menu.CODE_FUNCTION.equals(parent.getCode())){ MenuNext(parent.getCode(), menuList); } } } /** ========================== 自定义区域结束 ========================== **/ }
import br.com.bytebank.banco.modelo.ContaCorrente; public class TestaBiblioteca { public static void main(String[] args) { ContaCorrente c = new ContaCorrente(111, 111); try { c.deposita(0); } catch (Exception e) { System.out.println(e.getMessage()); } finally { System.out.println("Valor saldo: " + c.getSaldo()); } } }
package org.yggard.brokkgui.element; import org.yggard.brokkgui.behavior.GuiLinkBehavior; import org.yggard.brokkgui.control.GuiLabeled; import org.yggard.brokkgui.paint.Color; import org.yggard.brokkgui.skin.GuiLabeledSkinBase; import org.yggard.brokkgui.skin.GuiSkinBase; import fr.ourten.teabeans.value.BaseProperty; /** * @author Ourten 15 oct. 2016 */ public class GuiLink extends GuiLabeled { private final BaseProperty<String> urlProperty; public GuiLink(final String url, final String text) { super(text); this.urlProperty = new BaseProperty<>(url, "urlProperty"); this.setTextColor(Color.BLUE); } public GuiLink(final String url) { this(url, url); } public GuiLink() { this(""); } @Override protected GuiSkinBase<?> makeDefaultSkin() { return new GuiLabeledSkinBase<>(this, new GuiLinkBehavior(this)); } public BaseProperty<String> getUrlProperty() { return this.urlProperty; } public String getUrl() { return this.getUrlProperty().getValue(); } public void setUrl(final String URL) { this.getUrlProperty().setValue(URL); } }
package fiuba.algo3.modelo; public class Moneda { private String tMoneda; private int cotizacion; public Moneda(String moneda) { this.tMoneda = moneda; this.cotizacion = 15; } public int conValor() { if (tMoneda == "Dolar") return cotizacion; return 1; } public String nombreMoneda() { return tMoneda; } }
package integration; import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; import com.mashape.unirest.http.exceptions.UnirestException; /* NOTE: IF YOU WANT TO TEST SOMETHING UP-TO-DATE, RUN THE SCRIPT `./update-pcf-with-latest-web-maths` BEFORE RUNNING THIS TEST */ public class PcfHttpIntegrationTest extends HttpIntegrationTest { @Override public String originOfEndpointUnderTest() { try { return webMathsPcfOrigin(); } catch (Exception e) { throw new RuntimeException("Couldn't get web-maths URL: " + e.getMessage()); } } private String webMathsPcfOrigin() throws UnirestException { HttpResponse<String> response = Unirest.get("http://wm-registry.dev.cfdev.sh/contact-web-maths").asString(); return response.getBody(); } }
package com.minja.entities; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; @Entity public class Student { @Id private long id; @Size(min=1, max=16, message="{ime.length}") @NotNull(message = "{ime.notnull}") private String ime; @Size(min=1, max=16, message="{prezime.length}") @NotNull(message = "{prezime.notnull}") private String prezime; @ManyToOne @JoinColumn(name="mesto_rodjenja_id") private NaseljenoMesto mestoRodjenja; public Student() {} public Student(long id, String ime, String prezime, NaseljenoMesto mestoRodjenja) { this(); this.id = id; this.ime = ime; this.prezime = prezime; this.mestoRodjenja = mestoRodjenja; } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getIme() { return ime; } public void setIme(String ime) { this.ime = ime; } public String getPrezime() { return prezime; } public void setPrezime(String prezime) { this.prezime = prezime; } public NaseljenoMesto getMestoRodjenja() { return mestoRodjenja; } public void setMestoRodjenja(NaseljenoMesto mestoRodjenja) { this.mestoRodjenja = mestoRodjenja; } @Override public String toString() { return "Student [id=" + id + ", ime=" + ime + ", mestoRodjenja=" + mestoRodjenja + ", prezime=" + prezime + "]"; } }
package com.pangpang6.books.tree; public class BTreeDefine { public int value; public BTreeDefine left; public BTreeDefine right; public BTreeDefine parent; public BTreeDefine(int value) { this.value = value; } @Override public String toString() { return value + ""; } }
/* DialogManager * * singleton class */ package jp.satoshun.chreco; import android.app.Dialog; import android.content.Context; class DialogManager { private static WaitingDialog instance = null; private DialogManager() {} public static void create(Context context) { if (instance == null) { instance = new WaitingDialog(context); } } public static WaitingDialog getInstance(Context context) { create(context); return instance; } public static void release() { instance = null; } private static class WaitingDialog extends Dialog { public WaitingDialog(Context context) { super(context); setContentView(R.layout.waiting_dialog); setCancelable(false); } } }
package servicos; import javax.swing.JOptionPane; import dados.Cidade; import dao.PrefeitoDAO; import visao.TelaCadastroCidade; public class Validacao { static final int MINIMO = 10; public static boolean minimoCadastro(Cidade eleicao) { if (!TelaCadastroCidade.umCadastro) { JOptionPane.showMessageDialog(null, "Nenhum candidato cadastrado!", "Aviso", JOptionPane.INFORMATION_MESSAGE); return false; } return true; } public static void validaSair(boolean umCadastro) { int resposta = JOptionPane.showConfirmDialog(null, "Deseja sair do programa?", "Sair", JOptionPane.YES_NO_OPTION); if (umCadastro == false) { JOptionPane.showMessageDialog(null, "Você deve realizar ao menos um cadastro!", "Erro ao sair", JOptionPane.ERROR_MESSAGE); } else if (resposta == 0) { PrefeitoDAO prefeitoDao = new PrefeitoDAO(); prefeitoDao.deletar(); System.exit(0); } } public static boolean validaNomePrefeito(String nome) { if (nome.length() <= 3) { JOptionPane.showMessageDialog(null, "Nome inválido! Digite novamente o nome do prefeito"); return false; } return true; } public static boolean validaNumeroLegenda(String numeroLegendaString, Cidade eleicao) { try { Integer numeroLegenda = Integer.parseInt(numeroLegendaString); if (numeroLegenda < MINIMO || numeroLegenda > 99) { JOptionPane.showMessageDialog(null, "Valor Inválido!"); return false; } else { for (int i = 0; i < eleicao.quantidadePrefeitos(); i++) { if (numeroLegenda == eleicao.getPrefeitos().get(i).getNumeroLegenda()) { JOptionPane.showMessageDialog(null, "Número de legenda já cadastrado!"); return false; } } } } catch (NumberFormatException e) { JOptionPane.showMessageDialog(null, "Ocorreu um erro! Digite novamente o número da legenda"); return false; } return true; } public static boolean validaPartidoAssociado(String partidoAssociado, Cidade eleicao) { if (validaPontuacaoEspaçamento(partidoAssociado)) { JOptionPane.showMessageDialog(null, "A sigla do partido não pode ter espaços nem caracteres especiais", "Aviso", JOptionPane.INFORMATION_MESSAGE); return false; } else if (partidoAssociado.length() < 2 || partidoAssociado.length() > 10) { JOptionPane.showMessageDialog(null, "A sigla do partido precisa possuir mais de 2 letras e menos de 10:", "Aviso", JOptionPane.INFORMATION_MESSAGE); return false; } else { for (int i = 0; i < eleicao.quantidadePrefeitos(); i++) { if (partidoAssociado.equalsIgnoreCase(eleicao.getPrefeitos().get(i).getPartidoAssociado())) { JOptionPane.showMessageDialog(null, "Partido já cadastrado!", "Aviso", JOptionPane.INFORMATION_MESSAGE); return false; } } } return true; } public static boolean validaPontuacaoEspaçamento(String partidoAssociado) { for(int i=0;i<partidoAssociado.length();i++) { if(partidoAssociado.charAt(i)==' ' || partidoAssociado.charAt(i)=='!' || partidoAssociado.charAt(i)=='@' || partidoAssociado.charAt(i)=='#' || partidoAssociado.charAt(i)=='$' || partidoAssociado.charAt(i)=='%' || partidoAssociado.charAt(i)=='¨' || partidoAssociado.charAt(i)=='&' || partidoAssociado.charAt(i)=='.' || partidoAssociado.charAt(i)==',' || partidoAssociado.charAt(i)=='?' || partidoAssociado.charAt(i)=='*' || partidoAssociado.charAt(i)=='(' || partidoAssociado.charAt(i)==')' || partidoAssociado.charAt(i)=='_' || partidoAssociado.charAt(i)=='-' || partidoAssociado.charAt(i)=='+' || partidoAssociado.charAt(i)=='/' || partidoAssociado.charAt(i)=='\\' || partidoAssociado.charAt(i)=='=' || partidoAssociado.charAt(i)=='|' || partidoAssociado.charAt(i)==':' || partidoAssociado.charAt(i)==';' || partidoAssociado.charAt(i)=='¬' ) return true; } return false; } public static boolean validaNomeCidade(StringBuilder nome) { if (nome == null || nome.length() <= 2) { JOptionPane.showMessageDialog(null, "Nome inválido! Digite novamente o nome da cidade"); return false; } return true; } public static boolean validaSair() { int resposta; do { resposta = JOptionPane.showConfirmDialog(null, "Deseja sair do programa?", "Sair", JOptionPane.YES_NO_OPTION); } while (resposta == -1); if (resposta == 0) { PrefeitoDAO prefeitoDao = new PrefeitoDAO(); prefeitoDao.deletar(); } return ((resposta == 0) ? true : false); } public static boolean validaCadastrarOutraCidade() { int resposta; do { resposta = JOptionPane.showConfirmDialog(null, "Deseja cadastrar outra cidade?", "Sair", JOptionPane.YES_NO_OPTION); } while (resposta == -1); if (resposta == 0) { PrefeitoDAO prefeitoDao = new PrefeitoDAO(); prefeitoDao.deletar(); } return ((resposta == 0) ? true : false); } }
package prefeitura.siab.persistencia; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.TypedQuery; import org.springframework.stereotype.Component; import prefeitura.siab.tabela.Raca; @Component public class RacaDao { private @PersistenceContext EntityManager manager; public Raca searchRaca(Raca raca) { StringBuilder predicate = new StringBuilder("1 = 1"); if (raca.getCodigo() != null && raca.getCodigo() != 0 && raca.getNome() != null && raca.getNome().length() > 1) { predicate.append(" and (raca.codigo = :racaCodigo or upper(raca.nome) like :racaNome)"); } else { if (raca.getCodigo() != null && raca.getCodigo() != 0) { predicate.append(" and raca.codigo = :racaCodigo"); } if (raca.getNome() != null && raca.getNome().length() > 1) { predicate.append(" and upper(raca.nome) like :racaNome"); } } String jpql = "Select raca from Raca raca where " + predicate; TypedQuery<Raca> query = manager.createQuery(jpql, Raca.class); if (raca.getCodigo() != null && raca.getCodigo() != 0 && raca.getNome() != null && raca.getNome().length() > 1) { query.setParameter("racaCodigo", raca.getCodigo()); query.setParameter("racaNome", raca.getNome().toUpperCase()); }else{ if (raca.getCodigo() != null && raca.getCodigo() != 0) { query.setParameter("racaCodigo", raca.getCodigo()); } if (raca.getNome() != null && raca.getNome().length() > 1) { query.setParameter("racaNome", raca.getNome().toUpperCase()); } } List<Raca> result = query.getResultList(); if (result.isEmpty()) { return null; } else { return result.get(0); } } public void insert(Raca raca) { manager.persist(raca); } public List<Raca> searchListRaca(Raca raca) { StringBuilder predicate = new StringBuilder("1 = 1"); if (raca.getCodigo() != null && raca.getCodigo() != 0 && raca.getNome() != null && raca.getNome().length() > 1) { predicate.append(" and raca.codigo = :racaCodigo and upper(raca.nome) like :racaNome"); } else { if (raca.getCodigo() != null && raca.getCodigo() != 0) { predicate.append(" and raca.codigo = :racaCodigo"); } if (raca.getNome() != null && raca.getNome().length() > 1) { predicate.append(" and upper(raca.nome) like :racaNome"); } } String jpql = "Select raca from Raca raca where " + predicate; TypedQuery<Raca> query = manager.createQuery(jpql, Raca.class); if (raca.getCodigo() != null && raca.getCodigo() != 0 && raca.getNome() != null && raca.getNome().length() > 1) { query.setParameter("racaCodigo", raca.getCodigo()); query.setParameter("racaNome", raca.getNome().toUpperCase()); }else{ if (raca.getCodigo() != null && raca.getCodigo() != 0) { query.setParameter("racaCodigo", raca.getCodigo()); } if (raca.getNome() != null && raca.getNome().length() > 1) { query.setParameter("racaNome", raca.getNome().toUpperCase()); } } List<Raca> result = query.getResultList(); System.out.println(result); return result; } }
package com.example.admin3.mobtransyandex; /** * Created by Admin3 on 19.04.2017. */ public class DataItem { private String input = null; private String output = null; private String dirs = null; private long ID = 0; private int fav = 0; public DataItem(String input, String dirs) { this.input = input; this.dirs = dirs; } public DataItem() { } public String getInput() { return input; } public void setInput(String input) { this.input = input; } public String getOutput() { return output; } public void setOutput(String output) { this.output = output; } public String getDirs() { return dirs; } public void setDirs(String dirs) { this.dirs = dirs; } public long getID() { return ID; } public void setID(long ID) { this.ID = ID; } public int getFav() { return fav; } public void setFav(int fav) { this.fav = fav; } }
package com.example.iutassistant.NewActivities; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.app.Dialog; import android.content.SharedPreferences; import android.os.Bundle; import android.view.View; import android.widget.AutoCompleteTextView; import android.widget.Button; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import com.example.iutassistant.Extra.Constant; import com.example.iutassistant.R; import com.example.iutassistant.Model.FirebaseKeyDataListAutoTextInfo; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; public class Teachers_Class_Invitation extends AppCompatActivity { public AutoCompleteTextView selectCourse, selectSection; private Button invite; private ImageView yes,no; private ListView invitedList; private String courseText,secText,name,email,teacherNameEmail=""; private boolean isNotTaken=true; private Dialog asstTeacherDialog; private TextView teWarning; private int count_class; DatabaseReference firebaseDatabase,firebaseDatabaseCrs,firebaseDatabaseSec; FirebaseKeyDataListAutoTextInfo firebaseKeyDataListAutoTextInfo; SharedPreferences userInfo,classInfo; String teachers_all_uid; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_teachers__class__invitation); userInfo=getSharedPreferences(Constant.USER_INFO_SHARED_PREFERENCES,MODE_PRIVATE); classInfo=getSharedPreferences(Constant.CLASSES_INFO_SHARED_PREFERENCES,MODE_PRIVATE); selectCourse = findViewById(R.id.courseSelectId); selectSection = findViewById(R.id.sectionSelectId); invite = findViewById(R.id.inviteButtonId); invitedList = findViewById(R.id.invitedListId); //firebaseKeyDataListAutoTextSingleTone=FirebaseKeyDataListAutoTextSingleTone.getInstance(); firebaseDatabase=FirebaseDatabase.getInstance().getReference(Constant.Ref); addCourses(); addSections(); System.out.println(" tarpor "); Invite(); asstTeacherDialog=new Dialog(this); } private void addSections() { firebaseDatabaseSec=firebaseDatabase.child(Constant.Section_Node); firebaseKeyDataListAutoTextInfo =new FirebaseKeyDataListAutoTextInfo(); firebaseKeyDataListAutoTextInfo.getDataList(2,this,selectSection,firebaseDatabaseSec); } public void addCourses(){ firebaseDatabaseCrs=firebaseDatabase.child(Constant.Course_Node); firebaseKeyDataListAutoTextInfo =new FirebaseKeyDataListAutoTextInfo(); firebaseKeyDataListAutoTextInfo.getDataList(1,this,selectCourse,firebaseDatabaseCrs); } //listeners public void Invite(){ invite.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { System.out.println(" hoi nai ken"); courseText=selectCourse.getText().toString().trim(); secText=selectSection.getText().toString().trim(); isClassTaken(); } }); } //dialog box button public void yesBtn(){ yes.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { addClass(teachers_all_uid); asstTeacherDialog.dismiss(); } }); } public void noBtn(){ no.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { asstTeacherDialog.dismiss(); } }); } //fetching data from firebase public void isClassTaken(){ firebaseDatabase.child(Constant.Classes_Node).child(secText).child(courseText).addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { System.out.println(dataSnapshot); if(dataSnapshot.exists()){ System.out.println("kia hua"); teachers_all_uid=String.valueOf(dataSnapshot.getValue()); System.out.println(teachers_all_uid+ "uid"); getTeachesName(teachers_all_uid); } else{ System.out.println("shabbash"); addClass(userInfo.getString(Constant.uid_preference,"N/A")); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } public void getTeachesName(String teachers_all_uid){ String[] all_uid=teachers_all_uid.split(","); firebaseDatabase.child(Constant.Teacher_Node).addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { if(dataSnapshot.exists()){ teacherNameEmail=""; for(String uid : all_uid) { name = String.valueOf(dataSnapshot.child(uid).child(Constant.userInfo_node_name).getValue()); email = String.valueOf(dataSnapshot.child(uid).child(Constant.userInfo_node_email).getValue()); System.out.println(email+ " email"); teacherNameEmail = teacherNameEmail + name + "(" + email + ")"; } popUpAssistantTeacherDialogBox(); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } //storing into Firebase public void addClass(String teachesId){ firebaseDatabase.child(Constant.Teaches_Node).child(userInfo.getString(Constant.user_email_preference,"N/A")).child(secText).child(courseText).setValue("1"); firebaseDatabase.child(Constant.Classes_Node).child(secText).child(courseText).setValue(teachesId); addClassesToSp(); } //DialogBox public void popUpAssistantTeacherDialogBox(){ asstTeacherDialog.setContentView(R.layout.dialog_is_class_taken); yes=asstTeacherDialog.findViewById(R.id.yesBtn); no=asstTeacherDialog.findViewById(R.id.noBtn); teWarning=asstTeacherDialog.findViewById(R.id.teWarning); teWarning.setText(teacherNameEmail); yesBtn(); noBtn(); asstTeacherDialog.show(); } public void addClassesToSp(){ count_class=classInfo.getInt(Constant.CLASSES_count_preference,0); count_class++; classInfo.edit().putString(String.valueOf(count_class),courseText+secText); classInfo.edit().putInt(Constant.CLASSES_count_preference,count_class); } }