Skip to content

Commit

Permalink
Merge pull request #2 from PikachuHy/master
Browse files Browse the repository at this point in the history
我没有删任何东西,只是把我自己的拷贝进去了
  • Loading branch information
CoderXLoong authored Apr 10, 2017
2 parents 9d07aea + 6d59190 commit 738541d
Show file tree
Hide file tree
Showing 47 changed files with 2,588 additions and 669 deletions.
Binary file not shown.
Binary file modified group13/2931408816/.gradle/3.1/taskArtifacts/fileHashes.bin
Binary file not shown.
Binary file modified group13/2931408816/.gradle/3.1/taskArtifacts/fileSnapshots.bin
Binary file not shown.
Binary file modified group13/2931408816/.gradle/3.1/taskArtifacts/taskArtifacts.bin
Binary file not shown.
4 changes: 4 additions & 0 deletions group13/2931408816/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions group13/2931408816/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions group13/2931408816/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1,659 changes: 992 additions & 667 deletions group13/2931408816/.idea/workspace.xml

Large diffs are not rendered by default.

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;
}

}
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();

}
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();
}
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;
}
}
31 changes: 31 additions & 0 deletions group13/2931408816/lesson5/build.gradle
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'
}
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;
}

}
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();
}
}
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;
}
}
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();
}
}
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);
}

}
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;
}
}
Loading

0 comments on commit 738541d

Please sign in to comment.