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

Commit 20e64dd

Browse files
Added position attribute
1 parent b551a12 commit 20e64dd

File tree

6 files changed

+50
-2
lines changed

6 files changed

+50
-2
lines changed

‎src/javaxt/utils/src/Class.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public class Class implements Member, Comparable {
1414
private ArrayList<String> extensions;
1515
private ArrayList<String> interfaces;
1616
private ArrayList<Config> config;
17+
private Integer position;
1718

1819

1920
public Class(String name){
@@ -149,6 +150,14 @@ public Class getParent(){
149150
return parent;
150151
}
151152

153+
public void setPosition(Integer position){
154+
this.position = position;
155+
}
156+
157+
public Integer getPosition(){
158+
return position;
159+
}
160+
152161
public JSONObject toJson(){
153162
JSONObject json = new JSONObject();
154163
json.set("name", name);

‎src/javaxt/utils/src/Config.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package javaxt.utils.src;
22
import java.util.*;
33

4-
public class Config {
4+
public class Config implementsMember{
55

66
private String name;
77
private String description;
88
private String defaultValue;
99
private ArrayList<Config> config;
10+
private Integer position;
1011

1112
public Config(String name){
1213
this.name = name;
@@ -44,4 +45,12 @@ public void addConfig(Config config){
4445
public ArrayList<Config> getConfig(){
4546
return config;
4647
}
48+
49+
public void setPosition(Integer position){
50+
this.position = position;
51+
}
52+
53+
public Integer getPosition(){
54+
return position;
55+
}
4756
}

‎src/javaxt/utils/src/Member.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22

33
public interface Member {
44
public String getName();
5+
public void setPosition(Integer position);
6+
public Integer getPosition();
57
}

‎src/javaxt/utils/src/Method.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public class Method implements Member {
1111
private ArrayList<Parameter> parameters;
1212
private boolean isDeprecated = false;
1313
private String deprecationMessage;
14+
private Integer position;
1415

1516
public Method(String name){
1617
this.name = name;
@@ -70,6 +71,14 @@ public ArrayList<Parameter> getParameters(){
7071
return parameters;
7172
}
7273

74+
public void setPosition(Integer position){
75+
this.position = position;
76+
}
77+
78+
public Integer getPosition(){
79+
return position;
80+
}
81+
7382
public String toString(){
7483
return name;
7584
}

‎src/javaxt/utils/src/Parser.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ else if (str.endsWith("class") || str.endsWith("interface")){
119119
boolean isInterface = str.contains("interface");
120120
cls.setInterface(isInterface);
121121
addMembers(cls, s.substring(start, end));
122+
cls.setPosition(i);
122123
classes.add(cls);
123124

124125

@@ -218,7 +219,7 @@ private static void addMembers(Class cls, String s){
218219
boolean isInterface = word.toString().equals("interface");
219220
innerClass.setInterface(isInterface);
220221
addMembers(innerClass, s.substring(start, end));
221-
222+
innerClass.setPosition(nextWord.end);
222223
cls.addMember(innerClass);
223224
}
224225

@@ -283,6 +284,7 @@ private static void addMembers(Class cls, String s){
283284
}
284285
method.setPublic(isPublic);
285286
method.setDescription(comment.getDescription());
287+
method.setPosition(word.end);
286288
cls.addMember(method);
287289

288290

@@ -386,6 +388,7 @@ else if (b<a || d<a){ //found property or class
386388
property.setType(type);
387389
property.setStatic(isStatic);
388390
property.setDefaultValue(defaultValue);
391+
property.setPosition(word.end);
389392
cls.addMember(property);
390393

391394

@@ -922,11 +925,13 @@ private static ArrayList<Class> getClasses(String s){
922925
cls.setNamespace(namespace);
923926
Comment comment = parseComment(fn.get("comment").toString());
924927
cls.setDescription(comment.getDescription());
928+
cls.setPosition(i);
925929
classes.add(cls);
926930

927931

928932
//Add constructor
929933
Constructor contructor = new Constructor(functionName);
934+
contructor.setPosition(start);
930935
for (Parameter parameter : getParameters(params, comment.getAnnotations())){
931936
contructor.addParameter(parameter);
932937
}
@@ -986,6 +991,7 @@ private static ArrayList<Method> getFunctions(String s){
986991
Method function = new Method(functionName);
987992
function.setDescription(comment.getDescription());
988993
function.setPublic(fn.get("isPublic").toBoolean());
994+
function.setPosition(word.end);
989995
functions.add(function);
990996

991997

@@ -1269,6 +1275,7 @@ private static ArrayList<Config> parseConfig(String defaultConfig){
12691275
String key = prevWord.toString().trim();
12701276
Config config = new Config(key);
12711277
config.setDescription(parseComment(prevWord.lastComment).getDescription());
1278+
config.setPosition(prevWord.end);
12721279
arr.add(config);
12731280

12741281
//Get config value and update i
@@ -1286,6 +1293,7 @@ else if (str.endsWith(":")){
12861293
String key = str.substring(0, str.length()-1);
12871294
Config config = new Config(key);
12881295
config.setDescription(parseComment(word.lastComment).getDescription());
1296+
config.setPosition(word.end);
12891297
arr.add(config);
12901298

12911299

@@ -1299,6 +1307,7 @@ else if (str.startsWith(":")){
12991307
String key = prevWord.toString().trim();
13001308
Config config = new Config(key);
13011309
config.setDescription(parseComment(prevWord.lastComment).getDescription());
1310+
config.setPosition(prevWord.end);
13021311
arr.add(config);
13031312

13041313

@@ -1328,6 +1337,7 @@ else if (str.contains(":")){
13281337

13291338
Config config = new Config(key);
13301339
config.setDescription(parseComment(word.lastComment).getDescription());
1340+
config.setPosition(word.end);
13311341
arr.add(config);
13321342

13331343
//Get config value and update i

‎src/javaxt/utils/src/Property.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public class Property implements Member {
88
private String defaultValue;
99
private boolean isStatic = false;
1010
private boolean isPublic = true;
11+
private Integer position;
1112

1213
public Property(String name){
1314
this.name = name;
@@ -57,6 +58,14 @@ public String getDefaultValue(){
5758
return defaultValue;
5859
}
5960

61+
public void setPosition(Integer position){
62+
this.position = position;
63+
}
64+
65+
public Integer getPosition(){
66+
return position;
67+
}
68+
6069
public JSONObject toJson(){
6170
JSONObject json = new JSONObject();
6271
json.set("name", name);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /