forked from onlyliuxin/coding2017
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from PikachuHy/master
我没有删任何东西,只是把我自己的拷贝进去了
- Loading branch information
Showing
47 changed files
with
2,588 additions
and
669 deletions.
There are no files selected for viewing
Binary file modified
BIN
+0 Bytes
(100%)
group13/2931408816/.gradle/3.1/taskArtifacts/cache.properties.lock
Binary file not shown.
Binary file modified
BIN
+1.17 KB
(100%)
group13/2931408816/.gradle/3.1/taskArtifacts/fileHashes.bin
Binary file not shown.
Binary file modified
BIN
+15.8 KB
(120%)
group13/2931408816/.gradle/3.1/taskArtifacts/fileSnapshots.bin
Binary file not shown.
Binary file modified
BIN
+7.32 KB
(120%)
group13/2931408816/.gradle/3.1/taskArtifacts/taskArtifacts.bin
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
32 changes: 32 additions & 0 deletions
32
group13/2931408816/lesson4/src/main/java/com/coding/basic/BinaryTreeNode.java~HEAD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.coding.basic; | ||
|
||
public class BinaryTreeNode { | ||
|
||
private Object data; | ||
private BinaryTreeNode left; | ||
private BinaryTreeNode right; | ||
|
||
public Object getData() { | ||
return data; | ||
} | ||
public void setData(Object data) { | ||
this.data = data; | ||
} | ||
public BinaryTreeNode getLeft() { | ||
return left; | ||
} | ||
public void setLeft(BinaryTreeNode left) { | ||
this.left = left; | ||
} | ||
public BinaryTreeNode getRight() { | ||
return right; | ||
} | ||
public void setRight(BinaryTreeNode right) { | ||
this.right = right; | ||
} | ||
|
||
public BinaryTreeNode insert(Object o){ | ||
return null; | ||
} | ||
|
||
} |
File renamed without changes.
7 changes: 7 additions & 0 deletions
7
group13/2931408816/lesson4/src/main/java/com/coding/basic/Iterator.java~HEAD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.coding.basic; | ||
|
||
public interface Iterator { | ||
public boolean hasNext(); | ||
public Object next(); | ||
|
||
} |
File renamed without changes.
9 changes: 9 additions & 0 deletions
9
group13/2931408816/lesson4/src/main/java/com/coding/basic/List.java~HEAD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.coding.basic; | ||
|
||
public interface List { | ||
public void add(Object o); | ||
public void add(int index, Object o); | ||
public Object get(int index); | ||
public Object remove(int index); | ||
public int size(); | ||
} |
File renamed without changes.
24 changes: 24 additions & 0 deletions
24
group13/2931408816/lesson4/src/main/java/com/coding/basic/Stack.java~HEAD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.coding.basic; | ||
|
||
import com.coding.basic.array.ArrayList; | ||
|
||
public class Stack { | ||
private ArrayList elementData = new ArrayList(); | ||
|
||
public void push(Object o){ | ||
} | ||
|
||
public Object pop(){ | ||
return null; | ||
} | ||
|
||
public Object peek(){ | ||
return null; | ||
} | ||
public boolean isEmpty(){ | ||
return false; | ||
} | ||
public int size(){ | ||
return -1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
buildscript { | ||
ext.kotlin_version = '1.1.1' | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
dependencies { | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | ||
} | ||
} | ||
|
||
apply plugin: 'java' | ||
apply plugin: 'kotlin' | ||
|
||
sourceCompatibility = 1.8 | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version" | ||
// https://mvnrepository.com/artifact/commons-io/commons-io | ||
compile group: 'commons-io', name: 'commons-io', version: '2.5' | ||
|
||
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 | ||
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.5' | ||
|
||
testCompile group: 'junit', name: 'junit', version: '4.12' | ||
} |
25 changes: 25 additions & 0 deletions
25
group13/2931408816/lesson5/src/main/java/com/coderising/jvm/clz/AccessFlag.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.coderising.jvm.clz; | ||
|
||
public class AccessFlag { | ||
private int flagValue; | ||
|
||
public AccessFlag(int value) { | ||
this.flagValue = value; | ||
} | ||
|
||
public int getFlagValue() { | ||
return flagValue; | ||
} | ||
|
||
public void setFlagValue(int flag) { | ||
this.flagValue = flag; | ||
} | ||
|
||
public boolean isPublicClass(){ | ||
return (this.flagValue & 0x0001) != 0; | ||
} | ||
public boolean isFinalClass(){ | ||
return (this.flagValue & 0x0010) != 0; | ||
} | ||
|
||
} |
75 changes: 75 additions & 0 deletions
75
group13/2931408816/lesson5/src/main/java/com/coderising/jvm/clz/ClassFile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package com.coderising.jvm.clz; | ||
|
||
import com.coderising.jvm.constant.ClassInfo; | ||
import com.coderising.jvm.constant.ConstantPool; | ||
|
||
public class ClassFile { | ||
|
||
private int minorVersion; | ||
private int majorVersion; | ||
|
||
private AccessFlag accessFlag; | ||
private ClassIndex clzIndex; | ||
private ConstantPool pool; | ||
|
||
|
||
public ClassIndex getClzIndex() { | ||
return clzIndex; | ||
} | ||
public AccessFlag getAccessFlag() { | ||
return accessFlag; | ||
} | ||
public void setAccessFlag(AccessFlag accessFlag) { | ||
this.accessFlag = accessFlag; | ||
} | ||
|
||
|
||
|
||
public ConstantPool getConstantPool() { | ||
return pool; | ||
} | ||
public int getMinorVersion() { | ||
return minorVersion; | ||
} | ||
public void setMinorVersion(int minorVersion) { | ||
this.minorVersion = minorVersion; | ||
} | ||
public int getMajorVersion() { | ||
return majorVersion; | ||
} | ||
public void setMajorVersion(int majorVersion) { | ||
this.majorVersion = majorVersion; | ||
} | ||
public void setConstPool(ConstantPool pool) { | ||
this.pool = pool; | ||
|
||
} | ||
public void setClassIndex(ClassIndex clzIndex) { | ||
this.clzIndex = clzIndex; | ||
} | ||
|
||
|
||
|
||
|
||
public void print(){ | ||
|
||
if(this.accessFlag.isPublicClass()){ | ||
System.out.println("Access flag : public "); | ||
} | ||
System.out.println("Class Name:"+ getClassName()); | ||
|
||
System.out.println("Super Class Name:"+ getSuperClassName()); | ||
|
||
|
||
} | ||
|
||
private String getClassName(){ | ||
int thisClassIndex = this.clzIndex.getThisClassIndex(); | ||
ClassInfo thisClass = (ClassInfo)this.getConstantPool().getConstantInfo(thisClassIndex); | ||
return thisClass.getClassName(); | ||
} | ||
private String getSuperClassName(){ | ||
ClassInfo superClass = (ClassInfo)this.getConstantPool().getConstantInfo(this.clzIndex.getSuperClassIndex()); | ||
return superClass.getClassName(); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
group13/2931408816/lesson5/src/main/java/com/coderising/jvm/clz/ClassIndex.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.coderising.jvm.clz; | ||
|
||
public class ClassIndex { | ||
private int thisClassIndex; | ||
private int superClassIndex; | ||
|
||
public int getThisClassIndex() { | ||
return thisClassIndex; | ||
} | ||
public void setThisClassIndex(int thisClassIndex) { | ||
this.thisClassIndex = thisClassIndex; | ||
} | ||
public int getSuperClassIndex() { | ||
return superClassIndex; | ||
} | ||
public void setSuperClassIndex(int superClassIndex) { | ||
this.superClassIndex = superClassIndex; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
group13/2931408816/lesson5/src/main/java/com/coderising/jvm/constant/ClassInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.coderising.jvm.constant; | ||
|
||
public class ClassInfo extends ConstantInfo { | ||
private int type = ConstantInfo.CLASS_INFO; | ||
private int utf8Index ; | ||
public ClassInfo(ConstantPool pool) { | ||
super(pool); | ||
} | ||
public int getUtf8Index() { | ||
return utf8Index; | ||
} | ||
public void setUtf8Index(int utf8Index) { | ||
this.utf8Index = utf8Index; | ||
} | ||
public int getType() { | ||
return type; | ||
} | ||
|
||
public String getClassName() { | ||
int index = getUtf8Index(); | ||
UTF8Info utf8Info = (UTF8Info)constantPool.getConstantInfo(index); | ||
return utf8Info.getValue(); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
group13/2931408816/lesson5/src/main/java/com/coderising/jvm/constant/ConstantInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.coderising.jvm.constant; | ||
|
||
public abstract class ConstantInfo { | ||
public static final int UTF8_INFO = 1; | ||
public static final int FLOAT_INFO = 4; | ||
public static final int CLASS_INFO = 7; | ||
public static final int STRING_INFO = 8; | ||
public static final int FIELD_INFO = 9; | ||
public static final int METHOD_INFO = 10; | ||
public static final int NAME_AND_TYPE_INFO = 12; | ||
protected ConstantPool constantPool; | ||
|
||
public ConstantInfo(){ | ||
|
||
} | ||
|
||
public ConstantInfo(ConstantPool pool) { | ||
this.constantPool = pool; | ||
} | ||
public abstract int getType(); | ||
|
||
public ConstantPool getConstantPool() { | ||
return constantPool; | ||
} | ||
public ConstantInfo getConstantInfo(int index){ | ||
return this.constantPool.getConstantInfo(index); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
group13/2931408816/lesson5/src/main/java/com/coderising/jvm/constant/ConstantPool.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.coderising.jvm.constant; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class ConstantPool { | ||
|
||
private List<ConstantInfo> constantInfos = new ArrayList<ConstantInfo>(); | ||
|
||
|
||
public ConstantPool(){ | ||
|
||
} | ||
public void addConstantInfo(ConstantInfo info){ | ||
|
||
this.constantInfos.add(info); | ||
|
||
} | ||
|
||
public ConstantInfo getConstantInfo(int index){ | ||
return this.constantInfos.get(index); | ||
} | ||
public String getUTF8String(int index){ | ||
return ((UTF8Info)this.constantInfos.get(index)).getValue(); | ||
} | ||
public Object getSize() { | ||
return this.constantInfos.size() -1; | ||
} | ||
} |
Oops, something went wrong.