Changeset 162 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder


Ignore:
Timestamp:
12/04/2019 02:49:34 PM (6 years ago)
Author:
sdanthin
Message:

TimeSlice?.java added a function to remove a corresponding audio event given an I_AudioEvent type

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/scriptbuilder/structures/TimeSlice.java

    r152 r162  
    320320        } 
    321321    } 
     322    /** 
     323     * this method removes an audioevent that corresponds to the input I_AudioEvent. NEEDS VERIFICATION 
     324     */ 
     325    public void removeCorrespondingAudioEvent(I_AudioEvent comparisonEvent){ 
     326        String id = comparisonEvent.getFileName().split("/")[1]; 
     327        for(I_ScriptEvent event : events) 
     328        { 
     329            if(event instanceof AudioEvent) 
     330            { 
     331                System.out.println("removed an audioevent \n" + ((AudioEvent)event).audioPath.split("/")[2].substring(0,((AudioEvent)event).audioPath.split("/")[2].length() - 4)); 
     332                System.out.println(id); 
     333                System.out.println(id.equals(((AudioEvent)event).audioPath.split("/")[2].substring(0,((AudioEvent)event).audioPath.split("/")[2].length() - 4))); 
     334 
     335                if(id.equals(((AudioEvent)event).audioPath.split("/")[2].substring(0,((AudioEvent)event).audioPath.split("/")[2].length() - 4))) 
     336                { 
     337                    System.out.println("the event was deleted"); 
     338                    events.remove(event); 
     339                } 
     340                 
     341            } 
     342        } 
     343    } 
     344    public AudioEvent getCorrespondingAudioEvent(I_AudioEvent compariosonEvent) 
     345    { 
     346        String id = compariosonEvent.getFileName(); 
     347        AudioEvent retVal = null; 
     348        for(I_ScriptEvent event: events) 
     349        { 
     350            if(event instanceof AudioEvent && ((AudioEvent)event).audioPath.split("/")[2].equals(id)) 
     351            { 
     352                retVal = (AudioEvent) event; 
     353            } 
     354        } 
     355        return retVal; 
     356    } 
    322357} 
Note: See TracChangeset for help on using the changeset viewer.