From 9a6b78a68ddbfbe927eb5829cb616f9fd422ef4d Mon Sep 17 00:00:00 2001 From: Robert von Burg Date: Thu, 6 Aug 2020 15:34:03 +0200 Subject: [PATCH] [New] Added ElementLdtDateVisitor and ElementZdtDateVisitor --- .../model/visitor/ElementLdtDateVisitor.java | 43 +++++++++++++++++++ .../model/visitor/ElementZdtDateVisitor.java | 43 +++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 li.strolch.model/src/main/java/li/strolch/model/visitor/ElementLdtDateVisitor.java create mode 100644 li.strolch.model/src/main/java/li/strolch/model/visitor/ElementZdtDateVisitor.java diff --git a/li.strolch.model/src/main/java/li/strolch/model/visitor/ElementLdtDateVisitor.java b/li.strolch.model/src/main/java/li/strolch/model/visitor/ElementLdtDateVisitor.java new file mode 100644 index 000000000..4e8633b07 --- /dev/null +++ b/li.strolch.model/src/main/java/li/strolch/model/visitor/ElementLdtDateVisitor.java @@ -0,0 +1,43 @@ +/* + * Copyright 2013 Robert von Burg + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package li.strolch.model.visitor; + +import java.time.LocalDateTime; + +import li.strolch.model.Order; +import li.strolch.model.Resource; +import li.strolch.model.activity.Activity; + +/** + * @author Robert von Burg + */ +public class ElementLdtDateVisitor implements StrolchRootElementVisitor { + + @Override + public LocalDateTime visitOrder(Order order) { + return order.getDateLdt(); + } + + @Override + public LocalDateTime visitResource(Resource resource) { + throw new IllegalArgumentException("Resources have no date!"); + } + + @Override + public LocalDateTime visitActivity(Activity activity) { + throw new IllegalArgumentException("Activities have no date!"); + } +} diff --git a/li.strolch.model/src/main/java/li/strolch/model/visitor/ElementZdtDateVisitor.java b/li.strolch.model/src/main/java/li/strolch/model/visitor/ElementZdtDateVisitor.java new file mode 100644 index 000000000..a1ad5ce71 --- /dev/null +++ b/li.strolch.model/src/main/java/li/strolch/model/visitor/ElementZdtDateVisitor.java @@ -0,0 +1,43 @@ +/* + * Copyright 2013 Robert von Burg + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package li.strolch.model.visitor; + +import java.time.ZonedDateTime; + +import li.strolch.model.Order; +import li.strolch.model.Resource; +import li.strolch.model.activity.Activity; + +/** + * @author Robert von Burg + */ +public class ElementZdtDateVisitor implements StrolchRootElementVisitor { + + @Override + public ZonedDateTime visitOrder(Order order) { + return order.getDateZdt(); + } + + @Override + public ZonedDateTime visitResource(Resource resource) { + throw new IllegalArgumentException("Resources have no date!"); + } + + @Override + public ZonedDateTime visitActivity(Activity activity) { + throw new IllegalArgumentException("Activities have no date!"); + } +}