Changeset 906 for trunk/src/org/expeditee/io
- Timestamp:
- 04/15/14 12:56:30 (10 years ago)
- Location:
- trunk/src/org/expeditee/io
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/io/DefaultFrameReader.java
r737 r906 12 12 import java.util.LinkedHashMap; 13 13 import java.util.List; 14 import java.util.LinkedList; 14 15 15 16 import org.expeditee.gui.Frame; … … 24 25 public abstract class DefaultFrameReader implements FrameReader { 25 26 protected static LinkedHashMap<Character, Method> _ItemTags = null; 27 28 protected static List<Character> _DelayedItemTags = null; 26 29 27 30 protected static LinkedHashMap<Character, Method> _FrameTags = null; … … 49 52 _ItemTags = new LinkedHashMap<Character, Method>(); 50 53 _FrameTags = new LinkedHashMap<Character, Method>(); 54 _DelayedItemTags = new LinkedList<Character>(); 51 55 52 56 try { … … 139 143 _ItemTags.put('L', Line.class.getMethod("setStartItem", pItem)); 140 144 _ItemTags.put('C', Constraint.class.getMethod("getID", (Class[]) null)); 145 146 _ItemTags.put('[', Item.class.getMethod("setMagnetizedItemLeft", pInt)); 147 _DelayedItemTags.add('['); 148 _ItemTags.put(']', Item.class.getMethod("setMagnetizedItemRight", pInt)); 149 _DelayedItemTags.add(']'); 150 _ItemTags.put('^', Item.class.getMethod("setMagnetizedItemTop", pInt)); 151 _DelayedItemTags.add('^'); 152 _ItemTags.put('_', Item.class.getMethod("setMagnetizedItemBottom", pInt)); 153 _DelayedItemTags.add('_'); 141 154 } catch (Exception e) { 142 155 e.printStackTrace(); -
trunk/src/org/expeditee/io/DefaultFrameWriter.java
r874 r906 123 123 _ItemTags.put('p', Item.class.getMethod("getPermission")); 124 124 125 _ItemTags.put('[', Item.class.getMethod("getMagnetizedItemLeft")); 126 _ItemTags.put(']', Item.class.getMethod("getMagnetizedItemRight")); 127 _ItemTags.put('^', Item.class.getMethod("getMagnetizedItemTop")); 128 _ItemTags.put('_', Item.class.getMethod("getMagnetizedItemBottom")); 125 129 } catch (Exception e) { 126 130 e.printStackTrace(); -
trunk/src/org/expeditee/io/ExpReader.java
r659 r906 6 6 import java.lang.reflect.Method; 7 7 import java.util.HashMap; 8 import java.util.LinkedList; 9 import java.util.List; 8 10 9 11 import org.expeditee.gui.Frame; … … 48 50 protected static boolean isValidLine(String s) { 49 51 return s.length() >= 2 && s.charAt(1) == ' ' 50 && Character.isLetter(s.charAt(0));52 && (Character.isLetter(s.charAt(0)) || s.charAt(0) == '[' || s.charAt(0) == ']' || s.charAt(0) == '^' || s.charAt(0) == '_'); 51 53 } 52 54 … … 69 71 newFrame.setName(_frameName); 70 72 73 final List<DelayedAction> delayedActions = new LinkedList<DelayedAction>(); 74 71 75 // First read all the header lines 72 76 while (_reader.ready() && !(next = _reader.readLine()).equals("Z")) { … … 95 99 _linePoints.put(currentItem.getID(), currentItem); 96 100 newFrame.addItem(currentItem); 101 } else if (currentItem != null && actionShouldBeDelayed(getTag(next))) { 102 delayedActions.add(new DelayedAction(currentItem, next)); 97 103 } else if (currentItem != null) { 98 104 processBodyLine(currentItem, next); 105 } else { 106 System.err.println("Error while reading in frame (ExpReader): Found body line but no current item to apply it to."); 99 107 } 100 108 } … … 140 148 } 141 149 } 150 151 for(DelayedAction action: delayedActions) 152 action.exec(); 142 153 143 154 // Read the stats … … 173 184 } 174 185 186 private class DelayedAction { 187 private Item theItem; 188 private String theLine; 189 190 DelayedAction(final Item theItem, final String theLine) { 191 this.theItem = theItem; 192 this.theLine = theLine; 193 } 194 195 void exec() { 196 processBodyLine(theItem, theLine); 197 } 198 } 199 175 200 // Stores points used when constructing lines 176 201 private HashMap<Integer, Item> _linePoints = new HashMap<Integer, Item>(); … … 213 238 else 214 239 return ""; 240 } 241 242 protected static boolean actionShouldBeDelayed(Character c) { 243 return _DelayedItemTags.contains(c); 215 244 } 216 245 -
trunk/src/org/expeditee/io/flowlayout/XGroupItem.java
r904 r906 213 213 } 214 214 215 public int getItemSpanLength() { 216 return yitems_span_array.length; 217 } 218 215 219 public YOverlappingItemsSpan getYOverlappingItemsSpan(int y) 216 220 {
Note:
See TracChangeset
for help on using the changeset viewer.