2 * Copyright (c) 2010-2020 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.icalendar.internal.logic;
15 import java.time.Instant;
16 import java.util.ArrayList;
17 import java.util.List;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.eclipse.jdt.annotation.Nullable;
25 * @author Michael Wodniok - Initial contribution
26 * @author Andrew Fiddian-Green - Added support for event description
30 public final List<CommandTag> commandTags = new ArrayList<CommandTag>();
31 public final Instant end;
32 public final Instant start;
33 public final String title;
35 public Event(String title, Instant start, Instant end, String description) {
40 if (description.isEmpty()) {
44 String[] lines = description.replace("<p>", "").replace("</p>", "\n").split("\n");
45 for (String line : lines) {
46 CommandTag tag = CommandTag.createCommandTag(line);
54 public boolean equals(@Nullable Object other) {
55 if (other == null || other.getClass() != this.getClass()) {
58 final Event otherEvent = (Event) other;
59 return (this.title.equals(otherEvent.title) && this.start.equals(otherEvent.start)
60 && this.end.equals(otherEvent.end));