All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.kennycason.kumo.placement.LinearWordPlacer Maven / Gradle / Ivy

There is a newer version: 1.28
Show newest version
package com.kennycason.kumo.placement;

import com.kennycason.kumo.Word;

import java.util.HashSet;
import java.util.Set;

/**
 * Created by kenny on 2/21/16.
 */
public class LinearWordPlacer implements RectangleWordPlacer {
    private final Set placedWords = new HashSet<>();

    @Override
    public void reset() {
        placedWords.clear();
    }

    @Override
    public boolean place(final Word word) {
        for (final Word placeWord : this.placedWords) {
            if (placeWord.collide(word)) {
                return false;
            }
        }
        placedWords.add(word);
        return true;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy