org.spdx.rdfparser.license.SpdxNoneLicense Maven / Gradle / Ivy
/**
* Copyright (c) 2011 Source Auditor Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.spdx.rdfparser.license;
import java.util.List;
import org.spdx.rdfparser.IModelContainer;
import org.spdx.rdfparser.InvalidSPDXAnalysisException;
import org.spdx.rdfparser.SpdxRdfConstants;
import org.spdx.rdfparser.model.IRdfModel;
import com.google.common.collect.Lists;
import org.apache.jena.graph.Node;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.Resource;
/**
* A special license meaning that no license was found
* @author Gary O'Neall
*
*/
public class SpdxNoneLicense extends AnyLicenseInfo {
static final int NONE_LICENSE_HASHCODE = 147; // prime number - all none licenses should have the same hashcde
/**
* @param container
* @param node
* @throws InvalidSPDXAnalysisException
*/
public SpdxNoneLicense(IModelContainer container, Node node) throws InvalidSPDXAnalysisException {
super(container, node);
}
public SpdxNoneLicense() {
super();
}
/* (non-Javadoc)
* @see org.spdx.rdfparser.license.AnyLicenseInfo#toString()
*/
@Override
public String toString() {
return LicenseInfoFactory.NONE_LICENSE_NAME;
}
@Override
public int hashCode() {
return NONE_LICENSE_HASHCODE;
}
/* (non-Javadoc)
* @see org.spdx.rdfparser.license.AnyLicenseInfo#equals(java.lang.Object)
*/
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
return (o instanceof SpdxNoneLicense); // All Instances of this type are considered equal
}
/* (non-Javadoc)
* @see org.spdx.rdfparser.license.AnyLicenseInfo#verify()
*/
@Override
public List verify() {
return Lists.newArrayList();
}
/* (non-Javadoc)
* @see org.spdx.rdfparser.license.AnyLicenseInfo#clone()
*/
@Override
public AnyLicenseInfo clone() {
return new SpdxNoneLicense();
}
/* (non-Javadoc)
* @see org.spdx.rdfparser.model.IRdfModel#equivalent(org.spdx.rdfparser.model.IRdfModel)
*/
@Override
public boolean equivalent(IRdfModel compare) {
return this.equals(compare);
}
/* (non-Javadoc)
* @see org.spdx.rdfparser.license.AnyLicenseInfo#populateModel()
*/
@Override
public void populateModel() throws InvalidSPDXAnalysisException {
// Nothing to populate
}
/* (non-Javadoc)
* @see org.spdx.rdfparser.model.RdfModelObject#getPropertiesFromModel()
*/
@Override
public void getPropertiesFromModel() throws InvalidSPDXAnalysisException {
// No properties to get
}
/* (non-Javadoc)
* @see org.spdx.rdfparser.model.RdfModelObject#getUri(org.spdx.rdfparser.IModelContainer)
*/
@Override
public String getUri(IModelContainer modelContainer)
throws InvalidSPDXAnalysisException {
return SpdxRdfConstants.SPDX_NAMESPACE+SpdxRdfConstants.TERM_LICENSE_NONE;
}
/* (non-Javadoc)
* @see org.spdx.rdfparser.model.RdfModelObject#getType(org.apache.jena.rdf.model.Model)
*/
@Override
public Resource getType(Model model) {
return model.createResource(SpdxRdfConstants.SPDX_NAMESPACE+SpdxRdfConstants.TERM_LICENSE_NONE);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy