001/*
002 *                    BioJava development code
003 *
004 * This code may be freely distributed and modified under the
005 * terms of the GNU Lesser General Public Licence.  This should
006 * be distributed with the code.  If you do not have a copy,
007 * see:
008 *
009 *      http://www.gnu.org/copyleft/lesser.html
010 *
011 * Copyright for this code is held jointly by the individual
012 * authors.  These should be listed in @author doc comments.
013 *
014 * For more information on the BioJava project and its aims,
015 * or to join the biojava-l mailing list, visit the home page
016 * at:
017 *
018 *      http://www.biojava.org/
019 *
020 */
021package org.biojava.stats.svm;
022
023import java.io.Serializable;
024
025/**
026 * Encapsulates a kernel that wraps another kernel up.
027 *
028 * @author Matthew Pocock
029 */
030public abstract class NestedKernel implements SVMKernel, Serializable {
031  /**
032   * The <span class="type">SVMKernel</span> being wrapped.
033   */
034  private SVMKernel nested;
035
036  /**
037   * Create a new <span class="type">NestedKernel</span>.
038   */
039  public NestedKernel() {}
040
041  /**
042   * Create a new <span class="type">NestedKernel</span> that wraps
043   * <span class="arg">k</span>.
044   *
045   * @param k  the <span class="type">SVMKernel</span> to wrap
046   */
047  public NestedKernel(SVMKernel k) {
048    setNestedKernel(k);
049  }
050
051  /**
052   * Set the <span class="type">SVMKernel</span> to nest to
053   * <span class="arg">k</span>.
054   *
055   * @param k  the <span class="type">SVMKernel</span> to nest.
056   */
057  public void setNestedKernel(SVMKernel k) {
058    nested = k;
059  }
060
061  /**
062   * Retrieve the currently nested <span class="type">SVMKernel</span>.
063   *
064   * @return the nested <span class="type">SVMKernel</span>
065   */
066  public SVMKernel getNestedKernel() {
067    return nested;
068  }
069}