package bluej.groupwork;

import bluej.groupwork.TeamStatusInfo.Status;


| Class to filter TeamStatusInfo objects to calculate those classes that will | be changed when we next update. | | @author Davin McCall | public class UpdateFilter {
| Filter to identify which files in a repository will be altered at | the next update. | public boolean accept(TeamStatusInfo statusInfo) { boolean isDir = statusInfo.getFile().isDirectory(); Status stat = statusInfo.getStatus(); Status remoteStat = statusInfo.getRemoteStatus(); if (stat == Status.NEEDS_CHECKOUT || remoteStat == Status.NEEDS_CHECKOUT) { return true; } if (stat == Status.NEEDS_MERGE || remoteStat == Status.NEEDS_MERGE) { return ! isDir; } if (stat == Status.NEEDS_UPDATE || remoteStat == Status.NEEDS_UPDATE) { return ! isDir; } if (stat == Status.REMOVED || remoteStat == Status.REMOVED) { return true; } if (stat == Status.CONFLICT_LDRM || remoteStat == Status.CONFLICT_LDRM) { return true; } if (stat == Status.CONFLICT_LMRD || remoteStat == Status.CONFLICT_LMRD) { return true; } if (remoteStat == Status.NEEDS_UPDATE) { return true; } return false; }
| For the given remote status, check whether an update will affect the file. | public boolean acceptDist(Status remoteStatus) { switch (remoteStatus) { case CONFLICT_ADD: case CONFLICT_LDRM: case CONFLICT_LMRD: case NEEDS_CHECKOUT: case NEEDS_UPDATE: case NEEDS_MERGE: case REMOVED: return true; default: return false; } }
| For layout files, checks whether the file should be updated unconditionally. | public boolean updateAlways(TeamStatusInfo statusInfo) { Status remoteStatus = statusInfo.getRemoteStatus(); if (statusInfo.getStatus() == Status.NEEDS_CHECKOUT || remoteStatus == Status.NEEDS_CHECKOUT) { return true; } if (statusInfo.getStatus() == Status.REMOVED || remoteStatus == Status.REMOVED) { return true; } if (statusInfo.getStatus() == Status.CONFLICT_LMRD || remoteStatus == Status.CONFLICT_LMRD) { return true; } return false; } }
top, use, map, class UpdateFilter

.   accept
.   acceptDist
.   updateAlways




103 neLoCode + 7 LoComm