Misc.jrag 1.24 KB
Newer Older
1 2
/* -*-Java-*- */

3
/* 
4
 * Copyright (C) 2006,2010  Anders Nilsson <anders.nilsson@control.lth.se>
5 6
 *
 * This file is part of OntologyCompiler.
7 8 9 10 11 12 13 14 15 16 17 18 19
 *
 * OntologyCompiler is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * OntologyCompiler is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 
 * You should have received a copy of the GNU General Public License
 * along with OntologyCompiler.  If not, see <http://www.gnu.org/licenses/>.
20 21 22
 */


23 24 25
aspect Misc {
	syn Start ASTNode.goStart() = getParent().goStart();
	eq Start.goStart() = this;
Anders Nilsson's avatar
Anders Nilsson committed
26 27 28 29 30 31 32 33

	public String ASTNode.ind(int n) {
		StringBuffer s = new StringBuffer();
		for (int i=0; i<n; i++) {
			s.append("  ");
		}
		return s.toString();
	}
34 35 36 37 38 39 40 41 42 43 44 45


	syn Attribute Element.iri() = null;
	eq ComplexElement.iri() {
		for (int i=0; i<getNumAttribute(); i++) {
			Attribute a = getAttribute(i);
			if (a instanceof IRI) {
				return a;
			}
		}
		return null;
	}
46
}