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