Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
224 changes: 0 additions & 224 deletions ChangeReqLab_merged.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
/*
* @(#)FormatExtension.java
*
* Copyright (c) 2025 The authors and contributors of JHotDraw.
* You may not use, copy or modify this file, except in compliance with the
* accompanying license terms.
*/
package org.jhotdraw.draw.io;

import java.util.Arrays;
Expand All @@ -17,48 +10,24 @@ public final class FormatExtension {

private final String extension;

/**
* Creates a new format extension.
*
* @param extension the file extension (without leading dot)
* @throws IllegalArgumentException if extension is null or empty
*/
public FormatExtension(String extension) {
if (extension == null || extension.trim().isEmpty()) {
throw new IllegalArgumentException("Extension cannot be null or empty");
}
// Normalize to lowercase for consistent comparison
this.extension = extension.trim().toLowerCase();
}

/**
* Returns the normalized extension string.
*
* @return the extension in lowercase
*/
public String getValue() {
return extension;
}

/**
* Checks if this extension matches the given string (case-insensitive).
*
* @param other the string to compare
* @return true if they match
*/
public boolean matches(String other) {
if (other == null) {
return false;
}
return extension.equalsIgnoreCase(other.trim());
}

/**
* Creates a set of FormatExtension objects from an array of strings.
*
* @param extensions array of extension strings
* @return immutable set of FormatExtension objects
*/
public static Set<FormatExtension> createSet(String... extensions) {
if (extensions == null || extensions.length == 0) {
return Collections.emptySet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,15 @@

public interface ImageFormatProvider {

/**
* Returns the format name (e.g., "PNG", "JPEG").
*
* @return the format name
*/
String getFormatName();

/**
* Returns a human-readable description of the format.
*
* @return the format description
*/
String getDescription();

/**
* Returns the file extensions supported by this format.
*
* @return array of file extensions (without dots)
*/
String[] getFileExtensions();

/**
* Returns the MIME types supported by this format.
*
* @return array of MIME types
*/
String[] getMimeTypes();

/**
* Creates an input format for reading images of this type.
*
* @param prototype the prototype figure for holding the image
* @return an InputFormat instance
*/
InputFormat createInputFormat(ImageHolderFigure prototype);

/**
* Creates an output format for writing images of this type.
*
* @return an OutputFormat instance, or null if output is not supported
*/
OutputFormat createOutputFormat();
}
Loading