1 6 7 package com.hp.hpl.jena.db.impl; 8 9 import com.hp.hpl.jena.graph.*; 10 import com.hp.hpl.jena.graph.query.Domain; 11 import com.hp.hpl.jena.graph.query.Element; 12 import com.hp.hpl.jena.shared.JenaException; 13 14 20 public class Free extends Element 21 { 22 23 26 27 private Node_Variable var; 28 private int listIx; private int mapIx; private boolean isListed; private boolean isArgument; 33 public Free( Node n ) { 34 super( ); 35 var = (Node_Variable) n; 36 isArgument = false; 37 isListed = false; 38 } 39 40 public int getListing() 41 { 42 if ( isListed ) return listIx; 43 else throw new JenaException("UnListed variable"); 44 } 45 46 public void setListing ( int ix ) 47 { 48 if ( isListed ) 49 throw new JenaException("Relisting of variable"); 50 isListed = true; 51 listIx = ix; 52 } 53 54 public void setIsArg ( int ix ) { isArgument = true; mapIx = ix; } 55 public boolean isArg() { return isArgument; } 56 57 public int getMapping() 58 { 59 if ( isArgument ) return mapIx; 60 else throw new JenaException("Unmapped variable"); 61 } 62 63 public boolean isListed() { return isListed; } 64 65 public Node_Variable var() { 66 return var; 67 } 68 69 public boolean match( Domain d, Node x ) 70 {throw new JenaException("Attempt to match a free variable"); 71 } 72 73 public Node asNodeMatch( Domain d ) { 74 throw new JenaException("asNodeMatch not supported"); 75 } 76 77 public String toString() 78 { return "<Free " + listIx + ">"; } 79 } 80 81 110 | Popular Tags |