Skip to content

Commit

Permalink
Merge pull request #507 from nvanderperren/issue/422
Browse files Browse the repository at this point in the history
add default switch statements
  • Loading branch information
carlwilson committed Nov 5, 2019
2 parents 7a277f8 + 076fd0f commit 5ed4ba9
Show file tree
Hide file tree
Showing 12 changed files with 589 additions and 342 deletions.
Expand Up @@ -30,7 +30,7 @@ public class RepTreeRoot extends DefaultMutableTreeNode
* Constructor.
* @param info The RepInfo object whose contents are to
* be displayed.
* @param base The JHOVE base on which we're operating.
* @param base The JhoveBase object under which we're operating.
*/
public RepTreeRoot (RepInfo info, JhoveBase base)
{
Expand All @@ -49,6 +49,8 @@ public RepTreeRoot (RepInfo info, JhoveBase base)

/**
* Constructs a DefaultMutableTreeNode representing a property
* @param pProp: the property
* @return: the DefaultMutableTreeNode representing a property
*/
private DefaultMutableTreeNode propToNode (Property pProp)
{
Expand Down Expand Up @@ -126,13 +128,16 @@ private DefaultMutableTreeNode propToNode (Property pProp)
/**
* Find the index of an object in its parent.
* Understands the Jhove property structure.
* @param parent: the parent object
* @param child: the child object of which we want the index
* @return the index of the child object in its parent
*/
public int getIndexOfChild (Object parent, Object child)
{
Property pProp = (Property) parent;
PropertyArity arity = pProp.getArity ();
// For Lists, Maps, and Sets we construct an Iterator.
Iterator<?> iter = null;
Iterator<?> iter;
if (arity == PropertyArity.SET ||
arity == PropertyArity.LIST ||
arity == PropertyArity.MAP) {
Expand Down Expand Up @@ -172,7 +177,7 @@ else if (iter.next () == child) {
Property[] propArray = null;
Rational[] rationalArray = null;
Object[] objArray = null;
int n = 0;
int n;

if (null == propType) {
return 0; // non-object array type
Expand Down Expand Up @@ -295,12 +300,14 @@ private void snarfRepInfo ()
if (_info.getWellFormed () == RepInfo.TRUE) {
switch (_info.getValid ()) {
case RepInfo.TRUE:
wfStr += " and valid";
break;
wfStr += " and valid";
break;

case RepInfo.FALSE:
wfStr += ", but not valid";
break;
wfStr += ", but not valid";
break;
default: wfStr += "";
break;

// case UNDETERMINED: add nothing
}
Expand Down Expand Up @@ -932,19 +939,17 @@ private DefaultMutableTreeNode nisoToNode (NisoImageMetadata niso)
DefaultMutableTreeNode nod = (new DefaultMutableTreeNode
("YCbCrCoefficients", true));
val.add (nod);
for (int i = 0; i < rarray.length; i++) {
nod.add (new DefaultMutableTreeNode
(rarray[i].toString (), false));
for (Rational rarray1 : rarray) {
nod.add(new DefaultMutableTreeNode(rarray1.toString(), false));
}
}
rarray = niso.getReferenceBlackWhite ();
if (rarray != null) {
DefaultMutableTreeNode nod = (new DefaultMutableTreeNode
("ReferenceBlackWhite", true));
val.add (nod);
for (int i = 0; i < rarray.length; i++) {
nod.add (new DefaultMutableTreeNode
(rarray[i].toString (), false));
for (Rational rarray1 : rarray) {
nod.add(new DefaultMutableTreeNode(rarray1.toString(), false));
}
}
if ((n = niso.getSegmentType ()) != NisoImageMetadata.NULL) {
Expand Down

0 comments on commit 5ed4ba9

Please sign in to comment.