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