de.javagl.jgltf.impl.v2.Scene Maven / Gradle / Ivy
The newest version!
/*
* glTF JSON model
*
* Do not modify this class. It is automatically generated
* with JsonModelGen (https://github.com/javagl/JsonModelGen)
* Copyright (c) 2016-2021 Marco Hutter - http://www.javagl.de
*/
package de.javagl.jgltf.impl.v2;
import java.util.ArrayList;
import java.util.List;
/**
* The root nodes of a scene.
*
* Auto-generated for scene.schema.json
*
*/
public class Scene
extends GlTFChildOfRootProperty
{
/**
* The indices of each root node. (optional)
* Minimum number of items: 1
* Array elements:
* The elements of this array (optional)
* Minimum: 0 (inclusive)
*
*/
private List nodes;
/**
* The indices of each root node. (optional)
* Minimum number of items: 1
* Array elements:
* The elements of this array (optional)
* Minimum: 0 (inclusive)
*
* @param nodes The nodes to set
* @throws IllegalArgumentException If the given value does not meet
* the given constraints
*
*/
public void setNodes(List nodes) {
if (nodes == null) {
this.nodes = nodes;
return ;
}
if (nodes.size()< 1) {
throw new IllegalArgumentException("Number of nodes elements is < 1");
}
for (Integer nodesElement: nodes) {
if (nodesElement< 0) {
throw new IllegalArgumentException("nodesElement < 0");
}
}
this.nodes = nodes;
}
/**
* The indices of each root node. (optional)
* Minimum number of items: 1
* Array elements:
* The elements of this array (optional)
* Minimum: 0 (inclusive)
*
* @return The nodes
*
*/
public List getNodes() {
return this.nodes;
}
/**
* Add the given nodes. The nodes of this instance will be replaced with
* a list that contains all previous elements, and additionally the new
* element.
*
* @param element The element
* @throws NullPointerException If the given element is null
*
*/
public void addNodes(Integer element) {
if (element == null) {
throw new NullPointerException("The element may not be null");
}
List oldList = this.nodes;
List newList = new ArrayList();
if (oldList!= null) {
newList.addAll(oldList);
}
newList.add(element);
this.nodes = newList;
}
/**
* Remove the given nodes. The nodes of this instance will be replaced
* with a list that contains all previous elements, except for the
* removed one.
* If this new list would be empty, then it will be set to
* null
.
*
* @param element The element
* @throws NullPointerException If the given element is null
*
*/
public void removeNodes(Integer element) {
if (element == null) {
throw new NullPointerException("The element may not be null");
}
List oldList = this.nodes;
List newList = new ArrayList();
if (oldList!= null) {
newList.addAll(oldList);
}
newList.remove(element);
if (newList.isEmpty()) {
this.nodes = null;
} else {
this.nodes = newList;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy