• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /barrelfish-2018-10-04/usr/eclipseclp/JavaInterface/src/com/parctechnologies/eclipse/
1// BEGIN LICENSE BLOCK
2// Version: CMPL 1.1
3//
4// The contents of this file are subject to the Cisco-style Mozilla Public
5// License Version 1.1 (the "License"); you may not use this file except
6// in compliance with the License.  You may obtain a copy of the License
7// at www.eclipse-clp.org/license.
8//
9// Software distributed under the License is distributed on an "AS IS"
10// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
11// the License for the specific language governing rights and limitations
12// under the License.
13//
14// The Original Code is  The ECLiPSe Constraint Logic Programming System.
15// The Initial Developer of the Original Code is  Cisco Systems, Inc.
16// Portions created by the Initial Developer are
17// Copyright (C) 2000 - 2006 Cisco Systems, Inc.  All Rights Reserved.
18//
19// Contributor(s): Stefano Novello / Josh Singer, Parc Technologies
20//
21// END LICENSE BLOCK
22
23//Title:        Java/ECLiPSe interface
24//Version:      $Id: Atom.java,v 1.1 2006/09/23 01:54:08 snovello Exp $
25//Author:       Stefano Novello / Josh Singer
26//Company:      Parc Technologies
27//Description:  Java representation of an ECLiPSe atom.
28package com.parctechnologies.eclipse;
29
30/**
31 * An ECLiPSe atom. Although atoms are not strictly compound terms, this class
32 * implements the CompoundTerm interface (it has 0 arguments), so it can be
33 * passed to and returned by
34 * rpc methods.
35 * @see CompoundTerm
36 */
37public class Atom extends AbstractCompoundTerm implements CompoundTerm
38{
39  /**
40   * Create an Atom given its functor as a String.
41   */
42  public Atom(String functor)
43  {
44    super(functor,0);
45  }
46
47  /**
48   * This always throws an IndexOutOfBoundsException since the Atom has no arguments.
49   * Note that a "throws" clause in the <i>CompoundTerm</i> interface is unnecessary
50   * since this is RuntimeException.
51   */
52  public Object arg(int i)
53  {
54    throw new IndexOutOfBoundsException("Tried to access argument of ECLiPSe atom.");
55  }
56
57  public String toString()
58  {
59    String result = this.getClass().getName() + " with [";
60    result += "functor="+functor()+"]";
61    // System.err.println("WARNING: toString called on"+result);
62
63    return(result);
64  }
65
66
67}
68
69