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
Aliaksandr Halavatyi
AutoMicTools
Commits
848fa317
Commit
848fa317
authored
Jan 14, 2022
by
Aliaksandr Halavatyi
Browse files
imaplementing WellPosition class
parent
5b27b301
Changes
3
Show whitespace changes
Inline
Side-by-side
pom.xml
View file @
848fa317
...
...
@@ -8,7 +8,7 @@
<version>5.0</version> <relativePath /> </parent> -->
<groupId>
embl.almf
</groupId>
<artifactId>
AutoMicTools_
</artifactId>
<version>
1.1.3
3
-SNAPSHOT
</version>
<version>
1.1.3
4
-SNAPSHOT
</version>
<name>
plugins/AutoMicTools_.jar
</name>
<description>
Collection of tools for automated (feedback) microscopy data acquisition and analysis
</description>
...
...
src/main/java/automic/geom/WellPosition.java
0 → 100644
View file @
848fa317
package
automic.geom
;
public
class
WellPosition
implements
Comparable
<
WellPosition
>
{
private
String
well
;
private
Integer
position
;
public
WellPosition
(
String
_well
,
int
_position
)
{
well
=
_well
;
position
=
_position
;
}
public
String
getWell
()
{
return
well
;
}
public
int
getPosition
()
{
return
position
;
}
@Override
public
int
compareTo
(
WellPosition
reference
){
int
wellComparison
=
this
.
well
.
compareTo
(
reference
.
well
);
if
(
wellComparison
!=
0
)
return
wellComparison
;
return
this
.
position
.
compareTo
(
reference
.
position
);
}
@Override
public
String
toString
()
{
return
String
.
format
(
"Well: %s; Position: %d"
,
well
,
position
);
}
@Override
public
final
int
hashCode
()
{
int
result
=
1000
;
if
(
well
!=
null
)
{
result
=
31
*
result
+
well
.
hashCode
();
}
if
(
position
!=
null
)
{
result
=
31
*
result
+
position
;
}
return
result
;
}
@Override
public
boolean
equals
(
Object
reference
)
{
if
(
reference
==
this
)
return
true
;
if
(!(
reference
instanceof
WellPosition
))
return
false
;
WellPosition
referenceO
=
(
WellPosition
)
reference
;
return
(
this
.
compareTo
(
referenceO
)==
0
);
}
}
src/test/java/automic/geom/TestWellPosition.java
0 → 100644
View file @
848fa317
package
automic.geom
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
public
class
TestWellPosition
{
public
static
void
main
(
String
[]
args
){
WellPosition
wp1
=
new
WellPosition
(
"A01"
,
1
);
WellPosition
wp1_1
=
new
WellPosition
(
"A01"
,
1
);
WellPosition
wp1_2
=
new
WellPosition
(
"A01"
,
2
);
WellPosition
wp2_1
=
new
WellPosition
(
"B02"
,
1
);
WellPosition
wp2_2
=
new
WellPosition
(
"B02"
,
2
);
System
.
out
.
println
(
String
.
format
(
"(%s) compared to (%s): %s"
,
wp1
,
wp1_1
,(
wp1
.
compareTo
(
wp1_1
))));
System
.
out
.
println
(
String
.
format
(
"(%s) compared to (%s): %s"
,
wp1
,
wp1_2
,(
wp1
.
compareTo
(
wp1_2
))));
System
.
out
.
println
(
String
.
format
(
"(%s) compared to (%s): %s"
,
wp1
,
wp2_1
,(
wp1
.
compareTo
(
wp2_1
))));
System
.
out
.
println
(
String
.
format
(
"(%s) compared to (%s): %s"
,
wp2_2
,
wp2_1
,(
wp2_2
.
compareTo
(
wp2_1
))));
Map
<
WellPosition
,
Point3D
>
platePositions
=
new
LinkedHashMap
<
WellPosition
,
Point3D
>();
System
.
out
.
println
(
platePositions
.
containsKey
(
wp1
));
platePositions
.
put
(
wp1_1
,
new
Point3D
(
0
,
0
,
0
));
System
.
out
.
println
(
platePositions
.
containsKey
(
wp1
));
platePositions
.
put
(
wp1
,
new
Point3D
(
0
,
0
,
0
));
System
.
out
.
println
(
platePositions
.
containsKey
(
wp1
));
System
.
out
.
println
(
platePositions
.
keySet
());
System
.
out
.
println
(
String
.
format
(
"(%s) hash code is: %d"
,
wp1
,
wp1
.
hashCode
()));
System
.
out
.
println
(
String
.
format
(
"(%s) hash code is: %d"
,
wp1_1
,
wp1_1
.
hashCode
()));
System
.
out
.
println
(
String
.
format
(
"(%s) hash code is: %d"
,
wp1_2
,
wp1_2
.
hashCode
()));
System
.
out
.
println
(
String
.
format
(
"(%s) hash code is: %d"
,
wp2_1
,
wp2_1
.
hashCode
()));
}
}
Write
Preview
Markdown
is supported
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