X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fmapping%2FTag.java;h=39633d74c6a1a5df4e610143ae2d3f8b57888e6e;hb=4e402f51b0e34d40c3f9d33a4bec7feffeb8d339;hp=fda10983ab621314542e35b98d22a9dde889ec31;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/mapping/Tag.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/mapping/Tag.java index fda10983a..39633d74c 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/mapping/Tag.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/mapping/Tag.java @@ -1,44 +1,44 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.modeling.mapping; - -import org.simantics.db.ReadGraph; -import org.simantics.db.Resource; -import org.simantics.db.WriteGraph; -import org.simantics.db.exception.DatabaseException; -import org.simantics.layer0.utils.predicates.UnaryTest; - -public class Tag extends UnaryTest { - - Resource tag; - - public Tag(Resource tag) { - this.tag = tag; - } - - @Override - public boolean has(ReadGraph g, Resource r) throws DatabaseException { - return g.hasStatement(r, tag); - } - - @Override - public void add(WriteGraph g, Resource r) throws DatabaseException { - if(!g.hasStatement(r, tag)) - g.claim(r, tag, r); - } - - @Override - public void remove(WriteGraph g, Resource r) throws DatabaseException { - g.deny(r, tag); - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.modeling.mapping; + +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.WriteGraph; +import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.utils.predicates.UnaryTest; + +public class Tag extends UnaryTest { + + Resource tag; + + public Tag(Resource tag) { + this.tag = tag; + } + + @Override + public boolean has(ReadGraph g, Resource r) throws DatabaseException { + return g.hasStatement(r, tag); + } + + @Override + public void add(WriteGraph g, Resource r) throws DatabaseException { + if(!g.hasStatement(r, tag)) + g.claim(r, tag, r); + } + + @Override + public void remove(WriteGraph g, Resource r) throws DatabaseException { + g.deny(r, tag); + } + +}