| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent eb7c654 commit a307092
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -577,17 +577,18 @@ public void swap(int a, int b) { | |||
| 577 | 577 | // } | |
| 578 | 578 | ||
| 579 | 579 | ||
| 580 | - public void subset(int start) { | ||
| 581 | - subset(start, count - start); | ||
| 582 | - } | ||
| 580 | + // public void subset(int start) { | ||
| 581 | + // subset(start, count - start); | ||
| 582 | + // } | ||
| 583 | 583 | ||
| 584 | 584 | ||
| 585 | - public void subset(int start, int num) { | ||
| 586 | - for (int i = 0; i < num; i++) { | ||
| 587 | - data[i] = data[i+start]; | ||
| 588 | - } | ||
| 589 | - count = num; | ||
| 590 | - } | ||
| 585 | + // public void subset(int start, int num) { | ||
| 586 | + // for (int i = 0; i < num; i++) { | ||
| 587 | + // data[i] = data[i+start]; | ||
| 588 | + // } | ||
| 589 | + // count = num; | ||
| 590 | + // } | ||
| 591 | + | ||
| 591 | 592 | ||
| 592 | 593 | /** | |
| 593 | 594 | * @webref floatlist:method | |
@@ -707,6 +708,18 @@ public float[] array(float[] array) { | |||
| 707 | 708 | } | |
| 708 | 709 | ||
| 709 | 710 | ||
| 711 | + public FloatList getSubset(int start) { | ||
| 712 | + return getSubset(start, count - start); | ||
| 713 | + } | ||
| 714 | + | ||
| 715 | + | ||
| 716 | + public FloatList getSubset(int start, int num) { | ||
| 717 | + float[] subset = new float[num]; | ||
| 718 | + System.arraycopy(data, start, subset, 0, num); | ||
| 719 | + return new FloatList(subset); | ||
| 720 | + } | ||
| 721 | + | ||
| 722 | + | ||
| 710 | 723 | @Override | |
| 711 | 724 | public String toString() { | |
| 712 | 725 | StringBuilder sb = new StringBuilder(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -704,11 +704,9 @@ public IntList getSubset(int start) { | |||
| 704 | 704 | ||
| 705 | 705 | ||
| 706 | 706 | public IntList getSubset(int start, int num) { | |
| 707 | - IntList outgoing = new IntList(num); | ||
| 708 | - for (int i = 0; i < num; i++) { | ||
| 709 | - System.arraycopy(data, start, outgoing.data, 0, num); | ||
| 710 | - } | ||
| 711 | - return outgoing; | ||
| 707 | + int[] subset = new int[num]; | ||
| 708 | + System.arraycopy(data, start, subset, 0, num); | ||
| 709 | + return new IntList(subset); | ||
| 712 | 710 | } | |
| 713 | 711 | ||
| 714 | 712 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -648,11 +648,9 @@ public StringList getSubset(int start) { | |||
| 648 | 648 | ||
| 649 | 649 | ||
| 650 | 650 | public StringList getSubset(int start, int num) { | |
| 651 | - StringList outgoing = new StringList(num); | ||
| 652 | - for (int i = 0; i < num; i++) { | ||
| 653 | - System.arraycopy(data, start, outgoing.data, 0, num); | ||
| 654 | - } | ||
| 655 | - return outgoing; | ||
| 651 | + String[] subset = new String[num]; | ||
| 652 | + System.arraycopy(data, start, subset, 0, num); | ||
| 653 | + return new StringList(subset); | ||
| 656 | 654 | } | |
| 657 | 655 | ||
| 658 | 656 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments