-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4ef8041
Showing
12 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
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,6 @@ | ||
# | ||
# https://help.github.com/articles/dealing-with-line-endings/ | ||
# | ||
# These are explicitly windows files and should use crlf | ||
*.bat text eol=crlf | ||
|
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,5 @@ | ||
# Ignore Gradle project-specific cache directory | ||
.gradle | ||
|
||
# Ignore Gradle build output directory | ||
build |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,4 @@ | ||
package com.realtimetech.opack; | ||
|
||
public class Opacker { | ||
} |
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,4 @@ | ||
package com.realtimetech.opack.value; | ||
|
||
public class OpackArray extends OpackValue { | ||
} |
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.realtimetech.opack.value; | ||
|
||
public class OpackBool extends OpackValue { | ||
private boolean value; | ||
|
||
|
||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/realtimetech/opack/value/OpackLazyValue.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,31 @@ | ||
package com.realtimetech.opack.value; | ||
|
||
import java.util.HashMap; | ||
|
||
public abstract class OpackLazyValue<T> extends OpackValue<T>{ | ||
public OpackLazyValue() { | ||
super(null); | ||
} | ||
|
||
abstract T createLazyValue(); | ||
|
||
@Override | ||
public void set(T value) { | ||
throw new Doe | ||
} | ||
|
||
@Override | ||
public T get() { | ||
T value = super.get(); | ||
|
||
if (value == null) { | ||
synchronized (this) { | ||
if (value == null) { | ||
super.set(value = createLazyValue()); | ||
} | ||
} | ||
} | ||
|
||
return value; | ||
} | ||
} |
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,4 @@ | ||
package com.realtimetech.opack.value; | ||
|
||
public class OpackNone extends OpackValue { | ||
} |
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,4 @@ | ||
package com.realtimetech.opack.value; | ||
|
||
public class OpackNumber extends OpackValue { | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/realtimetech/opack/value/OpackObject.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,20 @@ | ||
package com.realtimetech.opack.value; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.HashMap; | ||
|
||
public class OpackObject extends OpackLazyValue<HashMap<String, OpackValue>> { | ||
@Override | ||
HashMap<String, OpackValue> createLazyValue() { | ||
return new HashMap<>(); | ||
} | ||
|
||
public OpackValue get(@NotNull String key) { | ||
return this.get().get(key); | ||
} | ||
|
||
public OpackValue put(@NotNull String key, @NotNull OpackValue opackValue) { | ||
return this.get().put(key, opackValue); | ||
} | ||
} |
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.realtimetech.opack.value; | ||
|
||
public class OpackString extends OpackValue<String>{ | ||
public OpackString(String value) { | ||
super(value); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/realtimetech/opack/value/OpackValue.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.realtimetech.opack.value; | ||
|
||
import java.util.HashMap; | ||
|
||
public abstract class OpackValue<T> { | ||
private T value; | ||
|
||
public OpackValue(T value){ | ||
this.value = value; | ||
} | ||
|
||
public void set(T value) { | ||
this.value = value; | ||
} | ||
|
||
public T get() { | ||
return this.value; | ||
} | ||
} |