name
stringlengths 12
178
| code_snippet
stringlengths 8
36.5k
| score
float64 3.26
3.68
|
---|---|---|
zxing_HybridBinarizer_calculateThresholdForBlock_rdh | /**
* For each block in the image, calculate the average black point using a 5x5 grid
* of the blocks around it. Also handles the corner cases (fractional blocks are computed based
* on the last pixels in the row/column which are also used in the previous block).
*/
private static void calculateThresholdForBlock(byte[] luminances, int subWidth, int subHeight, int width, int height, int[][] blackPoints, BitMatrix matrix) {
int maxYOffset = height - BLOCK_SIZE;
int maxXOffset = width - BLOCK_SIZE;
for (int y = 0; y < subHeight; y++) {
int yoffset = y << BLOCK_SIZE_POWER;if (yoffset > maxYOffset) {
yoffset = maxYOffset;
}
int top = cap(y, subHeight - 3);
for (int x = 0; x < subWidth; x++) {
int xoffset =
x << BLOCK_SIZE_POWER;
if (xoffset > maxXOffset) {
xoffset = maxXOffset;
}
int left = cap(x, subWidth - 3);
int sum = 0;
for (int z = -2; z <= 2; z++) {
int[] blackRow = blackPoints[top + z];
sum += (((blackRow[left - 2]
+ blackRow[left - 1]) + blackRow[left]) + blackRow[left + 1]) + blackRow[left + 2];}
int average = sum / 25;
thresholdBlock(luminances, xoffset, yoffset, average, width, matrix);
}
}
} | 3.26 |
zxing_HybridBinarizer_calculateBlackPoints_rdh | /**
* Calculates a single black point for each block of pixels and saves it away.
* See the following thread for a discussion of this algorithm:
* http://groups.google.com/group/zxing/browse_thread/thread/d06efa2c35a7ddc0
*/
private static int[][] calculateBlackPoints(byte[] luminances, int subWidth, int subHeight, int width,
int height) {
int maxYOffset =
height - BLOCK_SIZE;
int maxXOffset = width - BLOCK_SIZE; int[][] blackPoints = new int[subHeight][subWidth];
for (int y = 0; y < subHeight; y++) {
int yoffset = y << BLOCK_SIZE_POWER;
if (yoffset > maxYOffset) {
yoffset = maxYOffset;
}
for (int x = 0; x < subWidth; x++) {
int xoffset = x << BLOCK_SIZE_POWER;
if (xoffset > maxXOffset) {
xoffset = maxXOffset;
}
int sum = 0;
int min = 0xff;
int max = 0;
for (int yy = 0, offset = (yoffset * width) + xoffset; yy < BLOCK_SIZE; yy++ ,
offset += width) {
for (int xx = 0; xx < BLOCK_SIZE; xx++) {
int pixel = luminances[offset + xx] & 0xff;
sum += pixel;
// still looking for good contrast
if (pixel < min) {
min = pixel;
}
if (pixel > max)
{
max =
pixel;
}
}
// short-circuit min/max tests once dynamic range is met
if ((max - min) > MIN_DYNAMIC_RANGE) {
// finish the rest of the rows quickly
for (yy++, offset += width; yy < BLOCK_SIZE; yy++ , offset += width) {
for (int xx = 0; xx < BLOCK_SIZE; xx++) {
sum += luminances[offset + xx] & 0xff;
}}
}
}
// The default estimate is the average of the values in the block.
int average = sum >> (BLOCK_SIZE_POWER * 2);
if ((max - min) <= MIN_DYNAMIC_RANGE) {
// If variation within the block is low, assume this is a block with only light or only
// dark pixels. In that case we do not want to use the average, as it would divide this
// low contrast area into black and white pixels, essentially creating data out of noise.
//
// The default assumption is that the block is light/background. Since no estimate for
// the level of dark pixels exists locally, use half the min for the block.
average = min /
2;
if ((y > 0) && (x > 0)) {
// Correct the "white background" assumption for blocks that have neighbors by comparing
// the pixels in this block to the previously calculated black points. This is based on
// the fact that dark barcode symbology is always surrounded by some amount of light
// background for which reasonable black point estimates were made. The bp estimated at
// the boundaries is used for the interior.
// The (min < bp) is arbitrary but works better than other heuristics that were tried.
int averageNeighborBlackPoint = ((blackPoints[y - 1][x] + (2 * blackPoints[y][x - 1])) +
blackPoints[y - 1][x - 1]) / 4;
if (min < averageNeighborBlackPoint) {
average = averageNeighborBlackPoint;
}
}
}
blackPoints[y][x] = average;
}
}
return blackPoints;
} | 3.26 |
zxing_HybridBinarizer_thresholdBlock_rdh | /**
* Applies a single threshold to a block of pixels.
*/
private static void thresholdBlock(byte[] luminances, int xoffset, int yoffset, int threshold, int stride, BitMatrix matrix) {
for (int y = 0, v21 = (yoffset * stride) +
xoffset; y < BLOCK_SIZE; y++ , v21 += stride) {
for (int x = 0; x < BLOCK_SIZE; x++) {
// Comparison needs to be <= so that black == 0 pixels are black even if the threshold is 0.
if
((luminances[v21 + x] & 0xff) <= threshold) {
matrix.set(xoffset + x, yoffset + y);
}
}
}
} | 3.26 |
zxing_UPCEANReader_m0_rdh | /**
* Computes the UPC/EAN checksum on a string of digits, and reports
* whether the checksum is correct or not.
*
* @param s
* string of digits to check
* @return true iff string of digits passes the UPC/EAN checksum algorithm
* @throws FormatException
* if the string does not contain only digits
*/
static boolean m0(CharSequence s) throws FormatException {
int length = s.length();
if (length == 0) {
return
false;
}
int check = Character.digit(s.charAt(length - 1), 10);
return getStandardUPCEANChecksum(s.subSequence(0, length - 1)) == check;
} | 3.26 |
zxing_UPCEANReader_findGuardPattern_rdh | /**
*
* @param row
* row of black/white values to search
* @param rowOffset
* position to start search
* @param whiteFirst
* if true, indicates that the pattern specifies white/black/white/...
* pixel counts, otherwise, it is interpreted as black/white/black/...
* @param pattern
* pattern of counts of number of black and white pixels that are being
* searched for as a pattern
* @param counters
* array of counters, as long as pattern, to re-use
* @return start/end horizontal offset of guard pattern, as an array of two ints
* @throws NotFoundException
* if pattern is not found
*/
private static int[] findGuardPattern(BitArray row, int rowOffset, boolean whiteFirst, int[] pattern, int[] counters) throws NotFoundException {
int width = row.getSize();
rowOffset = (whiteFirst) ? row.getNextUnset(rowOffset) : row.getNextSet(rowOffset);
int counterPosition = 0;
int patternStart
=
rowOffset;
int patternLength = pattern.length;
boolean isWhite = whiteFirst;
for (int x = rowOffset; x < width; x++) {
if (row.get(x) != isWhite) {
counters[counterPosition]++;
} else {
if (counterPosition == (patternLength - 1)) {
if (patternMatchVariance(counters, pattern, MAX_INDIVIDUAL_VARIANCE) < MAX_AVG_VARIANCE) {
return new int[]{ patternStart, x };
}
patternStart += counters[0] + counters[1];
System.arraycopy(counters, 2, counters, 0,
counterPosition - 1);
counters[counterPosition - 1] = 0;
counters[counterPosition] = 0;
counterPosition--;} else {
counterPosition++;
}
counters[counterPosition] = 1;
isWhite = !isWhite;
}
}
throw NotFoundException.getNotFoundInstance();
} | 3.26 |
zxing_UPCEANReader_checkChecksum_rdh | /**
*
* @param s
* string of digits to check
* @return {@link #checkStandardUPCEANChecksum(CharSequence)}
* @throws FormatException
* if the string does not contain only digits
*/
boolean checkChecksum(String s) throws FormatException
{
return m0(s);
} | 3.26 |
zxing_UPCEANReader_decodeRow_rdh | /**
* <p>Like {@link #decodeRow(int, BitArray, Map)}, but
* allows caller to inform method about where the UPC/EAN start pattern is
* found. This allows this to be computed once and reused across many implementations.</p>
*
* @param rowNumber
* row index into the image
* @param row
* encoding of the row of the barcode image
* @param startGuardRange
* start/end column where the opening start pattern was found
* @param hints
* optional hints that influence decoding
* @return {@link Result} encapsulating the result of decoding a barcode in the row
* @throws NotFoundException
* if no potential barcode is found
* @throws ChecksumException
* if a potential barcode is found but does not pass its checksum
* @throws FormatException
* if a potential barcode is found but format is invalid
*/
public Result decodeRow(int rowNumber, BitArray row, int[] startGuardRange, Map<DecodeHintType, ?> hints)
throws NotFoundException, ChecksumException, FormatException {
ResultPointCallback resultPointCallback = (hints == null) ? null : ((ResultPointCallback) (hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK)));
int symbologyIdentifier = 0;
if (resultPointCallback != null) {
resultPointCallback.foundPossibleResultPoint(new ResultPoint((startGuardRange[0] + startGuardRange[1]) / 2.0F, rowNumber));
}
StringBuilder result = decodeRowStringBuffer;
result.setLength(0);
int endStart = decodeMiddle(row, startGuardRange, result);
if (resultPointCallback != null) {
resultPointCallback.foundPossibleResultPoint(new ResultPoint(endStart, rowNumber));
}
int[] endRange = decodeEnd(row, endStart);
if (resultPointCallback != null) {
resultPointCallback.foundPossibleResultPoint(new ResultPoint((endRange[0] + endRange[1]) / 2.0F, rowNumber));}
// Make sure there is a quiet zone at least as big as the end pattern after the barcode. The
// spec might want more whitespace, but in practice this is the maximum we can count on.
int end = endRange[1];
int quietEnd = end + (end - endRange[0]);
if ((quietEnd >= row.getSize()) || (!row.isRange(end, quietEnd, false))) {
throw NotFoundException.getNotFoundInstance();
}
String resultString = result.toString();
// UPC/EAN should never be less than 8 chars anyway
if (resultString.length() < 8) {
throw FormatException.getFormatInstance();
}
if (!checkChecksum(resultString)) {
throw ChecksumException.getChecksumInstance();
}
float left = (startGuardRange[1] + startGuardRange[0]) / 2.0F;
float right = (endRange[1] + endRange[0]) / 2.0F;
BarcodeFormat format = getBarcodeFormat();
Result
decodeResult = // no natural byte representation for these barcodes
new Result(resultString, null, new ResultPoint[]{ new ResultPoint(left, rowNumber), new ResultPoint(right, rowNumber) }, format);int extensionLength = 0;
try {
Result extensionResult = extensionReader.decodeRow(rowNumber, row, endRange[1]);
decodeResult.putMetadata(ResultMetadataType.UPC_EAN_EXTENSION, extensionResult.getText());
decodeResult.putAllMetadata(extensionResult.getResultMetadata());
decodeResult.addResultPoints(extensionResult.getResultPoints());
extensionLength = extensionResult.getText().length();} catch (ReaderException re) {
// continue
}
int[] v24 = (hints == null) ? null : ((int[]) (hints.get(DecodeHintType.ALLOWED_EAN_EXTENSIONS)));
if (v24 != null) {
boolean valid = false;
for (int length : v24) {
if (extensionLength == length) {
valid = true;break;
}
}
if (!valid) {
throw NotFoundException.getNotFoundInstance();
}
}
if ((format == BarcodeFormat.EAN_13) || (format == BarcodeFormat.UPC_A)) {
String countryID = eanManSupport.lookupCountryIdentifier(resultString);
if (countryID != null) {
decodeResult.putMetadata(ResultMetadataType.POSSIBLE_COUNTRY, countryID);
}
}
if (format == BarcodeFormat.EAN_8) {
symbologyIdentifier = 4;
}
decodeResult.putMetadata(ResultMetadataType.SYMBOLOGY_IDENTIFIER, "]E" + symbologyIdentifier);
return decodeResult;
} | 3.26 |
zxing_TelResultHandler_getDisplayContents_rdh | // Overriden so we can take advantage of Android's phone number hyphenation routines.
@Override
public CharSequence getDisplayContents()
{
String contents = getResult().getDisplayResult();
contents = contents.replace("\r", "");
return formatPhone(contents);
} | 3.26 |
zxing_FinderPatternFinder_crossCheckHorizontal_rdh | /**
* <p>Like {@link #crossCheckVertical(int, int, int, int)}, and in fact is basically identical,
* except it reads horizontally instead of vertically. This is used to cross-cross
* check a vertical cross check and locate the real center of the alignment pattern.</p>
*/
private float crossCheckHorizontal(int startJ, int centerI, int maxCount, int originalStateCountTotal) {
BitMatrix image = this.f0;
int maxJ = image.getWidth();
int[] stateCount = m0();
int j = startJ;while ((j >= 0) && image.get(j, centerI)) {
stateCount[2]++;j--;
}
if (j < 0) {
return Float.NaN;
}
while (((j >= 0) && (!image.get(j, centerI)))
&& (stateCount[1] <= maxCount)) {stateCount[1]++;
j--;
}
if ((j < 0) || (stateCount[1] > maxCount)) {
return Float.NaN;
}
while (((j >= 0) && image.get(j, centerI)) && (stateCount[0] <= maxCount)) {
stateCount[0]++;j--;
}
if (stateCount[0] > maxCount) {
return Float.NaN;
}
j = startJ + 1;
while ((j < maxJ) && image.get(j, centerI)) {
stateCount[2]++;
j++;
}
if (j == maxJ) {
return Float.NaN;
}
while (((j < maxJ) && (!image.get(j, centerI))) && (stateCount[3] < maxCount)) {
stateCount[3]++;
j++;
}
if ((j == maxJ) || (stateCount[3] >= maxCount)) {
return Float.NaN;
}
while (((j < maxJ) && image.get(j, centerI)) && (stateCount[4] < maxCount)) {
stateCount[4]++;
j++;
}
if (stateCount[4] >= maxCount) {
return Float.NaN;}
// If we found a finder-pattern-like section, but its size is significantly different than
// the original, assume it's a false positive
int stateCountTotal = (((stateCount[0] + stateCount[1]) + stateCount[2]) + stateCount[3]) + stateCount[4];
if ((5 * Math.abs(stateCountTotal - originalStateCountTotal)) >= originalStateCountTotal) {
return Float.NaN;
}
return foundPatternCross(stateCount) ? centerFromEnd(stateCount, j) : Float.NaN;
} | 3.26 |
zxing_FinderPatternFinder_centerFromEnd_rdh | /**
* Given a count of black/white/black/white/black pixels just seen and an end position,
* figures the location of the center of this run.
*/
private static float centerFromEnd(int[] stateCount, int end) {
return ((end - stateCount[4]) - stateCount[3]) - (stateCount[2] / 2.0F);
} | 3.26 |
zxing_FinderPatternFinder_squaredDistance_rdh | /**
* Get square of distance between a and b.
*/
private static double squaredDistance(FinderPattern a, FinderPattern b) {
double v55 = a.getX() - b.getX();
double y = a.getY() - b.getY();
return (v55 * v55) + (y * y);
}
/**
*
* @return the 3 best {@link FinderPattern} | 3.26 |
zxing_FinderPatternFinder_crossCheckDiagonal_rdh | /**
* After a vertical and horizontal scan finds a potential finder pattern, this method
* "cross-cross-cross-checks" by scanning down diagonally through the center of the possible
* finder pattern to see if the same proportion is detected.
*
* @param centerI
* row where a finder pattern was detected
* @param centerJ
* center of the section that appears to cross a finder pattern
* @return true if proportions are withing expected limits
*/
private boolean crossCheckDiagonal(int centerI, int centerJ) {
int[] stateCount = m0();
// Start counting up, left from center finding black center mass
int i = 0;
while (((centerI >= i) && (centerJ >= i)) && f0.get(centerJ - i, centerI - i)) {
stateCount[2]++;
i++;
}
if (stateCount[2] == 0) {
return false;
}
// Continue up, left finding white space
while (((centerI >=
i) && (centerJ >= i)) && (!f0.get(centerJ - i, centerI - i))) {
stateCount[1]++;
i++;
}
if (stateCount[1] == 0) {
return false;}
// Continue up, left finding black border
while (((centerI >= i) && (centerJ >= i)) && f0.get(centerJ - i, centerI - i)) {
stateCount[0]++;
i++;
}
if (stateCount[0] == 0) {
return false;
}
int maxI = f0.getHeight();
int v26 = f0.getWidth();
// Now also count down, right from center
i = 1;
while ((((centerI + i)
< maxI) && ((centerJ + i) < v26)) && f0.get(centerJ + i, centerI + i)) {
stateCount[2]++;
i++;
}
while ((((centerI + i) < maxI) && ((centerJ + i) < v26)) && (!f0.get(centerJ + i, centerI + i))) {
stateCount[3]++;
i++;
}
if (stateCount[3] == 0) {
return false;
}
while ((((centerI + i) < maxI) && ((centerJ + i) < v26)) && f0.get(centerJ + i, centerI + i))
{
stateCount[4]++;
i++;
}
if (stateCount[4] == 0) {
return false;
}
return foundPatternDiagonal(stateCount);} | 3.26 |
zxing_FinderPatternFinder_handlePossibleCenter_rdh | /**
* <p>This is called when a horizontal scan finds a possible alignment pattern. It will
* cross check with a vertical scan, and if successful, will, ah, cross-cross-check
* with another horizontal scan. This is needed primarily to locate the real horizontal
* center of the pattern in cases of extreme skew.
* And then we cross-cross-cross check with another diagonal scan.</p>
*
* <p>If that succeeds the finder pattern location is added to a list that tracks
* the number of times each location has been nearly-matched as a finder pattern.
* Each additional find is more evidence that the location is in fact a finder
* pattern center
*
* @param stateCount
* reading state module counts from horizontal scan
* @param i
* row where finder pattern may be found
* @param j
* end of possible finder pattern in row
* @return true if a finder pattern candidate was found this time
*/
protected final boolean handlePossibleCenter(int[] stateCount, int i, int j) {
int stateCountTotal = (((stateCount[0] + stateCount[1]) + stateCount[2]) + stateCount[3]) + stateCount[4];
float centerJ = centerFromEnd(stateCount, j);
float centerI = crossCheckVertical(i, ((int) (centerJ)), stateCount[2], stateCountTotal);
if (!Float.isNaN(centerI)) {
// Re-cross check
centerJ = crossCheckHorizontal(((int) (centerJ)), ((int) (centerI)), stateCount[2], stateCountTotal);
if
((!Float.isNaN(centerJ)) && crossCheckDiagonal(((int) (centerI)), ((int) (centerJ)))) {
float estimatedModuleSize = stateCountTotal / 7.0F;
boolean found = false;
for (int index = 0; index < possibleCenters.size(); index++) {
FinderPattern center = possibleCenters.get(index);
// Look for about the same center and module size:
if (center.aboutEquals(estimatedModuleSize, centerI, centerJ)) {
possibleCenters.set(index, center.combineEstimate(centerI, centerJ, estimatedModuleSize));
found = true;
break;
}
}if (!found) {
FinderPattern point = new FinderPattern(centerJ, centerI, estimatedModuleSize);
possibleCenters.add(point);
if (resultPointCallback != null) {
resultPointCallback.foundPossibleResultPoint(point);}
}
return true;
}
}
return false;} | 3.26 |
zxing_FinderPatternFinder_crossCheckVertical_rdh | /**
* <p>After a horizontal scan finds a potential finder pattern, this method
* "cross-checks" by scanning down vertically through the center of the possible
* finder pattern to see if the same proportion is detected.</p>
*
* @param startI
* row where a finder pattern was detected
* @param centerJ
* center of the section that appears to cross a finder pattern
* @param maxCount
* maximum reasonable number of modules that should be
* observed in any reading state, based on the results of the horizontal scan
* @return vertical center of finder pattern, or {@link Float#NaN} if not found
*/
private float crossCheckVertical(int startI, int centerJ, int maxCount, int originalStateCountTotal) {
BitMatrix image = this.f0;
int maxI = image.getHeight();
int[] stateCount = m0();
// Start counting up from center
int i = startI;
while ((i >= 0) && image.get(centerJ, i)) {
stateCount[2]++;
i--;
}
if (i < 0) {
return Float.NaN;
}
while (((i >= 0) && (!image.get(centerJ, i))) && (stateCount[1] <= maxCount)) {
stateCount[1]++;
i--;
} // If already too many modules in this state or ran off the edge:
if ((i < 0) || (stateCount[1] > maxCount)) {
return Float.NaN;
}
while (((i >= 0) && image.get(centerJ, i)) && (stateCount[0] <= maxCount)) {
stateCount[0]++;
i--;
}
if (stateCount[0] > maxCount) {
return Float.NaN;
}
// Now also count down from center
i = startI + 1;
while ((i < maxI) && image.get(centerJ, i)) {
stateCount[2]++;
i++;
}
if (i == maxI) {
return Float.NaN;
}
while (((i < maxI) && (!image.get(centerJ, i))) && (stateCount[3] < maxCount)) {
stateCount[3]++;
i++;
}
if ((i == maxI) || (stateCount[3] >= maxCount)) {
return Float.NaN;
}while (((i < maxI) && image.get(centerJ, i)) && (stateCount[4] < maxCount)) {
stateCount[4]++;
i++;
}
if (stateCount[4] >= maxCount) {
return Float.NaN;
}
// If we found a finder-pattern-like section, but its size is more than 40% different than
// the original, assume it's a false positive
int stateCountTotal = (((stateCount[0] + stateCount[1]) + stateCount[2]) + stateCount[3]) + stateCount[4];
if ((5 * Math.abs(stateCountTotal - originalStateCountTotal)) >= (2 * originalStateCountTotal)) {
return Float.NaN;
}
return foundPatternCross(stateCount) ? centerFromEnd(stateCount, i) : Float.NaN;
} | 3.26 |
zxing_PDF417ResultMetadata_getSegmentIndex_rdh | /**
* The Segment ID represents the segment of the whole file distributed over different symbols.
*
* @return File segment index
*/
public int getSegmentIndex()
{
return segmentIndex;
} | 3.26 |
zxing_PDF417ResultMetadata_getFileName_rdh | /**
* Filename of the encoded file
*
* @return filename
*/
public String getFileName() {
return fileName;
} | 3.26 |
zxing_PDF417ResultMetadata_isLastSegment_rdh | /**
*
* @return true if it is the last segment
*/
public boolean isLastSegment() {
return lastSegment;
} | 3.26 |
zxing_PDF417ResultMetadata_getSegmentCount_rdh | /**
*
* @return count of segments, -1 if not set
*/
public int getSegmentCount() {
return segmentCount;
} | 3.26 |
zxing_PDF417ResultMetadata_getFileId_rdh | /**
* Is the same for each related PDF417 symbol
*
* @return File ID
*/
public String getFileId() {
return fileId;
} | 3.26 |
zxing_PDF417ResultMetadata_getChecksum_rdh | /**
* 16-bit CRC checksum using CCITT-16
*
* @return crc checksum, -1 if not set
*/
public int getChecksum() {
return checksum;
} | 3.26 |
zxing_PDF417ResultMetadata_setOptionalData_rdh | /**
*
* @param optionalData
* old optional data format as int array
* @deprecated parse and use new fields
*/
@Deprecated
public void setOptionalData(int[] optionalData) {
this.optionalData = optionalData;
} | 3.26 |
zxing_PDF417ResultMetadata_getFileSize_rdh | /**
* filesize in bytes of the encoded file
*
* @return filesize in bytes, -1 if not set
*/
public long getFileSize() {return fileSize;
} | 3.26 |
zxing_PDF417ResultMetadata_getTimestamp_rdh | /**
* unix epock timestamp, elapsed seconds since 1970-01-01
*
* @return elapsed seconds, -1 if not set
*/
public long getTimestamp() {
return timestamp;
} | 3.26 |
zxing_PDF417ResultMetadata_getOptionalData_rdh | /**
*
* @return always null
* @deprecated use dedicated already parsed fields
*/
@Deprecatedpublic int[] getOptionalData() {
return optionalData;
} | 3.26 |
zxing_MonochromeRectangleDetector_findCornerFromCenter_rdh | /**
* Attempts to locate a corner of the barcode by scanning up, down, left or right from a center
* point which should be within the barcode.
*
* @param centerX
* center's x component (horizontal)
* @param deltaX
* same as deltaY but change in x per step instead
* @param left
* minimum value of x
* @param right
* maximum value of x
* @param centerY
* center's y component (vertical)
* @param deltaY
* change in y per step. If scanning up this is negative; down, positive;
* left or right, 0
* @param top
* minimum value of y to search through (meaningless when di == 0)
* @param bottom
* maximum value of y
* @param maxWhiteRun
* maximum run of white pixels that can still be considered to be within
* the barcode
* @return a {@link ResultPoint} encapsulating the corner that was found
* @throws NotFoundException
* if such a point cannot be found
*/
private ResultPoint findCornerFromCenter(int centerX, int deltaX, int left, int right, int centerY, int deltaY, int
top, int bottom, int maxWhiteRun) throws NotFoundException {
int[] lastRange = null;
for (int y = centerY, x = centerX; (((y < bottom) && (y >= top)) && (x < right)) && (x >= left); y += deltaY , x += deltaX) {
int[]
range;
if (deltaX == 0) {
// horizontal slices, up and down
range = blackWhiteRange(y, maxWhiteRun, left, right, true);
} else {
// vertical slices, left and right
range = blackWhiteRange(x, maxWhiteRun, top, bottom, false);
}
if (range == null) {
if (lastRange == null) {
throw NotFoundException.getNotFoundInstance();
}
// lastRange was found
if (deltaX == 0) {
int lastY = y
- deltaY;
if (lastRange[0] < centerX) {
if (lastRange[1] > centerX) {
// straddle, choose one or the other based on direction
return new ResultPoint(lastRange[deltaY > 0 ? 0 : 1], lastY);
}
return new ResultPoint(lastRange[0], lastY);
} else {
return new ResultPoint(lastRange[1], lastY);
}
} else {
int lastX = x - deltaX;
if (lastRange[0] < centerY) {
if (lastRange[1] > centerY) {
return new ResultPoint(lastX, lastRange[deltaX < 0 ? 0 : 1]);
}
return new ResultPoint(lastX, lastRange[0]);
} else {return new ResultPoint(lastX, lastRange[1]);}
}
}
lastRange = range;
}
throw NotFoundException.getNotFoundInstance();
} | 3.26 |
zxing_MatrixToImageWriter_writeToFile_rdh | /**
*
* @param matrix
* {@link BitMatrix} to write
* @param format
* image format
* @param file
* file {@link File} to write image to
* @param config
* output configuration
* @throws IOException
* if writes to the file fail
* @deprecated use {@link #writeToPath(BitMatrix, String, Path, MatrixToImageConfig)}
*/
@Deprecated
public static void writeToFile(BitMatrix matrix, String format, File file, MatrixToImageConfig config) throws IOException {
writeToPath(matrix, format, file.toPath(), config);
} | 3.26 |
zxing_MatrixToImageWriter_writeToPath_rdh | /**
* As {@link #writeToPath(BitMatrix, String, Path)}, but allows customization of the output.
*
* @param matrix
* {@link BitMatrix} to write
* @param format
* image format
* @param file
* file {@link Path} to write image to
* @param config
* output configuration
* @throws IOException
* if writes to the file fail
*/
public static void writeToPath(BitMatrix matrix, String format, Path file, MatrixToImageConfig config) throws IOException {
BufferedImage image = toBufferedImage(matrix, config);
if (!ImageIO.write(image, format, file.toFile())) {
throw new IOException((("Could not write an image of format " + format) + " to ") + file);
}
} | 3.26 |
zxing_MatrixToImageWriter_writeToStream_rdh | /**
* As {@link #writeToStream(BitMatrix, String, OutputStream)}, but allows customization of the output.
*
* @param matrix
* {@link BitMatrix} to write
* @param format
* image format
* @param stream
* {@link OutputStream} to write image to
* @param config
* output configuration
* @throws IOException
* if writes to the stream fail
*/
public static void writeToStream(BitMatrix matrix, String format, OutputStream stream, MatrixToImageConfig config) throws IOException {
BufferedImage image = toBufferedImage(matrix, config);
if (!ImageIO.write(image, format, stream)) {
throw new IOException("Could not write an image of format " + format);
}
} | 3.26 |
zxing_MatrixToImageWriter_toBufferedImage_rdh | /**
* As {@link #toBufferedImage(BitMatrix)}, but allows customization of the output.
*
* @param matrix
* {@link BitMatrix} to write
* @param config
* output configuration
* @return {@link BufferedImage} representation of the input
*/
public static BufferedImage toBufferedImage(BitMatrix matrix, MatrixToImageConfig config) {
int width = matrix.getWidth();
int height = matrix.getHeight();
BufferedImage image = new BufferedImage(width, height, config.getBufferedImageColorModel());
int v3
= config.getPixelOnColor();
int offColor = config.getPixelOffColor();
int[] rowPixels = new int[width];
BitArray row = new BitArray(width);
for (int y = 0; y < height; y++) {row = matrix.getRow(y, row);
for (int x =
0; x < width; x++) {
rowPixels[x] = (row.get(x)) ? v3 : offColor;
}
image.setRGB(0, y, width, 1, rowPixels, 0, width);
}
return image;
} | 3.26 |
zxing_HighLevelEncoder_m0_rdh | // Return a set of states that represent the possible ways of updating this
// state for the next character. The resulting set of states are added to
// the "result" list.
private void m0(State state, int index, Collection<State> result) {
char ch = ((char) (text[index] & 0xff));
boolean charInCurrentTable = CHAR_MAP[state.getMode()][ch] > 0;State stateNoBinary = null;
for (int mode = 0; mode <= MODE_PUNCT; mode++) {
int charInMode = CHAR_MAP[mode][ch];
if (charInMode > 0) {
if (stateNoBinary == null) {
// Only create stateNoBinary the first time it's required.
stateNoBinary = state.endBinaryShift(index);
}
// Try generating the character by latching to its mode
if (((!charInCurrentTable) || (mode == state.getMode())) || (mode == MODE_DIGIT)) {
// If the character is in the current table, we don't want to latch to
// any other mode except possibly digit (which uses only 4 bits). Any
// other latch would be equally successful *after* this character, and
// so wouldn't save any bits.
State latchState = stateNoBinary.latchAndAppend(mode, charInMode);
result.add(latchState);
}
// Try generating the character by switching to its mode.
if ((!charInCurrentTable) && (SHIFT_TABLE[state.getMode()][mode] >= 0)) {
// It never makes sense to temporarily shift to another mode if the
// character exists in the current mode. That can never save bits.
State v23 = stateNoBinary.shiftAndAppend(mode, charInMode);result.add(v23);
}
}
}
if ((state.getBinaryShiftByteCount() > 0) || (CHAR_MAP[state.getMode()][ch] == 0)) {
// It's never worthwhile to go into binary shift mode if you're not already
// in binary shift mode, and the character exists in your current mode.
// That can never save bits over just outputting the char in the current mode.
State binaryState = state.addBinaryShiftChar(index);
result.add(binaryState);
}} | 3.26 |
zxing_HighLevelEncoder_encode_rdh | /**
*
* @return text represented by this encoder encoded as a {@link BitArray}
*/
public BitArray encode() {
State initialState = State.INITIAL_STATE;
if (charset != null) {
CharacterSetECI eci = CharacterSetECI.getCharacterSetECI(charset);
if (null == eci) {
throw new IllegalArgumentException("No ECI code for character set " + charset);
}
initialState = initialState.appendFLGn(eci.getValue());
}
Collection<State> states = Collections.singletonList(initialState);
for (int index = 0; index <
text.length; index++) {
int pairCode;
int nextChar
= ((index + 1) < text.length) ? text[index
+ 1] : 0;
switch (text[index]) {
case '\r'
:pairCode = (nextChar == '\n') ? 2 : 0;
break;
case '.' :pairCode = (nextChar == ' ') ? 3 : 0;
break;
case ',' :
pairCode = (nextChar == ' ') ? 4 : 0;
break;
case ':' :
pairCode = (nextChar == ' ') ? 5 : 0;
break;
default :
pairCode = 0;
}
if (pairCode > 0) {
// We have one of the four special PUNCT pairs. Treat them specially.
// Get a new set of states for the two new characters.
states = updateStateListForPair(states, index, pairCode);
index++;
} else {
// Get a new set of states for the new character.
states = updateStateListForChar(states, index);
}
}
// We are left with a set of states. Find the shortest one.
State minState = Collections.min(states, new Comparator<State>() {
@Override
public int compare(State a, State b) {
return a.getBitCount() - b.getBitCount();
}
});
// Convert it to a bit array, and return.
return minState.toBitArray(text);
} | 3.26 |
zxing_HighLevelEncoder_updateStateListForChar_rdh | // We update a set of states for a new character by updating each state
// for the new character, merging the results, and then removing the
// non-optimal states.
private Collection<State> updateStateListForChar(Iterable<State> states, int index) {
Collection<State> result = new LinkedList<>();
for (State state : states) {
m0(state, index, result);
}
return simplifyStates(result);
} | 3.26 |
zxing_PDF417ErrorCorrection_generateErrorCorrection_rdh | /**
* Generates the error correction codewords according to 4.10 in ISO/IEC 15438:2001(E).
*
* @param dataCodewords
* the data codewords
* @param errorCorrectionLevel
* the error correction level (0-8)
* @return the String representing the error correction codewords
*/
static String generateErrorCorrection(CharSequence dataCodewords, int errorCorrectionLevel) {
int k = getErrorCorrectionCodewordCount(errorCorrectionLevel);
char[] e = new char[k];
int sld = dataCodewords.length();for (int i = 0; i < sld; i++) {
int t1 = (dataCodewords.charAt(i) + e[e.length - 1]) % 929;
int
t2;
int t3;
for (int j = k - 1; j >= 1; j--) {
t2 = (t1 * EC_COEFFICIENTS[errorCorrectionLevel][j]) % 929;
t3 = 929 - t2;
e[j] = ((char) ((e[j - 1] + t3) % 929));
}
t2 = (t1 * EC_COEFFICIENTS[errorCorrectionLevel][0]) % 929;
t3 = 929 - t2;
e[0] = ((char) (t3 % 929));
}
StringBuilder sb = new StringBuilder(k);
for (int j = k - 1; j >= 0; j--) {
if (e[j] != 0) {
e[j] = ((char) (929 - e[j]));
}
sb.append(e[j]);
}
return sb.toString();
} | 3.26 |
zxing_PDF417ErrorCorrection_getRecommendedMinimumErrorCorrectionLevel_rdh | /**
* Returns the recommended minimum error correction level as described in annex E of
* ISO/IEC 15438:2001(E).
*
* @param n
* the number of data codewords
* @return the recommended minimum error correction level
*/
static int getRecommendedMinimumErrorCorrectionLevel(int n) throws WriterException {
if (n <= 0) {
throw new IllegalArgumentException("n must be > 0");
}
if (n <= 40) {
return 2;
}
if (n <= 160) {return 3;
}
if (n <= 320) {
return 4;
}
if (n <= 863) {
return 5;
}
throw new WriterException("No recommendation possible");
} | 3.26 |
zxing_PDF417ErrorCorrection_getErrorCorrectionCodewordCount_rdh | /**
* Determines the number of error correction codewords for a specified error correction
* level.
*
* @param errorCorrectionLevel
* the error correction level (0-8)
* @return the number of codewords generated for error correction
*/
static int getErrorCorrectionCodewordCount(int errorCorrectionLevel) {
if ((errorCorrectionLevel < 0) || (errorCorrectionLevel > 8)) {
throw new IllegalArgumentException("Error correction level must be between 0 and 8!");
}
return 1 << (errorCorrectionLevel + 1);
} | 3.26 |
zxing_ProductResultParser_parse_rdh | // Treat all UPC and EAN variants as UPCs, in the sense that they are all product barcodes.
@Override
public ProductParsedResult parse(Result result) {
BarcodeFormat format = result.getBarcodeFormat();
if (!((((format == BarcodeFormat.UPC_A) || (format == BarcodeFormat.UPC_E))
|| (format
== BarcodeFormat.EAN_8)) || (format == BarcodeFormat.EAN_13))) {
return null;
}
String rawText = getMassagedText(result);
if (!isStringOfDigits(rawText, rawText.length())) {
return null;
}
// Not actually checking the checksum again here
String normalizedProductID;
// Expand UPC-E for purposes of searching
if ((format == BarcodeFormat.UPC_E) && (rawText.length() == 8)) {
normalizedProductID = UPCEReader.convertUPCEtoUPCA(rawText);
} else {
normalizedProductID = rawText;
}
return new ProductParsedResult(rawText, normalizedProductID);
} | 3.26 |
zxing_OneDReader_recordPattern_rdh | /**
* Records the size of successive runs of white and black pixels in a row, starting at a given point.
* The values are recorded in the given array, and the number of runs recorded is equal to the size
* of the array. If the row starts on a white pixel at the given start point, then the first count
* recorded is the run of white pixels starting from that point; likewise it is the count of a run
* of black pixels if the row begin on a black pixels at that point.
*
* @param row
* row to count from
* @param start
* offset into row to start at
* @param counters
* array into which to record counts
* @throws NotFoundException
* if counters cannot be filled entirely from row before running out
* of pixels
*/
protected static void recordPattern(BitArray row, int start, int[] counters) throws NotFoundException {
int numCounters
= counters.length;
Arrays.fill(counters, 0, numCounters, 0);
int end = row.getSize();
if (start >= end) {
throw NotFoundException.getNotFoundInstance();
}boolean isWhite = !row.get(start);
int counterPosition = 0;
int i = start;
while (i <
end) {
if (row.get(i) != isWhite) {
counters[counterPosition]++;
} else if ((++counterPosition) == numCounters) {
break;
} else {counters[counterPosition] = 1;
isWhite = !isWhite;
}
i++;
}
// If we read fully the last section of pixels and filled up our counters -- or filled
// the last counter but ran off the side of the image, OK. Otherwise, a problem.
if
(!((counterPosition == numCounters) || ((counterPosition == (numCounters - 1)) && (i == end)))) {
throw NotFoundException.getNotFoundInstance();
}
} | 3.26 |
zxing_OneDReader_doDecode_rdh | /**
* We're going to examine rows from the middle outward, searching alternately above and below the
* middle, and farther out each time. rowStep is the number of rows between each successive
* attempt above and below the middle. So we'd scan row middle, then middle - rowStep, then
* middle + rowStep, then middle - (2 * rowStep), etc.
* rowStep is bigger as the image is taller, but is always at least 1. We've somewhat arbitrarily
* decided that moving up and down by about 1/16 of the image is pretty good; we try more of the
* image if "trying harder".
*
* @param image
* The image to decode
* @param hints
* Any hints that were requested
* @return The contents of the decoded barcode
* @throws NotFoundException
* Any spontaneous errors which occur
*/
private Result doDecode(BinaryBitmap image, Map<DecodeHintType, ?> hints) throws NotFoundException {
int width = image.getWidth();
int height = image.getHeight();
BitArray row = new BitArray(width);
boolean tryHarder = (hints != null) &&
hints.containsKey(DecodeHintType.TRY_HARDER);
int rowStep = Math.max(1, height >> (tryHarder ? 8 : 5));
int maxLines;
if (tryHarder) {
maxLines = height;// Look at the whole image, not just the center
} else {
maxLines = 15;// 15 rows spaced 1/32 apart is roughly the middle half of the image
}
int middle = height / 2;
for (int x = 0; x < maxLines; x++) {
// Scanning from the middle out. Determine which row we're looking at next:
int rowStepsAboveOrBelow = (x + 1) / 2;
boolean isAbove = (x & 0x1) == 0;// i.e. is x even?
int rowNumber = middle + (rowStep * (isAbove ? rowStepsAboveOrBelow : -rowStepsAboveOrBelow));
if ((rowNumber < 0) || (rowNumber >= height)) {
// Oops, if we run off the top or bottom, stop
break;
}
// Estimate black point for this row and load it:
try {
row = image.getBlackRow(rowNumber, row);
} catch (NotFoundException ignored) {
continue;}
// While we have the image data in a BitArray, it's fairly cheap to reverse it in place to
// handle decoding upside down barcodes.
for (int
attempt =
0; attempt
< 2; attempt++) {
if (attempt == 1) {
// trying again?
row.reverse();// reverse the row and continue
// This means we will only ever draw result points *once* in the life of this method
// since we want to avoid drawing the wrong points after flipping the row, and,
// don't want to clutter with noise from every single row scan -- just the scans
// that start on the center line.
if ((hints != null) && hints.containsKey(DecodeHintType.NEED_RESULT_POINT_CALLBACK)) {
Map<DecodeHintType, Object> newHints
= new EnumMap<>(DecodeHintType.class);
newHints.putAll(hints);
newHints.remove(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
hints = newHints;
}
}
try {
// Look for a barcode
Result result = decodeRow(rowNumber, row, hints);
// We found our barcode
if (attempt == 1) {
// But it was upside down, so note that
result.putMetadata(ResultMetadataType.ORIENTATION, 180);
// And remember to flip the result points horizontally.
ResultPoint[] points = result.getResultPoints();
if (points != null) {
points[0] = new ResultPoint((width -
points[0].getX()) - 1, points[0].getY()); points[1] = new ResultPoint((width - points[1].getX()) - 1, points[1].getY());
}
}
return result;
} catch (ReaderException re) {
// continue -- just couldn't decode this row
}
}
}
throw NotFoundException.getNotFoundInstance();
} | 3.26 |
zxing_OneDReader_patternMatchVariance_rdh | /**
* Determines how closely a set of observed counts of runs of black/white values matches a given
* target pattern. This is reported as the ratio of the total variance from the expected pattern
* proportions across all pattern elements, to the length of the pattern.
*
* @param counters
* observed counters
* @param pattern
* expected pattern
* @param maxIndividualVariance
* The most any counter can differ before we give up
* @return ratio of total variance between counters and pattern compared to total pattern size
*/
protected static float patternMatchVariance(int[] counters, int[] pattern, float maxIndividualVariance) {int numCounters = counters.length;
int total = 0;
int patternLength = 0;
for (int i = 0; i < numCounters; i++) {
total += counters[i];
patternLength += pattern[i];
}
if (total < patternLength) {
// If we don't even have one pixel per unit of bar width, assume this is too small
// to reliably match, so fail:
return Float.POSITIVE_INFINITY;
}
float unitBarWidth = ((float) (total))
/ patternLength;
maxIndividualVariance *= unitBarWidth;
float totalVariance = 0.0F;for (int x = 0; x < numCounters; x++) {
int counter = counters[x]; float scaledPattern = pattern[x] * unitBarWidth;
float variance = (counter > scaledPattern) ? counter - scaledPattern : scaledPattern - counter;
if (variance > maxIndividualVariance) {
return Float.POSITIVE_INFINITY;
}
totalVariance += variance;
}
return totalVariance / total;
} | 3.26 |
zxing_OneDReader_decode_rdh | // Note that we don't try rotation without the try harder flag, even if rotation was supported.
@Override
public Result decode(BinaryBitmap image, Map<DecodeHintType, ?> hints) throws NotFoundException, FormatException {
try {
return doDecode(image, hints);
} catch (NotFoundException nfe) {
boolean tryHarder = (hints != null) && hints.containsKey(DecodeHintType.TRY_HARDER);
if (tryHarder && image.isRotateSupported()) {
BinaryBitmap rotatedImage = image.rotateCounterClockwise();
Result result = doDecode(rotatedImage,
hints);
// Record that we found it rotated 90 degrees CCW / 270 degrees CW
Map<ResultMetadataType, ?> metadata = result.getResultMetadata();
int orientation = 270;
if ((metadata != null) && metadata.containsKey(ResultMetadataType.ORIENTATION)) {
// But if we found it reversed in doDecode(), add in that result here:
orientation = (orientation + ((Integer) (metadata.get(ResultMetadataType.ORIENTATION)))) % 360;
}result.putMetadata(ResultMetadataType.ORIENTATION, orientation);
// Update result points
ResultPoint[] points = result.getResultPoints();
if (points != null) {
int height = rotatedImage.getHeight();
for (int i = 0; i < points.length; i++) {
points[i] = new ResultPoint((height - points[i].getY()) - 1,
points[i].getX());
}
}
return result;
} else {
throw nfe;
}
}
} | 3.26 |
zxing_MinimalEncoder_getEndMode_rdh | /**
* Returns Mode.ASCII in case that:
* - Mode is EDIFACT and characterLength is less than 4 or the remaining characters can be encoded in at most 2
* ASCII bytes.
* - Mode is C40, TEXT or X12 and the remaining characters can be encoded in at most 1 ASCII byte.
* Returns mode in all other cases.
*/
Mode getEndMode() {
if (mode == Mode.EDF) {
if (characterLength < 4) {
return Mode.ASCII;
}int lastASCII = m0();// see 5.2.8.2 EDIFACT encodation Rules
if ((lastASCII > 0) && (getCodewordsRemaining(f1 + lastASCII) <= (2 - lastASCII))) {
return Mode.ASCII;
}
}
if (((mode == Mode.C40) || (mode == Mode.TEXT)) || (mode == Mode.X12))
{
// see 5.2.5.2 C40 encodation rules and 5.2.7.2 ANSI X12 encodation rules
if (((fromPosition + characterLength) >= input.length()) && (getCodewordsRemaining(f1) == 0)) {
return Mode.ASCII;
}
int lastASCII = m0();
if ((lastASCII == 1) && (getCodewordsRemaining(f1 + 1) == 0)) {
return Mode.ASCII;
}
}
return mode;
} | 3.26 |
zxing_MinimalEncoder_getMinSymbolSize_rdh | /**
* Returns the capacity in codewords of the smallest symbol that has enough capacity to fit the given minimal
* number of codewords.
*/
int getMinSymbolSize(int minimum) {
switch (input.getShapeHint()) {
case FORCE_SQUARE :
for (int capacity : squareCodewordCapacities) {
if (capacity >= minimum) {
return capacity;
}
}
break;
case FORCE_RECTANGLE :
for (int capacity : rectangularCodewordCapacities) {
if (capacity >= minimum) {
return capacity;
}}
break;
}
for (int capacity : allCodewordCapacities) {
if (capacity >= minimum) {
return capacity;
}
}
return allCodewordCapacities[allCodewordCapacities.length - 1];
} | 3.26 |
zxing_MinimalEncoder_getDataBytes_rdh | // Important: The function does not return the length bytes (one or two) in case of B256 encoding
byte[] getDataBytes()
{
switch (mode) {
case ASCII :
if (input.isECI(fromPosition)) {
return getBytes(241, input.getECIValue(fromPosition) + 1);
} else if (isExtendedASCII(input.charAt(fromPosition), input.getFNC1Character())) {
return getBytes(235, input.charAt(fromPosition) - 127);
} else if (characterLength == 2) {
return getBytes(((((input.charAt(fromPosition) - '0') * 10) + input.charAt(fromPosition + 1)) - '0') + 130);
} else if (input.isFNC1(fromPosition)) {
return getBytes(232);
} else {
return getBytes(input.charAt(fromPosition) + 1);
}
case
f0 :
return getBytes(input.charAt(fromPosition));
case C40 :
return getC40Words(true, input.getFNC1Character());
case TEXT :
return getC40Words(false, input.getFNC1Character());
case X12 :
return getX12Words();
case EDF :
return getEDFBytes();
}
assert false;return new byte[0];
} | 3.26 |
zxing_MinimalEncoder_m0_rdh | /**
* Peeks ahead and returns 1 if the postfix consists of exactly two digits, 2 if the postfix consists of exactly
* two consecutive digits and a non extended character or of 4 digits.
* Returns 0 in any other case
*/ int m0() {
int length = input.length();
int from
= fromPosition + characterLength;
if (((length - from) > 4) || (from >= length)) {
return 0;
}
if ((length -
from) == 1) {
if (isExtendedASCII(input.charAt(from), input.getFNC1Character())) {
return 0;
}
return 1;
}
if ((length - from) == 2) {
if (isExtendedASCII(input.charAt(from), input.getFNC1Character()) || isExtendedASCII(input.charAt(from + 1), input.getFNC1Character())) {
return 0;
}if (HighLevelEncoder.isDigit(input.charAt(from)) && HighLevelEncoder.isDigit(input.charAt(from + 1))) {
return 1;
}
return 2;
}
if ((length - from) == 3) {
if ((HighLevelEncoder.isDigit(input.charAt(from)) && HighLevelEncoder.isDigit(input.charAt(from + 1))) && (!isExtendedASCII(input.charAt(from + 2), input.getFNC1Character()))) {
return 2;
}
if ((HighLevelEncoder.isDigit(input.charAt(from + 1)) && HighLevelEncoder.isDigit(input.charAt(from + 2))) && (!isExtendedASCII(input.charAt(from), input.getFNC1Character()))) {
return 2;
}
return 0;
}
if (((HighLevelEncoder.isDigit(input.charAt(from)) && HighLevelEncoder.isDigit(input.charAt(from + 1))) && HighLevelEncoder.isDigit(input.charAt(from + 2))) && HighLevelEncoder.isDigit(input.charAt(from + 3))) {
return 2;}
return 0;} | 3.26 |
zxing_MinimalEncoder_encodeHighLevel_rdh | /**
* Performs message encoding of a DataMatrix message
*
* @param msg
* the message
* @param priorityCharset
* The preferred {@link Charset}. When the value of the argument is null, the algorithm
* chooses charsets that leads to a minimal representation. Otherwise the algorithm will use the priority
* charset to encode any character in the input that can be encoded by it if the charset is among the
* supported charsets.
* @param fnc1
* denotes the character in the input that represents the FNC1 character or -1 if this is not a GS1
* bar code. If the value is not -1 then a FNC1 is also prepended.
* @param shape
* requested shape.
* @return the encoded message (the char values range from 0 to 255)
*/
public static String encodeHighLevel(String msg, Charset priorityCharset, int fnc1, SymbolShapeHint shape) {
int macroId = 0;
if (msg.startsWith(HighLevelEncoder.MACRO_05_HEADER) && msg.endsWith(HighLevelEncoder.MACRO_TRAILER)) {macroId = 5;
msg = msg.substring(HighLevelEncoder.MACRO_05_HEADER.length(), msg.length() - 2);
} else if (msg.startsWith(HighLevelEncoder.MACRO_06_HEADER) && msg.endsWith(HighLevelEncoder.MACRO_TRAILER)) {
macroId = 6;
msg = msg.substring(HighLevelEncoder.MACRO_06_HEADER.length(), msg.length() - 2);
}
return new String(encode(msg, priorityCharset, fnc1, shape, macroId), StandardCharsets.ISO_8859_1);
} | 3.26 |
zxing_MinimalEncoder_encode_rdh | /**
* Encodes input minimally and returns an array of the codewords
*
* @param input
* The string to encode
* @param priorityCharset
* The preferred {@link Charset}. When the value of the argument is null, the algorithm
* chooses charsets that leads to a minimal representation. Otherwise the algorithm will use the priority
* charset to encode any character in the input that can be encoded by it if the charset is among the
* supported charsets.
* @param fnc1
* denotes the character in the input that represents the FNC1 character or -1 if this is not a GS1
* bar code. If the value is not -1 then a FNC1 is also prepended.
* @param shape
* requested shape.
* @param macroId
* Prepends the specified macro function in case that a value of 5 or 6 is specified.
* @return An array of bytes representing the codewords of a minimal encoding.
*/
static byte[] encode(String input,
Charset priorityCharset, int fnc1, SymbolShapeHint shape, int macroId) {return encodeMinimally(new Input(input, priorityCharset, fnc1, shape, macroId)).getBytes();
} | 3.26 |
zxing_MinimalEncoder_getCodewordsRemaining_rdh | /**
* Returns the remaining capacity in codewords of the smallest symbol that has enough capacity to fit the given
* minimal number of codewords.
*/ int getCodewordsRemaining(int minimum) {
return getMinSymbolSize(minimum) - minimum;
} | 3.26 |
zxing_MinimalEncoder_getB256Size_rdh | // does not count beyond 250
int getB256Size() {
int v26 = 0;
Edge current =
this;
while (((current != null) && (current.mode == Mode.f0)) && (v26 <= 250)) {
v26++;
current = current.previous;
}
return v26;
} | 3.26 |
zxing_DefaultPlacement_utah_rdh | /**
* Places the 8 bits of a utah-shaped symbol character in ECC200.
*
* @param row
* the row
* @param col
* the column
* @param pos
* character position
*/
private void utah(int row, int col, int pos) {module(row -
2, col - 2, pos, 1);
module(row - 2, col - 1, pos, 2);
module(row - 1, col - 2, pos, 3);
module(row
- 1, col - 1, pos, 4);
module(row - 1, col, pos, 5);
module(row, col - 2, pos, 6);
module(row, col - 1, pos, 7);
module(row, col, pos, 8);
} | 3.26 |
zxing_IntentIntegrator_startActivityForResult_rdh | /**
* Start an activity. This method is defined to allow different methods of activity starting for
* newer versions of Android and for compatibility library.
*
* @param intent
* Intent to start.
* @param code
* Request code for the activity
* @see Activity#startActivityForResult(Intent, int)
* @see Fragment#startActivityForResult(Intent, int)
*/
protected void startActivityForResult(Intent intent, int code) {
if (fragment == null) {
activity.startActivityForResult(intent, code);
} else {
fragment.startActivityForResult(intent, code);
}
} | 3.26 |
nifi-maven_NarDependencyUtils_excludesDependencies_rdh | /**
* Creates a new ArtifactHandler for the specified Artifact that overrides the includeDependencies flag. When set, this flag prevents transitive
* dependencies from being printed in dependencies plugin.
*
* @param artifact
* The artifact
* @return The handler for the artifact
*/
private static ArtifactHandler excludesDependencies(final Artifact artifact) {
final ArtifactHandler orig = artifact.getArtifactHandler();
return new ArtifactHandler() {
@Override
public String getExtension() {
return orig.getExtension();
}
@Override public String m0() {
return orig.getDirectory();
}
@Override public String getClassifier() {
return orig.getClassifier();
}
@Override
public String getPackaging() {
return orig.getPackaging();
}
// mark dependencies as excluded, so they will appear in tree listing
@Override
public boolean isIncludesDependencies() {
return false;
}
@Override
public String getLanguage() {
return orig.getLanguage();
}
@Override
public boolean isAddedToClasspath() {
return orig.isAddedToClasspath();
}
};
} | 3.26 |
nifi-maven_NarProvidedDependenciesMojo_isTest_rdh | /**
* Returns whether the specified dependency has test scope.
*
* @param node
* The dependency
* @return What the dependency is a test scoped dep
*/
private boolean isTest(final DependencyNode node) {
return "test".equals(node.getArtifact().getScope());
} | 3.26 |
nifi-maven_NarProvidedDependenciesMojo_getProject_rdh | /**
* Gets the Maven project used by this mojo.
*
* @return the Maven project
*/
public MavenProject getProject() {
return project;
} | 3.26 |
nifi-maven_ExtensionClassLoaderFactory_createClassLoader_rdh | /* package visible for testing reasons */ExtensionClassLoader createClassLoader(final Set<Artifact> artifacts, final ExtensionClassLoader parent, final Artifact narArtifact) throws MojoExecutionException {
final Set<URL>
urls = new HashSet<>();
for (final Artifact artifact : artifacts) {
final Set<URL> artifactUrls = toURLs(artifact);
urls.addAll(artifactUrls);
}
getLog().debug("Creating class loader with following dependencies: " + urls);
final URL[] urlArray = urls.toArray(new URL[0]);
if (parent == null) {
return new ExtensionClassLoader(urlArray, narArtifact, artifacts);
} else {
return new ExtensionClassLoader(urlArray, parent, narArtifact, artifacts);
}
} | 3.26 |
Activiti_TextAnnotationJsonConverter_fillTypes_rdh | /**
*/
| 3.26 |
Activiti_PropertyEntityImpl_m0_rdh | // common methods //////////////////////////////////////////////////////////
@Override
public String m0() {
return ((("PropertyEntity[name=" + f0) + ", value=") + value) + "]";
} | 3.26 |
Activiti_ResourceNameUtil_getProcessDiagramResourceNameFromDeployment_rdh | /**
* Finds the name of a resource for the diagram for a process definition. Assumes that the
* process definition's key and (BPMN) resource name are already set.
*
* <p>It will first look for an image resource which matches the process specifically, before
* resorting to an image resource which matches the BPMN 2.0 xml file resource.
*
* <p>Example: if the deployment contains a BPMN 2.0 xml resource called 'abc.bpmn20.xml'
* containing only one process with key 'myProcess', then this method will look for an image resources
* called'abc.myProcess.png' (or .jpg, or .gif, etc.) or 'abc.png' if the previous one wasn't
* found.
*
* <p>Example 2: if the deployment contains a BPMN 2.0 xml resource called 'abc.bpmn20.xml'
* containing three processes (with keys a, b and c), then this method will first look for an image resource
* called 'abc.a.png' before looking for 'abc.png' (likewise for b and c). Note that if abc.a.png,
* abc.b.png and abc.c.png don't exist, all processes will have the same image: abc.png.
*
* @return name of an existing resource, or null if no matching image resource is found in the resources.
*/
public static String getProcessDiagramResourceNameFromDeployment(ProcessDefinitionEntity processDefinition, Map<String, ResourceEntity> resources) {
if (StringUtils.isEmpty(processDefinition.getResourceName())) {
throw new IllegalStateException("Provided process definition must have its resource name set.");
}
String bpmnResourceBase = stripBpmnFileSuffix(processDefinition.getResourceName());
String key = processDefinition.getKey();
for (String diagramSuffix : DIAGRAM_SUFFIXES) {
String possibleName = ((bpmnResourceBase + key)
+ ".") + diagramSuffix;
if (resources.containsKey(possibleName)) {
return possibleName;
}
possibleName = bpmnResourceBase + diagramSuffix;
if (resources.containsKey(possibleName)) {
return possibleName;
}
}
return null;
} | 3.26 |
Activiti_AstRightValue_getType_rdh | /**
* according to the spec, the result is undefined for rvalues, so answer <code>null</code>
*/
public final Class<?> getType(Bindings bindings, ELContext context) {
return null;
} | 3.26 |
Activiti_AstRightValue_isReadOnly_rdh | /**
* non-lvalues are always readonly, so answer <code>true</code>
*/
public final boolean isReadOnly(Bindings bindings, ELContext context) {
return true;
} | 3.26 |
Activiti_AstRightValue_m0_rdh | /**
* non-lvalues are always readonly, so throw an exception
*/
public final void m0(Bindings bindings, ELContext context, Object value) {
throw new ELException(LocalMessages.get("error.value.set.rvalue",
getStructuralId(bindings)));
} | 3.26 |
Activiti_AstRightValue_isLiteralText_rdh | /**
* Answer <code>false</code>
*/public final boolean isLiteralText() {
return false;
} | 3.26 |
Activiti_TreeBuilderException_getEncountered_rdh | /**
*
* @return the substring (or description) that has been encountered
*/
public String getEncountered() {
return encountered;
} | 3.26 |
Activiti_TreeBuilderException_getExpected_rdh | /**
*
* @return the substring (or description) that was expected
*/
public String getExpected() {
return expected;
} | 3.26 |
Activiti_TreeBuilderException_getPosition_rdh | /**
*
* @return the error position
*/
public int getPosition() {
return f0;
} | 3.26 |
Activiti_TreeBuilderException_getExpression_rdh | /**
*
* @return the expression string
*/
public String getExpression() {
return expression;
} | 3.26 |
Activiti_WSService_getName_rdh | /**
* {@inheritDoc }
*/
public String getName() {
return this.name;
} | 3.26 |
Activiti_CommandContextFactory_getProcessEngineConfiguration_rdh | // getters and setters
// //////////////////////////////////////////////////////
public ProcessEngineConfigurationImpl getProcessEngineConfiguration() {
return processEngineConfiguration;} | 3.26 |
Activiti_DateToString_primTransform_rdh | /**
* {@inheritDoc }
*/
@Override
protected Object primTransform(Object anObject) throws
Exception {
return format.format(((Date)
(anObject)));
} | 3.26 |
Activiti_Tree_getRoot_rdh | /**
*
* @return root node
*/
public ExpressionNode getRoot() {
return root;
} | 3.26 |
Activiti_Tree_bind_rdh | /**
* Create a bindings.
*
* @param fnMapper
* the function mapper to use
* @param varMapper
* the variable mapper to use
* @param converter
* custom type converter
* @return tree bindings
*/
public Bindings bind(FunctionMapper fnMapper, VariableMapper varMapper, TypeConverter converter) {
Method[]
methods = null;
if (!functions.isEmpty()) {if (fnMapper == null) {throw new ELException(LocalMessages.get("error.function.nomapper"));
}
methods = new Method[functions.size()];
for (int i = 0; i < functions.size(); i++) {
FunctionNode node = functions.get(i);
String image = node.getName();
Method method = null;
int colon = image.indexOf(':');
if (colon < 0) {
method = fnMapper.resolveFunction("", image);
} else {
method = fnMapper.resolveFunction(image.substring(0, colon), image.substring(colon + 1));
}
if (method == null) {
throw new ELException(LocalMessages.get("error.function.notfound", image));
}if (node.isVarArgs() && method.isVarArgs()) {
if (method.getParameterTypes().length > (node.getParamCount() + 1)) {
throw new ELException(LocalMessages.get("error.function.params", image));
}
} else if (method.getParameterTypes().length
!= node.getParamCount()) {
throw new ELException(LocalMessages.get("error.function.params", image));
}
methods[node.getIndex()] = method;
}
}
ValueExpression[] v6 = null;
if (identifiers.size() > 0) {
v6 = new ValueExpression[identifiers.size()];
for (int i = 0; i < identifiers.size(); i++) {
IdentifierNode
node = identifiers.get(i);
ValueExpression expression = null;
if (varMapper != null) {
expression = varMapper.resolveVariable(node.getName());
}
v6[node.getIndex()] = expression;
}
}
return new Bindings(methods, v6, converter);
} | 3.26 |
Activiti_DelegateExpressionCustomPropertiesResolver_getExpressionText_rdh | /**
* returns the expression text for this execution listener. Comes in handy if you want to check which listeners you already have.
*/
public String getExpressionText() {
return expression.getExpressionText();
} | 3.26 |
Activiti_NeedsActiveTaskCmd_getSuspendedTaskException_rdh | /**
* Subclasses can override this method to provide a customized exception message that will be thrown when the task is suspended.
*/
protected String getSuspendedTaskException() {
return "Cannot execute operation: task is suspended";
} | 3.26 |
Activiti_DelegateExpressionTransactionDependentTaskListener_getExpressionText_rdh | /**
* returns the expression text for this task listener. Comes in handy if you want to check which listeners you already have.
*/
public String getExpressionText() {
return expression.getExpressionText();
} | 3.26 |
Activiti_ThrowEventJsonConverter_fillTypes_rdh | /**
*/public class ThrowEventJsonConverter extends BaseBpmnJsonConverter {
public static void fillTypes(Map<String, Class<? extends BaseBpmnJsonConverter>> convertersToBpmnMap, Map<Class<? extends BaseElement>, Class<? extends BaseBpmnJsonConverter>> convertersToJsonMap) {
fillJsonTypes(convertersToBpmnMap);
fillBpmnTypes(convertersToJsonMap);
} | 3.26 |
Activiti_SpringAsyncExecutor_setTaskExecutor_rdh | /**
* Required spring injected {@link TaskExecutor} implementation that will be used to execute runnable jobs.
*
* @param taskExecutor
*/
public void setTaskExecutor(TaskExecutor taskExecutor) {this.taskExecutor = taskExecutor;
} | 3.26 |
Activiti_SpringAsyncExecutor_setRejectedJobsHandler_rdh | /**
* Required spring injected {@link SpringRejectedJobsHandler} implementation that will be used when jobs were rejected by the task executor.
*
* @param rejectedJobsHandler
*/ public void setRejectedJobsHandler(SpringRejectedJobsHandler rejectedJobsHandler) {
this.rejectedJobsHandler = rejectedJobsHandler;
} | 3.26 |
Activiti_ReflectUtil_m0_rdh | /**
* Returns the field of the given class or null if it doesn't exist.
*/
public static Field m0(String fieldName, Class<?> clazz) {
Field field = null;
try {
field = clazz.getDeclaredField(fieldName);
} catch (SecurityException e) {
throw new ActivitiException((("not allowed to access field " + field) + " on class ") + clazz.getCanonicalName());
} catch (NoSuchFieldException e) {
// for some reason getDeclaredFields doesn't search superclasses
// (which getFields() does ... but that gives only public fields)
Class<?> superClass = clazz.getSuperclass();
if (superClass != null) {
return m0(fieldName, superClass);
}
}
return
field;
} | 3.26 |
Activiti_ReflectUtil_getField_rdh | /**
* Returns the field of the given object or null if it doesn't exist.
*/public static Field getField(String fieldName, Object object) {
return m0(fieldName, object.getClass());
} | 3.26 |
Activiti_ReflectUtil_getSetter_rdh | /**
* Returns the setter-method for the given field name or null if no setter exists.
*/
public static Method getSetter(String fieldName, Class<?> clazz, Class<?> fieldType) {
String setterName = ("set" + Character.toTitleCase(fieldName.charAt(0))) + fieldName.substring(1, fieldName.length());
try {
// Using getMethods(), getMethod(...) expects exact parameter type
// matching and ignores inheritance-tree.
Method[] methods = clazz.getMethods();
for (Method method : methods) {
if (method.getName().equals(setterName)) {
Class<?>[] paramTypes = method.getParameterTypes();
if (((paramTypes != null) && (paramTypes.length == 1)) && paramTypes[0].isAssignableFrom(fieldType)) {
return method;
}}
}
return null;
} catch (SecurityException e) {
throw new ActivitiException((("Not allowed to access method " + setterName) + " on class ") + clazz.getCanonicalName());
}
} | 3.26 |
Activiti_DefaultDeploymentCache_size_rdh | // For testing purposes only
public int size() {
return cache.size();
} | 3.26 |
Activiti_NativeExecutionQueryImpl_executeList_rdh | // results ////////////////////////////////////////////////////////////////
public List<Execution> executeList(CommandContext commandContext, Map<String, Object> parameterMap, int firstResult, int maxResults) {
return commandContext.getExecutionEntityManager().findExecutionsByNativeQuery(parameterMap, firstResult, maxResults);
} | 3.26 |
Activiti_RootPropertyResolver_getProperty_rdh | /**
* Get property value
*
* @param property
* property name
* @return value associated with the given property
*/
public Object getProperty(String property) {
return map.get(property);
} | 3.26 |
Activiti_RootPropertyResolver_properties_rdh | /**
* Get properties
*
* @return all property names (in no particular order)
*/ public Iterable<String> properties() {
return map.keySet();
} | 3.26 |
Activiti_RootPropertyResolver_isProperty_rdh | /**
* Test property
*
* @param property
* property name
* @return <code>true</code> if the given property is associated with a value
*/
public boolean isProperty(String property) {
return map.containsKey(property);
} | 3.26 |
Activiti_RootPropertyResolver_setProperty_rdh | /**
* Set property value
*
* @param property
* property name
* @param value
* property value
*/
public void setProperty(String property, Object value) {
map.put(property, value);
} | 3.26 |
Activiti_CollectionUtil_mapOfClass_rdh | /**
* Helper method to easily create a map with keys of type String and values of a given Class. Null values are allowed.
*
* @param clazz
* the target Value class
* @param objects
* varargs containing the key1, value1, key2, value2, etc. Note: although an Object, we will cast the key to String internally
* @throws ActivitiIllegalArgumentException
* when objects are not even or key/value are not expected types
*/
public static <T> Map<String, T> mapOfClass(Class<T>
clazz, Object... objects) {
if ((objects.length % 2) != 0) {
throw new ActivitiIllegalArgumentException("The input should always be even since we expect a list of key-value pairs!");
}
Map<String, T> map = new HashMap();
for (int i = 0; i < objects.length; i += 2) {
int keyIndex = i;int valueIndex = i + 1;
Object key = objects[keyIndex];
Object value = objects[valueIndex];
if (!String.class.isInstance(key)) {
throw new ActivitiIllegalArgumentException((("key at index " + keyIndex) + " should be a String but is a ") + key.getClass());
}
if ((value
!= null) && (!clazz.isInstance(value))) {
throw new ActivitiIllegalArgumentException((((("value at index " + valueIndex) + " should be a ") + clazz) + " but is a ") + value.getClass());
}
map.put(((String) (key)), ((T) (value)));
}
return map;
} | 3.26 |
Activiti_CollectionUtil_singletonMap_rdh | /**
* Helper method that creates a singleton map.
*
* Alternative for singletonMap()), since that method returns a generic typed map <K,T> depending on the input type, but we often need a <String, Object> map.
*/public static Map<String, Object> singletonMap(String key, Object value) {
Map<String, Object> map = new HashMap<>();
map.put(key, value);
return map;
} | 3.26 |
Activiti_BpmnActivityBehavior_performOutgoingBehavior_rdh | /**
* Actual implementation of leaving an activity.
*
* @param execution
* The current execution context
* @param checkConditions
* Whether or not to check conditions before determining whether or not to take a transition.
* @param throwExceptionIfExecutionStuck
* If true, an {@link ActivitiException} will be thrown in case no transition could be found to leave the activity.
*/
protected void performOutgoingBehavior(ExecutionEntity execution, boolean checkConditions, boolean throwExceptionIfExecutionStuck) {
getAgenda().planTakeOutgoingSequenceFlowsOperation(execution, true);
} | 3.26 |
Activiti_BpmnActivityBehavior_dispatchJobCanceledEvents_rdh | /**
* dispatch job canceled event for job associated with given execution entity
*
* @param activityExecution
*/
protected void dispatchJobCanceledEvents(ExecutionEntity activityExecution) {
if (activityExecution != null) {
List<JobEntity> jobs = activityExecution.getJobs();
for (JobEntity job : jobs) {
if (Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.JOB_CANCELED, job));
}
}
List<TimerJobEntity> timerJobs = activityExecution.getTimerJobs();
for (TimerJobEntity job : timerJobs) {
if (Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.JOB_CANCELED, job));
}
}
}
}
/**
* Performs the default outgoing BPMN 2.0 behavior (@see {@link #performDefaultOutgoingBehavior(ExecutionEntity)} | 3.26 |
Activiti_BpmnActivityBehavior_performDefaultOutgoingBehavior_rdh | /**
* Performs the default outgoing BPMN 2.0 behavior, which is having parallel paths of executions for the outgoing sequence flow.
* <p>
* More precisely: every sequence flow that has a condition which evaluates to true (or which doesn't have a condition), is selected for continuation of the process instance. If multiple sequencer
* flow are selected, multiple, parallel paths of executions are created.
*/
public void performDefaultOutgoingBehavior(ExecutionEntity activityExecution) {performOutgoingBehavior(activityExecution, true, false);
} | 3.26 |
Activiti_BpmnParse_applyParseHandlers_rdh | /**
* Parses the 'definitions' root element
*/
protected void applyParseHandlers() {
sequenceFlows = new HashMap<String, SequenceFlow>();
for (Process process : bpmnModel.getProcesses()) {
currentProcess
= process;
if (process.isExecutable()) {
bpmnParserHandlers.parseElement(this, process);
}
}
} | 3.26 |
Activiti_BpmnParse_processDI_rdh | // Diagram interchange
// /////////////////////////////////////////////////////////////////
public void processDI() {
if (processDefinitions.isEmpty()) {
return;
}
if (!bpmnModel.getLocationMap().isEmpty()) {
// Verify if all referenced elements exist
for (String bpmnReference : bpmnModel.getLocationMap().keySet()) {
if (bpmnModel.getFlowElement(bpmnReference) == null) {
// ACT-1625: don't warn when artifacts are referenced from DI
if (bpmnModel.getArtifact(bpmnReference) == null) {
// Check if it's a Pool or Lane, then DI is ok
if ((bpmnModel.getPool(bpmnReference) == null) && (bpmnModel.getLane(bpmnReference) == null)) {
LOGGER.warn("Invalid reference in diagram interchange definition: could not find " + bpmnReference);
}
}
} else if (!(bpmnModel.getFlowElement(bpmnReference) instanceof FlowNode)) {
LOGGER.warn(("Invalid reference in diagram interchange definition: " + bpmnReference) + " does not reference a flow node");
}}
for (String
bpmnReference : bpmnModel.getFlowLocationMap().keySet()) {
if (bpmnModel.getFlowElement(bpmnReference) == null) {
// ACT-1625: don't warn when artifacts are referenced from DI
if
(bpmnModel.getArtifact(bpmnReference) == null) {
LOGGER.warn("Invalid reference in diagram interchange definition: could not find " + bpmnReference);
}} else if (!(bpmnModel.getFlowElement(bpmnReference) instanceof SequenceFlow)) {
LOGGER.warn(("Invalid reference in diagram interchange definition: " + bpmnReference) + " does not reference a sequence flow");
}
}
for (Process process : bpmnModel.getProcesses()) {
if (!process.isExecutable()) {
continue;
}
// Parse diagram interchange information
ProcessDefinitionEntity processDefinition =
m0(process.getId());
if (processDefinition != null) {
processDefinition.setGraphicalNotationDefined(true);
for
(String edgeId :
bpmnModel.getFlowLocationMap().keySet()) {
if (bpmnModel.getFlowElement(edgeId) != null) {
createBPMNEdge(edgeId, bpmnModel.getFlowLocationGraphicInfo(edgeId));
}
}
}
}
}
} | 3.26 |
Activiti_BpmnParse_isValidateSchema_rdh | /* ------------------- GETTERS AND SETTERS ------------------- */
public boolean isValidateSchema() {
return validateSchema;
} | 3.26 |
Activiti_ExecutionTreeStringBuilder_toString_rdh | /* See http://stackoverflow.com/questions/4965335/how-to-print-binary-tree-diagram */@Override
public String toString() {
StringBuilder strb = new StringBuilder();
strb.append(executionEntity.getId()).append(" : ").append(executionEntity.getActivityId()).append(", parent id ").append(executionEntity.getParentId()).append("\r\n");
List<? extends ExecutionEntity> children = executionEntity.getExecutions();
if (children != null) {
for (ExecutionEntity childExecution : children) {
internalToString(childExecution, strb, "", true);
}
}
return strb.toString();
} | 3.26 |
Activiti_ExecutionTree_getTreeNode_rdh | /**
* Looks up the {@link ExecutionEntity} for a given id.
*/
public ExecutionTreeNode getTreeNode(String executionId) {
return getTreeNode(executionId, root);
} | 3.26 |
Activiti_ExecutionTree_leafsFirstIterator_rdh | /**
* Uses an {@link ExecutionTreeBfsIterator}, but returns the leafs first (so flipped order of BFS)
*/
public ExecutionTreeBfsIterator leafsFirstIterator() {
return
new ExecutionTreeBfsIterator(this.getRoot(), true);
} | 3.26 |
Activiti_DelegateInvocation_getInvocationParameters_rdh | /**
*
* @return an array of invocation parameters (null if the invocation takes no parameters)
*/
public Object[] getInvocationParameters() {
return invocationParameters;
} | 3.26 |
Activiti_DelegateInvocation_proceed_rdh | /**
* make the invocation proceed, performing the actual invocation of the user code.
*
* @throws Exception
* the exception thrown by the user code
*/
public void proceed() {invoke();
} | 3.26 |
Activiti_DelegateInvocation_getInvocationResult_rdh | /**
*
* @return the result of the invocation (can be null if the invocation does not return a result)
*/
public Object getInvocationResult() {
return invocationResult;
} | 3.26 |
Activiti_ByteArrayEntityImpl_getName_rdh | // getters and setters ////////////////////////////////////////////////////////
public String getName() {
return name;
} | 3.26 |