]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db/src/org/simantics/db/RelationInfo.java
DB query swapping to file system
[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 final public class RelationInfo {
15     
16     public static final RelationInfo[] NONE = new RelationInfo[0];
17     public final int predicate;
18     public final boolean isFunctional;
19     public final boolean isFinal;
20     public final boolean isAsserted;
21     
22     public RelationInfo(final int predicate, final boolean isFunctional, final boolean isFinal, final boolean isAsserted) {
23         this.predicate = predicate;
24         this.isFunctional = isFunctional;
25         this.isFinal = isFinal;
26         this.isAsserted = isAsserted;
27     }
28
29     @Override
30     public String toString() {
31         return "RelationInfo[predicate=" + predicate + ", isFunctional=" + isFunctional + ", isFinal=" + isFinal + ", isAsserted=" + isAsserted + "]";
32     }
33     
34     @Override
35     public int hashCode() {
36         return 31 * predicate;
37     }
38
39     @Override
40     public boolean equals(Object object) {
41         if (this == object)
42             return true;
43         else if (object == null)
44             return false;
45         else if (RelationInfo.class != object.getClass())
46             return false;
47         RelationInfo r = (RelationInfo)object;
48         return r.predicate == predicate && r.isFinal == isFinal && r.isFunctional == isFunctional;
49     }
50     
51     
52 }