Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8d78ad0

Browse files
committed
(4.2, only for legay Jmol) adding more efficient @j2sOverride and
@j2sIgnore and @j2sIgnoreSuperavoids SearchAndExecuteMethod better
1 parentdbde100 commit8d78ad0

File tree

12 files changed

+113
-35
lines changed

12 files changed

+113
-35
lines changed
209 Bytes
Binary file not shown.

‎sources/net.sf.j2s.java.core/site-resources_4.2/jsmol/js/j2sjmol.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ Clazz.defineMethod = function (clazzThis, funName, funBody, funParams) {
894894
if(!f$.stacks||f$.claxxReference!==clazzThis){
895895
//Generate a new delegating method for the class
896896
varid=++SAEMid;
897-
console.log("SAEM "+clazzThis.__CLASS_NAME__+"."+funName);
897+
//console.log("SAEM " + clazzThis.__CLASS_NAME__ + "." + funName);
898898
vardelegate=function(){
899899
returnsearchAndExecuteMethod(id,this,arguments.callee.claxxReference,arguments.callee.methodName,arguments);
900900
};

‎sources/net.sf.j2s.java.core/src_4.2/com/jcraft/jzlib/InflaterInputStream.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ public int readByteAsInt() throws IOException {
8484
returnread(byte1,0,1) == -1 ? -1 :byte1[0] &0xff;
8585
}
8686

87+
/**
88+
* @j2sOverride
89+
*/
8790
@Override
8891
publicintread(byte[]b,intoff,intlen)throwsIOException {
8992
returnreadInf(b,off,len);

‎sources/net.sf.j2s.java.core/src_4.2/java/io/BufferedInputStream.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,9 @@ private int isRead(byte[] b, int off, int len) throws IOException {
304304
}
305305

306306
/**
307+
*
308+
* @j2sOverride
309+
*
307310
* Reads bytes from this byte-input stream into the specified byte array,
308311
* starting at the given offset.
309312
*

‎sources/net.sf.j2s.java.core/src_4.2/java/io/ByteArrayInputStream.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ public synchronized int readByteAsInt() {
148148
}
149149

150150
/**
151+
* @j2sOverride
152+
151153
* Reads up to <code>len</code> bytes of data into an array of bytes
152154
* from this input stream.
153155
* If <code>pos</code> equals <code>count</code>,

‎sources/net.sf.j2s.java.core/src_4.2/java/io/DataInputStream.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ public DataInputStream(InputStream in) {
104104
// }
105105

106106
/**
107+
* @j2sOverride
108+
*
107109
* Reads up to <code>len</code> bytes of data from the contained input stream
108110
* into an array of bytes. An attempt is made to read as many as
109111
* <code>len</code> bytes, but a smaller number may be read, possibly zero.

‎sources/net.sf.j2s.java.core/src_4.2/java/io/FilterInputStream.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ public int readByteAsInt() throws IOException {
111111
// }
112112

113113
/**
114+
* @j2sOverride
115+
*
114116
* Reads up to <code>len</code> bytes of data from this input stream
115117
* into an array of bytes. If <code>len</code> is not zero, the method
116118
* blocks until some input is available; otherwise, no

‎sources/net.sf.j2s.java.core/src_4.2/java/util/ArrayList.java‎

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,28 +45,36 @@ public class ArrayList<E> extends AbstractList<E> implements List<E>, Cloneable,
4545
privatetransientE[]array;
4646

4747
/**
48+
* @j2sIgnore
49+
*
4850
* Constructs a new instance of ArrayList with zero capacity.
4951
*/
5052
publicArrayList() {
5153
this(0);
5254
}
5355

5456
/**
57+
* @j2sIgnore
5558
* Constructs a new instance of ArrayList with the specified capacity.
5659
*
5760
* @param capacity
5861
* the initial capacity of this ArrayList
5962
*/
6063
publicArrayList(intcapacity) {
61-
firstIndex =lastIndex =0;
64+
setCapacity(capacity);
65+
}
66+
67+
privatevoidsetCapacity(intcapacity) {
6268
try {
6369
array =newElementArray(capacity);
6470
}catch (NegativeArraySizeExceptione) {
6571
thrownewIllegalArgumentException();
6672
}
67-
}
6873

74+
}
6975
/**
76+
* @j2sIgnoreSuperConstructor
77+
*
7078
* Constructs a new instance of ArrayList containing the elements in the
7179
* specified collection. The ArrayList will have an initial capacity which
7280
* is 110% of the size of the collection. The order of the elements in this
@@ -76,8 +84,25 @@ public ArrayList(int capacity) {
7684
* the collection of elements to add
7785
*/
7886
publicArrayList(Collection<?extendsE>collection) {
79-
intsize =collection.size();
8087
firstIndex =lastIndex =0;
88+
intn = -1;
89+
/**
90+
* @j2sNative
91+
* if (!collection) {
92+
* n = 0;
93+
* } else if (typeof collection == "number") {
94+
* n = collection;
95+
* }
96+
*
97+
*
98+
*
99+
*/
100+
{}
101+
if (n >=0) {
102+
setCapacity(n);
103+
return;
104+
}
105+
intsize =collection.size();
81106
array =newElementArray(size + (size /10));
82107
addAll(collection);
83108
}
@@ -103,6 +128,10 @@ private E[] newElementArray(int size) {
103128
*/
104129
@Override
105130
publicvoidadd(intlocation,Eobject) {
131+
add2(location,object);
132+
}
133+
134+
publicvoidadd2(intlocation,Eobject) {
106135
intsize =size();
107136
if (0 <location &&location <size) {
108137
if (firstIndex ==0 &&lastIndex ==array.length) {
@@ -131,7 +160,6 @@ public void add(int location, E object) {
131160
}else {
132161
thrownewIndexOutOfBoundsException();
133162
}
134-
135163
modCount++;
136164
}
137165

@@ -639,6 +667,8 @@ public Object[] toArray() {
639667
}
640668

641669
/**
670+
* @j2sOverride
671+
*
642672
* Answers an array containing all elements contained in this ArrayList. If
643673
* the specified array is large enough to hold the elements, the specified
644674
* array is used, otherwise an array of the same type is created. If the

‎sources/net.sf.j2s.java.core/src_4.2/java/util/Arrays.java‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ private Arrays() {
4343

4444

4545
/**
46+
* @j2sIgnore
47+
*
4648
* Assigns the specified Object reference to each element of the specified
4749
* array of Objects.
4850
*
@@ -71,6 +73,15 @@ public static void fill(Object[] a, Object val) {
7173
* <tt>toIndex &gt; a.length</tt>
7274
*/
7375
publicstaticvoidfill(Object[]a,intfromIndex,inttoIndex,Objectval){
76+
/**
77+
* @j2sNative
78+
* if (arguments.length == 2) {
79+
* val = arguments[1];
80+
* fromIndex = 0;
81+
* toIndex = a.length;
82+
* }
83+
*/
84+
{}
7485
rangeCheck(a.length,fromIndex,toIndex);
7586
for (inti=fromIndex;i<toIndex;i++)
7687
a[i] =val;

‎sources/net.sf.j2s.java.core/src_4.2/java/util/Hashtable.java‎

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ public class Hashtable<K,V>
161161
privatetransientintmodCount;
162162

163163
/**
164+
* @j2sIgnore
165+
*
164166
* SwingJS note: This constructor DOES NOT allow JavaScript Map object for
165167
* Hashtable<String,?>.
166168
*
@@ -173,7 +175,6 @@ public class Hashtable<K,V>
173175
* zero, or if the load factor is
174176
* nonpositive.
175177
*
176-
* @j2sIgnore
177178
*/
178179
publicHashtable(intcapacity,floatloadFactor) {
179180
super();
@@ -212,9 +213,12 @@ public Hashtable(int initialCapacity) {
212213
*
213214
* @j2sIgnoreSuperConstructor
214215
*/
215-
@SuppressWarnings("unused")
216216
publicHashtable() {
217-
super();
217+
initHT();
218+
}
219+
220+
@SuppressWarnings("unused")
221+
protectedvoidinitHT() {
218222
Hashtablemap =null;
219223
intcapacity =11;
220224
floatloadFactor =0.75f;
@@ -248,9 +252,9 @@ public Hashtable() {
248252
__setJS();
249253
if (map !=null)
250254
putAll(map);
251-
}
255+
}
252256

253-
/**
257+
/**
254258
* Constructs a new hashtable with the same mappings as the given
255259
* Map. The hashtable is created with an initial capacity sufficient to
256260
* hold the mappings in the given Map and a default load factor (0.75).
@@ -762,6 +766,8 @@ public synchronized Object clone() {
762766
}
763767

764768
/**
769+
* @j2sOverride
770+
*
765771
* Returns a string representation of this <tt>Hashtable</tt> object
766772
* in the form of a set of entries, enclosed in braces and separated
767773
* by the ASCII characters "<tt>,&nbsp;</tt>" (comma and space). Each
@@ -777,21 +783,20 @@ public synchronized String toString() {
777783
if (max == -1)
778784
return"{}";
779785

780-
StringBuildersb =newStringBuilder();
781786
Iterator<Map.Entry<K,V>>it =entrySet().iterator();
782787

783-
sb.append('{');
788+
Stringsb ="{";
784789
for (inti =0; ;i++) {
785790
Map.Entry<K,V>e =it.next();
786791
Kkey =e.getKey();
787792
Vvalue =e.getValue();
788-
sb.append(key ==this ?"(this Map)" :key.toString());
789-
sb.append('=');
790-
sb.append(value ==this ?"(this Map)" :value.toString());
793+
sb += (key ==this ?"(this Map)" :key.toString());
794+
sb +="=";
795+
sb +=(value ==this ?"(this Map)" :value.toString());
791796

792797
if (i ==max)
793-
returnsb.append('}').toString();
794-
sb.append(", ");
798+
returnsb +'}';
799+
sb +=", ";
795800
}
796801
}
797802

@@ -1432,6 +1437,7 @@ static void __set(Map map, Object key, Object value) {
14321437
*
14331438
* map.__m.set(key == null ? null : key + "", value)
14341439
*/
1440+
{}
14351441
}
14361442

14371443
/**
@@ -1491,6 +1497,7 @@ static void __ensureJavaMap(Map map) {
14911497
* m.clear();
14921498
* }
14931499
*/
1500+
{}
14941501
}
14951502

14961503
/**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp