「tbd注解java」注解 java
本篇文章给大家谈谈tbd注解java,以及注解 java对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。
本文目录一览:
- 1、Java关于一个java.util.TreeSet的问题
- 2、java的web开发时,怎么在web页面用户动态的填入表格中的信息,表格行数不确定的情况,
- 3、java 控制打印机实现打印 String【】aa 字符串的数据
- 4、JAVA测试类调用DAO层查询数据库空指针异常
- 5、java编程题,实现一个简单的英中天气转换器
Java关于一个java.util.TreeSet的问题
你好,看到这种问题,你最好能看看源码,我截取TreeSet代码如下:
public boolean add(E e) {
return m.put(e, PRESENT)==null;
}
public TreeSet() {
this(new TreeMapE,Object()); //默认构造
}
HashSet的内部实现就是一个new TreeMapE,Object(),继续看TreeMap:
public V put(K key, V value) {
EntryK,V t = root;
if (t == null) {
// TBD:
// 5045147: (coll) Adding null to an empty TreeSet should
// throw NullPointerException
//
// compare(key, key); // type check
root = new EntryK,V(key, value, null);
size = 1;
modCount++;
return null;
}
int cmp;
EntryK,V parent;
// split comparator and comparable paths
Comparator? super K cpr = comparator;
if (cpr != null) {
do {
parent = t;
cmp = cpr.compare(key, t.key);
if (cmp 0)
t = t.left;
else if (cmp 0)
t = t.right;
else
return t.setValue(value);
} while (t != null);
}
else {
if (key == null)
throw new NullPointerException();
Comparable? super K k = (Comparable? super K) key;
do {
parent = t;
cmp = k.compareTo(t.key);
if (cmp 0)
t = t.left;
else if (cmp 0)
t = t.right;
else
return t.setValue(value);
} while (t != null);
}
EntryK,V e = new EntryK,V(key, value, parent);
if (cmp 0)
parent.left = e;
else
parent.right = e;
fixAfterInsertion(e);
size++;
modCount++;
return null;
}
看到这里我想你也明白了吧,这里就对调用对象的compareTo方法,而你的那个方法返回的正好是相等也就是0.所以在put的时候每次的键相同是不可以继续添加的,所以返回是false。
java的web开发时,怎么在web页面用户动态的填入表格中的信息,表格行数不确定的情况,
function addRow(){
var tr=$("#temptr").clone(true);
tr.css("display","block");
tr.appendTo($("#tbd"));
bh();
}
tr id="temptr" style="display:none" align="center"
td/td
tdinput type="text" style="width: 100px;" //td
tdinput type="text" style="width: 100px;" onblur="cal(this)" //td
tdinput type="text" style="width: 100px;" onblur="cal(this)" //td
tdinput type="text" style="width: 100px;" readonly="readonly" //td
tdinput type="image" src="/RyanYeung/images/delrow.gif" onclick="del(this)" //td
/tr
java 控制打印机实现打印 String【】aa 字符串的数据
/**
* 这是一部分代码
*/
package com.mqney.barcode.tsc.templet;
import ookj.ui.pub.messagedailog.MessageDailog;
import com.mqney.barcode.tsc.TscBarcode;
import com.mqney.barcode.tsc.TscClearbuffer;
import com.mqney.barcode.tsc.TscCloseport;
//import com.mqney.barcode.tsc.TscSendcommand;
import com.mqney.barcode.tsc.TscWindowsfont;
import com.mqney.barcode.tsc.impl.TscBarcodeDefault;
import com.mqney.barcode.tsc.impl.TscOpenportDefault;
import com.mqney.barcode.tsc.impl.TscPrintlabelDefault;
import com.mqney.barcode.tsc.impl.TscSetupDefault;
import com.mqney.barcode.tsc.impl.TscWindowsfontDefault;
import com.mqney.barcode.util.ReadTscProperties;
import com.mqney.barcode.util.RunTscDllFunction;
import com.mqney.barcode.util.TextToParagraph;
/**
* @author pinkfloyd
*
*/
public class SonqaoReportPrint {
public void init(SonqaoReportBean[] srbs){
try{if(srbs==null||srbs.length==0){
return;
}
int num = srbs.length;
/**
* DIRECTION可以,RSS、CIRCLE不行。
*/
// TscSendcommand ts = new TscSendcommand("DIRECTION 1,1");
// TscSendcommand ts = new TscSendcommand("RSS 300,300,\"UCC128CCC\",270,2,2,25,\"1234567890|ABCDEFG\"");
// TscSendcommand ts = new TscSendcommand("CIRCLE 40,16,10,2");
// rdf.RunDllFunctionTSC(ts);
for(int i=0; inum; i++){
SonqaoReportBean srb = srbs[i];
if(srb==null){
continue;
}
RunTscDllFunction rdf = new RunTscDllFunction();
TextToParagraph ttp = new TextToParagraph();
MessageDailog md = new MessageDailog();
TscOpenportDefault tod = new TscOpenportDefault();
ReadTscProperties rtp = new ReadTscProperties();
tod.setPrinter(rtp.getValue(ReadTscProperties.TSC_REPORT_PATH));
rdf.RunDllFunctionTSC(tod);
TscSetupDefault tsd = new TscSetupDefault();
tsd.setLabelWidth("100");
tsd.setLabelHeight("70");
rdf.RunDllFunctionTSC(tsd);
TscClearbuffer tcb = new TscClearbuffer();
rdf.RunDllFunctionTSC(tcb);
TscWindowsfontDefault twd;
twd = new TscWindowsfontDefault(40,16,36,"单位:");
twd.setFontStyle(TscWindowsfont.FONT_STYLE_BOLD);
rdf.RunDllFunctionTSC(twd);
twd = new TscWindowsfontDefault(40,88,36,"姓名:");
twd.setFontStyle(TscWindowsfont.FONT_STYLE_BOLD);
rdf.RunDllFunctionTSC(twd);
twd = new TscWindowsfontDefault(40,152,36,"信息:");
twd.setFontStyle(TscWindowsfont.FONT_STYLE_BOLD);
rdf.RunDllFunctionTSC(twd);
twd = new TscWindowsfontDefault(40,216,36,"部门:");
twd.setFontStyle(TscWindowsfont.FONT_STYLE_BOLD);
rdf.RunDllFunctionTSC(twd);
String[] s0 = ttp.textToParaVoid(srb.getGongsi(), 40);
if(s0==null||s0.length==0){
md.showWarningMessage("getGongsi");
}else{
int num0 = s0.length;
for(int j=0; jnum0; j++){
twd = new TscWindowsfontDefault(140,16+(j*32),32,s0[j]);
// twd.setFontUnderline(TscWindowsfont.FONT_UNDERLINE_WITH);
rdf.RunDllFunctionTSC(twd);
}
}
twd = new TscWindowsfontDefault(140,80,40,srb.getXingming());
rdf.RunDllFunctionTSC(twd);
String[] s2 = ttp.textToParaVoid(srb.getXinxi(), 40);
if(s2==null||s2.length==0){
md.showWarningMessage("getXinxi");
}else{
int num2 = s2.length;
for(int j=0; jnum2; j++){
twd = new TscWindowsfontDefault(140,152+j*32,32,s2[j]);
// twd.setFontUnderline(TscWindowsfont.FONT_UNDERLINE_WITH);
rdf.RunDllFunctionTSC(twd);
}
}
String[] s3 = ttp.textToParaVoid(srb.getBumen(), 40);
if(s3==null||s3.length==0){
md.showWarningMessage("getBumen");
}else{
int num3 = s3.length;
for(int j=0; jnum3; j++){
twd = new TscWindowsfontDefault(140,216+j*32,32,s3[j]);
// twd.setFontUnderline(TscWindowsfont.FONT_UNDERLINE_WITH);
rdf.RunDllFunctionTSC(twd);
}
}
TscBarcodeDefault tbd;
tbd = new TscBarcodeDefault("216","360","48",srb.getBarcode());
tbd.setNarrowBarRatioX(TscBarcode.NARROW_BARRATIO_3);
tbd.setNarrowBarRatioY(TscBarcode.NARROW_BARRATIO_3);
rdf.RunDllFunctionTSC(tbd);
twd = new TscWindowsfontDefault(160,500,32,srb.getSonqao());
rdf.RunDllFunctionTSC(twd);
TscPrintlabelDefault tpd = new TscPrintlabelDefault();
tpd.setLabelCopies("1");
tpd.setLabelSets("1");
rdf.RunDllFunctionTSC(tpd);
TscCloseport tc = new TscCloseport();
rdf.RunDllFunctionTSC(tc);
}
}catch(Exception e){
e.printStackTrace();
}
}
}
JAVA测试类调用DAO层查询数据库空指针异常
tb.getTbUser().getUserLoginpwd()肯定是这句报了异常
然后你看
ListTbAssignment list = this.getHibernateTemplate().find(hqlString);
if (list != null list.size() 0) {
return (TbAssignment) list.get(0);
} else {
return null;
}
说明方法返回了null
你看看你的hqlString里面的名字数据库能查到么。
java编程题,实现一个简单的英中天气转换器
import java.util.Scanner;
public class Weather {
public static String getWeatherInChinese(char c) {
switch (c) {
case 'D':
return "干燥";
case 'M':
return "潮湿";
case 'H':
return "炎热";
case 'R':
return "下雨";
default:
return "输入错误,无法转换";
}
}
public static void main(String[] args) {
boolean tbd = true;
do {
System.out.print("请输入天气情况的第一个英文字母:");
Scanner scanner = new Scanner(System.in);
String input = scanner.next().trim();
if (input.length() != 1) {
System.out.println("输入错误,无法转换!");
} else {
System.out.println(getWeatherInChinese(input.charAt(0)));
}
System.out.print("你想继续吗?(y/n)");
String sta = scanner.next();
tbd = sta.equals("y") ? true : false;
} while (tbd);
System.out.println("退出系统!");
}
}
运行截图:
tbd注解java的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于注解 java、tbd注解java的信息别忘了在本站进行查找喔。