-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from NASA-PDS/validate_7
Validate 7: add complex types
- Loading branch information
Showing
8 changed files
with
173 additions
and
4 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
src/main/java/gov/nasa/pds/label/NameNotKnownException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package gov.nasa.pds.label; | ||
|
||
public class NameNotKnownException extends IllegalArgumentException { | ||
private static final long serialVersionUID = -2657183691342441420L; | ||
public NameNotKnownException() { | ||
super(); | ||
} | ||
public NameNotKnownException(String s) { | ||
super(s); | ||
} | ||
public NameNotKnownException(Throwable cause) { | ||
super(cause); | ||
} | ||
public NameNotKnownException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/main/java/gov/nasa/pds/objectAccess/array/ComplexDataTypeAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package gov.nasa.pds.objectAccess.array; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
public interface ComplexDataTypeAdapter extends DataTypeAdapter { | ||
/** | ||
* Gets the imaginary value as an int. | ||
* | ||
* @param buf the buffer from which to get the value | ||
* @return the imaginary value, as an int | ||
*/ | ||
int getImagInt(ByteBuffer buf); | ||
/** | ||
* Gets the imaginary value as a long. | ||
* | ||
* @param buf the buffer from which to get the value | ||
* @return the imaginary value, as a long | ||
*/ | ||
long getImagLong(ByteBuffer buf); | ||
/** | ||
* Gets the imaginary value as a double. | ||
* | ||
* @param buf the buffer from which to get the value | ||
* @return the imaginary value, as a double | ||
*/ | ||
double getImagDouble(ByteBuffer buf); | ||
/** | ||
* Gets the real value as an int. | ||
* | ||
* @param buf the buffer from which to get the value | ||
* @return the real value, as an int | ||
*/ | ||
int getRealInt(ByteBuffer buf); | ||
/** | ||
* Gets the real value as a long. | ||
* | ||
* @param buf the buffer from which to get the value | ||
* @return the real value, as a long | ||
*/ | ||
long getRealLong(ByteBuffer buf); | ||
/** | ||
* Gets the real value as a double. | ||
* | ||
* @param buf the buffer from which to get the value | ||
* @return the real value, as a double | ||
*/ | ||
double getRealDouble(ByteBuffer buf); | ||
} |
47 changes: 47 additions & 0 deletions
47
src/main/java/gov/nasa/pds/objectAccess/array/ComplexDoubleAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package gov.nasa.pds.objectAccess.array; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
public class ComplexDoubleAdapter extends DoubleAdapter implements ComplexDataTypeAdapter { | ||
public ComplexDoubleAdapter(boolean isBigEndian) { | ||
super(isBigEndian); | ||
// TODO Auto-generated constructor stub | ||
} | ||
@Override | ||
public int getInt(ByteBuffer buf) { | ||
return (int)this.getDouble(buf); | ||
} | ||
@Override | ||
public long getLong(ByteBuffer buf) { | ||
return (long)this.getDouble(buf); | ||
} | ||
@Override | ||
public double getDouble(ByteBuffer buf) { | ||
double imag=this.getImagDouble(buf), real=this.getRealDouble(buf); | ||
return Math.sqrt(imag*imag + real*real); | ||
} | ||
@Override | ||
public int getImagInt(ByteBuffer buf) { | ||
return super.getInt(buf); | ||
} | ||
@Override | ||
public long getImagLong(ByteBuffer buf) { | ||
return super.getLong(buf); | ||
} | ||
@Override | ||
public double getImagDouble(ByteBuffer buf) { | ||
return super.getDouble(buf); | ||
} | ||
@Override | ||
public int getRealInt(ByteBuffer buf) { | ||
return super.getInt(buf); | ||
} | ||
@Override | ||
public long getRealLong(ByteBuffer buf) { | ||
return super.getLong(buf); | ||
} | ||
@Override | ||
public double getRealDouble(ByteBuffer buf) { | ||
return super.getDouble(buf); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/gov/nasa/pds/objectAccess/array/ComplexFloatAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package gov.nasa.pds.objectAccess.array; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
public class ComplexFloatAdapter extends FloatAdapter implements ComplexDataTypeAdapter { | ||
public ComplexFloatAdapter(boolean isBigEndian) { | ||
super(isBigEndian); | ||
} | ||
@Override | ||
public int getInt(ByteBuffer buf) { | ||
return (int)this.getDouble(buf); | ||
} | ||
@Override | ||
public long getLong(ByteBuffer buf) { | ||
return (long)this.getDouble(buf); | ||
} | ||
@Override | ||
public double getDouble(ByteBuffer buf) { | ||
double imag=this.getImagDouble(buf), real=this.getRealDouble(buf); | ||
return Math.sqrt(imag*imag + real*real); | ||
} | ||
@Override | ||
public int getImagInt(ByteBuffer buf) { | ||
return super.getInt(buf); | ||
} | ||
@Override | ||
public long getImagLong(ByteBuffer buf) { | ||
return super.getLong(buf); | ||
} | ||
@Override | ||
public double getImagDouble(ByteBuffer buf) { | ||
return super.getDouble(buf); | ||
} | ||
@Override | ||
public int getRealInt(ByteBuffer buf) { | ||
return super.getInt(buf); | ||
} | ||
@Override | ||
public long getRealLong(ByteBuffer buf) { | ||
return super.getLong(buf); | ||
} | ||
@Override | ||
public double getRealDouble(ByteBuffer buf) { | ||
return super.getDouble(buf); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters