All files / platform/core/src/services/DisplaySetService DisplaySetMessage.ts

27.27% Statements 3/11
100% Branches 0/0
25% Functions 2/8
33.33% Lines 3/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51      34x                                                 115x                 1856x                          
/**
 * Defines a displaySet message, that could be any pf the potential problems of a displaySet
 */
class DisplaySetMessage {
  id: number;
  static CODES = {
    NO_VALID_INSTANCES: 1,
    NO_POSITION_INFORMATION: 2,
    NOT_RECONSTRUCTABLE: 3,
    MULTIFRAME_NO_PIXEL_MEASUREMENTS: 4,
    MULTIFRAME_NO_ORIENTATION: 5,
    MULTIFRAME_NO_POSITION_INFORMATION: 6,
    MISSING_FRAMES: 7,
    IRREGULAR_SPACING: 8,
    INCONSISTENT_DIMENSIONS: 9,
    INCONSISTENT_COMPONENTS: 10,
    INCONSISTENT_ORIENTATIONS: 11,
    INCONSISTENT_POSITION_INFORMATION: 12,
    UNSUPPORTED_DISPLAYSET: 13,
  };
 
  constructor(id: number) {
    this.id = id;
  }
}
/**
 * Defines a list of displaySet messages
 */
class DisplaySetMessageList {
  messages = [];
 
  public addMessage(messageId: number): void {
    const message = new DisplaySetMessage(messageId);
    this.messages.push(message);
  }
 
  public size(): number {
    return this.messages.length;
  }
 
  public includesMessage(messageId: number): boolean {
    return this.messages.some(message => message.id === messageId);
  }
 
  public includesAllMessages(messageIdList: number[]): boolean {
    return messageIdList.every(messageId => this.include(messageId));
  }
}
 
export { DisplaySetMessage, DisplaySetMessageList };