1 6 7 package com.hp.hpl.jena.graph; 8 9 15 16 public class Node_Variable extends Node_Fluid 17 { 18 protected Node_Variable( Object name ) 19 { super( name ); } 20 21 public String getName() 22 { return ((VariableName) label).name; } 23 24 public Object visitWith( NodeVisitor v ) 25 { return v.visitVariable( this, getName() ); } 26 27 public boolean isVariable() 28 { return true; } 29 30 public String toString() 31 { return "?" + ((VariableName) label).name; } 32 33 public boolean equals( Object other ) 34 { return other instanceof Node_Variable && label.equals( ((Node_Variable) other).label ); } 35 36 public static Object variable( String name ) 37 { return new VariableName( name ); } 38 39 public static class VariableName 40 { 41 String name; 42 43 VariableName( String name ) 44 { this.name = name; } 45 46 public int hashCode() 47 { return name.hashCode(); } 48 49 public boolean equals( Object other ) 50 { return other instanceof VariableName && name.equals( ((VariableName) other).name ); } 51 52 public String toString() 53 { return "?" + name; } 54 } 55 } 56 57 86 | Popular Tags |