You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2005/03/10 18:33:20 UTC
svn commit: r156968 - in cocoon/trunk/src/java/org/apache/cocoon:
components/modules/input/DateMetaInputModule.java
components/modules/input/IteratorHelper.java
components/xpointer/parser/XPointerFrameworkParser.java
util/EnumerationFactory.java
Author: cziegeler
Date: Thu Mar 10 09:33:17 2005
New Revision: 156968
URL: http://svn.apache.org/viewcvs?view=rev&rev=156968
Log:
Enum is a keyword starting with jdk 5.0 :(
Modified:
cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/DateMetaInputModule.java
cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/IteratorHelper.java
cocoon/trunk/src/java/org/apache/cocoon/components/xpointer/parser/XPointerFrameworkParser.java
cocoon/trunk/src/java/org/apache/cocoon/util/EnumerationFactory.java
Modified: cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/DateMetaInputModule.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/DateMetaInputModule.java?view=diff&r1=156967&r2=156968
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/DateMetaInputModule.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/DateMetaInputModule.java Thu Mar 10 09:33:17 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@
* "input-module" holds InputModule to obtain the string from.
*
* @author <a href="mailto:haul@apache.org">Christian Haul</a>
- * @version CVS $Id: DateMetaInputModule.java,v 1.4 2004/03/05 13:02:48 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class DateMetaInputModule extends AbstractMetaModule implements ThreadSafe {
@@ -133,10 +133,10 @@
// done reading configuration
// setup modules and read values
- Iterator enum = getNames(objectModel,
- this.input, this.defaultInput, inputConfig,
- null, inputName, mConf);
- return enum;
+ Iterator enumeration = getNames(objectModel,
+ this.input, this.defaultInput, inputConfig,
+ null, inputName, mConf);
+ return enumeration;
}
Modified: cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/IteratorHelper.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/IteratorHelper.java?view=diff&r1=156967&r2=156968
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/IteratorHelper.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/IteratorHelper.java Thu Mar 10 09:33:17 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,13 +21,15 @@
/**
* Wraps an Enumeration and provides Iterator interface.
*
- * @version CVS $Id: IteratorHelper.java,v 1.4 2004/03/05 13:02:48 bdelacretaz Exp $
+ * @version CVS $Id$
*/
class IteratorHelper implements Iterator {
- Enumeration enum = null;
- public IteratorHelper( Enumeration e ) { this.enum = e; }
- public boolean hasNext() { return this.enum.hasMoreElements(); }
- public Object next() { return this.enum.nextElement(); }
+
+ protected Enumeration enumeration;
+
+ public IteratorHelper( Enumeration e ) { this.enumeration = e; }
+ public boolean hasNext() { return this.enumeration.hasMoreElements(); }
+ public Object next() { return this.enumeration.nextElement(); }
/** ignored */
public void remove() {}
}
Modified: cocoon/trunk/src/java/org/apache/cocoon/components/xpointer/parser/XPointerFrameworkParser.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/xpointer/parser/XPointerFrameworkParser.java?view=diff&r1=156967&r2=156968
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/xpointer/parser/XPointerFrameworkParser.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/xpointer/parser/XPointerFrameworkParser.java Thu Mar 10 09:33:17 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -506,10 +506,10 @@
jj_expentry[i] = jj_lasttokens[i];
}
boolean exists = false;
- for (java.util.Enumeration enum = jj_expentries.elements();
- enum.hasMoreElements();
+ for (java.util.Enumeration enumeration = jj_expentries.elements();
+ enumeration.hasMoreElements();
) {
- int[] oldentry = (int[]) (enum.nextElement());
+ int[] oldentry = (int[]) (enumeration.nextElement());
if (oldentry.length == jj_expentry.length) {
exists = true;
for (int i = 0; i < jj_expentry.length; i++) {
Modified: cocoon/trunk/src/java/org/apache/cocoon/util/EnumerationFactory.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/util/EnumerationFactory.java?view=diff&r1=156967&r2=156968
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/util/EnumerationFactory.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/util/EnumerationFactory.java Thu Mar 10 09:33:17 2005
@@ -1,5 +1,5 @@
/*
-* Copyright 1999-2004 The Apache Software Foundation
+* Copyright 1999-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -92,6 +92,8 @@
package org.apache.cocoon.util;
+import java.util.Vector;
+
/**
* A factory for the creation of enumeration types (missing in Java).
* The same operations are provided as for Ada, only representation
@@ -102,101 +104,109 @@
* the derived class.
*
* @author Christoph Grein
- * @version CVS $Id: EnumerationFactory.java,v 1.4 2004/03/06 02:26:13 antonio Exp $
+ * @version CVS $Id$
*/
public class EnumerationFactory {
- private static java.util.Vector allObjects = // must be here JDK 1.1.3
- new java.util.Vector (0, 1); // empty, increment by 1
+ private static Vector allObjects = // must be here JDK 1.1.3
+ new Vector (0, 1); // empty, increment by 1
+
+ private int pos;
+ private String image;
+
+ /**
+ * Constructors with and without a string representation (image).
+ * Make constructors private upon derivation.
+ * Be careful: No check is made that the image string is unique!
+ * @param image
+ */
+ public EnumerationFactory(String image) {
+ this.pos = allObjects.size();
+ this.image = image;
+ allObjects.addElement(this);
+ }
+
+ public EnumerationFactory() {
+ this ("");
+ }
+
+ //--------------------------------------------------------------------------
+ // Order relations:
+
+ /**
+ * Order relations Object.op (OtherObject) representing the relation
+ * Object op OtherObject.
+ * @param e the right operand
+ */
+ public boolean lt(EnumerationFactory e) { // "<"
+ return this.getPos() < e.getPos();
+ }
+
+ public boolean le(EnumerationFactory e) { // "<="
+ return this.getPos() <= e.getPos();
+ }
+
+ public boolean gt(EnumerationFactory e) { // ">"
+ return this.getPos() > e.getPos();
+ }
+
+ public boolean ge(EnumerationFactory e) { // ">="
+ return this.getPos() >= e.getPos ();
+ }
+
+ // "==" and "equals" are inherited.
- private int pos;
- private String image;
+ //--------------------------------------------------------------------------
+ // Numeric representation:
+
+ public int getPos() { // Ada'Pos
+ return pos;
+ }
+
+ /**
+ * Access to the numeric representation.
+ * @param value the numeric value
+ */
+ public static EnumerationFactory getVal(int value) { // Ada'Val
+ return (EnumerationFactory)allObjects.elementAt(value);
+ }
+
+ //--------------------------------------------------------------------------
+ // Iterator:
+
+ public static EnumerationFactory getFirst() { // Ada'First
+ return getVal(0);
+ }
+
+ public static EnumerationFactory getLast() { // Ada'Last
+ return getVal(allObjects.size() - 1);
+ }
+
+ public EnumerationFactory getNext () { // Ada'Succ
+ return getVal(this.getPos() + 1);
+ }
+
+ public EnumerationFactory getPrev () { // Ada'Pred
+ return getVal(this.getPos() - 1);
+ }
+
+ //--------------------------------------------------------------------------
+ // String representation:
+
+ public String toString() { // Ada'Image
+ return image;
+ }
- /**
- * Constructors with and without a string representation (image).
- * Make constructors private upon derivation.
- * Be careful: No check is made that the image string is unique!
- * @param image
- */
- public EnumerationFactory (String image) {
- this.pos = allObjects.size ();
- this.image = image;
- allObjects.addElement (this);
- }
- public EnumerationFactory () {
- this ("");
- }
-
- //--------------------------------------------------------------------------
- // Order relations:
-
- /**
- * Order relations Object.op (OtherObject) representing the relation
- * Object op OtherObject.
- * @param enum the right operand
- */
- public boolean lt (EnumerationFactory enum) { // "<"
- return this.getPos() < enum.getPos ();
- }
- public boolean le (EnumerationFactory enum) { // "<="
- return this.getPos() <= enum.getPos ();
- }
- public boolean gt (EnumerationFactory enum) { // ">"
- return this.getPos() > enum.getPos ();
- }
- public boolean ge (EnumerationFactory enum) { // ">="
- return this.getPos() >= enum.getPos ();
- }
-
- // "==" and "equals" are inherited.
-
- //--------------------------------------------------------------------------
- // Numeric representation:
-
- public int getPos () { // Ada'Pos
- return pos;
- }
- /**
- * Access to the numeric representation.
- * @param value the numeric value
- */
- public static EnumerationFactory getVal (int value) { // Ada'Val
- return (EnumerationFactory) allObjects.elementAt (value);
- }
-
- //--------------------------------------------------------------------------
- // Iterator:
-
- public static EnumerationFactory getFirst () { // Ada'First
- return getVal (0);
- }
- public static EnumerationFactory getLast () { // Ada'Last
- return getVal (allObjects.size () - 1);
- }
-
- public EnumerationFactory getNext () { // Ada'Succ
- return getVal (this.getPos () + 1);
- }
- public EnumerationFactory getPrev () { // Ada'Pred
- return getVal (this.getPos () - 1);
- }
-
- //--------------------------------------------------------------------------
- // String representation:
-
- public String toString () { // Ada'Image
- return image;
- }
- public static EnumerationFactory getObject (String image) { // Ada'Value
- EnumerationFactory found;
- // Linear search seems good enough because there presumably
- // will not be too many literals.
- for (int i = 0 ; i < allObjects.size () ; i++) {
- found = (EnumerationFactory) allObjects.elementAt (i);
- if (found.toString () == image) {
- return found;
- }
+ public static EnumerationFactory getObject(String image) { // Ada'Value
+ EnumerationFactory found;
+ // Linear search seems good enough because there presumably
+ // will not be too many literals.
+ for (int i = 0 ; i < allObjects.size() ; i++) {
+ found = (EnumerationFactory) allObjects.elementAt(i);
+ if (found.toString().equals(image)) {
+ return found;
+ }
+ }
+ return null;
}
- return null;
- }
}