📄 testcontainer.java
字号:
/*
* Copyright (C) 2006-2007 Funambol
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package com.funambol.storage;
import com.funambol.util.Log;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Vector;
/** Another test class. This is a cointainer that uses a Vector. */
public class TestContainer implements Serializable {
protected Vector v;
public TestContainer() {
v = null;
}
public TestContainer(TestClass element) {
v = new Vector(3);
v.addElement(element);
v.addElement(new String("String element"));
v.addElement(new Integer(10));
}
public void serialize(DataOutputStream out) throws IOException {
ComplexSerializer.serializeVector(out, v);
}
public void deserialize(DataInputStream in) throws IOException {
v=(Vector) ComplexSerializer.deserializeVector(in);
}
public boolean equals(TestContainer c) {
TestClass tc1 = (TestClass)v.elementAt(0);
TestClass tc2 = (TestClass)c.v.elementAt(0);
if(!tc1.toString().equals(tc2.toString())){
Log.info("Not equals");
Log.info(tc1.toString());
Log.info(tc2.toString());
return false;
}
String s1 = (String)v.elementAt(1);
String s2 = (String)c.v.elementAt(1);
if(!s1.equals(s2)){
Log.info("Not equals: '"+s1+"' '"+s2+"'");
return false;
}
Integer i1 = (Integer)v.elementAt(2);
Integer i2 = (Integer)c.v.elementAt(2);
if(!i1.equals(i2)){
Log.info("Not equals: '"+i1+"' '"+i2+"'");
return false;
}
return true;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -