Update of /var/cvs/src/org/mmbase/bridge/util
In directory james.mmbase.org:/tmp/cvs-serv25982/src/org/mmbase/bridge/util
Modified Files:
FieldWrapper.java MapNode.java AbstractCollectionNodeList.java
AbstractNodeManager.java TreeList.java NodeWrapper.java
Queries.java
Log Message:
Cleaned the code a little
Added some generic stuff for function and datatypes
See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/bridge/util
Index: FieldWrapper.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/bridge/util/FieldWrapper.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- FieldWrapper.java 11 Feb 2007 14:46:13 -0000 1.3
+++ FieldWrapper.java 3 Feb 2008 17:33:56 -0000 1.4
@@ -22,7 +22,7 @@
* implementation on a existing <code>Field</code> instance.
*
* @author Michiel Meeuwissen
- * @version $Id: FieldWrapper.java,v 1.3 2007/02/11 14:46:13 nklasens Exp $
+ * @version $Id: FieldWrapper.java,v 1.4 2008/02/03 17:33:56 nklasens Exp $
* @since MMBase-1.8.1
*/
@@ -36,7 +36,7 @@
public int getState() { return Field.STATE_VIRTUAL; }
- public DataType getDataType() { return field.getDataType(); }
+ public DataType<Object> getDataType() { return field.getDataType(); }
public boolean isUnique() { return field.isUnique(); }
public boolean hasIndex() { return field.hasIndex(); }
public int getType() { return field.getType(); }
Index: MapNode.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/bridge/util/MapNode.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- MapNode.java 10 Feb 2007 15:47:42 -0000 1.10
+++ MapNode.java 3 Feb 2008 17:33:56 -0000 1.11
@@ -20,7 +20,7 @@
* MMBase Node. E.g. because then it can be accessed in MMBase taglib using
mm:field tags.
* @author Michiel Meeuwissen
- * @version $Id: MapNode.java,v 1.10 2007/02/10 15:47:42 nklasens Exp $
+ * @version $Id: MapNode.java,v 1.11 2008/02/03 17:33:56 nklasens Exp $
* @since MMBase-1.8
*/
@@ -237,7 +237,7 @@
return false;
}
- public Collection getFunctions() {
+ public Collection<Function<?>> getFunctions() {
return nodeManager.getFunctions();
}
Index: AbstractCollectionNodeList.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/bridge/util/AbstractCollectionNodeList.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- AbstractCollectionNodeList.java 30 Mar 2007 12:47:58 -0000 1.3
+++ AbstractCollectionNodeList.java 3 Feb 2008 17:33:56 -0000 1.4
@@ -22,13 +22,13 @@
protected final NodeManager nodeManager;
protected final List wrappedCollection;
- public AbstractCollectionNodeList(Collection c, NodeManager nodeManager) {
+ public AbstractCollectionNodeList(Collection<Node> c, NodeManager
nodeManager) {
this.nodeManager = nodeManager;
this.cloud = nodeManager.getCloud();
this.wrappedCollection = convertedList(c, cloud);
}
- public AbstractCollectionNodeList(Collection c, Cloud cloud) {
+ public AbstractCollectionNodeList(Collection<Node> c, Cloud cloud) {
this.nodeManager = null;
this.cloud = cloud;
this.wrappedCollection = convertedList(c, cloud);
Index: AbstractNodeManager.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/bridge/util/AbstractNodeManager.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- AbstractNodeManager.java 16 Apr 2007 08:33:43 -0000 1.8
+++ AbstractNodeManager.java 3 Feb 2008 17:33:56 -0000 1.9
@@ -16,6 +16,7 @@
import org.mmbase.bridge.*;
import org.mmbase.bridge.implementation.BasicFieldList;
+import org.mmbase.util.functions.Function;
/**
* Abstract implementation of NodeManager, to minimalize the implementation of
a virtual one. Must
@@ -23,7 +24,7 @@
* org.mmbase.bridge.implementation.VirtualNodeManager}.
*
* @author Michiel Meeuwissen
- * @version $Id: AbstractNodeManager.java,v 1.8 2007/04/16 08:33:43 nklasens
Exp $
+ * @version $Id: AbstractNodeManager.java,v 1.9 2008/02/03 17:33:56 nklasens
Exp $
* @see org.mmbase.bridge.NodeManager
* @since MMBase-1.8
*/
@@ -162,7 +163,7 @@
return BridgeCollections.EMPTY_NODEMANAGERLIST;
}
- public Collection getFunctions() {
+ public Collection<Function<?>> getFunctions() {
return Collections.emptyList();
}
Index: TreeList.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/bridge/util/TreeList.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- TreeList.java 2 Aug 2007 10:09:49 -0000 1.28
+++ TreeList.java 3 Feb 2008 17:33:56 -0000 1.29
@@ -23,7 +23,7 @@
*
*
* @author Michiel Meeuwissen
- * @version $Id: TreeList.java,v 1.28 2007/08/02 10:09:49 michiel Exp $
+ * @version $Id: TreeList.java,v 1.29 2008/02/03 17:33:56 nklasens Exp $
* @since MMBase-1.7
*/
@@ -287,7 +287,7 @@
nodeList.setProperty(REAL_NODES, realNodes);
}
assert realNodes.size() == nodeList.size() : "The size of nodeList " +
nodeList.size() + " does not match realNodes " + realNodes.size() +
- " at queryIndex; " + queryIndex + " query " + ((Branch)
branches.get(queryIndex)).getLeafQuery().toSql();
+ " at queryIndex; " + queryIndex + " query " +
branches.get(queryIndex).getLeafQuery().toSql();
assert realNodes.size() >= index : "The size of realNodes (" +
realNodes.size() + ") is too small (index = " + index + ")";
return realNodes.getNode(index);
}
Index: NodeWrapper.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/bridge/util/NodeWrapper.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- NodeWrapper.java 10 Feb 2007 17:44:03 -0000 1.19
+++ NodeWrapper.java 3 Feb 2008 17:33:56 -0000 1.20
@@ -22,7 +22,7 @@
* implementation on a existing <code>Node</code> instance.
*
* @author Michiel Meeuwissen
- * @version $Id: NodeWrapper.java,v 1.19 2007/02/10 17:44:03 nklasens Exp $
+ * @version $Id: NodeWrapper.java,v 1.20 2008/02/03 17:33:56 nklasens Exp $
* @since MMBase-1.8
*/
@@ -120,7 +120,7 @@
public boolean mayWrite() { return node.mayWrite(); }
public boolean mayDelete() { return node.mayDelete(); }
public boolean mayChangeContext() { return node.mayChangeContext(); }
- public Collection getFunctions() { return node.getFunctions(); }
+ public Collection<Function<?>> getFunctions() { return
node.getFunctions(); }
public Function getFunction(String functionName) { return
node.getFunction(functionName); }
public Parameters createParameters(String functionName) { return
node.createParameters(functionName); }
public FieldValue getFunctionValue(String functionName, List parameters) {
return node.getFunctionValue(functionName, parameters);}
Index: Queries.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/bridge/util/Queries.java,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -b -r1.94 -r1.95
--- Queries.java 4 Jan 2008 13:44:47 -0000 1.94
+++ Queries.java 3 Feb 2008 17:33:56 -0000 1.95
@@ -26,7 +26,7 @@
* methods are put here.
*
* @author Michiel Meeuwissen
- * @version $Id: Queries.java,v 1.94 2008/01/04 13:44:47 michiel Exp $
+ * @version $Id: Queries.java,v 1.95 2008/02/03 17:33:56 nklasens Exp $
* @see org.mmbase.bridge.Query
* @since MMBase-1.7
*/
@@ -439,7 +439,7 @@
} else if (value instanceof Collection) { // or even more
aliases!
Collection col = (Collection) value;
value = new ArrayList();
- List list = (List) value;
+ List<Object> list = (List<Object>) value;
for (Object v : col) {
if (v instanceof Number) {
list.add(v);
@@ -577,7 +577,7 @@
FieldValueInConstraint constraint = (FieldValueInConstraint) c;
// sigh
- SortedSet set = new TreeSet();
+ SortedSet<Object> set = new TreeSet<Object>();
int type = field.getType();
for (Object value : constraint.getValues()) {
switch(type) {
@@ -936,7 +936,7 @@
count.addAggregatedField(step,
cloud.getNodeManager(step.getTableName()).getField(resultName), type);
} else {
// simply take this one field
- StepField sf = (StepField) fields.get(0);
+ StepField sf = fields.get(0);
Step step = sf.getStep();
resultName = sf.getFieldName();
count.addAggregatedField(step,
cloud.getNodeManager(step.getTableName()).getField(resultName), type);
@@ -1136,7 +1136,7 @@
Step step = sortOrder.getField().getStep();
if (steps == null) {
// instantiate new ArrayList only if really necessary
- steps = new ArrayList(q.getSteps());
+ steps = new ArrayList<Step>(q.getSteps());
}
steps.remove(step);
}
@@ -1230,7 +1230,7 @@
} else {
// compare the results
try {
- result = ((Comparable)value).compareTo(value2);
+ result = ((Comparable<Object>)value).compareTo(value2);
} catch (ClassCastException cce) {
// This should not occur, and indicates very odd values are
being sorted on (i.e. byte arrays).
// warn and ignore this sortorder
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs