1 19 20 package org.netbeans.lib.lexer.test; 21 22 public class RandomModifyDescriptor { 23 24 private final int opCount; 25 26 private final RandomTextProvider randomTextProvider; 27 28 private final double insertCharRatio; 29 30 private final double insertTextRatio; 31 32 private int insertTextMaxLength = 10; 33 34 private final double insertFixedTextRatio; 35 36 private final double removeCharRatio; 37 38 private final double removeTextRatio; 39 40 private int removeTextMaxLength = 10; 41 42 private final double createSnapshotRatio; 43 44 private final double destroySnapshotRatio; 45 46 private double ratioSum; 47 48 private boolean ratioSumInited; 49 50 public RandomModifyDescriptor(int opCount, RandomTextProvider randomTextProvider, 51 double insertCharRatio, double insertTextRatio, double insertFixedTextRatio, 52 double removeCharRatio, double removeTextRatio, 53 double createSnapshotRatio, double destroySnapshotRatio) { 54 this.opCount = opCount; 55 this.randomTextProvider = randomTextProvider; 56 this.insertCharRatio = insertCharRatio; 57 this.insertTextRatio = insertTextRatio; 58 this.insertFixedTextRatio = insertFixedTextRatio; 59 this.removeCharRatio = removeCharRatio; 60 this.removeTextRatio = removeTextRatio; 61 this.createSnapshotRatio = createSnapshotRatio; 62 this.destroySnapshotRatio = destroySnapshotRatio; 63 } 64 65 protected double computeRatioSum() { 66 return insertCharRatio + insertTextRatio + insertFixedTextRatio 67 + removeCharRatio + removeTextRatio 68 + createSnapshotRatio + destroySnapshotRatio; 69 } 70 71 public int opCount() { 72 return opCount; 73 } 74 75 public RandomTextProvider randomTextProvider() { 76 return randomTextProvider; 77 } 78 79 public double insertCharRatio() { 80 return insertCharRatio; 81 } 82 83 public double insertTextRatio() { 84 return insertTextRatio; 85 } 86 87 public int insertTextMaxLength() { 88 return insertTextMaxLength; 89 } 90 91 public double insertFixedTextRatio() { 92 return insertFixedTextRatio; 93 } 94 95 public void setInsertTextMaxLength(int insertTextMaxLength) { 96 this.insertTextMaxLength = insertTextMaxLength; 97 } 98 99 public double removeCharRatio() { 100 return removeCharRatio; 101 } 102 103 public double removeTextRatio() { 104 return removeTextRatio; 105 } 106 107 public int removeTextMaxLength() { 108 return removeTextMaxLength; 109 } 110 111 public void setRemoveTextMaxLength(int removeTextMaxLength) { 112 this.removeTextMaxLength = removeTextMaxLength; 113 } 114 115 public double ratioSum() { 116 if (!ratioSumInited) { 117 ratioSumInited = true; 118 ratioSum = computeRatioSum(); 119 } 120 return ratioSum; 121 } 122 123 public double createSnapshotRatio() { 124 return createSnapshotRatio; 125 } 126 127 public double destroySnapshotRatio() { 128 return destroySnapshotRatio; 129 } 130 131 } | Popular Tags |