/** * Cluster to frames convertor. * * @return the tree map< integer, segment> containing the segment sorted by show first and start * time */ public TreeMap<Integer, Segment> clusterToFrames() { TreeMap<Integer, Segment> segmentTreeMapResult = new TreeMap<Integer, Segment>(); TreeSet<Segment> segmentList = getSegments(); for (Segment segment : segmentList) { int start = segment.getStart(); int length = segment.getLength(); for (int i = start; i < (start + length); i++) { Segment newSegment = (segment.clone()); newSegment.setStart(i); newSegment.setLength(1); newSegment.setCluster(this); // Plus utile le genre porte sur le cluster // newSegment.setGender(getGender()); segmentTreeMapResult.put(i, newSegment); } } return segmentTreeMapResult; }
/** * Adds a segment to the inner container. * * @param segment the segment to add * @return true, if add successful */ public boolean addSegment(Segment segment) { segment.setCluster(this); return segmentSet.add(segment); }