org.nervousync.security.config.CRCConfig Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of utils-jdk11 Show documentation
Show all versions of utils-jdk11 Show documentation
Java utility collections, development by Nervousync Studio (NSYC)
/*
* Licensed to the Nervousync Studio (NSYC) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.nervousync.security.config;
/**
* CRC configure
* CRC设置
*
* @author Steven Wee [email protected]
* @version $Revision: 1.0.0 $ $Date: Jan 4, 2018 16:08:46 $
*/
public final class CRCConfig {
/**
* CRC bit
* CRC比特位
*/
private final int bit;
/**
* CRC polynomial
* CRC多项式编码
*/
private final long polynomial;
/**
* CRC initialize value
* CRC初始值
*/
private final long init;
/**
* CRC XOR out value
* CRC输出值异或运算
*/
private final long xorOut;
/**
* CRC output data length
* CRC输出数据长度
*/
private final int outLength;
/**
* CRC reverse input data bytes
* CRC反转输入字节数组
*/
private final boolean refIn;
/**
* CRC reverse output data bytes
* CRC反转输出字节数组
*/
private final boolean refOut;
/**
* Constructor method for CRCConfig
* CRC设置的构造方法
*
* @param bit CRC bit
* CRC比特位
* @param polynomial CRC polynomial
* CRC多项式编码
* @param init CRC initialize value
* CRC初始值
* @param xorOut CRC XOR out value
* CRC输出值异或运算
* @param refIn CRC reverse input data bytes
* CRC反转输入字节数组
* @param refOut CRC reverse output data bytes
* CRC反转输出字节数组
*/
public CRCConfig(int bit, long polynomial, long init, long xorOut, boolean refIn, boolean refOut) {
this.bit = bit;
this.polynomial = polynomial;
this.init = init;
this.xorOut = xorOut;
this.outLength = (bit % 4 != 0) ? ((bit / 4) + 1) : (bit / 4);
this.refIn = refIn;
this.refOut = refOut;
}
/**
* Getter method for CRC bit
* CRC比特位的Getter方法
*
* @return CRC bit
* CRC比特位
*/
public int getBit() {
return bit;
}
/**
* Getter method for CRC polynomial
* CRC多项式编码的Getter方法
*
* @return CRC polynomial
* CRC多项式编码
*/
public long getPolynomial() {
return polynomial;
}
/**
* Getter method for CRC initialize value
* CRC初始值的Getter方法
*
* @return CRC initialize value
* CRC初始值
*/
public long getInit() {
return init;
}
/**
* Getter method for CRC XOR out value
* CRC输出值异或运算的Getter方法
*
* @return CRC XOR out value
* CRC输出值异或运算
*/
public long getXorOut() {
return xorOut;
}
/**
* Getter method for CRC output data length
* CRC输出数据长度的Getter方法
*
* @return CRC output data length
* CRC输出数据长度
*/
public int getOutLength() {
return outLength;
}
/**
* Getter method for CRC reverse input data bytes
* CRC反转输入字节数组的Getter方法
*
* @return CRC reverse input data bytes
* CRC反转输入字节数组
*/
public boolean isRefIn() {
return refIn;
}
/**
* Getter method for CRC reverse output data bytes
* CRC反转输出字节数组的Getter方法
*
* @return CRC reverse output data bytes
* CRC反转输出字节数组
*/
public boolean isRefOut() {
return refOut;
}
}