code: private void insert(Geometry geom, GeometryIndex index, Coordinate coordinate)
  			throws GeometryIndexNotFoundException {
  		if (index.hasChild() && geom.getGeometries() != null && geom.getGeometries().length > index.getValue()) {
  			insert(geom.getGeometries()[index.getValue()], index.getChild(), coordinate);
  		} else if (index.getType() == GeometryIndexType.TYPE_EDGE) {
  			insertAfterEdge(geom, index, coordinate);
  		} else if (index.getType() == GeometryIndexType.TYPE_VERTEX) {
  			insertAfterVertex(geom, index, coordinate);
  		} else {
  			throw new GeometryIndexNotFoundException("Could not match index with given geometry.");
  		}
  	}
docs: ------------------------------------------------------------------------