teichmann@5831: package org.dive4elements.river.artifacts.access; raimund@3887: raimund@3898: import java.util.Arrays; raimund@3898: raimund@3898: import org.apache.log4j.Logger; raimund@3898: teichmann@5831: import org.dive4elements.artifacts.CallContext; teichmann@5831: import org.dive4elements.river.artifacts.FLYSArtifact; teichmann@5831: import org.dive4elements.river.utils.FLYSUtils; teichmann@5831: import org.dive4elements.river.utils.StringUtil; raimund@3887: raimund@3887: raimund@3887: public class BedDifferencesAccess raimund@3887: extends RiverAccess raimund@3887: { raimund@3898: private static Logger logger = Logger.getLogger(BedDifferencesAccess.class); raimund@3887: private String yearEpoch; raimund@3887: private String[] diffs; raimund@3887: raimund@3887: private CallContext context; raimund@3887: raimund@3887: public BedDifferencesAccess(FLYSArtifact artifact, CallContext context) { raimund@3887: super(artifact); raimund@3887: this.context = context; raimund@3887: } raimund@3887: raimund@3887: public String getYearEpoch() { raimund@3898: yearEpoch = getString("ye_select"); raimund@3887: return yearEpoch; raimund@3887: } raimund@3887: raimund@3887: public FLYSArtifact[][] getDifferenceArtifacts() { raimund@3898: diffs = getString("diffids").split("#"); raimund@3898: logger.debug("diffs: " + Arrays.toString(diffs)); raimund@3898: FLYSArtifact[][] artifacts = new FLYSArtifact[diffs.length/2][2]; raimund@3898: for (int i = 0; i < diffs.length; i += 2) { raimund@3898: String diff1 = StringUtil.unbracket(diffs[0 + 2*i]); raimund@3898: String diff2 = StringUtil.unbracket(diffs[1 + 2*i]); raimund@3887: String[] diff1parts = diff1.split(";"); raimund@3887: String[] diff2parts = diff2.split(";"); raimund@3898: logger.debug("creating 2 artifacts." + diff1parts[0] + "; " + diff2parts[0]); raimund@3887: artifacts[i][0] = FLYSUtils.getArtifact(diff1parts[0], context); raimund@3898: artifacts[i][1] = FLYSUtils.getArtifact(diff2parts[0], context); raimund@3887: } raimund@3887: return artifacts; raimund@3887: } raimund@3887: raimund@3887: public static int getHeightId(FLYSArtifact artifact) { raimund@3887: Access a = new Access(artifact); raimund@3887: return a.getInteger("height_id"); raimund@3887: } raimund@3887: } felix@4528: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :