code clean up

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

@ -80,7 +80,7 @@ configure(javaProjects) {
jar { jar {
manifest { manifest {
version = project.version.replace("-", "."); version = project.version.replace("-", ".")
} }
} }
cobertura { cobertura {
@ -232,30 +232,30 @@ task javadocAll(type: Javadoc) {
task writeSettings { task writeSettings {
doLast { doLast {
Writer out = new OutputStreamWriter(new FileOutputStream("build/settings.gradle")); Writer out = new OutputStreamWriter(new FileOutputStream("build/settings.gradle"))
out.write("include "); out.write("include ")
boolean first = true; boolean first = true
for (Project myproject : distributionProjects) { for (Project myproject : distributionProjects) {
if (!myproject.getProjectDir().equals(getProjectDir())) { if (!myproject.getProjectDir().equals(getProjectDir())) {
if (first == true) { if (first == true) {
first = false; first = false
} else { } else {
out.write ", "; out.write ", "
} }
out.write '"' + myproject.name + '"' out.write '"' + myproject.name + '"'
} }
} }
out.write "\n\n"; out.write "\n\n"
for (Project myproject : distributionProjects) { for (Project myproject : distributionProjects) {
if (myproject.getProjectDir().equals(getProjectDir())) { if (myproject.getProjectDir().equals(getProjectDir())) {
continue; continue
} }
println myproject.name 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 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 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 * 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() * @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); BAD_STATE(3);
private final int value; private final int value;
private DoubleBitPos(int value) { DoubleBitPos(int value) {
this.value = value; this.value = value;
} }

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

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

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

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

@ -31,7 +31,7 @@ public interface ClientEventListener {
* *
* @param report the report that arrived. * @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 * 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. * @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++) { for (int i = 0; i < numArrayElements; i++) {
arrayChildren.add( arrayChildren.add(
getModelNodesFromTypeSpecification( getModelNodesFromTypeSpecification(
new ObjectReference(ref + "(" + Integer.toString(i) + ")"), new ObjectReference(ref + "(" + i + ")"),
fc, fc,
mmsTypeSpec.getTypeDescription().getArray().getElementType())); mmsTypeSpec.getTypeDescription().getArray().getElementType()));
} }

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

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

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

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

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

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

@ -20,17 +20,17 @@ import javax.swing.tree.TreeNode;
public interface DataTreeNode { 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 @Test
public void testClientServerCom() public void testClientServerCom()
throws IOException, ServiceError, ConfigurationException, javax.naming.ConfigurationException, throws IOException, ServiceError, javax.naming.ConfigurationException,
SclParseException, InterruptedException { SclParseException, InterruptedException {
clientSap.setTSelRemote(new byte[] {0, 1}); clientSap.setTSelRemote(new byte[] {0, 1});

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

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

Loading…
Cancel
Save