View Javadoc
1   /**
2    * Copyright 2010-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.common.util.file.model;
17  
18  import java.util.List;
19  
20  import org.kuali.common.util.Assert;
21  
22  public class DuplicateArtifact implements Comparable<DuplicateArtifact> {
23  
24  	public DuplicateArtifact(String path, List<ArtifactForTesting> artifacts) {
25  		Assert.noBlanks(path);
26  		Assert.noNulls(artifacts);
27  		this.path = path;
28  		this.artifacts = artifacts;
29  	}
30  
31  	private final String path;
32  	private final List<ArtifactForTesting> artifacts;
33  
34  	@Override
35  	public int compareTo(DuplicateArtifact other) {
36  		int sizeComparison = Double.compare(artifacts.size(), other.getArtifacts().size());
37  		if (sizeComparison == 0) {
38  			return path.compareTo(other.getPath());
39  		} else {
40  			return sizeComparison;
41  		}
42  	}
43  
44  	public String getPath() {
45  		return path;
46  	}
47  
48  	public List<ArtifactForTesting> getArtifacts() {
49  		return artifacts;
50  	}
51  
52  }