To compute this allowance, the 'rent' value must be provided for the same month, but 'housing_occupancy_status' is not necessary.
7791
def formula_1980(household, period, parameters):
        '''
        
        '''
        return household('rent', period) * parameters(period).benefits.housing_allowance
964357
def verify_month(self, now):
        ''''''
        return self.month == "*" or str(now.month) in self.month.split(" ")
1337605
public void addLessOrEqualThan(Object attribute, Object value)
    {
		// PAW
		// addSelectionCriteria(ValueCriteria.buildNotGreaterCriteria(attribute, value, getAlias()));
		addSelectionCriteria(ValueCriteria.buildNotGreaterCriteria(attribute, value, getUserAlias(attribute)));
    }
1252761
function(calendar) {
					while (m < calendar.minMonth) {
						y--;
						m += calendar.monthsInYear(y);
					}
					var yearMonths = calendar.monthsInYear(y);
					while (m > yearMonths - 1 + calendar.minMonth) {
						y++;
						m -= yearMonths;
						yearMonths = calendar.monthsInYear(y);
					}
				}
550850
private void requirePending() {
		if (pending != null) {
			return;
		}

		long exclusionComparable = Long.MIN_VALUE;
		while (nInclusionsRemaining != 0 && !queue.isEmpty()) {
			//find a candidate that is not excluded
			HeapElement inclusion = null;
			do {
				HeapElement candidate = queue.poll();
				if (candidate.inclusion) {
					if (exclusionComparable != candidate.comparable()) {
						inclusion = candidate;
						break;
					}
				} else {
					exclusionComparable = candidate.comparable();
				}
				reattach(candidate);
				if (nInclusionsRemaining == 0) {
					return;
				}
			} while (!queue.isEmpty());
			if (inclusion == null) {
				return;
			}
			long inclusionComparable = inclusion.comparable();

			/*
			 * Check for any following exclusions and for duplicates. We could
			 * change the sort order so that exclusions always preceded
			 * inclusions, but that would be less efficient and would make the
			 * ordering different than the comparable value.
			 */
			boolean excluded = exclusionComparable == inclusionComparable;
			while (!queue.isEmpty() && queue.peek().comparable() == inclusionComparable) {
				HeapElement match = queue.poll();
				excluded |= !match.inclusion;
				reattach(match);
				if (nInclusionsRemaining == 0) {
					return;
				}
			}
			if (!excluded) {
				pending = inclusion;
				return;
			}
			reattach(inclusion);
		}
	}
399515
def __set_due_date(self, value):
        '''
        
        '''
        if type(value) != date:
            raise ValueError('Due date must be an instance of date.')

        if self.__date.date() and value < self.__date.date():
            raise ValueError("Due date cannot be anterior to the invoice " \
                             "date.")

        self.__due_date = value
925924
public static boolean sameMonth(Date dateOne, Date dateTwo) {
        if ((dateOne == null) || (dateTwo == null)) {
            return false;
        }

        Calendar cal = Calendar.getInstance();
        cal.setTime(dateOne);
        int year = cal.get(Calendar.YEAR);
        int month = cal.get(Calendar.MONTH);

        cal.setTime(dateTwo);
        int year2 = cal.get(Calendar.YEAR);
        int month2 = cal.get(Calendar.MONTH);

        return ( (year == year2) && (month == month2) );
    }
121558
def availability(self, availability):
        
        allowed_values = ["available", "comingSoon", "retired"]
        if availability is not None and availability not in allowed_values:
            raise ValueError(
                "Invalid value for `availability` ({0}), must be one of {1}"
                .format(availability, allowed_values)
            )

        self._availability = availability
1351784
private static int daysInMonth(int year, int month) {
    assert month >= FIRST_MONTH && month <= LAST_MONTH;
    int d = DAYS_IN_MONTH[month - 1];
    if (month == FEBRUARY && isLeapYear(year)) d++;
    return d;
  }
452543
def onOffset(self, date):
        """"""
        mod_month = (date.month - self.month) % 3
        return mod_month == 0 and date.day == self._get_offset_day(date)
497934
private int parseMonth(String month) {
    for (int i = 0; i < months.length; i++)
      if (months[i].startsWith(month))
        return i;
    return -1;
  }
538707
private static boolean isLastDayOfMonth(int value, int month, boolean isLeapYear) {
		if (isLeapYear && month == 2) {
			return value == 29;
		} else {
			return value == LAST_DAYS[month - 1];
		}
	}
899484
def with_tenant(tenant,&blk)
      orig = self.current_tenant
      begin
        self.current_tenant = tenant
        return blk.call(tenant)
      ensure
        self.current_tenant = orig
      end
    end
1314254
def month=(value)
      value = 0 if value.nil?

      if value.is_a?(String) 
        if value.length == 0
          value = 0
        elsif value =~ /\A\d{1,2}\z/ 
          value = value.to_i
        else
          raise MonthError, "Month must be a valid one or two digit string or integer between 0 and 12"
        end
      end

      if (value >= 0 && value <= 12)
        @bits = self.class.set_month(@bits, value)
        @bits = self.class.set_day(@bits, 0) if value == 0
      else
        raise MonthError, "Month must an be integer between 0 and 12"
      end
    end
305202
private void computePeriod(InfoTree it1, int aVp, int aNextVp, InfoTree it2, int aStrategy) {

		int fTreeSize = it1.getSize();
		int gTreeSize = it2.getSize();

		int vpPreorder = it1.info[POST2_PRE][aVp];
		int vpRevPreorder = fTreeSize - 1 - aVp;
		int vpSize = it1.info[POST2_SIZE][aVp];

		int gSize = it2.info[POST2_SIZE][it2.getCurrentNode()];
		int gPreorder = it2.info[POST2_PRE][it2.getCurrentNode()];
		int gRevPreorder = gTreeSize - 1 - it2.getCurrentNode();

		int nextVpPreorder = -1;
		int nextVpRevPreorder = -1;
		int nextVpSize = -1;
		// count k and assign next vp values
		int k;
		if (aNextVp != -1) {
			nextVpPreorder = it1.info[POST2_PRE][aNextVp];
			nextVpRevPreorder = fTreeSize - 1 - aNextVp;
			nextVpSize = it1.info[POST2_SIZE][aNextVp];
			// if strategy==LEFT use preorder to count number of left deletions from vp to
			// vp-1
			// if strategy==RIGHT use reversed preorder
			k = aStrategy == LEFT ? nextVpPreorder - vpPreorder
					: nextVpRevPreorder - vpRevPreorder;
			if (aStrategy != previousStrategy) {
				computeIJTable(it2, gPreorder, gRevPreorder, gSize, aStrategy, gTreeSize);
			}
		} else {
			k = 1;
			computeIJTable(it2, gPreorder, gRevPreorder, gSize, aStrategy, gTreeSize);
		}

		int realStrategy = it1.info[POST2_STRATEGY][aVp];

		boolean switched = it1.isSwitched();

		double[][] tTable_copy = t.clone();

		// Q and T are visible for every i
		double[] qTable = new double[k];

		// if aVp is a leaf => precompute table T - edit distance betwen EMPTY and all
		// subforests of G

		// check if nextVp is the only child of vp
		if (vpSize - nextVpSize == 1) {
			// update delta from T table => dist between Fvp-1 and G was computed in
			// previous compute period
			if (gSize == 1) {
				setDeltaValue(it1.info[PRE2_POST][vpPreorder], it2.info[PRE2_POST][gPreorder],
						vpSize - 1, switched);
			} else {
				setDeltaValue(it1.info[PRE2_POST][vpPreorder], it2.info[PRE2_POST][gPreorder],
						t[1][0], switched);
			}
		}

		double[][] sTable;// = new double[k][gTreeSize+1];

		int gijForestPreorder;
		int previousI;
		int fForestPreorderKPrime;
		int jPrime;
		int kBis;
		int jOfIminus1;
		int gijOfIMinus1Preorder;
		int jOfI;
		double deleteFromLeft;
		double deleteFromRight;
		double match;
		int fLabel;
		int gLabel;

		// Q and T are visible for every i
		for (int i = gSize - 1; i >= 0; i--) {

			// jOfI was already computed once in spfH
			jOfI = jOfI(it2, i, gSize, gRevPreorder, gPreorder, aStrategy, gTreeSize);

			// when strategy==BOTH first LEFT then RIGHT is done

			counter += realStrategy == BOTH && aStrategy == LEFT ? (k - 1) * (jOfI + 1)
					: k * (jOfI + 1);

			// compute table S - visible for actual i

			sTable = new double[k][jOfI + 1]; // initialized outside loop? -> doesn't work

			for (int kPrime = 1; kPrime <= k; kPrime++) {

				fForestPreorderKPrime = aStrategy == LEFT ? vpPreorder + (k - kPrime)
						: it1.info[POST2_PRE][fTreeSize - 1 - (vpRevPreorder + (k - kPrime))];
				kBis = kPrime - it1.info[POST2_SIZE][it1.info[PRE2_POST][fForestPreorderKPrime]];

				// reset the minimum arguments' values
				deleteFromRight = costIns;
				deleteFromLeft = costDel;
				match = 0;

				match += aStrategy == LEFT ? kBis + nextVpSize : vpSize - k + kBis;

				if ((i + jOfI) == (gSize - 1)) {
					deleteFromRight += (vpSize - (k - kPrime));
				} else {
					deleteFromRight += qTable[kPrime - 1];
				}

				fLabel = it1.info[POST2_LABEL][it1.info[PRE2_POST][fForestPreorderKPrime]];

				for (int j = jOfI; j >= 0; j--) {
					// count dist(FkPrime, Gij) with min

					// delete from left

					gijForestPreorder = aStrategy == LEFT ? IJ[i][j]
							: it2.info[POST2_PRE][gTreeSize - 1 - IJ[i][j]];

					if (kPrime == 1) {
						// if the direction changed from the previous period to this one use i and j
						// of
						// previous strategy

						// since T is overwritten continously, thus use T_copy for getting values
						// from
						// previous period

						if (aStrategy != previousStrategy) {
							if (aStrategy == LEFT) {
								previousI = gijForestPreorder - gPreorder; // minus preorder of G
							} else {
								previousI = gTreeSize - 1
										- it2.info[RPOST2_POST][gTreeSize - 1 - gijForestPreorder]
										- gRevPreorder; // minus rev preorder of G
							}
							deleteFromLeft += tTable_copy[previousI][i + j - previousI];
						} else {
							deleteFromLeft += tTable_copy[i][j];
						}

					} else {
						deleteFromLeft += sTable[kPrime - 1 - 1][j];
					}

					// match

					match += switched
							?
							delta[it2.info[PRE2_POST][gijForestPreorder]][it1.info[PRE2_POST][fForestPreorderKPrime]]
							:
							delta[it1.info[PRE2_POST][fForestPreorderKPrime]][it2.info[PRE2_POST][gijForestPreorder]];

					jPrime = j + it2.info[POST2_SIZE][it2.info[PRE2_POST][gijForestPreorder]];

					// if root nodes of L/R Fk' and L/R Gij have different labels add the match cost
					gLabel = it2.info[POST2_LABEL][it2.info[PRE2_POST][gijForestPreorder]];

					if (fLabel != gLabel) {
						match += costMatch;
					}

					// this condition is checked many times but is not satisfied only once
					if (j != jOfI) {
						// delete from right
						deleteFromRight += sTable[kPrime - 1][j + 1];
						if (kBis == 0) {
							if (aStrategy != previousStrategy) {
								previousI = aStrategy == LEFT ? IJ[i][jPrime] - gPreorder
										: IJ[i][jPrime] - gRevPreorder;
								match += tTable_copy[previousI][i + jPrime - previousI];
							} else {
								match += tTable_copy[i][jPrime];
							}
						} else if (kBis > 0) {
							match += sTable[kBis - 1][jPrime];
						} else {
							match += gSize - (i + jPrime);
						}

					}

					// fill S table
					sTable[kPrime - 1][j] = (deleteFromLeft < deleteFromRight)
							? ((deleteFromLeft < match) ? deleteFromLeft : match)
							: ((deleteFromRight < match) ? deleteFromRight : match);

					// reset the minimum arguments' values
					deleteFromRight = costIns;
					deleteFromLeft = costDel;
					match = 0;
				}
			}

			// compute table T => add row to T
			if (realStrategy == BOTH && aStrategy == LEFT) {
				t[i] = sTable[k - 1 - 1];
			} else {
				t[i] = sTable[k - 1];
			}

			if (i > 0) {
				// compute table Q
				jOfIminus1 =
						jOfI(it2, i - 1, gSize, gRevPreorder, gPreorder, aStrategy, gTreeSize);
				if (jOfIminus1 <= jOfI) {
					for (int x = 0;
					     x < qTable.length; x++) { // copy whole column | qTable.length=k
						qTable[x] = sTable[x][jOfIminus1];
					}
				}

				// fill table delta
				if (i + jOfIminus1 < gSize) {

					gijOfIMinus1Preorder = aStrategy == LEFT
							? it2.info[POST2_PRE][gTreeSize - 1 - (gRevPreorder + (i - 1))]
							: gPreorder + (i - 1);

					// If Fk from Fk-1 differ with a single node,
					// then Fk without the root node is Fk-1 and the distance value has to be taken
					// from previous T table.
					if (k - 1 - 1 < 0) {
						if (aStrategy != previousStrategy) {
							previousI = aStrategy == LEFT ? IJ[i][jOfIminus1] - gPreorder
									: IJ[i][jOfIminus1] - gRevPreorder;
							setDeltaValue(it1.info[PRE2_POST][vpPreorder],
									it2.info[PRE2_POST][gijOfIMinus1Preorder],
									tTable_copy[previousI][i + jOfIminus1 - previousI], switched);
						} else {
							setDeltaValue(it1.info[PRE2_POST][vpPreorder],
									it2.info[PRE2_POST][gijOfIMinus1Preorder],
									tTable_copy[i][jOfIminus1], switched);
						}
					} else {
						setDeltaValue(it1.info[PRE2_POST][vpPreorder],
								it2.info[PRE2_POST][gijOfIMinus1Preorder],
								sTable[k - 1 - 1][jOfIminus1], switched);
					}
				}
			}

		}
		previousStrategy = aStrategy;
	}
358405
private static boolean isEquivalentDateRule(int month, int weekInMonth, int dayOfWeek, DateTimeRule dtrule) {
        if (month != dtrule.getRuleMonth() || dayOfWeek != dtrule.getRuleDayOfWeek()) {
            return false;
        }
        if (dtrule.getTimeRuleType() != DateTimeRule.WALL_TIME) {
            // Do not try to do more intelligent comparison for now.
            return false;
        }
        if (dtrule.getDateRuleType() == DateTimeRule.DOW
                && dtrule.getRuleWeekInMonth() == weekInMonth) {
            return true;
        }
        int ruleDOM = dtrule.getRuleDayOfMonth();
        if (dtrule.getDateRuleType() == DateTimeRule.DOW_GEQ_DOM) {
            if (ruleDOM%7 == 1 && (ruleDOM + 6)/7 == weekInMonth) {
                return true;
            }
            if (month != Calendar.FEBRUARY && (MONTHLENGTH[month] - ruleDOM)%7 == 6
                    && weekInMonth == -1*((MONTHLENGTH[month]-ruleDOM+1)/7)) {
                return true;
            }
        }
        if (dtrule.getDateRuleType() == DateTimeRule.DOW_LEQ_DOM) {
            if (ruleDOM%7 == 0 && ruleDOM/7 == weekInMonth) {
                return true;
            }
            if (month != Calendar.FEBRUARY && (MONTHLENGTH[month] - ruleDOM)%7 == 0
                    && weekInMonth == -1*((MONTHLENGTH[month] - ruleDOM)/7 + 1)) {
                return true;
            }
        }
        return false;
    }
1069680
public boolean isMultiDay() {

        if (m_isMultiDay != null) {
            return m_isMultiDay.booleanValue();
        }

        Long instanceDuration = getInstanceDuration();

        if ((null == instanceDuration) || (instanceDuration.longValue() == 0)) {
            m_isMultiDay = Boolean.FALSE;
            return false;
        }
        if (getInstanceDuration().longValue() > I_CmsSerialDateValue.DAY_IN_MILLIS) {
            m_isMultiDay = Boolean.TRUE;
            return true;
        }
        if (isWholeDay() && (getInstanceDuration().longValue() <= I_CmsSerialDateValue.DAY_IN_MILLIS)) {
            m_isMultiDay = Boolean.FALSE;
            return false;
        }
        Calendar start = new GregorianCalendar();
        start.setTime(m_seriesDefinition.getStart());
        Calendar end = new GregorianCalendar();
        end.setTime(m_seriesDefinition.getEnd());
        if (start.get(Calendar.DAY_OF_MONTH) == end.get(Calendar.DAY_OF_MONTH)) {
            m_isMultiDay = Boolean.FALSE;
            return false;
        }
        m_isMultiDay = Boolean.TRUE;
        return true;
    }