public override bool isPartialMatch(Context context) { if (context is LeftRightContext) { LeftRightContext leftRightContext = (LeftRightContext)context; Unit[] array = leftRightContext.getLeftContext(); Unit[] array2 = leftRightContext.getRightContext(); return((array == null || this.leftContext == null || Unit.isContextMatch(array, this.leftContext)) && (array2 == null || this.rightContext == null || Unit.isContextMatch(array2, this.rightContext))); } return(context == Context.__EMPTY_CONTEXT && this.leftContext == null && this.rightContext == null); }
public virtual int getID(Unit unit) { if (!unit.isContextDependent()) { return(this.getSimpleUnitID(unit)); } LeftRightContext leftRightContext = (LeftRightContext)unit.getContext(); if (!HMMPool.assertionsDisabled && leftRightContext.getLeftContext().Length != 1) { throw new AssertionError(); } if (!HMMPool.assertionsDisabled && leftRightContext.getRightContext().Length != 1) { throw new AssertionError(); } return(this.buildID(this.getSimpleUnitID(unit), this.getSimpleUnitID(leftRightContext.getLeftContext()[0]), this.getSimpleUnitID(leftRightContext.getRightContext()[0]))); }
private Unit synthesizeUnit(int num) { int centralUnitID = this.getCentralUnitID(num); int leftUnitID = this.getLeftUnitID(num); int rightUnitID = this.getRightUnitID(num); if (centralUnitID == 0 || leftUnitID == 0 || rightUnitID == 0) { return(null); } Unit unit = this.unitTable[centralUnitID]; Unit unit2 = this.unitTable[leftUnitID]; Unit unit3 = this.unitTable[rightUnitID]; if (!HMMPool.assertionsDisabled && unit == null) { throw new AssertionError(); } if (!HMMPool.assertionsDisabled && unit2 == null) { throw new AssertionError(); } if (!HMMPool.assertionsDisabled && unit3 == null) { throw new AssertionError(); } Unit[] array = new Unit[1]; Unit[] array2 = new Unit[1]; array[0] = unit2; array2[0] = unit3; LeftRightContext context = LeftRightContext.get(array, array2); Unit unit4 = this.unitManager.getUnit(unit.getName(), unit.isFiller(), context); if (this.logger.isLoggable(Level.FINER)) { this.logger.finer(new StringBuilder().append("Missing ").append(this.getUnitNameFromID(num)).append(" returning ").append(unit4).toString()); } return(unit4); }
public override string toString() { return(new StringBuilder().append(LeftRightContext.getContextName(this.leftContext)).append(',').append(LeftRightContext.getContextName(this.rightContext)).toString()); }