001package jmri.jmrit.logixng; 002 003import java.util.List; 004import java.util.Map; 005 006import jmri.Manager; 007 008/** 009 * Manager for ConditionalNG 010 * 011 * @author Dave Duchamp Copyright (C) 2007 012 * @author Daniel Bergqvist Copyright (C) 2018 013 * @author Dave Sand Copyright (C) 2021 014 */ 015public interface ConditionalNG_Manager extends Manager<ConditionalNG> { 016 017 /** 018 * Create a new ConditionalNG if the ConditionalNG does not exist. 019 * 020 * @param logixNG The parent LogixNG 021 * @param systemName The system name 022 * @param userName The user name 023 * @return a new ConditionalNG or null if unable to create 024 */ 025 public ConditionalNG createConditionalNG(LogixNG logixNG, String systemName, String userName) 026 throws IllegalArgumentException; 027 028 /** 029 * For use with User GUI, to allow the auto generation of systemNames, where 030 * the user can optionally supply a username. 031 * 032 * @param logixNG The parent LogixNG 033 * @param userName The user name 034 * @return a new ConditionalNG or null if unable to create 035 */ 036 public ConditionalNG createConditionalNG(LogixNG logixNG, String userName) 037 throws IllegalArgumentException; 038 039 /** 040 * Create a new ConditionalNG if the ConditionalNG does not exist. 041 * 042 * @param logixNG The parent LogixNG 043 * @param systemName The system name 044 * @param userName The user name 045 * @param threadID The thread ID that this ConditionalNG will execute on 046 * @return a new ConditionalNG or null if unable to create 047 */ 048 public ConditionalNG createConditionalNG( 049 LogixNG logixNG, String systemName, String userName, int threadID) 050 throws IllegalArgumentException; 051 052 /** 053 * For use with User GUI, to allow the auto generation of systemNames, where 054 * the user can optionally supply a username. 055 * 056 * @param logixNG The parent LogixNG 057 * @param userName The user name 058 * @param threadID The thread ID that this ConditionalNG will execute on 059 * @return a new ConditionalNG or null if unable to create 060 */ 061 public ConditionalNG createConditionalNG(LogixNG logixNG, String userName, int threadID) 062 throws IllegalArgumentException; 063 064 /** 065 * Locate via user name using the LogixNG, then system name if needed. Does not create a new 066 * one if nothing found 067 * 068 * @param logixNG The LogixNG for the user name match. If null, only do a system name match. 069 * @param name User name or system name to match 070 * @return null if no match found 071 */ 072 public ConditionalNG getConditionalNG(LogixNG logixNG, String name); 073 074 /** 075 * Find the LogixNG which has the ConditionalNG system name in its ConditionalNG_Entry list. 076 * @param systemName The ConditionalNG system name. 077 * @return the parent LogixNG or null if none found. 078 */ 079 public LogixNG getParentLogixNG(String systemName); 080 081 /** 082 * Find the ConditionalNG which is a member of the LogixNG with the supplied user name. 083 * @param logixNG The LogixNG that contains the requested ConditionalNG. 084 * @param name The requested ConditionalNG user name. 085 * @return the ConditionalNG or null if none found. 086 */ 087 public ConditionalNG getByUserName(LogixNG logixNG, String name); 088 089 /** {@inheritDoc} */ 090 @Override 091 public ConditionalNG getByUserName(String name); 092 093 /** {@inheritDoc} */ 094 @Override 095 public ConditionalNG getBySystemName(String name); 096 097 /** 098 * {@inheritDoc} 099 * 100 * The sub system prefix for the ConditionalNG_Manager is 101 * {@link #getSystemNamePrefix() } and "C"; 102 */ 103 @Override 104 public default String getSubSystemNamePrefix() { 105 return getSystemNamePrefix() + "C"; 106 } 107 108 /** 109 * Create a new system name for a ConditionalNG. 110 * @return a new system name 111 */ 112 public String getAutoSystemName(); 113 114 /** 115 * Delete ConditionalNG by removing it from the manager. The ConditionalNG must first 116 * be deactivated so it stops processing. 117 * 118 * @param x the ConditionalNG to delete 119 */ 120 void deleteConditionalNG(ConditionalNG x); 121 122 /** 123 * Support for loading ConditionalNGs in a disabled state 124 * 125 * @param s true if ConditionalNG should be disabled when loaded 126 */ 127 public void setLoadDisabled(boolean s); 128 129 /** 130 * Set whenether execute() should run on the GUI thread at once or should 131 * dispatch the call until later, for all ConditionalNGs registered in this 132 * manager. 133 * Most tests turns off the delay to simplify the tests. 134 * @param value true if execute() should run on GUI thread delayed, 135 * false otherwise. 136 */ 137 public void setRunOnGUIDelayed(boolean value); 138 139}