public Assignment update(Border border){
  Arrays.sort(cs);
  int j=1;
  boolean found=(cs[0].core == border.core);
  for (int i=1; i < cs.length; i++) {
    if (cs[i].core != cs[i - 1].core) {
      cs[j++]=cs[i];
    }
    found|=(cs[i].core == border.core);
  }
  if (found) {
    if (j == 1) {
      Border r=cs[0];
      cs=null;
      return r;
    }
    if (j < cs.length) {
      cs=Arrays.copyOf(cs,j);
    }
    return this;
  }
  if (j + 1 != cs.length) {
    cs=Arrays.copyOf(cs,j + 1);
  }
  cs[j]=border;
  return this;
}

public Assignment update ( Border border ) { Arrays . sort ( cs ) ; int j = 1 ; boolean found = ( cs [ 0 ] . core == border . core ) ; for ( int i = 1 ; i < cs . length ; i ++ ) { if ( cs [ i ] . core != cs [ i - 1 ] . core ) { cs [ j ++ ] = cs [ i ] ; } found |= ( cs [ i ] . core == border . core ) ; } if ( found ) { if ( j == 1 ) { Border r = cs [ 0 ] ; cs = null ; return r ; } if ( j < cs . length ) { cs = Arrays . copyOf ( cs , j ) ; } return this ; } if ( j + 1 != cs . length ) { cs = Arrays . copyOf ( cs , j + 1 ) ; } cs [ j ] = border ; return this ; }
add a new border to the existing borders .
