1 7 8 package com.sun.corba.se.impl.interceptors; 9 10 import com.sun.corba.se.impl.corba.AnyImpl; 11 import com.sun.corba.se.spi.orb.ORB; 12 import org.omg.PortableInterceptor.Current ; 13 import org.omg.PortableInterceptor.InvalidSlot ; 14 import org.omg.CORBA.Any ; 15 16 19 public class SlotTable { 20 private Any [] theSlotData; 22 23 private ORB orb; 25 26 private boolean dirtyFlag; 29 30 34 SlotTable( ORB orb, int slotSize ) { 35 dirtyFlag = false; 36 this.orb = orb; 37 theSlotData = new Any [slotSize]; 38 } 39 40 43 public void set_slot( int id, Any data ) throws InvalidSlot 44 { 45 if( id >= theSlotData.length ) { 48 throw new InvalidSlot (); 49 } 50 dirtyFlag = true; 51 theSlotData[id] = data; 52 } 53 54 57 public Any get_slot( int id ) throws InvalidSlot 58 { 59 if( id >= theSlotData.length ) { 62 throw new InvalidSlot (); 63 } 64 if( theSlotData[id] == null ) { 65 theSlotData [id] = new AnyImpl(orb); 66 } 67 return theSlotData[ id ]; 68 } 69 70 71 74 void resetSlots( ) { 75 if( dirtyFlag == true ) { 76 for( int i = 0; i < theSlotData.length; i++ ) { 77 theSlotData[i] = null; 78 } 79 } 80 } 81 82 85 int getSize( ) { 86 return theSlotData.length; 87 } 88 89 } 90 91 | Popular Tags |