Coverage Report - org.mule.module.launcher.util.ElementEvent
 
Classes in this File Line Coverage Branch Coverage Complexity
ElementEvent
0%
0/19
0%
0/14
0
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.module.launcher.util;
 8  
 
 9  
 import java.beans.PropertyChangeEvent;
 10  
 
 11  
 /**
 12  
 *
 13  
 */
 14  
 public abstract class ElementEvent<E> extends PropertyChangeEvent {
 15  
 
 16  
     public static final int ADDED = 0;
 17  
     public static final int UPDATED = 1;
 18  
     public static final int REMOVED = 2;
 19  
     public static final int CLEARED = 3;
 20  
     public static final int MULTI_ADD = 4;
 21  
     public static final int MULTI_REMOVE = 5;
 22  
 
 23  
     private static final String PROPERTY_NAME = "ObservableList__element";
 24  0
     protected static final Object OLDVALUE = new Object();
 25  0
     protected static final Object NEWVALUE = new Object();
 26  
 
 27  
     private int type;
 28  
     private int index;
 29  
 
 30  
     public ElementEvent(Object source, Object oldValue, Object newValue, int index, int type) {
 31  0
         super(source, PROPERTY_NAME, oldValue, newValue);
 32  0
         switch (type) {
 33  
             case ADDED:
 34  
             case UPDATED:
 35  
             case REMOVED:
 36  
             case CLEARED:
 37  
             case MULTI_ADD:
 38  
             case MULTI_REMOVE:
 39  0
                 this.type = type;
 40  0
                 break;
 41  
             default:
 42  0
                 this.type = UPDATED;
 43  
                 break;
 44  
         }
 45  0
         this.index = index;
 46  0
     }
 47  
 
 48  
     public int getIndex() {
 49  0
         return index;
 50  
     }
 51  
 
 52  
     public int getType() {
 53  0
         return type;
 54  
     }
 55  
 
 56  
     public String getTypeAsString() {
 57  0
         switch (type) {
 58  
             case ADDED:
 59  0
                 return "ADDED";
 60  
             case UPDATED:
 61  0
                 return "UPDATED";
 62  
             case REMOVED:
 63  0
                 return "REMOVED";
 64  
             case CLEARED:
 65  0
                 return "CLEARED";
 66  
             case MULTI_ADD:
 67  0
                 return "MULTI_ADD";
 68  
             case MULTI_REMOVE:
 69  0
                 return "MULTI_REMOVE";
 70  
             default:
 71  0
                 return "UPDATED";
 72  
         }
 73  
     }
 74  
 }