~ubuntu-branches/ubuntu/jaunty/electric/jaunty

« back to all changes in this revision

Viewing changes to com/sun/electric/database/LibraryBackup.java

  • Committer: Bazaar Package Importer
  • Author(s): Onkar Shinde
  • Date: 2009-01-08 02:05:08 UTC
  • mfrom: (1.1.2 upstream) (3.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090108020508-0h3li7zt9mu5gf0i
Tags: 8.08-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
public class LibraryBackup {
38
38
    public static final LibraryBackup[] NULL_ARRAY = {};
39
39
    public static final ImmutableArrayList<LibraryBackup> EMPTY_LIST = new ImmutableArrayList<LibraryBackup>(NULL_ARRAY);
40
 
    
 
40
 
41
41
    /** Library persistent data. */                                     public final ImmutableLibrary d;
42
42
    /** True if library needs saving to disk. */                        public final boolean modified;
43
43
    /** Array of referenced libs */                                     public final LibId[] referencedLibs;
48
48
        this.modified = modified;
49
49
        this.referencedLibs = referencedLibs;
50
50
    }
51
 
    
 
51
 
 
52
        /**
 
53
         * Returns LibraryBackup which differs from this LibraryBackup by "modified" flag set.
 
54
     * @return LibraryBackup with "modified" flag set.
 
55
         */
 
56
    LibraryBackup withModified() {
 
57
        if (modified) return this;
 
58
        return new LibraryBackup(d, true, referencedLibs);
 
59
    }
 
60
 
52
61
        /**
53
62
         * Returns LibraryBackup which differs from this LibraryBackup by renamed Ids.
54
63
         * @param idMapper a map from old Ids to new Ids.
74
83
        newBackup.check();
75
84
        return newBackup;
76
85
    }
77
 
    
 
86
 
78
87
    /**
79
88
     * Writes this LibraryBackup to IdWriter.
80
89
     * @param writer where to write.
86
95
        for (int i = 0; i < referencedLibs.length; i++)
87
96
            writer.writeLibId(referencedLibs[i]);
88
97
    }
89
 
    
 
98
 
90
99
    /**
91
100
     * Reads LibraryBackup from SnapshotReader.
92
101
     * @param reader where to read.
100
109
            refs[i] = reader.readLibId();
101
110
        return new LibraryBackup(d, modified, refs);
102
111
    }
103
 
    
 
112
 
104
113
    /**
105
114
         * Checks invariant of this CellBackup.
106
115
         * @throws AssertionError if invariant is broken.
110
119
        for (LibId libId: referencedLibs)
111
120
            assert libId != null;
112
121
    }
113
 
    
 
122
 
114
123
    @Override
115
124
    public String toString() { return d.toString(); }
116
125
}