Skip to content

Resolve "Clean up CzmlFile"

Julien LEBLOND requested to merge 19-clean-up-czmlfile into master

Closes #19 (closed)

  • abstractPrimaryObjects → Rename to objects or czmlPrimaryObjects if you like the long names ;)

    • Should be a list of CzmlPrimaryObject (use the interface for genericity, instead of the abstract class)
    • Add a public method getId() to CzmlPrimaryObject
  • stringWriter: does it need to be static ? It's only used to create a default CesiumOutputStream

  • CesiumOutputStream output, only really used in write() method → should be initialized at the beginning of this method

  • `CesiumStreamWriter streamWriter: same

  • String pathDirectory: there are methods in Java to get parent directory and create it.

    In your case: File file = new File(filePath); then file.getParentFile().mkdirs();

    Can be done on the fly just before writing the actual file.

  • String pathFile and `write()` method. IMHO we shouldn't store the pathFile but have a signature `write(String)` or `write(File)`

    (and then `pathFile` shall be removed from the builder too

  • `NUMBER_OF_POLYLINE_IN_FILE` and associated functions: only used in `FieldOfObservation`. Move them here?

  • `header`, `setHeader`: user can set the header but then in write method it is overwritten. I think the attribute and class could be removed

  • Also, at start of write(), an empty-check is done on the list. The exception is NO_HEADER but then the header is taken from the list, so the exception should be EMPTY_LIST ??

  • `containsInstance` and `indexOfInstance`: why not just `getHeader()` that loops on objects and catch the Header?

  • Removing duplicates in write():

    • `noDuplicates.add(objects.get(0));` is that supposed to be the Header?
    • In the loop: current object is compared to previous from ids, what happened if two objects have the same ID but are not consecutive? In a nutshell, what is the point of the "remove duplicates" block of code?

Merge request reports

Loading