Skip to content
This repository has been archived by the owner on May 17, 2020. It is now read-only.

Commit

Permalink
Merge pull request #44 from JacopoWolf/feature-Min-middleware
Browse files Browse the repository at this point in the history
Implemented network-to-logic levels
  • Loading branch information
JacopoWolf authored Nov 18, 2019
2 parents e672e3e + 8898aa4 commit dd267f0
Show file tree
Hide file tree
Showing 36 changed files with 2,249 additions and 99 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ build/
nbbuild/
dist/
nbdist/
.nb-gradle/
.nb-gradle/
/PCP/nbproject/
54 changes: 51 additions & 3 deletions PCP/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@

<groupId>edu.itimarconivr.quintaei</groupId>
<artifactId>PCP</artifactId>
<version>Min.a.2</version>

<name>PCP</name>
<version>Min.a.1</version>
<packaging>jar</packaging>


<properties>

Expand All @@ -23,8 +25,6 @@

</properties>


<!-- list of dependencies -->
<dependencies>

<!-- https://mvnrepository.com/artifact/junit/junit -->
Expand All @@ -42,6 +42,54 @@
<version>2.8.6</version>
<scope>compile</scope>
</dependency>

</dependencies>

<build>

<plugins>

<!-- code coverage -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.0.201403182114</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- javadoc compilation -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<doclint>none</doclint>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>

</build>

</project>
41 changes: 37 additions & 4 deletions PCP/src/main/java/PCP/Min/data/AliasChange.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,29 @@

package PCP.Min.data;

import PCP.data.IPCPdata;
import PCP.*;
import PCP.data.*;
import java.util.*;

/**
*
* rapresents an alias change
*
* @author gfurri20
* @author Alessio789
*/
public class AliasChange implements IPCPdata
public class AliasChange implements IPCPData
{
private byte[] id;
private String oldAlias;
private String newAlias;

/**
*
* @param id
* @param oldAlias
* @param newAlias
*/
public AliasChange( byte[] id, String oldAlias, String newAlias )
{
this.id = id;
Expand All @@ -28,31 +36,56 @@ public AliasChange( byte[] id, String oldAlias, String newAlias )

//<editor-fold defaultstate="collapsed" desc="getter and setters">

/**
*
* @return
*/

public byte[] getId()
{
return id;
}

/**
*
* @param id
*/
public void setId( byte[] id )
{
this.id = id;
}

/**
*
* @return
*/
public String getOldAlias()
{
return oldAlias;
}

/**
*
* @param oldAlias
*/
public void setOldAlias( String oldAlias )
{
this.oldAlias = oldAlias;
}

/**
*
* @return
*/
public String getNewAlias()
{
return newAlias;
}

/**
*
* @param newAlias
*/
public void setNewAlias( String newAlias )
{
this.newAlias = newAlias;
Expand All @@ -63,7 +96,7 @@ public void setNewAlias( String newAlias )
@Override
public OpCode getOpCode()
{
return OpCode.AliasChanghe;
return OpCode.AliasChange;
}

@Override
Expand All @@ -79,7 +112,7 @@ public byte[] header()

int i = 0;
//Opcode
buffer[i++] = OpCode.AliasChanghe.getByte();
buffer[i++] = OpCode.AliasChange.getByte();
//Id
for(byte b : id)
buffer[i++] = b;
Expand Down
60 changes: 57 additions & 3 deletions PCP/src/main/java/PCP/Min/data/Disconnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,38 @@
*/
package PCP.Min.data;

import PCP.data.IPCPdata;
import PCP.*;
import PCP.data.*;
import java.util.*;


/**
*
* rappresents a disconnection action
* @author Alessio789
* @author gfurri20
*/
public class Disconnection implements IPCPdata
public class Disconnection implements IPCPData
{

/**
* reasons for the disconnection
*/
public enum Reason
{

/**
* no reason
*/
none (0),

/**
* you jave timed out, meaning no activity for the default time
*/
timedOut (1),

/**
* the server has been shut down. Before that it will tell you.
*/
goneOffline (2);


Expand All @@ -29,6 +45,11 @@ private Reason( int code )
{
this.code = (byte)code;
}

/**
*
* @return
*/
public byte getByte()
{
return this.code;
Expand All @@ -39,12 +60,20 @@ public byte getByte()
private Reason reason;
private boolean byClient; //It's true if the disconnection has been required by the client

/**
*
* @param id
*/
public Disconnection( byte[] id )
{
this.id = id;
this.byClient = true;
}

/**
*
* @param reason
*/
public Disconnection( Reason reason )
{
this.reason = reason;
Expand All @@ -53,31 +82,56 @@ public Disconnection( Reason reason )

//<editor-fold defaultstate="collapsed" desc="getter and setters">

/**
*
* @return
*/

public byte[] getId()
{
return id;
}

/**
*
* @param id
*/
public void setId( byte[] id )
{
this.id = id;
}

/**
*
* @return
*/
public Reason getReason()
{
return reason;
}

/**
*
* @param reason
*/
public void setReason( Reason reason )
{
this.reason = reason;
}

/**
*
* @return
*/
public boolean isByClient()
{
return byClient;
}

/**
*
* @param byClient
*/
public void setByClient( boolean byClient )
{
this.byClient = byClient;
Expand Down
4 changes: 2 additions & 2 deletions PCP/src/main/java/PCP/Min/data/ErrorMsg.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
package PCP.Min.data;

import PCP.data.IPCPdata;
import PCP.data.IPCPData;
import PCP.*;
import PCP.PCPException.ErrorCode;
import java.util.*;
Expand All @@ -14,7 +14,7 @@
* @author Jacopo_Wolf
* @author Alessio789
*/
public class ErrorMsg implements IPCPdata
public class ErrorMsg implements IPCPData
{
private ErrorCode errorCode;

Expand Down
4 changes: 2 additions & 2 deletions PCP/src/main/java/PCP/Min/data/GroupUserListRrq.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

package PCP.Min.data;
import PCP.data.IPCPdata;
import PCP.data.IPCPData;
import PCP.*;
import java.util.*;

Expand All @@ -12,7 +12,7 @@
* @author gfurri20
* @author Alessio789
*/
public class GroupUserListRrq implements IPCPdata
public class GroupUserListRrq implements IPCPData
{
private byte[] senderId;

Expand Down
Loading

0 comments on commit dd267f0

Please sign in to comment.