Skip to content

Commit

Permalink
Initialize project
Browse files Browse the repository at this point in the history
  • Loading branch information
devjeonghwan committed Dec 3, 2021
0 parents commit 4ef8041
Show file tree
Hide file tree
Showing 12 changed files with 119 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitattributes
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

5 changes: 5 additions & 0 deletions .gitignore
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
8 changes: 8 additions & 0 deletions .idea/.gitignore

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

4 changes: 4 additions & 0 deletions src/main/java/com/realtimetech/opack/Opacker.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.realtimetech.opack;

public class Opacker {
}
4 changes: 4 additions & 0 deletions src/main/java/com/realtimetech/opack/value/OpackArray.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.realtimetech.opack.value;

public class OpackArray extends OpackValue {
}
7 changes: 7 additions & 0 deletions src/main/java/com/realtimetech/opack/value/OpackBool.java
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 src/main/java/com/realtimetech/opack/value/OpackLazyValue.java
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;
}
}
4 changes: 4 additions & 0 deletions src/main/java/com/realtimetech/opack/value/OpackNone.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.realtimetech.opack.value;

public class OpackNone extends OpackValue {
}
4 changes: 4 additions & 0 deletions src/main/java/com/realtimetech/opack/value/OpackNumber.java
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 src/main/java/com/realtimetech/opack/value/OpackObject.java
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);
}
}
7 changes: 7 additions & 0 deletions src/main/java/com/realtimetech/opack/value/OpackString.java
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 src/main/java/com/realtimetech/opack/value/OpackValue.java
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;
}
}

0 comments on commit 4ef8041

Please sign in to comment.