Package com.easydesk.util
Class BitMatrix
java.lang.Object
com.easydesk.util.BitMatrix
- All Implemented Interfaces:
Cloneable
FixedBitSet 기반 2차원 BitMatrix ( ModuleSize x ItemTypeSize )
- Author:
- Youngho Cho
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAND 연산: 두 행렬의 비트별 AND를 수행합니다.AND-NOT (차집합) 연산: 현재 행렬에서 other 행렬의 비트를 제거합니다.andNotCopy(BitMatrix other) long설정된 총 비트 수(1의 개수) 반환clone()(non-Javadoc)boolean(non-Javadoc)booleanget(long x, long y) (x, y) 좌표 비트 상태 확인longlonggetOffset(long x, long y) (x, y) 좌표를 1차원 인덱스로 변환longgetWidth()inthashCode()(non-Javadoc)NOR 연산: 두 행렬의 비트별 NOR를 수행합니다.not()NOT 연산: 모든 비트를 반전합니다.notCopy()OR 연산: 두 행렬의 비트별 OR를 수행합니다.voidset(long x, long y) (x, y) 좌표 비트 켜기 (1로 설정)longsize()XOR 연산: 두 행렬의 비트별 XOR를 수행합니다.
-
Constructor Details
-
BitMatrix
public BitMatrix(long width, long height) - Parameters:
width- (Module Size)height- (ItemType Size)
-
BitMatrix
복사 생성자 (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
NOT 연산: 모든 비트를 반전합니다.(~A)(0부터 width * height - 1 인덱스까지 모든 비트를 반전합니다.)- Returns:
-
and
AND 연산: 두 행렬의 비트별 AND를 수행합니다.(A & B)(두 비트세트 간 64비트 단위(long) Word 단위의 비트 AND 연산을 실행합니다.)- Parameters:
other-- Returns:
-
or
OR 연산: 두 행렬의 비트별 OR를 수행합니다.(A | B)(두 비트세트 간 64비트 단위 Word 단위의 비트 OR 연산을 실행합니다.)- Parameters:
other-- Returns:
-
nor
NOR 연산: 두 행렬의 비트별 NOR를 수행합니다.(~(A | B))(OR 연산 후 전체 영역을 flip하여 반전합니다.)- Parameters:
other-- Returns:
-
xor
XOR 연산: 두 행렬의 비트별 XOR를 수행합니다. (A ^ B) 서로 다른 비트 위치만 1이 됩니다. (두 비트가 다를 때만 1로 설정됩니다.)- Parameters:
other-- Returns:
-
andNot
AND-NOT (차집합) 연산: 현재 행렬에서 other 행렬의 비트를 제거합니다.(A & ~B)현재 행렬이 1이고 other 행렬이 0인 위치만 1로 남습니다. (this의 비트 중 other의 비트가 1인 자리를 0으로 끕니다.)- Parameters:
other-- Returns:
-
xorCopy
- Parameters:
other-- Returns:
-
andNotCopy
- Parameters:
other-- Returns:
-
notCopy
- Returns:
-
andCopy
- Parameters:
other-- Returns:
-
orCopy
- Parameters:
other-- Returns:
-
norCopy
- Parameters:
other-- Returns:
-
equals
(non-Javadoc) -
hashCode
public int hashCode()(non-Javadoc) -
clone
(non-Javadoc)
-