Package com.webobjects.foundation

Examples of com.webobjects.foundation.NSRange


      int length = batchSize;
      if (offset >= results.count()) {
        results = NSArray.<T> emptyArray();
      }
      else {
        NSRange range;
        if (offset + length > results.count()) {
          range = new NSRange(offset, results.count() - offset);
        }
        else {
          range = new NSRange(offset, length);
        }
        results = results.subarrayWithRange(range);
      }
    }
    return results;
View Full Code Here


    if (!ERXValueUtilities.isNull(obj)) {
      if (obj instanceof NSData) {
        value = (NSData) obj;
      } else if (obj instanceof byte[]) {
        byte[] byteValue = (byte[]) obj;
        value = new NSData(byteValue, new NSRange(0, byteValue.length), true);
      } else if (obj instanceof String) {
        String strValue = ((String) obj).trim();
        if (strValue.length() > 0) {
          Object objValue = NSPropertyListSerialization.propertyListFromString(strValue); // MS:
                                                  // Encoding?
View Full Code Here

      _valueClass = _NSUtilities.classWithName(className());//_valueClassName);
      if (_valueClass == null)
        _valueClass = dataClass;
    }
    if (_valueClass == dataClass || _argumentType == FactoryMethodArgumentIsData || _valueFactoryMethod == null) {
      data = new NSData(bytes, new NSRange(0, bytes.length), true);
      if (_valueClass == dataClass || _valueFactoryMethod == null)
        return data;
    }
    switch (_argumentType) {
    default:
View Full Code Here

    for (int i = 0; i < sourceObjects.count(); i += batchSize) {
      int rangeSize = batchSize;
      if (i + batchSize > sourceObjects.count()) {
        rangeSize = sourceObjects.count() - i;
      }
      NSRange range = new NSRange(i, rangeSize);
      NSArray batchedSourceObjects = sourceObjects.subarrayWithRange(range);
      batchFetch(batchedSourceObjects, keypaths, skipFaultedSourceObjects);
    }
  }
View Full Code Here

        NSArray<T> result = null;
       
        if ( array != null ) {
            final int count = array.count();
           
            result = count > 1 ? array.subarrayWithRange(new NSRange(1, count-1)) : NSArray.EmptyArray;
        }
       
        return result;
    }
View Full Code Here

        for(int i = 0; i < count; i+=batchSize) {
            int length = batchSize;
            if(i + length > count)
                length = count - i;
            batchedArray.addObject(array.subarrayWithRange(new NSRange(i, length)));
        }
        return batchedArray;
    }
View Full Code Here

     * automatic support for the Iterator and Enumeration interfaces.
     * @return next batch
     */
    protected NSArray _fetchNextBatch() {
        if (hasNextBatch()) {
            NSRange range = _rangeForOffset(currentObjectFetchCount);
            NSArray nextBatch = batchWithRange(range);
            currentObjectFetchCount += range.length();
            return nextBatch;
        }
        throw new IllegalStateException("Iterator is exhausted");
    }
View Full Code Here

        int totalCountMinusStart = count() - start;
        int length = totalCountMinusStart > batchSize ? batchSize : totalCountMinusStart;
        if (length < 0) {
          length = 0;
        }
        return new NSRange(start, length);
    }
View Full Code Here

     * Calling this method does not affect the position of the iterator.
     * @param index index of batch to retrieve
     * @return batch of enterprise objects
     */
    public NSArray batchWithIndex(int index) {
        NSRange range = _rangeForBatchIndex(index);
        return batchWithRange(range);
    }
View Full Code Here

        if ( ec == null) {
            throw new IllegalStateException("ERXFetchSpecificationBatchIterator: Calling nextBatch with a null editing context!");
        }

        NSArray nextBatch = null;
        NSRange range = requestedRange.rangeByIntersectingRange( new NSRange(0, count()) ); //intersect with legal range
        if ( range.length() > 0 ) {
            NSArray primaryKeys = primaryKeys();
            NSArray primaryKeysToFetch = primaryKeys.subarrayWithRange(range);

            log.debug("Of primaryKey count: " + primaryKeys.count() + " fetching range: " + range + " which is: " + primaryKeysToFetch.count());
View Full Code Here

TOP

Related Classes of com.webobjects.foundation.NSRange

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.