Skip to content
This repository has been archived by the owner on Apr 26, 2020. It is now read-only.

Commit

Permalink
发布 0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
berberman committed Sep 15, 2018
1 parent 2897baf commit 6789470
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .idea/modules/statemachine.iml

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

86 changes: 43 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,49 +11,7 @@

在此也要感谢 .Net 下状态机库 [Stateless](http://www.hanselman.com/blog/Stateless30AStateMachineLibraryForNETCore.aspx) 带来的启发,希望这个简单的实现,能使有趣的状态机模式在机器人行为控制中得到发展。

*( 2018 年 9 月 9 日 )*

## 开始使用

* Gradle
* Maven
* Bintray

您需要将其添加至 [仓库和依赖](https://docs.gradle.org/current/userguide/declaring_dependencies.html) 中。

### Gradle

```groovy
repositories {
jcenter()
}
dependencies {
compile 'org.mechdancer:statemachine:0.1.0'
}
```

### Maven

```xml
<repositories>
<repository>
<id>jcenter</id>
<name>JCenter</name>
<url>https://jcenter.bintray.com/</url>
</repository>
</repositories>

<dependency>
<groupId>org.mechdancer</groupId>
<artifactId>statemachine</artifactId>
<version>0.1.0</version>
<type>pom</type>
</dependency>
```

### Bintray

您总可以从 bintray 直接下载 jar:[![Download](https://api.bintray.com/packages/mechdancer/maven/statemachine/images/download.svg) ](https://bintray.com/mechdancer/maven/statemachine/_latestVersion)
*(2018 年 9 月 9 日)*

## 使用说明

Expand Down Expand Up @@ -179,3 +137,45 @@ val init = state {
## 示例

完整示例代码可以在 [这里](https://github.com/MechDancer/statemachine/blob/dev/src/test/kotlin/org/mechdancer/statemachine/test/StateTest.kt) 找到。

## 开始使用

* Gradle
* Maven
* Bintray

您需要将其添加至 [仓库和依赖](https://docs.gradle.org/current/userguide/declaring_dependencies.html) 中。

### Gradle

```groovy
repositories {
jcenter()
}
dependencies {
compile 'org.mechdancer:statemachine:0.1.1'
}
```

### Maven

```xml
<repositories>
<repository>
<id>jcenter</id>
<name>JCenter</name>
<url>https://jcenter.bintray.com/</url>
</repository>
</repositories>

<dependency>
<groupId>org.mechdancer</groupId>
<artifactId>statemachine</artifactId>
<version>0.1.1</version>
<type>pom</type>
</dependency>
```

### Bintray

您总可以从 bintray 直接下载 jar:[![Download](https://api.bintray.com/packages/mechdancer/maven/statemachine/images/download.svg) ](https://bintray.com/mechdancer/maven/statemachine/_latestVersion)
12 changes: 3 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,21 @@ buildscript {
}

plugins {
id 'org.jetbrains.kotlin.jvm' version '1.2.60'
id 'org.jetbrains.kotlin.jvm' version '1.2.70'
}

apply plugin: 'org.jetbrains.dokka'
apply plugin: 'com.novoda.bintray-release'

group 'org.mechdancer'
version '0.1.0-SNAPSHOT'
version '0.1.1-SNAPSHOT'

repositories {
mavenCentral()
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:0.24.0"
testCompile group: 'junit', name: 'junit', version: '4.12'
}

Expand All @@ -35,17 +34,12 @@ compileKotlin {
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
kotlin {
experimental {
coroutines "enable"
}
}

publish {
userOrg = 'mechdancer'
groupId = 'org.mechdancer'
artifactId = 'statemachine'
publishVersion = '0.1.0'
publishVersion = '0.1.1'
desc = 'statemachine kotlin framework'
website = 'https://github.com/MechDancer/statemachine'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ data class DelayBuilderDsl(
val nano get() = unit.toNanos(time)
}

/** dsl构造延时状态 */
/** dsl 构造延时状态 */
fun delay(block: DelayBuilderDsl.() -> Unit) =
state {
var start = 0L
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/org/mechdancer/statemachine/builder/State.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ package org.mechdancer.statemachine.builder

import org.mechdancer.statemachine.core.IState

/** DSL缓存 */
/** dsl 建造者 */
data class StateBuilderDsl(
var before: () -> Boolean = { true },
var doing: () -> Unit = {},
var after: () -> Boolean = { true },
var loop: Boolean = false
)

/** dsl构造状态 */
/** dsl 构造状态 */
fun state(block: StateBuilderDsl.() -> Unit) =
StateBuilderDsl().apply(block).let {
object : IState {
Expand Down

0 comments on commit 6789470

Please sign in to comment.