Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
joram
joram
Commits
3aca56d8
Commit
3aca56d8
authored
Mar 18, 2022
by
Andre Freyssinet
Browse files
Code cleaning.
parent
e067c94a
Changes
2
Hide whitespace changes
Inline
Side-by-side
joram/a3/common/src/main/java/fr/dyade/aaa/common/encoding/EncodedStringList.java
View file @
3aca56d8
/*
* Copyright (C) 2013 - 20
17
ScalAgent Distributed Technologies
* Copyright (C) 2013 - 20
22
ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -26,7 +26,7 @@ import java.util.ArrayList;
import
java.util.List
;
@SuppressWarnings
(
"serial"
)
public
class
EncodedStringList
implements
Serializable
,
Encodable
{
public
final
class
EncodedStringList
implements
Serializable
,
Encodable
{
private
List
<
EncodedString
>
list
;
public
EncodedStringList
()
{
...
...
@@ -37,10 +37,12 @@ public class EncodedStringList implements Serializable, Encodable {
return
list
;
}
@Override
public
int
getEncodableClassId
()
{
return
EncodableFactoryRepository
.
ENCODED_STRING_LIST_CLASS_ID
;
}
@Override
public
int
getEncodedSize
()
throws
Exception
{
int
res
=
4
;
for
(
EncodedString
str
:
list
)
{
...
...
@@ -49,6 +51,7 @@ public class EncodedStringList implements Serializable, Encodable {
return
res
;
}
@Override
public
void
encode
(
Encoder
encoder
)
throws
Exception
{
encoder
.
encode32
(
list
.
size
());
for
(
EncodedString
str
:
list
)
{
...
...
@@ -56,6 +59,7 @@ public class EncodedStringList implements Serializable, Encodable {
}
}
@Override
public
void
decode
(
Decoder
decoder
)
throws
Exception
{
int
l
=
decoder
.
decode32
();
list
=
new
ArrayList
<
EncodedString
>(
l
);
...
...
joram/a3/common/src/main/java/fr/dyade/aaa/common/encoding/StringPair.java
View file @
3aca56d8
/*
* Copyright (C) 2013 ScalAgent Distributed Technologies
* Copyright (C) 2013
- 2022
ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -24,7 +24,7 @@ package fr.dyade.aaa.common.encoding;
/**
* Encodable object representing a pair of strings.
*/
public
class
StringPair
implements
Encodable
{
public
final
class
StringPair
implements
Encodable
{
private
EncodedString
s1
;
...
...
@@ -33,24 +33,27 @@ public class StringPair implements Encodable {
public
StringPair
()
{}
public
StringPair
(
EncodedString
s1
,
EncodedString
s2
)
{
super
();
this
.
s1
=
s1
;
this
.
s2
=
s2
;
}
@Override
public
int
getEncodableClassId
()
{
return
EncodableFactoryRepository
.
STRING_PAIR_CLASS_ID
;
}
@Override
public
int
getEncodedSize
()
{
return
s1
.
getEncodedSize
()
+
s2
.
getEncodedSize
();
}
@Override
public
void
encode
(
Encoder
encoder
)
throws
Exception
{
s1
.
encode
(
encoder
);
s2
.
encode
(
encoder
);
}
@Override
public
void
decode
(
Decoder
decoder
)
throws
Exception
{
s1
=
new
EncodedString
();
s1
.
decode
(
decoder
);
...
...
@@ -60,11 +63,8 @@ public class StringPair implements Encodable {
@Override
public
String
toString
()
{
StringBuffer
buf
=
new
StringBuffer
(
s1
.
getString
().
length
()
+
1
+
s2
.
getString
().
length
());
buf
.
append
(
s1
);
buf
.
append
(
'-'
);
buf
.
append
(
s2
);
StringBuffer
buf
=
new
StringBuffer
(
s1
.
getString
().
length
()
+
1
+
s2
.
getString
().
length
());
buf
.
append
(
s1
).
append
(
'-'
).
append
(
s2
);
return
buf
.
toString
();
}
...
...
@@ -100,11 +100,8 @@ public class StringPair implements Encodable {
}
public
static
class
Factory
implements
EncodableFactory
{
public
Encodable
createEncodable
()
{
return
new
StringPair
();
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment