files) throws ServletException;
}
diff --git a/src/zutil/net/nio/worker/chat/ChatMessage.java b/src/zutil/net/nio/worker/chat/ChatMessage.java
index 1e29977..278fa0c 100755
--- a/src/zutil/net/nio/worker/chat/ChatMessage.java
+++ b/src/zutil/net/nio/worker/chat/ChatMessage.java
@@ -27,45 +27,43 @@ package zutil.net.nio.worker.chat;
import zutil.net.nio.message.Message;
public class ChatMessage implements Message {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- public static enum ChatMessageType {REGISTER, UNREGISTER, MESSAGE};
-
- public ChatMessageType type;
- public String msg;
- public String room;
-
- /**
- * Registers the user to the main chat
- *
- * @param name Name of user
- */
- public ChatMessage(){
- this("", "", ChatMessageType.REGISTER);
- }
-
- /**
- * Registers the user to the given room
- *
- * @param room The room to register to
- */
- public ChatMessage(String room){
- this("", room, ChatMessageType.REGISTER);
- }
-
- /**
- * Sends a message to the given room
- *
- * @param msg The message
- * @param room The room
- */
- public ChatMessage(String msg, String room){
- this(msg, room, ChatMessageType.MESSAGE);
- }
-
- public ChatMessage(String msg, String room, ChatMessageType type){
- this.msg = msg;
- this.room = room;
- this.type = type;
- }
+ public static enum ChatMessageType {REGISTER, UNREGISTER, MESSAGE};
+
+ public ChatMessageType type;
+ public String msg;
+ public String room;
+
+ /**
+ * Registers the user to the main chat
+ */
+ public ChatMessage(){
+ this("", "", ChatMessageType.REGISTER);
+ }
+
+ /**
+ * Registers the user to the given room
+ *
+ * @param room The room to register to
+ */
+ public ChatMessage(String room){
+ this("", room, ChatMessageType.REGISTER);
+ }
+
+ /**
+ * Sends a message to the given room
+ *
+ * @param msg The message
+ * @param room The room
+ */
+ public ChatMessage(String msg, String room){
+ this(msg, room, ChatMessageType.MESSAGE);
+ }
+
+ public ChatMessage(String msg, String room, ChatMessageType type){
+ this.msg = msg;
+ this.room = room;
+ this.type = type;
+ }
}
diff --git a/src/zutil/net/ws/WSInterface.java b/src/zutil/net/ws/WSInterface.java
index 1857a95..7f0c3ff 100755
--- a/src/zutil/net/ws/WSInterface.java
+++ b/src/zutil/net/ws/WSInterface.java
@@ -38,22 +38,22 @@ import java.lang.annotation.Target;
* private static class Test implements WSInterface{
* public Test(){}
*
- * @WSDocumentation("blabla")
- * @WSDLParamDocumentation("olle = a variable?")
+ * @WSDocumentation("blabla")
+ * @WSDLParamDocumentation("olle = a variable?")
* public void pubZ(
- * @WSParamName("olle") int lol)
+ * @WSParamName("olle") int lol)
* throws Exception{
* ....
* }
*
- * @WSReturnName("param")
+ * @WSReturnName("param")
* public String pubA(
- * @WSParamName(value="lol", optional=true) String lol)
+ * @WSParamName(value="lol", optional=true) String lol)
* throws Exception{
* ....
* }
*
- * @WSIgnore()
+ * @WSIgnore()
* public void privaZ(....){
* ...
* }
@@ -63,79 +63,78 @@ import java.lang.annotation.Target;
* @author Ziver
*/
public interface WSInterface {
- /**
- * Annotation that assigns a name to an parameters
- * in an method.
- *
- * @author Ziver
- */
- @Retention(RetentionPolicy.RUNTIME)
- @Target(ElementType.PARAMETER)
- public @interface WSParamName {
- String value();
- boolean optional() default false;
- }
-
- /**
- * Annotation that assigns a name to the return value
- * in an method.
- *
- * @author Ziver
- */
- @Retention(RetentionPolicy.RUNTIME)
- @Target(ElementType.METHOD)
- public @interface WSReturnName {
- String value();
- }
-
- /**
- * Skipp publication of the given method
- *
- * @author Ziver
- */
- @Retention(RetentionPolicy.RUNTIME)
- @Target(ElementType.METHOD)
- public @interface WSIgnore { }
-
- /**
- * Method or Parameter comments for the WSDL.
- * These comments are put in the message part of the WSDL
- *
- * @author Ziver
- */
- @Retention(RetentionPolicy.RUNTIME)
- public @interface WSDocumentation{
- String value();
- }
+ /**
+ * Annotation that assigns a name to an parameters
+ * in an method.
+ *
+ * @author Ziver
+ */
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.PARAMETER)
+ @interface WSParamName {
+ String value();
+ boolean optional() default false;
+ }
- /**
- * Parameter comments for the WSDL.
- * These comments are put in the message part of the WSDL
- *
- * @author Ziver
- */
- @Retention(RetentionPolicy.RUNTIME)
- public @interface WSParamDocumentation{
- String value();
- }
-
- /**
- * This method will be used in the header.
- *
- * @author Ziver
- */
- @Retention(RetentionPolicy.RUNTIME)
- @Target(ElementType.METHOD)
- public @interface WSHeader { }
-
- /**
- * Specifies the name space for method.
- *
- * @author Ziver
- */
- @Retention(RetentionPolicy.RUNTIME)
- //@Target(ElementType.TYPE)
- public @interface WSNamespace {
- String value();
- }
+ /**
+ * Annotation that assigns a name to the return value
+ * in an method.
+ *
+ * @author Ziver
+ */
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.METHOD)
+ @interface WSReturnName {
+ String value();
+ }
+
+ /**
+ * Skipp publication of the given method
+ *
+ * @author Ziver
+ */
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.METHOD)
+ public @interface WSIgnore { }
+
+ /**
+ * Method or Parameter comments for the WSDL.
+ * These comments are put in the message part of the WSDL
+ *
+ * @author Ziver
+ */
+ @Retention(RetentionPolicy.RUNTIME)
+ @interface WSDocumentation{
+ String value();
+ }
+
+ /**
+ * Parameter comments for the WSDL.
+ * These comments are put in the message part of the WSDL
+ *
+ * @author Ziver
+ */
+ @Retention(RetentionPolicy.RUNTIME)
+ @interface WSParamDocumentation{
+ String value();
+ }
+
+ /**
+ * This method will be used in the header.
+ *
+ * @author Ziver
+ */
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.METHOD)
+ @interface WSHeader { }
+
+ /**
+ * Specifies the name space for method.
+ *
+ * @author Ziver
+ */
+ @Retention(RetentionPolicy.RUNTIME)
+ @interface WSNamespace {
+ String value();
+ }
}
diff --git a/src/zutil/net/ws/WSReturnObject.java b/src/zutil/net/ws/WSReturnObject.java
index de37938..eb4d7e1 100644
--- a/src/zutil/net/ws/WSReturnObject.java
+++ b/src/zutil/net/ws/WSReturnObject.java
@@ -38,9 +38,9 @@ import java.lang.reflect.Field;
*
*
* private static class TestObject implements WSReturnObject{
- * @WSValueName("name")
+ * @WSValueName("name")
* public String name;
- * @WSValueName("lastname")
+ * @WSValueName("lastname")
* public String lastname;
*
* public TestObject(String n, String l){
diff --git a/src/zutil/parser/BEncodedParser.java b/src/zutil/parser/BEncodedParser.java
index ff5fc0e..eddbdfc 100755
--- a/src/zutil/parser/BEncodedParser.java
+++ b/src/zutil/parser/BEncodedParser.java
@@ -41,7 +41,6 @@ public class BEncodedParser {
* Returns the representation of the data in the BEncoded string
*
* @param data is the data to be decoded
- * @return
*/
public static DataNode read(String data) throws ParseException {
return decode_BEncoded(new MutableInt(), new StringBuilder(data));
diff --git a/src/zutil/struct/BloomFilter.java b/src/zutil/struct/BloomFilter.java
index 9c21b7c..cd74aff 100644
--- a/src/zutil/struct/BloomFilter.java
+++ b/src/zutil/struct/BloomFilter.java
@@ -38,163 +38,164 @@ import java.util.Set;
*
*/
public class BloomFilter implements Set, Serializable{
- private static final long serialVersionUID = 1L;
-
- private BitSet bits;
- private int content_size;
- private int optimal_size;
- private int k;
+ private static final long serialVersionUID = 1L;
-
- /**
- * Creates a bloom filter
- *
- * @param size The amount of bits in the filter
- * @param expected_data_count The estimated amount of data to
- * be inserted(a bigger number is better than a smaller)
- */
- public BloomFilter(int size, int expected_data_count){
- bits = new BitSet(size);
- k = (int)((size/expected_data_count) * Math.log(2));
- content_size = 0;
- optimal_size = expected_data_count;
- }
+ private BitSet bits;
+ private int content_size;
+ private int optimal_size;
+ private int k;
- /**
- * @param e A Serializable object
- * @return If the optimal size has been reached
- */
- public boolean add(T e) {
- try {
- content_size++;
- int hash = 0;
- for(int i=0; i c) {
- for(T t : c){
- add(t);
- }
- return isFull();
- }
+ /**
+ * Creates a bloom filter
+ *
+ * @param size The amount of bits in the filter
+ * @param expected_data_count The estimated amount of data to
+ * be inserted(a bigger number is better than a smaller)
+ */
+ public BloomFilter(int size, int expected_data_count){
+ bits = new BitSet(size);
+ k = (int)((size/expected_data_count) * Math.log(2));
+ content_size = 0;
+ optimal_size = expected_data_count;
+ }
- /**
- * @return clears the filter
- */
- public void clear() {
- content_size = 0;
- bits.clear();
- }
+ /**
+ * @param e A Serializable object
+ * @return If the optimal size has been reached
+ */
+ public boolean add(T e) {
+ try {
+ content_size++;
+ int hash = 0;
+ for(int i=0; i c) {
+ for(T t : c){
+ add(t);
+ }
+ return isFull();
+ }
- /**
- * Checks if the whole collection contains in the filter
- *
- * @param c The collection
- */
- public boolean containsAll(Collection> c) {
- for(Object o : c){
- if(!contains(o)) return false;
- }
- return true;
- }
+ /**
+ * Clears the filter
+ */
+ public void clear() {
+ content_size = 0;
+ bits.clear();
+ }
- /**
- * @return If the bloom filter is empty
- */
- public boolean isEmpty() {
- return content_size == 0;
- }
-
- /**
- * @return If the optimal size has been reached
- */
- public boolean isFull() {
- return content_size > optimal_size;
- }
-
- /**
- * @return The number of data added
- */
- public int size() {
- return content_size;
- }
-
- /**
- * @return The false positive probability of the current state of the filter
- */
- public double falsePosetiveProbability(){
- return Math.pow(0.6185, bits.size()/content_size);
- }
-
- /**
- * Set the hash count. Should be set before adding elements
- * or the already added elements will be lost
- *
- * @param k The hash count
- */
- public void setHashCount(int k){
- this.k = k;
- }
-
- //*********************************************************************
- //*********************************************************************
- public Object[] toArray() {
- throw new UnsupportedOperationException();
- }
+ /**
+ * @param o is the Serializable object to search for
+ * @return If the object contains in the filter or
+ * false if the Object is not Serializable
+ */
+ public boolean contains(Object o) {
+ try {
+ if(!(o instanceof Serializable))return false;
+ int hash = 0;
+ for(int i=0; i T[] toArray(T[] a) {
- throw new UnsupportedOperationException();
- }
+ return true;
+ }
- public Iterator iterator() {
- throw new UnsupportedOperationException();
- }
+ /**
+ * Checks if the whole collection contains in the filter
+ *
+ * @param c The collection
+ */
+ public boolean containsAll(Collection> c) {
+ for(Object o : c){
+ if(!contains(o)) return false;
+ }
+ return true;
+ }
- public boolean remove(Object o) {
- throw new UnsupportedOperationException();
- }
+ /**
+ * @return If the bloom filter is empty
+ */
+ public boolean isEmpty() {
+ return content_size == 0;
+ }
- public boolean removeAll(Collection> c) {
- throw new UnsupportedOperationException();
- }
-
- public boolean retainAll(Collection> c) {
- throw new UnsupportedOperationException();
- }
+ /**
+ * @return If the optimal size has been reached
+ */
+ public boolean isFull() {
+ return content_size > optimal_size;
+ }
+
+ /**
+ * @return The number of data added
+ */
+ public int size() {
+ return content_size;
+ }
+
+ /**
+ * @return The false positive probability of the current state of the filter
+ */
+ public double falsePositiveProbability(){
+ return Math.pow(0.6185, bits.size()/content_size);
+ }
+
+ /**
+ * Set the hash count. Should be set before adding elements
+ * or the already added elements will be lost
+ *
+ * @param k The hash count
+ */
+ public void setHashCount(int k){
+ this.k = k;
+ }
+
+
+ //*********************************************************************
+ //*********************************************************************
+ public Object[] toArray() {
+ throw new UnsupportedOperationException();
+ }
+
+ @SuppressWarnings("hiding")
+ public T[] toArray(T[] a) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Iterator iterator() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean remove(Object o) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean removeAll(Collection> c) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean retainAll(Collection> c) {
+ throw new UnsupportedOperationException();
+ }
}
diff --git a/src/zutil/ui/wizard/WizardActionHandler.java b/src/zutil/ui/wizard/WizardActionHandler.java
index 3cbbe1e..7a6b33b 100644
--- a/src/zutil/ui/wizard/WizardActionHandler.java
+++ b/src/zutil/ui/wizard/WizardActionHandler.java
@@ -36,87 +36,87 @@ import java.awt.event.FocusListener;
import java.util.HashMap;
public class WizardActionHandler implements ActionListener, FocusListener, ListSelectionListener{
- private HashMap values;
+ private HashMap values;
- public WizardActionHandler(HashMap values){
- this.values = values;
- }
+ public WizardActionHandler(HashMap values){
+ this.values = values;
+ }
- public void actionPerformed(ActionEvent e) {
- event(e);
- }
- public void focusGained(FocusEvent e) {
- event(e);
- }
- public void focusLost(FocusEvent e) {
- event(e);
- }
- public void event(AWTEvent e){
- if(e.getSource() instanceof Component)
- registerValue( (Component)e.getSource() );
- }
- public void valueChanged(ListSelectionEvent e) {
- if(e.getSource() instanceof Component)
- registerValue( (Component)e.getSource() );
- }
+ public void actionPerformed(ActionEvent e) {
+ event(e);
+ }
+ public void focusGained(FocusEvent e) {
+ event(e);
+ }
+ public void focusLost(FocusEvent e) {
+ event(e);
+ }
+ public void event(AWTEvent e){
+ if(e.getSource() instanceof Component)
+ registerValue( (Component)e.getSource() );
+ }
+ public void valueChanged(ListSelectionEvent e) {
+ if(e.getSource() instanceof Component)
+ registerValue( (Component)e.getSource() );
+ }
- public void registerListener(Component c){
- /**
- * JToggleButton
- * JCheckBox
- * JRadioButton
- */
- if(c instanceof JToggleButton){
- JToggleButton o = (JToggleButton) c;
- o.addActionListener( this );
- }
- /**
- * JEditorPane
- * JTextArea
- * JTextField
- */
- else if(c instanceof JTextComponent){
- JTextComponent o = (JTextComponent) c;
- o.addFocusListener( this );
- }
- /**
- * JList
- */
- else if(c instanceof JList){
- JList> o = (JList>) c;
- o.addListSelectionListener( this );
- }
- }
+ public void registerListener(Component c){
+ /**
+ * JToggleButton
+ * JCheckBox
+ * JRadioButton
+ */
+ if(c instanceof JToggleButton){
+ JToggleButton o = (JToggleButton) c;
+ o.addActionListener( this );
+ }
+ /**
+ * JEditorPane
+ * JTextArea
+ * JTextField
+ */
+ else if(c instanceof JTextComponent){
+ JTextComponent o = (JTextComponent) c;
+ o.addFocusListener( this );
+ }
+ /**
+ * JList
+ */
+ else if(c instanceof JList){
+ JList> o = (JList>) c;
+ o.addListSelectionListener( this );
+ }
+ }
- /**
- * Registers the state of the event source
- * @param e is the event
- */
- public void registerValue(Component c) {
- /**
- * JToggleButton
- * JCheckBox
- * JRadioButton
- */
- if(c instanceof JToggleButton){
- JToggleButton o = (JToggleButton) c;
- values.put( o.getName() , o.isSelected() );
- }
- /**
- * JEditorPane
- * JTextArea
- * JTextField
- */
- else if(c instanceof JTextComponent){
- JTextComponent o = (JTextComponent) c;
- values.put( o.getName() , o.getText() );
- }
- /**
- * JList
- */
- else if(c instanceof JList){
- JList> o = (JList>) c;
- values.put( o.getName() , o.getSelectedValue() );
- }
- }
+ /**
+ * Registers the state of the event source
+ * @param c is the event
+ */
+ public void registerValue(Component c) {
+ /**
+ * JToggleButton
+ * JCheckBox
+ * JRadioButton
+ */
+ if(c instanceof JToggleButton){
+ JToggleButton o = (JToggleButton) c;
+ values.put( o.getName() , o.isSelected() );
+ }
+ /**
+ * JEditorPane
+ * JTextArea
+ * JTextField
+ */
+ else if(c instanceof JTextComponent){
+ JTextComponent o = (JTextComponent) c;
+ values.put( o.getName() , o.getText() );
+ }
+ /**
+ * JList
+ */
+ else if(c instanceof JList){
+ JList> o = (JList>) c;
+ values.put( o.getName() , o.getSelectedValue() );
+ }
+ }
}
diff --git a/test/zutil/struct/BloomFilterTest.java b/test/zutil/struct/BloomFilterTest.java
index 2dfa9fb..0f8ec82 100755
--- a/test/zutil/struct/BloomFilterTest.java
+++ b/test/zutil/struct/BloomFilterTest.java
@@ -70,7 +70,7 @@ public class BloomFilterTest extends TestCase {
falsePositives++;
}
}
- double expectedFP = bf.falsePosetiveProbability();
+ double expectedFP = bf.falsePositiveProbability();
double actualFP = (double) falsePositives / (double) addCount;
System.out.println("Got " + falsePositives
+ " false positives out of " + addCount + " added items, rate = "