Example usage for org.apache.commons.collections CollectionUtils filter

List of usage examples for org.apache.commons.collections CollectionUtils filter

Introduction

In this page you can find the example usage for org.apache.commons.collections CollectionUtils filter.

Prototype

public static void filter(Collection collection, Predicate predicate) 

Source Link

Document

Filter the collection by applying a Predicate to each element.

Usage

From source file:org.jajuk.base.FileManager.java

/**
 * Refresh best of files.//from w w w .  java 2  s . c o m
 */
public void refreshBestOfFiles() {
    Log.debug("Invoking Refresh of BestOf-Files");
    // clear data
    alBestofFiles.clear();
    // create a temporary table to remove unmounted files
    int iNbBestofFiles = Integer.parseInt(Conf.getString(Const.CONF_BESTOF_TRACKS_SIZE));
    List<File> alEligibleFiles = new ArrayList<File>(iNbBestofFiles);
    List<Track> tracks = TrackManager.getInstance().getTracks();
    // filter banned tracks
    CollectionUtils.filter(tracks, new JajukPredicates.BannedTrackPredicate());
    for (Track track : tracks) {
        File file = track.getBestFile(Conf.getBoolean(Const.CONF_OPTIONS_HIDE_UNMOUNTED));
        if (file != null) {
            alEligibleFiles.add(file);
        }
    }
    Collections.sort(alEligibleFiles, rateComparator);
    // Keep as much items as we can
    int i = 0;
    while (i < alEligibleFiles.size() && i < iNbBestofFiles) {
        File file = alEligibleFiles.get(i);
        alBestofFiles.add(file);
        i++;
    }
}

From source file:org.jajuk.services.dj.TransitionDigitalDJ.java

/**
 * Returns a map ambience -> set of files.
 * /*from  w  w  w .  ja v  a 2s .  com*/
 * @param global initial set of files to consider
 * 
 * @return a map ambience -> set of files
 */
@SuppressWarnings("unchecked")
private Map<Ambience, List<File>> getAmbienceFilesList(List<File> global) {
    // Create a map ambience -> set of files
    Map<Ambience, List<File>> hmAmbienceFiles = new HashMap<Ambience, List<File>>(5);
    // For performance, we find unique ambiences in from and to transitions
    Set<Ambience> ambiences = new HashSet<Ambience>(5);
    for (Transition tr : transitions) {
        ambiences.add(tr.getFrom());
        ambiences.add(tr.getTo());
    }
    // Fill null key
    hmAmbienceFiles.put(null, (List<File>) ((ArrayList<File>) global).clone());
    // Fill all ambiences
    for (Ambience ambience : ambiences) {
        List<File> all = (List<File>) ((ArrayList<File>) global).clone();
        CollectionUtils.filter(all, new JajukPredicates.AmbiencePredicate(ambience));
        hmAmbienceFiles.put(ambience, all);
    }
    return hmAmbienceFiles;
}

From source file:org.jajuk.ui.actions.CDDBSelectionAction.java

@Override
public void perform(final ActionEvent e) throws Exception {
    try {//w w  w.j  a  v  a  2s  .co  m
        CDDBSelectionAction.super.perform(e);
        // Check selection is not void
        if (selection.size() == 0) {
            return;
        }
        // - We perform here fast computation, no need to use a SwingWorker here.
        // Actual network call to freedb is done in the CDDBWizard class that uses
        // a SwingWorker.
        // Build a list of tracks from various items
        List<Track> tracks = TrackManager.getInstance().getAssociatedTracks(selection, true);
        // Remove video tracks found (clips)
        CollectionUtils.filter(tracks, new JajukPredicates.NotVideoPredicate());
        // Display the wizard
        new CDDBWizard(tracks);
    } catch (Exception ex) {
        Log.error(ex);
    }
}

From source file:org.jajuk.ui.helpers.FilesTableModel.java

@Override
public void populateModel(String sPropertyName, String sPattern, List<String> columnsToShow) {
    // This should be monitor file manager to avoid NPE when changing items
    List<File> alToShow = FileManager.getInstance().getFiles();
    // Filter mounted files if needed and apply sync table with tree
    // option if needed
    final boolean syncTreeTable = Conf.getBoolean(Const.CONF_SYNC_TABLE_TREE + "." + viewID);
    oItems = new Item[iRowNum];
    CollectionUtils.filter(alToShow, new Predicate() {
        @Override//from w  w  w .j  a  va  2  s. c  o  m
        public boolean evaluate(Object o) {
            File file = (File) o;
            // show it if no sync option or if item is in the selection
            boolean bShowWithTree = !syncTreeTable
                    // tree selection = null means none selection have been
                    // done in tree so far
                    || treeSelection == null
            // check if the tree selection contains the current file
                    || (treeSelection.size() > 0 && treeSelection.contains(file));
            return (!file.shouldBeHidden() && bShowWithTree);
        }
    });
    // Filter files
    Filter filter = new Filter(sPropertyName, sPattern, true, Conf.getBoolean(Const.CONF_REGEXP));
    alToShow = Filter.filterItems(alToShow, filter, File.class);
    Iterator<File> it = alToShow.iterator();
    int iColNum = iNumberStandardCols + FileManager.getInstance().getCustomProperties().size()
            + TrackManager.getInstance().getCustomProperties().size();
    iRowNum = alToShow.size();
    it = alToShow.iterator();
    oValues = new Object[iRowNum][iColNum];
    oItems = new Item[iRowNum];
    bCellEditable = new boolean[iRowNum][iColNum];
    // For perfs, prepare columns visibility
    boolean bTrackName = (columnsToShow != null && columnsToShow.contains(Const.XML_TRACK));
    boolean bAlbum = (columnsToShow != null && columnsToShow.contains(Const.XML_ALBUM));
    boolean bArtist = (columnsToShow != null && columnsToShow.contains(Const.XML_ARTIST));
    boolean bAlbumArtist = (columnsToShow != null && columnsToShow.contains(Const.XML_ALBUM_ARTIST));
    boolean bGenre = (columnsToShow != null && columnsToShow.contains(Const.XML_GENRE));
    boolean bRate = (columnsToShow != null && columnsToShow.contains(Const.XML_TRACK_RATE));
    boolean bLength = (columnsToShow != null && columnsToShow.contains(Const.XML_TRACK_LENGTH));
    boolean bDevice = (columnsToShow != null && columnsToShow.contains(Const.XML_DEVICE));
    boolean bFileName = (columnsToShow != null && columnsToShow.contains(Const.XML_NAME));
    boolean bComment = (columnsToShow != null && columnsToShow.contains(Const.XML_TRACK_COMMENT));
    boolean bQuality = (columnsToShow != null && columnsToShow.contains(Const.XML_QUALITY));
    boolean bSize = (columnsToShow != null && columnsToShow.contains(Const.XML_SIZE));
    boolean bDiscovery = (columnsToShow != null && columnsToShow.contains(Const.XML_TRACK_DISCOVERY_DATE));
    boolean bOrder = (columnsToShow != null && columnsToShow.contains(Const.XML_TRACK_ORDER));
    boolean bDiscNumber = (columnsToShow != null && columnsToShow.contains(Const.XML_TRACK_DISC_NUMBER));
    boolean bYear = (columnsToShow != null && columnsToShow.contains(Const.XML_YEAR));
    boolean bDirectory = (columnsToShow != null && columnsToShow.contains(Const.XML_DIRECTORY));
    boolean bFileDate = (columnsToShow != null && columnsToShow.contains(Const.XML_FILE_DATE));
    boolean bHits = (columnsToShow != null && columnsToShow.contains(Const.XML_TRACK_HITS));
    for (int iRow = 0; it.hasNext(); iRow++) {
        File file = it.next();
        setItemAt(iRow, file);
        // Id
        oItems[iRow] = file;
        // Play
        IconLabel il = null;
        if (file.isReady()) {
            il = getIcon(false);
        } else {
            il = getIcon(true);
        }
        oValues[iRow][0] = il;
        bCellEditable[iRow][0] = false;
        // check track has an associated tag editor (not null)
        boolean bHasATagEditor = false;
        Type type = file.getType();
        if (type != null) {
            bHasATagEditor = (type.getTaggerClass() != null);
        }
        // Track name
        if (bTrackName) {
            oValues[iRow][1] = file.getTrack().getName();
        } else {
            oValues[iRow][1] = "";
        }
        bCellEditable[iRow][1] = bHasATagEditor;
        // Album
        if (bAlbum) {
            oValues[iRow][2] = file.getTrack().getAlbum().getName2();
        } else {
            oValues[iRow][2] = "";
        }
        bCellEditable[iRow][2] = bHasATagEditor;
        // Artist
        if (bArtist) {
            oValues[iRow][3] = file.getTrack().getArtist().getName2();
        } else {
            oValues[iRow][3] = "";
        }
        bCellEditable[iRow][3] = bHasATagEditor;
        // AlbumArtist
        if (bAlbumArtist) {
            oValues[iRow][4] = file.getTrack().getAlbumArtist().getName2();
        } else {
            oValues[iRow][4] = "";
        }
        bCellEditable[iRow][4] = bHasATagEditor;
        // Genre
        if (bGenre) {
            oValues[iRow][5] = file.getTrack().getGenre().getName2();
        } else {
            oValues[iRow][5] = "";
        }
        bCellEditable[iRow][5] = bHasATagEditor;
        // Rate
        if (bRate) {
            oValues[iRow][6] = StarsHelper.getStarIconLabel(file.getTrack());
        } else {
            oValues[iRow][6] = "";
        }
        bCellEditable[iRow][6] = false;
        // Length
        if (bLength) {
            oValues[iRow][7] = new Duration(file.getTrack().getDuration());
        } else {
            oValues[iRow][7] = "";
        }
        bCellEditable[iRow][7] = false;
        // Device
        if (bDevice) {
            oValues[iRow][8] = file.getDirectory().getDevice().getName();
        } else {
            oValues[iRow][8] = "";
        }
        bCellEditable[iRow][8] = false;
        // File name
        if (bFileName) {
            oValues[iRow][9] = file.getName();
        } else {
            oValues[iRow][9] = "";
        }
        bCellEditable[iRow][9] = true;
        // Comment
        if (bComment) {
            oValues[iRow][10] = file.getTrack().getValue(Const.XML_TRACK_COMMENT);
        } else {
            oValues[iRow][10] = "";
        }
        bCellEditable[iRow][10] = bHasATagEditor;
        // Quality
        if (bQuality) {
            long lQuality = file.getQuality();
            oValues[iRow][11] = lQuality;
        } else {
            oValues[iRow][11] = 0l;
        }
        bCellEditable[iRow][11] = false;
        // Size, we want to keep 2 decimals to the value in MB
        if (bSize) {
            oValues[iRow][12] = Math.round(file.getSize() / 10485.76) / 100f;
        } else {
            oValues[iRow][12] = 0l;
        }
        bCellEditable[iRow][12] = false;
        // Order
        if (bOrder) {
            oValues[iRow][13] = file.getTrack().getOrder();
        } else {
            oValues[iRow][13] = "";
        }
        bCellEditable[iRow][13] = bHasATagEditor;
        // Disc number
        if (bDiscNumber) {
            oValues[iRow][14] = file.getTrack().getDiscNumber();
        } else {
            oValues[iRow][14] = "";
        }
        bCellEditable[iRow][14] = bHasATagEditor;
        // year
        if (bYear) {
            oValues[iRow][15] = file.getTrack().getYear().getValue();
        } else {
            oValues[iRow][15] = "";
        }
        bCellEditable[iRow][15] = bHasATagEditor;
        // directory full path
        if (bDirectory) {
            oValues[iRow][16] = file.getDirectory().getAbsolutePath();
        } else {
            oValues[iRow][16] = "";
        }
        bCellEditable[iRow][16] = false;
        // file date
        if (bFileDate) {
            oValues[iRow][17] = file.getDateValue(Const.XML_FILE_DATE);
        } else {
            oValues[iRow][17] = "";
        }
        bCellEditable[iRow][17] = false;
        // Hits
        if (bHits) {
            oValues[iRow][18] = file.getTrack().getHits();
        } else {
            oValues[iRow][18] = "";
        }
        bCellEditable[iRow][18] = false;
        // Discovery date
        if (bDiscovery) {
            oValues[iRow][19] = file.getTrack().getDiscoveryDate();
        } else {
            oValues[iRow][19] = "";
        }
        bCellEditable[iRow][19] = false;
        // -- Custom properties now --
        Map<String, Object> properties = file.getProperties();
        // files custom tags
        Iterator<PropertyMetaInformation> it2 = FileManager.getInstance().getCustomProperties().iterator();
        for (int i = 0; it2.hasNext(); i++) {
            PropertyMetaInformation meta = it2.next();
            Object o = properties.get(meta.getName());
            if (o != null) {
                oValues[iRow][iNumberStandardCols + i] = o;
            } else {
                oValues[iRow][iNumberStandardCols + i] = meta.getDefaultValue();
            }
            // Date values not editable, use properties panel instead to
            // edit
            if (meta.getType().equals(Date.class)) {
                bCellEditable[iRow][iNumberStandardCols + i] = false;
            } else {
                bCellEditable[iRow][iNumberStandardCols + i] = true;
            }
        }
        // tracks custom properties
        properties = file.getTrack().getProperties();
        it2 = TrackManager.getInstance().getCustomProperties().iterator();
        for (int i = FileManager.getInstance().getCustomProperties().size(); it2.hasNext(); i++) {
            PropertyMetaInformation meta = it2.next();
            Object o = properties.get(meta.getName());
            if (o != null) {
                oValues[iRow][iNumberStandardCols + i] = properties.get(meta.getName());
            } else {
                oValues[iRow][iNumberStandardCols + i] = meta.getDefaultValue();
            }
            // Date values not editable, use properties panel instead to
            // edit
            if (meta.getType().equals(Date.class)) {
                bCellEditable[iRow][iNumberStandardCols + i] = false;
            } else {
                bCellEditable[iRow][iNumberStandardCols + i] = true;
            }
        }
    }
}

From source file:org.jajuk.ui.helpers.PlaylistRepositoryTableModel.java

/**
 * Fill model with data using an optional filter property and pattern
 * <p>//from www .  ja  v a  2 s  .c o m
 * For now, this table will not be editable (except for custom properties) for
 * complexity reasons. This may be implemented in the future if required
 * </p>
 *
 * @param sPropertyName 
 * @param sPattern 
 * @param columnsToShow 
 */
@Override
public void populateModel(final String sPropertyName, final String sPattern, final List<String> columnsToShow) {
    List<Playlist> alToShow = PlaylistManager.getInstance().getPlaylists();
    // OK, begin by filtering using any provided pattern
    // Regular filtering for natural properties registrated as a playlist intern property
    if (PlaylistManager.getInstance().getMetaInformation(sPropertyName) != null) {
        Filter filter = new Filter(sPropertyName, sPattern, true, Conf.getBoolean(Const.CONF_REGEXP));
        alToShow = Filter.filterItems(alToShow, filter, Playlist.class);
        // Filter against the device attribute
    } else if (Const.XML_DEVICE.equals(sPropertyName)) {
        alToShow = new ArrayList<Playlist>(Collections2.filter(alToShow, new Predicate<Playlist>() {
            @Override
            public boolean apply(Playlist playlist) {
                return playlist.getDirectory().getDevice().getName().toLowerCase()
                        .contains(sPattern.toLowerCase());
            }
        }));
        // Filter against the PATH attribute
    } else if (Const.XML_PATH.equals(sPropertyName)) {
        alToShow = new ArrayList<Playlist>(Collections2.filter(alToShow, new Predicate<Playlist>() {
            @Override
            public boolean apply(Playlist playlist) {
                return playlist.getAbsolutePath().toLowerCase().contains(sPattern.toLowerCase());
            }
        }));
        // Filter against "any"
    } else if (Const.XML_ANY.equals(sPropertyName)) {
        alToShow = new ArrayList<Playlist>(Collections2.filter(alToShow, new Predicate<Playlist>() {
            @Override
            public boolean apply(Playlist playlist) {
                return playlist.getAny().toLowerCase().contains(sPattern.toLowerCase());
            }
        }));
    } // filter unavailable playlists
    if (Conf.getBoolean(Const.CONF_OPTIONS_HIDE_UNMOUNTED)) {
        CollectionUtils.filter(alToShow, new JajukPredicates.ReadyPlaylistPredicate());
    }
    Iterator<Playlist> it = null;
    int iColNum = iNumberStandardCols + PlaylistManager.getInstance().getCustomProperties().size();
    iRowNum = alToShow.size();
    oValues = new Object[iRowNum][iColNum];
    oItems = new Item[iRowNum];
    bCellEditable = new boolean[iRowNum][iColNum];
    // Allow only custom properties edition
    bEditable = true;
    // For perfs, prepare columns visibility
    boolean bName = (columnsToShow != null && columnsToShow.contains(Const.XML_NAME));
    boolean bDevice = (columnsToShow != null && columnsToShow.contains(Const.XML_DEVICE));
    boolean bDirectory = (columnsToShow != null && columnsToShow.contains(Const.XML_DIRECTORY));
    boolean bPath = (columnsToShow != null && columnsToShow.contains(Const.XML_PATH));
    it = alToShow.iterator();
    for (int iRow = 0; it.hasNext(); iRow++) {
        Playlist plf = it.next();
        setItemAt(iRow, plf);
        // Id
        oItems[iRow] = plf;
        // Play
        IconLabel il = null;
        if (plf.getDirectory().getDevice().isMounted()) {
            il = getIcon(false);
        } else {
            il = getIcon(true);
        }
        // Note: if you want to add an image, use an ImageIcon class and
        // change
        oValues[iRow][0] = il;
        bCellEditable[iRow][0] = false;
        // Playlist Name
        if (bName) {
            oValues[iRow][1] = plf.getName();
        } else {
            oValues[iRow][1] = "";
        }
        bCellEditable[iRow][1] = false;
        // Device
        if (bDevice) {
            Device device = plf.getDirectory().getDevice();
            oValues[iRow][2] = device.getName();
        } else {
            oValues[iRow][2] = "";
        }
        bCellEditable[iRow][2] = false;
        // Directory
        if (bDirectory) {
            Directory directory = plf.getDirectory();
            oValues[iRow][3] = directory.getName();
        } else {
            oValues[iRow][3] = "";
        }
        bCellEditable[iRow][3] = false;
        // PATH
        if (bPath) {
            String path = plf.getAbsolutePath();
            oValues[iRow][4] = path;
        } else {
            oValues[iRow][4] = "";
        }
        bCellEditable[iRow][4] = false;
        // Custom properties now
        Map<String, Object> properties = plf.getProperties();
        Iterator<PropertyMetaInformation> it2 = PlaylistManager.getInstance().getCustomProperties().iterator();
        for (int i = 0; it2.hasNext(); i++) {
            PropertyMetaInformation meta = it2.next();
            Object o = properties.get(meta.getName());
            if (o != null) {
                oValues[iRow][iNumberStandardCols + i] = o;
            } else {
                oValues[iRow][iNumberStandardCols + i] = meta.getDefaultValue();
            }
            // Date values not editable, use properties panel instead to
            // edit
            bCellEditable[iRow][iNumberStandardCols + i] = !(meta.getType().equals(Date.class));
        }
    }
}

From source file:org.jajuk.ui.helpers.TracksTableModel.java

@Override
public void populateModel(String property, String sPattern, List<String> columnsToShow) {
    // This should be monitor file manager to avoid NPE when changing items
    List<Track> alToShow = TrackManager.getInstance().getTracks();
    // / Filter mounted files if needed and apply sync table with tree
    // option if needed
    final boolean syncTreeTable = Conf.getBoolean(Const.CONF_SYNC_TABLE_TREE + "." + viewID);
    CollectionUtils.filter(alToShow, new Predicate() {
        @Override/* w  w  w  .j  a  v a2 s. com*/
        public boolean evaluate(Object o) {
            Track track = (Track) o;
            // show it if no sync option or if item is in the selection
            boolean bShowWithTree = !syncTreeTable
                    // tree selection = null means none election have been
                    // selected in tree so far
                    || treeSelection == null
            // check if the tree selection contains the current file
                    || (treeSelection.size() > 0 && treeSelection.contains(track));
            return (!track.shouldBeHidden() && bShowWithTree);
        }
    });
    // Filter values using given pattern
    Filter filter = new Filter(property, sPattern, true, Conf.getBoolean(Const.CONF_REGEXP));
    alToShow = Filter.filterItems(alToShow, filter, Track.class);
    // sort by album
    Collections.sort(alToShow, new TrackComparator(TrackComparatorType.ALBUM));
    Iterator<Track> it = alToShow.iterator();
    int iColNum = iNumberStandardCols + TrackManager.getInstance().getCustomProperties().size();
    iRowNum = alToShow.size();
    it = alToShow.iterator();
    oValues = new Object[iRowNum][iColNum];
    oItems = new Item[iRowNum];
    bCellEditable = new boolean[iRowNum][iColNum];
    // For perfs, prepare columns visibility
    boolean bName = (columnsToShow != null && columnsToShow.contains(Const.XML_NAME));
    boolean bAlbum = (columnsToShow != null && columnsToShow.contains(Const.XML_ALBUM));
    boolean bArtist = (columnsToShow != null && columnsToShow.contains(Const.XML_ARTIST));
    boolean bAlbumArtist = (columnsToShow != null && columnsToShow.contains(Const.XML_ALBUM_ARTIST));
    boolean bGenre = (columnsToShow != null && columnsToShow.contains(Const.XML_GENRE));
    boolean bRate = (columnsToShow != null && columnsToShow.contains(Const.XML_TRACK_RATE));
    boolean bLength = (columnsToShow != null && columnsToShow.contains(Const.XML_TRACK_LENGTH));
    boolean bComment = (columnsToShow != null && columnsToShow.contains(Const.XML_TRACK_COMMENT));
    boolean bDiscovery = (columnsToShow != null && columnsToShow.contains(Const.XML_TRACK_DISCOVERY_DATE));
    boolean bOrder = (columnsToShow != null && columnsToShow.contains(Const.XML_TRACK_ORDER));
    boolean bDiscNumber = (columnsToShow != null && columnsToShow.contains(Const.XML_TRACK_DISC_NUMBER));
    boolean bYear = (columnsToShow != null && columnsToShow.contains(Const.XML_YEAR));
    boolean bHits = (columnsToShow != null && columnsToShow.contains(Const.XML_TRACK_HITS));
    boolean bFiles = (columnsToShow != null && columnsToShow.contains(Const.XML_FILES));
    for (int iRow = 0; it.hasNext(); iRow++) {
        Track track = it.next();
        setItemAt(iRow, track);
        // Id
        oItems[iRow] = track;
        // Play
        IconLabel il = null;
        if (track.getBestFile(true) != null) {
            il = getIcon(false);
        } else {
            il = getIcon(true);
        }
        // Note: if you want to add an image, use an ImageIcon class and
        // change
        oValues[iRow][0] = il;
        bCellEditable[iRow][0] = false;
        // check track has an associated tag editor (not null)
        boolean bHasATagEditor = false;
        File file = track.getFiles().get(0);
        // all files have the same type
        Type type = file.getType();
        if (type != null) {
            bHasATagEditor = (type.getTaggerClass() != null);
        }
        // Track name
        if (bName) {
            oValues[iRow][1] = track.getName();
        } else {
            oValues[iRow][1] = "";
        }
        bCellEditable[iRow][1] = bHasATagEditor;
        // Album
        if (bAlbum) {
            oValues[iRow][2] = track.getAlbum().getName2();
        } else {
            oValues[iRow][2] = "";
        }
        bCellEditable[iRow][2] = bHasATagEditor;
        // Artist
        if (bArtist) {
            oValues[iRow][3] = track.getArtist().getName2();
        } else {
            oValues[iRow][3] = "";
        }
        bCellEditable[iRow][3] = bHasATagEditor;
        // Album Artist
        if (bAlbumArtist) {
            oValues[iRow][4] = track.getAlbumArtist().getName2();
        } else {
            oValues[iRow][4] = "";
        }
        bCellEditable[iRow][4] = bHasATagEditor;
        // Genre
        if (bGenre) {
            oValues[iRow][5] = track.getGenre().getName2();
        } else {
            oValues[iRow][5] = "";
        }
        bCellEditable[iRow][5] = bHasATagEditor;
        // Rate
        if (bRate) {
            oValues[iRow][6] = StarsHelper.getStarIconLabel(track);
        } else {
            oValues[iRow][6] = "";
        }
        bCellEditable[iRow][6] = false;
        // Length
        if (bLength) {
            oValues[iRow][7] = new Duration(track.getDuration());
        } else {
            oValues[iRow][7] = "";
        }
        bCellEditable[iRow][7] = false;
        // Comment
        if (bComment) {
            oValues[iRow][8] = track.getValue(Const.XML_TRACK_COMMENT);
        } else {
            oValues[iRow][8] = "";
        }
        bCellEditable[iRow][8] = bHasATagEditor;
        // Date discovery
        if (bDiscovery) {
            oValues[iRow][9] = track.getDiscoveryDate(); // show date using
            // default local format
            // and not technical
            // representation
            bCellEditable[iRow][9] = false;
        } else {
            oValues[iRow][9] = "";
        }
        // Order
        if (bOrder) {
            oValues[iRow][10] = track.getOrder();
        } else {
            oValues[iRow][10] = "";
        }
        bCellEditable[iRow][10] = bHasATagEditor;
        // Disc number
        if (bDiscNumber) {
            oValues[iRow][11] = track.getDiscNumber();
        } else {
            oValues[iRow][11] = "";
        }
        bCellEditable[iRow][11] = bHasATagEditor;
        // Year
        if (bYear) {
            oValues[iRow][12] = track.getYear().getValue();
        } else {
            oValues[iRow][12] = "";
        }
        bCellEditable[iRow][12] = bHasATagEditor;
        // Hits
        if (bHits) {
            oValues[iRow][13] = track.getHits();
        } else {
            oValues[iRow][13] = "";
        }
        bCellEditable[iRow][13] = false;
        // Files
        if (bFiles) {
            List<File> alFiles = track.getFiles();
            StringBuilder files = new StringBuilder(50);
            // for perfs, we manage differently single file tracks and multi-files
            // tracks
            if (alFiles.size() == 1) {
                files.append(alFiles.get(0).getAbsolutePath());
            } else {
                for (File file2 : alFiles) {
                    files.append(file2.getAbsolutePath()).append(',');
                }
                files.deleteCharAt(files.length() - 1);
            }
            oValues[iRow][14] = files.toString();
        } else {
            oValues[iRow][14] = "";
        }
        bCellEditable[iRow][14] = false;
        // Custom properties now
        Map<String, Object> properties = track.getProperties();
        Iterator<PropertyMetaInformation> it2 = TrackManager.getInstance().getCustomProperties().iterator();
        for (int i = 0; it2.hasNext(); i++) {
            PropertyMetaInformation meta = it2.next();
            Object o = properties.get(meta.getName());
            if (o != null) {
                oValues[iRow][iNumberStandardCols + i] = o;
            } else {
                oValues[iRow][iNumberStandardCols + i] = meta.getDefaultValue();
            }
            // Date values not editable, use properties panel instead to
            // edit
            bCellEditable[iRow][iNumberStandardCols + i] = !(meta.getType().equals(Date.class));
        }
    }
}

From source file:org.jannocessor.collection.impl.PowerArrayList.java

@Override
public PowerList<E> remove(Criteria<E> criteria) {
    CollectionUtils.filter(this, predicate(criteria.not()));
    return this;
}

From source file:org.jannocessor.collection.impl.PowerArrayList.java

@Override
public PowerList<E> retain(Criteria<E> criteria) {
    CollectionUtils.filter(this, predicate(criteria));
    return this;
}

From source file:org.jannocessor.collection.impl.PowerLinkedHashSet.java

public PowerSet<E> remove(Criteria<E> criteria) {
    CollectionUtils.filter(this, predicate(criteria.not()));
    return this;
}

From source file:org.jannocessor.collection.impl.PowerLinkedHashSet.java

public PowerSet<E> retain(Criteria<E> criteria) {
    CollectionUtils.filter(this, predicate(criteria));
    return this;
}