< prev index next >

src/com/sun/interview/ListQuestion.java

Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg


 108             if (newIndex != index) {
 109                 index = newIndex;
 110                 setBaseTag(question.getBaseTag() + "." + index);
 111             }
 112         }
 113 
 114         /**
 115          * Get a default summary to be used to identify this instance of the
 116          * the loop body, to be used when getSummary() returns null.
 117          * The summary will be a standard prefix string possibly followed
 118          * by a number to distinguish between multiple bodies using the
 119          * default summary. The default summary will be unique and persist
 120          * for the life of this body or until getSummary() returns a non-null
 121          * value.
 122          * @return a default summary to be used to identify this instance of the
 123          * the loop body, to be used when getSummary() returns null.
 124          */
 125         public String getDefaultSummary() {
 126             if (defaultSummary == null) {
 127                 // recycle any default summaries that are no longer required
 128                 Vector bodies = question.bodies;
 129                 for (int i = 0; i < bodies.size(); i++) {
 130                     Body b = (Body) (bodies.elementAt(i));
 131                     if (b.defaultSummary != null
 132                         && b.getSummary() != null
 133                         && !b.defaultSummary.equals(b.getSummary())) {
 134                         b.defaultSummary = null;
 135                     }
 136                 }
 137 
 138                 // try and find an unused unique value v not used by any other default summary
 139                 for (int v = 0; v < bodies.size(); v++) {
 140                     String s = MessageFormat.format(i18n.getString("lp.newValue"),
 141                                                     new Object[] { new Integer(v) });
 142                     // check s is not the same as any current default summary;
 143                     // if it is, reset it to null
 144                     for (int i = 0; i < bodies.size(); i++) {
 145                         Body b = (Body) (bodies.elementAt(i));
 146                         if (s.equals(b.defaultSummary)) {
 147                             s = null;
 148                             break;
 149                         }
 150                     }
 151                     // if s is not null, it is unique, different from other default
 152                     // summaries, so use it...
 153                     if (s != null) {
 154                         defaultSummary = s;
 155                         break;
 156                     }
 157                 }
 158             }
 159 
 160             return defaultSummary;
 161         }
 162 
 163         /**
 164          * Check if this body has been completed. It is considered to have
 165          * been completed if none of the questions in this body




 108             if (newIndex != index) {
 109                 index = newIndex;
 110                 setBaseTag(question.getBaseTag() + "." + index);
 111             }
 112         }
 113 
 114         /**
 115          * Get a default summary to be used to identify this instance of the
 116          * the loop body, to be used when getSummary() returns null.
 117          * The summary will be a standard prefix string possibly followed
 118          * by a number to distinguish between multiple bodies using the
 119          * default summary. The default summary will be unique and persist
 120          * for the life of this body or until getSummary() returns a non-null
 121          * value.
 122          * @return a default summary to be used to identify this instance of the
 123          * the loop body, to be used when getSummary() returns null.
 124          */
 125         public String getDefaultSummary() {
 126             if (defaultSummary == null) {
 127                 // recycle any default summaries that are no longer required
 128                 Vector<Body> bodies = question.bodies;
 129                 for (int i = 0; i < bodies.size(); i++) {
 130                     Body b = (bodies.elementAt(i));
 131                     if (b.defaultSummary != null
 132                         && b.getSummary() != null
 133                         && !b.defaultSummary.equals(b.getSummary())) {
 134                         b.defaultSummary = null;
 135                     }
 136                 }
 137 
 138                 // try and find an unused unique value v not used by any other default summary
 139                 for (int v = 0; v < bodies.size(); v++) {
 140                     String s = MessageFormat.format(i18n.getString("lp.newValue"),
 141                                                     new Object[] { new Integer(v) });
 142                     // check s is not the same as any current default summary;
 143                     // if it is, reset it to null
 144                     for (int i = 0; i < bodies.size(); i++) {
 145                         Body b = (bodies.elementAt(i));
 146                         if (s.equals(b.defaultSummary)) {
 147                             s = null;
 148                             break;
 149                         }
 150                     }
 151                     // if s is not null, it is unique, different from other default
 152                     // summaries, so use it...
 153                     if (s != null) {
 154                         defaultSummary = s;
 155                         break;
 156                     }
 157                 }
 158             }
 159 
 160             return defaultSummary;
 161         }
 162 
 163         /**
 164          * Check if this body has been completed. It is considered to have
 165          * been completed if none of the questions in this body


< prev index next >