code clean up

pull/11/head
Stefan Feuerhahn 7 years ago
parent 0d3a5e2971
commit fafbec0786

@ -80,7 +80,7 @@ configure(javaProjects) {
jar {
manifest {
version = project.version.replace("-", ".");
version = project.version.replace("-", ".")
}
}
cobertura {
@ -232,30 +232,30 @@ task javadocAll(type: Javadoc) {
task writeSettings {
doLast {
Writer out = new OutputStreamWriter(new FileOutputStream("build/settings.gradle"));
out.write("include ");
boolean first = true;
Writer out = new OutputStreamWriter(new FileOutputStream("build/settings.gradle"))
out.write("include ")
boolean first = true
for (Project myproject : distributionProjects) {
if (!myproject.getProjectDir().equals(getProjectDir())) {
if (first == true) {
first = false;
first = false
} else {
out.write ", ";
out.write ", "
}
out.write '"' + myproject.name + '"'
}
}
out.write "\n\n";
out.write "\n\n"
for (Project myproject : distributionProjects) {
if (myproject.getProjectDir().equals(getProjectDir())) {
continue;
continue
}
println myproject.name
out.write 'project(":' + myproject.name + '").projectDir = file("' + myproject.getProjectDir().toString().substring((int) (getProjectDir().toString().size() + 1)) + '")\n';
out.write 'project(":' + myproject.name + '").projectDir = file("' + myproject.getProjectDir().toString().substring((int) (getProjectDir().toString().size() + 1)) + '")\n'
}
out.close();
out.close()
}
}

@ -18,7 +18,7 @@ import java.nio.ByteBuffer;
public interface AcseAssociationListener {
public void connectionIndication(AcseAssociation acseAssociation, ByteBuffer data);
void connectionIndication(AcseAssociation acseAssociation, ByteBuffer data);
public void serverStoppedListeningIndication(IOException e);
void serverStoppedListeningIndication(IOException e);
}

@ -17,7 +17,7 @@ import java.io.IOException;
public interface TConnectionListener {
public void connectionIndication(TConnection tConnection);
void connectionIndication(TConnection tConnection);
/**
* This function is only called when an IOException in ServerSocket.accept() occurred which was
@ -25,5 +25,5 @@ public interface TConnectionListener {
*
* @param e The IOException caught form ServerSocket.accept()
*/
public void serverStoppedListeningIndication(IOException e);
void serverStoppedListeningIndication(IOException e);
}

@ -83,7 +83,7 @@ public final class BdaDoubleBitPos extends BdaBitString {
BAD_STATE(3);
private final int value;
private DoubleBitPos(int value) {
DoubleBitPos(int value) {
this.value = value;
}

@ -220,7 +220,7 @@ public final class BdaQuality extends BdaBitString {
QUESTIONABLE(3);
private final int value;
private Validity(int value) {
Validity(int value) {
this.value = value;
}

@ -78,7 +78,7 @@ public final class BdaTapCommand extends BdaBitString {
RESERVED(3);
private final int value;
private TapCommand(int value) {
TapCommand(int value) {
this.value = value;
}

@ -40,5 +40,5 @@ public enum BdaType {
TAP_COMMAND,
TRIGGER_CONDITIONS,
OPTFLDS,
REASON_FOR_INCLUSION;
REASON_FOR_INCLUSION
}

@ -840,9 +840,7 @@ public final class ClientAssociation {
}
boolean moreFollows =
(fileDirectoryRes.getMoreFollows() == null)
? false
: fileDirectoryRes.getMoreFollows().value;
(fileDirectoryRes.getMoreFollows() != null) && fileDirectoryRes.getMoreFollows().value;
return moreFollows;
}
@ -1304,7 +1302,7 @@ public final class ClientAssociation {
} else if (!existingDs.isDeletable()) {
return;
} else {
serverModel.removeDataSet(dsObjRef.toString());
serverModel.removeDataSet(dsObjRef);
serverModel.addDataSet(dataSet);
}
}
@ -1873,10 +1871,7 @@ public final class ClientAssociation {
getDataValues(sbo);
if (sbo.getValue().length == 0) {
return false;
}
return true;
return sbo.getValue().length != 0;
}
/**

@ -31,7 +31,7 @@ public interface ClientEventListener {
*
* @param report the report that arrived.
*/
public void newReport(Report report);
void newReport(Report report);
/**
* Invoked when an IOException occurred for the association. An IOException implies that the
@ -40,5 +40,5 @@ public interface ClientEventListener {
*
* @param e the exception that occured.
*/
public void associationClosed(IOException e);
void associationClosed(IOException e);
}

@ -153,7 +153,7 @@ final class DataDefinitionResParser {
for (int i = 0; i < numArrayElements; i++) {
arrayChildren.add(
getModelNodesFromTypeSpecification(
new ObjectReference(ref + "(" + Integer.toString(i) + ")"),
new ObjectReference(ref + "(" + i + ")"),
fc,
mmsTypeSpec.getTypeDescription().getArray().getElementType()));
}

@ -127,7 +127,7 @@ public final class DataSet implements Iterable<FcModelNode> {
int slash = dataSetReference.indexOf('/');
String domainID = dataSetReference.substring(0, slash);
String itemID =
dataSetReference.substring(slash + 1, dataSetReference.length()).replace('.', '$');
dataSetReference.substring(slash + 1).replace('.', '$');
ObjectName.DomainSpecific domainSpecificObjectName = new ObjectName.DomainSpecific();
domainSpecificObjectName.setDomainID(new Identifier(domainID.getBytes()));

@ -107,17 +107,11 @@ public abstract class FcModelNode extends ModelNode {
}
boolean isSelected() {
if (selected == null) {
return false;
}
return true;
return selected != null;
}
boolean isSelectedBy(ServerAssociation association) {
if (selected == association) {
return true;
}
return false;
return selected == association;
}
VariableDefs.SEQUENCE getMmsVariableDef() {

@ -69,7 +69,7 @@ public abstract class ModelNode implements Iterable<ModelNode> {
if (children == null) {
return null;
}
return (Collection<ModelNode>) ((Collection<?>) children.values());
return (Collection<ModelNode>) children.values();
}
protected Iterator<Iterator<? extends ModelNode>> getIterators() {

@ -112,7 +112,7 @@ public final class ObjectReference implements Iterable<String> {
int lastDelim = -1;
int nextDelim = objectReference.indexOf('/');
if (nextDelim == -1) {
nodeNames.add(objectReference.substring(lastDelim + 1, objectReference.length()));
nodeNames.add(objectReference.substring(lastDelim + 1));
return;
}
@ -143,7 +143,7 @@ public final class ObjectReference implements Iterable<String> {
}
if (dotIndex == openingbracketIndex && dotIndex == closingbracketIndex) {
nodeNames.add(objectReference.substring(lastDelim + 1, objectReference.length()));
nodeNames.add(objectReference.substring(lastDelim + 1));
return;
}

@ -16,7 +16,7 @@ package com.beanit.openiec61850;
public class ReportEntryData {
/** Not specified in IEC61850 but useful for data persistence */
private long id;;
private long id;
/** Reference to to {@link DataSet}-member */
private String dataRef;
/** Attribute value to be reported */
@ -67,7 +67,7 @@ public class ReportEntryData {
this.report = report;
}
public static enum ReasonCode {
public enum ReasonCode {
DCHG,
QCHG,
DUPD,

@ -29,7 +29,7 @@ public interface ServerEventListener {
* @return a list of service errors indicating errors writing the corresponding basic data
* attributes.
*/
public List<ServiceError> write(List<BasicDataAttribute> bdas);
List<ServiceError> write(List<BasicDataAttribute> bdas);
void serverStoppedListening(ServerSap serverSAP);
}

@ -20,17 +20,17 @@ import javax.swing.tree.TreeNode;
public interface DataTreeNode {
public abstract BasicDataBind<?> getData();
BasicDataBind<?> getData();
public abstract void reset(ClientAssociation association) throws ServiceError, IOException;
void reset(ClientAssociation association) throws ServiceError, IOException;
public abstract void writeValues(ClientAssociation association) throws ServiceError, IOException;
void writeValues(ClientAssociation association) throws ServiceError, IOException;
public abstract int getChildCount();
int getChildCount();
public abstract TreeNode getChildAt(int index);
TreeNode getChildAt(int index);
public abstract boolean writable();
boolean writable();
public abstract boolean readable();
boolean readable();
}

@ -112,7 +112,7 @@ public class ClientServerITest extends Thread implements ServerEventListener, Cl
@Test
public void testClientServerCom()
throws IOException, ServiceError, ConfigurationException, javax.naming.ConfigurationException,
throws IOException, ServiceError, javax.naming.ConfigurationException,
SclParseException, InterruptedException {
clientSap.setTSelRemote(new byte[] {0, 1});

@ -100,7 +100,7 @@ public class ClientServerITest2 extends Thread implements ServerEventListener, C
@Test
public void testClientServerCom()
throws IOException, ServiceError, ConfigurationException, javax.naming.ConfigurationException,
throws IOException, ServiceError, javax.naming.ConfigurationException,
SclParseException, InterruptedException {
clientSap.setTSelRemote(new byte[] {0, 1});

@ -60,12 +60,12 @@ public class ReportingTest implements ClientEventListener {
@Before
public void startServerAndClient()
throws SclParseException, UnknownHostException, IOException, ServiceError {
throws SclParseException, IOException, ServiceError {
startServer();
startClient();
}
private void startClient() throws IOException, UnknownHostException, ServiceError {
private void startClient() throws IOException, ServiceError {
ClientSap clientSap = new ClientSap();
this.clientAssociation =
clientSap.associate(InetAddress.getByName("localhost"), PORT, "", this);

Loading…
Cancel
Save