소스 검색

- Modified export to public

- Added some utility methods to StringBuilder
- Added new classes to live module
Stan Hebben 6 년 전
부모
커밋
0f1a3190dc
43개의 변경된 파일140개의 추가작업 그리고 43개의 파일을 삭제
  1. 1
    1
      collections/src/HashSet.zs
  2. 1
    1
      collections/src/LinkedList.zs
  3. 1
    1
      collections/src/NoSuchElementException.zs
  4. 1
    1
      collections/src/Queue.zs
  5. 1
    1
      collections/src/Set.zs
  6. 1
    3
      collections/src/Stack.zs
  7. 1
    1
      compactio/src/CompactBytesDataInput.zs
  8. 1
    1
      compactio/src/CompactBytesDataOutput.zs
  9. 1
    1
      compactio/src/CompactDataInput.zs
  10. 1
    1
      io/src/InputStream.zs
  11. 1
    1
      io/src/OutputStream.zs
  12. 1
    1
      io/src/Reader.zs
  13. 1
    1
      io/src/StringReader.zs
  14. 1
    1
      listeners/src/DummyListenerHandle.zs
  15. 1
    1
      live/src/ImmutableLiveBool.zs
  16. 1
    1
      live/src/ImmutableLiveObject.zs
  17. 1
    1
      live/src/ImmutableLiveString.zs
  18. 1
    1
      live/src/InverseLiveBool.zs
  19. 1
    1
      live/src/LiveArrayList.zs
  20. 1
    1
      live/src/LiveInt.zs
  21. 1
    1
      live/src/LiveList.zs
  22. 1
    1
      live/src/LiveObject.zs
  23. 1
    1
      live/src/LiveString.zs
  24. 3
    0
      live/src/MutableLiveBool.zs
  25. 3
    0
      live/src/MutableLiveInt.zs
  26. 1
    1
      live/src/MutableLiveList.zs
  27. 3
    0
      live/src/MutableLiveString.zs
  28. 24
    0
      live/src/SimpleLiveBool.zs
  29. 24
    0
      live/src/SimpleLiveInt.zs
  30. 24
    0
      live/src/SimpleLiveString.zs
  31. 3
    3
      stdlib/src/Arrays.zs
  32. 1
    1
      stdlib/src/Assoc.zs
  33. 1
    1
      stdlib/src/Chars.zs
  34. 1
    1
      stdlib/src/Comparable.zs
  35. 1
    1
      stdlib/src/Exception.zs
  36. 1
    1
      stdlib/src/IllegalArgumentException.zs
  37. 1
    1
      stdlib/src/Integers.zs
  38. 1
    1
      stdlib/src/List.zs
  39. 2
    2
      stdlib/src/Result.zs
  40. 1
    1
      stdlib/src/StringBuildable.zs
  41. 20
    2
      stdlib/src/StringBuilder.zs
  42. 1
    1
      stdlib/src/Strings.zs
  43. 1
    1
      stdlib/src/USize.zs

+ 1
- 1
collections/src/HashSet.zs 파일 보기

@@ -1,4 +1,4 @@
1
-export class HashSet<T> {
1
+public class HashSet<T> {
2 2
 	public implements Set<T> {
3 3
 		add(value as T) as bool;
4 4
 		remove(value as T) as bool;

+ 1
- 1
collections/src/LinkedList.zs 파일 보기

@@ -1,4 +1,4 @@
1
-export class LinkedList<T> {
1
+public class LinkedList<T> {
2 2
 	var first as Node?;
3 3
 	var last as Node?;
4 4
 	var size as usize : get;

+ 1
- 1
collections/src/NoSuchElementException.zs 파일 보기

@@ -1,4 +1,4 @@
1
-export class NoSuchElementException : Exception {
1
+public class NoSuchElementException : Exception {
2 2
 	public this(message as string) {
3 3
 		super(message);
4 4
 	}

+ 1
- 1
collections/src/Queue.zs 파일 보기

@@ -1,4 +1,4 @@
1
-export interface Queue<T> {
1
+public interface Queue<T> {
2 2
 	get empty as bool;
3 3
 	
4 4
 	poll() as T;

+ 1
- 1
collections/src/Set.zs 파일 보기

@@ -1,4 +1,4 @@
1
-export interface Set<T> {
1
+public interface Set<T> {
2 2
 	add(value as T) as bool;
3 3
 	remove(value as T) as bool;
4 4
 	

+ 1
- 3
collections/src/Stack.zs 파일 보기

@@ -1,6 +1,4 @@
1
-import stdlib.List;
2
-
3
-export class Stack<T> {
1
+public class Stack<T> {
4 2
 	var values as List<T> = new List<T>();
5 3
 	
6 4
 	public push(value as T) as void

+ 1
- 1
compactio/src/CompactBytesDataInput.zs 파일 보기

@@ -1,4 +1,4 @@
1
-export class CompactBytesDataInput {
1
+public class CompactBytesDataInput {
2 2
 	private const P6 as uint = 1 << 6;
3 3
 	private const P7 as uint = 1 << 7;
4 4
 	private const P13 as uint = 1 << 13;

+ 1
- 1
compactio/src/CompactBytesDataOutput.zs 파일 보기

@@ -1,4 +1,4 @@
1
-export class CompactBytesDataOutput {
1
+public class CompactBytesDataOutput {
2 2
 	private const P6 as uint = 1 << 6;
3 3
 	private const P7 as uint = 1 << 7;
4 4
 	private const P13 as uint = 1 << 13;

+ 1
- 1
compactio/src/CompactDataInput.zs 파일 보기

@@ -1,4 +1,4 @@
1
-export interface CompactDataInput {
1
+public interface CompactDataInput {
2 2
 	readBool`mutable() as bool;
3 3
 	
4 4
 	readByte`mutable() as byte;

+ 1
- 1
io/src/InputStream.zs 파일 보기

@@ -1,5 +1,5 @@
1 1
 [Native("io::InputStream")]
2
-export interface InputStream {
2
+public interface InputStream {
3 3
 	[Native("read")]
4 4
 	read() as int throws IOException;
5 5
 	

+ 1
- 1
io/src/OutputStream.zs 파일 보기

@@ -1,5 +1,5 @@
1 1
 [Native("io::OutputStream")]
2
-export interface OutputStream {
2
+public interface OutputStream {
3 3
 	[Native("write")]
4 4
 	write(value as byte) as void throws IOException;
5 5
 	

+ 1
- 1
io/src/Reader.zs 파일 보기

@@ -1,5 +1,5 @@
1 1
 [Native("io::Reader")]
2
-export interface Reader {
2
+public interface Reader {
3 3
 	[Native("destruct")]
4 4
 	~this;
5 5
 	

+ 1
- 1
io/src/StringReader.zs 파일 보기

@@ -1,5 +1,5 @@
1 1
 [Native("io::StringReader")]
2
-export class StringReader {
2
+public class StringReader {
3 3
 	val data as char[];
4 4
 	var offset as usize;
5 5
 	

+ 1
- 1
listeners/src/DummyListenerHandle.zs 파일 보기

@@ -1,4 +1,4 @@
1
-export class DummyListenerHandle<T> {
1
+public class DummyListenerHandle<T> {
2 2
 	val listener as T : get;
3 3
 	
4 4
 	public this(listener as T) {

+ 1
- 1
live/src/ImmutableLiveBool.zs 파일 보기

@@ -1,6 +1,6 @@
1 1
 import listeners.DummyListenerHandle;
2 2
 
3
-export class ImmutableLiveBool {
3
+public class ImmutableLiveBool {
4 4
 	public const TRUE = new ImmutableLiveBool(true);
5 5
 	public const FALSE = new ImmutableLiveBool(false);
6 6
 	

+ 1
- 1
live/src/ImmutableLiveObject.zs 파일 보기

@@ -1,6 +1,6 @@
1 1
 import listeners.DummyListenerHandle;
2 2
 
3
-export class ImmutableLiveObject<T> {
3
+public class ImmutableLiveObject<T> {
4 4
 	val value as T : get;
5 5
 	
6 6
 	public this(value as T) {

+ 1
- 1
live/src/ImmutableLiveString.zs 파일 보기

@@ -1,6 +1,6 @@
1 1
 import listeners.DummyListenerHandle;
2 2
 
3
-export class ImmutableLiveString {
3
+public class ImmutableLiveString {
4 4
 	val value as string : get;
5 5
 	
6 6
 	public this(value as string) {

+ 1
- 1
live/src/InverseLiveBool.zs 파일 보기

@@ -1,4 +1,4 @@
1
-export class InverseLiveBool {
1
+public class InverseLiveBool {
2 2
 	val source as LiveBool;
3 3
 	
4 4
 	public this(source as LiveBool) {

+ 1
- 1
live/src/LiveArrayList.zs 파일 보기

@@ -1,6 +1,6 @@
1 1
 import listeners.ListenerList;
2 2
 
3
-class LiveArrayList<T> {
3
+public class LiveArrayList<T> {
4 4
 	val values = new List<T>();
5 5
 	val listeners = new ListenerList<LiveList<T>.Listener<T>>();
6 6
 	

+ 1
- 1
live/src/LiveInt.zs 파일 보기

@@ -1,4 +1,4 @@
1
-export interface LiveInt {
1
+public interface LiveInt {
2 2
 	get value as int;
3 3
 	set value as int;
4 4
 	

+ 1
- 1
live/src/LiveList.zs 파일 보기

@@ -1,4 +1,4 @@
1
-export interface LiveList<T> : Iterable<T> {
1
+public interface LiveList<T> : Iterable<T> {
2 2
 	~this;
3 3
 	
4 4
 	get length as usize;

+ 1
- 1
live/src/LiveObject.zs 파일 보기

@@ -1,4 +1,4 @@
1
-export interface LiveObject<T> {
1
+public interface LiveObject<T> {
2 2
 	get value as T;
3 3
 	
4 4
 	addListener(listener as Listener<T>) as ListenerHandle<T>`unique;

+ 1
- 1
live/src/LiveString.zs 파일 보기

@@ -1,4 +1,4 @@
1
-export interface LiveString {
1
+public interface LiveString {
2 2
 	get value as string;
3 3
 	
4 4
 	addListener(listener as Listener) as ListenerHandle`unique;

+ 3
- 0
live/src/MutableLiveBool.zs 파일 보기

@@ -0,0 +1,3 @@
1
+public interface MutableLiveBool : LiveBool {
2
+	set value as bool;
3
+}

+ 3
- 0
live/src/MutableLiveInt.zs 파일 보기

@@ -0,0 +1,3 @@
1
+public interface MutableLiveInt : LiveInt {
2
+	set value as int;
3
+}

+ 1
- 1
live/src/MutableLiveList.zs 파일 보기

@@ -1,4 +1,4 @@
1
-export interface MutableLiveList<T> : LiveList<T> {
1
+public interface MutableLiveList<T> : LiveList<T> {
2 2
 	add(value as T) as void;
3 3
 	
4 4
 	insert(index as usize, value as T) as void;

+ 3
- 0
live/src/MutableLiveString.zs 파일 보기

@@ -0,0 +1,3 @@
1
+public interface MutableLiveString : LiveString {
2
+	set value as string;
3
+}

+ 24
- 0
live/src/SimpleLiveBool.zs 파일 보기

@@ -0,0 +1,24 @@
1
+import listeners.ListenerList;
2
+
3
+public class SimpleLiveBool {
4
+	val listeners = new ListenerList<LiveBool.Listener>;
5
+	
6
+	var value as bool : get;
7
+	
8
+	public this(value as bool) {
9
+		this.value = value;
10
+	}
11
+	
12
+	public implements MutableLiveBool {
13
+		addListener(listener) => listeners.add(listener);
14
+		
15
+		set value {
16
+			if $ == this.value
17
+				return;
18
+			
19
+			val oldValue = $value;
20
+			$value = $;
21
+			listeners.accept(listener => listener(oldValue, $value));
22
+		}
23
+	}
24
+}

+ 24
- 0
live/src/SimpleLiveInt.zs 파일 보기

@@ -0,0 +1,24 @@
1
+import listeners.ListenerList;
2
+
3
+public class SimpleLiveInt {
4
+	val listeners = new ListenerList<LiveInt.Listener>;
5
+	
6
+	var value as int : get;
7
+	
8
+	public this(value as int) {
9
+		this.value = value;
10
+	}
11
+	
12
+	public implements MutableLiveInt {
13
+		addListener(listener) => listeners.add(listener);
14
+		
15
+		set value {
16
+			if $ == this.value
17
+				return;
18
+			
19
+			val oldValue = $value;
20
+			$value = $;
21
+			listeners.accept(listener => listener(oldValue, $value));
22
+		}
23
+	}
24
+}

+ 24
- 0
live/src/SimpleLiveString.zs 파일 보기

@@ -0,0 +1,24 @@
1
+import listeners.ListenerList;
2
+
3
+public class SimpleLiveString {
4
+	val listeners = new ListenerList<LiveString.Listener>;
5
+	
6
+	var value as string : get;
7
+	
8
+	public this(value as string) {
9
+		this.value = value;
10
+	}
11
+	
12
+	public implements MutableLiveString {
13
+		addListener(listener) => listeners.add(listener);
14
+		
15
+		set value {
16
+			if $ == this.value
17
+				return;
18
+			
19
+			val oldValue = $value;
20
+			$value = $;
21
+			listeners.accept(listener => listener(oldValue, $value));
22
+		}
23
+	}
24
+}

+ 3
- 3
stdlib/src/Arrays.zs 파일 보기

@@ -1,12 +1,12 @@
1 1
 [Native("stdlib::Arrays")]
2
-export expand <T : Comparable<T>> T[] {
2
+public expand <T : Comparable<T>> T[] {
3 3
 	[Native("sort")]
4 4
 	public extern sort() as void;
5 5
 	[Native("sorted")]
6 6
 	public extern sorted() as T[];
7 7
 }
8 8
 
9
-export expand <T : Hashable<T>> T[] {
9
+public expand <T : Hashable<T>> T[] {
10 10
 	public implements Hashable<T[]> {
11 11
 		public extern hashCode() as int;
12 12
 		public extern == (other as T[]) as bool;
@@ -14,7 +14,7 @@ export expand <T : Hashable<T>> T[] {
14 14
 }
15 15
 
16 16
 [Native("stdlib::Arrays")]
17
-export expand <T> T[] {
17
+public expand <T> T[] {
18 18
 	[Native("sortWithComparator")]
19 19
 	public extern sort(comparator as function(a as T, b as T) as int) as void;
20 20
 	[Native("sortedWithComparator")]

+ 1
- 1
stdlib/src/Assoc.zs 파일 보기

@@ -1,4 +1,4 @@
1
-export expand <K, V> V[K] {
1
+public expand <K, V> V[K] {
2 2
 	mapValues<W>(projection as function(value as V) as W) as W[K] {
3 3
 		val result = new W[K];
4 4
 		for k, v in this

+ 1
- 1
stdlib/src/Chars.zs 파일 보기

@@ -1,4 +1,4 @@
1
-export expand char {
1
+public expand char {
2 2
 	public times(number as usize) as string
3 3
 		=> new string(new char[](number, this));
4 4
 }

+ 1
- 1
stdlib/src/Comparable.zs 파일 보기

@@ -1,5 +1,5 @@
1 1
 [Native("stdlib::Comparable")]
2
-export interface Comparable<T> {
2
+public interface Comparable<T> {
3 3
 	[Native("compareTo")]
4 4
 	compareTo(other as T) as int;
5 5
 }

+ 1
- 1
stdlib/src/Exception.zs 파일 보기

@@ -1,5 +1,5 @@
1 1
 [Native("stdlib::Exception")]
2
-export virtual class Exception {
2
+public virtual class Exception {
3 3
 	[Native("constructor")]
4 4
 	public this(message as string) {}
5 5
 	

+ 1
- 1
stdlib/src/IllegalArgumentException.zs 파일 보기

@@ -1,5 +1,5 @@
1 1
 [Native("stdlib::IllegalArgumentException")]
2
-export class IllegalArgumentException : Exception {
2
+public class IllegalArgumentException : Exception {
3 3
 	[Native("constructor")]
4 4
 	public this(message as string) {
5 5
 		super(message);

+ 1
- 1
stdlib/src/Integers.zs 파일 보기

@@ -1,5 +1,5 @@
1 1
 [Native("stdlib::Integer")]
2
-expand int {
2
+public expand int {
3 3
 	[Native("toHexString")]
4 4
 	public extern toHexString() as string;
5 5
 	

+ 1
- 1
stdlib/src/List.zs 파일 보기

@@ -1,5 +1,5 @@
1 1
 [Native("stdlib::List")]
2
-export class List<T> {
2
+public class List<T> {
3 3
 	[Native("constructor")]
4 4
 	public this() {}
5 5
 	

+ 2
- 2
stdlib/src/Result.zs 파일 보기

@@ -1,4 +1,4 @@
1
-export variant Result<T, E> {
1
+public variant Result<T, E> {
2 2
 	Ok(T),
3 3
 	Error(E);
4 4
 	
@@ -38,7 +38,7 @@ export variant Result<T, E> {
38 38
 	}
39 39
 }
40 40
 
41
-export expand <T, E : Exception> Result<T, E> {
41
+public expand <T, E : Exception> Result<T, E> {
42 42
 	public unwrap() as T throws E {
43 43
 		return match this {
44 44
 			Ok(result) => result,

+ 1
- 1
stdlib/src/StringBuildable.zs 파일 보기

@@ -1,4 +1,4 @@
1
-export interface StringBuildable {
1
+public interface StringBuildable {
2 2
 	toString(output as StringBuilder`borrow) as void;
3 3
 	
4 4
 	as string

+ 20
- 2
stdlib/src/StringBuilder.zs 파일 보기

@@ -1,5 +1,5 @@
1 1
 [Native("stdlib::StringBuilder")]
2
-export class StringBuilder {
2
+public class StringBuilder {
3 3
 	[Native("constructor")]
4 4
 	public extern this();
5 5
 	[Native("constructorWithCapacity")]
@@ -41,11 +41,29 @@ export class StringBuilder {
41 41
 	[Native("appendString")]
42 42
 	public extern <<(value as string) as StringBuilder;
43 43
 	
44
-	public <<`shared(value as StringBuildable`borrow) as StringBuilder`shared {
44
+	public <<(value as StringBuildable`borrow) as StringBuilder {
45 45
 		value.toString(this);
46 46
 		return this;
47 47
 	}
48 48
 	
49
+	public append<T : StringBuildable>(values as T[]`borrow, separator as string) as StringBuilder {
50
+		for i, value in values {
51
+			if i > 0
52
+				this << separator;
53
+			value.toString(this);
54
+		}
55
+		return this;
56
+	}
57
+	
58
+	public append<T>(values as T[]`borrow, stringer as function(value as T) as string, separator as string) as StringBuilder {
59
+		for i, value in values {
60
+			if i > 0
61
+				this << separator;
62
+			this << stringer(value);
63
+		}
64
+		return this;
65
+	}
66
+	
49 67
 	[Native("asString")]
50 68
 	public extern implicit as string;
51 69
 }

+ 1
- 1
stdlib/src/Strings.zs 파일 보기

@@ -1,5 +1,5 @@
1 1
 [Native("stdlib::String")]
2
-export expand string {
2
+public expand string {
3 3
 	[Native("fromAsciiBytes")]
4 4
 	public static fromAsciiBytes(data as byte[]) as string;
5 5
 	

+ 1
- 1
stdlib/src/USize.zs 파일 보기

@@ -1,5 +1,5 @@
1 1
 [Native("stdlib::USize")]
2
-expand usize {
2
+public expand usize {
3 3
 	[Native("toHexString")]
4 4
 	public extern toHexString() as string;
5 5
 	

Loading…
취소
저장