1 6 7 package com.hp.hpl.jena.graph.query; 8 9 import com.hp.hpl.jena.graph.*; 10 11 import java.util.*; 12 13 21 22 23 public class Domain extends AbstractList implements IndexValues 24 { 25 28 private Node [] value; 29 30 33 public Domain( Node [] value ) 34 { 35 Node [] result = new Node[value.length]; 36 for (int i = 0; i < value.length; i += 1) result[i] = value[i]; 37 this.value = result; 38 } 39 40 42 public Domain( int size ) { this( new Node[size] ); } 43 44 public int size() { return value.length; } 45 public Object get( int i ) { return value[i]; } 46 public void setElement( int i, Node x ) { value[i] = x; } 47 48 public Domain copy() { return new Domain( this.value ); } 49 50 public boolean equals( Object x ) 51 { 52 return x instanceof Domain && Arrays.equals( this.value, ((Domain) x).value ); 53 } 54 55 public String toString() 56 { 57 StringBuffer b = new StringBuffer ( 200 ); 58 b.append( "<domain" ); 59 for (int i = 0; i < value.length; i += 1) b.append( " " + i + ":" + value[i] ); 60 b.append( ">" ); 61 return b.toString(); 62 } 63 } 64 65 94 | Popular Tags |