/** * Returns a read-only Map that maps PhysicalBody names to instances. * Names may be aliases and if so will map to the original instances. * * @return read-only Map from names to PhysicalBody instances, or null if * no instances */ public Map getNamedPhysicalBodies() { if (bodyMap != null) return bodyMap ; bodyMap = createMap("PhysicalBody") ; return bodyMap ; }
/** * Returns a read-only Set of all configured Viewer instances in the order * they were defined in the configuration file. The Viewers will have * incorporated any PhysicalEnvironment and PhysicalBody objects specfied * for them in the configuration file, and will be attached to any * ViewingPlatforms specified for them.<p> * * Viewer instances are created with the following command:<p> * <blockquote> * (NewView <i><instance name></i> [Alias <i><alias name></i>]) * </blockquote> * * The Viewer is configured through the following command:<p> * <blockquote> * (ViewProperty <i><instance name> * <property name> <property value></i>) * </blockquote> * * @return read-only Set of all unique instances, or null */ public Set getViewers() { if (viewers != null) return viewers ; viewers = createSet("View") ; return viewers ; }
co = createConfigObject(cmd) ; addConfigObject(co) ; break ; case ConfigCommand.ALIAS: co = createConfigAlias(cmd) ; addConfigObject(co) ; break ; case ConfigCommand.PROPERTY: co = findConfigObject(cmd.baseName, cmd.instanceName) ; co.setProperty(cmd) ; break ; throw new IllegalArgumentException(e.toString()) ; loadConfig(url) ; break ; case ConfigCommand.IGNORE:
configContainer = new ConfigContainer (userConfig, setVisible, transformCount, false); Collection c = configContainer.getViewers(); if (c == null || c.size() == 0) throw new IllegalArgumentException( c = configContainer.findConfigObjects("ViewPlatform"); if (c == null || c.size() == 0) { createDefaultViewingPlatform(transformCount);
/** * Instantiate and initialize a ConfigObject base class containing alias * information. The command is of the form:<p> * * ({baseName}Alias {aliasName} {originalName}) * * @param cmd configuration command that creates a new alias * @return the new ConfigObject with alias information */ private ConfigObject createConfigAlias(ConfigCommand cmd) { ConfigObject original ; if (cmd.argc != 3 || ! (cmd.argv[2] instanceof String)) throw new IllegalArgumentException ("Command \"" + cmd.commandName + "\" requires an instance name as second argument") ; original = findConfigObject(cmd.baseName, (String)cmd.argv[2]) ; return new ConfigAlias(cmd.baseName, cmd.instanceName, original) ; }
argv[a] = configContainer.evaluateBuiltIn(bcmd) ;
((String)cmd.argv[i]).equals("Alias")) { if (i == (cmd.argc - 2) && cmd.argv[i+1] instanceof String) { addConfigObject(new ConfigAlias(cmd.baseName, (String)cmd.argv[i+1], configObject)) ;
/** * Cleanup memory references used by ConfiguredUniverse. * @since Java 3D 1.3.1 */ @Override public void cleanup() { if (viewer != null) { for (int i = 0 ; i < viewer.length ; i++) { viewer[i].getView().removeAllCanvas3Ds(); viewer[i].setViewingPlatform(null); viewer[i] = null; } } locale = null; removeAllLocales(); configContainer.clear(); configContainer = null; } }
try { if (level == 0) { configContainer.evaluateCommand(elements, st.lineno()) ;
return ((ConfigScreen)findConfigObject("Screen", cmd)).j3dCanvas ; return findConfigObject(cmd.commandName, cmd).targetObject ;
/** * Returns a read-only Map that maps generic object names to * instances. Names may be aliases and if so will map to the original * instances. * * @return read-only Map from names to generic object instances, or * null if no instances * @see #getGenericObjects */ public Map getNamedGenericObjects() { if (genericObjectMap != null) return genericObjectMap ; genericObjectMap = createMap("Object") ; return genericObjectMap ; }
/** * Returns the ConfigObject associated with the name in the given * ConfigCommand. This is used for evaluating retained built-in commands * after the config file has already been parsed. The parser won't catch * any of the exceptions generated by this method, so the error messages * are wrapped accordingly. * * @param basename base name of the config object * @param cmd command containing the name in argv[1] * @return the found ConfigObject */ private ConfigObject findConfigObject(String baseName, ConfigCommand cmd) { if (cmd.argc != 2 || !(cmd.argv[1] instanceof String)) throw new IllegalArgumentException (ConfigObject.errorMessage (cmd, "Parameter must be a single string")) ; try { return findConfigObject(baseName, (String)cmd.argv[1]) ; } catch (IllegalArgumentException e) { throw new IllegalArgumentException (ConfigObject.errorMessage(cmd, e.getMessage())) ; } }
/** * Returns a read-only Set of all configured PhysicalEnvironment instances * in the order they were defined in the configuration file.<p> * * PhysicalEnvironment instances are created with the following command:<p> * <blockquote> * (NewPhysicalEnvironment <i><instance name></i> * [Alias <i><alias name></i>]) * </blockquote> * * The PhysicalEnvironment is configured through the following command:<p> * <blockquote> * (PhysicalEnvironmentProperty <i><instance name> * <property name> <property value></i>) * </blockquote> * * @return read-only Set of all unique instances, or null */ public Set getPhysicalEnvironments() { if (environments != null) return environments ; environments = createSet("PhysicalEnvironment") ; return environments ; }
/** * Returns a read-only Map that maps PhysicalEnvironment names to * instances. Names may be aliases and if so will map to the original * instances. * * @return read-only Map from names to PhysicalEnvironment instances, or * null if no instances */ public Map getNamedPhysicalEnvironments() { if (environmentMap != null) return environmentMap ; environmentMap = createMap("PhysicalEnvironment") ; return environmentMap ; }
ConfigView cv = (ConfigView)findConfigObject("View", viewName) ; Iterator i = cv.screens.iterator() ; while (i.hasNext()) {
/** * Returns a read-only Set of all configured PhysicalBody instances in the * order they were defined in the configuration file. * * PhysicalBody instances are created with the following command:<p> * <blockquote> * (NewPhysicalBody <i><instance name></i> * [Alias <i><alias name></i>]) * </blockquote> * * The PhysicalBody is configured through the following command:<p> * <blockquote> * (PhysicalBodyProperty <i><instance name> * <property name> <property value></i>) * </blockquote> * * @return read-only Set of all unique instances, or null */ public Set getPhysicalBodies() { if (bodies != null) return bodies ; bodies = createSet("PhysicalBody") ; return bodies ; }
/** * Returns a read-only Map that maps InputDevice names to instances. * Names may be aliases and if so will map to the original instances. All * InputDevice instances in the map are initialized and registered with * any PhysicalEnvironments that reference them. * * @return read-only Map from names to InputDevice instances, or * null if no instances * @see #getInputDevices */ public Map getNamedInputDevices() { if (deviceMap != null) return deviceMap ; deviceMap = createMap("Device") ; return deviceMap ; }
/** * Handles the command * (NewSensor {instanceName} {inputDeviceName} {indexInInputDevice}) * * @param command the command that invoked this method */ @Override protected void initialize(ConfigCommand command) { int argc = command.argc ; Object[] argv = command.argv ; // Check that arg[1] and arg[2] are strings, arg[3] a number if (argc != 4) { syntaxError("Incorrect number of arguments to " + command.commandName) ; } if (!isName(argv[2])) { syntaxError("The second argument to " + command.commandName + " must be the device name") ; } if (!(argv[3] instanceof Double)) { syntaxError("The third argument to " + command.commandName + " must be a sensor index") ; } sensorIndex = ((Double)argv[3]).intValue() ; configDevice = (ConfigDevice)configContainer.findConfigObject ("Device", (String)argv[2]) ; }
/** * Returns a read-only Set of all configured ViewingPlatform instances in * the order they were defined in the configuration file. The * ConfigContainer class itself does not attach the ViewingPlatform * instances to any scengraph components or universe Locales; they are not * "live" until made so by a separate client such as ConfiguredUniverse. * * ViewingPlatform instances are created with the following command:<p> * <blockquote> * (NewViewPlatform <i><instance name></i> * [Alias <i><alias name></i>]) * </blockquote> * * The ViewingPlatform is configured through the following command:<p> * <blockquote> * (ViewPlatformProperty <i><instance name> <property name> * <property value></i>) * </blockquote> * * @return read-only Set of all unique instances, or null */ public Set getViewingPlatforms() { if (platforms != null) return platforms ; platforms = createSet("ViewPlatform") ; return platforms ; }
/** * Returns a read-only Map that maps Viewer names to instances. * Names may be aliases and if so will map to the original instances. * The Viewers will have incorporated any PhysicalEnvironment and * PhysicalBody objects specfied for them in the configuration file, and * will be attached to any ViewingPlatforms specified for them.<p> * * @return read-only Map from names to Viewer instances, or * null if no instances */ public Map getNamedViewers() { if (viewerMap != null) return viewerMap ; viewerMap = createMap("View") ; return viewerMap ; }