Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
QZero_0
java-design-patterns
提交
68a5df1c
J
java-design-patterns
项目概览
QZero_0
/
java-design-patterns
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
java-design-patterns
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
68a5df1c
编写于
12月 29, 2021
作者:
I
Ilkka Seppälä
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
delete unwanted files
上级
1c70cdc3
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
0 addition
and
549 deletion
+0
-549
component/README.md
component/README.md
+0
-25
component/component.iml
component/component.iml
+0
-31
component/etc/component.urm.puml
component/etc/component.urm.puml
+0
-2
component/pom.xml
component/pom.xml
+0
-42
component/src/main/java/com/iluwatar/component/App.java
component/src/main/java/com/iluwatar/component/App.java
+0
-56
component/src/main/java/com/iluwatar/component/BjornGraphicsComponent.java
...n/java/com/iluwatar/component/BjornGraphicsComponent.java
+0
-25
component/src/main/java/com/iluwatar/component/BjornInputComponent.java
...main/java/com/iluwatar/component/BjornInputComponent.java
+0
-22
component/src/main/java/com/iluwatar/component/BjornPhysicsComponent.java
...in/java/com/iluwatar/component/BjornPhysicsComponent.java
+0
-27
component/src/main/java/com/iluwatar/component/Component.java
...onent/src/main/java/com/iluwatar/component/Component.java
+0
-9
component/src/main/java/com/iluwatar/component/GameObject.java
...nent/src/main/java/com/iluwatar/component/GameObject.java
+0
-87
component/src/main/java/com/iluwatar/component/GraphicsComponent.java
...c/main/java/com/iluwatar/component/GraphicsComponent.java
+0
-8
component/src/main/java/com/iluwatar/component/InputComponent.java
.../src/main/java/com/iluwatar/component/InputComponent.java
+0
-7
component/src/main/java/com/iluwatar/component/PhysicsComponent.java
...rc/main/java/com/iluwatar/component/PhysicsComponent.java
+0
-7
component/src/main/java/module-info.java
component/src/main/java/module-info.java
+0
-26
component/src/test/java/com/iluwatar/component/AppTest.java
component/src/test/java/com/iluwatar/component/AppTest.java
+0
-37
component/src/test/java/com/iluwatar/component/UpdateTest.java
...nent/src/test/java/com/iluwatar/component/UpdateTest.java
+0
-138
未找到文件。
component/README.md
已删除
100644 → 0
浏览文件 @
1c70cdc3
---
layout
:
pattern
title
:
Component
folder
:
component
permalink
:
/patterns/component/
categories
:
Behavioral
tags
:
-
Java
-
Game Programming
-
Decoupling
---
## Intent
> Allow a single entity to span multiple domains without coupling the domains to each other.
## Applicability
1.
You want to keep decoupled from each other in a class which contains multiple domains.
2.
A class is too big and massive.
## Reference
*
[http://gameprogrammingpatterns.com/component.html]
component/component.iml
已删除
100644 → 0
浏览文件 @
1c70cdc3
<?xml version="1.0" encoding="UTF-8"?>
<module
org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule=
"true"
type=
"JAVA_MODULE"
version=
"4"
>
<component
name=
"CheckStyle-IDEA-Module"
>
<option
name=
"configuration"
>
<map
/>
</option>
</component>
<component
name=
"NewModuleRootManager"
LANGUAGE_LEVEL=
"JDK_11"
>
<output
url=
"file://$MODULE_DIR$/target/classes"
/>
<output-test
url=
"file://$MODULE_DIR$/target/test-classes"
/>
<content
url=
"file://$MODULE_DIR$"
>
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/java"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/resources"
type=
"java-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/test/java"
isTestSource=
"true"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/target"
/>
</content>
<orderEntry
type=
"inheritedJdk"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: junit:junit:4.12"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.hamcrest:hamcrest-core:1.3"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.junit.jupiter:junit-jupiter-engine:5.5.2"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.apiguardian:apiguardian-api:1.1.0"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.junit.platform:junit-platform-engine:1.5.2"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.opentest4j:opentest4j:1.2.0"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.junit.platform:junit-platform-commons:1.5.2"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.junit.jupiter:junit-jupiter-api:5.5.2"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.slf4j:slf4j-api:1.7.30"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: ch.qos.logback:logback-classic:1.2.3"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: ch.qos.logback:logback-core:1.2.3"
level=
"project"
/>
</component>
</module>
\ No newline at end of file
component/etc/component.urm.puml
已删除
100644 → 0
浏览文件 @
1c70cdc3
@startuml
@enduml
\ No newline at end of file
component/pom.xml
已删除
100644 → 0
浏览文件 @
1c70cdc3
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
java-design-patterns
</artifactId>
<groupId>
com.iluwatar
</groupId>
<version>
1.23.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
component
</artifactId>
<dependencies>
<dependency>
<groupId>
org.junit.jupiter
</groupId>
<artifactId>
junit-jupiter-engine
</artifactId>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Maven assembly plugin is invoked with default setting which we have
in parent pom and specifying the class having main method -->
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-assembly-plugin
</artifactId>
<executions>
<execution>
<configuration>
<archive>
<manifest>
<mainClass>
com.iluwatar.component.App
</mainClass>
</manifest>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
component/src/main/java/com/iluwatar/component/App.java
已删除
100644 → 0
浏览文件 @
1c70cdc3
/*
* The MIT License
* Copyright © 2014-2019 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package
com.iluwatar.component
;
import
java.util.ArrayList
;
/**
* Object-oriented to a certain extent can solve many problems of code reuse and data reuse,
* but it also has great defects:
* 1.the coupling of data organization is very strong.
* 2.Interface logic is difficult to reuse and hot plug.
*
* The component pattern solves the defects of object orientation and process orientation and
* is widely used in game clients
*
* A component is a part of one object. We can consider that a object contains multiple
* components, in another way, multiple components can construct a object.
* Here is a demo using component pattern to solve a game-like problem.
* A person named Bjorn who has three components: input;physics;graphics
* These three component with a common game object can construct our protagonist:Bjorn, also can
* construct other objects like dog or cat if you want to write a real game.
*/
public
class
App
{
/**
* Launcher for this demo design pattern
*/
public
static
void
main
(
String
[]
args
)
{
var
arrayList
=
new
ArrayList
<
Component
>();
arrayList
.
add
(
new
BjornInputComponent
());
arrayList
.
add
(
new
BjornPhysicsComponent
());
arrayList
.
add
(
new
BjornGraphicsComponent
());
var
gameObject
=
new
GameObject
(
arrayList
);
gameObject
.
update
();
}
}
component/src/main/java/com/iluwatar/component/BjornGraphicsComponent.java
已删除
100644 → 0
浏览文件 @
1c70cdc3
package
com.iluwatar.component
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
import
org.slf4j.Logger
;
/**
* BjornGraphicsComponent is a class for our main game star
* This class creat a Graphics component for Bjorn.
*/
public
class
BjornGraphicsComponent
implements
GraphicsComponent
{
private
static
final
Logger
LOGGER
=
getLogger
(
BjornGraphicsComponent
.
class
);
/**
* This method is a logger for Bjorn when happens a Graphics update.
* In real scenario, there will be code for Graphics Update.
*
* @param gameObject is a object in the game, here it is Bjorn
*/
@Override
public
void
update
(
GameObject
gameObject
)
{
LOGGER
.
info
(
"positive:"
+
gameObject
.
getPositionOFx
()
+
","
+
gameObject
.
getPositionOFy
());
}
}
component/src/main/java/com/iluwatar/component/BjornInputComponent.java
已删除
100644 → 0
浏览文件 @
1c70cdc3
package
com.iluwatar.component
;
/**
* BjornInputComponent is a class for our main game star
* This class creat a Input component for Bjorn.
*/
public
class
BjornInputComponent
implements
InputComponent
{
/**
* This method is a logger for Bjorn when happens a Input update.
* In real scenario, there will be code for dealing with IO.
*
* @param gameObject is a object in the game, here it is Bjorn
*/
@Override
public
void
update
(
GameObject
gameObject
)
{
gameObject
.
setPositionOFx
(
gameObject
.
getPositionOFx
()
+
gameObject
.
getVelocity
());
gameObject
.
setPositionOFy
(
gameObject
.
getPositionOFy
()
+
gameObject
.
getVelocity
());
}
}
component/src/main/java/com/iluwatar/component/BjornPhysicsComponent.java
已删除
100644 → 0
浏览文件 @
1c70cdc3
package
com.iluwatar.component
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
import
org.slf4j.Logger
;
/**
* BjornPhysicsComponent is a class for our main game star
* This class creat a Physics component for Bjorn.
*/
public
class
BjornPhysicsComponent
implements
PhysicsComponent
{
private
static
final
Logger
LOGGER
=
getLogger
(
BjornPhysicsComponent
.
class
);
/**
* This method is a logger for Bjorn when happens a Physics update.
* In real scenario, there will be code for Physics Update.
*
* @param gameObject is a object in the game, here it is Bjorn
*/
@Override
public
void
update
(
GameObject
gameObject
)
{
if
(
gameObject
.
getPositionOFx
()
==
gameObject
.
getPositionOFy
()){
LOGGER
.
info
(
"Your position is pretty good, keep it!"
);
}
}
}
component/src/main/java/com/iluwatar/component/Component.java
已删除
100644 → 0
浏览文件 @
1c70cdc3
package
com.iluwatar.component
;
/**
* Component is an interface for all component.
*/
public
interface
Component
{
void
update
(
GameObject
gameObject
);
}
component/src/main/java/com/iluwatar/component/GameObject.java
已删除
100644 → 0
浏览文件 @
1c70cdc3
package
com.iluwatar.component
;
import
java.util.ArrayList
;
/**
* GameObject is a class for all object in the game.
* It was constructed by a collection of component.
*/
public
class
GameObject
{
private
int
velocity
;
private
int
positionOFx
;
private
int
positionOFy
;
ArrayList
<
Component
>
componentArrayList
;
/**
* Constructor for GameObject
* @param componentArrayList is the list of this object contains
*/
public
GameObject
(
ArrayList
<
Component
>
componentArrayList
){
this
.
componentArrayList
=
new
ArrayList
<>();
this
.
componentArrayList
.
addAll
(
componentArrayList
);
}
/**
* setter for velocity
* @param velocity is the velocity of this object
*/
public
void
setVelocity
(
int
velocity
)
{
this
.
velocity
=
velocity
;
}
/**
* getter for velocity
*/
public
int
getVelocity
()
{
return
velocity
;
}
/**
* setter for PositionOFx
* @param positionOFx is the PositionOFx of this object
*/
public
void
setPositionOFx
(
int
positionOFx
)
{
this
.
positionOFx
=
positionOFx
;
}
/**
* getter for PositionOFx
*/
public
int
getPositionOFx
()
{
return
positionOFx
;
}
/**
* setter for PositionOFy
* @param positionOFy is the PositionOFy of this object
*/
public
void
setPositionOFy
(
int
positionOFy
)
{
this
.
positionOFy
=
positionOFy
;
}
/**
* getter for PositionOFy
*/
public
int
getPositionOFy
()
{
return
positionOFy
;
}
/**
* update for this object's components.
*/
public
void
update
(){
for
(
Component
component
:
componentArrayList
)
{
component
.
update
(
this
);
}
}
}
component/src/main/java/com/iluwatar/component/GraphicsComponent.java
已删除
100644 → 0
浏览文件 @
1c70cdc3
package
com.iluwatar.component
;
/**
* GraphicsComponent is an interface for Graphics function
*/
public
interface
GraphicsComponent
extends
Component
{
void
update
(
GameObject
gameObject
);
}
component/src/main/java/com/iluwatar/component/InputComponent.java
已删除
100644 → 0
浏览文件 @
1c70cdc3
package
com.iluwatar.component
;
/**
* InputComponent is an interface for Input function
*/
public
interface
InputComponent
extends
Component
{
void
update
(
GameObject
gameObject
);
}
component/src/main/java/com/iluwatar/component/PhysicsComponent.java
已删除
100644 → 0
浏览文件 @
1c70cdc3
package
com.iluwatar.component
;
/**
* PhysicsComponent is an interface for Physics function
*/
public
interface
PhysicsComponent
extends
Component
{
void
update
(
GameObject
gameObject
);
}
component/src/main/java/module-info.java
已删除
100644 → 0
浏览文件 @
1c70cdc3
/*
* The MIT License
* Copyright © 2014-2019 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
module
com
.
iluwatar
.
component
{
requires
org
.
slf4j
;
}
component/src/test/java/com/iluwatar/component/AppTest.java
已删除
100644 → 0
浏览文件 @
1c70cdc3
/*
* The MIT License
* Copyright © 2014-2019 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package
com.iluwatar.component
;
import
org.junit.jupiter.api.Test
;
/**
* Tests that Component example runs without errors.
*/
public
class
AppTest
{
/**
* test for the design pattern runnable.
*/
@Test
public
void
test
()
{
App
.
main
(
new
String
[]{});
}
}
component/src/test/java/com/iluwatar/component/UpdateTest.java
已删除
100644 → 0
浏览文件 @
1c70cdc3
/*
* The MIT License
* Copyright © 2014-2019 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package
com.iluwatar.component
;
import
org.junit.jupiter.api.Test
;
import
java.util.ArrayList
;
import
static
junit
.
framework
.
TestCase
.
assertEquals
;
/**
* Tests that Component example runs without errors.
*/
public
class
UpdateTest
{
/**
* test for the update for the input component of the object
*/
@Test
public
void
inputUpdateTest
()
{
var
arrayList
=
new
ArrayList
<
Component
>();
arrayList
.
add
(
new
BjornInputComponent
());
var
gameObject
=
new
GameObject
(
arrayList
);
gameObject
.
setPositionOFy
(
12
);
gameObject
.
setPositionOFx
(
13
);
gameObject
.
setVelocity
(
1
);
gameObject
.
update
();
assertEquals
(
14
,
gameObject
.
getPositionOFx
());
assertEquals
(
13
,
gameObject
.
getPositionOFy
());
}
/**
* test for the update for the Physics component of the object
*/
@Test
public
void
physicsUpdateTest
()
{
var
arrayList
=
new
ArrayList
<
Component
>();
arrayList
.
add
(
new
BjornPhysicsComponent
());
arrayList
.
add
(
new
BjornGraphicsComponent
());
var
gameObject
=
new
GameObject
(
arrayList
);
gameObject
.
setPositionOFy
(
13
);
gameObject
.
setPositionOFx
(
12
);
gameObject
.
setVelocity
(
1
);
gameObject
.
update
();
assertEquals
(
13
,
gameObject
.
getPositionOFx
());
assertEquals
(
14
,
gameObject
.
getPositionOFy
());
}
/**
* test for the update for the Graphics component of the object
*/
@Test
public
void
graphicsUpdateTest
()
{
var
arrayList
=
new
ArrayList
<
Component
>();
arrayList
.
add
(
new
BjornInputComponent
());
arrayList
.
add
(
new
BjornPhysicsComponent
());
arrayList
.
add
(
new
BjornGraphicsComponent
());
var
gameObject
=
new
GameObject
(
arrayList
);
gameObject
.
setPositionOFy
(
1
);
gameObject
.
setPositionOFx
(
1
);
gameObject
.
setVelocity
(
1
);
gameObject
.
update
();
assertEquals
(
2
,
gameObject
.
getPositionOFx
());
assertEquals
(
2
,
gameObject
.
getPositionOFy
());
}
/**
* test for the setPositionOFx
*/
@Test
public
void
setPositionOFxTest
(){
var
gameObject
=
new
GameObject
(
null
);
gameObject
.
setPositionOFx
(
1
);
assertEquals
(
1
,
gameObject
.
getPositionOFx
());
}
/**
* test for the getPositionOFx
*/
@Test
public
void
getPositionOFxTest
(){
var
gameObject
=
new
GameObject
(
null
);
gameObject
.
setPositionOFx
(
1
);
assertEquals
(
1
,
gameObject
.
getPositionOFx
());
}
/**
* test for the setPositionOFy
*/
@Test
public
void
setPositionOFyTest
(){
var
gameObject
=
new
GameObject
(
null
);
gameObject
.
setPositionOFy
(
1
);
assertEquals
(
1
,
gameObject
.
getPositionOFy
());
}
/**
* test for the getPositionOFy
*/
@Test
public
void
getPositionOFyTest
(){
var
gameObject
=
new
GameObject
(
null
);
gameObject
.
setPositionOFy
(
1
);
assertEquals
(
1
,
gameObject
.
getPositionOFy
());
}
/**
* test for the setVelocity
*/
@Test
public
void
setVelocityTest
(){
var
gameObject
=
new
GameObject
(
null
);
gameObject
.
setVelocity
(
1
);
assertEquals
(
1
,
gameObject
.
getVelocity
());
}
/**
* test for the getVelocity
*/
@Test
public
void
getVelocityTest
(){
var
gameObject
=
new
GameObject
(
null
);
gameObject
.
setVelocity
(
1
);
assertEquals
(
1
,
gameObject
.
getVelocity
());
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录