/*
- * put your module comment here
+ * The former (German) documentation of this classe
+ * stated that this class is an abstract one. There is,
+ * however, not a single abstract method in this class.
*/
/**
*
- * abstrakte Containerklasse für Listen von Entities.
+ * Container class for lists of Entities.
*
* @author <RK>
* @version 27.6.1999
}
/**
- * Konstruktor für leere Liste von Entities
+ * Constructor. Creates an empty EntityList
*/
public EntityList(){
this.theEntityArrayList = new ArrayList();
}
+
/**
- * Setzt die WhereClause, mit der die Entitis dieser Liste geholt wurden.
- * @param wc
+ * Sets the WHERE clause that fetched the Entities of this EntityList from the database.
+ * @param wc The string that contains the WHERE clause
*/
public void setWhere(String wc) {
this.whereClause = wc;
}
/**
- * Liefert die WhereClause zurueck, mit der die Entities geholt wurden.
- * @return whereClause
+ * Returns the WHERE clause that returned this EntityList from the database
+ * @return whereClause The WHERE clause
*/
public String getWhere() {
return whereClause;
}
+
/**
- * Setzt das Sortierkriterium fest, mit der die Entities in die Liste
- * gestellt wurden.
- *
+ * Sets the sorting criterium of this EntityList
* @param oc
*/
public void setOrder(String oc) {
}
/**
- * Liefert das Sortierkriterium der Liste zurueck.
- * @return orderClause
+ * Returns the sorting criterium.
+ * @return orderClause The sort order
*/
public String getOrder() {
return orderClause;
}
/**
- * Setzt die Anzahl der Datensätze fest, die WhereClause erfüllen.
- * @param i
+ * Sets the number of rows that match the WHERE clause
+ * @param i The number of rows that match the WHERE clause
*/
public void setCount(int i) {
this.count = i;
}
/**
- * Liefert Anzahle der Datensätze, die WhereClause erfüllen.
- * @return
+ * Returns the number of rows that match the WHERE clause
+ * @return The number of rows ...
*/
public int getCount() {
return count;
}
/**
- * Setzt den Offset fest.
- * @param i
+ * Sets the offset
+ * @param i The offset
*/
public void setOffset(int i) {
offset = i;
}
/**
- * Liefert den Offset zurueck
+ * Returns the offset
* @return offset
*/
public int getOffset() {
}
/**
- * Setzt den offset für das naechste Batch von Entities fest.
- * @param i
+ * Sets the offset of the next batch of Entities.
+ * @param i The next offset
*/
public void setNextBatch(int i) {
offsetnext = i;
}
/**
- * Liefert den offset für das naechste Batch von Entities
- * @return offset für naechstes Batch
+ * Returns the offset of the next batch of Entities.
+ * @return offset of the next batch
*/
public int getNextBatch() {
return offsetnext;
}
/**
- * Fragt ab, ob es noch nachfolgendes Batch innerhalb der WhereClause gibt
- * @return
+ * Returns whether there is a next batch within the WHERE clause
+ * @return true if yes, false if no.
*/
public boolean hasNextBatch() {
return (offsetnext >= 0);
}
/**
- * Setzt offset des vorhergehenden Batches fest.
- * @param i
+ * Sets the offset of the previous batch.
+ * @param i the previous offset
*/
public void setPrevBatch(int i) {
offsetprev = i;
}
/**
- * Liefert offset des vorhergehenden Batches zurueck.
- * @return offset des vorhergehenden Batches.
+ * Returns the offset of the previous batch.
+ * @return offset of the previous batch
*/
public int getPrevBatch() {
return offsetprev;
}
/**
- * Fragt ab, ob es ein vorhergehendes Batch gibt
- * @return true wenn ja, sont false
+ * Returns whether there is a previous batch.
+ * @return true if yes, false if no
*/
public boolean hasPrevBatch() {
return (offsetprev >= 0);
}
/**
- * Liefert den Startindex des Batches zurueck.
+ * Returns the start index of the batch.
* @return
*/
public int getFrom() {
}
/**
- * Liefert den Endindex des Batches zurueck.
+ * Returns the end index of the batch.
* @return
*/
public int getTo() {
- if (hasNextBatch())
- return offsetnext;
- else
- return count;
+ if (hasNextBatch())
+ return offsetnext;
+ else
+ return count;
}
- /**
- * Fügt eine Entity in die Liste ein
- * @param anEntity
- */
+ /**
+ * Inserts an Entity into the EntityList.
+ * @param anEntity The entity to be inserted.
+ */
+
public void add (Entity anEntity) {
if (anEntity!=null)
theEntityArrayList.add(anEntity);
else
- theLog.printWarning("EntityList: add called with empty Entity");
+ theLog.printWarning("EntityList: add called with empty Entity");
}
- /**
- * @return Anzahl der Entities in der Liste
- */
+
+ /**
+ * @return The number of Entities in the EntityList.
+ */
+
public int size() {
return theEntityArrayList.size();
}
+ /**
+ * Returns the element at position i in the EntityList as Entity
+ * @param i the position of the element in question
+ * @return The element at position i.
+ */
+
public Entity elementAt(int i) {
/** @todo check if i is in list.size() */
return (Entity)theEntityArrayList.get(i);
}
- // Freemarker TemplateListModel methods
+ // The following methods have to be implemented
+ // for this class to be an implementation of the
+ // TemplateListModel of the Freemarker packages
public TemplateModel get(int i) { return elementAt(i); }
public boolean isRewound() { return (freemarkerListPointer==-1) ? true : false; }
else return null;
}
+
+ /**
+ * Returns whether there is a next element
+ * @return true if there is a next element, else false
+ */
+
public boolean hasNext() {
return theEntityArrayList.size()>0 && freemarkerListPointer+2<=theEntityArrayList.size();
}
+
+ /**
+ * Returns whether EntityList is empty or not
+ * @return true in case of empty list, false otherwise
+ */
+
public boolean isEmpty() {
if (theEntityArrayList!=null)
return theEntityArrayList.size()<1 ;