Skip to content

Commit 083222c

Browse files
committed
add comment inside Collection and make some comments out function also
1 parent e9bf739 commit 083222c

3 files changed

Lines changed: 132 additions & 23 deletions

File tree

java/lang/Object/Object.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,20 @@ namespace Java {
205205
*/
206206
// void wait(long timeout, int nanos);
207207

208+
/**
209+
* Compare two object is equal or not
210+
* @param target
211+
* @return boolean
212+
*/
208213
boolean operator==(const Object &target) const {
209214
return this->equals(target);
210215
}
211216

217+
/**
218+
* Compare two object is not equal or not
219+
* @param target
220+
* @return boolean
221+
*/
212222
boolean operator!=(const Object &target) const {
213223
return !this->equals(target);
214224
}

java/util/AbstractCollection/AbstractCollection.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ namespace Java {
3636
namespace Util {
3737
template <typename E>
3838
class AbstractCollection : public Object, public virtual Collection<E> {
39-
public:
40-
string toString() const {
41-
return (string) "";
42-
}
4339
};
4440
}
4541
}

java/util/Collection/Collection.hpp

Lines changed: 122 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,38 +43,141 @@ namespace Java {
4343
template <typename E>
4444
class Collection : public virtual Iterable<E> {
4545
public:
46+
/**
47+
* Add a element to this collection
48+
* @param e
49+
* @return boolean
50+
*/
4651
virtual boolean add(E &e) = 0;
52+
53+
/**
54+
* Add a Collection element to this collection
55+
* @param c
56+
* @return boealn
57+
*/
4758
virtual boolean addAll(Collection<E> &c) = 0;
59+
60+
/**
61+
* Clear all element inside this collection
62+
* @return
63+
*/
4864
virtual void clear() = 0;
65+
66+
/**
67+
* Search for specified object, return true if it occurs
68+
* @param o
69+
* @return boolean
70+
*/
4971
virtual boolean contains(Object &o) const = 0;
50-
boolean containsAll(Collection<Object> &c) {
72+
73+
/**
74+
* Search for a Collection of object, return true if all element inside <c> occurs inside this collection
75+
* @param c
76+
* @return booealeam
77+
*/
78+
boolean containsAll(Collection<Object> &c) {
5179
return true;
5280
}
81+
82+
/**
83+
* Compare object <o> with this collection through hashCode(), return true if it is equal
84+
* @param o
85+
* @return boolean
86+
*/
5387
virtual boolean equals(Object &o) const = 0;
88+
89+
/**
90+
* Make a hashcode through this virtual address on memory
91+
* @return int
92+
*/
5493
virtual int hashCode() const = 0;
94+
95+
/**
96+
* A hash code value for this object.
97+
* @return int
98+
*/
5599
virtual boolean isEmpty() const = 0;
100+
101+
/**
102+
* Return an iterator at the start of this object
103+
* @return
104+
*/
56105
virtual Iterator<E> &iterator() const = 0;
57-
Java::Util::Stream::Stream<E> &parallelStream() {
58-
}
106+
107+
/**
108+
* Don't support this method
109+
* @return
110+
*/
111+
// Java::Util::Stream::Stream<E> &parallelStream();
112+
113+
/**
114+
* Remove a specified object inside this collection, return true if it exits and be removed also
115+
* @param o
116+
* @return boolean
117+
*/
59118
virtual boolean remove(Object &o) = 0;
119+
120+
/**
121+
* Remove a collection of object inside this collection, return true if it exits and be removed all also
122+
* @param c
123+
* @return
124+
*/
60125
virtual boolean removeAll(Collection<Object> &c) = 0;
61-
virtual boolean removeIf(Java::Util::Function::Predicate<E> &filter) = 0;
62-
virtual boolean retainAll(Collection<Object> &c) = 0;
126+
127+
/**
128+
* Don't support this method
129+
* @param filter
130+
* @return
131+
*/
132+
// virtual boolean removeIf(Java::Util::Function::Predicate<E> &filter) = 0;
133+
134+
/**
135+
* Don't support this method
136+
* @return
137+
*/
138+
// virtual boolean retainAll(Collection<Object> &c) = 0;
139+
140+
/**
141+
* Return number of element inside this collection
142+
* @return
143+
*/
63144
virtual int size() const = 0;
64-
Spliterator<E> &spliterator() {
65-
Spliterator<E> spliterator;
66-
return spliterator;
67-
}
68-
Java::Util::Stream::Stream<E> &stream() {
69-
Java::Util::Stream::Stream<E> *stream = new Java::Util::Stream::Stream<E>();
70-
return *stream;
71-
}
72-
Array<Object> &toArray() {
73-
Array<Object> *array = new Array<Object>();
74-
return *array;
75-
}
76-
template <typename T>
77-
Array<T> toArray(Array<T> &a) const;
145+
146+
/**
147+
* Don't support this method
148+
* @return
149+
*/
150+
// Spliterator<E> &spliterator() {
151+
// Spliterator<E> spliterator;
152+
// return spliterator;
153+
// }
154+
155+
/**
156+
* Don't support this method
157+
* @return
158+
*/
159+
// Java::Util::Stream::Stream<E> &stream() {
160+
// Java::Util::Stream::Stream<E> *stream = new Java::Util::Stream::Stream<E>();
161+
// return *stream;
162+
// }
163+
164+
/**
165+
* Don't support this method
166+
* @return
167+
*/
168+
// Array<Object> &toArray() {
169+
// Array<Object> *array = new Array<Object>();
170+
// return *array;
171+
// }
172+
173+
/**
174+
* Don't suppor this method
175+
* @param a
176+
* @return
177+
*/
178+
// template <typename T>
179+
// Array<T> toArray(Array<T> &a) const;
180+
78181
};
79182
}
80183
}

0 commit comments

Comments
 (0)