determine length of row since we have chunks now.
 Since chunk implements length, so not required except for the old
 cases of demos that use an array.
503956
def row_length
      case @buffer
      when String
        @buffer.length
      when Chunks::ChunkLine
        return @buffer.length
      when Array
        # this is for those old cases like rfe.rb which sent in an array
        # (before we moved to chunks) 
        # line is an array of arrays
        if @buffer[0].is_a? Array
          result = 0
          @buffer.each {|e| result += e[1].length  }
          return result
        end
        # line is one single chunk
        return @buffer[1].length
      end
    end
664480
def determine_lengths(dtrajs):
    
    """
    if (isinstance(dtrajs[0], (int))):
        return len(dtrajs) * np.ones((1))
    lengths = np.zeros((len(dtrajs)))
    for i in range(len(dtrajs)):
        lengths[i] = len(dtrajs[i])
    return lengths
75439
def length(self):
        """"""
        return sum([shot.length for shot in self.shots if not shot.is_splay])
1269996
private int findMaxRowLength(String maze[]){
        int max = 0;
        for (String rowMaze : maze) {
            if (rowMaze.length() > max) max = rowMaze.length();
        }
        return max;
    }
371575
public int getLength()
  {
    int length = 0;
    
    for (TempBuffer ptr = _head; ptr != null; ptr = ptr.next()) {
      length += ptr.length();
    }

    return length;
  }
997310
def _determineLength(self, fObj):
        
        try:
            seek = fObj.seek
            tell = fObj.tell
        except AttributeError:
            return UNKNOWN_LENGTH
        originalPosition = tell()
        seek(0, self._SEEK_END)
        end = tell()
        seek(originalPosition, self._SEEK_SET)
        return end - originalPosition
138396
@Override
    public int size() {
	final Segment<K, V>[] segments = this.segments;
	long sum = 0;
	long check = 0;
	int[] mc = new int[segments.length];
	// Try a few times to get accurate count. On failure due to
	// continuous async changes in table, resort to locking.
	for (int k = 0; k < RETRIES_BEFORE_LOCK; ++k) {
	    check = 0;
	    sum = 0;
	    int mcsum = 0;
	    for (int i = 0; i < segments.length; ++i) {
		sum += segments[i].count;
		mcsum += mc[i] = segments[i].modCount;
	    }
	    if (mcsum != 0) {
		for (int i = 0; i < segments.length; ++i) {
		    check += segments[i].count;
		    if (mc[i] != segments[i].modCount) {
			check = -1; // force retry
			break;
		    }
		}
	    }
	    if (check == sum) break;
	}
	if (check != sum) { // Resort to locking all segments
	    sum = 0;
	    for (int i = 0; i < segments.length; ++i)
		segments[i].lock();
	    for (int i = 0; i < segments.length; ++i)
		sum += segments[i].count;
	    for (int i = 0; i < segments.length; ++i)
		segments[i].unlock();
	}
	if (sum > Integer.MAX_VALUE) return Integer.MAX_VALUE;
	return (int) sum;
    }
737883
function getWithLength(length) {
  var arrays = pool[length];
  var array;
  var i;

  // Create the first array for the specified length
  if (!arrays) {
    array = create(length);
  }

  // Find an unused array among the created arrays for the specified length
  if (!array) {
    for (i = arrays.length; i--;) {
      if (!arrays[i].inUse) {
        array = arrays[i];
        break;
      }
    }

    // If no array was found, create a new one
    if (!array) {
      array = create(length);
    }
  }

  array.inUse = true;
  return array;
}
445404
public int length() {
        if(keys == null)
            return 0;
        int retval=0;
        for(byte[] key: keys)
            if(key != null)
                retval++;
        return retval;
    }
61416
public static <T extends Chunkable> int chunkCountFrom(T chunkable, int chunkLength) {
        byte[] data = chunkable.getChunkableData();
        return (int) Math.ceil(data.length * 1.0 / chunkLength);
    }
1126316
public int getLength()
  {      
    // Tell if this is being called from within a predicate.
  	boolean isPredicateTest = (this == m_execContext.getSubContextList());

    // And get how many total predicates are part of this step.
  	int predCount = getPredicateCount();
  	
    // If we have already calculated the length, and the current predicate 
    // is the first predicate, then return the length.  We don't cache 
    // the anything but the length of the list to the first predicate.
    if (-1 != m_length && isPredicateTest && m_predicateIndex < 1)
  		return m_length;
  	
    // I'm a bit worried about this one, since it doesn't have the 
    // checks found above.  I suspect it's fine.  -sb
    if (m_foundLast)
  		return m_pos;
  		
    // Create a clone, and count from the current position to the end 
    // of the list, not taking into account the current predicate and 
    // predicates after the current one.
    int pos = (m_predicateIndex >= 0) ? getProximityPosition() : m_pos;
              
    LocPathIterator clone;

    try
    {
      clone = (LocPathIterator) clone();        
    }
    catch (CloneNotSupportedException cnse)
    {
      return -1;
    }

    // We want to clip off the last predicate, but only if we are a sub 
    // context node list, NOT if we are a context list.  See pos68 test, 
    // also test against bug4638.
    if (predCount > 0 && isPredicateTest)
    {
      // Don't call setPredicateCount, because it clones and is slower.
      clone.m_predCount = m_predicateIndex;
      // The line above used to be:
      // clone.m_predCount = predCount - 1;
      // ...which looks like a dumb bug to me. -sb
    }

    int next;

    while (DTM.NULL != (next = clone.nextNode()))
    {
      pos++;
    }
    
    if (isPredicateTest && m_predicateIndex < 1)
      m_length = pos;
    
    return pos;
  }
609633
public function length(): int {
        $array = \array_filter($this->heap, function ($v, $k) {
            return $v !== null;
        }, \ARRAY_FILTER_USE_BOTH);
        return \count($array) - 1;
    }
906232
public static int length(Object obj) {
		if (obj == null) {
			return 0;
		}
		if (obj instanceof CharSequence) {
			return ((CharSequence) obj).length();
		}
		if (obj instanceof Collection) {
			return ((Collection<?>) obj).size();
		}
		if (obj instanceof Map) {
			return ((Map<?, ?>) obj).size();
		}

		int count;
		if (obj instanceof Iterator) {
			Iterator<?> iter = (Iterator<?>) obj;
			count = 0;
			while (iter.hasNext()) {
				count++;
				iter.next();
			}
			return count;
		}
		if (obj instanceof Enumeration) {
			Enumeration<?> enumeration = (Enumeration<?>) obj;
			count = 0;
			while (enumeration.hasMoreElements()) {
				count++;
				enumeration.nextElement();
			}
			return count;
		}
		if (obj.getClass().isArray() == true) {
			return Array.getLength(obj);
		}
		return -1;
	}
529418
public static int length(IntBuffer buffer) {
        int ret = 1;
        IntBuffer shape = Shape.shapeOf(buffer);
        int rank = Shape.rank(buffer);
        for (int i = 0; i < rank; i++)
            ret *= shape.get(i);
        return ret;
    }
323973
private int readChunkSize() {
        // read chunk size from database
        int chunkSize = -1;
        Connection conn = null;
        try {
            Class.forName("org.sqlite.JDBC");
            conn = DriverManager.getConnection("jdbc:sqlite:" + databasePath);
            Statement stmt = conn.createStatement();
            ResultSet rs = stmt.executeQuery("SELECT value FROM info where name = 'chunkSize';");
            while (rs.next()) {
                // the first is read
                chunkSize = Integer.parseInt(rs.getString("value"));
                break;
            }
            conn.close();
        } catch (SQLException e) {
            logger.error(e.getClass().getName() + ": " + e.getMessage());
            cleanConnectionClose(conn, null);
        } catch (ClassNotFoundException e) {
            logger.error(e.getClass().getName() + ": " + e.getMessage());
            e.printStackTrace();
        }
        return chunkSize;
    }
1130265
public static long lengthOfBuffer(@NonNull long[] shape, @NonNull long[] stride){
        Preconditions.checkArgument(shape.length == stride.length, "Shape and strides must be same length: shape %s, stride %s",
                shape, stride);
        //Length is simply 1 + the buffer index of the last element
        long length = 1;
        for(int i=0; i<shape.length; i++ ){
            length += (shape[i]-1) * stride[i];
        }
        return length;
    }
1218345
function length(A) {
    if (A.shape.length !== 1) {
        throw new Error('A is not a 1D array');
    }
    return Math.sqrt(dot(A, A));
}