~ubuntu-branches/ubuntu/maverick/electric/maverick

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Onkar Shinde
  • Date: 2010-01-09 16:26:04 UTC
  • mfrom: (1.1.4 upstream) (3.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100109162604-1ypvmy8ijmlc6oq7
Tags: 8.10-1
* New upstream version.
* debian/control
  - Add libjava3d-java and quilt build dependencies.
  - Update standards version to 3.8.3.
  - Add libjava3d-java as recommends to binary package.
* debian/rules
  - Use quilt patch system instead of simple patchsys.
  - Add java3d related jar files to DEB_JARS.
* debian/patches/*
  - Update as per current upstream source. Convert to quilt.
* debian/ant.properties
  - Do not disable 3D plugin anymore.
  - Use new property to disable compilation of OS X related classes.
* debian/wrappers/electric
  - Add java3d related jar files to runtime classpath.
* debian/README.source
  - Change text to the appropriate one for quilt.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
 
44
44
    public final static ImmutableExport[] NULL_ARRAY = {};
45
45
    public final static ImmutableArrayList<ImmutableExport> EMPTY_LIST = new ImmutableArrayList<ImmutableExport>(NULL_ARRAY);
46
 
 
47
 
        /** set if this port should always be drawn */                  private static final int PORTDRAWN =         0400000000;
48
 
        /** set to exclude this port from the icon */                   private static final int BODYONLY =         01000000000;
 
46
    /** set if this port should always be drawn */
 
47
    private static final int PORTDRAWN = 0400000000;
 
48
    /** set to exclude this port from the icon */
 
49
    private static final int BODYONLY = 01000000000;
49
50
//      /** input/output/power/ground/clock state */                    private static final int STATEBITS =       036000000000;
50
 
        /** input/output/power/ground/clock state */                    private static final int STATEBITSSHIFTED =         036;
51
 
        /** input/output/power/ground/clock state */                    private static final int STATEBITSSH =               27;
52
 
 
53
 
    /** id of this Export. */                                       public final ExportId exportId;
54
 
        /** name of this ImmutableExport. */                                                    public final Name name;
55
 
        /** The text descriptor of name of ImmutableExport. */          public final TextDescriptor nameDescriptor;
56
 
    /** The nodeId of original PortInst. */                         public final int originalNodeId;
57
 
    /** The PortProtoId of orignal PortInst. */                     public final PortProtoId originalPortId;
58
 
    /** True if this ImmutableExport to be always drawn. */         public final boolean alwaysDrawn;
59
 
    /** True to exclude this ImmutableExport from the icon. */      public final boolean bodyOnly;
60
 
        /** PortCharacteristic of this ImmutableExport. */              public final PortCharacteristic characteristic;
61
 
 
62
 
        /**
63
 
         * The private constructor of ImmutableExport. Use the factory "newInstance" instead.
 
51
    /** input/output/power/ground/clock state */
 
52
    private static final int STATEBITSSHIFTED = 036;
 
53
    /** input/output/power/ground/clock state */
 
54
    private static final int STATEBITSSH = 27;
 
55
    /** id of this Export. */
 
56
    public final ExportId exportId;
 
57
    /** name of this ImmutableExport. */
 
58
    public final Name name;
 
59
    /** The text descriptor of name of ImmutableExport. */
 
60
    public final TextDescriptor nameDescriptor;
 
61
    /** The nodeId of original PortInst. */
 
62
    public final int originalNodeId;
 
63
    /** The PortProtoId of orignal PortInst. */
 
64
    public final PortProtoId originalPortId;
 
65
    /** True if this ImmutableExport to be always drawn. */
 
66
    public final boolean alwaysDrawn;
 
67
    /** True to exclude this ImmutableExport from the icon. */
 
68
    public final boolean bodyOnly;
 
69
    /** PortCharacteristic of this ImmutableExport. */
 
70
    public final PortCharacteristic characteristic;
 
71
 
 
72
    /**
 
73
     * The private constructor of ImmutableExport. Use the factory "newInstance" instead.
64
74
     * @param exportId id of new Export.
65
 
         * @param name name of new ImmutableExport.
 
75
     * @param name name of new ImmutableExport.
66
76
     * @param nameDescriptor TextDescriptor of name of this ImmutableExport.
67
77
     * @param originalNodeId node id of original PortInst.
68
78
     * @param originalPortId port proto id of original PortInst.
70
80
     * @param bodyOnly true to exclude new ImmutableExport from the icon.
71
81
     * @param characteristic PortCharacteristic of new ImmutableExport.
72
82
     * @param vars array of Variables of this ImmutableNodeInst
73
 
         */
74
 
     ImmutableExport(ExportId exportId, Name name, TextDescriptor nameDescriptor,
75
 
             int originalNodeId, PortProtoId originalPortId,
76
 
             boolean alwaysDrawn, boolean bodyOnly, PortCharacteristic characteristic, Variable[] vars) {
 
83
     */
 
84
    ImmutableExport(ExportId exportId, Name name, TextDescriptor nameDescriptor,
 
85
            int originalNodeId, PortProtoId originalPortId,
 
86
            boolean alwaysDrawn, boolean bodyOnly, PortCharacteristic characteristic, Variable[] vars) {
77
87
        super(vars, 0);
78
88
        this.exportId = exportId;
79
89
        this.name = name;
86
96
//        check();
87
97
    }
88
98
 
89
 
        /**
90
 
         * Returns new ImmutableExport object.
 
99
    /**
 
100
     * Returns new ImmutableExport object.
91
101
     * @param exportId id of new Export.
92
 
         * @param name name of new ImmutableExport.
 
102
     * @param name name of new ImmutableExport.
93
103
     * @param nameDescriptor TextDescriptor of name of this ImmutableExport.
94
104
     * @param originalNodeId node id of original PortInst.
95
105
     * @param originalPortId port proto id of original PortInst.
96
106
     * @param alwaysDrawn true if new ImmutableExport is always drawn.
97
107
     * @param bodyOnly true to exclude new ImmutableExport from the icon.
98
108
     * @param characteristic PortCharacteristic of new ImmutableExport.
99
 
         * @return new ImmutableExport object.
100
 
         * @throws NullPointerException if exportId, name, originalPortId is null.
 
109
     * @return new ImmutableExport object.
 
110
     * @throws NullPointerException if exportId, name, originalPortId is null.
101
111
     * @throws IllegalArgumentException if originalNodeId is bad.
102
 
         */
 
112
     */
103
113
    public static ImmutableExport newInstance(ExportId exportId, Name name, TextDescriptor nameDescriptor,
104
 
             int originalNodeId, PortProtoId originalPortId,
105
 
             boolean alwaysDrawn, boolean bodyOnly, PortCharacteristic characteristic) {
106
 
                if (exportId == null) throw new NullPointerException("exportId");
107
 
                if (name == null) throw new NullPointerException("name");
108
 
        if (!name.isValid() || name.hasEmptySubnames() || name.isTempname()) throw new IllegalArgumentException("name");
109
 
        if (nameDescriptor != null)
 
114
            int originalNodeId, PortProtoId originalPortId,
 
115
            boolean alwaysDrawn, boolean bodyOnly, PortCharacteristic characteristic) {
 
116
        if (exportId == null) {
 
117
            throw new NullPointerException("exportId");
 
118
        }
 
119
        if (name == null) {
 
120
            throw new NullPointerException("name");
 
121
        }
 
122
        if (!name.isValid() || name.hasEmptySubnames() || name.isTempname()) {
 
123
            throw new IllegalArgumentException("name");
 
124
        }
 
125
        if (nameDescriptor != null) {
110
126
            nameDescriptor = nameDescriptor.withDisplayWithoutParam();
111
 
        if (originalNodeId < 0) throw new IllegalArgumentException("originalNodeId");
112
 
        if (originalPortId == null) throw new NullPointerException("orignalPortId");
113
 
        if (characteristic == null) characteristic = PortCharacteristic.UNKNOWN;
114
 
                return new ImmutableExport(exportId, name, nameDescriptor,
 
127
        }
 
128
        if (originalNodeId < 0) {
 
129
            throw new IllegalArgumentException("originalNodeId");
 
130
        }
 
131
        if (originalPortId == null) {
 
132
            throw new NullPointerException("orignalPortId");
 
133
        }
 
134
        if (characteristic == null) {
 
135
            characteristic = PortCharacteristic.UNKNOWN;
 
136
        }
 
137
        return new ImmutableExport(exportId, name, nameDescriptor,
115
138
                originalNodeId, originalPortId, alwaysDrawn, bodyOnly, characteristic, Variable.NULL_ARRAY);
116
139
    }
117
140
 
118
 
        /**
119
 
         * Returns ImmutableExport which differs from this ImmutableExport by name.
120
 
         * @param name export name key.
121
 
         * @return ImmutableExport which differs from this ImmutableExport by name.
122
 
         * @throws NullPointerException if name is null
123
 
         */
124
 
        public ImmutableExport withName(Name name) {
125
 
                if (this.name.toString().equals(name.toString())) return this;
126
 
                if (name == null) throw new NullPointerException("name");
127
 
        if (!name.isValid() || name.hasEmptySubnames() || name.isTempname()) throw new IllegalArgumentException("name");
128
 
                return new ImmutableExport(this.exportId, name, this.nameDescriptor,
 
141
    /**
 
142
     * Returns ImmutableExport which differs from this ImmutableExport by name.
 
143
     * @param name export name key.
 
144
     * @return ImmutableExport which differs from this ImmutableExport by name.
 
145
     * @throws NullPointerException if name is null
 
146
     */
 
147
    public ImmutableExport withName(Name name) {
 
148
        if (this.name.toString().equals(name.toString())) {
 
149
            return this;
 
150
        }
 
151
        if (name == null) {
 
152
            throw new NullPointerException("name");
 
153
        }
 
154
        if (!name.isValid() || name.hasEmptySubnames() || name.isTempname()) {
 
155
            throw new IllegalArgumentException("name");
 
156
        }
 
157
        return new ImmutableExport(this.exportId, name, this.nameDescriptor,
129
158
                this.originalNodeId, this.originalPortId, this.alwaysDrawn, this.bodyOnly, this.characteristic, getVars());
130
 
        }
 
159
    }
131
160
 
132
 
        /**
133
 
         * Returns ImmutableExport which differs from this ImmutableExport by name descriptor.
 
161
    /**
 
162
     * Returns ImmutableExport which differs from this ImmutableExport by name descriptor.
134
163
     * @param nameDescriptor TextDescriptor of name
135
 
         * @return ImmutableExport which differs from this ImmutableExport by name descriptor.
136
 
         */
137
 
        public ImmutableExport withNameDescriptor(TextDescriptor nameDescriptor) {
138
 
        if (nameDescriptor != null)
 
164
     * @return ImmutableExport which differs from this ImmutableExport by name descriptor.
 
165
     */
 
166
    public ImmutableExport withNameDescriptor(TextDescriptor nameDescriptor) {
 
167
        if (nameDescriptor != null) {
139
168
            nameDescriptor = nameDescriptor.withDisplayWithoutParam();
140
 
        if (this.nameDescriptor == nameDescriptor) return this;
141
 
                return new ImmutableExport(this.exportId, this.name, nameDescriptor,
 
169
        }
 
170
        if (this.nameDescriptor == nameDescriptor) {
 
171
            return this;
 
172
        }
 
173
        return new ImmutableExport(this.exportId, this.name, nameDescriptor,
142
174
                this.originalNodeId, this.originalPortId, this.alwaysDrawn, this.bodyOnly, this.characteristic, getVars());
143
 
        }
 
175
    }
144
176
 
145
 
        /**
146
 
         * Returns ImmutableExport which differs from this ImmutableExport by original port.
 
177
    /**
 
178
     * Returns ImmutableExport which differs from this ImmutableExport by original port.
147
179
     * @param originalNodeId node id of original PortInst.
148
180
     * @param originalPortId port proto id of original PortInst.
149
 
         * @return ImmutableExport which differs from this ImmutableExport by original port.
 
181
     * @return ImmutableExport which differs from this ImmutableExport by original port.
150
182
     * @throws NullPointerException if originalPortId is null.
151
 
         */
152
 
        public ImmutableExport withOriginalPort(int originalNodeId, PortProtoId originalPortId) {
153
 
        if (this.originalNodeId == originalNodeId && this.originalPortId == originalPortId) return this;
154
 
        if (originalPortId == null) throw new NullPointerException("originalPortId");
155
 
                return new ImmutableExport(this.exportId, this.name, this.nameDescriptor,
 
183
     */
 
184
    public ImmutableExport withOriginalPort(int originalNodeId, PortProtoId originalPortId) {
 
185
        if (this.originalNodeId == originalNodeId && this.originalPortId == originalPortId) {
 
186
            return this;
 
187
        }
 
188
        if (originalPortId == null) {
 
189
            throw new NullPointerException("originalPortId");
 
190
        }
 
191
        return new ImmutableExport(this.exportId, this.name, this.nameDescriptor,
156
192
                originalNodeId, originalPortId, this.alwaysDrawn, this.bodyOnly, this.characteristic, getVars());
157
 
        }
 
193
    }
158
194
 
159
 
        /**
160
 
         * Returns ImmutableExport which differs from this ImmutableExport by alwaysDrawn flag.
 
195
    /**
 
196
     * Returns ImmutableExport which differs from this ImmutableExport by alwaysDrawn flag.
161
197
     * @param alwaysDrawn true if new ImmutableExport is always drawn.
162
 
         * @return ImmutableExport which differs from this ImmutableExport by alwaysDrawn flag.
163
 
         */
164
 
        public ImmutableExport withAlwaysDrawn(boolean alwaysDrawn) {
165
 
        if (this.alwaysDrawn == alwaysDrawn) return this;
166
 
                return new ImmutableExport(this.exportId, this.name, this.nameDescriptor,
 
198
     * @return ImmutableExport which differs from this ImmutableExport by alwaysDrawn flag.
 
199
     */
 
200
    public ImmutableExport withAlwaysDrawn(boolean alwaysDrawn) {
 
201
        if (this.alwaysDrawn == alwaysDrawn) {
 
202
            return this;
 
203
        }
 
204
        return new ImmutableExport(this.exportId, this.name, this.nameDescriptor,
167
205
                this.originalNodeId, this.originalPortId, alwaysDrawn, this.bodyOnly, this.characteristic, getVars());
168
 
        }
 
206
    }
169
207
 
170
 
        /**
171
 
         * Returns ImmutableExport which differs from this ImmutableExport by bodyOnly flag.
 
208
    /**
 
209
     * Returns ImmutableExport which differs from this ImmutableExport by bodyOnly flag.
172
210
     * @param bodyOnly true to exclude new ImmutableExport from the icon.
173
 
         * @return ImmutableExport which differs from this ImmutableExport by bodyOnly flag.
174
 
         */
175
 
        public ImmutableExport withBodyOnly(boolean bodyOnly) {
176
 
        if (this.bodyOnly == bodyOnly) return this;
177
 
                return new ImmutableExport(this.exportId, this.name, this.nameDescriptor,
 
211
     * @return ImmutableExport which differs from this ImmutableExport by bodyOnly flag.
 
212
     */
 
213
    public ImmutableExport withBodyOnly(boolean bodyOnly) {
 
214
        if (this.bodyOnly == bodyOnly) {
 
215
            return this;
 
216
        }
 
217
        return new ImmutableExport(this.exportId, this.name, this.nameDescriptor,
178
218
                this.originalNodeId, this.originalPortId, this.alwaysDrawn, bodyOnly, this.characteristic, getVars());
179
 
        }
 
219
    }
180
220
 
181
 
        /**
182
 
         * Returns ImmutableExport which differs from this ImmutableExport by port characteristic.
 
221
    /**
 
222
     * Returns ImmutableExport which differs from this ImmutableExport by port characteristic.
183
223
     * @param characteristic PortCharacteristic of new ImmutableExport.
184
 
         * @return ImmutableExport which differs from this ImmutableExport by port characteristic.
185
 
         */
186
 
        public ImmutableExport withCharacteristic(PortCharacteristic characteristic) {
187
 
        if (characteristic == null) characteristic = PortCharacteristic.UNKNOWN;
188
 
        if (this.characteristic == characteristic) return this;
189
 
                return new ImmutableExport(this.exportId, this.name, this.nameDescriptor,
 
224
     * @return ImmutableExport which differs from this ImmutableExport by port characteristic.
 
225
     */
 
226
    public ImmutableExport withCharacteristic(PortCharacteristic characteristic) {
 
227
        if (characteristic == null) {
 
228
            characteristic = PortCharacteristic.UNKNOWN;
 
229
        }
 
230
        if (this.characteristic == characteristic) {
 
231
            return this;
 
232
        }
 
233
        return new ImmutableExport(this.exportId, this.name, this.nameDescriptor,
190
234
                this.originalNodeId, this.originalPortId, this.alwaysDrawn, this.bodyOnly, characteristic, getVars());
191
 
        }
 
235
    }
192
236
 
193
 
        /**
194
 
         * Returns ImmutableExport which differs from this ImmutableExport by additional Variable.
 
237
    /**
 
238
     * Returns ImmutableExport which differs from this ImmutableExport by additional Variable.
195
239
     * If this ImmutableExport has Variable with the same key as new, the old variable will not be in new
196
240
     * ImmutableExport.
197
 
         * @param var additional Variable.
198
 
         * @return ImmutableExport with additional Variable.
199
 
         * @throws NullPointerException if var is null
200
 
         */
 
241
     * @param var additional Variable.
 
242
     * @return ImmutableExport with additional Variable.
 
243
     * @throws NullPointerException if var is null
 
244
     */
201
245
    public ImmutableExport withVariable(Variable var) {
202
246
        Variable[] vars = arrayWithVariable(var.withParam(false));
203
 
        if (this.getVars() == vars) return this;
204
 
                return new ImmutableExport(this.exportId, this.name, this.nameDescriptor,
 
247
        if (this.getVars() == vars) {
 
248
            return this;
 
249
        }
 
250
        return new ImmutableExport(this.exportId, this.name, this.nameDescriptor,
205
251
                this.originalNodeId, this.originalPortId, this.alwaysDrawn, this.bodyOnly, this.characteristic, vars);
206
252
    }
207
253
 
208
 
        /**
209
 
         * Returns ImmutableExport which differs from this ImmutableExport by removing Variable
 
254
    /**
 
255
     * Returns ImmutableExport which differs from this ImmutableExport by removing Variable
210
256
     * with the specified key. Returns this ImmutableExport if it doesn't contain variable with the specified key.
211
 
         * @param key Variable Key to remove.
212
 
         * @return ImmutableExport without Variable with the specified key.
213
 
         * @throws NullPointerException if key is null
214
 
         */
 
257
     * @param key Variable Key to remove.
 
258
     * @return ImmutableExport without Variable with the specified key.
 
259
     * @throws NullPointerException if key is null
 
260
     */
215
261
    public ImmutableExport withoutVariable(Variable.Key key) {
216
262
        Variable[] vars = arrayWithoutVariable(key);
217
 
        if (this.getVars() == vars) return this;
218
 
                return new ImmutableExport(this.exportId, this.name, this.nameDescriptor,
 
263
        if (this.getVars() == vars) {
 
264
            return this;
 
265
        }
 
266
        return new ImmutableExport(this.exportId, this.name, this.nameDescriptor,
219
267
                this.originalNodeId, this.originalPortId, this.alwaysDrawn, this.bodyOnly, this.characteristic, vars);
220
268
    }
221
269
 
222
 
        /**
223
 
         * Returns ImmutableExport which differs from this ImmutableExport by renamed Ids.
224
 
         * @param idMapper a map from old Ids to new Ids.
 
270
    /**
 
271
     * Returns ImmutableExport which differs from this ImmutableExport by renamed Ids.
 
272
     * @param idMapper a map from old Ids to new Ids.
225
273
     * @return ImmutableExport with renamed Ids.
226
 
         */
 
274
     */
227
275
    ImmutableExport withRenamedIds(IdMapper idMapper) {
228
276
        Variable[] vars = arrayWithRenamedIds(idMapper);
229
277
        ExportId exportId = idMapper.get(this.exportId);
230
278
        PortProtoId originalPortId = this.originalPortId;
231
 
        if (originalPortId instanceof ExportId)
232
 
            originalPortId = idMapper.get((ExportId)originalPortId);
233
 
        if (getVars() == vars && this.exportId == exportId && this.originalPortId == originalPortId) return this;
234
 
                return new ImmutableExport(exportId, this.name, this.nameDescriptor,
 
279
        if (originalPortId instanceof ExportId) {
 
280
            originalPortId = idMapper.get((ExportId) originalPortId);
 
281
        }
 
282
        if (getVars() == vars && this.exportId == exportId && this.originalPortId == originalPortId) {
 
283
            return this;
 
284
        }
 
285
        return new ImmutableExport(exportId, this.name, this.nameDescriptor,
235
286
                this.originalNodeId, originalPortId, this.alwaysDrawn, this.bodyOnly, this.characteristic, vars);
236
287
    }
237
288
 
256
307
     * @param reader where to read.
257
308
     */
258
309
    static ImmutableExport read(IdReader reader) throws IOException {
259
 
        ExportId exportId = (ExportId)reader.readPortProtoId();
 
310
        ExportId exportId = (ExportId) reader.readPortProtoId();
260
311
        Name name = reader.readNameKey();
261
312
        TextDescriptor nameDescriptor = reader.readTextDescriptor();
262
313
        int originalNodeId = reader.readNodeId();
275
326
     * Returns ELIB user bits of this ImmutableExport.
276
327
     * @return ELIB user bits of this ImmutableExport.
277
328
     */
278
 
        public int getElibBits() {
 
329
    public int getElibBits() {
279
330
        int userBits = characteristic.getBits() << STATEBITSSH;
280
 
        if (alwaysDrawn) userBits |= PORTDRAWN;
281
 
        if (bodyOnly) userBits |= BODYONLY;
 
331
        if (alwaysDrawn) {
 
332
            userBits |= PORTDRAWN;
 
333
        }
 
334
        if (bodyOnly) {
 
335
            userBits |= BODYONLY;
 
336
        }
282
337
        return userBits;
283
338
    }
284
339
 
287
342
     * @param elibBits ELIB user bits.
288
343
     * @return alwaysDrawn flag.
289
344
     */
290
 
    public static boolean alwaysDrawnFromElib(int elibBits) { return (elibBits & PORTDRAWN) != 0; }
 
345
    public static boolean alwaysDrawnFromElib(int elibBits) {
 
346
        return (elibBits & PORTDRAWN) != 0;
 
347
    }
291
348
 
292
349
    /**
293
350
     * Get bodyOnly Export flag from ELIB user bits.
294
351
     * @param elibBits ELIB user bits.
295
352
     * @return bodyOnly flag.
296
353
     */
297
 
    public static boolean bodyOnlyFromElib(int elibBits) { return (elibBits & BODYONLY) != 0; }
 
354
    public static boolean bodyOnlyFromElib(int elibBits) {
 
355
        return (elibBits & BODYONLY) != 0;
 
356
    }
298
357
 
299
358
    /**
300
359
     * Get PortCharacteristic of Export from ELIB user bits.
310
369
     * Return a hash code value for fields of this object.
311
370
     * Variables of objects are not compared
312
371
     */
313
 
    public int hashCodeExceptVariables() { return exportId.hashCode(); }
 
372
    public int hashCodeExceptVariables() {
 
373
        return exportId.hashCode();
 
374
    }
314
375
 
315
376
    /**
316
377
     * Indicates whether fields of other ImmutableElectricObject are equal to fileds of this object.
319
380
     * @return true if fields of objects are equal.
320
381
     */
321
382
    public boolean equalsExceptVariables(ImmutableElectricObject o) {
322
 
        if (this == o) return true;
323
 
        if (!(o instanceof ImmutableExport)) return false;
324
 
        ImmutableExport that = (ImmutableExport)o;
325
 
        return this.exportId == that.exportId && this.name == that.name && this.nameDescriptor == that.nameDescriptor &&
326
 
                this.originalNodeId == that.originalNodeId && this.originalPortId == that.originalPortId &&
327
 
                this.alwaysDrawn == that.alwaysDrawn && this.bodyOnly == that.bodyOnly &&
328
 
                this.characteristic == that.characteristic;
 
383
        if (this == o) {
 
384
            return true;
 
385
        }
 
386
        if (!(o instanceof ImmutableExport)) {
 
387
            return false;
 
388
        }
 
389
        ImmutableExport that = (ImmutableExport) o;
 
390
        return this.exportId == that.exportId && this.name == that.name && this.nameDescriptor == that.nameDescriptor
 
391
                && this.originalNodeId == that.originalNodeId && this.originalPortId == that.originalPortId
 
392
                && this.alwaysDrawn == that.alwaysDrawn && this.bodyOnly == that.bodyOnly
 
393
                && this.characteristic == that.characteristic;
329
394
    }
330
395
 
331
396
    /**
335
400
     * @return name key or null.
336
401
     */
337
402
    public static Name validExportName(String name, boolean busAllowed) {
338
 
        if (name == null) return null;
 
403
        if (name == null) {
 
404
            return null;
 
405
        }
339
406
        Name nameKey = Name.findName(name);
340
407
        return nameKey.isValid() && !nameKey.isTempname() && !nameKey.hasEmptySubnames() && (busAllowed || !nameKey.isBus()) ? nameKey : null;
341
408
    }
342
409
 
343
410
    /**
344
 
         * Checks invariant of this ImmutableExport.
345
 
         * @throws AssertionError if invariant is broken.
346
 
         */
347
 
        public void check() {
 
411
     * Checks invariant of this ImmutableExport.
 
412
     * @throws AssertionError if invariant is broken.
 
413
     */
 
414
    public void check() {
348
415
        super.check(true);
349
 
                assert exportId != null;
350
 
                assert name != null;
 
416
        assert exportId != null;
 
417
        assert name != null;
351
418
        assert name.isValid() && !name.hasEmptySubnames() && !name.isTempname();
352
 
        if (nameDescriptor != null)
 
419
        if (nameDescriptor != null) {
353
420
            assert nameDescriptor.isDisplay() && !nameDescriptor.isParam();
 
421
        }
354
422
        assert originalNodeId >= 0;
355
423
        assert originalPortId != null;
356
424
        assert characteristic != null;
357
 
        }
 
425
    }
358
426
}