-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor instances: adds an abstract Intance
- Loading branch information
Showing
6 changed files
with
65 additions
and
64 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
src/main/java/fr/inria/spirals/npefix/resi/context/instance/AbstractInstance.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,54 @@ | ||
package fr.inria.spirals.npefix.resi.context.instance; | ||
|
||
public abstract class AbstractInstance<T> implements Instance<T> { | ||
|
||
protected Class getClassFromString (String className) { | ||
if(className.equals("int")) { | ||
return int.class; | ||
} | ||
if(className.equals("int[]")) { | ||
return int[].class; | ||
} | ||
if(className.equals("long")) { | ||
return long.class; | ||
} | ||
if(className.equals("long[]")) { | ||
return long[].class; | ||
} | ||
if(className.equals("float")) { | ||
return float.class; | ||
} | ||
if(className.equals("float[]")) { | ||
return float[].class; | ||
} | ||
if(className.equals("double")) { | ||
return double.class; | ||
} | ||
if(className.equals("double[]")) { | ||
return double[].class; | ||
} | ||
if(className.equals("byte")) { | ||
return byte.class; | ||
} | ||
if(className.equals("byte[]")) { | ||
return byte[].class; | ||
} | ||
if(className.equals("char")) { | ||
return char.class; | ||
} | ||
if(className.equals("char[]")) { | ||
return char[].class; | ||
} | ||
if(className.equals("boolean")) { | ||
return boolean.class; | ||
} | ||
if(className.equals("boolean[]")) { | ||
return boolean[].class; | ||
} | ||
try { | ||
return getClass().forName(className); | ||
} catch (ClassNotFoundException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
src/main/java/fr/inria/spirals/npefix/resi/context/instance/PrimitiveInstance.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
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