Examples of NSRange


Examples of com.webobjects.foundation.NSRange

  public NSArray<Movie> movies() {
    return Movie.fetchAllMovies(ERXEC.newEditingContext(), Movie.TITLE.asc().array());
  }

  public NSArray<Movie> onlyFiveMovies() {
    NSRange range = new NSRange(0, 5);
    return movies().subarrayWithRange(range);
  }
View Full Code Here

Examples of com.webobjects.foundation.NSRange

   * @param options
   *            the current options
   * @return the effective batch number
   */
  public NSRange range(NSKeyValueCoding options) {
    NSRange range = null;
   
    String rangeStr = (String)options.valueForKey("Range");
    if (rangeStr != null) {
      Matcher rangeMatcher = _rangePattern.matcher(rangeStr);
      if (rangeMatcher.matches()) {
        int start = Integer.parseInt(rangeMatcher.group(1));
        int length = Integer.parseInt(rangeMatcher.group(2)) - start + 1;
        range = new NSRange(start, length);
      }
    }
    else {
      int batchNumber = batchNumber(options);
      int batchSize = batchSize(options);
      if (batchSize > 0) {
        range = new NSRange(batchNumber * batchSize, batchSize);
      }
    }
   
    return range;
  }
View Full Code Here

Examples of com.webobjects.foundation.NSRange

    EOFetchSpecification fetchSpec = new EOFetchSpecification(_entityName, qualifier, sortOrderings);
    fetchSpec.setIsDeep(true);

    NSArray<T> objects;
    NSRange range = range(options);
    if (range == null) {
      objects = editingContext.objectsWithFetchSpecification(fetchSpec);
      results = new Results<T>(objects, 0, -1, objects.count());
    }
    else {
      ERXFetchSpecificationBatchIterator batchIterator = new ERXFetchSpecificationBatchIterator(fetchSpec, editingContext, range.length());
      objects = batchIterator.batchWithRange(range);
      results = new Results<T>(objects, range.location(), range.length(), batchIterator.count());
    }
    return results;
  }
View Full Code Here

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

Examples of com.webobjects.foundation.NSRange

    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

Examples of com.webobjects.foundation.NSRange

      _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

Examples of ns.foundation.NSRange

import ns.foundation.NSRange;

public class TestNSRange extends BaseTestCase {

  public void testNSRange() {
    NSRange range = new NSRange();
    assertEquals(new NSRange(0,0), range);
  }
View Full Code Here

Examples of ns.foundation.NSRange

    NSRange range = new NSRange();
    assertEquals(new NSRange(0,0), range);
  }

  public void testNSRangeIntInt() {
    NSRange range = new NSRange(2,3);
    assertEquals(2, range.location());
    assertEquals(3, range.length());
  }
View Full Code Here

Examples of ns.foundation.NSRange

    assertEquals(2, range.location());
    assertEquals(3, range.length());
  }

  public void testNSRangeNSRange() {
    NSRange range = new NSRange(1,1);
    NSRange otherRange = new NSRange(range);
    assertEquals(range, otherRange);
  }
View Full Code Here

Examples of ns.foundation.NSRange

    NSRange otherRange = new NSRange(range);
    assertEquals(range, otherRange);
  }

  public void testLocation() {
    NSRange range = new NSRange(2,3);
    assertEquals(2, range.location());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.