net.dschinghis-kahn:objectstore

A data store with size limitation capabilities.

Лицензия

Лицензия

Категории

Категории

Сеть
Группа

Группа

net.dschinghis-kahn
Идентификатор

Идентификатор

objectstore
Последняя версия

Последняя версия

1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

net.dschinghis-kahn:objectstore
A data store with size limitation capabilities.
Ссылка на сайт

Ссылка на сайт

https://github.com/Dschinghis-Kahn/objectstore
Система контроля версий

Система контроля версий

https://github.com/Dschinghis-Kahn/objectstore

Скачать objectstore

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/net.dschinghis-kahn/objectstore/ -->
<dependency>
    <groupId>net.dschinghis-kahn</groupId>
    <artifactId>objectstore</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/net.dschinghis-kahn/objectstore/
implementation 'net.dschinghis-kahn:objectstore:1.0'
// https://jarcasting.com/artifacts/net.dschinghis-kahn/objectstore/
implementation ("net.dschinghis-kahn:objectstore:1.0")
'net.dschinghis-kahn:objectstore:jar:1.0'
<dependency org="net.dschinghis-kahn" name="objectstore" rev="1.0">
  <artifact name="objectstore" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.dschinghis-kahn', module='objectstore', version='1.0')
)
libraryDependencies += "net.dschinghis-kahn" % "objectstore" % "1.0"
[net.dschinghis-kahn/objectstore "1.0"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
log4j : log4j jar 1.2.17

test (2)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.11
org.apache.maven.plugins : maven-surefire-plugin maven-plugin 2.16

Модули Проекта

Данный проект не имеет модулей.

objectstore

A data store with size limitation capabilities.

##Features

  • Easy to use
  • Blocks add method when full
  • Can prioritize its items

##Example

public class TaskStore {

    private ObjectStore<Task> store;

    public static void main(String[] args) {
        TaskStore taskStore = new TaskStore();
        taskStore.addTask(new Task(0));
        taskStore.addTask(new Task(1));
        taskStore.addTask(new Task(3));

        // this task will be sorted to the correct position
        taskStore.addTask(new Task(2));

        taskStore.addTask(new Task(4));

       /*
         * At this point the store holds these tasks in order: 
         * 1. Task(0) 
         * 2. Task(1) 
         * 3. Task(2) 
         * 4. Task(3) 
         * 5. Task(4)
         */

        // this method will block because the store is full now
        taskStore.addTask(new Task(5));
    }

    public TaskStore() {
        // An Object store with maxSize=5 and priorized=true is created
        store = new ObjectStore<Task>(5, true);
    }

    public void addTask(Task task) {
        // Just add the task, the method will block if necessary
        store.add(task);
    }

    public Task getNextTask() {
        return store.get();
    }

}
public class Task implements Comparable<Task> {

    private Integer id;

    public Task(int id) {
        this.id = id;
    }

    @Override
    public int compareTo(Task o) {
        return id.compareTo(o.id);
    }

    @Override
    public String toString() {
        return "Task [id=" + id + "]";
    }
    
}

Версии библиотеки

Версия
1.0