001/*
002 * Copyright (c) 2012-2017 Institut National des Sciences Appliquées de Lyon (INSA-Lyon)
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 */
009
010package gololang;
011
012/**
013 * Base class for Golo union objects.
014 * <p>
015 * This class defines common behavior.
016 */
017public abstract class Union {
018  /**
019   * Array conversion.
020   *
021   * @return an array containing the values (in member orders)
022   */
023  public Object[] toArray() {
024    return new Object[]{};
025  }
026
027  /**
028   * Destructuration helper.
029   *
030   * @return a tuple with the current values.
031   */
032  public Tuple destruct() {
033    return Tuple.fromArray(toArray());
034  }
035}