Package de.foconis.lsext

Source Code of de.foconis.lsext.LSFocStringMap

package de.foconis.lsext;

import java.util.Set;

import org.openntf.formula.impl.StringMap;
import org.openntf.formula.impl.StringSet;

/*----------------------------------------------------------------------------*/
public class LSFocStringMap extends StringMap<Object> {

  private static final long serialVersionUID = -5701938083812020297L;

  private int iModCount = 1;
  private String iFocIF = null;
  private StringSet iWrittenKeys = null;
  private StringSet iRemovedKeys = null;

  /*----------------------------------------------------------------------------*/
  public LSFocStringMap(final boolean caseInsensitive, final int modCount, final String focIF) {
    super(caseInsensitive);
    iModCount = modCount;
    iFocIF = focIF;
  }

  public LSFocStringMap() {
    super();
  }

  public LSFocStringMap(final boolean caseInsensitive) {
    super(caseInsensitive);
  }

  /*----------------------------------------------------------------------------*/
  public int getModCount() {
    return iModCount;
  }

  public String getFocIF() {
    return iFocIF;
  }

  /*----------------------------------------------------------------------------*/
  public void activateChangeControl() {
    iWrittenKeys = new StringSet(iCaseInsensitive);
    iRemovedKeys = new StringSet(iCaseInsensitive);
  }

  public Set<String> getWrittenKeys() {
    return iWrittenKeys;
  }

  public Set<String> getRemovedKeys() {
    return iRemovedKeys;
  }

  /*----------------------------------------------------------------------------*/
  @Override
  public Object put(final String key, final Object value) {
    if (iWrittenKeys != null)
      iWrittenKeys.add(key);
    return super.put(key, value);
  }

  /*----------------------------------------------------------------------------*/
  @Override
  public Object remove(final Object key) {
    if (iRemovedKeys != null && containsKey(key) && key instanceof String)
      iRemovedKeys.add((String) key);
    return super.remove(key);
  }
  /*----------------------------------------------------------------------------*/
TOP

Related Classes of de.foconis.lsext.LSFocStringMap

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.