Changeset 1200 for trunk/src/org/expeditee/io
- Timestamp:
- 11/28/18 16:16:29 (6 years ago)
- Location:
- trunk/src/org/expeditee/io
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/io/DefaultFrameReader.java
r1102 r1200 96 96 pColor)); 97 97 98 // Note: As of 26/11/18 there are no unused letter item tags. Use other characters. 98 99 _ItemTags.put('S', Item.class.getMethod("setID", pInt)); 99 100 _ItemTags.put('s', Item.class.getMethod("setDateCreated", pString)); … … 150 151 _ItemTags.put('m', Text.class.getMethod("setInitialSpacing", pFloat)); 151 152 _ItemTags.put('w', Text.class.getMethod("setWidth", pIntO)); 153 _ItemTags.put('M', Text.class.getMethod("setMinWidth", pIntO)); 152 154 _ItemTags.put('k', Text.class.getMethod("setJustification", pJustification)); 153 155 _ItemTags.put('r', Text.class.getMethod("setAutoWrap", pBool)); … … 161 163 162 164 _ItemTags.put('p', Item.class.getMethod("setPermission", pPermission)); 165 166 _ItemTags.put('O', Text.class.getMethod("setMask", pIntO)); 163 167 164 168 // Lines and constraints are created differently -
trunk/src/org/expeditee/io/DefaultFrameWriter.java
r1102 r1200 33 33 import org.expeditee.agents.WriteTree; 34 34 import org.expeditee.gio.EcosystemManager; 35 import org.expeditee.gui.Browser;36 35 import org.expeditee.gui.Frame; 37 36 import org.expeditee.gui.FrameIO; … … 80 79 _FrameTags.put('B', Frame.class.getMethod("getBackgroundColor")); 81 80 81 // Note: As of 26/11/18 there are no unused letter item tags. Use other characters. 82 82 _ItemTags.put('S', Item.class.getMethod("getTypeAndID")); 83 83 _ItemTags.put('s', Item.class.getMethod("getDateCreated")); … … 120 120 _ItemTags.put('f', Text.class.getMethod("getFont")); 121 121 _ItemTags.put('t', Text.class.getMethod("getSpacing")); 122 123 _ItemTags.put('O', Text.class.getMethod("getMask")); 122 124 123 125 // TODO set a boolean flag to indicate that the text is a formula … … 129 131 _ItemTags.put('m', Text.class.getMethod("getInitialSpacing")); 130 132 _ItemTags.put('w', Text.class.getMethod("getWidthToSave")); 133 _ItemTags.put('M', Text.class.getMethod("getMinWidthToSave")); 131 134 _ItemTags.put('k', Text.class.getMethod("getJustification")); 132 135 _ItemTags.put('r', Text.class.getMethod("getAutoWrapToSave")); -
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 } -
trunk/src/org/expeditee/io/ExpWriter.java
r919 r1200 47 47 public class ExpWriter extends DefaultFrameWriter { 48 48 49 pr ivateProxyWriter _writer = null;49 protected ProxyWriter _writer = null; 50 50 51 51 protected StringBuilder _stringWriter = null; … … 104 104 if (_writer == null) 105 105 return; 106 107 preOutputFrame(); 106 108 107 109 writeHeader(frame); … … 109 111 // write each item in the frame 110 112 for (Item i : frame.getItemsToSave()) { 113 assert (!(i instanceof Line)); 114 writeItem(i); 115 } 116 117 for (final Item i: frame.getBodyItemsWithInsufficientPermissions()) { 111 118 assert (!(i instanceof Line)); 112 119 writeItem(i); … … 122 129 123 130 return; 131 } 132 133 protected void preOutputFrame() { 124 134 } 125 135
Note:
See TracChangeset
for help on using the changeset viewer.