Skip to content

Commit

Permalink
Clean up memory classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
dim-s committed Feb 22, 2020
1 parent 93bde32 commit 1b0db7c
Show file tree
Hide file tree
Showing 11 changed files with 5 additions and 300 deletions.
4 changes: 2 additions & 2 deletions jphp-runtime/src/php/runtime/Memory.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ public int getPointer(){
public boolean isObject() { return type == Type.OBJECT; }
public boolean isClosure() { return false; }
public boolean isResource() { return false; }
public boolean isArray(){ return type == Type.ARRAY; }
public boolean isTraversable() { return isArray() || instanceOf("Traversable", "traversable"); }
public boolean isArray() { return type == Type.ARRAY; }
public boolean isTraversable() { return isArray() || (isObject() && instanceOf("Traversable", "traversable")); }
public boolean isString() { return type == Type.STRING; }
public boolean isNumber() { return type == Type.INT || type == Type.DOUBLE; }
public boolean isBoolean() { return type == Type.BOOL; }
Expand Down
55 changes: 0 additions & 55 deletions jphp-runtime/src/php/runtime/memory/DoubleMemory.java
Original file line number Diff line number Diff line change
Expand Up @@ -337,59 +337,4 @@ public int hashCode() {
public byte[] getBinaryBytes(Charset charset) {
return MemoryStringUtils.getBinaryBytes(this);
}

@Override
public boolean isArray() {
return false;
}

@Override
public Memory toValue() {
return this;
}

@Override
public Memory toImmutable() {
return this;
}

@Override
public boolean isNull() {
return false;
}

@Override
public boolean isUndefined() {
return false;
}

@Override
public boolean isString() {
return false;
}

@Override
public boolean isTraversable() {
return false;
}

@Override
public boolean isReference() {
return false;
}

@Override
public boolean isObject() {
return false;
}

@Override
public boolean isClosure() {
return false;
}

@Override
public boolean isNumber() {
return true;
}
}
20 changes: 0 additions & 20 deletions jphp-runtime/src/php/runtime/memory/FalseMemory.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,24 +283,4 @@ public boolean identical(String value) {
public Invoker toInvoker(Environment env) {
return null;
}

@Override
public boolean isArray() {
return false;
}

@Override
public Memory toValue() {
return this;
}

@Override
public Memory toImmutable() {
return this;
}

@Override
public boolean isNumber() {
return false;
}
}
55 changes: 0 additions & 55 deletions jphp-runtime/src/php/runtime/memory/LongMemory.java
Original file line number Diff line number Diff line change
Expand Up @@ -305,63 +305,8 @@ public byte[] getBinaryBytes(Charset charset) {
return MemoryStringUtils.getBinaryBytes(this);
}

@Override
public boolean isNull() {
return false;
}

@Override
public boolean isNotNull() {
return true;
}

@Override
public boolean isArray() {
return false;
}

@Override
public Memory toValue() {
return this;
}

@Override
public Memory toImmutable() {
return this;
}

@Override
public boolean isUndefined() {
return false;
}

@Override
public boolean isString() {
return false;
}

@Override
public boolean isTraversable() {
return false;
}

@Override
public boolean isReference() {
return false;
}

@Override
public boolean isObject() {
return false;
}

@Override
public boolean isClosure() {
return false;
}

@Override
public boolean isNumber() {
return true;
}
}
10 changes: 0 additions & 10 deletions jphp-runtime/src/php/runtime/memory/NativeMemory.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,4 @@ public NativeMemory(T object) {
public T getObject() {
return object;
}

@Override
public Memory toImmutable() {
return this;
}

@Override
public Memory toValue() {
return this;
}
}
35 changes: 0 additions & 35 deletions jphp-runtime/src/php/runtime/memory/ObjectMemory.java
Original file line number Diff line number Diff line change
Expand Up @@ -1259,39 +1259,4 @@ public boolean equals(Object o) {

return value != null ? value.equals(that.value) : that.value == null;
}

@Override
public Memory toValue() {
return this;
}

@Override
public Memory toImmutable() {
return this;
}

@Override
public boolean isNull() {
return false;
}

@Override
public boolean isUndefined() {
return false;
}

@Override
public boolean isString() {
return false;
}

@Override
public boolean isReference() {
return false;
}

@Override
public boolean isNumber() {
return false;
}
}
55 changes: 0 additions & 55 deletions jphp-runtime/src/php/runtime/memory/StringMemory.java
Original file line number Diff line number Diff line change
Expand Up @@ -674,61 +674,6 @@ public int hashCode() {
return toString() == null ? 0 : toString().hashCode();
}

@Override
public boolean isArray() {
return false;
}

@Override
public Memory toValue() {
return this;
}

@Override
public Memory toImmutable() {
return this;
}

@Override
public boolean isNull() {
return false;
}

@Override
public boolean isUndefined() {
return false;
}

@Override
public boolean isString() {
return true;
}

@Override
public boolean isTraversable() {
return false;
}

@Override
public boolean isReference() {
return false;
}

@Override
public boolean isObject() {
return false;
}

@Override
public boolean isClosure() {
return false;
}

@Override
public boolean isNumber() {
return false;
}

protected static StringMemory getChar(char ch) {
int i = (int) ch;

Expand Down
56 changes: 0 additions & 56 deletions jphp-runtime/src/php/runtime/memory/TrueMemory.java
Original file line number Diff line number Diff line change
Expand Up @@ -285,60 +285,4 @@ public boolean identical(boolean value) {
public boolean identical(String value) {
return false;
}

@Override
public boolean isArray() {
return false;
}

@Override
public Memory toValue() {
return this;
}

@Override
public Memory toImmutable() {
return this;
}


@Override
public boolean isNull() {
return false;
}

@Override
public boolean isUndefined() {
return false;
}

@Override
public boolean isString() {
return false;
}

@Override
public boolean isTraversable() {
return false;
}

@Override
public boolean isReference() {
return false;
}

@Override
public boolean isObject() {
return false;
}

@Override
public boolean isClosure() {
return false;
}

@Override
public boolean isNumber() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,4 @@ public String getName() {
public String getClassName() {
return className;
}

@Override
public Memory toValue() {
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,4 @@ public class UndefinedMemory extends NullMemory {
public Memory toImmutable() {
return UNDEFINED;
}

@Override
public boolean isUndefined() {
return true;
}
}
5 changes: 3 additions & 2 deletions packager/package.php.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: jppm
version: 0.5.9
version: 0.5.10

plugins: [GitHub, Hub, Doc]

Expand All @@ -14,7 +14,8 @@ github:
> JPHP Package Manager v%version%
**What's new**
+ Improve Gradle plugin, add implDeps.
+ New JPHP runtime & core (boost performance).
+ Fix loading empty yml config files.
**Downloads**
+ For Windows: [JPPM Windows Installer](%github.address%/releases/download/jppm-%version%/jppm-setup-%version%.exe)
Expand Down

0 comments on commit 1b0db7c

Please sign in to comment.