Class BitMatrix

java.lang.Object
com.easydesk.util.BitMatrix
All Implemented Interfaces:
Cloneable

public class BitMatrix extends Object implements Cloneable
FixedBitSet 기반 2차원 BitMatrix ( ModuleSize x ItemTypeSize )
Author:
Youngho Cho
  • Constructor Details

    • BitMatrix

      public BitMatrix(long width, long height)
      Parameters:
      width - (Module Size)
      height - (ItemType Size)
    • BitMatrix

      public BitMatrix(BitMatrix other)
      복사 생성자 (Non-destructive 연산용)
      Parameters:
      other -
    • BitMatrix

      public BitMatrix(org.apache.lucene.util.FixedBitSet a, org.apache.lucene.util.FixedBitSet b)
      두 FixedBitSet 의 외적 (a x b) 으로 BitMatrix 를 만든다.
      Parameters:
      a - Module FixedBitSet (x, width)
      b - ItemType FixedBitSet (y, height)
  • Method Details

    • getWidth

      public long getWidth()
      Returns:
    • getHeight

      public long getHeight()
      Returns:
    • size

      public long size()
      Returns:
    • set

      public void set(long x, long y)
      (x, y) 좌표 비트 켜기 (1로 설정)
      Parameters:
      x -
      y -
    • get

      public boolean get(long x, long y)
      (x, y) 좌표 비트 상태 확인
      Parameters:
      x -
      y -
      Returns:
    • getOffset

      public long getOffset(long x, long y)
      (x, y) 좌표를 1차원 인덱스로 변환
      Parameters:
      x -
      y -
      Returns:
    • cardinality

      public long cardinality()
      설정된 총 비트 수(1의 개수) 반환
      Returns:
    • not

      public BitMatrix not()
      NOT 연산: 모든 비트를 반전합니다. (~A) (0부터 width * height - 1 인덱스까지 모든 비트를 반전합니다.)
      Returns:
    • and

      public BitMatrix and(BitMatrix other)
      AND 연산: 두 행렬의 비트별 AND를 수행합니다. (A & B) (두 비트세트 간 64비트 단위(long) Word 단위의 비트 AND 연산을 실행합니다.)
      Parameters:
      other -
      Returns:
    • or

      public BitMatrix or(BitMatrix other)
      OR 연산: 두 행렬의 비트별 OR를 수행합니다. (A | B) (두 비트세트 간 64비트 단위 Word 단위의 비트 OR 연산을 실행합니다.)
      Parameters:
      other -
      Returns:
    • nor

      public BitMatrix nor(BitMatrix other)
      NOR 연산: 두 행렬의 비트별 NOR를 수행합니다. (~(A | B)) (OR 연산 후 전체 영역을 flip하여 반전합니다.)
      Parameters:
      other -
      Returns:
    • xor

      public BitMatrix xor(BitMatrix other)
      XOR 연산: 두 행렬의 비트별 XOR를 수행합니다. (A ^ B) 서로 다른 비트 위치만 1이 됩니다. (두 비트가 다를 때만 1로 설정됩니다.)
      Parameters:
      other -
      Returns:
    • andNot

      public BitMatrix andNot(BitMatrix other)
      AND-NOT (차집합) 연산: 현재 행렬에서 other 행렬의 비트를 제거합니다. (A & ~B) 현재 행렬이 1이고 other 행렬이 0인 위치만 1로 남습니다. (this의 비트 중 other의 비트가 1인 자리를 0으로 끕니다.)
      Parameters:
      other -
      Returns:
    • xorCopy

      public BitMatrix xorCopy(BitMatrix other)
      Parameters:
      other -
      Returns:
    • andNotCopy

      public BitMatrix andNotCopy(BitMatrix other)
      Parameters:
      other -
      Returns:
    • notCopy

      public BitMatrix notCopy()
      Returns:
    • andCopy

      public BitMatrix andCopy(BitMatrix other)
      Parameters:
      other -
      Returns:
    • orCopy

      public BitMatrix orCopy(BitMatrix other)
      Parameters:
      other -
      Returns:
    • norCopy

      public BitMatrix norCopy(BitMatrix other)
      Parameters:
      other -
      Returns:
    • equals

      public boolean equals(Object o)
      (non-Javadoc)
      Overrides:
      equals in class Object
      See Also:
    • hashCode

      public int hashCode()
      (non-Javadoc)
      Overrides:
      hashCode in class Object
      See Also:
    • clone

      public BitMatrix clone()
      (non-Javadoc)
      Overrides:
      clone in class Object
      See Also: