@Override public Object retrieve(String field) { if (field == null) { return null; } else if (field.equals(ID)) { return getId(); } else if (field.equals(VERSION)) { return getVersion(); } else if (field.equals(CORRECTIONCOLLAR)) { return getCorrectionCollar(); } else if (field.equals(MEDIUM)) { return getMedium(); } else if (field.equals(REFRACTIVEINDEX)) { return getRefractiveIndex(); } else if (field.equals(OBJECTIVE)) { return getObjective(); } else if (field.equals(DETAILS)) { return getDetails(); } else { if (_dynamicFields != null) { return _dynamicFields.get(field); } return null; } }
/** * Handles inserting a specific type of model object into our object graph. * @param LSID LSID of the model object. * @param sourceObject Model object itself. * @param indexes Any indexes that should be used to reference the model * object. */ private void handle(String LSID, ObjectiveSettings sourceObject, Map<String, Integer> indexes) { Integer instrumentIndex = indexes.get("instrumentIndex"); Integer otfIndex = indexes.get("otfIndex"); Integer imageIndex = indexes.get("imageIndex"); if (instrumentIndex != null && otfIndex != null) { OTF o = getOTF(instrumentIndex, otfIndex); o.setObjective(sourceObject.getObjective()); } else { Image i = getImage(imageIndex); i.setObjectiveSettings(sourceObject); } }
/** * Finds the matching unique settings for an image. * @param uniqueSettings Set of existing unique settings. * @param image Image to find unique settings for. * @return Matched unique settings or <code>null</code> if * <code>lc.getObjectiveSettings() == null</code>. */ private ObjectiveSettings getUniqueObjectiveSettings( Set<ObjectiveSettings> uniqueSettings, Image image) { ObjectiveSettings s1 = image.getObjectiveSettings(); if (s1 == null) { return null; } for (ObjectiveSettings s2 : uniqueSettings) { if (compare(s1.getCorrectionCollar(), s2.getCorrectionCollar()) && compare(s1.getMedium(), s2.getMedium()) && s1.getObjective() == s2.getObjective() && compare(s1.getRefractiveIndex(), s2.getRefractiveIndex())) { return s2; } } uniqueSettings.add(s1); return s1; }