001
002/*
003 * Copyright (C) 2010 Archie L. Cobbs. All rights reserved.
004 *
005 * $Id$
006 */
007
008package org.dellroad.jibxbindings.pidf;
009
010import java.util.ArrayList;
011import java.util.Date;
012import java.util.List;
013
014import org.dellroad.jibxbindings.pidf.lo.GeoPriv;
015
016/**
017 * PIDF {@code <tuple>} element.
018 */
019public class Tuple implements Component {
020
021    private String id;
022    private Status status;
023    private Contact contact;
024    private List<LangContent> notes = new ArrayList<LangContent>();
025    private Date timestamp;
026
027    public String getId() {
028        return this.id;
029    }
030    public void setId(String id) {
031        this.id = id;
032    }
033
034    public Status getStatus() {
035        return this.status;
036    }
037    public void setStatus(Status status) {
038        this.status = status;
039    }
040
041    public Contact getContact() {
042        return this.contact;
043    }
044    public void setContact(Contact contact) {
045        this.contact = contact;
046    }
047
048    public List<LangContent> getNotes() {
049        return this.notes;
050    }
051    public void setNotes(List<LangContent> notes) {
052        this.notes = notes;
053    }
054
055    public Date getTimestamp() {
056        return this.timestamp;
057    }
058    public void setTimestamp(Date timestamp) {
059        this.timestamp = timestamp;
060    }
061
062    @Override
063    public GeoPriv getGeoPriv() {
064        return this.status != null ? this.status.getGeoPriv() : null;
065    }
066
067    @Override
068    public void visit(ComponentSwitch componentSwitch) {
069        componentSwitch.caseTuple(this);
070    }
071
072// Cloneable
073
074    @Override
075    public Tuple clone() {
076        final Tuple clone;
077        try {
078            clone = (Tuple)super.clone();
079        } catch (CloneNotSupportedException e) {
080            throw new RuntimeException(e);
081        }
082        clone.status = this.status != null ? this.status.clone() : null;
083        clone.contact = this.contact != null ? this.contact.clone() : null;
084        if (this.notes != null) {
085            clone.notes = new ArrayList<>(this.notes.size());
086            for (LangContent note : this.notes)
087                clone.notes.add(note.clone());
088        }
089        return clone;
090    }
091}
092