Commit pirate JS files
This commit is contained in:
62
js/CandidateFilterConfirmed.js
Normal file
62
js/CandidateFilterConfirmed.js
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
Copyright (c) 2023-forever Douglas Malnati. All rights reserved.
|
||||
|
||||
See the /faq/tos page for details.
|
||||
|
||||
(If this generated header is stamped on a file which is a 3rd party file or under a different license or copyright, then ignore this copyright statement and use that file's terms.)
|
||||
*/
|
||||
|
||||
import { CandidateFilterBase } from './CandidateFilterBase.js';
|
||||
import { NonRejectedOnlyFilter } from './WsprMessageCandidate.js';
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Candidate Filter - Confirmed
|
||||
//
|
||||
// If a slot contains one or more confirmed messages, reject any remaining
|
||||
// non-confirmed candidates in that same slot.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
export class CandidateFilterConfirmed
|
||||
extends CandidateFilterBase
|
||||
{
|
||||
constructor(t)
|
||||
{
|
||||
super("ByConfirmed", t);
|
||||
}
|
||||
|
||||
OnFilterStart()
|
||||
{
|
||||
this.t.Event(`CandidateFilterConfirmed Start`);
|
||||
}
|
||||
|
||||
OnFilterEnd()
|
||||
{
|
||||
this.t.Event(`CandidateFilterConfirmed End`);
|
||||
}
|
||||
|
||||
FilterWindowAlgorithm(msgListList)
|
||||
{
|
||||
for (let slot = 0; slot < 5; ++slot)
|
||||
{
|
||||
let msgList = NonRejectedOnlyFilter(msgListList[slot]);
|
||||
let hasConfirmed = msgList.some(msg => msg.IsConfirmed());
|
||||
|
||||
if (!hasConfirmed)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (let msg of msgList)
|
||||
{
|
||||
if (msg.IsCandidate())
|
||||
{
|
||||
msg.Reject(
|
||||
this.type,
|
||||
`Confirmed message found in slot ${slot}, rejecting unconfirmed candidates in same slot.`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user