X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.support.simple%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fdiff%2FSimpleDiffResult.java;h=cc1facb664564b21474d8f9106ec0fd37ef33d23;hb=74904a755b5b344238eafa798419b80c5e74f7ed;hp=e0263c111f9d3edbef45782831c396463fc1f53f;hpb=e2fa1e50b1900115233089b2d10bfa68be37cd3e;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/SimpleDiffResult.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/SimpleDiffResult.java index e0263c111..cc1facb66 100644 --- a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/SimpleDiffResult.java +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/diff/SimpleDiffResult.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Mathieu Baudier + * Copyright (C) 2007-2012 Mathieu Baudier * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.argeo.slc.diff; import java.util.ArrayList; @@ -23,8 +22,28 @@ import java.util.TreeMap; /** A basic implementation of DiffResult. */ public class SimpleDiffResult implements DiffResult { - private List issues = new ArrayList(); - private Map summary = new TreeMap(); + private final List issues; + private final Map summary; + + /** Empty constructor */ + public SimpleDiffResult() { + this(new TreeMap(), new ArrayList()); + } + + /** Initialize from existing data */ + public SimpleDiffResult(Map summary, List issues) { + this.summary = summary; + this.issues = issues; + } + + /** + * Initialize from existing {@link DiffResult}, the collections are NOT + * cloned for performance purposes. + */ + public SimpleDiffResult(DiffResult diffResult) { + this.summary = diffResult.getSummary(); + this.issues = diffResult.getIssues(); + } /** Summary information, alphabetically ordered key/value pairs */ public Map getSummary() {