Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
61 changes: 61 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# PyDev specific (Python IDE for Eclipse)
*.pydevproject

# CDT-specific (C/C++ Development Tooling)
.cproject

# CDT- autotools
.autotools

# Java annotation processor (APT)
.factorypath

# PDT-specific (PHP Development Tools)
.buildpath

# sbteclipse plugin
.target

# Tern plugin
.tern-project

# TeXlipse plugin
.texlipse

# STS (Spring Tool Suite)
.springBeans

# Code Recommenders
.recommenders/

# Annotation Processing
.apt_generated/
.apt_generated_test/

# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet

# Uncomment this line if you wish to ignore the project description file.
# Typically, this file would be tracked if it contains build/dependency configurations:
#.project
/target/
8 changes: 8 additions & 0 deletions .idea/.gitignore
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commits polluted with project files (.settings, .idea, etc.).

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/pio_git_rhymers_23.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>powp-rhymers</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
67 changes: 67 additions & 0 deletions src/main/java/edu/kis/vh/nursery/DefaultCountingOutRhymer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package edu.kis.vh.nursery;

/**
* @author 240827
* Default rhymer that works similarly to a stack.
*/
public class DefaultCountingOutRhymer {

public static final int NUMBER = 12;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong name.
Errors in collaborators work (lack of good review). Extracting constants is done incorrectly. Have you used review hints ('Github - PR checkpoint' at wikamp).

public static final int NEGATIVE = -1;
private int[] numbers = new int[NUMBER];

private int total = NEGATIVE;

/**
* @return How many numbers have been added to the rhymer so far.
*/
public int getTotal() {
return total;
}

/**
* Adds number specified in in argument to the rhymer.
* The in argument is not added if the rhymer is full.
* @param in
*/
public void countIn(int in) {
if (!isFull())
numbers[++total] = in;
}

/**
* @return boolean value indicating if the rhymer is empty.
*/
public boolean isEmpty() {
return total == NEGATIVE;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This constant should be different (separate) than the one in peekaboo and countOut methods.

}

/**
* @return boolean value indicating if the rhymer is full.
*/
public boolean isFull() {
return total == 11;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another constant. It is related to NUMBER

}

/**
* Returns at the top of the rhymer.
* If the rhymer is empty, NEGATIVE is returned.
* @return value at the top of the rhymer.
*/
protected int peekaboo() {
if (isEmpty())
return NEGATIVE;
return numbers[total];
}

/**
* Returns value at the top of the rhymer and removes it from the rhymer.
* If the rhymer is empty, NEGATIVE is returned.
* @return value at the top of the rhymer.
*/
public int countOut() {
if (isEmpty())
return NEGATIVE;
return numbers[total--];
}
}
21 changes: 0 additions & 21 deletions src/main/java/edu/kis/vh/nursery/FIFORhymer.java

This file was deleted.

21 changes: 21 additions & 0 deletions src/main/java/edu/kis/vh/nursery/FifoRhymer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package edu.kis.vh.nursery;

public class FifoRhymer extends DefaultCountingOutRhymer {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fifo -> FIFO


private DefaultCountingOutRhymer internalRhymer = new DefaultCountingOutRhymer();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be final


@Override
public int countOut() {
while (!isEmpty())

internalRhymer.countIn(super.countOut());

int ret = internalRhymer.countOut();

while (!internalRhymer.isEmpty())

countIn(internalRhymer.countOut());

Comment on lines +8 to +18
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting convention issues (problems with merging 'format' branch?)
you forked a wrong repo

return ret;
}
}
13 changes: 7 additions & 6 deletions src/main/java/edu/kis/vh/nursery/HanoiRhymer.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package edu.kis.vh.nursery;

public class HanoiRhymer extends defaultCountingOutRhymer {
public class HanoiRhymer extends DefaultCountingOutRhymer {

int totalRejected = 0;
private int totalRejected = 0;

public int reportRejected() {
return totalRejected;
}

@Override
public void countIn(int in) {
if (!callCheck() && in > peekaboo())
if (!isEmpty() && in > peekaboo())
totalRejected++;
else
super.countIn(in);
else
super.countIn(in);
}
}
}
34 changes: 0 additions & 34 deletions src/main/java/edu/kis/vh/nursery/defaultCountingOutRhymer.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
package edu.kis.vh.nursery.factory;

import edu.kis.vh.nursery.defaultCountingOutRhymer;
import edu.kis.vh.nursery.FIFORhymer;
import edu.kis.vh.nursery.DefaultCountingOutRhymer;
import edu.kis.vh.nursery.FifoRhymer;
import edu.kis.vh.nursery.HanoiRhymer;
import edu.kis.vh.nursery.factory.Rhymersfactory;

public class DefaultRhymersFactory implements Rhymersfactory {

@Override
public defaultCountingOutRhymer GetStandardRhymer() {
return new defaultCountingOutRhymer();
public DefaultCountingOutRhymer GetStandardRhymer() {
return new DefaultCountingOutRhymer();
}

@Override
public defaultCountingOutRhymer GetFalseRhymer() {
return new defaultCountingOutRhymer();
public DefaultCountingOutRhymer GetFalseRhymer() {
return new DefaultCountingOutRhymer();
}

@Override
public defaultCountingOutRhymer GetFIFORhymer() {
return new FIFORhymer();
public DefaultCountingOutRhymer GetFIFORhymer() {
return new FifoRhymer();
}

@Override
public defaultCountingOutRhymer GetHanoiRhymer() {
public DefaultCountingOutRhymer GetHanoiRhymer() {
return new HanoiRhymer();
}

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/edu/kis/vh/nursery/factory/Rhymersfactory.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package edu.kis.vh.nursery.factory;

import edu.kis.vh.nursery.defaultCountingOutRhymer;
import edu.kis.vh.nursery.DefaultCountingOutRhymer;

public interface Rhymersfactory {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rhymersfactory -> RhymersFactory


public defaultCountingOutRhymer GetStandardRhymer();
public DefaultCountingOutRhymer GetStandardRhymer();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong convention. Method names should start from a lower case.


public defaultCountingOutRhymer GetFalseRhymer();
public DefaultCountingOutRhymer GetFalseRhymer();

public defaultCountingOutRhymer GetFIFORhymer();
public DefaultCountingOutRhymer GetFIFORhymer();

public defaultCountingOutRhymer GetHanoiRhymer();
public DefaultCountingOutRhymer GetHanoiRhymer();

}
Loading