Package ns.foundation

Examples of ns.foundation.NSRange


  }

  public void testRemoveIdenticalObjectObjectNSRange() {
    String def = "def";
    NSMutableArray<String> array = new NSMutableArray<String>(new String[] { "abc", def });
    NSRange range = new NSRange(1, 1);
    array.removeIdenticalObject(def, range);
    assertEquals(1, array.size());
    assertEquals("abc", array.get(0));
  }
View Full Code Here


    assertEquals("abc", array.get(0));
  }

  public void testRemoveObjectObjectNSRange() {
    NSMutableArray<String> array = new NSMutableArray<String>(new String[] { "abc", "def" });
    NSRange range = new NSRange(1, 1);
    array.removeObject("def", range);
    assertEquals(1, array.size());
    assertEquals("abc", array.get(0));
  }
View Full Code Here

    assertEquals("abc", array.get(0));
  }

  public void testRemoveObjectsInRange() {
    NSMutableArray<String> array = new NSMutableArray<String>(new String[] { "abc", "def", "ghi" });
    NSRange range = new NSRange(1, 2);
    array.removeObjectsInRange(range);
    assertEquals(1, array.size());
    assertEquals("abc", array.get(0));
  }
View Full Code Here

  }

  public void testReplaceObjectsInRange() {
    NSArray<String> array = new NSArray<String>(new String[] { "abc", "def", "ghi" });
    NSArray<String> array2 = new NSArray<String>(new String[] { "123", "456" });
    NSRange sourceRange = new NSRange(1, 2);
    NSRange otherRange = new NSRange(0, 2);
    NSMutableArray<String>array3  = array.mutableClone();
    array3.replaceObjectsInRange(sourceRange, array2, otherRange);
    assertEquals(3, array3.size());
    assertEquals("abc", array3.get(0));
    assertEquals("123", array3.get(1));
    assertEquals("456", array3.get(2));
   
    array3 = array.mutableClone();
    sourceRange = new NSRange(0, 3);
    otherRange = new NSRange(0, 2);
    array3.replaceObjectsInRange(sourceRange, array2, otherRange);
    assertEquals(2, array3.size());
    assertEquals(array2, array3);

    array3 = array.mutableClone();
    sourceRange = new NSRange(2, 1);
    otherRange = new NSRange(0, 2);
    array3.replaceObjectsInRange(sourceRange, array2, otherRange);
    assertEquals(4, array3.size());
    assertEquals("abc", array3.get(0));
    assertEquals("def", array3.get(1));
    assertEquals("123", array3.get(2));   
View Full Code Here

import ns.foundation.NSRange;

public class TestNSMutableRange extends BaseTestCase {

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

    assertEquals(range, clone);
  }

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

    assertEquals(1, range.location());
  }

  public void testUnionRange() {
    NSMutableRange range = new NSMutableRange(2,3);
    NSRange otherRange = new NSRange(3, 3);
    range.unionRange(otherRange);
    assertEquals(2, range.location());
    assertEquals(4, range.length());
  }
View Full Code Here

TOP

Related Classes of ns.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.