Package org.zkoss.zss.engine

Examples of org.zkoss.zss.engine.Ref


   * @see org.zkoss.zss.engine.RefMatrix#addRef(int, int, int, int)
   */
  @Override
  public Ref getOrCreateRef(int tRow, int lCol, int bRow, int rCol) {
    final RefAddr addr = new RefAddr(tRow, lCol, bRow, rCol);
    final Ref ref = _ltrbIndex.get(addr);
    if (ref != null) {
      return ref;
    }
    //a new reference
    //add the new Ref into the RefIndex
    final Ref candidateRef = tRow == bRow && lCol == rCol ?
      new CellRefImpl(tRow, lCol, this) : new AreaRefImpl(tRow, lCol, bRow, rCol, this);

    //update the ltrb index
    _ltrbIndex.put(addr, candidateRef);
   
View Full Code Here


   * @see org.zkoss.zss.engine.RefMatrix#removeRef(int, int, int, int)
   */
  @Override
  public Ref removeRef(int tRow, int lCol, int bRow, int rCol) {
    final RefAddr addr = new RefAddr(tRow, lCol, bRow, rCol);
    final Ref ref = _ltrbIndex.get(addr);
    if (ref == null)
      return null;
   
    removeRefDirectly(ref);
   
View Full Code Here

      (CellRefImpl) getRef(srcRow, srcCol, srcRow, srcCol);
    if (srcRef != null) {
      if (sheet == null) {
        sheet = this;
      }
      final Ref precedent = srcRef.removePrecedent(sheet, tRow, lCol, bRow, rCol);
      if (precedent.getDependents().isEmpty() && precedent.getPrecedents().isEmpty()) {
        sheet.removeRef(tRow, lCol, bRow, rCol);
      }
      if (srcRef.getDependents().isEmpty() && srcRef.getPrecedents().isEmpty()) {
        removeRef(srcRow, srcCol, srcRow, srcCol);
      }
View Full Code Here

  @Override
  public void removeDependency(int srcRow, int srcCol, String name) {
    final CellRefImpl srcRef = (CellRefImpl) getRef(srcRow, srcCol, srcRow, srcCol);
    if (srcRef != null) {
      final Ref precedent = srcRef.removePrecedent(name);
      if (precedent.getDependents().isEmpty() && precedent.getPrecedents().isEmpty()) {
        _ownerBook.removeVariableRef(name);
      }
      if (srcRef.getDependents().isEmpty() && srcRef.getPrecedents().isEmpty()) {
        removeRef(srcRow, srcCol, srcRow, srcCol);
      }
View Full Code Here

    }
  }
 
  private void addOrMergeBackLtrbIndex(Ref ref) {
    final RefAddr refAddr = new RefAddr(ref);
    final Ref refX = _ltrbIndex.get(refAddr);
    if (refX == null)
      _ltrbIndex.put(refAddr, ref);
    else {
      final Set<Ref> dependents = ref.getDependents();
      refX.getDependents().addAll(dependents);
      for (Ref dependent : dependents) {
        final Set<Ref> depprecendents = dependent.getPrecedents();
        depprecendents.remove(ref);
        depprecendents.add(refX);
      }
      final Set<Ref> precedents = ref.getPrecedents();
      refX.getPrecedents().addAll(precedents);
      for (Ref precedent : precedents) {
        final Set<Ref> predependents = precedent.getDependents();
        predependents.remove(ref);
        predependents.add(refX);
      }
View Full Code Here

    return getBothDependents(removeHits, srcHits);
  }
 
  @Override
  public void setRefWithIndirectPrecedent(int row, int col, boolean withIndirectPrecedent) {
    final Ref ref0 = getRef(row, col, row, col);
    if (ref0 != null) {
      if (!withIndirectPrecedent) {
        _indirectDependentRefs.remove(ref0);
      } else {
        _indirectDependentRefs.add(ref0);
      }
      ref0.setWithIndirectPrecedent(withIndirectPrecedent);
    }
  }
View Full Code Here

    return _maxcol;
  }

  @Override
  public Ref getOrCreateVariableRef(String name, RefSheet dummy) {
    final Ref ref = new VarRefImpl(name, dummy);
    final Ref ret = _variableRefs.putIfAbsent(name, ref);
    return ret != null ? ret : ref;
  }
View Full Code Here

  }
 
  @SuppressWarnings("unchecked")
  @Override
  public Set<Ref>[] getBothDependents(String name) {
    final Ref ref = _variableRefs.get(name);
    if (ref != null) {
      final Set<Ref> last = new HashSet<Ref>();
      final Set<Ref> all = new HashSet<Ref>();
      DependencyTrackerHelper.getBothDependents(ref.getDependents(), all, last);
      return (Set<Ref>[]) new Set[] {last, all};
    }
    return null;
  }
View Full Code Here

    int tRow, int lCol, int bRow, int rCol) {
    if (srcRef != null) {
      if (sheet == null) {
        sheet = srcRef.getOwnerSheet();
      }
      final Ref precedent = srcRef.removePrecedent(sheet, tRow, lCol, bRow, rCol);
      if (precedent.getDependents().isEmpty() && precedent.getPrecedents().isEmpty()) {
        sheet.removeRef(tRow, lCol, bRow, rCol);
      }
      if (srcRef.getDependents().isEmpty() && srcRef.getPrecedents().isEmpty()) {
        removeRef(srcRef);
      }
View Full Code Here

    srcRef.addPrecedent(name);
  }

  public static void removeDependency(CellRefImpl srcRef, String name) {
    if (srcRef != null) {
      final Ref precedent = srcRef.removePrecedent(name);
      if (precedent.getDependents().isEmpty() && precedent.getPrecedents().isEmpty()) {
        srcRef.getOwnerSheet().getOwnerBook().removeVariableRef(name);
      }
      if (srcRef.getDependents().isEmpty() && srcRef.getPrecedents().isEmpty()) {
        removeRef(srcRef);
      }
View Full Code Here

TOP

Related Classes of org.zkoss.zss.engine.Ref

Copyright © 2018 www.massapicom. 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.