This repository has been archived on 2022-12-21. You can view files and clone it, but cannot push or open issues or pull requests.
sdm03/src/main/java/com/github/dtschust/zork/types/ZorkContainer.java

50 lines
1.2 KiB
Java
Raw Normal View History

2022-11-19 09:46:28 +00:00
package com.github.dtschust.zork.types;
2022-11-21 21:29:36 +00:00
import com.github.dtschust.zork.ZorkTrigger;
import java.util.*;
/* Container*/
2022-11-16 16:18:19 +00:00
public class ZorkContainer extends ZorkObject {
2022-11-21 21:29:36 +00:00
public final Set<String> item;
private final List<String> accepts;
private boolean open;
2022-11-21 21:29:36 +00:00
public ZorkContainer(final String name,
final String description,
final boolean open,
final String status,
final Collection<String> items,
final Collection<String> accepts,
final Collection<ZorkTrigger> triggers) {
super(name, description, status, triggers);
this.open = open;
this.item = new HashSet<>(items);
this.accepts = new ArrayList<>(accepts);
}
2022-11-21 21:29:36 +00:00
public void addItem(final String item) {
this.item.add(item);
}
public void removeItem(final String item) {
this.item.remove(item);
}
public boolean containsItem(final String item) {
return this.item.contains(item);
}
public boolean isEmpty() {
return this.item.isEmpty();
}
2022-11-21 16:10:08 +00:00
public boolean isOpen() {
return open;
}
2022-11-21 16:10:08 +00:00
public void open() {
open = true;
}
}