Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
W1nt0r committed Dec 7, 2018
2 parents 1b9b8ed + 1f7970b commit 802ef5c
Show file tree
Hide file tree
Showing 43 changed files with 1,158 additions and 274 deletions.
6 changes: 3 additions & 3 deletions bintray.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
]
},
"version": {
"name": "1.1",
"released": "2018-11-15",
"name": "1.2",
"released": "2018-12-07",
"gpgSign": false
},
"files": [
{
"includePattern": "build/libs/(.*)",
"uploadPattern": "/ch/hsr/adv/adv-lib/1.1/$1",
"uploadPattern": "/ch/hsr/adv/adv-lib/1.2/$1",
"matrixParams": {
"override": 1
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = 'ch.hsr.adv'
version = '1.1'
version = '1.2'

/****************************************
* instructions for all projects
Expand Down
2 changes: 1 addition & 1 deletion lib-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ dependencies {
compile "ch.qos.logback:logback-classic:1+"

// common dependencies
compile 'ch.hsr.adv:adv-commons:1.1'
compile 'ch.hsr.adv:adv-commons:1.2'
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@ class ArrayBuilder implements Builder {
@Override
public ModuleGroup build(ADVModule advModule) {
ArrayModule arrayModule = (ArrayModule) advModule;
ModuleGroup moduleGroup = new ModuleGroup(advModule.getModuleName());
ModuleGroup moduleGroup = new ModuleGroup(advModule.getModuleName(),
arrayModule.getPosition());

if (arrayModule.isShowObjectRelations()) {
moduleGroup.getFlags().add(SHOW_OBJECT_RELATIONS);
}

if (arrayModule.isShowArrayIndices()) {
moduleGroup.getFlags().add(ConstantsArray.SHOW_ARRAY_INDICES);
}

buildElements(arrayModule, moduleGroup);

return moduleGroup;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ch.hsr.adv.lib.array.logic;

import ch.hsr.adv.commons.array.logic.ConstantsArray;
import ch.hsr.adv.commons.core.logic.domain.ModulePosition;
import ch.hsr.adv.commons.core.logic.domain.styles.ADVStyle;
import ch.hsr.adv.commons.queue.logic.ConstantsQueue;
import ch.hsr.adv.lib.core.logic.ADVModule;
Expand All @@ -21,6 +22,8 @@ public class ArrayModule implements ADVModule {
private final String sessionName;
private Object[] array;
private boolean showObjectRelations;
private boolean showArrayIndices;
private ModulePosition position = ModulePosition.DEFAULT;

/**
* Default constructor
Expand All @@ -45,7 +48,6 @@ public ArrayModule(Object[] array) {
this.array = array;
}


public Object[] getArray() {
return array;
}
Expand Down Expand Up @@ -95,4 +97,19 @@ public Map<Integer, ADVStyle> getStyleMap() {
return styleMap;
}

public void setShowArrayIndices(boolean showArrayIndices) {
this.showArrayIndices = showArrayIndices;
}

public boolean isShowArrayIndices() {
return showArrayIndices;
}

public ModulePosition getPosition() {
return position;
}

public void setPosition(ModulePosition position) {
this.position = position;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package ch.hsr.adv.lib.array.logic;

import ch.hsr.adv.commons.array.logic.ConstantsArray;
import ch.hsr.adv.commons.core.logic.domain.ADVElement;
import ch.hsr.adv.commons.core.logic.domain.ModuleGroup;
import ch.hsr.adv.commons.core.logic.domain.ModulePosition;
import ch.hsr.adv.lib.array.logic.domain.ArrayTestModule;
import com.google.inject.Inject;
import org.jukito.JukitoRunner;
Expand Down Expand Up @@ -71,5 +73,22 @@ public void elementBuildTest() {
assertEquals(0, fixedElements.size());
}

@Test
public void addArrayIndicesFlagTest() {
ArrayTestModule arrayModule = new ArrayTestModule();
arrayModule.setShowArrayIndices(true);

ModuleGroup arrayGroup = sut.build(arrayModule);

assertTrue(arrayGroup.getFlags().contains(ConstantsArray.SHOW_ARRAY_INDICES));
}

@Test
public void modulePositionAppendedTest() {
ArrayTestModule arrayModule = new ArrayTestModule();

ModuleGroup arrayGroup = sut.build(arrayModule);

assertEquals(ModulePosition.DEFAULT, arrayGroup.getPosition());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public ModuleGroup build(ADVModule advModule) {
GraphModule module = (GraphModule) advModule;

ModuleGroup moduleGroup = new ModuleGroup(
advModule.getModuleName());
module.getModuleName(), module.getPosition());

buildVertices(moduleGroup, module.getGraph().getVertices());
buildRelations(moduleGroup, module.getGraph().getEdges());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ch.hsr.adv.lib.graph.logic;

import ch.hsr.adv.commons.core.logic.domain.ModulePosition;
import ch.hsr.adv.commons.graph.logic.ConstantsGraph;
import ch.hsr.adv.commons.graph.logic.domain.ADVEdge;
import ch.hsr.adv.commons.graph.logic.domain.ADVGraph;
Expand All @@ -16,6 +17,7 @@ public class GraphModule implements ADVModule {

private final String sessionName;
private final List<ADVModule> childModules = new ArrayList<>();
private ModulePosition position = ModulePosition.DEFAULT;

private ADVGraph<? extends ADVVertex<?>, ? extends ADVEdge<?>> graph;

Expand Down Expand Up @@ -78,4 +80,11 @@ public void addChildModule(ADVModule module) {
this.childModules.add(module);
}

public ModulePosition getPosition() {
return position;
}

public void setPosition(ModulePosition position) {
this.position = position;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import ch.hsr.adv.commons.core.logic.domain.ADVElement;
import ch.hsr.adv.commons.core.logic.domain.ModuleGroup;
import ch.hsr.adv.commons.core.logic.domain.ModulePosition;
import ch.hsr.adv.lib.graph.logic.domain.GraphTestModule;
import com.google.inject.Inject;
import org.jukito.JukitoRunner;
Expand Down Expand Up @@ -50,5 +51,13 @@ public void elementBuildTest() {
assertEquals(0, fixedElements.size());
}

@Test
public void modulePositionAppendedTest() {
GraphTestModule graphModule = new GraphTestModule();
graphModule.setPosition(ModulePosition.TOP);

ModuleGroup graphGroup = sut.build(graphModule);

assertEquals(ModulePosition.TOP, graphGroup.getPosition());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ class QueueBuilder implements Builder {

@Override
public ModuleGroup build(ADVModule module) {
ModuleGroup moduleGroup = createModuleGroup(module);
return moduleGroup;
return createModuleGroup(module);
}

private <T> ModuleGroup createModuleGroup(ADVModule module) {
QueueModule queueModule = (QueueModule) module;
ModuleGroup moduleGroup = new ModuleGroup(queueModule.getModuleName());
ModuleGroup moduleGroup = new ModuleGroup(queueModule.getModuleName(),
queueModule.getPosition());

Queue<T> clonedQueue = new LinkedList<>();
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ch.hsr.adv.lib.queue.logic;

import ch.hsr.adv.commons.core.logic.domain.ModulePosition;
import ch.hsr.adv.commons.core.logic.domain.styles.ADVStyle;
import ch.hsr.adv.commons.queue.logic.ConstantsQueue;
import ch.hsr.adv.lib.core.logic.ADVModule;
Expand All @@ -20,6 +21,7 @@ public class QueueModule implements ADVModule {
private final ADVQueue<?> queue;
private final List<ADVModule> childModules = new ArrayList<>();
private final Map<Integer, ADVStyle> styleMap = new HashMap<>();
private ModulePosition position = ModulePosition.DEFAULT;

/**
* Default constructor
Expand Down Expand Up @@ -87,5 +89,11 @@ public ADVQueue<?> getQueue() {
return queue;
}

public ModulePosition getPosition() {
return position;
}

public void setPosition(ModulePosition position) {
this.position = position;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import ch.hsr.adv.commons.core.logic.domain.ADVElement;
import ch.hsr.adv.commons.core.logic.domain.ModuleGroup;
import ch.hsr.adv.commons.core.logic.domain.ModulePosition;
import ch.hsr.adv.lib.queue.logic.domain.QueueTestModule;
import ch.hsr.adv.lib.queue.logic.domain.TestConstants;
import com.google.inject.Inject;
Expand Down Expand Up @@ -54,4 +55,14 @@ public void elementBuildTest() {
.collect(Collectors.toList());
assertEquals(0, fixedElements.size());
}

@Test
public void modulePositionAppendedTest() {
QueueTestModule queueModule = new QueueTestModule();
queueModule.setPosition(ModulePosition.LEFT);

ModuleGroup queueGroup = sut.build(queueModule);

assertEquals(ModulePosition.LEFT, queueGroup.getPosition());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ class StackBuilder implements Builder {

@Override
public ModuleGroup build(ADVModule module) {
ModuleGroup moduleGroup = createModuleGroup(module);
return moduleGroup;
return createModuleGroup(module);
}

private <T> ModuleGroup createModuleGroup(ADVModule module) {
StackModule stackModule = (StackModule) module;
ModuleGroup moduleGroup = new ModuleGroup(stackModule.getModuleName());
ModuleGroup moduleGroup = new ModuleGroup(stackModule.getModuleName(),
stackModule.getPosition());

Stack<T> clonedStack = new Stack<>();
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ch.hsr.adv.lib.stack.logic;

import ch.hsr.adv.commons.core.logic.domain.ModulePosition;
import ch.hsr.adv.commons.core.logic.domain.styles.ADVStyle;
import ch.hsr.adv.commons.stack.logic.ConstantsStack;
import ch.hsr.adv.lib.core.logic.ADVModule;
Expand All @@ -20,6 +21,7 @@ public class StackModule implements ADVModule {
private final ADVStack<?> stack;
private final List<ADVModule> childModules = new ArrayList<>();
private final Map<Integer, ADVStyle> styleMap = new HashMap<>();
private ModulePosition position = ModulePosition.DEFAULT;

/**
* Default constructor
Expand Down Expand Up @@ -86,5 +88,11 @@ public ADVStack<?> getStack() {
return stack;
}

public ModulePosition getPosition() {
return position;
}

public void setPosition(ModulePosition position) {
this.position = position;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import ch.hsr.adv.commons.core.logic.domain.ADVElement;
import ch.hsr.adv.commons.core.logic.domain.ModuleGroup;
import ch.hsr.adv.commons.core.logic.domain.ModulePosition;
import ch.hsr.adv.lib.stack.logic.domain.StackTestModule;
import ch.hsr.adv.lib.stack.logic.domain.TestConstants;
import com.google.inject.Inject;
Expand Down Expand Up @@ -54,4 +55,14 @@ public void elementBuildTest() {
.collect(Collectors.toList());
assertEquals(0, fixedElements.size());
}

@Test
public void modulePositionAppendedTest() {
StackTestModule stackModule = new StackTestModule();
stackModule.setPosition(ModulePosition.RIGHT);

ModuleGroup stackGroup = sut.build(stackModule);

assertEquals(ModulePosition.RIGHT, stackGroup.getPosition());
}
}
Loading

0 comments on commit 802ef5c

Please sign in to comment.