Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: b3ddbd7d4bce8b47cf4fb7348c4641a80e7f6f5a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
/******************************************************************************
 * Copyright (c) 2004, 2009 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    IBM Corporation - initial API and implementation
 ****************************************************************************/

package org.eclipse.emf.cdo.gmf.notation.impl;

import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.ECollections;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.util.EContentsEList;
import org.eclipse.emf.ecore.util.InternalEList;

import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.NamedStyle;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.Style;
import org.eclipse.gmf.runtime.notation.View;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

/**
 * <!-- begin-user-doc --> An implementation of the model object '<em><b>View</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * </p>
 * <ul>
 *   <li>{@link org.eclipse.emf.cdo.gmf.notation.impl.ViewImpl#isVisible <em>Visible</em>}</li>
 *   <li>{@link org.eclipse.emf.cdo.gmf.notation.impl.ViewImpl#getType <em>Type</em>}</li>
 *   <li>{@link org.eclipse.emf.cdo.gmf.notation.impl.ViewImpl#isMutable <em>Mutable</em>}</li>
 *   <li>{@link org.eclipse.emf.cdo.gmf.notation.impl.ViewImpl#getSourceEdges <em>Source Edges</em>}</li>
 *   <li>{@link org.eclipse.emf.cdo.gmf.notation.impl.ViewImpl#getTargetEdges <em>Target Edges</em>}</li>
 *   <li>{@link org.eclipse.emf.cdo.gmf.notation.impl.ViewImpl#getPersistedChildren <em>Persisted Children</em>}</li>
 *   <li>{@link org.eclipse.emf.cdo.gmf.notation.impl.ViewImpl#getStyles <em>Styles</em>}</li>
 *   <li>{@link org.eclipse.emf.cdo.gmf.notation.impl.ViewImpl#getElement <em>Element</em>}</li>
 *   <li>{@link org.eclipse.emf.cdo.gmf.notation.impl.ViewImpl#getDiagram <em>Diagram</em>}</li>
 *   <li>{@link org.eclipse.emf.cdo.gmf.notation.impl.ViewImpl#getTransientChildren <em>Transient Children</em>}</li>
 * </ul>
 *
 * @generated
 */
/*
 * @canBeSeenBy org.eclipse.gmf.runtime.notation.*
 */
public abstract class ViewImpl extends org.eclipse.emf.cdo.ecore.impl.EModelElementImpl implements View
{

  /**
  * The default value of the '{@link #isVisible() <em>Visible</em>}' attribute.
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @see #isVisible()
  * @generated
  * @ordered
  */
  protected static final boolean VISIBLE_EDEFAULT = true;

  /**
  * The default value of the '{@link #getType() <em>Type</em>}' attribute.
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @see #getType()
  * @generated
  * @ordered
  */
  protected static final String TYPE_EDEFAULT = ""; //$NON-NLS-1$

  /**
  * The default value of the '{@link #isMutable() <em>Mutable</em>}' attribute.
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @see #isMutable()
  * @generated
  * @ordered
  */
  protected static final boolean MUTABLE_EDEFAULT = false;

  // EATM
  // private EContentsEList allChildren = null;

  protected static final EStructuralFeature[] childrenFeatures = new EStructuralFeature[] { NotationPackage.Literals.VIEW__PERSISTED_CHILDREN,
      NotationPackage.Literals.VIEW__TRANSIENT_CHILDREN };

  /**
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @generated
  */
  protected ViewImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return NotationPackage.Literals.VIEW;
  }

  /**
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  * @generated
  */
  protected static final int ESTATIC_FEATURE_COUNT = 0;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected int eStaticFeatureCount()
  {
    return ESTATIC_FEATURE_COUNT;
  }

  /**
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @generated
  */
  public boolean isVisible()
  {
    return ((Boolean)eDynamicGet(NotationPackage.VIEW__VISIBLE - ESTATIC_FEATURE_COUNT, NotationPackage.Literals.VIEW__VISIBLE, true, true)).booleanValue();
  }

  /**
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @generated
  */
  public void setVisible(boolean newVisible)
  {
    eDynamicSet(NotationPackage.VIEW__VISIBLE - ESTATIC_FEATURE_COUNT, NotationPackage.Literals.VIEW__VISIBLE, new Boolean(newVisible));
  }

  /**
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @generated
  */
  public String getType()
  {
    return (String)eDynamicGet(NotationPackage.VIEW__TYPE - ESTATIC_FEATURE_COUNT, NotationPackage.Literals.VIEW__TYPE, true, true);
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   * 
   * @generated NOT
   */
  public void setType(String newType)
  {
    setTypeGen(newType == null ? null : newType.intern());
  }

  /**
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @generated
  */
  public void setTypeGen(String newType)
  {
    eDynamicSet(NotationPackage.VIEW__TYPE - ESTATIC_FEATURE_COUNT, NotationPackage.Literals.VIEW__TYPE, newType);
  }

  /**
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @generated
  */
  public boolean isMutable()
  {
    return ((Boolean)eDynamicGet(NotationPackage.VIEW__MUTABLE - ESTATIC_FEATURE_COUNT, NotationPackage.Literals.VIEW__MUTABLE, true, true)).booleanValue();
  }

  /**
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @generated
  */
  public void setMutable(boolean newMutable)
  {
    eDynamicSet(NotationPackage.VIEW__MUTABLE - ESTATIC_FEATURE_COUNT, NotationPackage.Literals.VIEW__MUTABLE, new Boolean(newMutable));
  }

  /**
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @generated
  */
  public EList getSourceEdges()
  {
    return (EList)eDynamicGet(NotationPackage.VIEW__SOURCE_EDGES - ESTATIC_FEATURE_COUNT, NotationPackage.Literals.VIEW__SOURCE_EDGES, true, true);
  }

  /**
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @generated
  */
  public EList getTargetEdges()
  {
    return (EList)eDynamicGet(NotationPackage.VIEW__TARGET_EDGES - ESTATIC_FEATURE_COUNT, NotationPackage.Literals.VIEW__TARGET_EDGES, true, true);
  }

  /**
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @generated
  */
  public EList getPersistedChildren()
  {
    return (EList)eDynamicGet(NotationPackage.VIEW__PERSISTED_CHILDREN - ESTATIC_FEATURE_COUNT, NotationPackage.Literals.VIEW__PERSISTED_CHILDREN, true, true);
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   */
  public EList getChildren()
  {
    return new EContentsEList(this, childrenFeatures);
    // if (allChildren == null) {
    // allChildren = new EContentsEList(this, childrenFeatures);
    // }
    // return allChildren;
  }

  /**
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @generated
  */
  public EList getStyles()
  {
    return (EList)eDynamicGet(NotationPackage.VIEW__STYLES - ESTATIC_FEATURE_COUNT, NotationPackage.Literals.VIEW__STYLES, true, true);
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   * 
   * @generated NOT
   */
  public EObject getElement()
  {
    if (!isSetElement())
    {
      EObject container = eContainer();
      if (container instanceof View)
      {
        View view = (View)container;
        return view.getElement();
      }
    }

    return getElementGen();
  }

  /**
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @generated
  */
  public EObject getElementGen()
  {
    return (EObject)eDynamicGet(NotationPackage.VIEW__ELEMENT - ESTATIC_FEATURE_COUNT, NotationPackage.Literals.VIEW__ELEMENT, true, true);
  }

  /**
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @generated
  */
  public EObject basicGetElement()
  {
    return (EObject)eDynamicGet(NotationPackage.VIEW__ELEMENT - ESTATIC_FEATURE_COUNT, NotationPackage.Literals.VIEW__ELEMENT, false, true);
  }

  /**
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @generated
  */
  public void setElement(EObject newElement)
  {
    eDynamicSet(NotationPackage.VIEW__ELEMENT - ESTATIC_FEATURE_COUNT, NotationPackage.Literals.VIEW__ELEMENT, newElement);
  }

  /**
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  * @generated
  */
  public void unsetElement()
  {
    eDynamicUnset(NotationPackage.VIEW__ELEMENT - ESTATIC_FEATURE_COUNT, NotationPackage.Literals.VIEW__ELEMENT);
  }

  /**
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  * @generated
  */
  public boolean isSetElement()
  {
    return eDynamicIsSet(NotationPackage.VIEW__ELEMENT - ESTATIC_FEATURE_COUNT, NotationPackage.Literals.VIEW__ELEMENT);
  }

  /**
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @generated
  */
  public Diagram getDiagram()
  {
    Diagram diagram = basicGetDiagram();
    return diagram != null && diagram.eIsProxy() ? (Diagram)eResolveProxy((InternalEObject)diagram) : diagram;
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   */
  public Diagram basicGetDiagram()
  {
    for (EObject parent = this; parent != null; parent = ((InternalEObject)parent).eInternalContainer())
    {
      if (NotationPackage.Literals.DIAGRAM.isSuperTypeOf(parent.eClass()))
      {
        return (Diagram)parent;
      }
    }
    return null;
  }

  /**
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @generated
  */
  public EList getTransientChildren()
  {
    return (EList)eDynamicGet(NotationPackage.VIEW__TRANSIENT_CHILDREN - ESTATIC_FEATURE_COUNT, NotationPackage.Literals.VIEW__TRANSIENT_CHILDREN, true, true);
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   */
  public Style getStyle(EClass eClass)
  {
    if (eClass != null && NotationPackage.eINSTANCE.getStyle().isSuperTypeOf(eClass))
    {
      if (eClass.isSuperTypeOf(eClass()))
      {
        return (Style)this;
      }
      if (eIsSet(NotationPackage.Literals.VIEW__STYLES))
      {
        for (Iterator i = getStyles().iterator(); i.hasNext();)
        {
          Style style = (Style)i.next();
          if (style.eClass() == eClass || eClass.isInstance(style))
          {
            return style;
          }
        }
      }
    }
    return null;
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   */
  public Node createChild(EClass eClass)
  {
    Node newChild = (Node)eClass.getEPackage().getEFactoryInstance().create(eClass);
    getPersistedChildren().add(newChild);
    return newChild;
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   */
  public Style createStyle(EClass eClass)
  {
    Style newStyle = (Style)eClass.getEPackage().getEFactoryInstance().create(eClass);
    getStyles().add(newStyle);
    return newStyle;
  }

  /**
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  * @generated NOT
  */
  public NamedStyle getNamedStyle(EClass eClass, String name)
  {
    if (eClass != null && eIsSet(NotationPackage.Literals.VIEW__STYLES) && NotationPackage.eINSTANCE.getNamedStyle().isSuperTypeOf(eClass))
    {
      for (Iterator i = getStyles().iterator(); i.hasNext();)
      {
        Style style = (Style)i.next();
        if (style.eClass() == eClass || eClass.isInstance(style))
        {
          if (style.eGet(NotationPackage.eINSTANCE.getNamedStyle_Name()).equals(name))
          {
            return (NamedStyle)style;
          }
        }
      }
    }
    return null;
  }

  /**
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @generated
  */
  @Override
  public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
    case NotationPackage.VIEW__EANNOTATIONS:
      return ((InternalEList)getEAnnotations()).basicAdd(otherEnd, msgs);
    case NotationPackage.VIEW__SOURCE_EDGES:
      return ((InternalEList)getSourceEdges()).basicAdd(otherEnd, msgs);
    case NotationPackage.VIEW__TARGET_EDGES:
      return ((InternalEList)getTargetEdges()).basicAdd(otherEnd, msgs);
    }
    return eDynamicInverseAdd(otherEnd, featureID, msgs);
  }

  /**
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @generated
  */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
    case NotationPackage.VIEW__EANNOTATIONS:
      return ((InternalEList)getEAnnotations()).basicRemove(otherEnd, msgs);
    case NotationPackage.VIEW__SOURCE_EDGES:
      return ((InternalEList)getSourceEdges()).basicRemove(otherEnd, msgs);
    case NotationPackage.VIEW__TARGET_EDGES:
      return ((InternalEList)getTargetEdges()).basicRemove(otherEnd, msgs);
    case NotationPackage.VIEW__PERSISTED_CHILDREN:
      return ((InternalEList)getPersistedChildren()).basicRemove(otherEnd, msgs);
    case NotationPackage.VIEW__STYLES:
      return ((InternalEList)getStyles()).basicRemove(otherEnd, msgs);
    case NotationPackage.VIEW__TRANSIENT_CHILDREN:
      return ((InternalEList)getTransientChildren()).basicRemove(otherEnd, msgs);
    }
    return eDynamicInverseRemove(otherEnd, featureID, msgs);
  }

  /**
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @generated
  */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
    case NotationPackage.VIEW__EANNOTATIONS:
      return getEAnnotations();
    case NotationPackage.VIEW__VISIBLE:
      return isVisible() ? Boolean.TRUE : Boolean.FALSE;
    case NotationPackage.VIEW__TYPE:
      return getType();
    case NotationPackage.VIEW__MUTABLE:
      return isMutable() ? Boolean.TRUE : Boolean.FALSE;
    case NotationPackage.VIEW__SOURCE_EDGES:
      return getSourceEdges();
    case NotationPackage.VIEW__TARGET_EDGES:
      return getTargetEdges();
    case NotationPackage.VIEW__PERSISTED_CHILDREN:
      return getPersistedChildren();
    case NotationPackage.VIEW__STYLES:
      return getStyles();
    case NotationPackage.VIEW__ELEMENT:
      if (resolve)
      {
        return getElement();
      }
      return basicGetElement();
    case NotationPackage.VIEW__DIAGRAM:
      if (resolve)
      {
        return getDiagram();
      }
      return basicGetDiagram();
    case NotationPackage.VIEW__TRANSIENT_CHILDREN:
      return getTransientChildren();
    }
    return eDynamicGet(featureID, resolve, coreType);
  }

  /**
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @generated
  */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
    case NotationPackage.VIEW__EANNOTATIONS:
      getEAnnotations().clear();
      getEAnnotations().addAll((Collection)newValue);
      return;
    case NotationPackage.VIEW__VISIBLE:
      setVisible(((Boolean)newValue).booleanValue());
      return;
    case NotationPackage.VIEW__TYPE:
      setType((String)newValue);
      return;
    case NotationPackage.VIEW__MUTABLE:
      setMutable(((Boolean)newValue).booleanValue());
      return;
    case NotationPackage.VIEW__SOURCE_EDGES:
      getSourceEdges().clear();
      getSourceEdges().addAll((Collection)newValue);
      return;
    case NotationPackage.VIEW__TARGET_EDGES:
      getTargetEdges().clear();
      getTargetEdges().addAll((Collection)newValue);
      return;
    case NotationPackage.VIEW__PERSISTED_CHILDREN:
      getPersistedChildren().clear();
      getPersistedChildren().addAll((Collection)newValue);
      return;
    case NotationPackage.VIEW__STYLES:
      getStyles().clear();
      getStyles().addAll((Collection)newValue);
      return;
    case NotationPackage.VIEW__ELEMENT:
      setElement((EObject)newValue);
      return;
    case NotationPackage.VIEW__TRANSIENT_CHILDREN:
      getTransientChildren().clear();
      getTransientChildren().addAll((Collection)newValue);
      return;
    }
    eDynamicSet(featureID, newValue);
  }

  /**
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @generated
  */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
    case NotationPackage.VIEW__EANNOTATIONS:
      getEAnnotations().clear();
      return;
    case NotationPackage.VIEW__VISIBLE:
      setVisible(VISIBLE_EDEFAULT);
      return;
    case NotationPackage.VIEW__TYPE:
      setType(TYPE_EDEFAULT);
      return;
    case NotationPackage.VIEW__MUTABLE:
      setMutable(MUTABLE_EDEFAULT);
      return;
    case NotationPackage.VIEW__SOURCE_EDGES:
      getSourceEdges().clear();
      return;
    case NotationPackage.VIEW__TARGET_EDGES:
      getTargetEdges().clear();
      return;
    case NotationPackage.VIEW__PERSISTED_CHILDREN:
      getPersistedChildren().clear();
      return;
    case NotationPackage.VIEW__STYLES:
      getStyles().clear();
      return;
    case NotationPackage.VIEW__ELEMENT:
      unsetElement();
      return;
    case NotationPackage.VIEW__TRANSIENT_CHILDREN:
      getTransientChildren().clear();
      return;
    }
    eDynamicUnset(featureID);
  }

  /**
  * <!-- begin-user-doc --> <!-- end-user-doc -->
  * @generated
  */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
    case NotationPackage.VIEW__EANNOTATIONS:
      return !getEAnnotations().isEmpty();
    case NotationPackage.VIEW__VISIBLE:
      return isVisible() != VISIBLE_EDEFAULT;
    case NotationPackage.VIEW__TYPE:
      return TYPE_EDEFAULT == null ? getType() != null : !TYPE_EDEFAULT.equals(getType());
    case NotationPackage.VIEW__MUTABLE:
      return isMutable() != MUTABLE_EDEFAULT;
    case NotationPackage.VIEW__SOURCE_EDGES:
      return !getSourceEdges().isEmpty();
    case NotationPackage.VIEW__TARGET_EDGES:
      return !getTargetEdges().isEmpty();
    case NotationPackage.VIEW__PERSISTED_CHILDREN:
      return !getPersistedChildren().isEmpty();
    case NotationPackage.VIEW__STYLES:
      return !getStyles().isEmpty();
    case NotationPackage.VIEW__ELEMENT:
      return isSetElement();
    case NotationPackage.VIEW__DIAGRAM:
      return basicGetDiagram() != null;
    case NotationPackage.VIEW__TRANSIENT_CHILDREN:
      return !getTransientChildren().isEmpty();
    }
    return eDynamicIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   */
  public void persistChildren()
  {
    if (eIsSet(NotationPackage.VIEW__TRANSIENT_CHILDREN))
    {
      getPersistedChildren().addAll(getTransientChildren());
    }
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   */
  public void insertChild(View child)
  {
    persistChildren();
    getPersistedChildren().add(child);
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   */
  public void insertChildAt(View child, int index)
  {
    persistChildren();
    if (getPersistedChildren().size() >= index)
    {
      getPersistedChildren().add(index, child);
    }
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   */
  public void insertChild(View child, boolean persisted)
  {
    List children = null;
    if (persisted)
    {
      children = getPersistedChildren();
    }
    else
    {
      children = getTransientChildren();
    }
    children.add(child);
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   */
  public void removeChild(View child)
  {
    if (child.eContainer() == this)
    {
      EStructuralFeature eContainingFeature = child.eContainingFeature();
      if (eContainingFeature == NotationPackage.Literals.VIEW__TRANSIENT_CHILDREN)
      {
        getTransientChildren().remove(child);
      }
      else if (eContainingFeature == NotationPackage.Literals.VIEW__PERSISTED_CHILDREN)
      {
        getPersistedChildren().remove(child);
      }
    }
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   */
  public void persist()
  {
    EObject eContainer = eContainer();
    if (eContainer instanceof View)
    {
      EStructuralFeature eContaingFeature = eContainingFeature();
      if (eContaingFeature != null && eContaingFeature.isTransient())
      {
        View vContainer = (View)eContainer;
        vContainer.persistChildren();
      }
    }
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   */
  public EList getVisibleChildren()
  {
    boolean persistedChildrenSet = eIsSet(NotationPackage.VIEW__PERSISTED_CHILDREN);
    boolean transientChildrenSet = eIsSet(NotationPackage.VIEW__TRANSIENT_CHILDREN);

    if (!persistedChildrenSet && !transientChildrenSet)
    {
      return ECollections.EMPTY_ELIST;
    }

    List _children = new ArrayList();
    if (persistedChildrenSet)
    {
      EList persistedChildren = getPersistedChildren();
      for (Iterator iter = persistedChildren.iterator(); iter.hasNext();)
      {
        View view = (View)iter.next();
        if (view.isVisible())
        {
          _children.add(view);
        }
      }
    }

    if (transientChildrenSet)
    {
      EList transientChildren = getTransientChildren();
      for (Iterator iter = transientChildren.iterator(); iter.hasNext();)
      {
        View view = (View)iter.next();
        if (view.isVisible())
        {
          _children.add(view);
        }
      }
    }

    return new BasicEList.UnmodifiableEList(_children.size(), _children.toArray());
  }

} // ViewImpl

Back to the top