public class SemanticInterpreterGrid extends Object
Modifier and Type | Field and Description |
---|---|
private EditableReportProperties |
EP |
SemanticInterpreterGrid |
fatherGrid |
private int[] |
Gravity |
private int |
GridSize |
private String |
imgDir |
SemanticNode[][] |
labels |
static int |
NUMBER_OF_REGIONS |
private QMContainer |
qm |
private int |
Region |
HashMap<Integer,SemanticClass>[] |
SemanticClasses |
HashMap<Integer,SemanticClass> |
SemanticClassesIndex |
private TestRunResult |
TestRun |
int |
totalEmptyNodes |
private int |
type |
Unit[] |
units |
int |
XLength |
int |
YLength |
Constructor and Description |
---|
SemanticInterpreterGrid(Unit[] units,
TestRunResult testrun,
boolean master,
int Region,
int type,
String imgDir) |
Modifier and Type | Method and Description |
---|---|
void |
addClasstoGrid(int j)
adds a class from ClassCointainer to this SemanticClass Hashmap, used if the Grid is non Regular
|
private ArrayList<Integer> |
compareArrayLists(ArrayList<Integer> a1,
ArrayList<Integer> a2)
Compares two array lists and return how many elements are equal
FIXME: move to a generic utility class |
private int[] |
computeAxisPartition(int axislength)
Combines the used partitions for one axis (for easier handling)
|
private int[] |
computeMiddlePartition(int axislength)
Computes the Middle Partition (& let it grow) for the given axis
|
private int[] |
computeSidePartition(int axislength,
int type)
Computes the areas for the left(type==1) or right (type==2) side of the Middle part for the given Axis and
divides the parts equally among the granularity measures defines by the [] Gravity
|
int[] |
concatArrays(int[] a,
int[] b)
Concatenates two arrays.
|
void |
createClassReport(int j)
Creates a Class Report on Class with index j, saves it in the SemantiClass currClass and puts it on the
SemanticNode
|
String |
createClassReportOnGrid(int indexReport,
int clusterlevelReport,
ArrayList QMReportIntersection)
Creates a 3 fold Report
|
String |
createQMComparisonReportonGrid(String qualifier,
int Region)
Creates a Comparison report on all Quality Measures(qualifier=null), or on a specific Quality Measure(=Name), on
the given Region, or on the whole grid if the Region is 0
|
Unit[] |
cutArray(int x1,
int x2,
int y1,
int y2)
helper method, cuts a double array from this.units defined by X and Y
|
void |
getClassesfromFatherGrid()
Puts the Fathers Grid Classes in this grid
|
SemanticClass |
getClassfromGrid(int index) |
private ArrayList[] |
getclassTrail(ArrayList l)
Goes through the given list and tries to see which classes are connected
|
HashMap<Integer,SemanticClass> |
getClusterLevelClasses()
Gets the specific Classes for the Cluster Area, Used if this.fatherGrid != null & Index = 0
|
static int[] |
getDistance(int[] PointA,
int[] PointB) |
ArrayList<ArrayList<SemanticNode>> |
getEmptyNodeTrail(ArrayList<SemanticNode> EmptyNodes)
Returns a list containing all connect/unconnected parts of the empty units
|
ArrayList<Integer> |
getMaxRegionValue(ArrayList[] regions,
Integer[] wantedRegions)
Returns the MAX Value of the Region (Region values need to be summed and cast into the array at the specific
Region index)
|
private SemanticNode |
getNode(int[] c)
returns the Semantic Node for given coordinates
|
Unit[] |
getNonEmptyUnits()
Returns an array containing nonempty units
FIXME: refactor this, make a method in GrowingLayer , based on
GrowingLayer.getNumberOfNotEmptyUnits() |
int |
getNumberofSharedClasses(boolean clusterarea)
Returns the Number of all shared Classes within this Grid
|
private int[] |
getPartition(int axislength)
Estimates the Areas for the Middle part of the given Axis
|
ArrayList[] |
getQMIntersectionList(String Name1,
String Name2,
Unit[] units,
int type)
Returns a 9 field arrayList containing intersection units of QM Name1 & Name2, on units, that were chosen with
the comparing operation type
|
static String |
getRegion(int i)
Returns the String Name for the region with index i
FIXME: refactor this with a hashmap or similar |
ArrayList<SemanticNode>[] |
getRegionOccurance(String Name,
int clss)
Return an ArrayList with the SemanticNodes of ocurrances for the given quality measure and class
|
SemanticNode[][] |
getSemanticNodeArray()
returns the semantic node array
|
void |
initializeGridwithClasses(boolean regularGrid)
Creates all the Info needed for Report
|
ArrayList |
mergeArrayList(ArrayList l1,
ArrayList l2) |
String |
printQualityMeasureReport(String qualifier)
Prints a report on all selected Quality Measures, and adds a picture Frame if a visualization is available
qualifiers is a String array, containing all Names from the quality measures
|
void |
putClassinContainer(SemanticClass cl)
Puts the class in the right HashMap, and checks for wanted EditableProperties
|
void |
setFatherGrid(SemanticInterpreterGrid grid)
Used if the Grid wasn't made from a square Grid, so we use the Class Descriptions from a squared one in
SOMDEscriptionHTLM
|
void |
setSemanticGrid()
Puts this semanticGrid on the QuMContainer, uised or calculations ONLY the masterGrid should be set here, witch
is the one covering the whole Map
|
String |
showClassInfos(ArrayList<Integer> classes,
Integer type)
Creates a table that shows thew class infos if QMIntersectionClasshMap != Null, we also include a column showing
|
String |
simplifyRegionDescription(ArrayList[] regions)
Returns a simplified Region description (i.e region 3,6,9 lie all on the right side of the grid
FIXME: refactor this |
static Unit[] |
sortNodes(Unit[] units)
Sort the Unit array according to the Coordinates
FIXME: refactor this with some generic java sorting algorithm, implementing a special Comparator first if
needed |
String |
testQM(String QM_compare,
String QM_to,
ArrayList[] semanticNodes,
int type)
Tests the SemanticNodes found in the ArrayList-array about QM specific properties
|
public int XLength
public int YLength
private int Region
private String imgDir
private TestRunResult TestRun
public SemanticNode[][] labels
public Unit[] units
private int[] Gravity
public SemanticInterpreterGrid fatherGrid
private int type
private int GridSize
public static int NUMBER_OF_REGIONS
public HashMap<Integer,SemanticClass>[] SemanticClasses
public HashMap<Integer,SemanticClass> SemanticClassesIndex
public int totalEmptyNodes
private EditableReportProperties EP
private QMContainer qm
public SemanticInterpreterGrid(Unit[] units, TestRunResult testrun, boolean master, int Region, int type, String imgDir)
private int[] getPartition(int axislength)
private int[] computeMiddlePartition(int axislength)
private int[] computeSidePartition(int axislength, int type)
private int[] computeAxisPartition(int axislength)
public SemanticNode[][] getSemanticNodeArray()
public void initializeGridwithClasses(boolean regularGrid)
regularGrid
- true if the Grid is regular squaredpublic String createClassReportOnGrid(int indexReport, int clusterlevelReport, ArrayList QMReportIntersection)
indexReport
- = Number of the GridNumber to be analyzedclusterlevelReport
- number of the Clusterlevel to be analyzedQMReportIntersection
- [0] = Name of Quality Measure, [1] = 1 = MAX, 2 = MIN, [3..length] intersectio nunits
of the QM to be analyzedpublic static int[] getDistance(int[] PointA, int[] PointB)
public void createClassReport(int j)
public Unit[] cutArray(int x1, int x2, int y1, int y2)
private SemanticNode getNode(int[] c)
private ArrayList<Integer> compareArrayLists(ArrayList<Integer> a1, ArrayList<Integer> a2)
private ArrayList[] getclassTrail(ArrayList l)
public void setFatherGrid(SemanticInterpreterGrid grid)
public ArrayList<ArrayList<SemanticNode>> getEmptyNodeTrail(ArrayList<SemanticNode> EmptyNodes)
public static Unit[] sortNodes(Unit[] units)
Comparator
first if
neededpublic void addClasstoGrid(int j)
j
- classindexpublic int[] concatArrays(int[] a, int[] b)
ArrayUtils.addAll(int[], int[])
insteadpublic static String getRegion(int i)
public void putClassinContainer(SemanticClass cl)
public SemanticClass getClassfromGrid(int index)
public HashMap<Integer,SemanticClass> getClusterLevelClasses()
public int getNumberofSharedClasses(boolean clusterarea)
public String printQualityMeasureReport(String qualifier)
public ArrayList<SemanticNode>[] getRegionOccurance(String Name, int clss)
public String simplifyRegionDescription(ArrayList[] regions)
public ArrayList<Integer> getMaxRegionValue(ArrayList[] regions, Integer[] wantedRegions)
regions
- [9] double/intwantedRegions
- specifies a selectrion of Region, NULL if whole map regions wantedpublic String createQMComparisonReportonGrid(String qualifier, int Region)
public String showClassInfos(ArrayList<Integer> classes, Integer type)
classes
- the class indicestype
- 1,2,3,4 reportspublic ArrayList[] getQMIntersectionList(String Name1, String Name2, Unit[] units, int type)
Name1
- QualityMeasure1Name2
- QualityMeasure2units
- Array of units.type
- the type (see QMContainer.getComparedQMRegionOccurances(String, String, Unit[], int)
public void setSemanticGrid()
public String testQM(String QM_compare, String QM_to, ArrayList[] semanticNodes, int type)
QM_compare
- the QM Identifier that is QM_to is compared to if QM_compare == null, we dont make a
comparison, but just a test of the quality Measuretype
- 1 = MAX, 2 = MINpublic void getClassesfromFatherGrid()
public Unit[] getNonEmptyUnits()
GrowingLayer
, based on
GrowingLayer.getNumberOfNotEmptyUnits()