Esempio n. 1
0
 public void removeVertex(LW2DVertex vertex) {
   // remove and check the constantwidth
   this.setBit(BOOLEAN_BIT_CONSTANTWIDTH, true);
   for (Iterator<LW2DVertex> i = this.vertices.iterator(); i.hasNext(); ) {
     LW2DVertex v = i.next();
     if (v == vertex) {
       i.remove();
     } else if (!v.isConstantWidth()) {
       this.setBit(BOOLEAN_BIT_CONSTANTWIDTH, false);
     }
   }
 }
Esempio n. 2
0
 public void removeVertex(int index) {
   this.setBit(BOOLEAN_BIT_CONSTANTWIDTH, true);
   int count = 0;
   for (Iterator<LW2DVertex> i = this.vertices.iterator(); i.hasNext(); ) {
     LW2DVertex v = i.next();
     if (count == index) {
       i.remove();
     } else if (!v.isConstantWidth()) {
       this.setBit(BOOLEAN_BIT_CONSTANTWIDTH, false);
     }
     count++;
   }
 }
Esempio n. 3
0
  public boolean isConstantWidth() {
    // TODO review to see if the
    // property is always set correct
    if (!isBitEnabled(BOOLEAN_BIT_CONSTANTWIDTH)) {
      return false;
    } else {
      setBit(BOOLEAN_BIT_CONSTANTWIDTH, true);

      Iterator<LW2DVertex> i = vertices.iterator();

      while (i.hasNext()) {
        LW2DVertex vertex = i.next();

        if (!vertex.isConstantWidth()) {
          setBit(BOOLEAN_BIT_CONSTANTWIDTH, false);

          return isBitEnabled(BOOLEAN_BIT_CONSTANTWIDTH);
        }
      }
    }

    return isBitEnabled(BOOLEAN_BIT_CONSTANTWIDTH);
  }