From 3b9eb37b9becbcb00a23790fc0074c956c7a992f Mon Sep 17 00:00:00 2001 From: mj Date: Fri, 1 Mar 2002 20:12:47 +0000 Subject: [PATCH] Added some comments, but mostly translated them to English. --- source/mir/entity/EntityList.java | 117 +++++++++++++++++++++------------- source/mir/entity/EntityRelation.java | 2 +- source/mir/entity/GenericEntity.java | 7 +- 3 files changed, 76 insertions(+), 50 deletions(-) diff --git a/source/mir/entity/EntityList.java b/source/mir/entity/EntityList.java index 4b5a4d95..bf41e8ff 100755 --- a/source/mir/entity/EntityList.java +++ b/source/mir/entity/EntityList.java @@ -1,5 +1,7 @@ /* - * 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. */ @@ -15,7 +17,7 @@ import mir.misc.*; /** * - * abstrakte Containerklasse für Listen von Entities. + * Container class for lists of Entities. * * @author * @version 27.6.1999 @@ -38,32 +40,32 @@ public class EntityList implements TemplateListModel { } /** - * 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) { @@ -71,39 +73,39 @@ public class EntityList implements TemplateListModel { } /** - * 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() { @@ -111,55 +113,55 @@ public class EntityList implements TemplateListModel { } /** - * 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() { @@ -167,42 +169,53 @@ public class EntityList implements TemplateListModel { } /** - * 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; } @@ -214,10 +227,22 @@ public class EntityList implements TemplateListModel { 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 ; diff --git a/source/mir/entity/EntityRelation.java b/source/mir/entity/EntityRelation.java index 272a7de8..586d0f40 100755 --- a/source/mir/entity/EntityRelation.java +++ b/source/mir/entity/EntityRelation.java @@ -84,7 +84,7 @@ public class EntityRelation { } /** - * @return Liefert den Referenznamen der abhaengigen Tabelle + * @return The reference name of the related table. */ public String getName() { diff --git a/source/mir/entity/GenericEntity.java b/source/mir/entity/GenericEntity.java index 8a766992..d183407d 100755 --- a/source/mir/entity/GenericEntity.java +++ b/source/mir/entity/GenericEntity.java @@ -4,9 +4,10 @@ package mir.entity; /** - * Standard-Entity-Container. Wenn keine Zusatzfunktionalitaeten für die Kapselung einer - * Datenbankzeile nötig sind, d.h. zu einem Database-Objekt keine eigene Entity-Klasse - * implementiert wird, so wird dieser Standard-Container verwendet. + * Standard Entity container. + * If no additional functionality is neccessary for the encapsulation + * of a database row, i.e. no separate Entity class is implemented + * for a database object, this standard container is used. * * @author /rk * @version 1.2 -- 2.11.0