1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.browsing.ui.graph.impl;
14 import org.simantics.browsing.ui.common.property.IArrayProperty;
15 import org.simantics.db.Resource;
16 import org.simantics.db.common.ResourceArray;
17 import org.simantics.utils.datastructures.slice.ValueRange;
20 * @author Tuukka Lehtonen
22 public class ResourceArrayProperty extends ResourceProperty implements IArrayProperty {
24 protected final ValueRange range;
26 public ResourceArrayProperty(Type type, ValueRange range, Resource subject, Resource predicate, Resource value,
28 super(type, subject, predicate, value, path);
30 throw new IllegalArgumentException("null value range");
35 public ValueRange getRange() {
40 public String toString() {
41 return super.toString() + "[range=" + range + "]";
45 public int propertyHashCode() {
46 return super.propertyHashCode() * 31 + range.hashCode();
50 public boolean propertyEquals(Object obj) {
53 if (!super.propertyEquals(obj))
55 ResourceArrayProperty other = (ResourceArrayProperty) obj;
56 return range.equals(other.range);
60 public int hashCode() {
61 return range.hashCode() + 31 * super.hashCode();
65 public boolean equals(Object obj) {
68 if (!super.equals(obj))
70 ResourceArrayProperty other = (ResourceArrayProperty) obj;
71 return range.equals(other.range);
75 public IArrayProperty slice(ValueRange range) {
76 return new SlicedResourceArrayProperty(type, range, subject, predicate, value, path);
80 public boolean isSlice() {
84 private static class SlicedResourceArrayProperty extends ResourceArrayProperty {
85 public SlicedResourceArrayProperty(Type type, ValueRange range, Resource subject, Resource predicate,
86 Resource value, ResourceArray path) {
87 super(type, range, subject, predicate, value, path);
90 public boolean isSlice() {