View Javadoc

1   /*
2    wsmo4j - a WSMO API and Reference Implementation
3    Copyright (c) 2004, DERI Innsbruck
4    This library is free software; you can redistribute it and/or modify it under
5    the terms of the GNU Lesser General Public License as published by the Free
6    Software Foundation; either version 2.1 of the License, or (at your option)
7    any later version.
8    This library is distributed in the hope that it will be useful, but WITHOUT
9    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10   FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11   details.
12   You should have received a copy of the GNU Lesser General Public License along
13   with this library; if not, write to the Free Software Foundation, Inc.,
14   59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15   */
16  package org.deri.wsmo4j.logicalexpression;
17  
18  
19  import org.omwg.logicalexpression.*;
20  import org.omwg.logicalexpression.terms.*;
21  
22  
23  /**
24   * @author DERI Innsbruck, reto.krummenacher@deri.org
25   * @author DERI Innsbruck, thomas.haselwanter@deri.org
26   * @author Holger Lausen (holger.lausen@deri.org)
27   * @see org.omwg.logicalexpression.AttributeSpecification
28   */
29  public abstract class AttributeMoleculeImpl
30          extends MoleculeImpl
31          implements AttributeMolecule {
32  
33      protected Term attributeName;
34  
35      public AttributeMoleculeImpl(Term leftTerm, Term attributeName, Term rightTerm) {
36          super(leftTerm, rightTerm);
37          setAttribute(attributeName);
38      }
39  
40      /**
41       * @return the name of the attribute specified
42       * @see org.omwg.logicalexpression.AttributeSpecification#getName()
43       */
44      public Term getAttribute() {
45          return attributeName;
46      }
47  
48      /* (non-Javadoc)
49       * @see org.omwg.logicalexpression.AttributeMolecule#setAttribute(org.omwg.logicalexpression.terms.Term)
50       */
51      public void setAttribute(Term t) throws IllegalArgumentException{
52          if (t == null) {
53              throw new IllegalArgumentException("Attribute name may not be null");
54          }
55          this.attributeName = t;
56      }
57  }