package ConformanceNist.Sounds.Sound;

/*
Copyright (c) 1995-2017 held by the author(s).  All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer
      in the documentation and/or other materials provided with the
      distribution.
    * Neither the name of the Web3D Consortium (http://www.web3D.org)
      nor the names of its contributors may be used to endorse or
      promote products derived from this software without specific
      prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/

import java.util.*;
import org.web3d.x3d.jsail.Core.*;
import org.web3d.x3d.jsail.EnvironmentalSensor.*;
import org.web3d.x3d.jsail.fields.*;
import org.web3d.x3d.jsail.Geometry3D.*;
import org.web3d.x3d.jsail.Grouping.*;
import org.web3d.x3d.jsail.Interpolation.*;
import org.web3d.x3d.jsail.Navigation.*;
import org.web3d.x3d.jsail.PointingDeviceSensor.*;
import org.web3d.x3d.jsail.Scripting.*;
import org.web3d.x3d.jsail.Shape.*;
import org.web3d.x3d.jsail.Sound.*;
import org.web3d.x3d.jsail.Text.*;
import org.web3d.x3d.jsail.Time.*;

// Javadoc annotations follow, see below for source.
/**
 * <p> Test Switching of sounds. A "chime" sounding Sound node is initially a "switched out" child of a Switch node in this world. If the viewer clicks on the "Switch in" button in this world, the Sound child is switched in as a child of the Switch node, and should begin to play. If the viewer clicks on the "Switch out" button while the Sound is playing, the sound should cease. However, the Sound node should continue to send and receive events, and as a result, the "phonograph" geometry continue to remain a yellow color, indicating that the Sound node isActive field is still true, even though the Sound is no longer audible. </p>
 <p> Related links: <a href="../../../../Sounds/Sound/switchsounds.java">switchsounds.java</a> source, <a href="../../../../Sounds/Sound/switchsoundsIndex.html" target="_top">switchsounds catalog page</a>, <a href="http://www.web3d.org/x3d/content/examples/X3dResources.html" target="_blank">X3D Resources</a>, <a href="http://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html" target="_blank">X3D Scene Authoring Hints</a> and <a href="http://www.web3d.org/x3d/content/X3dTooltips.html" target="_blank">X3D Tooltips</a>. </p>
	<table style="color:black; border:0px solid; border-spacing:10px 0px;" summary="Scene Metadata">
		<tr style="background-color:silver; border-color:silver;">
			<td style="text-align:center; padding:10px 0px;"><i>meta tags</i></td>
			<td style="text-align:left;   padding:10px 0px;">&nbsp; Document Metadata </td>
		</tr>

		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> title </i> </td>
			<td> <a href="../../../../Sounds/Sound/switchsounds.x3d">switchsounds.x3d</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> MovingImage </i> </td>
			<td> <a href="../../../../Sounds/Sound/switch-movie.mpg">switch-movie.mpg</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> reference </i> </td>
			<td> <a href="http://www.nist.gov/vrml.html" target="_blank">http://www.nist.gov/vrml.html</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> reference </i> </td>
			<td> <a href="http://www.itl.nist.gov/div897/ctg/vrml/vrml.html" target="_blank">http://www.itl.nist.gov/div897/ctg/vrml/vrml.html</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> creator </i> </td>
			<td> <a href="http://www.itl.nist.gov/div897/ctg/vrml/members.html" target="_blank">http://www.itl.nist.gov/div897/ctg/vrml/members.html</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> disclaimer </i> </td>
			<td> This file was provided by the National Institute of Standards and Technology, and is part of the X3D Conformance Test Suite, available at <a href="http://www.nist.gov/vrml.html" target="_blank">http://www.nist.gov/vrml.html</a> The information contained within this file is provided for use in establishing conformance to the ISO VRML97 Specification. Conformance to this test does not imply recommendation or endorsement by the National Institute of Standards and Technology. This software can be redistributed and/or modified freely provided that any derivative works bear some notice that they are derived from it, and any modified versions bear some notice that they have been modified. </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> info </i> </td>
			<td> Correct definition and compliance of this conformance scene is maintained by the X3D Working Group, <a href="http://www.web3d.org/working-groups/x3d" target="_blank">http://www.web3d.org/working-groups/x3d</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> translator </i> </td>
			<td> Michael Kass NIST, Don Brutzman NPS </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> translated </i> </td>
			<td> 21 January 2001 </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> modified </i> </td>
			<td> 15 April 2017 </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> description </i> </td>
			<td> Test Switching of sounds. A "chime" sounding Sound node is initially a "switched out" child of a Switch node in this world. If the viewer clicks on the "Switch in" button in this world, the Sound child is switched in as a child of the Switch node, and should begin to play. If the viewer clicks on the "Switch out" button while the Sound is playing, the sound should cease. However, the Sound node should continue to send and receive events, and as a result, the "phonograph" geometry continue to remain a yellow color, indicating that the Sound node isActive field is still true, even though the Sound is no longer audible. </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> identifier </i> </td>
			<td> <a href="http://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/Sound/switchsounds.x3d" target="_blank">http://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/Sound/switchsounds.x3d</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> generator </i> </td>
			<td> Vrml97ToX3dNist, <a href="http://ovrt.nist.gov/v2_x3d.html" target="_blank">http://ovrt.nist.gov/v2_x3d.html</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> generator </i> </td>
			<td> X3D-Edit 3.3, <a href="https://savage.nps.edu/X3D-Edit" target="_blank">https://savage.nps.edu/X3D-Edit</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> license </i> </td>
			<td> <a href="../../../../Sounds/Sound/../../license.html">../../license.html</a> </td>
		</tr>
		<tr style="background-color:silver; border-color:silver;">
			<td style="text-align:center;" colspan="2">  &nbsp; </td>
		</tr>
	</table>

	<p>
		This program uses the
		<a href="http://www.web3d.org/specifications/java/X3DJSAIL.html" target="_blank">X3D Java Scene Access Interface Library (X3DJSAIL)</a>.
		It has been produced using the 
		<a href="http://www.web3d.org/x3d/stylesheets/X3dToJava.xslt" target="_blank">X3dToJava.xslt</a>
		stylesheet to create Java source code from an <code>.x3d</code> scene.
	</p>

	* @author http://www.itl.nist.gov/div897/ctg/vrml/members.html
 */

public class switchsounds
{
  /** Default constructor to create this object. */
  public switchsounds ()
  {
    initialize();
  }
	
  /** Create and initialize the X3D model. */
  public final void initialize()
  {
  x3dModel = new X3DObject().setProfile("Immersive").setVersion("3.0")
  .setHead(new headObject()
    .addMeta(new metaObject().setName("title").setContent("switchsounds.x3d"))
    .addMeta(new metaObject().setName("MovingImage").setContent("switch-movie.mpg"))
    .addMeta(new metaObject().setName("reference").setContent("http://www.nist.gov/vrml.html"))
    .addMeta(new metaObject().setName("reference").setContent("http://www.itl.nist.gov/div897/ctg/vrml/vrml.html"))
    .addMeta(new metaObject().setName("creator").setContent("http://www.itl.nist.gov/div897/ctg/vrml/members.html"))
    .addMeta(new metaObject().setName("disclaimer").setContent("This file was provided by the National Institute of Standards and Technology, and is part of the X3D Conformance Test Suite, available at http://www.nist.gov/vrml.html The information contained within this file is provided for use in establishing conformance to the ISO VRML97 Specification. Conformance to this test does not imply recommendation or endorsement by the National Institute of Standards and Technology. This software can be redistributed and/or modified freely provided that any derivative works bear some notice that they are derived from it, and any modified versions bear some notice that they have been modified."))
    .addMeta(new metaObject().setName("info").setContent("Correct definition and compliance of this conformance scene is maintained by the X3D Working Group, http://www.web3d.org/working-groups/x3d"))
    .addMeta(new metaObject().setName("translator").setContent("Michael Kass NIST, Don Brutzman NPS"))
    .addMeta(new metaObject().setName("translated").setContent("21 January 2001"))
    .addMeta(new metaObject().setName("modified").setContent("15 April 2017"))
    .addMeta(new metaObject().setName("description").setContent("Test Switching of sounds. A \"chime\" sounding Sound node is initially a \"switched out\" child of a Switch node in this world. If the viewer clicks on the \"Switch in\" button in this world, the Sound child is switched in as a child of the Switch node, and should begin to play. If the viewer clicks on the \"Switch out\" button while the Sound is playing, the sound should cease. However, the Sound node should continue to send and receive events, and as a result, the \"phonograph\" geometry continue to remain a yellow color, indicating that the Sound node isActive field is still true, even though the Sound is no longer audible."))
    .addMeta(new metaObject().setName("identifier").setContent("http://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/Sound/switchsounds.x3d"))
    .addMeta(new metaObject().setName("generator").setContent("Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html"))
    .addMeta(new metaObject().setName("generator").setContent("X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit"))
    .addMeta(new metaObject().setName("license").setContent("../../license.html")))
  .setScene(new SceneObject()
    .addChild(new ViewpointObject().setDescription("entry view").setPosition(0.0f,0.0f,5.0f))
    .addChild(new ProximitySensorObject("PROX_SENSOR").setSize(1000.0f,1000.0f,1000.0f))
    .addChild(new SwitchObject("MYSWITCH").setWhichChoice(-1)
      .addChild(new SoundObject()
        .setSource(new AudioClipObject("MYSOUND").setDescription("chimes").setLoop(true).setUrl(new MFStringObject("\"chimes.wav\" \"http://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/chimes.wav\"")))))
    .addChild(new TransformObject().setScale(0.5f,0.5f,0.5f)
      .addChild(new TransformObject().setTranslation(0.0f,-2.0f,0.0f)
        .addChild(new ShapeObject()
          .setAppearance(new AppearanceObject()
            .setMaterial(new MaterialObject("PHONOCOLOR")))
          .setGeometry(new BoxObject().setSize(3.0f,1.5f,3.0f))))
      .addChild(new TransformObject().setRotation(1.0f,0.0f,0.0f,-2.5f)
        .addChild(new ShapeObject()
          .setAppearance(new AppearanceObject()
            .setMaterial(new MaterialObject("HORNCOLOR")))
          .setGeometry(new ExtrusionObject().setSpine(Extrusion_6_29_spine).setOrientation(Extrusion_6_29_orientation).setCrossSection(Extrusion_6_29_crossSection).setCreaseAngle(1.57f).setScale(Extrusion_6_29_scale).setBeginCap(false).setEndCap(false).setSolid(false)))))
    .addChild(new TransformObject("START_TRANS")
      .addChild(new TransformObject().setTranslation(-3.0f,1.5f,-5.0f)
        .addChild(new ShapeObject()
          .setAppearance(new AppearanceObject()
            .setMaterial(new MaterialObject("GOMATERIAL").setDiffuseColor(0.0f,1.0f,0.0f).setAmbientIntensity(1f)))
          .setGeometry(new BoxObject("START").setSize(1.3f,1.0f,0.1f)))
        .addChild(new TransformObject().setTranslation(-0.45f,0.0f,0.2f)
          .addChild(new ShapeObject()
            .setAppearance(new AppearanceObject()
              .setMaterial(new MaterialObject().setDiffuseColor(0.0f,0.0f,0.0f).setAmbientIntensity(1f)))
            .setGeometry(new TextObject().setString(new MFStringObject("\"Switch\" \"in\""))
              .setFontStyle(new FontStyleObject().setSize(0.4f))))))
      .addChild(new TouchSensorObject("TOUCHSTART").setDescription("touch to start"))
      .addChild(new TimeSensorObject("GOTIMER"))
      .addChild(new ColorInterpolatorObject("GOFLASH").setKey(new float[] {0.0f,0.5f,1.0f}).setKeyValue(new MFColorObject(new float[] {0.0f,1.0f,0.0f,1.0f,1.0f,1.0f,0.0f,1.0f,0.0f}))))
    .addChild(new TransformObject("STOP_TRANS")
      .addChild(new TransformObject().setTranslation(3.0f,1.5f,-5.0f)
        .addChild(new ShapeObject()
          .setAppearance(new AppearanceObject()
            .setMaterial(new MaterialObject("STOPMATERIAL").setAmbientIntensity(1f).setDiffuseColor(1.0f,0.0f,0.0f)))
          .setGeometry(new BoxObject("STOP").setSize(1.3f,1.0f,0.1f)))
        .addChild(new TransformObject().setTranslation(-0.65f,0.0f,0.2f)
          .addChild(new ShapeObject()
            .setAppearance(new AppearanceObject()
              .setMaterial(new MaterialObject().setDiffuseColor(0.0f,0.0f,0.0f).setAmbientIntensity(1f)))
            .setGeometry(new TextObject().setString(new MFStringObject("\"Switch\" \"out\""))
              .setFontStyle(new FontStyleObject().setSize(0.4f))))))
      .addChild(new TouchSensorObject("TOUCHSTOP").setDescription("touch to stop"))
      .addChild(new TimeSensorObject("STOPTIMER"))
      .addChild(new ColorInterpolatorObject("STOPFLASH").setKey(new float[] {0.0f,0.5f,1.0f}).setKeyValue(new MFColorObject(new float[] {1.0f,0.0f,0.0f,1.0f,1.0f,1.0f,1.0f,0.0f,0.0f}))))
    .addChild(new ScriptObject("SOUND_SCRIPT").setDirectOutput(true).setUrl(new MFStringObject("\"switch.js\" \"http://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/Sound/switch.js\""))
      .addField(new fieldObject().setAccessType("initializeOnly").setName("mySwitch").setType("SFNode")
        .addChild(new SwitchObject().setUSE("MYSWITCH").setWhichChoice(-1)))
      .addField(new fieldObject().setAccessType("initializeOnly").setName("phonoColor").setType("SFNode")
        .addChild(new MaterialObject().setUSE("PHONOCOLOR")))
      .addField(new fieldObject().setAccessType("initializeOnly").setName("hornColor").setType("SFNode")
        .addChild(new MaterialObject().setUSE("HORNCOLOR")))
      .addField(new fieldObject().setAccessType("initializeOnly").setName("yellow").setType("SFColor").setValue("0.75 0.75 0.00"))
      .addField(new fieldObject().setAccessType("initializeOnly").setName("white").setType("SFColor").setValue("0.80 0.80 0.80"))
      .addField(new fieldObject().setAccessType("inputOnly").setName("colorPhonograph").setType("SFBool"))
      .addField(new fieldObject().setAccessType("inputOnly").setName("switchIn").setType("SFTime"))
      .addField(new fieldObject().setAccessType("inputOnly").setName("switchOut").setType("SFTime")))
    .addChild(new ROUTEObject().setFromNode("TOUCHSTART").setFromField("touchTime").setToNode("SOUND_SCRIPT").setToField("switchIn"))
    .addChild(new ROUTEObject().setFromNode("TOUCHSTOP").setFromField("touchTime").setToNode("SOUND_SCRIPT").setToField("switchOut"))
    .addChild(new ROUTEObject().setFromNode("PROX_SENSOR").setFromField("position_changed").setToNode("START_TRANS").setToField("set_translation"))
    .addChild(new ROUTEObject().setFromNode("PROX_SENSOR").setFromField("orientation_changed").setToNode("START_TRANS").setToField("set_rotation"))
    .addChild(new ROUTEObject().setFromNode("PROX_SENSOR").setFromField("position_changed").setToNode("STOP_TRANS").setToField("set_translation"))
    .addChild(new ROUTEObject().setFromNode("PROX_SENSOR").setFromField("orientation_changed").setToNode("STOP_TRANS").setToField("set_rotation"))
    .addChild(new ROUTEObject().setFromNode("MYSOUND").setFromField("isActive").setToNode("SOUND_SCRIPT").setToField("colorPhonograph"))
    .addChild(new ROUTEObject().setFromNode("TOUCHSTART").setFromField("touchTime").setToNode("GOTIMER").setToField("set_startTime"))
    .addChild(new ROUTEObject().setFromNode("GOTIMER").setFromField("fraction_changed").setToNode("GOFLASH").setToField("set_fraction"))
    .addChild(new ROUTEObject().setFromNode("GOFLASH").setFromField("value_changed").setToNode("GOMATERIAL").setToField("set_diffuseColor"))
    .addChild(new ROUTEObject().setFromNode("TOUCHSTOP").setFromField("touchTime").setToNode("STOPTIMER").setToField("set_startTime"))
    .addChild(new ROUTEObject().setFromNode("STOPTIMER").setFromField("fraction_changed").setToNode("STOPFLASH").setToField("set_fraction"))
    .addChild(new ROUTEObject().setFromNode("STOPFLASH").setFromField("value_changed").setToNode("STOPMATERIAL").setToField("set_diffuseColor")));
  }
  // end of initialize() method

	/** Large attribute array: Extrusion crossSection field, scene-graph level=6, element #29, 34 total numbers made up of 17 2-tuple values */
	private MFVec2fObject Extrusion_6_29_crossSection = new MFVec2fObject() /* splitting up long array to improve readability */
	.append(new MFVec2fObject(new float[] {1f,0f,0.92388f,0.382683f,0.707107f,0.707106f,0.382684f,0.923879f,1.26759e-006f,1f,-0.382682f,0.92388f,-0.707105f,0.707108f,-0.923879f,0.382685f,-1f,2.53518e-006f,-0.923881f,-0.382681f}))
	.append(new MFVec2fObject(new float[] {-0.707109f,-0.707105f,-0.382687f,-0.923878f,-3.80277e-006f,-1.0f,0.38268f,-0.923881f,0.707104f,-0.70711f,0.923878f,-0.382688f,1.0f,0.0f}));

	/** Large attribute array: Extrusion orientation field, scene-graph level=6, element #29, 60 total numbers made up of 15 4-tuple values */
	private MFRotationObject Extrusion_6_29_orientation = new MFRotationObject() /* splitting up long array to improve readability */
	.append(new MFRotationObject(new float[] {0.0f,0.0f,1.0f,0.0f,0.0f,0.0f,1.0f,0.0f,0.0f,0.0f,1.0f,0.0f,0.0f,0.0f,1.0f,0.0f,0.0f,0.0f,1.0f,0.0f,0.0f,0.0f,1.0f,0.0f,0.0f,0.0f,1.0f,0.0f,0.0f,0.0f,1.0f,0.0f,0.0f,0.0f,1.0f,0.0f,0.0f,0.0f,1.0f,0.0f}))
	.append(new MFRotationObject(new float[] {0.0f,0.0f,1.0f,0.0f,0.0f,0.0f,1.0f,0.0f,0.0f,0.0f,1.0f,0.0f,0.0f,0.0f,1.0f,0.0f,0.0f,0.0f,1.0f,0.0f}));

	/** Large attribute array: Extrusion scale field, scene-graph level=6, element #29, 30 total numbers made up of 15 2-tuple values */
	private MFVec2fObject Extrusion_6_29_scale = new MFVec2fObject() /* splitting up long array to improve readability */
	.append(new MFVec2fObject(new float[] {2.2f,2.2f,1.8f,1.8f,1.4f,1.4f,1.2f,1.2f,1.0f,1.0f,0.8f,0.8f,0.6f,0.6f,0.4f,0.4f,0.4f,0.4f,0.4f,0.4f}))
	.append(new MFVec2fObject(new float[] {0.4f,0.4f,0.4f,0.4f,0.4f,0.4f,0.2f,0.2f,0.0001f,0.0001f}));

	/** Large attribute array: Extrusion spine field, scene-graph level=6, element #29, 45 total numbers made up of 15 3-tuple values */
	private MFVec3fObject Extrusion_6_29_spine = new MFVec3fObject() /* splitting up long array to improve readability */
	.append(new MFVec3fObject(new float[] {0.0f,-1.4f,0.0f,0.0f,-1.22137f,0.0f,0.0f,-1.01245f,0.0f,0.0f,-0.819601f,0.0f,0.0f,-0.626754f,0.0f,0.0f,-0.401765f,0.0f,0.0f,-0.204459f,0.0f,0.0f,-0.0164327f,0.0f,0.0f,0.176777f,0.0f,0.0f,0.380511f,0.0f}))
	.append(new MFVec3fObject(new float[] {0.0f,0.578542f,0.0f,0.0f,0.819601f,0.0f,0.0f,0.996378f,0.0f,0.0f,1.8f,0.0f,0.0f,1.2f,0.0f}));

  /** The initialized model object, created within initialize() method. */
  private X3DObject x3dModel;
  
  /** Provide a shallow copy of the X3D model.
   * @return switchsounds model
   */
  public X3DObject getX3dModel()
  {	  
	  return x3dModel;
  }
  
  /** Indicate X3DJSAIL validation results for this X3D model.
   * @return validation results plus exception information, if any
   */
  public String validateSelf()
  {
	String       metaResult = new String();
	String validationResult = new String();
	String  exceptionResult = new String();
	try
	{
		initialize();
		
		if ((getX3dModel() == null) || (getX3dModel().getHead() == null))
		{
			validationResult = "empty scene, nothing to validate. " + x3dModel.validate();
			return validationResult;
		}
		// first list informational meta elements of interest
		for (metaObject meta : getX3dModel().getHead().getMetaList())
		{
			if (meta.getName().equals(metaObject.NAME_ERROR) ||
				meta.getName().equals(metaObject.NAME_WARNING) ||
				meta.getName().equals(metaObject.NAME_HINT) ||
				meta.getName().equals(metaObject.NAME_INFO) ||
				meta.getName().equals(metaObject.NAME_TODO))
			{
				metaResult += meta.toStringX3D();
			}
		}
		validationResult += x3dModel.validate(); // walk entire tree to validate correctness
	}
	catch (Exception e)
	{
		exceptionResult = e.getMessage(); // report exception failures, if any
	}
	if  (metaResult.isEmpty() && exceptionResult.isEmpty() && validationResult.isEmpty())
	     return "success";
	else
	{
		String returnMessage = metaResult;
		if  (!exceptionResult.isEmpty() && !validationResult.isEmpty())
			returnMessage += "\n*** ";
		returnMessage += exceptionResult;
		if  (exceptionResult.isEmpty() && !validationResult.isEmpty())
			returnMessage = "\n" + returnMessage; // skip line before meta tags, etc.
		returnMessage += validationResult;
		return returnMessage;
	}
  }
    /** Default main() method provided for test purposes.
     * @param argv input parameters
     */
    public static void main(String argv[])
    {
		switchsounds testObject = new switchsounds();
		System.out.println ("switchsounds execution self-validation test results: " + testObject.validateSelf());
	}
}
