]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.objmap2/src/org/simantics/objmap/graph/Mappings.java
Merge "Fixed invalid comparisons which were identified by Eclipse IDE 2018-09"
[simantics/platform.git] / bundles / org.simantics.objmap2 / src / org / simantics / objmap / graph / Mappings.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2013 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.objmap.graph;
13
14 import org.simantics.objmap.graph.impl.Mapping;
15 import org.simantics.objmap.graph.schema.IMappingSchema;
16 /**
17  * Static utility methods for mappings. 
18  * @author Hannu Niemistö
19  */
20 public class Mappings {
21         private Mappings() {}
22         
23         /**
24          * Creates a new mapping based on the given mapping schema. 
25          * The created mapping is not thread-safe and will not
26          * listen database changes automatically.
27          */
28         public static <Domain,Range> IMapping<Domain,Range> createWithoutListening(IMappingSchema<Domain,Range> schema) {
29                 return new Mapping<Domain,Range>(schema, false);
30         }
31         
32         /**
33      * Creates a new mapping based on the given mapping schema. 
34      * The created mapping is not thread-safe. It listens database
35      * changes automatically.
36      */
37         public static <Domain,Range> IMapping<Domain,Range> createWithListening(IMappingSchema<Domain,Range> schema) {
38         return new Mapping<Domain,Range>(schema, true);
39     }
40         
41         
42 }