Changeset 366 for trunk/src_apollo/org/apollo/io/MixIO.java
- Timestamp:
- 10/11/08 15:15:17 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src_apollo/org/apollo/io/MixIO.java
r315 r366 130 130 * The mixes to write to file 131 131 * 132 * @param usingLocalFlags 133 * Parallel list with banks. The isUsingLocal flag... 134 */ 135 public static void saveBanks(String mixBatchPath, List<TrackMixSubject> banks, List<Boolean> usingLocalFlags) { 132 */ 133 public static void saveBanks(String mixBatchPath, List<TrackMixSubject> banks) { 136 134 137 135 assert(mixBatchPath != null); 138 136 assert(banks != null); 139 assert(usingLocalFlags != null);140 assert(usingLocalFlags.size() == banks.size());141 137 142 138 File mixFile = new File(mixBatchPath); … … 161 157 TrackMixSubject mix = banks.get(i); 162 158 assert(mix != null); 163 164 Boolean flag = usingLocalFlags.get(i);165 assert(flag != null);166 167 159 out.write(mix.toParseableString() + "\n"); 168 out.write(flag.booleanValue() ? "1\n" : "0\n");169 160 } 170 161 … … 193 184 * A list to load the banks into. Must not be null - must be empty. 194 185 * 195 * @param usingLocalFlags196 * A list to load the channel flags into... Must not be null - must be empty.197 *198 186 * @return 199 187 * True of success. False if IO operatoin failed / file does not exist. … … 201 189 public static boolean loadBanks( 202 190 List<TrackMixSubject> banks, 203 List<Boolean> usingLocalFlags,204 191 String banksFilepath) { 205 192 206 193 assert(banks != null); 207 assert(usingLocalFlags != null);208 194 assert(banksFilepath != null); 209 195 assert(banks.isEmpty()); 210 assert(usingLocalFlags.isEmpty());211 196 212 197 File mixFile = new File(banksFilepath); … … 230 215 String line = null; 231 216 // Read the sbase file... 232 boolean waitingOnFlag = false;233 217 while ((line = in.readLine()) != null) { 234 218 … … 237 221 238 222 TrackMixSubject mix = TrackMixSubject.fromString(line); 239 240 if (mix != null) { 241 242 if (waitingOnFlag) { // missing flag for last mix line 243 usingLocalFlags.add(new Boolean(false)); // default to false 244 } 245 223 224 if (mix != null) 246 225 banks.add(mix); 247 waitingOnFlag = true; 248 249 } else if (waitingOnFlag) { // waiting on flag? 250 251 if (line.equals("1")) { 252 usingLocalFlags.add(new Boolean(true)); 253 waitingOnFlag = false; 254 } else if (line.equals("0")) { 255 usingLocalFlags.add(new Boolean(false)); 256 waitingOnFlag = false; 257 } 258 } 259 260 261 } 262 263 if (usingLocalFlags.size() == (banks.size() - 1)) { // missing last flag 264 usingLocalFlags.add(new Boolean(false)); 265 } 266 267 assert(usingLocalFlags.size() == banks.size()); 268 226 227 } 228 269 229 } catch (Exception e) { 270 230 e.printStackTrace();
Note:
See TracChangeset
for help on using the changeset viewer.