All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.okapi.common.skeleton.StorageList Maven / Gradle / Ivy

There is a newer version: 1.47.0
Show newest version
/*===========================================================================
  Copyright (C) 2008-2010 by the Okapi Framework contributors
-----------------------------------------------------------------------------
  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 net.sf.okapi.common.skeleton;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import net.sf.okapi.common.IResource;
import net.sf.okapi.common.ISkeleton;
import net.sf.okapi.common.LocaleId;
import net.sf.okapi.common.annotation.Annotations;
import net.sf.okapi.common.annotation.IAnnotation;
import net.sf.okapi.common.resource.IMultilingual;
import net.sf.okapi.common.resource.IReferenceable;
import net.sf.okapi.common.resource.Property;
import net.sf.okapi.common.resource.StartGroup;

/**
 * provides a way to store a list of resources and implements the different
 * interfaces of the resources.
 * 

This class is designed to be used with {@link GenericSkeletonWriter} and derived classes. */ public class StorageList extends ArrayList implements IReferenceable, IMultilingual { /** * */ private static final long serialVersionUID = 1L; private final Annotations annotations; private final Map properties; private StartGroup startGroup; public StorageList() { properties = new HashMap<>(); annotations = new Annotations(); } /** * Creates a new StorageList object with w StartGroup. * @param startGroup StartGroup to start with. */ public StorageList(StartGroup startGroup) { this(); this.startGroup = startGroup; } @Override public String getId () { return startGroup.getId(); } @Override public void setId(String id) { // Not implemented: read-only info } @Override public ISkeleton getSkeleton () { return startGroup.getSkeleton(); } @Override public void setSkeleton(ISkeleton skeleton) { // Not implemented: read-only info } @Override public boolean isReferent () { return startGroup.isReferent(); } @Override public void setIsReferent(boolean value) { // Not implemented: read-only info } @Override public int getReferenceCount () { return startGroup.getReferenceCount(); } @Override public void setReferenceCount(int value) { // Not implemented: read-only info } @Override public String getName () { return startGroup.getName(); } @Override public Property getProperty(String name) { return startGroup.getProperty(name); } @Override public void setName(String name) { // Not implemented: read-only info } @Override public Property setProperty(Property property) { // Not implemented: read-only info return null; } @Override public A getAnnotation(Class annotationType) { return startGroup.getAnnotation(annotationType); } @Override public void setAnnotation(IAnnotation annotation) { startGroup.setAnnotation(annotation); } @Override public Property createTargetProperty(LocaleId locId, String name, boolean overwrite, int creationOptions) { return startGroup.createTargetProperty(locId, name, getProperty(name), overwrite, creationOptions); } @Override public Property setTargetProperty(LocaleId language, Property property) { // Not implemented: read-only info return null; } @Override public Property getTargetProperty(LocaleId language, String name) { return startGroup.getTargetProperty(language, name); } @Override public boolean hasTargetProperty(LocaleId language, String name) { return startGroup.hasTargetProperty(language, name); } @Override public Set getPropertyNames () { return startGroup.getPropertyNames(); } @Override public Set getTargetPropertyNames(LocaleId language) { return startGroup.getTargetPropertyNames(language); } @Override public Property getSourceProperty(String name) { return startGroup.getSourceProperty(name); } @Override public Set getSourcePropertyNames () { return startGroup.getSourcePropertyNames(); } @Override public Set getTargetLocales () { return startGroup.getTargetLocales(); } @Override public Property setSourceProperty(Property property) { // Not implemented: read-only info return null; } @Override public boolean isTranslatable () { return startGroup.isTranslatable(); } @Override public void setIsTranslatable(boolean value) { // Not implemented: read-only info } @Override public String getType () { return startGroup.getType(); } @Override public void setType(String value) { // Not implemented: read-only info } @Override public boolean preserveWhitespaces () { return startGroup.preserveWhitespaces(); } @Override public void setPreserveWhitespaces(boolean value) { // Not implemented: read-only info } @Override public String getMimeType () { return startGroup.getMimeType(); } @Override public void setMimeType(String value) { // Not implemented: read-only info } @Override public boolean hasProperty(String name) { return startGroup.hasProperty(name); } @Override public boolean hasSourceProperty(String name) { return startGroup.hasSourceProperty(name); } @Override public void removeProperty(String name) { startGroup.removeProperty(name); } @Override public void removeSourceProperty(String name) { startGroup.removeSourceProperty(name); } @Override public void removeTargetProperty(LocaleId language, String name) { startGroup.removeTargetProperty(language, name); } public StartGroup getStartGroup() { return startGroup; } @Override public Map getSourceProperties() { return startGroup.getSourceProperties(); } @Override public Map getProperties() { return properties; } @Override public Annotations getAnnotations() { return annotations; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy