]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db/src/org/simantics/db/RelationInfo.java
General event listening interface for DB and purge events.
[simantics/platform.git] / bundles / org.simantics.db / src / org / simantics / db / RelationInfo.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
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
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.db;
13
14
15
16 final public class RelationInfo {
17     
18     public static final RelationInfo[] NONE = new RelationInfo[0];
19     public final int predicate;
20     public final boolean isFunctional;
21     public final boolean isFinal;
22     public final boolean isAsserted;
23     
24     public RelationInfo(final int predicate, final boolean isFunctional, final boolean isFinal, final boolean isAsserted) {
25         this.predicate = predicate;
26         this.isFunctional = isFunctional;
27         this.isFinal = isFinal;
28         this.isAsserted = isAsserted;
29     }
30     
31     @Override
32     public String toString() {
33         return "RelationInfo[predicate=" + predicate + ", isFunctional=" + isFunctional + ", isFinal=" + isFinal + ", isAsserted=" + isAsserted + "]";
34     }
35     
36     @Override
37     public int hashCode() {
38         return 31 * predicate;
39     }
40
41     @Override
42     public boolean equals(Object object) {
43         if (this == object)
44             return true;
45         else if (object == null)
46             return false;
47         else if (RelationInfo.class != object.getClass())
48             return false;
49         RelationInfo r = (RelationInfo)object;
50         return r.predicate == predicate && r.isFinal == isFinal && r.isFunctional == isFunctional;
51     }
52     
53     
54 }