/*
* Copyright 2009 Peter Karich, peat_hal 'at' users 'dot' sourceforge 'dot' net.
*
* 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.
* under the License.
*/
package de.timefinder.core.util;
import de.timefinder.core.io.winqd.PersonComparator;
import de.timefinder.data.DBInterface;
import de.timefinder.data.Event;
import de.timefinder.data.Person;
import java.util.Collection;
import java.util.TreeSet;
/**
*
* @author Peter Karich, peat_hal 'at' users 'dot' sourceforge 'dot' net
*/
public class DualEvent implements DBInterface {
private Event eventA;
private Event eventB;
private Collection<Person> commonPersons;
protected DualEvent() {
}
public DualEvent(Event eventA, Event eventB) {
this.eventA = eventA;
this.eventB = eventB;
init();
}
public void init() {
if (eventA != null && eventB != null) {
commonPersons = new TreeSet(new PersonComparator());
commonPersons.addAll(eventA.getPersons());
commonPersons.retainAll(eventB.getPersons());
}
}
public String getEventA() {
return eventA.getName();
}
public String getEventB() {
return eventB.getName();
}
public Collection<Person> getVisitorsA() {
return eventA.getPersons();
}
public Collection<Person> getVisitorsB() {
return eventB.getPersons();
}
public int getVisitorsASize() {
return eventA.getPersons().size();
}
public int getVisitorsBSize() {
return eventB.getPersons().size();
}
public Collection<Person> getCommonPersons() {
return commonPersons;
}
public int getCommonPersonsSize() {
return commonPersons.size();
}
@Override
public void setId(Long id) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Long getId() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getName() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setName(String str) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean equalsProperties(Object obj) {
throw new UnsupportedOperationException("Not supported yet.");
}
}