Changeset 1200 for trunk/src/org/expeditee/io/ExpReader.java
- Timestamp:
- 11/28/18 16:16:29 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/io/ExpReader.java
r1189 r1200 68 68 */ 69 69 protected static boolean isValidLine(String s) { 70 return s.length() >= 2 && s.charAt(1) == ' ' 71 && (Character.isLetter(s.charAt(0)) || s.charAt(0) == '[' || s.charAt(0) == ']' || s.charAt(0) == '^' || s.charAt(0) == '_'); 70 // Previously lines in a .exp file had to start with a letter (A-Z, a-z). This allowed for an efficient check for valid lines. 71 // As we started to run out of spare letters to use for properties, we wished to use the full range of characters. But we did not 72 // wish to loose the efficiency of the Character.isLetter check. In order to maintain as much of this efficiency as possible, but 73 // allow for all characters, we take advantage of how || is evaluated: 74 // if the check for Character.isLetter passes, then the more complex map lookup operation does not take place. 75 return s.length() >= 2 && (Character.isLetter(s.charAt(0)) || _ItemTags.keySet().contains(s.charAt(0))); 72 76 } 73 77 … … 117 121 break; 118 122 } 119 _linePoints.put(currentItem.getID(), currentItem); 123 _linePoints.put(currentItem.getID(), currentItem); 120 124 newFrame.addItem(currentItem); 121 125 } else if (currentItem != null && actionShouldBeDelayed(getTag(next))) { … … 123 127 } else if (currentItem != null) { 124 128 processBodyLine(currentItem, next); 129 // final boolean hasSpecifiedPermission = currentItem.getPermission() != null; 130 // final boolean hasSpecifiedOwner = currentItem.getOwner() != null; 131 // if (hasSpecifiedPermission && hasSpecifiedOwner && currentItem.getPermission().getPermission(currentItem.getOwner()) == UserAppliedPermission.denied) { 132 // newFrame.removeItem(currentItem); 133 // newFrame.addItemHidden(currentItem); 134 // continue; 135 // } 125 136 } else { 126 137 System.err.println("Error while reading in frame (ExpReader): Found body line but no current item to apply it to."); … … 236 247 Character tag = getTag(line); 237 248 String value = getValue(line); 238 249 239 250 Method toRun = _ItemTags.get(tag); 251 240 252 if (toRun == null) { 241 253 System.out.println("Error accessing tag method: " + tag); 242 254 } 255 243 256 Object[] vals = Conversion.Convert(toRun, value); 244 245 257 try { 246 258 if (vals != null) { … … 322 334 String value = getValue(next); 323 335 if (tag.equals('V')) { 336 reader.close(); 324 337 return Integer.parseInt(value); 325 338 } 326 339 } 327 340 } 341 reader.close(); 328 342 } catch (Exception e) { 329 343 }
Note:
See TracChangeset
for help on using the changeset viewer.