content
stringlengths
10
4.9M
def is_sv(entry, min_size=25): return entry_size(entry) >= min_size
def assign(self, request, pk=None): pi = self.get_object() data = request.data window_number = data.get('window') if window_number: window = Window.objects.get(pk=window_number) window.pi = pi window.save() return Response('OK')
def propSet(self): propFunList = { "general-data": dUtilityClass.extractCompData, "molecular-weight-mix": dUtilityClass.mixtureMolecularWeight, "diffusivity-coefficient-mix": 1 } propNameList = DATABASE_GENERAL_ITEMS propNameSet = self.propName compList = self.modelInput.get('components', -1) if propNameSet in propNameList: setData = self.dataSet() return np.array(propFunList['general-data'](setData, propNameSet)) elif propNameSet == "MW-MIX": setData = self.dataSet() MWi = np.array( propFunList['general-data'](setData, "MW")) MoFri = np.array(self.modelInput.get('MoFri')) return propFunList['molecular-weight-mix'](MoFri, MWi) elif propNameSet == "DiCo-MIX": setData = self.dataSet() MWi = np.array( propFunList['general-data'](setData, "MW")) Tci = np.array( propFunList['general-data'](setData, "Tc")) Pci = np.array( propFunList['general-data'](setData, "Pc")) params = { "MoFri": self.modelInput['MoFri'], "T": self.modelInput['params']['T'], "P": self.modelInput['params']['P'], "MWi": MWi, "CrTei": Tci, "CrPri": Pci } eqSet = self.modelInput.get('eq', -1) eq = 1 if eqSet == "DEFAULT" else eqSet DiCoi = calGasDiffusivity(compList, params, eq) return DiCoi elif propNameSet == "Cpp": setData = self.dataSet(DATABASE_INFO[1]['name']) T = self.modelInput['params']['T'] params = { "setData": setData } eqSet = self.modelInput.get('eq', -1) eq = 1 if eqSet == "DEFAULT" else eqSet Cppi = calHeatCapacityAtConstantPressure(compList, T, params, eq) return Cppi elif propNameSet == "Cpp-MEAN": setData = self.dataSet(DATABASE_INFO[1]['name']) T = self.modelInput['params']['T'] params = { "setData": setData } eqSet = self.modelInput.get('eq', -1) eq = 1 if eqSet == "DEFAULT" else eqSet CppiMean = calMeanHeatCapacityAtConstantPressure( compList, params, eq, T) return CppiMean elif propNameSet == "Cpp-MIX": setData = self.dataSet(DATABASE_INFO[1]['name']) T = self.modelInput['params']['T'] params = { "setData": setData } eqSet = self.modelInput.get('eq', -1) eq = 1 if eqSet == "DEFAULT" else eqSet CppiMeanInput = self.modelInput.get('Cppi-MEAN', -1) user input if CppiMeanInput == -1: CppiMean = calMeanHeatCapacityAtConstantPressure( compList, params, eq, T) else: CppiMean = np.array(CppiMeanInput) MoFri = np.array(self.modelInput.get('MoFri')) CppMix = calMixtureHeatCapacityAtConstantPressure(MoFri, CppiMean) return CppMix elif propNameSet == "Vi": setData = self.dataSet(DATABASE_INFO[3]['name']) T = self.modelInput['params']['T'] Vi = calGasViscosity(compList, T, setData) return Vi elif propNameSet == "Vi-MIX": setData = self.dataSet(DATABASE_INFO[3]['name']) setData_2 = self.dataSet() T = self.modelInput['params']['T'] ViInput = self.modelInput.get('Vi', -1) user input if ViInput == -1: Vi = calGasViscosity(compList, T, setData) else: Vi = np.array(ViInput) eqSet = self.modelInput.get('eq', -1) eq = 1 if eqSet == "DEFAULT" else eqSet MWi = np.array( propFunList['general-data'](setData_2, "MW")) MoFri = np.array(self.modelInput.get('MoFri')) params = { "Xi": Vi, "MWi": MWi, "MoFri": MoFri } ViMix = calMixPropertySelection(params, eq) return ViMix elif propNameSet == "ThCo": setData = self.dataSet(DATABASE_INFO[2]['name']) T = self.modelInput['params']['T'] ThCoi = calGasThermalConductivity(compList, T, setData) return ThCoi pass elif propNameSet == "ThCo-MIX": setData = self.dataSet(DATABASE_INFO[2]['name']) setData_2 = self.dataSet() T = self.modelInput['params']['T'] ThCoiInput = self.modelInput.get('ThCoi', -1) user input if ThCoiInput == -1: ThCoi = calGasThermalConductivity(compList, T, setData) else: ThCoi = np.array(ThCoiInput) eqSet = self.modelInput.get('eq', -1) eq = 1 if eqSet == "DEFAULT" else eqSet MWi = np.array( propFunList['general-data'](setData_2, "MW")) MoFri = np.array(self.modelInput.get('MoFri')) params = { "Xi": ThCoi, "MWi": MWi, "MoFri": MoFri } ThCoMIX = calMixPropertySelection(params, eq) return ThCoMIX else: raise Exception("property name is not valid!")
Repression of transcription initiation by Escherichia coli FNR protein: repression by FNR can be simple. Naturally occurring promoters that are repressed by the Escherichia coli FNR protein are complex. In this work, we have constructed a simple semi-synthetic promoter that is repressed by FNR binding to a single site that overlaps the promoter -35 element. Our results show that a single site for FNR is sufficient for effective repression. This semi-synthetic promoter provides a simple tool for monitoring FNR binding to target sites in the absence of its activation function. We have exploited this to study FNR mutants that are defective in repressing the ndh promoter, a complex naturally occurring promoter that is repressed by FNR.
<reponame>amosr/limp-cbc /* $Id: ClpNonLinearCost.cpp 1769 2011-07-26 09:31:51Z forrest $ */ // Copyright (C) 2002, International Business Machines // Corporation and others. All Rights Reserved. // This code is licensed under the terms of the Eclipse Public License (EPL). #include "CoinPragma.hpp" #include <iostream> #include <cassert> #include "CoinIndexedVector.hpp" #include "ClpSimplex.hpp" #include "CoinHelperFunctions.hpp" #include "ClpNonLinearCost.hpp" //############################################################################# // Constructors / Destructor / Assignment //############################################################################# //------------------------------------------------------------------- // Default Constructor //------------------------------------------------------------------- ClpNonLinearCost::ClpNonLinearCost () : changeCost_(0.0), feasibleCost_(0.0), infeasibilityWeight_(-1.0), largestInfeasibility_(0.0), sumInfeasibilities_(0.0), averageTheta_(0.0), numberRows_(0), numberColumns_(0), start_(NULL), whichRange_(NULL), offset_(NULL), lower_(NULL), cost_(NULL), model_(NULL), infeasible_(NULL), numberInfeasibilities_(-1), status_(NULL), bound_(NULL), cost2_(NULL), method_(1), convex_(true), bothWays_(false) { } //#define VALIDATE #ifdef VALIDATE static double * saveLowerV = NULL; static double * saveUpperV = NULL; #ifdef NDEBUG Validate sgould not be set if no debug #endif #endif /* Constructor from simplex. This will just set up wasteful arrays for linear, but later may do dual analysis and even finding duplicate columns */ ClpNonLinearCost::ClpNonLinearCost ( ClpSimplex * model, int method) { method = 2; model_ = model; numberRows_ = model_->numberRows(); //if (numberRows_==402) { //model_->setLogLevel(63); //model_->setMaximumIterations(30000); //} numberColumns_ = model_->numberColumns(); // If gub then we need this extra int numberExtra = model_->numberExtraRows(); if (numberExtra) method = 1; int numberTotal1 = numberRows_ + numberColumns_; int numberTotal = numberTotal1 + numberExtra; convex_ = true; bothWays_ = false; method_ = method; numberInfeasibilities_ = 0; changeCost_ = 0.0; feasibleCost_ = 0.0; infeasibilityWeight_ = -1.0; double * cost = model_->costRegion(); // check if all 0 int iSequence; bool allZero = true; for (iSequence = 0; iSequence < numberTotal1; iSequence++) { if (cost[iSequence]) { allZero = false; break; } } if (allZero&&model_->clpMatrix()->type()<15) model_->setInfeasibilityCost(1.0); double infeasibilityCost = model_->infeasibilityCost(); sumInfeasibilities_ = 0.0; averageTheta_ = 0.0; largestInfeasibility_ = 0.0; // All arrays NULL to start status_ = NULL; bound_ = NULL; cost2_ = NULL; start_ = NULL; whichRange_ = NULL; offset_ = NULL; lower_ = NULL; cost_ = NULL; infeasible_ = NULL; double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); // See how we are storing things bool always4 = (model_->clpMatrix()-> generalExpanded(model_, 10, iSequence) != 0); if (always4) method_ = 1; if (CLP_METHOD1) { start_ = new int [numberTotal+1]; whichRange_ = new int [numberTotal]; offset_ = new int [numberTotal]; memset(offset_, 0, numberTotal * sizeof(int)); // First see how much space we need int put = 0; // For quadratic we need -inf,0,0,+inf for (iSequence = 0; iSequence < numberTotal1; iSequence++) { if (!always4) { if (lower[iSequence] > -COIN_DBL_MAX) put++; if (upper[iSequence] < COIN_DBL_MAX) put++; put += 2; } else { put += 4; } } // and for extra put += 4 * numberExtra; #ifndef NDEBUG int kPut = put; #endif lower_ = new double [put]; cost_ = new double [put]; infeasible_ = new unsigned int[(put+31)>>5]; memset(infeasible_, 0, ((put + 31) >> 5)*sizeof(unsigned int)); put = 0; start_[0] = 0; for (iSequence = 0; iSequence < numberTotal1; iSequence++) { if (!always4) { if (lower[iSequence] > -COIN_DBL_MAX) { lower_[put] = -COIN_DBL_MAX; setInfeasible(put, true); cost_[put++] = cost[iSequence] - infeasibilityCost; } whichRange_[iSequence] = put; lower_[put] = lower[iSequence]; cost_[put++] = cost[iSequence]; lower_[put] = upper[iSequence]; cost_[put++] = cost[iSequence] + infeasibilityCost; if (upper[iSequence] < COIN_DBL_MAX) { lower_[put] = COIN_DBL_MAX; setInfeasible(put - 1, true); cost_[put++] = 1.0e50; } } else { lower_[put] = -COIN_DBL_MAX; setInfeasible(put, true); cost_[put++] = cost[iSequence] - infeasibilityCost; whichRange_[iSequence] = put; lower_[put] = lower[iSequence]; cost_[put++] = cost[iSequence]; lower_[put] = upper[iSequence]; cost_[put++] = cost[iSequence] + infeasibilityCost; lower_[put] = COIN_DBL_MAX; setInfeasible(put - 1, true); cost_[put++] = 1.0e50; } start_[iSequence+1] = put; } for (; iSequence < numberTotal; iSequence++) { lower_[put] = -COIN_DBL_MAX; setInfeasible(put, true); put++; whichRange_[iSequence] = put; lower_[put] = 0.0; cost_[put++] = 0.0; lower_[put] = 0.0; cost_[put++] = 0.0; lower_[put] = COIN_DBL_MAX; setInfeasible(put - 1, true); cost_[put++] = 1.0e50; start_[iSequence+1] = put; } assert (put <= kPut); } #ifdef FAST_CLPNON // See how we are storing things CoinAssert (model_->clpMatrix()-> generalExpanded(model_, 10, iSequence) == 0); #endif if (CLP_METHOD2) { assert (!numberExtra); bound_ = new double[numberTotal]; cost2_ = new double[numberTotal]; status_ = new unsigned char[numberTotal]; #ifdef VALIDATE delete [] saveLowerV; saveLowerV = CoinCopyOfArray(model_->lowerRegion(), numberTotal); delete [] saveUpperV; saveUpperV = CoinCopyOfArray(model_->upperRegion(), numberTotal); #endif for (iSequence = 0; iSequence < numberTotal; iSequence++) { bound_[iSequence] = 0.0; cost2_[iSequence] = cost[iSequence]; setInitialStatus(status_[iSequence]); } } } // Refresh - assuming regions OK void ClpNonLinearCost::refresh() { int numberTotal = numberRows_ + numberColumns_; numberInfeasibilities_ = 0; sumInfeasibilities_ = 0.0; largestInfeasibility_ = 0.0; double infeasibilityCost = model_->infeasibilityCost(); double primalTolerance = model_->currentPrimalTolerance(); double * cost = model_->costRegion(); double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); double * solution = model_->solutionRegion(); for (int iSequence = 0; iSequence < numberTotal; iSequence++) { cost2_[iSequence] = cost[iSequence]; double value = solution[iSequence]; double lowerValue = lower[iSequence]; double upperValue = upper[iSequence]; if (value - upperValue <= primalTolerance) { if (value - lowerValue >= -primalTolerance) { // feasible status_[iSequence] = static_cast<unsigned char>(CLP_FEASIBLE | (CLP_SAME << 4)); bound_[iSequence] = 0.0; } else { // below double infeasibility = lowerValue - value - primalTolerance; sumInfeasibilities_ += infeasibility; largestInfeasibility_ = CoinMax(largestInfeasibility_, infeasibility); cost[iSequence] -= infeasibilityCost; numberInfeasibilities_++; status_[iSequence] = static_cast<unsigned char>(CLP_BELOW_LOWER | (CLP_SAME << 4)); bound_[iSequence] = upperValue; upper[iSequence] = lowerValue; lower[iSequence] = -COIN_DBL_MAX; } } else { // above double infeasibility = value - upperValue - primalTolerance; sumInfeasibilities_ += infeasibility; largestInfeasibility_ = CoinMax(largestInfeasibility_, infeasibility); cost[iSequence] += infeasibilityCost; numberInfeasibilities_++; status_[iSequence] = static_cast<unsigned char>(CLP_ABOVE_UPPER | (CLP_SAME << 4)); bound_[iSequence] = lowerValue; lower[iSequence] = upperValue; upper[iSequence] = COIN_DBL_MAX; } } // checkInfeasibilities(model_->primalTolerance()); } // Refreshes costs always makes row costs zero void ClpNonLinearCost::refreshCosts(const double * columnCosts) { double * cost = model_->costRegion(); // zero row costs memset(cost + numberColumns_, 0, numberRows_ * sizeof(double)); // copy column costs CoinMemcpyN(columnCosts, numberColumns_, cost); if ((method_ & 1) != 0) { for (int iSequence = 0; iSequence < numberRows_ + numberColumns_; iSequence++) { int start = start_[iSequence]; int end = start_[iSequence+1] - 1; double thisFeasibleCost = cost[iSequence]; if (infeasible(start)) { cost_[start] = thisFeasibleCost - infeasibilityWeight_; cost_[start+1] = thisFeasibleCost; } else { cost_[start] = thisFeasibleCost; } if (infeasible(end - 1)) { cost_[end-1] = thisFeasibleCost + infeasibilityWeight_; } } } if (CLP_METHOD2) { for (int iSequence = 0; iSequence < numberRows_ + numberColumns_; iSequence++) { cost2_[iSequence] = cost[iSequence]; } } } ClpNonLinearCost::ClpNonLinearCost(ClpSimplex * model, const int * starts, const double * lowerNon, const double * costNon) { #ifndef FAST_CLPNON // what about scaling? - only try without it initially assert(!model->scalingFlag()); model_ = model; numberRows_ = model_->numberRows(); numberColumns_ = model_->numberColumns(); int numberTotal = numberRows_ + numberColumns_; convex_ = true; bothWays_ = true; start_ = new int [numberTotal+1]; whichRange_ = new int [numberTotal]; offset_ = new int [numberTotal]; memset(offset_, 0, numberTotal * sizeof(int)); double whichWay = model_->optimizationDirection(); COIN_DETAIL_PRINT(printf("Direction %g\n", whichWay)); numberInfeasibilities_ = 0; changeCost_ = 0.0; feasibleCost_ = 0.0; double infeasibilityCost = model_->infeasibilityCost(); infeasibilityWeight_ = infeasibilityCost;; largestInfeasibility_ = 0.0; sumInfeasibilities_ = 0.0; int iSequence; assert (!model_->rowObjective()); double * cost = model_->objective(); // First see how much space we need // Also set up feasible bounds int put = starts[numberColumns_]; double * columnUpper = model_->columnUpper(); double * columnLower = model_->columnLower(); for (iSequence = 0; iSequence < numberColumns_; iSequence++) { if (columnLower[iSequence] > -1.0e20) put++; if (columnUpper[iSequence] < 1.0e20) put++; } double * rowUpper = model_->rowUpper(); double * rowLower = model_->rowLower(); for (iSequence = 0; iSequence < numberRows_; iSequence++) { if (rowLower[iSequence] > -1.0e20) put++; if (rowUpper[iSequence] < 1.0e20) put++; put += 2; } lower_ = new double [put]; cost_ = new double [put]; infeasible_ = new unsigned int[(put+31)>>5]; memset(infeasible_, 0, ((put + 31) >> 5)*sizeof(unsigned int)); // now fill in put = 0; start_[0] = 0; for (iSequence = 0; iSequence < numberTotal; iSequence++) { lower_[put] = -COIN_DBL_MAX; whichRange_[iSequence] = put + 1; double thisCost; double lowerValue; double upperValue; if (iSequence >= numberColumns_) { // rows lowerValue = rowLower[iSequence-numberColumns_]; upperValue = rowUpper[iSequence-numberColumns_]; if (lowerValue > -1.0e30) { setInfeasible(put, true); cost_[put++] = -infeasibilityCost; lower_[put] = lowerValue; } cost_[put++] = 0.0; thisCost = 0.0; } else { // columns - move costs and see if convex lowerValue = columnLower[iSequence]; upperValue = columnUpper[iSequence]; if (lowerValue > -1.0e30) { setInfeasible(put, true); cost_[put++] = whichWay * cost[iSequence] - infeasibilityCost; lower_[put] = lowerValue; } int iIndex = starts[iSequence]; int end = starts[iSequence+1]; assert (fabs(columnLower[iSequence] - lowerNon[iIndex]) < 1.0e-8); thisCost = -COIN_DBL_MAX; for (; iIndex < end; iIndex++) { if (lowerNon[iIndex] < columnUpper[iSequence] - 1.0e-8) { lower_[put] = lowerNon[iIndex]; cost_[put++] = whichWay * costNon[iIndex]; // check convexity if (whichWay * costNon[iIndex] < thisCost - 1.0e-12) convex_ = false; thisCost = whichWay * costNon[iIndex]; } else { break; } } } lower_[put] = upperValue; setInfeasible(put, true); cost_[put++] = thisCost + infeasibilityCost; if (upperValue < 1.0e20) { lower_[put] = COIN_DBL_MAX; cost_[put++] = 1.0e50; } int iFirst = start_[iSequence]; if (lower_[iFirst] != -COIN_DBL_MAX) { setInfeasible(iFirst, true); whichRange_[iSequence] = iFirst + 1; } else { whichRange_[iSequence] = iFirst; } start_[iSequence+1] = put; } // can't handle non-convex at present assert(convex_); status_ = NULL; bound_ = NULL; cost2_ = NULL; method_ = 1; #else printf("recompile ClpNonLinearCost without FAST_CLPNON\n"); abort(); #endif } //------------------------------------------------------------------- // Copy constructor //------------------------------------------------------------------- ClpNonLinearCost::ClpNonLinearCost (const ClpNonLinearCost & rhs) : changeCost_(0.0), feasibleCost_(0.0), infeasibilityWeight_(-1.0), largestInfeasibility_(0.0), sumInfeasibilities_(0.0), averageTheta_(0.0), numberRows_(rhs.numberRows_), numberColumns_(rhs.numberColumns_), start_(NULL), whichRange_(NULL), offset_(NULL), lower_(NULL), cost_(NULL), model_(NULL), infeasible_(NULL), numberInfeasibilities_(-1), status_(NULL), bound_(NULL), cost2_(NULL), method_(rhs.method_), convex_(true), bothWays_(rhs.bothWays_) { if (numberRows_) { int numberTotal = numberRows_ + numberColumns_; model_ = rhs.model_; numberInfeasibilities_ = rhs.numberInfeasibilities_; changeCost_ = rhs.changeCost_; feasibleCost_ = rhs.feasibleCost_; infeasibilityWeight_ = rhs.infeasibilityWeight_; largestInfeasibility_ = rhs.largestInfeasibility_; sumInfeasibilities_ = rhs.sumInfeasibilities_; averageTheta_ = rhs.averageTheta_; convex_ = rhs.convex_; if (CLP_METHOD1) { start_ = new int [numberTotal+1]; CoinMemcpyN(rhs.start_, (numberTotal + 1), start_); whichRange_ = new int [numberTotal]; CoinMemcpyN(rhs.whichRange_, numberTotal, whichRange_); offset_ = new int [numberTotal]; CoinMemcpyN(rhs.offset_, numberTotal, offset_); int numberEntries = start_[numberTotal]; lower_ = new double [numberEntries]; CoinMemcpyN(rhs.lower_, numberEntries, lower_); cost_ = new double [numberEntries]; CoinMemcpyN(rhs.cost_, numberEntries, cost_); infeasible_ = new unsigned int[(numberEntries+31)>>5]; CoinMemcpyN(rhs.infeasible_, ((numberEntries + 31) >> 5), infeasible_); } if (CLP_METHOD2) { bound_ = CoinCopyOfArray(rhs.bound_, numberTotal); cost2_ = CoinCopyOfArray(rhs.cost2_, numberTotal); status_ = CoinCopyOfArray(rhs.status_, numberTotal); } } } //------------------------------------------------------------------- // Destructor //------------------------------------------------------------------- ClpNonLinearCost::~ClpNonLinearCost () { delete [] start_; delete [] whichRange_; delete [] offset_; delete [] lower_; delete [] cost_; delete [] infeasible_; delete [] status_; delete [] bound_; delete [] cost2_; } //---------------------------------------------------------------- // Assignment operator //------------------------------------------------------------------- ClpNonLinearCost & ClpNonLinearCost::operator=(const ClpNonLinearCost& rhs) { if (this != &rhs) { numberRows_ = rhs.numberRows_; numberColumns_ = rhs.numberColumns_; delete [] start_; delete [] whichRange_; delete [] offset_; delete [] lower_; delete [] cost_; delete [] infeasible_; delete [] status_; delete [] bound_; delete [] cost2_; start_ = NULL; whichRange_ = NULL; lower_ = NULL; cost_ = NULL; infeasible_ = NULL; status_ = NULL; bound_ = NULL; cost2_ = NULL; method_ = rhs.method_; if (numberRows_) { int numberTotal = numberRows_ + numberColumns_; if (CLP_METHOD1) { start_ = new int [numberTotal+1]; CoinMemcpyN(rhs.start_, (numberTotal + 1), start_); whichRange_ = new int [numberTotal]; CoinMemcpyN(rhs.whichRange_, numberTotal, whichRange_); offset_ = new int [numberTotal]; CoinMemcpyN(rhs.offset_, numberTotal, offset_); int numberEntries = start_[numberTotal]; lower_ = new double [numberEntries]; CoinMemcpyN(rhs.lower_, numberEntries, lower_); cost_ = new double [numberEntries]; CoinMemcpyN(rhs.cost_, numberEntries, cost_); infeasible_ = new unsigned int[(numberEntries+31)>>5]; CoinMemcpyN(rhs.infeasible_, ((numberEntries + 31) >> 5), infeasible_); } if (CLP_METHOD2) { bound_ = CoinCopyOfArray(rhs.bound_, numberTotal); cost2_ = CoinCopyOfArray(rhs.cost2_, numberTotal); status_ = CoinCopyOfArray(rhs.status_, numberTotal); } } model_ = rhs.model_; numberInfeasibilities_ = rhs.numberInfeasibilities_; changeCost_ = rhs.changeCost_; feasibleCost_ = rhs.feasibleCost_; infeasibilityWeight_ = rhs.infeasibilityWeight_; largestInfeasibility_ = rhs.largestInfeasibility_; sumInfeasibilities_ = rhs.sumInfeasibilities_; averageTheta_ = rhs.averageTheta_; convex_ = rhs.convex_; bothWays_ = rhs.bothWays_; } return *this; } // Changes infeasible costs and computes number and cost of infeas // We will need to re-think objective offsets later // We will also need a 2 bit per variable array for some // purpose which will come to me later void ClpNonLinearCost::checkInfeasibilities(double oldTolerance) { numberInfeasibilities_ = 0; double infeasibilityCost = model_->infeasibilityCost(); changeCost_ = 0.0; largestInfeasibility_ = 0.0; sumInfeasibilities_ = 0.0; double primalTolerance = model_->currentPrimalTolerance(); int iSequence; double * solution = model_->solutionRegion(); double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); double * cost = model_->costRegion(); bool toNearest = oldTolerance <= 0.0; feasibleCost_ = 0.0; //bool checkCosts = (infeasibilityWeight_ != infeasibilityCost); infeasibilityWeight_ = infeasibilityCost; int numberTotal = numberColumns_ + numberRows_; //#define NONLIN_DEBUG #ifdef NONLIN_DEBUG double * saveSolution = NULL; double * saveLower = NULL; double * saveUpper = NULL; unsigned char * saveStatus = NULL; if (method_ == 3) { // Save solution as we will be checking saveSolution = CoinCopyOfArray(solution, numberTotal); saveLower = CoinCopyOfArray(lower, numberTotal); saveUpper = CoinCopyOfArray(upper, numberTotal); saveStatus = CoinCopyOfArray(model_->statusArray(), numberTotal); } #else assert (method_ != 3); #endif if (CLP_METHOD1) { // nonbasic should be at a valid bound for (iSequence = 0; iSequence < numberTotal; iSequence++) { double lowerValue; double upperValue; double value = solution[iSequence]; int iRange; // get correct place int start = start_[iSequence]; int end = start_[iSequence+1] - 1; // correct costs for this infeasibility weight // If free then true cost will be first double thisFeasibleCost = cost_[start]; if (infeasible(start)) { thisFeasibleCost = cost_[start+1]; cost_[start] = thisFeasibleCost - infeasibilityCost; } if (infeasible(end - 1)) { thisFeasibleCost = cost_[end-2]; cost_[end-1] = thisFeasibleCost + infeasibilityCost; } for (iRange = start; iRange < end; iRange++) { if (value < lower_[iRange+1] + primalTolerance) { // put in better range if infeasible if (value >= lower_[iRange+1] - primalTolerance && infeasible(iRange) && iRange == start) iRange++; whichRange_[iSequence] = iRange; break; } } assert(iRange < end); lowerValue = lower_[iRange]; upperValue = lower_[iRange+1]; ClpSimplex::Status status = model_->getStatus(iSequence); if (upperValue == lowerValue && status != ClpSimplex::isFixed) { if (status != ClpSimplex::basic) { model_->setStatus(iSequence, ClpSimplex::isFixed); status = ClpSimplex::isFixed; } } //#define PRINT_DETAIL7 2 #if PRINT_DETAIL7>1 printf("NL %d sol %g bounds %g %g\n", iSequence,solution[iSequence], lowerValue,upperValue); #endif switch(status) { case ClpSimplex::basic: case ClpSimplex::superBasic: // iRange is in correct place // slot in here if (infeasible(iRange)) { if (lower_[iRange] < -1.0e50) { //cost_[iRange] = cost_[iRange+1]-infeasibilityCost; // possibly below lowerValue = lower_[iRange+1]; if (value - lowerValue < -primalTolerance) { value = lowerValue - value - primalTolerance; #ifndef NDEBUG if(value > 1.0e15) printf("nonlincostb %d %g %g %g\n", iSequence, lowerValue, solution[iSequence], lower_[iRange+2]); #endif #if PRINT_DETAIL7 printf("**NL %d sol %g below %g\n", iSequence,solution[iSequence], lowerValue); #endif sumInfeasibilities_ += value; largestInfeasibility_ = CoinMax(largestInfeasibility_, value); changeCost_ -= lowerValue * (cost_[iRange] - cost[iSequence]); numberInfeasibilities_++; } } else { //cost_[iRange] = cost_[iRange-1]+infeasibilityCost; // possibly above upperValue = lower_[iRange]; if (value - upperValue > primalTolerance) { value = value - upperValue - primalTolerance; #ifndef NDEBUG if(value > 1.0e15) printf("nonlincostu %d %g %g %g\n", iSequence, lower_[iRange-1], solution[iSequence], upperValue); #endif #if PRINT_DETAIL7 printf("**NL %d sol %g above %g\n", iSequence,solution[iSequence], upperValue); #endif sumInfeasibilities_ += value; largestInfeasibility_ = CoinMax(largestInfeasibility_, value); changeCost_ -= upperValue * (cost_[iRange] - cost[iSequence]); numberInfeasibilities_++; } } } //lower[iSequence] = lower_[iRange]; //upper[iSequence] = lower_[iRange+1]; //cost[iSequence] = cost_[iRange]; break; case ClpSimplex::isFree: //if (toNearest) //solution[iSequence] = 0.0; break; case ClpSimplex::atUpperBound: if (!toNearest) { // With increasing tolerances - we may be at wrong place if (fabs(value - upperValue) > oldTolerance * 1.0001) { if (fabs(value - lowerValue) <= oldTolerance * 1.0001) { if (fabs(value - lowerValue) > primalTolerance) solution[iSequence] = lowerValue; model_->setStatus(iSequence, ClpSimplex::atLowerBound); } else { model_->setStatus(iSequence, ClpSimplex::superBasic); } } else if (fabs(value - upperValue) > primalTolerance) { solution[iSequence] = upperValue; } } else { // Set to nearest and make at upper bound int kRange; iRange = -1; double nearest = COIN_DBL_MAX; for (kRange = start; kRange < end; kRange++) { if (fabs(lower_[kRange] - value) < nearest) { nearest = fabs(lower_[kRange] - value); iRange = kRange; } } assert (iRange >= 0); iRange--; whichRange_[iSequence] = iRange; solution[iSequence] = lower_[iRange+1]; } break; case ClpSimplex::atLowerBound: if (!toNearest) { // With increasing tolerances - we may be at wrong place // below stops compiler error with gcc 3.2!!! if (iSequence == -119) printf("ZZ %g %g %g %g\n", lowerValue, value, upperValue, oldTolerance); if (fabs(value - lowerValue) > oldTolerance * 1.0001) { if (fabs(value - upperValue) <= oldTolerance * 1.0001) { if (fabs(value - upperValue) > primalTolerance) solution[iSequence] = upperValue; model_->setStatus(iSequence, ClpSimplex::atUpperBound); } else { model_->setStatus(iSequence, ClpSimplex::superBasic); } } else if (fabs(value - lowerValue) > primalTolerance) { solution[iSequence] = lowerValue; } } else { // Set to nearest and make at lower bound int kRange; iRange = -1; double nearest = COIN_DBL_MAX; for (kRange = start; kRange < end; kRange++) { if (fabs(lower_[kRange] - value) < nearest) { nearest = fabs(lower_[kRange] - value); iRange = kRange; } } assert (iRange >= 0); whichRange_[iSequence] = iRange; solution[iSequence] = lower_[iRange]; } break; case ClpSimplex::isFixed: if (toNearest) { // Set to true fixed for (iRange = start; iRange < end; iRange++) { if (lower_[iRange] == lower_[iRange+1]) break; } if (iRange == end) { // Odd - but make sensible // Set to nearest and make at lower bound int kRange; iRange = -1; double nearest = COIN_DBL_MAX; for (kRange = start; kRange < end; kRange++) { if (fabs(lower_[kRange] - value) < nearest) { nearest = fabs(lower_[kRange] - value); iRange = kRange; } } assert (iRange >= 0); whichRange_[iSequence] = iRange; if (lower_[iRange] != lower_[iRange+1]) model_->setStatus(iSequence, ClpSimplex::atLowerBound); else model_->setStatus(iSequence, ClpSimplex::atUpperBound); } solution[iSequence] = lower_[iRange]; } break; } lower[iSequence] = lower_[iRange]; upper[iSequence] = lower_[iRange+1]; cost[iSequence] = cost_[iRange]; feasibleCost_ += thisFeasibleCost * solution[iSequence]; //assert (iRange==whichRange_[iSequence]); } } #ifdef NONLIN_DEBUG double saveCost = feasibleCost_; if (method_ == 3) { feasibleCost_ = 0.0; // Put back solution as we will be checking unsigned char * statusA = model_->statusArray(); for (iSequence = 0; iSequence < numberTotal; iSequence++) { double value = solution[iSequence]; solution[iSequence] = saveSolution[iSequence]; saveSolution[iSequence] = value; value = lower[iSequence]; lower[iSequence] = saveLower[iSequence]; saveLower[iSequence] = value; value = upper[iSequence]; upper[iSequence] = saveUpper[iSequence]; saveUpper[iSequence] = value; unsigned char value2 = statusA[iSequence]; statusA[iSequence] = saveStatus[iSequence]; saveStatus[iSequence] = value2; } } #endif if (CLP_METHOD2) { //#define CLP_NON_JUST_BASIC #ifndef CLP_NON_JUST_BASIC // nonbasic should be at a valid bound for (iSequence = 0; iSequence < numberTotal; iSequence++) { #else const int * pivotVariable = model_->pivotVariable(); for (int i=0;i<numberRows_;i++) { int iSequence = pivotVariable[i]; #endif double value = solution[iSequence]; unsigned char iStatus = status_[iSequence]; assert (currentStatus(iStatus) == CLP_SAME); double lowerValue = lower[iSequence]; double upperValue = upper[iSequence]; double costValue = cost2_[iSequence]; double trueCost = costValue; int iWhere = originalStatus(iStatus); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; costValue -= infeasibilityCost; } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; costValue += infeasibilityCost; } // get correct place int newWhere = CLP_FEASIBLE; ClpSimplex::Status status = model_->getStatus(iSequence); if (upperValue == lowerValue && status != ClpSimplex::isFixed) { if (status != ClpSimplex::basic) { model_->setStatus(iSequence, ClpSimplex::isFixed); status = ClpSimplex::isFixed; } } switch(status) { case ClpSimplex::basic: case ClpSimplex::superBasic: if (value - upperValue <= primalTolerance) { if (value - lowerValue >= -primalTolerance) { // feasible //newWhere=CLP_FEASIBLE; } else { // below newWhere = CLP_BELOW_LOWER; assert (fabs(lowerValue) < 1.0e100); double infeasibility = lowerValue - value - primalTolerance; sumInfeasibilities_ += infeasibility; largestInfeasibility_ = CoinMax(largestInfeasibility_, infeasibility); costValue = trueCost - infeasibilityCost; changeCost_ -= lowerValue * (costValue - cost[iSequence]); numberInfeasibilities_++; } } else { // above newWhere = CLP_ABOVE_UPPER; double infeasibility = value - upperValue - primalTolerance; sumInfeasibilities_ += infeasibility; largestInfeasibility_ = CoinMax(largestInfeasibility_, infeasibility); costValue = trueCost + infeasibilityCost; changeCost_ -= upperValue * (costValue - cost[iSequence]); numberInfeasibilities_++; } break; case ClpSimplex::isFree: break; case ClpSimplex::atUpperBound: if (!toNearest) { // With increasing tolerances - we may be at wrong place if (fabs(value - upperValue) > oldTolerance * 1.0001) { if (fabs(value - lowerValue) <= oldTolerance * 1.0001) { if (fabs(value - lowerValue) > primalTolerance) { solution[iSequence] = lowerValue; value = lowerValue; } model_->setStatus(iSequence, ClpSimplex::atLowerBound); } else { if (value < upperValue) { if (value > lowerValue) { model_->setStatus(iSequence, ClpSimplex::superBasic); } else { // set to lower bound as infeasible solution[iSequence] = lowerValue; value = lowerValue; model_->setStatus(iSequence, ClpSimplex::atLowerBound); } } else { // set to upper bound as infeasible solution[iSequence] = upperValue; value = upperValue; } } } else if (fabs(value - upperValue) > primalTolerance) { solution[iSequence] = upperValue; value = upperValue; } } else { // Set to nearest and make at bound if (fabs(value - lowerValue) < fabs(value - upperValue)) { solution[iSequence] = lowerValue; value = lowerValue; model_->setStatus(iSequence, ClpSimplex::atLowerBound); } else { solution[iSequence] = upperValue; value = upperValue; } } break; case ClpSimplex::atLowerBound: if (!toNearest) { // With increasing tolerances - we may be at wrong place if (fabs(value - lowerValue) > oldTolerance * 1.0001) { if (fabs(value - upperValue) <= oldTolerance * 1.0001) { if (fabs(value - upperValue) > primalTolerance) { solution[iSequence] = upperValue; value = upperValue; } model_->setStatus(iSequence, ClpSimplex::atUpperBound); } else { if (value < upperValue) { if (value > lowerValue) { model_->setStatus(iSequence, ClpSimplex::superBasic); } else { // set to lower bound as infeasible solution[iSequence] = lowerValue; value = lowerValue; } } else { // set to upper bound as infeasible solution[iSequence] = upperValue; value = upperValue; model_->setStatus(iSequence, ClpSimplex::atUpperBound); } } } else if (fabs(value - lowerValue) > primalTolerance) { solution[iSequence] = lowerValue; value = lowerValue; } } else { // Set to nearest and make at bound if (fabs(value - lowerValue) < fabs(value - upperValue)) { solution[iSequence] = lowerValue; value = lowerValue; } else { solution[iSequence] = upperValue; value = upperValue; model_->setStatus(iSequence, ClpSimplex::atUpperBound); } } break; case ClpSimplex::isFixed: solution[iSequence] = lowerValue; value = lowerValue; break; } #ifdef NONLIN_DEBUG double lo = saveLower[iSequence]; double up = saveUpper[iSequence]; double cc = cost[iSequence]; unsigned char ss = saveStatus[iSequence]; unsigned char snow = model_->statusArray()[iSequence]; #endif if (iWhere != newWhere) { setOriginalStatus(status_[iSequence], newWhere); if (newWhere == CLP_BELOW_LOWER) { bound_[iSequence] = upperValue; upperValue = lowerValue; lowerValue = -COIN_DBL_MAX; costValue = trueCost - infeasibilityCost; } else if (newWhere == CLP_ABOVE_UPPER) { bound_[iSequence] = lowerValue; lowerValue = upperValue; upperValue = COIN_DBL_MAX; costValue = trueCost + infeasibilityCost; } else { costValue = trueCost; } lower[iSequence] = lowerValue; upper[iSequence] = upperValue; } // always do as other things may change cost[iSequence] = costValue; #ifdef NONLIN_DEBUG if (method_ == 3) { assert (ss == snow); assert (cc == cost[iSequence]); assert (lo == lower[iSequence]); assert (up == upper[iSequence]); assert (value == saveSolution[iSequence]); } #endif feasibleCost_ += trueCost * value; } } #ifdef NONLIN_DEBUG if (method_ == 3) assert (fabs(saveCost - feasibleCost_) < 0.001 * (1.0 + CoinMax(fabs(saveCost), fabs(feasibleCost_)))); delete [] saveSolution; delete [] saveLower; delete [] saveUpper; delete [] saveStatus; #endif //feasibleCost_ /= (model_->rhsScale()*model_->objScale()); } // Puts feasible bounds into lower and upper void ClpNonLinearCost::feasibleBounds() { if (CLP_METHOD2) { int iSequence; double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); double * cost = model_->costRegion(); int numberTotal = numberColumns_ + numberRows_; for (iSequence = 0; iSequence < numberTotal; iSequence++) { unsigned char iStatus = status_[iSequence]; assert (currentStatus(iStatus) == CLP_SAME); double lowerValue = lower[iSequence]; double upperValue = upper[iSequence]; double costValue = cost2_[iSequence]; int iWhere = originalStatus(iStatus); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; assert (fabs(lowerValue) < 1.0e100); } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; } setOriginalStatus(status_[iSequence], CLP_FEASIBLE); lower[iSequence] = lowerValue; upper[iSequence] = upperValue; cost[iSequence] = costValue; } } } /* Goes through one bound for each variable. If array[i]*multiplier>0 goes down, otherwise up. The indices are row indices and need converting to sequences */ void ClpNonLinearCost::goThru(int numberInArray, double multiplier, const int * index, const double * array, double * rhs) { assert (model_ != NULL); abort(); const int * pivotVariable = model_->pivotVariable(); if (CLP_METHOD1) { for (int i = 0; i < numberInArray; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; double alpha = multiplier * array[iRow]; // get where in bound sequence int iRange = whichRange_[iSequence]; iRange += offset_[iSequence]; //add temporary bias double value = model_->solution(iSequence); if (alpha > 0.0) { // down one iRange--; assert(iRange >= start_[iSequence]); rhs[iRow] = value - lower_[iRange]; } else { // up one iRange++; assert(iRange < start_[iSequence+1] - 1); rhs[iRow] = lower_[iRange+1] - value; } offset_[iSequence] = iRange - whichRange_[iSequence]; } } #ifdef NONLIN_DEBUG double * saveRhs = NULL; if (method_ == 3) { int numberRows = model_->numberRows(); saveRhs = CoinCopyOfArray(rhs, numberRows); } #endif if (CLP_METHOD2) { const double * solution = model_->solutionRegion(); const double * upper = model_->upperRegion(); const double * lower = model_->lowerRegion(); for (int i = 0; i < numberInArray; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; double alpha = multiplier * array[iRow]; double value = solution[iSequence]; unsigned char iStatus = status_[iSequence]; int iWhere = currentStatus(iStatus); if (iWhere == CLP_SAME) iWhere = originalStatus(iStatus); if (iWhere == CLP_FEASIBLE) { if (alpha > 0.0) { // going below iWhere = CLP_BELOW_LOWER; rhs[iRow] = value - lower[iSequence]; } else { // going above iWhere = CLP_ABOVE_UPPER; rhs[iRow] = upper[iSequence] - value; } } else if(iWhere == CLP_BELOW_LOWER) { assert (alpha < 0); // going feasible iWhere = CLP_FEASIBLE; rhs[iRow] = upper[iSequence] - value; } else { assert (iWhere == CLP_ABOVE_UPPER); // going feasible iWhere = CLP_FEASIBLE; rhs[iRow] = value - lower[iSequence]; } #ifdef NONLIN_DEBUG if (method_ == 3) assert (rhs[iRow] == saveRhs[iRow]); #endif setCurrentStatus(status_[iSequence], iWhere); } } #ifdef NONLIN_DEBUG delete [] saveRhs; #endif } /* Takes off last iteration (i.e. offsets closer to 0) */ void ClpNonLinearCost::goBack(int numberInArray, const int * index, double * rhs) { assert (model_ != NULL); abort(); const int * pivotVariable = model_->pivotVariable(); if (CLP_METHOD1) { for (int i = 0; i < numberInArray; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; // get where in bound sequence int iRange = whichRange_[iSequence]; // get closer to original if (offset_[iSequence] > 0) { offset_[iSequence]--; assert (offset_[iSequence] >= 0); iRange += offset_[iSequence]; //add temporary bias double value = model_->solution(iSequence); // up one assert(iRange < start_[iSequence+1] - 1); rhs[iRow] = lower_[iRange+1] - value; // was earlier lower_[iRange] } else { offset_[iSequence]++; assert (offset_[iSequence] <= 0); iRange += offset_[iSequence]; //add temporary bias double value = model_->solution(iSequence); // down one assert(iRange >= start_[iSequence]); rhs[iRow] = value - lower_[iRange]; // was earlier lower_[iRange+1] } } } #ifdef NONLIN_DEBUG double * saveRhs = NULL; if (method_ == 3) { int numberRows = model_->numberRows(); saveRhs = CoinCopyOfArray(rhs, numberRows); } #endif if (CLP_METHOD2) { const double * solution = model_->solutionRegion(); const double * upper = model_->upperRegion(); const double * lower = model_->lowerRegion(); for (int i = 0; i < numberInArray; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; double value = solution[iSequence]; unsigned char iStatus = status_[iSequence]; int iWhere = currentStatus(iStatus); int original = originalStatus(iStatus); assert (iWhere != CLP_SAME); if (iWhere == CLP_FEASIBLE) { if (original == CLP_BELOW_LOWER) { // going below iWhere = CLP_BELOW_LOWER; rhs[iRow] = lower[iSequence] - value; } else { // going above iWhere = CLP_ABOVE_UPPER; rhs[iRow] = value - upper[iSequence]; } } else if(iWhere == CLP_BELOW_LOWER) { // going feasible iWhere = CLP_FEASIBLE; rhs[iRow] = value - upper[iSequence]; } else { // going feasible iWhere = CLP_FEASIBLE; rhs[iRow] = lower[iSequence] - value; } #ifdef NONLIN_DEBUG if (method_ == 3) assert (rhs[iRow] == saveRhs[iRow]); #endif setCurrentStatus(status_[iSequence], iWhere); } } #ifdef NONLIN_DEBUG delete [] saveRhs; #endif } void ClpNonLinearCost::goBackAll(const CoinIndexedVector * update) { assert (model_ != NULL); const int * pivotVariable = model_->pivotVariable(); int number = update->getNumElements(); const int * index = update->getIndices(); if (CLP_METHOD1) { for (int i = 0; i < number; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; offset_[iSequence] = 0; } #ifdef CLP_DEBUG for (i = 0; i < numberRows_ + numberColumns_; i++) assert(!offset_[i]); #endif } if (CLP_METHOD2) { for (int i = 0; i < number; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; setSameStatus(status_[iSequence]); } } } void ClpNonLinearCost::checkInfeasibilities(int numberInArray, const int * index) { assert (model_ != NULL); double primalTolerance = model_->currentPrimalTolerance(); const int * pivotVariable = model_->pivotVariable(); if (CLP_METHOD1) { for (int i = 0; i < numberInArray; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; // get where in bound sequence int iRange; int currentRange = whichRange_[iSequence]; double value = model_->solution(iSequence); int start = start_[iSequence]; int end = start_[iSequence+1] - 1; for (iRange = start; iRange < end; iRange++) { if (value < lower_[iRange+1] + primalTolerance) { // put in better range if (value >= lower_[iRange+1] - primalTolerance && infeasible(iRange) && iRange == start) iRange++; break; } } assert(iRange < end); assert(model_->getStatus(iSequence) == ClpSimplex::basic); double & lower = model_->lowerAddress(iSequence); double & upper = model_->upperAddress(iSequence); double & cost = model_->costAddress(iSequence); whichRange_[iSequence] = iRange; if (iRange != currentRange) { if (infeasible(iRange)) numberInfeasibilities_++; if (infeasible(currentRange)) numberInfeasibilities_--; } lower = lower_[iRange]; upper = lower_[iRange+1]; cost = cost_[iRange]; } } if (CLP_METHOD2) { double * solution = model_->solutionRegion(); double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); double * cost = model_->costRegion(); for (int i = 0; i < numberInArray; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; double value = solution[iSequence]; unsigned char iStatus = status_[iSequence]; assert (currentStatus(iStatus) == CLP_SAME); double lowerValue = lower[iSequence]; double upperValue = upper[iSequence]; double costValue = cost2_[iSequence]; int iWhere = originalStatus(iStatus); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; numberInfeasibilities_--; assert (fabs(lowerValue) < 1.0e100); } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; numberInfeasibilities_--; } // get correct place int newWhere = CLP_FEASIBLE; if (value - upperValue <= primalTolerance) { if (value - lowerValue >= -primalTolerance) { // feasible //newWhere=CLP_FEASIBLE; } else { // below newWhere = CLP_BELOW_LOWER; assert (fabs(lowerValue) < 1.0e100); costValue -= infeasibilityWeight_; numberInfeasibilities_++; } } else { // above newWhere = CLP_ABOVE_UPPER; costValue += infeasibilityWeight_; numberInfeasibilities_++; } if (iWhere != newWhere) { setOriginalStatus(status_[iSequence], newWhere); if (newWhere == CLP_BELOW_LOWER) { bound_[iSequence] = upperValue; upperValue = lowerValue; lowerValue = -COIN_DBL_MAX; } else if (newWhere == CLP_ABOVE_UPPER) { bound_[iSequence] = lowerValue; lowerValue = upperValue; upperValue = COIN_DBL_MAX; } lower[iSequence] = lowerValue; upper[iSequence] = upperValue; cost[iSequence] = costValue; } } } } /* Puts back correct infeasible costs for each variable The input indices are row indices and need converting to sequences for costs. On input array is empty (but indices exist). On exit just changed costs will be stored as normal CoinIndexedVector */ void ClpNonLinearCost::checkChanged(int numberInArray, CoinIndexedVector * update) { assert (model_ != NULL); double primalTolerance = model_->currentPrimalTolerance(); const int * pivotVariable = model_->pivotVariable(); int number = 0; int * index = update->getIndices(); double * work = update->denseVector(); if (CLP_METHOD1) { for (int i = 0; i < numberInArray; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; // get where in bound sequence int iRange; double value = model_->solution(iSequence); int start = start_[iSequence]; int end = start_[iSequence+1] - 1; for (iRange = start; iRange < end; iRange++) { if (value < lower_[iRange+1] + primalTolerance) { // put in better range if (value >= lower_[iRange+1] - primalTolerance && infeasible(iRange) && iRange == start) iRange++; break; } } assert(iRange < end); assert(model_->getStatus(iSequence) == ClpSimplex::basic); int jRange = whichRange_[iSequence]; if (iRange != jRange) { // changed work[iRow] = cost_[jRange] - cost_[iRange]; index[number++] = iRow; double & lower = model_->lowerAddress(iSequence); double & upper = model_->upperAddress(iSequence); double & cost = model_->costAddress(iSequence); whichRange_[iSequence] = iRange; if (infeasible(iRange)) numberInfeasibilities_++; if (infeasible(jRange)) numberInfeasibilities_--; lower = lower_[iRange]; upper = lower_[iRange+1]; cost = cost_[iRange]; } } } if (CLP_METHOD2) { double * solution = model_->solutionRegion(); double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); double * cost = model_->costRegion(); for (int i = 0; i < numberInArray; i++) { int iRow = index[i]; int iSequence = pivotVariable[iRow]; double value = solution[iSequence]; unsigned char iStatus = status_[iSequence]; assert (currentStatus(iStatus) == CLP_SAME); double lowerValue = lower[iSequence]; double upperValue = upper[iSequence]; double costValue = cost2_[iSequence]; int iWhere = originalStatus(iStatus); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; numberInfeasibilities_--; assert (fabs(lowerValue) < 1.0e100); } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; numberInfeasibilities_--; } // get correct place int newWhere = CLP_FEASIBLE; if (value - upperValue <= primalTolerance) { if (value - lowerValue >= -primalTolerance) { // feasible //newWhere=CLP_FEASIBLE; } else { // below newWhere = CLP_BELOW_LOWER; costValue -= infeasibilityWeight_; numberInfeasibilities_++; assert (fabs(lowerValue) < 1.0e100); } } else { // above newWhere = CLP_ABOVE_UPPER; costValue += infeasibilityWeight_; numberInfeasibilities_++; } if (iWhere != newWhere) { work[iRow] = cost[iSequence] - costValue; index[number++] = iRow; setOriginalStatus(status_[iSequence], newWhere); if (newWhere == CLP_BELOW_LOWER) { bound_[iSequence] = upperValue; upperValue = lowerValue; lowerValue = -COIN_DBL_MAX; } else if (newWhere == CLP_ABOVE_UPPER) { bound_[iSequence] = lowerValue; lowerValue = upperValue; upperValue = COIN_DBL_MAX; } lower[iSequence] = lowerValue; upper[iSequence] = upperValue; cost[iSequence] = costValue; } } } update->setNumElements(number); } /* Sets bounds and cost for one variable - returns change in cost*/ double ClpNonLinearCost::setOne(int iSequence, double value) { assert (model_ != NULL); double primalTolerance = model_->currentPrimalTolerance(); // difference in cost double difference = 0.0; if (CLP_METHOD1) { // get where in bound sequence int iRange; int currentRange = whichRange_[iSequence]; int start = start_[iSequence]; int end = start_[iSequence+1] - 1; if (!bothWays_) { // If fixed try and get feasible if (lower_[start+1] == lower_[start+2] && fabs(value - lower_[start+1]) < 1.001 * primalTolerance) { iRange = start + 1; } else { for (iRange = start; iRange < end; iRange++) { if (value <= lower_[iRange+1] + primalTolerance) { // put in better range if (value >= lower_[iRange+1] - primalTolerance && infeasible(iRange) && iRange == start) iRange++; break; } } } } else { // leave in current if possible iRange = whichRange_[iSequence]; if (value < lower_[iRange] - primalTolerance || value > lower_[iRange+1] + primalTolerance) { for (iRange = start; iRange < end; iRange++) { if (value < lower_[iRange+1] + primalTolerance) { // put in better range if (value >= lower_[iRange+1] - primalTolerance && infeasible(iRange) && iRange == start) iRange++; break; } } } } assert(iRange < end); whichRange_[iSequence] = iRange; if (iRange != currentRange) { if (infeasible(iRange)) numberInfeasibilities_++; if (infeasible(currentRange)) numberInfeasibilities_--; } double & lower = model_->lowerAddress(iSequence); double & upper = model_->upperAddress(iSequence); double & cost = model_->costAddress(iSequence); lower = lower_[iRange]; upper = lower_[iRange+1]; ClpSimplex::Status status = model_->getStatus(iSequence); if (upper == lower) { if (status != ClpSimplex::basic) { model_->setStatus(iSequence, ClpSimplex::isFixed); status = ClpSimplex::basic; // so will skip } } switch(status) { case ClpSimplex::basic: case ClpSimplex::superBasic: case ClpSimplex::isFree: break; case ClpSimplex::atUpperBound: case ClpSimplex::atLowerBound: case ClpSimplex::isFixed: // set correctly if (fabs(value - lower) <= primalTolerance * 1.001) { model_->setStatus(iSequence, ClpSimplex::atLowerBound); } else if (fabs(value - upper) <= primalTolerance * 1.001) { model_->setStatus(iSequence, ClpSimplex::atUpperBound); } else { // set superBasic model_->setStatus(iSequence, ClpSimplex::superBasic); } break; } difference = cost - cost_[iRange]; cost = cost_[iRange]; } if (CLP_METHOD2) { double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); double * cost = model_->costRegion(); unsigned char iStatus = status_[iSequence]; assert (currentStatus(iStatus) == CLP_SAME); double lowerValue = lower[iSequence]; double upperValue = upper[iSequence]; double costValue = cost2_[iSequence]; int iWhere = originalStatus(iStatus); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; numberInfeasibilities_--; assert (fabs(lowerValue) < 1.0e100); } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; numberInfeasibilities_--; } // get correct place int newWhere = CLP_FEASIBLE; if (value - upperValue <= primalTolerance) { if (value - lowerValue >= -primalTolerance) { // feasible //newWhere=CLP_FEASIBLE; } else { // below newWhere = CLP_BELOW_LOWER; costValue -= infeasibilityWeight_; numberInfeasibilities_++; assert (fabs(lowerValue) < 1.0e100); } } else { // above newWhere = CLP_ABOVE_UPPER; costValue += infeasibilityWeight_; numberInfeasibilities_++; } if (iWhere != newWhere) { difference = cost[iSequence] - costValue; setOriginalStatus(status_[iSequence], newWhere); if (newWhere == CLP_BELOW_LOWER) { bound_[iSequence] = upperValue; upperValue = lowerValue; lowerValue = -COIN_DBL_MAX; } else if (newWhere == CLP_ABOVE_UPPER) { bound_[iSequence] = lowerValue; lowerValue = upperValue; upperValue = COIN_DBL_MAX; } lower[iSequence] = lowerValue; upper[iSequence] = upperValue; cost[iSequence] = costValue; } ClpSimplex::Status status = model_->getStatus(iSequence); if (upperValue == lowerValue) { if (status != ClpSimplex::basic) { model_->setStatus(iSequence, ClpSimplex::isFixed); status = ClpSimplex::basic; // so will skip } } switch(status) { case ClpSimplex::basic: case ClpSimplex::superBasic: case ClpSimplex::isFree: break; case ClpSimplex::atUpperBound: case ClpSimplex::atLowerBound: case ClpSimplex::isFixed: // set correctly if (fabs(value - lowerValue) <= primalTolerance * 1.001) { model_->setStatus(iSequence, ClpSimplex::atLowerBound); } else if (fabs(value - upperValue) <= primalTolerance * 1.001) { model_->setStatus(iSequence, ClpSimplex::atUpperBound); } else { // set superBasic model_->setStatus(iSequence, ClpSimplex::superBasic); } break; } } changeCost_ += value * difference; return difference; } /* Sets bounds and infeasible cost and true cost for one variable This is for gub and column generation etc */ void ClpNonLinearCost::setOne(int sequence, double solutionValue, double lowerValue, double upperValue, double costValue) { if (CLP_METHOD1) { int iRange = -1; int start = start_[sequence]; double infeasibilityCost = model_->infeasibilityCost(); cost_[start] = costValue - infeasibilityCost; lower_[start+1] = lowerValue; cost_[start+1] = costValue; lower_[start+2] = upperValue; cost_[start+2] = costValue + infeasibilityCost; double primalTolerance = model_->currentPrimalTolerance(); if (solutionValue - lowerValue >= -primalTolerance) { if (solutionValue - upperValue <= primalTolerance) { iRange = start + 1; } else { iRange = start + 2; } } else { iRange = start; } model_->costRegion()[sequence] = cost_[iRange]; whichRange_[sequence] = iRange; } if (CLP_METHOD2) { bound_[sequence]=0.0; cost2_[sequence]=costValue; setInitialStatus(status_[sequence]); } } /* Sets bounds and cost for outgoing variable may change value Returns direction */ int ClpNonLinearCost::setOneOutgoing(int iSequence, double & value) { assert (model_ != NULL); double primalTolerance = model_->currentPrimalTolerance(); // difference in cost double difference = 0.0; int direction = 0; if (CLP_METHOD1) { // get where in bound sequence int iRange; int currentRange = whichRange_[iSequence]; int start = start_[iSequence]; int end = start_[iSequence+1] - 1; // Set perceived direction out if (value <= lower_[currentRange] + 1.001 * primalTolerance) { direction = 1; } else if (value >= lower_[currentRange+1] - 1.001 * primalTolerance) { direction = -1; } else { // odd direction = 0; } // If fixed try and get feasible if (lower_[start+1] == lower_[start+2] && fabs(value - lower_[start+1]) < 1.001 * primalTolerance) { iRange = start + 1; } else { // See if exact for (iRange = start; iRange < end; iRange++) { if (value == lower_[iRange+1]) { // put in better range if (infeasible(iRange) && iRange == start) iRange++; break; } } if (iRange == end) { // not exact for (iRange = start; iRange < end; iRange++) { if (value <= lower_[iRange+1] + primalTolerance) { // put in better range if (value >= lower_[iRange+1] - primalTolerance && infeasible(iRange) && iRange == start) iRange++; break; } } } } assert(iRange < end); whichRange_[iSequence] = iRange; if (iRange != currentRange) { if (infeasible(iRange)) numberInfeasibilities_++; if (infeasible(currentRange)) numberInfeasibilities_--; } double & lower = model_->lowerAddress(iSequence); double & upper = model_->upperAddress(iSequence); double & cost = model_->costAddress(iSequence); lower = lower_[iRange]; upper = lower_[iRange+1]; if (upper == lower) { value = upper; } else { // set correctly if (fabs(value - lower) <= primalTolerance * 1.001) { value = CoinMin(value, lower + primalTolerance); } else if (fabs(value - upper) <= primalTolerance * 1.001) { value = CoinMax(value, upper - primalTolerance); } else { //printf("*** variable wandered off bound %g %g %g!\n", // lower,value,upper); if (value - lower <= upper - value) value = lower + primalTolerance; else value = upper - primalTolerance; } } difference = cost - cost_[iRange]; cost = cost_[iRange]; } if (CLP_METHOD2) { double * upper = model_->upperRegion(); double * lower = model_->lowerRegion(); double * cost = model_->costRegion(); unsigned char iStatus = status_[iSequence]; assert (currentStatus(iStatus) == CLP_SAME); double lowerValue = lower[iSequence]; double upperValue = upper[iSequence]; double costValue = cost2_[iSequence]; // Set perceived direction out if (value <= lowerValue + 1.001 * primalTolerance) { direction = 1; } else if (value >= upperValue - 1.001 * primalTolerance) { direction = -1; } else { // odd direction = 0; } int iWhere = originalStatus(iStatus); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; numberInfeasibilities_--; assert (fabs(lowerValue) < 1.0e100); } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; numberInfeasibilities_--; } // get correct place // If fixed give benefit of doubt if (lowerValue == upperValue) value = lowerValue; int newWhere = CLP_FEASIBLE; if (value - upperValue <= primalTolerance) { if (value - lowerValue >= -primalTolerance) { // feasible //newWhere=CLP_FEASIBLE; } else { // below newWhere = CLP_BELOW_LOWER; costValue -= infeasibilityWeight_; numberInfeasibilities_++; assert (fabs(lowerValue) < 1.0e100); } } else { // above newWhere = CLP_ABOVE_UPPER; costValue += infeasibilityWeight_; numberInfeasibilities_++; } if (iWhere != newWhere) { difference = cost[iSequence] - costValue; setOriginalStatus(status_[iSequence], newWhere); if (newWhere == CLP_BELOW_LOWER) { bound_[iSequence] = upperValue; upper[iSequence] = lowerValue; lower[iSequence] = -COIN_DBL_MAX; } else if (newWhere == CLP_ABOVE_UPPER) { bound_[iSequence] = lowerValue; lower[iSequence] = upperValue; upper[iSequence] = COIN_DBL_MAX; } else { lower[iSequence] = lowerValue; upper[iSequence] = upperValue; } cost[iSequence] = costValue; } // set correctly if (fabs(value - lowerValue) <= primalTolerance * 1.001) { value = CoinMin(value, lowerValue + primalTolerance); } else if (fabs(value - upperValue) <= primalTolerance * 1.001) { value = CoinMax(value, upperValue - primalTolerance); } else { //printf("*** variable wandered off bound %g %g %g!\n", // lowerValue,value,upperValue); if (value - lowerValue <= upperValue - value) value = lowerValue + primalTolerance; else value = upperValue - primalTolerance; } } changeCost_ += value * difference; return direction; } // Returns nearest bound double ClpNonLinearCost::nearest(int iSequence, double solutionValue) { assert (model_ != NULL); double nearest = 0.0; if (CLP_METHOD1) { // get where in bound sequence int iRange; int start = start_[iSequence]; int end = start_[iSequence+1]; int jRange = -1; nearest = COIN_DBL_MAX; for (iRange = start; iRange < end; iRange++) { if (fabs(solutionValue - lower_[iRange]) < nearest) { jRange = iRange; nearest = fabs(solutionValue - lower_[iRange]); } } assert(jRange < end); nearest = lower_[jRange]; } if (CLP_METHOD2) { const double * upper = model_->upperRegion(); const double * lower = model_->lowerRegion(); double lowerValue = lower[iSequence]; double upperValue = upper[iSequence]; int iWhere = originalStatus(status_[iSequence]); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; assert (fabs(lowerValue) < 1.0e100); } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; } if (fabs(solutionValue - lowerValue) < fabs(solutionValue - upperValue)) nearest = lowerValue; else nearest = upperValue; } return nearest; } /// Feasible cost with offset and direction (i.e. for reporting) double ClpNonLinearCost::feasibleReportCost() const { double value; model_->getDblParam(ClpObjOffset, value); return (feasibleCost_ + model_->objectiveAsObject()->nonlinearOffset()) * model_->optimizationDirection() / (model_->objectiveScale() * model_->rhsScale()) - value; } // Get rid of real costs (just for moment) void ClpNonLinearCost::zapCosts() { int iSequence; double infeasibilityCost = model_->infeasibilityCost(); // zero out all costs int numberTotal = numberColumns_ + numberRows_; if (CLP_METHOD1) { int n = start_[numberTotal]; memset(cost_, 0, n * sizeof(double)); for (iSequence = 0; iSequence < numberTotal; iSequence++) { int start = start_[iSequence]; int end = start_[iSequence+1] - 1; // correct costs for this infeasibility weight if (infeasible(start)) { cost_[start] = -infeasibilityCost; } if (infeasible(end - 1)) { cost_[end-1] = infeasibilityCost; } } } if (CLP_METHOD2) { } } #ifdef VALIDATE // For debug void ClpNonLinearCost::validate() { double primalTolerance = model_->currentPrimalTolerance(); int iSequence; const double * solution = model_->solutionRegion(); const double * upper = model_->upperRegion(); const double * lower = model_->lowerRegion(); const double * cost = model_->costRegion(); double infeasibilityCost = model_->infeasibilityCost(); int numberTotal = numberRows_ + numberColumns_; int numberInfeasibilities = 0; double sumInfeasibilities = 0.0; for (iSequence = 0; iSequence < numberTotal; iSequence++) { double value = solution[iSequence]; int iStatus = status_[iSequence]; assert (currentStatus(iStatus) == CLP_SAME); double lowerValue = lower[iSequence]; double upperValue = upper[iSequence]; double costValue = cost2_[iSequence]; int iWhere = originalStatus(iStatus); if (iWhere == CLP_BELOW_LOWER) { lowerValue = upperValue; upperValue = bound_[iSequence]; assert (fabs(lowerValue) < 1.0e100); costValue -= infeasibilityCost; assert (value <= lowerValue - primalTolerance); numberInfeasibilities++; sumInfeasibilities += lowerValue - value - primalTolerance; assert (model_->getStatus(iSequence) == ClpSimplex::basic); } else if (iWhere == CLP_ABOVE_UPPER) { upperValue = lowerValue; lowerValue = bound_[iSequence]; costValue += infeasibilityCost; assert (value >= upperValue + primalTolerance); numberInfeasibilities++; sumInfeasibilities += value - upperValue - primalTolerance; assert (model_->getStatus(iSequence) == ClpSimplex::basic); } else { assert (value >= lowerValue - primalTolerance && value <= upperValue + primalTolerance); } assert (lowerValue == saveLowerV[iSequence]); assert (upperValue == saveUpperV[iSequence]); assert (costValue == cost[iSequence]); } if (numberInfeasibilities) printf("JJ %d infeasibilities summing to %g\n", numberInfeasibilities, sumInfeasibilities); } #endif
// DeleteBucketProtectionGroup Deletes a bucket from a protection group and the child protection group S3 asset. // Appearance in /datasources/protection-groups/s3-assets read/listing is asynchronous // and may take a few seconds to minutes at most. Must be in the same OU context as // the creator of this protection group. Bucket ID in path can be found in // datasources/aws/s3. func (p *ProtectionGroupsV1) DeleteBucketProtectionGroup( groupId string, bucketId string)( *models.DeleteBucketFromProtectionGroupResponse, *apiutils.APIError) { pathURL := "/protection-groups/{group_id}/buckets/{bucket_id}" pathParams := map[string]string{ "group_id": groupId, "bucket_id": bucketId, } queryBuilder := p.config.BaseUrl + pathURL header := "application/api.clumio.protection-groups=v1+json" var result *models.DeleteBucketFromProtectionGroupResponse apiErr := common.InvokeAPI(&common.InvokeAPIRequest{ Config: p.config, RequestUrl: queryBuilder, PathParams: pathParams, AcceptHeader: header, Result: &result, RequestType: common.Delete, }) return result, apiErr }
// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. // // Microsoft Bot Framework: http://botframework.com // // Bot Builder SDK Github: // https://github.com/Microsoft/BotBuilder // // Copyright (c) Microsoft Corporation // All rights reserved. // // MIT License: // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // import { Session } from '../Session'; import { fmtText } from '../Message'; export class CardAction implements IIsCardAction { private data = <ICardAction>{}; constructor(private session?: Session) { } public type(t: string): this { if (t) { this.data.type = t; } return this; } public title(text: string|string[], ...args: any[]): this { if (text) { this.data.title = fmtText(this.session, text, args); } return this; } public value(v: string): this { if (v) { this.data.value = v; } return this; } public image(url: string): this { if (url) { this.data.image = url; } return this; } public toAction(): ICardAction { return this.data; } static call(session: Session, number: string, title?: string|string[]): CardAction { return new CardAction(session).type('call').value(number).title(title || "Click to call"); } static openUrl(session: Session, url: string, title?: string|string[]): CardAction { return new CardAction(session).type('openUrl').value(url).title(title || "Click to open website in your browser"); } static openApp(session: Session, url: string, title?: string|string[]): CardAction { return new CardAction(session).type('openApp').value(url).title(title || "Click to open website in a webview"); } static imBack(session: Session, msg: string, title?: string|string[]): CardAction { return new CardAction(session).type('imBack').value(msg).title(title || "Click to send response to bot"); } static postBack(session: Session, msg: string, title?: string|string[]): CardAction { return new CardAction(session).type('postBack').value(msg).title(title || "Click to send response to bot"); } static playAudio(session: Session, url: string, title?: string|string[]): CardAction { return new CardAction(session).type('playAudio').value(url).title(title || "Click to play audio file"); } static playVideo(session: Session, url: string, title?: string|string[]): CardAction { return new CardAction(session).type('playVideo').value(url).title(title || "Click to play video"); } static showImage(session: Session, url: string, title?: string|string[]): CardAction { return new CardAction(session).type('showImage').value(url).title(title || "Click to view image"); } static downloadFile(session: Session, url: string, title?: string|string[]): CardAction { return new CardAction(session).type('downloadFile').value(url).title(title || "Click to download file"); } static dialogAction(session: Session, action: string, data?: string, title?: string|string[]): CardAction { var value = 'action?' + action; if (data) { value += '=' + data; } return new CardAction(session).type('postBack').value(value).title(title || "Click to send response to bot"); } }
<filename>src/index.ts export * from './interfaces'; export type { Context, ContextRequest, ContextResponse } from './context'; export type { Exception } from './exception'; export type { Model } from './model'; import { HttpClient, RequestMethod } from './http.client'; export type { RequestMethod }; export default HttpClient;
#include "ActionMove.h" #include "Entity.h" #include "ComponentRender.h" #include "ComponentMovement.h" #include "MovementSystem.h" #include <iostream> #define SPEED 5.0f ActionMove::ActionMove() : _dt(0) { } ActionMove::~ActionMove() { } void ActionMove::move(Entity* entity, std::map<sf::Keyboard::Key, actions::moveActions> inputs, bool keys[], float dt) { _dt += dt; ComponentMovement* movement = entity->getComponent<ComponentMovement>(components::COMPONENT_MOVEMENT); ComponentRender* render = entity->getComponent<ComponentRender>(components::COMPONENT_RENDER); float rotation = 0.0f; float speed = 0.0f; float speedboost = 1.0f; bool actions[actions::COUNT] = { false }; for (std::map<sf::Keyboard::Key, actions::moveActions>::iterator i = inputs.begin(); i != inputs.end(); ++i) { if (keys[i->first] == true) actions[i->second] = true; } if (actions[actions::CHARGE] == true) { speedboost = 3.0f; } if (actions[actions::MOVE_RIGHT] && !actions[actions::MOVE_LEFT]){ rotation = 90.0f; speed = SPEED * speedboost; if (_dt >= 100) { render->setTilePosition(sf::Vector2u((render->getTilePosition().x + 64) % (64 * 8), 32 * 30)); _dt = 0; } } if (actions[actions::MOVE_LEFT] && !actions[actions::MOVE_RIGHT]){ rotation = 270.0f; speed = SPEED * speedboost; if (_dt >= 100) { render->setTilePosition(sf::Vector2u((render->getTilePosition().x + 64) % (64 * 8), 32 * 28)); _dt = 0; } } if (actions[actions::MOVE_DOWN] && !actions[actions::MOVE_UP]){ rotation = 180.0f; speed = SPEED * speedboost; if (_dt > 100){ render->setTilePosition(sf::Vector2u((render->getTilePosition().x + 64) % (64 * 8), render->getTilePosition().y)); _dt = 0; } } if (actions[actions::MOVE_UP] && !actions[actions::MOVE_DOWN]){ rotation = 0.0f; speed = SPEED * speedboost; if (_dt > 100){ render->setTilePosition(sf::Vector2u((render->getTilePosition().x + 64) % (64 * 8), render->getTilePosition().y)); _dt = 0; } } if (actions[actions::MOVE_UP] && actions[actions::MOVE_RIGHT] && !(actions[actions::MOVE_DOWN] || actions[actions::MOVE_LEFT])){ rotation = 45.0f; speed = SPEED * speedboost; if (_dt >= 100) { render->setTilePosition(sf::Vector2u((render->getTilePosition().x + 64) % (64 * 8), 32 * 30)); _dt = 0; } } if (actions[actions::MOVE_RIGHT] && actions[actions::MOVE_DOWN] && !(actions[actions::MOVE_LEFT] || actions[actions::MOVE_UP])){ rotation = 135.0f; speed = SPEED * speedboost; if (_dt >= 100) { render->setTilePosition(sf::Vector2u((render->getTilePosition().x + 64) % (64 * 8), 32 * 30)); _dt = 0; } } if (actions[actions::MOVE_DOWN] && actions[actions::MOVE_LEFT] && !(actions[actions::MOVE_UP] || actions[actions::MOVE_RIGHT])){ rotation = 225.0f; speed = SPEED * speedboost; if (_dt >= 100) { render->setTilePosition(sf::Vector2u((render->getTilePosition().x + 64) % (64 * 8), 32 * 28)); _dt = 0; } } if (actions[actions::MOVE_LEFT] && actions[actions::MOVE_UP] && !(actions[actions::MOVE_RIGHT] || actions[actions::MOVE_DOWN])){ rotation = 315.0f; speed = SPEED * speedboost; if (_dt >= 100) { render->setTilePosition(sf::Vector2u((render->getTilePosition().x + 64) % (64 * 8), 32 * 28)); _dt = 0; } } if (actions[actions::SLASH] && actions[actions::MOVE_RIGHT]){ //if (dt - _dt >= 100) { render->setTilePosition(sf::Vector2u((64 * 4), 32 * 26)); _dt = 0; //} } if (actions[actions::SLASH] && actions[actions::MOVE_LEFT]){ //if (dt - _dt >= 100) { render->setTilePosition(sf::Vector2u((64 * 4), 32 * 24)); _dt = 0; //} } // If the player is idle if (speed == 0 && _dt > 333) { render->setTilePosition(sf::Vector2u((render->getTilePosition().x + 64) % (64 * 3), 32 * 26)); _dt = 0; } movement->setRotation(rotation); movement->setSpeed(speed); }
/* * This routine pretty-prints the platform's internal CPU clock * frequencies into the buffer for usage in /proc/cpuinfo. */ static int ppc4xx_show_percpuinfo(struct seq_file *m, int i) { seq_printf(m, "clock\t\t: %ldMHz\n", (long)__res.bi_intfreq / 1000000); return 0; }
# -*- coding: UTF-8 -*- from functools import wraps from flask import session, url_for, redirect, logging # 登录状态检查 def logincheck(f): @wraps(f) def wrapper(*args, **kwargs): try: if 'login' in session.keys(): if session['login'] == 'loginsuccess': return f(*args, **kwargs) else: return redirect(url_for('login')) else: return redirect(url_for('login')) except Exception as e: print(e) return redirect(url_for('Error')) return wrapper
def drop(cls, soClass): sql = getattr(soClass, soClass._connection.dbName + 'Drop', None) if sql: soClass._connection.query(sql) else: soClass.dropTable()
<gh_stars>0 /* Copyright 2019 Broadcom. All rights reserved. The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. */ /* Package tlerr defines the errors of the translib library. The Error() method of the error interface for these functions returns the English version, and are only meant for log files. For message strings that are returned to the users, the localization will happen at when the GNMI/REST client's locale is known. Hence, it cannot occur here. */ package tlerr import ( // "fmt" "golang.org/x/text/message" "golang.org/x/text/language" "cvl" // "errors" // "strings" ) var p * message.Printer func init() { p = message.NewPrinter(language.English) } // DB errors type TranslibDBCannotOpen struct { } func (e TranslibDBCannotOpen) Error() string { return p.Sprintf("Translib Redis Error: Cannot open DB") } type TranslibDBNotInit struct { } func (e TranslibDBNotInit) Error() string { return p.Sprintf("Translib Redis Error: DB Not Initialized") } type TranslibRedisClientEntryNotExist struct { Entry string } func (e TranslibRedisClientEntryNotExist) Error() string { return p.Sprintf("Translib Redis Error: Entry does not exist: %s", e.Entry) } type TranslibCVLFailure struct { Code int CVLErrorInfo cvl.CVLErrorInfo } func (e TranslibCVLFailure) Error() string { return p.Sprintf("Translib Redis Error: CVL Failure: %d: %v", e.Code, e.CVLErrorInfo) } type TranslibTransactionFail struct { } func (e TranslibTransactionFail) Error() string { return p.Sprintf("Translib Redis Error: Transaction Fails") } type TranslibDBSubscribeFail struct { } func (e TranslibDBSubscribeFail) Error() string { return p.Sprintf("Translib Redis Error: DB Subscribe Fail") } type TranslibSyntaxValidationError struct { StatusCode int // status code ErrorStr error // error message } func (e TranslibSyntaxValidationError) Error() string { return p.Sprintf("%s", e.ErrorStr) }
<reponame>ritikmishra/babycat // Copyright 2012-2014 The Rust Project Developers and <NAME>. See the // COPYRIGHT-RUST.txt file at the top-level directory of this distribution. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed except // according to those terms. //! A simple library implementing the [CESU-8 compatibility encoding //! scheme](http://www.unicode.org/reports/tr26/tr26-2.html). This is a //! non-standard variant of UTF-8 that is used internally by some systems //! that need to represent UTF-16 data as 8-bit characters. Yes, this is //! ugly. //! //! Use of this encoding is discouraged by the Unicode Consortium. It's OK //! for working with existing internal APIs, but it should not be used for //! transmitting or storing data. //! //! ``` //! use std::borrow::Cow; //! use cesu8::{from_cesu8, to_cesu8}; //! //! // 16-bit Unicode characters are the same in UTF-8 and CESU-8. //! assert_eq!(Cow::Borrowed("aé日".as_bytes()), //! to_cesu8("aé日")); //! assert_eq!(Cow::Borrowed("aé日"), //! from_cesu8("aé日".as_bytes()).unwrap()); //! //! // This string is CESU-8 data containing a 6-byte surrogate pair, //! // which decodes to a 4-byte UTF-8 string. //! let data = &[0xED, 0xA0, 0x81, 0xED, 0xB0, 0x81]; //! assert_eq!(Cow::Borrowed("\u{10401}"), //! from_cesu8(data).unwrap()); //! ``` //! //! ### A note about security //! //! As a general rule, this library is intended to fail on malformed or //! unexpected input. CESU-8 is supposed to be an internal-only format, //! and if we're seeing malformed data, we assume that it's either a bug in //! somebody's code, or an attacker is trying to improperly encode data to //! evade security checks. //! //! If you have a use case for lossy conversion to UTF-8, or conversion //! from mixed UTF-8/CESU-8 data, please feel free to submit a pull request //! for `from_cesu8_lossy_permissive` with appropriate behavior. //! //! ### Java and U+0000, and other variants //! //! Java uses the CESU-8 encoding as described above, but with one //! difference: The null character U+0000 is represented as an overlong //! UTF-8 sequence `C0 80`. This is supported by the `from_java_cesu8` and //! `to_java_cesu8` methods. //! //! ### Surrogate pairs and UTF-8 //! //! The UTF-16 encoding uses "surrogate pairs" to represent Unicode code //! points in the range from U+10000 to U+10FFFF. These are 16-bit numbers //! in the range 0xD800 to 0xDFFF. //! //! * 0xD800 to 0xDBFF: First half of surrogate pair. When encoded as //! CESU-8, these become **1110**1101 **10**100000 **10**000000 to //! **1110**1101 **10**101111 **10**111111. //! //! * 0xDC00 to 0xDFFF: Second half of surrogate pair. These become //! **1110**1101 **10**110000 **10**000000 to //! **1110**1101 **10**111111 **10**111111. //! //! Wikipedia [explains](http://en.wikipedia.org/wiki/UTF-16) the //! code point to UTF-16 conversion process: //! //! > Consider the encoding of U+10437 (𐐷): //! > //! > * Subtract 0x10000 from 0x10437. The result is 0x00437, 0000 0000 0100 //! > 0011 0111. //! > * Split this into the high 10-bit value and the low 10-bit value: //! > 0000000001 and 0000110111. //! > * Add 0xD800 to the high value to form the high surrogate: 0xD800 + //! > 0x0001 = 0xD801. //! > * Add 0xDC00 to the low value to form the low surrogate: 0xDC00 + //! > 0x0037 = 0xDC37. #![warn(missing_docs)] use std::borrow::Cow; use std::error::Error; use std::fmt; use std::result::Result; use std::slice; use std::str::{from_utf8, from_utf8_unchecked}; use unicode::utf8_char_width; mod unicode; /// Mask of the value bits of a continuation byte. const CONT_MASK: u8 = 0b0011_1111u8; /// Value of the tag bits (tag mask is !CONT_MASK) of a continuation byte. const TAG_CONT_U8: u8 = 0b1000_0000u8; /// The CESU-8 data could not be decoded as valid UTF-8 data. #[derive(Clone, Copy, Debug)] pub struct Cesu8DecodingError; impl Error for Cesu8DecodingError { fn description(&self) -> &str { "decoding error" } fn cause(&self) -> Option<&Error> { None } } impl fmt::Display for Cesu8DecodingError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "could not convert CESU-8 data to UTF-8") } } /// Which variant of the encoding are we working with? #[derive(PartialEq, Eq)] enum Variant { /// Regular CESU-8, with '\0' represented by itself. Standard, /// This is technically Java's "Modified UTF-8", which is supposedly /// like CESU-8, except that it UTF-8 encodes the '\0' byte. I'm sure /// it seemed like a good idea at the time. Java, } /// Convert CESU-8 data to a Rust string, re-encoding only if necessary. /// Returns an error if the data cannot be represented as valid UTF-8. /// /// ``` /// use std::borrow::Cow; /// use cesu8::from_cesu8; /// /// // This string is valid as UTF-8 or CESU-8, so it doesn't change, /// // and we can convert it without allocating memory. /// assert_eq!(Cow::Borrowed("aé日"), /// from_cesu8("aé日".as_bytes()).unwrap()); /// /// // This string is CESU-8 data containing a 6-byte surrogate pair, /// // which becomes a 4-byte UTF-8 string. /// let data = &[0xED, 0xA0, 0x81, 0xED, 0xB0, 0x81]; /// assert_eq!(Cow::Borrowed("\u{10401}"), /// from_cesu8(data).unwrap()); /// ``` pub fn from_cesu8(bytes: &[u8]) -> Result<Cow<str>, Cesu8DecodingError> { from_cesu8_internal(bytes, Variant::Standard) } /// Convert Java's modified UTF-8 data to a Rust string, re-encoding only if /// necessary. Returns an error if the data cannot be represented as valid /// UTF-8. /// /// ``` /// use std::borrow::Cow; /// use cesu8::from_java_cesu8; /// /// // This string is valid as UTF-8 or modified UTF-8, so it doesn't change, /// // and we can convert it without allocating memory. /// assert_eq!(Cow::Borrowed("aé日"), /// from_java_cesu8("aé日".as_bytes()).unwrap()); /// /// // This string is modified UTF-8 data containing a 6-byte surrogate pair, /// // which becomes a 4-byte UTF-8 string. /// let data = &[0xED, 0xA0, 0x81, 0xED, 0xB0, 0x81]; /// assert_eq!(Cow::Borrowed("\u{10401}"), /// from_java_cesu8(data).unwrap()); /// /// // This string is modified UTF-8 data containing null code-points. /// let data = &[0xC0, 0x80, 0xC0, 0x80]; /// assert_eq!(Cow::Borrowed("\0\0"), /// from_java_cesu8(data).unwrap()); /// ``` pub fn from_java_cesu8(bytes: &[u8]) -> Result<Cow<str>, Cesu8DecodingError> { from_cesu8_internal(bytes, Variant::Java) } /// Do the actual work of decoding. fn from_cesu8_internal(bytes: &[u8], variant: Variant) -> Result<Cow<str>, Cesu8DecodingError> { match from_utf8(bytes) { Ok(str) => Ok(Cow::Borrowed(str)), _ => { let mut decoded = Vec::with_capacity(bytes.len()); if decode_from_iter(&mut decoded, &mut bytes.iter(), variant) { // Keep this assertion in debug mode only. It's important // that this assertion is true, because Rust assumes that // all UTF-8 strings are valid. debug_assert!(from_utf8(&decoded[..]).is_ok()); Ok(Cow::Owned(unsafe { String::from_utf8_unchecked(decoded) })) } else { Err(Cesu8DecodingError) } } } } #[test] fn test_from_cesu8() { // The surrogate-encoded character below is from the ICU library's // icu/source/test/testdata/conversion.txt test case. let data = &[0x4D, 0xE6, 0x97, 0xA5, 0xED, 0xA0, 0x81, 0xED, 0xB0, 0x81, 0x7F]; assert_eq!(Cow::Borrowed("M日\u{10401}\u{7F}"), from_cesu8(data).unwrap()); // We used to have test data from the CESU-8 specification, but when we // worked it through manually, we got the wrong answer: // // Input: [0xED, 0xAE, 0x80, 0xED, 0xB0, 0x80] // Binary: 11101101 10101110 10000000 11101101 10110000 10000000 // // 0b1101_101110_000000 -> 0xDB80 // 0b1101_110000_000000 -> 0xDC00 // // ((0xDB80 - 0xD800) << 10) | (0xDC00 - 0xDC00) -> 0xE0000 // 0x10000 + 0xE0000 -> 0xF0000 // // The spec claims that we are supposed to get 0x10000, not 0xF0000. // Since I can't reconcile this example data with the text of the // specification, I decided to use a test character from ICU instead. } // Our internal decoder, based on Rust's is_utf8 implementation. fn decode_from_iter( decoded: &mut Vec<u8>, iter: &mut slice::Iter<u8>, variant: Variant) -> bool { macro_rules! err { () => { return false } } macro_rules! next { () => { match iter.next() { Some(a) => *a, // We needed data, but there was none: error! None => err!() } } } macro_rules! next_cont { () => { { let byte = next!(); if (byte) & !CONT_MASK == TAG_CONT_U8 { byte } else { err!() } } } } loop { let first = match iter.next() { Some(&b) => b, // We're at the end of the iterator and a codepoint boundary at // the same time, so this string is valid. None => return true }; if variant == Variant::Java && first == 0 { // Java's modified UTF-8 should never contain \0 directly. err!(); } else if first < 128 { // Pass ASCII through directly. decoded.push(first); } else if first == 0xc0 && variant == Variant::Java { match next!() { 0x80 => decoded.push(0), _ => err!(), } } else { let w = utf8_char_width(first); let second = next_cont!(); match w { // Two-byte sequences can be used directly. 2 => { decoded.extend([first, second].iter().cloned()); } 3 => { let third = next_cont!(); match (first, second) { // These are valid UTF-8, so pass them through. (0xE0 , 0xA0 ... 0xBF) | (0xE1 ... 0xEC, 0x80 ... 0xBF) | (0xED , 0x80 ... 0x9F) | (0xEE ... 0xEF, 0x80 ... 0xBF) => { decoded.extend([first, second, third].iter() .cloned()) } // First half a surrogate pair, so decode. (0xED , 0xA0 ... 0xAF) => { if next!() != 0xED { err!() } let fifth = next_cont!(); if fifth < 0xB0 || 0xBF < fifth { err!() } let sixth = next_cont!(); let s = dec_surrogates(second, third, fifth, sixth); decoded.extend(s.iter().cloned()); } _ => err!() } } _ => err!() } } } } /// Convert the two trailing bytes from a CESU-8 surrogate to a regular /// surrogate value. fn dec_surrogate(second: u8, third: u8) -> u32 { 0xD000u32 | ((second & CONT_MASK) as u32) << 6 | (third & CONT_MASK) as u32 } /// Convert the bytes from a CESU-8 surrogate pair into a valid UTF-8 /// sequence. Assumes input is valid. fn dec_surrogates(second: u8, third: u8, fifth: u8, sixth: u8) -> [u8; 4] { // Convert to a 32-bit code point. let s1 = dec_surrogate(second, third); let s2 = dec_surrogate(fifth, sixth); let c = 0x10000 + (((s1 - 0xD800) << 10) | (s2 - 0xDC00)); //println!("{:0>8b} {:0>8b} {:0>8b} -> {:0>16b}", 0xEDu8, second, third, s1); //println!("{:0>8b} {:0>8b} {:0>8b} -> {:0>16b}", 0xEDu8, fifth, sixth, s2); //println!("-> {:0>32b}", c); assert!(0x010000 <= c && c <= 0x10FFFF); // Convert to UTF-8. // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx [0b1111_0000u8 | ((c & 0b1_1100_0000_0000_0000_0000) >> 18) as u8, TAG_CONT_U8 | ((c & 0b0_0011_1111_0000_0000_0000) >> 12) as u8, TAG_CONT_U8 | ((c & 0b0_0000_0000_1111_1100_0000) >> 6) as u8, TAG_CONT_U8 | ((c & 0b0_0000_0000_0000_0011_1111) ) as u8] } /// Convert a Rust `&str` to CESU-8 bytes. /// /// ``` /// use std::borrow::Cow; /// use cesu8::to_cesu8; /// /// // This string is valid as UTF-8 or CESU-8, so it doesn't change, /// // and we can convert it without allocating memory. /// assert_eq!(Cow::Borrowed("aé日".as_bytes()), to_cesu8("aé日")); /// /// // This string is a 4-byte UTF-8 string, which becomes a 6-byte CESU-8 /// // vector. /// assert_eq!(Cow::Borrowed(&[0xED, 0xA0, 0x81, 0xED, 0xB0, 0x81]), /// to_cesu8("\u{10401}")); /// ``` pub fn to_cesu8(text: &str) -> Cow<[u8]> { if is_valid_cesu8(text) { Cow::Borrowed(text.as_bytes()) } else { Cow::Owned(to_cesu8_internal(text, Variant::Standard)) } } /// Convert a Rust `&str` to Java's modified UTF-8 bytes. /// /// ``` /// use std::borrow::Cow; /// use cesu8::to_java_cesu8; /// /// // This string is valid as UTF-8 or CESU-8, so it doesn't change, /// // and we can convert it without allocating memory. /// assert_eq!(Cow::Borrowed("aé日".as_bytes()), to_java_cesu8("aé日")); /// /// // This string is a 4-byte UTF-8 string, which becomes a 6-byte modified /// // UTF-8 vector. /// assert_eq!(Cow::Borrowed(&[0xED, 0xA0, 0x81, 0xED, 0xB0, 0x81]), /// to_java_cesu8("\u{10401}")); /// /// // This string contains null, which becomes 2-byte modified UTF-8 encoding /// assert_eq!(Cow::Borrowed(&[0xC0, 0x80, 0xC0, 0x80]), /// to_java_cesu8("\0\0")); /// ``` pub fn to_java_cesu8(text: &str) -> Cow<[u8]> { if is_valid_java_cesu8(text) { Cow::Borrowed(text.as_bytes()) } else { Cow::Owned(to_cesu8_internal(text, Variant::Java)) } } fn to_cesu8_internal(text: &str, variant: Variant) -> Vec<u8> { let bytes = text.as_bytes(); let mut encoded = Vec::with_capacity(bytes.len() + bytes.len() >> 2); let mut i = 0; while i < bytes.len() { let b = bytes[i]; if variant == Variant::Java && b == 0 { encoded.push(0xc0); encoded.push(0x80); i += 1; } else if b < 128 { // Pass ASCII through quickly. encoded.push(b); i += 1; } else { // Figure out how many bytes we need for this character. let w = utf8_char_width(b); assert!(w <= 4); assert!(i + w <= bytes.len()); if w != 4 { // Pass through short UTF-8 sequences unmodified. encoded.extend(bytes[i..i+w].iter().cloned()); } else { // Encode 4-byte sequences as 6 bytes. let s = unsafe { from_utf8_unchecked(&bytes[i..i+w]) }; let c = s.chars().next().unwrap() as u32 - 0x10000; let mut s: [u16; 2] = [0; 2]; s[0] = ((c >> 10) as u16) | 0xD800; s[1] = ((c & 0x3FF) as u16) | 0xDC00; encoded.extend(enc_surrogate(s[0]).iter().cloned()); encoded.extend(enc_surrogate(s[1]).iter().cloned()); } i += w; } } encoded } /// Check whether a Rust string contains valid CESU-8 data. pub fn is_valid_cesu8(text: &str) -> bool { // We rely on the fact that Rust strings are guaranteed to be valid // UTF-8. for b in text.bytes() { if (b & !CONT_MASK) == TAG_CONT_U8 { continue; } if utf8_char_width(b) > 3 { return false; } } true } /// Check whether a Rust string contains valid Java's modified UTF-8 data. pub fn is_valid_java_cesu8(text: &str) -> bool { !text.contains('\0') && is_valid_cesu8(text) } #[test] fn test_valid_cesu8() { assert!(is_valid_cesu8("aé日")); assert!(is_valid_java_cesu8("aé日")); assert!(!is_valid_cesu8("\u{10401}")); assert!(!is_valid_java_cesu8("\u{10401}")); assert!(is_valid_cesu8("\0\0")); assert!(!is_valid_java_cesu8("\0\0")); } /// Encode a single surrogate as CESU-8. fn enc_surrogate(surrogate: u16) -> [u8; 3] { assert!(0xD800 <= surrogate && surrogate <= 0xDFFF); // 1110xxxx 10xxxxxx 10xxxxxx [0b11100000 | ((surrogate & 0b11110000_00000000) >> 12) as u8, TAG_CONT_U8 | ((surrogate & 0b00001111_11000000) >> 6) as u8, TAG_CONT_U8 | ((surrogate & 0b00000000_00111111) ) as u8] }
/* * Copyright 2012-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.boot.web.embedded.jetty; import jakarta.servlet.ServletException; import org.eclipse.jetty.webapp.AbstractConfiguration; import org.eclipse.jetty.webapp.Configuration; import org.eclipse.jetty.webapp.WebAppContext; import org.springframework.boot.web.servlet.ServletContextInitializer; import org.springframework.util.Assert; /** * Jetty {@link Configuration} that calls {@link ServletContextInitializer}s. * * @author Phillip Webb * @author Andy Wilkinson * @since 2.0.0 */ public class ServletContextInitializerConfiguration extends AbstractConfiguration { private final ServletContextInitializer[] initializers; /** * Create a new {@link ServletContextInitializerConfiguration}. * @param initializers the initializers that should be invoked * @since 1.2.1 */ public ServletContextInitializerConfiguration(ServletContextInitializer... initializers) { Assert.notNull(initializers, "Initializers must not be null"); this.initializers = initializers; } @Override public void configure(WebAppContext context) throws Exception { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(context.getClassLoader()); try { callInitializers(context); } finally { Thread.currentThread().setContextClassLoader(classLoader); } } private void callInitializers(WebAppContext context) throws ServletException { try { setExtendedListenerTypes(context, true); for (ServletContextInitializer initializer : this.initializers) { initializer.onStartup(context.getServletContext()); } } finally { setExtendedListenerTypes(context, false); } } private void setExtendedListenerTypes(WebAppContext context, boolean extended) { try { context.getServletContext().setExtendedListenerTypes(extended); } catch (NoSuchMethodError ex) { // Not available on Jetty 8 } } }
def entropy(G,M): m = np.argmax( G, axis = 1 ) marg = calcMargiProb(m, M) jont = calcJointProb(G, m, M) cond = calcCondiProb(jont, marg) return estEntropy(cond)
package thread import ( "bytes" "fmt" ) type Stack struct { size uint top *Frame } func newStack() *Stack { return &Stack{} } func (s *Stack) Push(f *Frame) { f.next = s.top s.top = f s.size++ } func (s *Stack) Pop() *Frame { f := s.top if f != nil { s.top = f.next s.size-- return f } return nil } func (s *Stack) Size() uint { return s.size } func (s *Stack) String() string { var buffer bytes.Buffer buffer.WriteString(fmt.Sprintf("Stack size: %d\n", s.size)) for f := s.top; f != nil; f = f.next { buffer.WriteString(fmt.Sprintf("%v", f)) buffer.WriteString("\n") } return buffer.String() }
Gas Turbine Performance Monitoring and Operation Challenges: A Review • This paper presents the elements affecting the efficiency of gas turbines. • Reviews about machine learning monitoring system for gas turbine emission predication. • Reviews about the available monitoring system solutions for gas turbines. Article Info Abstract Gas turbines efficiently produce high amounts of electrical power hence they have been widely deployed as dependable power generators. It has been detected that the performance of gas turbines is a function of plenty of operational parameters and environmental variables. The impacts of those variables on the said performance can be mitigated using powerful monitoring techniques. Thus, extra maintenance costs, component defect costs, and manpower costs can be illuminated. This paper has enlisted the factors impacting gas turbine efficiency. It has also reviewed multiple monitoring solutions for the said impacting factors, It has been concluded that all types of sensors have ignored errors in their work, which may exacerbate the problems of malfunctions in gas turbines due to the critical environment in which they operate (heat, fumes, etc.); however, the machine learning-based monitoring systems excel in addressing such problems. The most cost-effective and accurate monitoring task can be achieved by using machine learning and deep learning tools. INTRODUCTION Gas turbines convert the working gas, more likely, air into high temperature and high-pressure gas which is subsequently used for turning the turbine engine . Thermodynamic energy is converted into mechanical energy that is used in electrical power production. Three essential parts participate in the production of power in the SPP, namely: gas compressor, combustion chamber, and turbine/engine . A gas turbine involves another vital process called combustion energy production that is used for heating the so-called working gas. A combustion chamber is a vital part of the GPP; it is used for compensating the lost energy of working gas after it departs the compressor . The power quality of the gas turbine is realised under multiple considerations related to the working mechanisms of each part in the GPP. The power enhancement of gas turbines was the focal point of a large number of researchers; it is mainly performed by enhancing the pre-turbine process (at the compressor and combustion chamber sections) . Inlet air is cooled down before entering the compressor to boost the output power at a high ambient temperature which was proposed in . From this point, performance enhancement techniques are imposed by adaption of mechanical chillers for cooling down the air before passing to the compressor . It is worth saying that the running cost of deploying chillers is relatively high; according to , it make up 30% of the power production cost. Gas emission from the turbine is another disturbing and performance degrading factor. According to , gas emission is related to ambient inlet air temperature. It was reported that low ambient inlet air temperature leads to an increase in the carbon emission from the turbine. As reported in , the type of fuel used in the combustion process is of direct impact on the level of gas emission (i.e., carbon emission). Since the gas emission is correlated with multiple concerns of turbine output quality, such as ambient inlet air temperature, ambient out air temperature, ambient air pressure, ambient humidity, etc., a proactive approach is proposed for forecasting the emission of two gases, i.e., Nitrogen oxides and Carbon monoxide. Upon successful forecasting of emissions, troubleshooting can be performed to prevent future damages. A natural air gas turbine is preferred since it has a low gas emission level as compared to diesel and oil fuels . The energy demand has dramatically increased in recent years due to population growth which is linked to economic and industrial growth . In other words, the larger the population, the larger the loads rise due to factory/industrial and residential power requirements. Gas turbines in GPP/stations are termed by their rapid installation and good power outcomes (amount) if the impact of fuel/raw material is neglected. Other than the fuel cost, gas power plants are the most rapid and efficient in power demand fulfilment. The expansion of power systems is associated with unpleasant occurrences such as maintenance/troubleshooting high cost and the redundant disposal outcomes such as burned fuel and gas emission treatment costs. More specifically, in gas power plants, gas emission is considered the most disturbing technical problem and is participating in many subsequent performance degradations. Risks of gas leakage/emission can include the following dangers: poison, fire, and injury casused from machinery performance . In 2003, in the Kaixian city of China, 243 people were killed, and 100,000 people evacuated due to gas blowouts . A smart/intelligent system was developed in for monitoring the pollution in urban air due to the existence of gas power plants. Conventional monitoring systems that depend on human power for diagnosing and reporting errors are no longer standing with the tremendous expansion of the power system. Deploying sensors made from semiconductor materials for detecting gas leakage has a major drawback in terms of poor gas sensitivity . An emission is a sign of low ambient temperature, which leads to a low rotation of the turbine blades and, hence, the lowering of the amount of output power. On the other hand, gas emission from the GPP is the biggest environment violating factor. Technically, three main strategies have been adopted in the literature for controlling the emission in the GPP, namely: Periodic measurements, continuous emission monitoring, and proactive emission control. In the first technique (i.e., Periodic measurements), costly tools and equipment are to be used for monitoring emissions from the turbine in a periodical fashion, more likely every week. This technique is reported by its high cost as well as having no sufficiency for tackling the ground reality of the emission problem (emission may occur at any time and trigger another bigger issue). On the other hand, continuous emission monitoring may be performed using expensive monitoring systems such as SCADA, which itself is susceptible to faults and errors. A proactive approach to emission control and prevention is a promising low-cost alternative depending on computer vision to tackle such asseverating trouble. The proactive approach is implementable by adopting smart machine learning and deep learning paradigms for predicting the future status of emissions. However, the problem is yet to be brought to a standstill since the big standard organisations such as the European Committee for Standardisation (CEN) have not yet approved the approach despite the existence of condensed research activities in the same interest. The performance of proactive forecasting approaches is still disputed and susceptible to more developments. GAS TURBINE OPERATIONAL CHALLENGES Gas turbines (GTs) work under rigid conditions such as fog, dust, salt, etc., moreover, frequent stop-start operations are also amongst the harsh environments where GT is functioning as sensors which are meant to control and monitor the GT process, it has been widely equipped in different types of machinery and sub-systems of GTs. Generally, the performance of sensors undergoing such harsh environments is degrading if left to run for long terms. The errors in sensing devices are causing GT malfunctions and operational errors. GTs are generally susceptible to various types of faults. More specifically, the fault of gas turbine sensors is considered one of the essential operational troubles. This kind of fault is categorised into five groups, namely: step fault, drift fault, pulse fault, noise fault, and periodic fault. Those categories are discussed in and . Fault monitoring is essential to clear the sensor's fault. Similarly, two methods are determined for the sensors' health diagnosis. Those methods are model-originated and dataoriginated. The model originated method is based on mathematical analysis that is meant for mathematical fault diagnosis model establishment, whereas, the data originated method depends on data technology, such as machine learning, for fault type assessment , . A combination of machine learning, i.e., support vector regression (SVR), and an analytical approach, i.e., wavelet energy entropy (WEE), are used for the fault diagnosis of sensors . Features and attributes of faults are extracted from the sensor's output using WEE, whereas SVR is used for classifying the extracted features. A 7000 kW GT is used for collecting log data for constructing a sensing database under various operation conditions. The same database is used for performance evaluation of the coupling approach; results have shown that WEE is contributing to reducing the sensing time by up to 90%. The data mining-based sensor diagnosis approach makes use of whole historical sensing information obtained from GT units. Such methods (machine learning) are utilised for training on sensing data and, hence, to be used for testing where both results can be compared to evaluate the efficiency of the method . Figure 1 depicts the process of data-orientedbased detection of internal faults in GTs. Fault diagnosis using a data-originated approach has multiple advantages such as, the model is trained by real data (historical sensing data); hence, it yields a good and reliable sensing process close to real-world sensors. In , feature extraction is vital for sensing efficacy using data-originated approaches. Conventionally, the Fast Fourier Transform (FFT) is used for performing frequency analysis of the data and for producing the frequency domain representation of them. Wavelet, on the other hand, can produce more reliable features by generating a time-frequency presentation of original data so that both information from the time domain and frequency domain are being used for attribution of the data. The artificial neural network (ANN) is amongst those tools that outperform sensor fault diagnosis. Figure 1. Depicts the process of data-oriented-based detection of internal faults in GTs In , features complexity can be reduced by using the so-call dimensionality reduction approach, which eliminates some features to mitigate the load on the classifier and to produce results quickly. The abruptly occurring fault and drifting incipient fault are identified using the multi-scale analysis . Sensor faults have be decomposed in using wavelet singular entropy and wavelet energy entropy. The problem of the mentioned approach was that both could identify whether the sensing signal was faulty but they could not recognise the type of fault. GAS TURBINE INTERNAL FAULTS The degradation of the GT components is leading to a crucial impact on engine availability, economic worth of GTs, as well as the reliability of GTs in power generation. The only way for tracking those degraded components is by tracking the gas path inside the GT. Accurate and quick diagnosis of GT degraded components (especially when multiple components are degraded at the same time) is a challenging task due to the lack of measurement tools and tracking systems that work inside the GT complex. Getting into this problem poses another challenge related to the cost of machinery and economic worthiness. They are considering that gas turbine life-cycle expenditures are higher than the purchasing budget. For example, the initial cost of the gas turbine from a Siemens V94.3A model is 2.86 million Euros, whereas the life cycle (forty-year plan of maintenance ) of expenditures from the same gas turbine costs 51.34 million Euro. The same indicates that GT expenditure might reach 18 times more than the initial budget of the same model. Monitoring engine conditions and applying appropriate maintenance schemes are, in turn, reducing the maintenance and life cycle expenditures of the GTs . The gas path analysis (GPA) demonstrated in has remained a sustainable technology for accessing the degraded components of the GT and assessing its conditions. The GPA was introduced for the first time in 1969 by Urban . This technique is widely used for the condition monitoring of GTs, and is said to have an implicit impact on maintenance . Both economic and aerodynamic performances are impacted by the degradation level of turbine components; more degradation may yield the so-called loss of performance in GT engines . In , degradation types that seem popular, such as hot section damage, erosion, fouling, object damage, rubbing wear, etc., are demonstrated. Those degradations are common and widely monitored in most of GTs. Some of the most common types of gas turbine degradation are fouling, erosion, corrosion, rubbing wear, hot section damage, seal damage, and object damage . Moreover, degradations are sub-divided into two groups, namely unrecoverable degradations and recoverable degradations . It reported that engine (internal) fault diagnosis methods are categorised into three sections as mentioned in , namely dataoriented, model-oriented, and a hybrid approach. The model-oriented approach requires broad knowledge of the GT model and subsystems where the model for internal faults can be simulated using that exported knowledge. This approach is suspected to present different challenges due to the GT model complexity. On the other hand, the data-oriented model is reserved for high fault detection accuracy; it has employed neural networks or other deep learning approaches . The accuracy of the data-oriented approaches is subject to the training phase performance. Other models have gained significant attention in the internal fault diagnosis of the GT engine, such as an object-oriented artificial neural network. Such approaches are made to pave the road for limited monitoring data availability . The hybrid approaches are, on the other hand, made to tackle the challenges faced in both model-oriented and data-oriented technologies. It is more likely desired for achieving high accuracy in less time where none of the previous models permits. Since the hybrid model is made from a combination of two different methods from the previous models to meet the desired enhancement of the performance, the trade-off between the performance metrics is termed as some methods are more about real-time applications where less processing time is being provided, and others are more about the accuracy (throughput) and that is essential for other types of applications that are promoting high throughputs. The sensing device fault detection model in GTs based on sensor signal monitoring is illustrated in Figure 2. COMBUSTION CHAMBER MONITORING Gas turbines, along with their noticeable performance in the energy sector, are reliable and fast establishing plants. The new century is witnessing a noteworthy expansion in GTs of mini size, which has become strategically essential in the energy production sector. The internal units of the GTs are very complex and require high-quality export systems for surveillance and control of each, which is practically not possible. When considering the costs of expert systems and other considerations, GT internal unit monitoring can be said to be complex as per the ground reality. As well, the development of diagnostic and prognostic systems is essential for the continuous GT performance to fill the gap of manpower limitation in surveillance tasks. Diagnostic and prognostic systems are widely propagated in mini GTs. GTs work on the principle of combustion operations that include multiple geometrical and physical parameters. That makes the combustion process which takes place inside the gas chamber of the turbine a very complex process. It is also complicated to be monitored. The heat flux impacting the walls of the gas chamber is an integral operand. This heat flux variation impacts the distribution parameters, spatial and temporal, which control the combustion process. This variation may lead to undesired occurrences such as loss of performance of the combustion process which impacts the generation level of the gas turbine. Malfunctioning, such as burner error and flame instability, is caused due to combustion process instability. Appropriate monitoring of those changes/variations, in turn, participates in maximising the performance of the gas turbine and maintaining high efficiency. Burner and flame distribution monitoring are the most targeted operations to maintain a good combustion process. The research conducted in this regard is illustrated in Table 1. Table 1. GT internal chamber monitoring technologies and their problems Reference Challenge Solution Research gap The complexity of gas combustion monitoring in GTs Using temperature profiles of downstream gas Cost of implementation and accuracy defect The difficulty of combustion modelling where a swirl angle cannot be accurately measured Using laser imagining operations is used for tracking the combustor process. Cost of implementation and accuracy defect Swirl angle measurement problem Numerical modelling of the Good accuracy but high computational cost combustion system using (CFD. Combustion system monitoring ANN for developing black box and white box for GT subsystem modelling High accuracy and still under development SWIRL CHARACTERISTICS Downstream gas temperatures in GTs in different patterns can be compared to maintain smooth operations of the combustion system. Theoretically, the essential heat parameter used for monitoring GTs is the outlet temperature of the combustor. But, the outlet temperature of the combustor is typically too high and cannot be measured directly using conventional sensors, all owing to the secondary parameters being located downstream of the combustor outlet, such that the inter-duct temperature (IDT) and exhaust gas temperature are considered key variables for the maintaining, monitoring, and controlling of the gas turbine engines . In gas path studies in the combustion system, the dynamic complexity is taking place when considering gas propagation through the turbine. The turbulence in the motion of the combustion system products inside the path of the turbine in the form of spiralling clusters results in the so-called swirl . The spiralling cluster's motion inside the gas turbine must be in a straight line to avoid the swirl impact. To monitor the back data of the combustion system product movement for judging its conditions and health status, it is mandatory to evaluate the swirl angle at the time of using the temperature profiles of the downstream gas . In , laser imagining operations were used for tracking the combustor process of the turbine, which determined the swirl angle. Laser imaging is an expensive approach but, on the other hand, does not yield an accurate status of the combustion system conditions. Alternatively, numerical modelling of the combustion system is made using the model of computational fluid dynamics (CFD) . Other than their high accuracy and performance, CFD models are proven to be high computational cost consumers. An artificial neural network (ANN) is used for developing the black box and white box models for monitoring the system and achieving good outcomes. The satisfactory result of those approaches is owed to their non-paramedical and nonlinear configurations . An artificial neural network (ANN) is widely popular as a data-oriented approach for monitoring systems in multiple sections inside the GT, yielding high accuracy and satisfactory outcomes wherever it is applied. DYNAMIC BEHAVIOUR MODELLING So far, the popularity of artificial neural networks has widely increased in mechanical applications and industrial areas. A large number of industrial applications are now modelled using the artificial neural network. It has been relied upon (ANN) by those applications due to its high-speed approximation and capability of learning complex nonlinear problems taking place in the mentioned sector. It is also known for its flexibility of solutions provided for industrial applications. A monitoring system is one of those interesting applications where ANN is applied. Several methods, including fault diagnosis, modelling, and systems optimisations, are illustrated in . Those works were performed between 2007 to 2017; the most required material that ANN demands to operate is data in large amounts, and it also demands a proper input parameter configuration. Speed and temperature property instantaneous prediction at flow structures are proposed in using an ANN-based prediction model. The results obtained from the proposed model are shown to be enhanced more than the results of the maxed dynamic model. The dynamic power signature in the welding process was monitored using the ANN, and the results were compared with those obtained from the regression model. However, the performance of both were compared, and the results showed that the ANN model is more reliable in terms of data quality . A locomotive system maintenance approach based on ANN is proposed in to monitor the level of lubricating oil in the system. This approach is said to be low-cost and for real-time applications. ANN is used in for monitoring of power grids (smart grids) for power system performance enhancement. This approach overcomes the limitations of the conventional existing monitoring technologies by providing fast and reliable results. A hidden output feedback-based Elman neural network (OHFEN) is used for the detection of faults in a gas turbine by investigating the blade's conditions of the turbine . The approach can state whether the blades are running smoothly or not. In , the ANN model was made for the implementation of a multi-neural network diagnosis model for gas turbine status assessment. Two types of optimisation algorithms were applied to the multi-stage neural network to enhance the accuracy of the diagnosis. Those algorithms were the Bayesian regularisation and Levenberg-Marquardt. A twin-shaft 18.7 MW gas turbine engine was used for the collection of training data used in this experiment. Faults of gas turbines such as pre-chamber exhaustion and bearing tilt pad wear early-stage detection was performed using the group of sensors that collected the data from the gas turbine in hierarchical form. The collected data were applied to selforganised map neural networks (SOMNN) . Other experiments of ANN in industrial applications, more specifically in the gas turbine, are illustrated in Table 2. Table 2. Research of ANN based GT applications Reference Application Model Fault detection and isolation of gas turbine engines Dynamic neural network (DNN) with multilayer perceptron (MLP) and support vector machine (SVM) Start-up phase of a single shaft gas turbine simulation Non-linear autoregressive models Gas transport network Artificial neural networks (ANN) and the fuzzy inference system (FIS) Control the heating process of a steam turbine Artificial neuron system Fault detection in a gas turbine and to control their dynamic behaviours Adaptive neuro-fuzzy interference system (ANFIS) Fault detection and isolation in an aircraft gas turbine engine Neural network bank based on the time delay neural network TDNN and dynamic neural model (DNM) Operating conditions of a steam turbine optimisation Inverse artificial neural network Fault detection and isolation in a dual spool gas turbine engine Dynamic neural network (DNN) Fault diagnosis in a GT engine Dynamic neural network (DNN) Microturbine gas modelling ANN GT monitoring with optimal mechanical performance ANN Modelling of microturbines. ANN Classifying data for GT validation ANN GT multi-model approach for industrial applications ANN High throughput GT diagnostic system ANN Presently, the processed monitoring field hung on distinct functions provides a set of solid tools to enhance operations of the processed outfit and to guarantee the optimal proportion of cost/ quality. One of the main exercises in the processed manufacturing of fault decisions is vibration monitoring in rotating machines which is still a hot motif in maximum processed sectors . The plan of the observed configuration will give the beginning data for a demonstrative methodology for these machines to guarantee their protection against fineness and to assess their energetic conduct precisely. The conventional modelling approaches of this type of machine cannot present their dynamic behaviours verbatim due to the considerably nonlinear exact complications of comparable systems , ; on the other hand, they're high procedures. Therefore, there is a fabulous expanded must for creating unused approaches to guarantee the exact displaying of the distant inside miracles of comparable configurations. This is the case of gas turbines, which are subject to several unstable marvels, which are hourly nasty to interpret because of the problems of their dynamic complications and their operating context . APPLICATION SCOPES The aero-dynamic impacts on the gas turbine are illustrated in , where there are impacts of various aero-dynamics on the engine and other turbine parts causing degradation. The correlation of aero-dynamic factors with the overall efficiency of the gas turbine is listed in . Aero-dynamics such as blade corrosion, erosion, and fouling have been found to affect the performance of the blades' aerodynamic behaviours, which affect the turbine tip clearance and triggers the so-called parasitic phenomenon . Other degradation impacts can be seen more easily when increasing the flight cycle that damages (disturb) the gas path and ruin the gas path components; the same degradation level has remained difficult to be realised . To tackle those impacts (most of the reported impacts) and increase the life of the gas turbine, sensor-based monitoring has been proposed . Other researchers have proposed to revise the design of the hybrid-electric propulsion and ultra-high bypass ratio . In , it was found that on-board monitoring and control systems may greatly enhance the life and performance of the gas turbine. INTELLIGENT SYSTEMS FOR GAS TURBINE MONITORING The expansion of data in various fields has incurred the need for smart and lost fewer methods for processing. Machine and deep learning tools are feasible options. Table 3 demonstrates the most populated AI tools used in different areas for monitoring through smart data processing. Machine learning tools have been used to classify the sensor reading features. Feature extraction is required whilst using machine learning tools for this purpose. However, with deep learning tools, the feature extraction stage is dispensed. Higher accuracy of monitoring is obtained by using deep learning such as a neural network. To adopt any machine learning or deep learning tool, insensitive and highly risky applications such as gas turbine monitoring, the accuracy of those tools must be optimised to a level that they can be reliable in their allotted tasks. Deep Learning Classifier Alternatively, neural networks have gained special attention in this regard due to their classification performance and their diagnosis accuracy; hence, neural networks are widely used for sensor fault diagnosis. Figure 3 demonstrates the learning and prediction process of artificial intelligence, i.e., deep learning-based monitoring in GTs. Dynamic neural networks have been used for the detection of signal abnormality through performing input-output mapping of sensor data. A general regression neural network (GRNN) is used for auto-detection network fabrication that represents the optimised architecture of the fault diagnosis of sensors through the exhaust inlet temperature of the gas turbine . A Sparse Bayesian extreme learning machine (SBELM) is presented in , where the multi-output classifier was established using a signal-output classifier using the sparse technology of the extreme learning machine. Different kinds of activation functions are presented in for designing a mini-cost multi-layer perception model. Such a model consists of several hidden layers (can be a single hidden layer also) as well as input and output layers. A support vector machine is applied to diagnose faults in GT sensors . It is understood that supervised learning algorithms such as SVM differ from the multi-layer perceptron, i.e., artificial neural networks (ANN), in terms of accuracy as well as the time of classification. Thus, both types of learning are meant for the classification of features provided by feature extraction paradigms. Knowing that feature extraction approaches are enriched with mathematical complexity increases the processing cost, i.e., processing time. Another approach is proposed using support vector data description (SVDD) for the classification of data without needing most statistical data and feature extraction work. This approach has been applied to the error diagnosis of helicopter drive train components . Another application of machine learning (coupling) has been used in the aerodynamic modelling of aero-engines. The support vector machine is coupled with a stochastic gradient descent to perform the aerodynamic modelling . CONCLUSION Gas turbine performance is limited by internal and external factors. However, sensors are used for remote monitoring of the internal gas turbine chamber where harsh environments with high pressure and high temperatures exist. The tolerance of the said sensors may not be enough to maintain efficient monitoring. The faulty sensors impose error challenges which may worsen the fault problems. On the other hand, the pressure and thermodynamic properties of the turbine are also have a noteworthy impact on the performance. As illustrated in the previous sections, machine learning-based monitoring systems are outperform others in tackling such complex problems. Prediction of future events is the main objective of deploying the machine learning predictors. It is also used to track sensor performance as well as the prediction of more appropriate parameters and decision-making in gas turbine maintenance and operation control. Artificial neural networks provide an interesting solution for tackling problems associated with gas turbines. This paper has shown that ANN memorisation, adaptation, and problem learning capacities provide strong functions for the control and monitoring system of the gas turbine. In any case, the most vital advantage that can be attributed to neural network control and monitoring tasks in gas turbines is the estimation and modelling of vibration indicators by problem learning. ANN technology does not demand the explicit (straightforward) knowledge of complicated mathematical models; instead, ANN demands reliable operating sources of data and a strong optimization approach. This paper has shown that intelligent models are having an outstanding impact on gas turbine monitoring. They have been utilised for different subsystems; monitoring of internal gas chambers, turbulence analysis, thermodynamic parameter monitoring, and sensor quality monitoring. The most cost-efficient and accurate monitoring task could be achieved using machine learning and deep learning tools as illustrated in the previous sections. CONFLICTS OF INTEREST The authors declare that there is no conflict of interest.
// Copyright (C) 2009-2016 National ICT Australia (NICTA) // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. // ------------------------------------------------------------------- // // Written by Conrad Sanderson - http://conradsanderson.id.au //! \addtogroup glue_solve //! @{ // // glue_solve_gen template<typename T1, typename T2> inline void glue_solve_gen::apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_solve_gen>& X) { arma_extra_debug_sigprint(); const bool status = glue_solve_gen::apply( out, X.A, X.B, X.aux_uword ); if(status == false) { arma_bad("solve(): solution not found"); } } template<typename eT, typename T1, typename T2> inline bool glue_solve_gen::apply(Mat<eT>& out, const Base<eT,T1>& A_expr, const Base<eT,T2>& B_expr, const uword flags) { arma_extra_debug_sigprint(); typedef typename get_pod_type<eT>::result T; const bool fast = bool(flags & solve_opts::flag_fast ); const bool equilibrate = bool(flags & solve_opts::flag_equilibrate); const bool no_approx = bool(flags & solve_opts::flag_no_approx ); arma_extra_debug_print("glue_solve_gen::apply(): enabled flags:"); if(fast ) { arma_extra_debug_print("fast"); } if(equilibrate) { arma_extra_debug_print("equilibrate"); } if(no_approx ) { arma_extra_debug_print("no_approx"); } T rcond = T(0); bool status = false; Mat<eT> A = A_expr.get_ref(); if(A.n_rows == A.n_cols) { arma_extra_debug_print("glue_solve_gen::apply(): detected square system"); if(fast) { arma_extra_debug_print("glue_solve_gen::apply(): (fast)"); if(equilibrate) { arma_debug_warn("solve(): option 'equilibrate' ignored, as option 'fast' is enabled"); } status = auxlib::solve_square_fast(out, A, B_expr.get_ref()); // A is overwritten } else { arma_extra_debug_print("glue_solve_gen::apply(): (refine)"); status = auxlib::solve_square_refine(out, rcond, A, B_expr, equilibrate); // A is overwritten } if( (status == false) && (no_approx == false) ) { arma_extra_debug_print("glue_solve_gen::apply(): solving rank deficient system"); if(rcond > T(0)) { arma_debug_warn("solve(): system seems singular (rcond: ", rcond, "); attempting approx solution"); } else { arma_debug_warn("solve(): system seems singular; attempting approx solution"); } Mat<eT> AA = A_expr.get_ref(); status = auxlib::solve_approx_svd(out, AA, B_expr.get_ref()); // AA is overwritten } } else { arma_extra_debug_print("glue_solve_gen::apply(): detected non-square system"); if(equilibrate) { arma_debug_warn( "solve(): option 'equilibrate' ignored for non-square matrix" ); } if(fast) { status = auxlib::solve_approx_fast(out, A, B_expr.get_ref()); // A is overwritten if(status == false) { Mat<eT> AA = A_expr.get_ref(); status = auxlib::solve_approx_svd(out, AA, B_expr.get_ref()); // AA is overwritten } } else { status = auxlib::solve_approx_svd(out, A, B_expr.get_ref()); // A is overwritten } } if(status == false) { out.reset(); } return status; } // // glue_solve_tri template<typename T1, typename T2> inline void glue_solve_tri::apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_solve_tri>& X) { arma_extra_debug_sigprint(); const bool status = glue_solve_tri::apply( out, X.A, X.B, X.aux_uword ); if(status == false) { arma_bad("solve(): solution not found"); } } template<typename eT, typename T1, typename T2> inline bool glue_solve_tri::apply(Mat<eT>& out, const Base<eT,T1>& A_expr, const Base<eT,T2>& B_expr, const uword flags) { arma_extra_debug_sigprint(); const bool fast = bool(flags & solve_opts::flag_fast ); const bool equilibrate = bool(flags & solve_opts::flag_equilibrate); const bool no_approx = bool(flags & solve_opts::flag_no_approx ); const bool triu = bool(flags & solve_opts::flag_triu ); const bool tril = bool(flags & solve_opts::flag_tril ); arma_extra_debug_print("glue_solve_tri::apply(): enabled flags:"); if(fast ) { arma_extra_debug_print("fast"); } if(equilibrate) { arma_extra_debug_print("equilibrate"); } if(no_approx ) { arma_extra_debug_print("no_approx"); } if(triu ) { arma_extra_debug_print("triu"); } if(tril ) { arma_extra_debug_print("tril"); } bool status = false; if(equilibrate) { arma_debug_warn("solve(): option 'equilibrate' ignored for triangular matrices"); } const unwrap_check<T1> U(A_expr.get_ref(), out); const Mat<eT>& A = U.M; arma_debug_check( (A.is_square() == false), "solve(): matrix marked as triangular must be square sized" ); const uword layout = (triu) ? uword(0) : uword(1); status = auxlib::solve_tri(out, A, B_expr.get_ref(), layout); // A is not modified if( (status == false) && (no_approx == false) ) { arma_extra_debug_print("glue_solve_tri::apply(): solving rank deficient system"); arma_debug_warn("solve(): system seems singular; attempting approx solution"); Mat<eT> triA = (triu) ? trimatu( A_expr.get_ref() ) : trimatl( A_expr.get_ref() ); status = auxlib::solve_approx_svd(out, triA, B_expr.get_ref()); // triA is overwritten } if(status == false) { out.reset(); } return status; } //! @}
/** * Resolves the exception and sets proper http code. * * @param request * the http servlet request * @param response * the http servlet response * @param handler * the handler object * @param exception * the thrown exception * * @return Resulting ModelAndView to show to user */ public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception exception) { String signature = CLASS_NAME + "#resolveException(HttpServletRequest request, HttpServletResponse response," + " Object handler, Exception exception)"; LoggingHelper.logEntrance(logger, signature, new String[] { "request", "response", "handler", "exception" }, new Object[] { request, response, handler, exception }); ModelAndView result; if ("XMLHttpRequest".equals(request.getHeader("X-Requested-With"))) { try { String message = exception.getMessage(); if (exception instanceof IllegalArgumentException) { response.sendError(HttpServletResponse.SC_BAD_REQUEST, exception.getMessage()); } else if (exception instanceof EntityNotFoundException) { response.sendError(HttpServletResponse.SC_NOT_FOUND, exception.getMessage()); } else { response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, exception.getMessage()); } response.getWriter().print(message); } catch (IOException e) { LoggingHelper.logException(logger, signature, e); } result = new ModelAndView(); } else { return super.resolveException(request, response, handler, exception); } LoggingHelper.logExit(logger, signature, new Object[] { result }); return result; }
package ttp.algorithm.greedy; import java.util.Arrays; import java.util.Comparator; import java.util.List; import lombok.AllArgsConstructor; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; import ttp.model.Item; import ttp.model.Node; import ttp.model.Problem; import ttp.model.wrapper.ProblemInfo; @AllArgsConstructor(staticName = "instance") @EqualsAndHashCode @ToString public class AdvancedGreedyKnapsackSolver implements KnapsackSolver { private final ProblemInfo problemInfo; @Override public Item[] solve(int[] nodes) { RouteDistanceInfo routeDistanceInfo = calculateRouteDistance(nodes); ItemWithValue[] itemsWithValue = sortItemsByRelativeValue(routeDistanceInfo); return fillKnapsack(itemsWithValue); } private RouteDistanceInfo calculateRouteDistance(int[] nodeIds) { List<Node> nodes = problemInfo.getProblem().getNodes(); NodeWithDistanceFromStart[] nodesWithDistanceFromStart = new NodeWithDistanceFromStart[nodeIds.length]; double entireDistance = 0; for (int i = 0; i < nodeIds.length; i++) { Node node = nodes.get(nodeIds[i] - 1); int nextNodeIndex = (i + 1) % nodeIds.length; Node nextNode = nodes.get(nodeIds[nextNodeIndex] - 1); nodesWithDistanceFromStart[i] = NodeWithDistanceFromStart.of(node, entireDistance); entireDistance += problemInfo.distanceBetween(node, nextNode); } return RouteDistanceInfo.of(entireDistance, nodesWithDistanceFromStart); } private ItemWithValue[] sortItemsByRelativeValue(RouteDistanceInfo routeDistanceInfo) { double routeDistance = routeDistanceInfo.getEntireDistance(); NodeWithDistanceFromStart[] nodeWithDistanceFromStart = routeDistanceInfo.getNodesWithDistanceFromStart(); Problem problem = problemInfo.getProblem(); ItemWithValue[] result = new ItemWithValue[problem.getNumberOfItems()]; double rentingRatio = problem.getRentingRatio(); double maxSpeed = problem.getMaxSpeed(); double minSpeed = problem.getMinSpeed(); double capacity = problem.getCapacityOfKnapsack(); for (int i = 0; i < problem.getItems().size(); i++) { Item item = problem.getItems().get(i); double distanceToFinish = routeDistance - nodeWithDistanceFromStart[item.getAssignedNode() - 1] .getDistanceFromStart(); double dVx = ((minSpeed - maxSpeed) / capacity) * ((double) item.getWeight()); double itemValue = (double) item .getProfit() - rentingRatio * ((distanceToFinish / (maxSpeed + dVx)) - (distanceToFinish / maxSpeed)); result[i] = ItemWithValue.of(item, itemValue); } Arrays.sort(result, Comparator.comparingDouble(ItemWithValue::getValue).reversed()); return result; } private Item[] fillKnapsack(ItemWithValue[] itemsWithValue) { Item[] result = new Item[problemInfo.getProblem().getItems().size()]; int capacity = problemInfo.getProblem().getCapacityOfKnapsack(); int currentWeight = 0; for (int i = 0; currentWeight < capacity && i < itemsWithValue.length; i++) { Item item = itemsWithValue[i].getItem(); if (currentWeight + item.getWeight() < capacity && itemsWithValue[i].getValue() > 0) { result[item.getId() - 1] = item; currentWeight += item.getWeight(); } } return result; } @AllArgsConstructor(staticName = "of") @EqualsAndHashCode(of = { "nodesWithDistanceFromStart" }) @ToString() private static class RouteDistanceInfo { @Getter private final double entireDistance; @Getter private final NodeWithDistanceFromStart[] nodesWithDistanceFromStart; } @AllArgsConstructor(staticName = "of") @EqualsAndHashCode(of = { "node" }) @ToString() private static class NodeWithDistanceFromStart { @Getter private final Node node; @Getter private final double distanceFromStart; } @AllArgsConstructor(staticName = "of") @EqualsAndHashCode(of = { "item" }) @ToString() private static class ItemWithValue { @Getter private final Item item; @Getter private final double value; } }
// Parse the arguments of the function-like define starting after the first (. Also returns // the location of the closing ). fn parse_define_call_arguments( &mut self, lexer: &mut dyn MeLexer, mut current_location: Location, ) -> Step<(Vec<Vec<Token>>, Location)> { let mut paren_nesting = 0u32; let mut arguments = vec![vec![]]; loop { // Get the next token (without additional expansion) let token = match self.step(lexer) { Err(StepExit::Continue) => continue, Err(StepExit::Finished) => { return Err(StepExit::Error(( PreprocessorError::UnexpectedEndOfInput, current_location, ))); } Err(err @ StepExit::Error(_)) => { return Err(err); } Ok(token) => token, }; current_location = token.location; // Handle special tokens match token.value { // Avoid overflow on parenthesis nesting counting. TokenValue::Punct(Punct::LeftParen) => match paren_nesting.checked_add(1) { // TODO figure out a way to cover this code path? Maybe make it a max nesting // so that it can be set to a small value? None => { return Err(StepExit::Error(( PreprocessorError::IntegerOverflow, current_location, ))); } Some(v) => paren_nesting = v, }, TokenValue::Punct(Punct::RightParen) => { // Return the arguments when we find our ) if paren_nesting == 0 { return Ok((arguments, token.location)); } paren_nesting -= 1; } TokenValue::Punct(Punct::Comma) => { // Commas outside of () split arguments and must not be added to them. if paren_nesting == 0 { arguments.push(Default::default()); continue; } } _ => {} } arguments.last_mut().unwrap().push(token); } }
// Status checks that the HTTP status code matches an expected one func (a Response) Status(code int) Response { if a.StatusCode != code { a.t.Errorf("HTTP: expected %d %s, got %d %s", code, http.StatusText(code), a.StatusCode, a.StatusText) } return a }
{-# LANGUAGE OverloadedStrings, PatternGuards #-} module Database.RethinkDB.MapReduce where -- (termToMapReduce) where import Control.Monad.State import Control.Monad.Writer import qualified Data.Text as T import Data.Maybe import Data.Foldable (toList) import Database.RethinkDB.Wire.Term import Database.RethinkDB.ReQL import Database.RethinkDB.Types import qualified Database.RethinkDB.Functions as R import Database.RethinkDB.NoClash hiding (get, collect, args) import Database.RethinkDB.Datum -- | Takes a function that takes a sequence as an argument, and -- returns a function that only uses that sequence once, by merging -- the map and reduce operations. This is used by groupBy. termToMapReduce :: (ReQL -> ReQL) -> State QuerySettings (ReQL -> ReQL) termToMapReduce f = do -- A variable is introduced to represent the sequence that f -- is being performed on. This variable is no longer present -- in the return value v <- newVarId body <- runReQL $ f (op VAR [v]) return . applyChain $ toMapReduce v body -- | Compares the two representations of a variable sameVar :: Int -> [Term] -> Bool sameVar x [Datum d] | Success y <- fromDatum d = x == y sameVar _ _ = False -- | notNone checks that it is a map/reduce and not a constant notConst :: Chain -> Bool notConst None{} = False notConst SingletonArray{} = False notConst _ = True -- | Helper function for casting up from Term into ReQL wrap :: Term -> ReQL wrap = ReQL . return -- | Build a single argument function from a constant ReQL expression toFun1 :: Term -> (ReQL -> ReQL) toFun1 f a = op FUNCALL (wrap f, a) -- | Build a two argument function from a constant ReQL expression toFun2 :: Term -> (ReQL -> ReQL -> ReQL) toFun2 f a b = op FUNCALL (wrap f, a, b) -- | Represents a map/reduce operation split into its map and reduce parts data MRF = MRF { _mrfMapFun :: MapFun, _mrfReduceFun :: ReQL -> ReQL -> ReQL, _mrfBase :: Maybe ReQL, _mrfFinally :: ReQL -> ReQL } -- | A Chain of ReQL expressions that might be transformed into -- a map/reduce operation data Chain = -- | A constant, not really a map/reduce operation None ReQL | -- | Just a map Map [Map] | -- | map/reduce operations represented as parts MapReduceChain [Map] Reduce | -- | A rewritten map/reduce MapReduce MRF | -- | Special cases for reduce with base SingletonArray ReQL | AddBase ReQL Chain -- | A built-in map operation data Map = BuiltInMap TermType [ReQL] [OptArg] MapFun data MapFun = MapFun (ReQL -> ReQL) | ConcatMapFun (ReQL -> ReQL) data Reduce = BuiltInReduce TermType [ReQL] [OptArg] MRF -- | Convert a Chain back into a ReQL function applyChain :: Chain -> (ReQL -> ReQL) applyChain (None t) x = op FUNCALL (t, x) applyChain (Map maps) s = applyMaps maps s applyChain (MapReduceChain maps red) s = applyReduce red $ applyMaps maps s applyChain (MapReduce mrf) s = applyMRF mrf s applyChain (SingletonArray x) s = op FUNCALL (op MAKE_ARRAY [x], s) applyChain (AddBase b c) s = applyChain c s `union` [b] -- | Convert an MRF into a ReQL function applyMRF :: MRF -> ReQL -> ReQL applyMRF (MRF m r Nothing f) s = f `apply` [reduce r (applyMapFun m s)] applyMRF (MRF m r (Just base) f) s = f $ apply (\x -> branch (isEmpty x) base (x R.! 0)) . return $ reduce (\a b -> [a R.! 0 `r` b R.! 0]) $ R.map (\x -> [x]) $ applyMapFun m s applyMaps :: [Map] -> ReQL -> ReQL applyMaps maps s = foldr applyMap s maps applyMap :: Map -> ReQL -> ReQL applyMap (BuiltInMap tt a oa _) s = op' tt (s : a) oa applyMapFun :: MapFun -> ReQL -> ReQL applyMapFun (MapFun f) = R.map f applyMapFun (ConcatMapFun f) = R.concatMap f applyReduce :: Reduce -> ReQL -> ReQL applyReduce (BuiltInReduce tt a oa _) s = op' tt (s : a) oa chainToMRF :: Chain -> Either ReQL MRF chainToMRF (None t) = Left t chainToMRF (Map maps) = Right $ maps `thenMRF` collect chainToMRF (MapReduceChain maps red) = Right $ maps `thenReduce` red chainToMRF (MapReduce mrf) = Right $ mrf chainToMRF (SingletonArray x) = Left $ op MAKE_ARRAY [x] chainToMRF (AddBase b c) = fmap (`thenFinally` \x -> op UNION [b, x]) $ chainToMRF c thenFinally :: MRF -> (ReQL -> ReQL) -> MRF thenFinally (MRF m r b f1) f2 = MRF m r b $ f2 . f1 thenMRF :: [Map] -> MRF -> MRF thenMRF maps (MRF m r b f) = MRF (m `composeMapFun` composeMaps maps) r b f composeMaps :: [Map] -> MapFun composeMaps = foldr composeMapFun (MapFun id) . map getMapFun where getMapFun (BuiltInMap _ _ _ mf) = mf composeMapFun :: MapFun -> MapFun -> MapFun composeMapFun (MapFun f) (MapFun g) = MapFun (f . g) composeMapFun (ConcatMapFun f) (MapFun g) = ConcatMapFun (f . g) composeMapFun (MapFun f) (ConcatMapFun g) = ConcatMapFun (R.map f . g) composeMapFun (ConcatMapFun f) (ConcatMapFun g) = ConcatMapFun (R.concatMap f . g) thenReduce :: [Map] -> Reduce -> MRF thenReduce maps (BuiltInReduce _ _ _ mrf) = maps `thenMRF` mrf collect :: MRF collect = MRF (MapFun $ \x -> expr [x]) union (Just (expr ())) id -- | Rewrites the term in the second argument to merge all uses of the -- variable whose id is given in the first argument. toMapReduce :: Int -> Term -> Chain toMapReduce v (Note _ t) = toMapReduce v t -- TODO: keep notes -- Singletons are singled out toMapReduce _ (Datum (Array a)) | [datum] <- toList a = SingletonArray . wrap $ Datum datum -- A datum stays constant toMapReduce _ t@(Datum _) = None $ wrap t -- The presence of the variable toMapReduce v (Term VAR w _) | sameVar v w = Map [] -- An arbitrary term toMapReduce v t@(Term type' args optargs) = let -- Recursively convert all arguments args' = map (toMapReduce v) args optargs' = map (\(TermAttribute k vv) -> (k, toMapReduce v vv)) optargs -- Count how many of the arguments have been rewritten nb = length $ filter notConst $ args' ++ map snd optargs' -- Rewrite the current term. rewrite1 is optimised for -- the single count case rewrite = MapReduce $ (if nb == 1 then rewrite1 else rewritex) type' args' optargs' in case nb of -- Special case for singleton arrays 0 | Just sing <- singleton type' args' optargs -> SingletonArray sing -- Special case for snoc 1 | UNION <- type', [x, SingletonArray s] <- args', [] <- optargs' -> AddBase s x -- Don't rewrite if there is nothing to rewrite 0 -> None $ wrap t -- Don't rewrite an operation that can be chained 1 | (arg1 : _) <- args', notConst arg1 -> fromMaybe rewrite $ mrChain type' arg1 (tail args) optargs -- Default to rewriting the term _ -> rewrite singleton :: TermType -> [Chain] -> [TermAttribute] -> Maybe ReQL singleton MAKE_ARRAY [None el] [] = Just el singleton _ _ _ = Nothing -- | Chain a ReQL command onto a MapReduce operation mrChain :: TermType -> Chain -> [Term] -> [TermAttribute] -> Maybe Chain mrChain REDUCE (AddBase base (Map maps)) [f] [] = Just $ MapReduceChain maps $ BuiltInReduce REDUCE [wrap f] [] $ MRF (MapFun id) (toFun2 f) (Just base) id -- | A built-in map mrChain tt (Map maps) args optargs | Just mrf <- mapMRF tt args optargs = Just . Map . (: maps) $ BuiltInMap tt (map wrap args) (map baseAttrToOptArg optargs) mrf -- | A built-in reduction mrChain tt (Map maps) args optargs | Just mrf <- reduceMRF tt args optargs = Just . MapReduceChain maps $ BuiltInReduce tt (map wrap args) (map baseAttrToOptArg optargs) mrf mrChain _ _ _ _ = Nothing -- | Convert some builtin operations into a map mapMRF :: TermType -> [Term] -> [TermAttribute] -> Maybe MapFun mapMRF MAP [f] [] = Just . MapFun $ toFun1 f mapMRF PLUCK ks [] = Just . MapFun $ \s -> op' PLUCK (s : map wrap ks) [noRecurse] mapMRF WITHOUT ks [] = Just . MapFun $ \s -> op' WITHOUT (s : map wrap ks) [noRecurse] mapMRF MERGE [b] [] = Just . MapFun $ \s -> op' MERGE [s, wrap b] [noRecurse] mapMRF CONCAT_MAP [f] [] = Just . ConcatMapFun $ toFun1 f mapMRF FILTER [f] [] = Just . ConcatMapFun $ \x -> branch (toFun1 f x # handle (const False)) x () mapMRF FILTER [f] [TermAttribute "default" defval] = Just . ConcatMapFun $ \x -> branch (toFun1 f x # handle (const defval)) x () mapMRF GET_FIELD [attr] [] = Just . ConcatMapFun $ \x -> branch (op' HAS_FIELDS (x, wrap attr) [noRecurse]) [op' GET_FIELD (x, attr) [noRecurse]] () mapMRF HAS_FIELDS sel [] = Just . ConcatMapFun $ \x -> branch (op' HAS_FIELDS (x : map wrap sel) [noRecurse]) [x] () mapMRF WITH_FIELDS sel [] = Just . ConcatMapFun $ \x -> branch (op' HAS_FIELDS (x : map wrap sel) [noRecurse]) [op' PLUCK (x : map wrap sel) [noRecurse]] () mapMRF BRACKET [k] [] = Just . MapFun $ \s -> op' BRACKET (s, k) [noRecurse] mapMRF _ _ _ = Nothing -- | Convert some of the built-in operations into a map/reduce -- -- TODO: these have not been tested reduceMRF :: TermType -> [Term] -> [TermAttribute] -> Maybe MRF reduceMRF REDUCE [f] [] = Just $ MRF (MapFun id) (toFun2 f) Nothing id reduceMRF COUNT [] [] = Just $ MRF (MapFun $ const (num 1)) (\a b -> op ADD (a, b)) (Just 0) id reduceMRF AVG [] [] = Just $ MRF (MapFun $ \x -> expr [x, 1]) (\a b -> expr [a R.! 0 R.+ b R.! 0, a R.! 1 R.+ b R.! 1]) Nothing (\x -> x R.! 0 R./ x R.! 1) reduceMRF SUM [] [] = Just $ MRF (MapFun id) (R.+) (Just 0) id reduceMRF SUM [sel] [] = Just $ MRF (MapFun $ toFun1 sel) (R.+) (Just 0) id reduceMRF MIN [] [] = Just $ MRF (MapFun id) (\a b -> branch (a R.< b) a b) Nothing id reduceMRF MIN [sel] [] = Just $ MRF (MapFun $ \x -> expr [x, toFun1 sel x]) (\a b -> branch (a R.! 1 R.< b R.! 1) a b) Nothing (R.! 0) reduceMRF MAX [] [] = Just $ MRF (MapFun id) (\a b -> branch (a R.> b) a b) Nothing id reduceMRF MAX [sel] [] = Just $ MRF (MapFun $ \x -> expr [x, toFun1 sel x]) (\a b -> branch (a R.! 1 R.> b R.! 1) a b) Nothing (R.! 0) reduceMRF DISTINCT [] [] = Just $ MRF (MapFun $ \a -> expr [a]) (\a b -> distinct (a `union` b)) (Just (expr ())) id reduceMRF _ _ _ = Nothing -- | Convert from one representation to the other baseAttrToOptArg :: TermAttribute -> OptArg baseAttrToOptArg (TermAttribute k v) = k := v -- | This undocumented optional argument circumvents stream -- polymorphism on some operations noRecurse :: OptArg noRecurse = "_NO_RECURSE_" := True -- | Rewrite a command into a map/reduce. -- -- This is a special case for when only one of the arguments -- is itself a map/reduce rewrite1 :: TermType -> [Chain] -> [(T.Text, Chain)] -> MRF rewrite1 ttype args optargs = MRF maps red mbase finals where (finally2, [mr]) = extract Nothing ttype args optargs MRF maps red mbase fin1 = mr finals = finally2 . return . fin1 -- | Rewrite a command that combines the result of multiple map/reduce -- operations into a single map/reduce operation rewritex :: TermType -> [Chain] -> [(Key, Chain)] -> MRF rewritex ttype args optargs = MRF maps reduces Nothing finallys where (finally, mrs) = extract (Just 0) ttype args optargs index = zip $ map expr ([0..] :: [Int]) maps = MapFun $ \x -> expr $ map (($ x) . getMapFun) mrs reduces a b = expr $ map (uncurry $ mkReduce a b) . index $ map getReduceFun mrs finallys = let fs = map getFinallyFun mrs in \x -> finally . map (uncurry $ mkFinally x) $ index fs mkReduce a b i f = f (a!i) (b!i) mkFinally x i f = f (x!i) getMapFun (MRF (MapFun f) _ _ _) = f getMapFun (MRF (ConcatMapFun f) _ _ _) = f getReduceFun (MRF (MapFun _) f _ _) = f getReduceFun (MRF (ConcatMapFun _) f _ _) = \a b -> flip apply [a `union` b] $ \l -> branch (isEmpty l) () [reduce f l] getFinallyFun (MRF (MapFun _) _ _ f) = f getFinallyFun (MRF (ConcatMapFun _) _ mbase f) = f . maybe (R.! 0) (\base s -> flip apply [s] $ handle (const base) $ s R.! 0) mbase -- | Extract the inner map/reduce objects, also returning a function -- which, given the result of all the map/reduce operations, returns -- the result of the given command extract :: Maybe Int -> TermType -> [Chain] -> [(Key, Chain)] -> ([ReQL] -> ReQL, [MRF]) extract st tt args optargs = fst $ flip runState st $ runWriterT $ do args' <- sequence $ map extractOne args optargvs' <- sequence $ map extractOne (map snd optargs) let optargks = map fst optargs return $ \v -> op' tt (map ($ v) args') (Prelude.zipWith (:=) optargks $ map ($ v) optargvs') where extractOne chain = either (return . const) go $ chainToMRF chain go :: MRF -> WriterT [MRF] (State (Maybe Int)) ([ReQL] -> ReQL) go mrf = do tell [mrf] st' <- get case st' of Nothing -> return head Just n -> do put $ Just $ n + 1 return $ \v -> v !! n
/** * An error that is reported when the server returns valid JSON, but it doesn't match the format we expect. */ public static class InvalidJSONException extends LiveQueryException { // JSON used for matching. private final String json; /// Key that was expected to match. private final String expectedKey; /* package */ InvalidJSONException(String json, String expectedKey) { super(String.format(Locale.US, "Invalid JSON; expectedKey: %s, json: %s", expectedKey, json)); this.json = json; this.expectedKey = expectedKey; } public String getJson() { return json; } public String getExpectedKey() { return expectedKey; } }
<reponame>dominico966/Spark /** * Copyright (C) 2004-2011 <NAME>. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jivesoftware.sparkplugin.ui; import java.awt.Color; import java.awt.EventQueue; import java.awt.FlowLayout; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Image; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.geom.AffineTransform; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.List; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.event.CaretEvent; import javax.swing.event.CaretListener; import net.java.sipmack.common.Log; import net.java.sipmack.sip.InterlocutorUI; import net.java.sipmack.softphone.SoftPhoneManager; import net.java.sipmack.softphone.listeners.InterlocutorListener; import org.jivesoftware.resource.Default; import org.jivesoftware.smackx.vcardtemp.packet.VCard; import org.jivesoftware.spark.SparkManager; import org.jivesoftware.spark.component.RolloverButton; import org.jivesoftware.spark.phone.Phone; import org.jivesoftware.spark.phone.PhoneManager; import org.jivesoftware.spark.plugin.phone.resource.PhoneRes; import org.jivesoftware.spark.ui.ContactInfoWindow; import org.jivesoftware.spark.util.ModelUtil; import org.jivesoftware.sparkplugin.callhistory.HistoryCall; import org.jivesoftware.sparkplugin.phonebook.ui.PhonebookUI; import org.jivesoftware.sparkplugin.ui.call.CallHistoryUI; import org.jivesoftware.sparkplugin.ui.call.CallManager; /** */ public class ContactDialControl extends JPanel implements InterlocutorListener, Phone { private static final long serialVersionUID = 8848248512306073866L; private TelephoneTextField callField; private RolloverButton callButton; private RolloverButton callHistoryButton; private RolloverButton voiceMailButton; private boolean incomingCall; private static final JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0)); public ContactDialControl() { setLayout(new GridBagLayout()); // Add to PhoneManager. PhoneManager.getInstance().addPhone(this); callField = new TelephoneTextField(); voiceMailButton = new RolloverButton(PhoneRes.getImageIcon("VOICEMAIL_IMAGE")); // make a button for the phonebook RolloverButton phonebookButton = new RolloverButton(PhoneRes.getImageIcon("BOOKICON")); phonebookButton.setToolTipText(PhoneRes.getIString("frame.title")); callButton = new RolloverButton(PhoneRes.getImageIcon("DIAL_BUTTON_IMAGE")); callButton.setMargin(new Insets(0, 0, 0, 0)); callButton.setDisabledIcon(PhoneRes.getImageIcon("DIAL_BUTTON_DISABLED_IMAGE")); callHistoryButton = new RolloverButton(PhoneRes.getImageIcon("HISTORY_IMAGE")); // Create Dial Section final JLabel callLabel = new JLabel(PhoneRes.getIString("phone.call")+":"); callLabel.setForeground(new Color(64, 103, 162)); callLabel.setFont(new Font("Dialog", Font.BOLD, 11)); add(callLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 2, 2, 2), 0, 0)); add(callField, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 2, 2, 2), 0, 0)); add(callButton, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 2, 2), 0, 0)); buttonPanel.add(phonebookButton); buttonPanel.add(new JLabel(PhoneRes.getImageIcon("DIVIDER_IMAGE"))); buttonPanel.add(callHistoryButton); buttonPanel.add(voiceMailButton); buttonPanel.setOpaque(false); add(buttonPanel, new GridBagConstraints(4, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 2, 0, 2), 0, 0)); voiceMailButton.setToolTipText(PhoneRes.getIString("phone.call")); callHistoryButton.setToolTipText(PhoneRes.getIString("phone.viewcallhistory")); voiceMailButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { final SoftPhoneManager phoneManager = SoftPhoneManager.getInstance(); String voiceMailNumber = phoneManager.getSipAccount().getVoiceMailNumber(); if (ModelUtil.hasLength(voiceMailNumber)) { phoneManager.getDefaultGuiManager().dial(voiceMailNumber); } } }); callButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { placeCall(); } }); phonebookButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { try { EventQueue.invokeLater(new Runnable(){ public void run() { // open the UI PhonebookUI book = PhonebookUI.getInstance(); book.invoke(); } }); } catch(Exception ex) { Log.error(ex); } } }); callHistoryButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { showCallList(); } }); setOpaque(false); // Set Line Border setBorder(BorderFactory.createLineBorder(new Color(197, 213, 230), 1)); Font font = new Font("Dialog", Font.BOLD, 11); voiceMailButton.setFont(font); voiceMailButton.setHorizontalTextPosition(JButton.RIGHT); // Listen for creation of new Interlocutor SoftPhoneManager.getInstance().addInterlocutorListener(this); callField.getTextComponent().addCaretListener(new CaretListener() { public void caretUpdate(CaretEvent caretEvent) { callButton.setEnabled(ModelUtil.hasLength(callField.getText()) && callField.isEdited()); callField.validateTextField(); } }); callField.getTextComponent().addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if (!callField.getTextComponent().isEnabled() || !callField.isEdited() || !ModelUtil.hasLength(callField.getText())) { return; } if (e.getKeyCode() == KeyEvent.VK_ENTER) { placeCall(); } } }); callButton.setEnabled(false); // Initialize CallManager. CallManager.getInstance(); } private void placeCall() { if (incomingCall) { SoftPhoneManager.getInstance().getDefaultGuiManager().answer(); enableIt(false); } else { final SoftPhoneManager phoneManager = SoftPhoneManager.getInstance(); if (phoneManager.getInterlocutors().size() > 0) { phoneManager.getDefaultGuiManager().hangupAll(); } else { phoneManager.getDefaultGuiManager().dial(callField.getText()); } } } public void setVoiceMailLabel(String text) { voiceMailButton.setText(text); } public void setVoiceMailDescription(String description) { voiceMailButton.setToolTipText(description); } public void paintComponent(Graphics g) { final Image backgroundImage = Default.getImageIcon(Default.TOP_BOTTOM_BACKGROUND_IMAGE).getImage(); double scaleX = getWidth() / (double)backgroundImage.getWidth(null); double scaleY = getHeight() / (double)backgroundImage.getHeight(null); AffineTransform xform = AffineTransform.getScaleInstance(scaleX, scaleY); ((Graphics2D)g).drawImage(backgroundImage, xform, this); } public void interlocutorAdded(InterlocutorUI ic) { String callState = ic.getCallState(); if (!ModelUtil.hasLength(callState)) { incomingCall = true; callField.getTextComponent().setEnabled(false); callButton.setEnabled(true); callButton.setToolTipText("Place phone call."); } else { incomingCall = false; showOnCall(); } if (!callField.isEdited()) { callField.setText(ic.getCall().getNumber()); } } public void interlocutorRemoved(InterlocutorUI interlocutorUI) { enableIt(true); incomingCall = false; //callField.reset(); } private void enableIt(boolean enable) { callField.getTextComponent().setEnabled(enable); callButton.setEnabled(enable); callButton.setIcon(PhoneRes.getImageIcon("DIAL_BUTTON_IMAGE")); if (enable) { callButton.setToolTipText(PhoneRes.getIString("phone.placecall")); } } private void showOnCall() { callField.getTextComponent().setEnabled(false); callButton.setIcon(PhoneRes.getImageIcon("HANG_UP_PHONE_IMAGE")); callButton.setToolTipText(PhoneRes.getIString("phone.tips.hangup")); } private void showCallList() { CallHistoryUI callHistory = new CallHistoryUI(); callHistory.invoke(); } final Comparator<HistoryCall> itemComparator = new Comparator<HistoryCall>() { public int compare(HistoryCall contactItemOne, HistoryCall contactItemTwo) { final HistoryCall time1 = contactItemOne; final HistoryCall time2 = contactItemTwo; if (time1.getTime() < time2.getTime()) { return 1; } else if (time1.getTime() > time2.getTime()) { return -1; } return 0; } }; /** * Used as the action to place Calls. */ private class CallAction extends AbstractAction { private static final long serialVersionUID = -6558494299123278779L; private String number; public CallAction(String label, String number, Icon icon) { this.number = number; putValue(Action.NAME, "<html><b>" + label + "</b>&nbsp;&nbsp;" + number + "</html>"); putValue(Action.SMALL_ICON, icon); } public void actionPerformed(ActionEvent e) { callField.setText(number); placeCall(); } } public void handleContactInfo(final ContactInfoWindow contactInfo) { } public Collection<Action> getPhoneActions(String jid) { if(!isVisible()){ return Collections.emptyList(); } final VCard vcard = SparkManager.getVCardManager().getVCardFromMemory(jid); final List<Action> actions = new ArrayList<Action>(); final String workNumber = vcard.getPhoneWork("VOICE"); final String homeNumber = vcard.getPhoneHome("VOICE"); final String cellNumber = vcard.getPhoneWork("CELL"); if (ModelUtil.hasLength(homeNumber)) { Action dialHomeAction = new CallAction(PhoneRes.getIString("phone.home")+":", homeNumber, PhoneRes.getImageIcon("HOME_IMAGE")); actions.add(dialHomeAction); } if (ModelUtil.hasLength(workNumber)) { final Action dialWorkAction = new CallAction(PhoneRes.getIString("phone.work")+":", workNumber, PhoneRes.getImageIcon("WORK_IMAGE")); actions.add(dialWorkAction); } if (ModelUtil.hasLength(cellNumber)) { final Action dialCellAction = new CallAction(PhoneRes.getIString("phone.cell")+":", cellNumber, PhoneRes.getImageIcon("MOBILE_IMAGE")); actions.add(dialCellAction); } return actions; } public TelephoneTextField getCallField() { return callField; } public static void addButton(JButton btn) { buttonPanel.add(btn); } }
/// \brief Run checkers for evaluating a call. /// Only one checker will evaluate the call. void CheckerManager::runCheckersForEvalCall(ExplodedNodeSet &Dst, const ExplodedNodeSet &Src, const CallEvent &Call, ExprEngine &Eng) { const CallExpr *CE = cast<CallExpr>(Call.getOriginExpr()); for (ExplodedNodeSet::iterator NI = Src.begin(), NE = Src.end(); NI != NE; ++NI) { ExplodedNode *Pred = *NI; bool anyEvaluated = false; ExplodedNodeSet checkDst; NodeBuilder B(Pred, checkDst, Eng.getBuilderContext()); for (std::vector<EvalCallFunc>::iterator EI = EvalCallCheckers.begin(), EE = EvalCallCheckers.end(); EI != EE; ++EI) { ProgramPoint::Kind K = ProgramPoint::PostStmtKind; const ProgramPoint &L = ProgramPoint::getProgramPoint(CE, K, Pred->getLocationContext(), EI->Checker); bool evaluated = false; { CheckerContext C(B, Eng, Pred, L); evaluated = (*EI)(CE, C); } assert(!(evaluated && anyEvaluated) && "There are more than one checkers evaluating the call"); if (evaluated) { anyEvaluated = true; Dst.insert(checkDst); #ifdef NDEBUG break; #endif } } if (!anyEvaluated) { NodeBuilder B(Pred, Dst, Eng.getBuilderContext()); Eng.defaultEvalCall(B, Pred, Call); } } }
Predicting the number of citations of polycystic kidney disease with 100 top-cited articles since 2010: Bibliometric analysis Background: Polycystic kidney disease (PKD) is a genetic disorder in which the renal tubules become structurally abnormal, resulting in the development and growth of multiple cysts within the kidneys. Numerous studies on PKD have been published in the literature. However, no such articles used medical subject headings (MeSH terms) to predict the number of article citations. This study aimed to predict the number of article citations using 100 top-cited PKD articles (T100PKDs) and dissect the characteristics of influential authors and affiliated counties since 2010. Methods: We searched the PubMed Central® (PMC) database and downloaded 100PKDs from 2010. Citation analysis was performed to compare the dominant countries and authors using social network analysis (SNA). MeSh terms were analyzed by referring to their citations in articles and used to predict the number of article citations using its correlation coefficients (CC) to examine the prediction effect. Results: We observed that the top 3 countries and journals in 100PKDs were the US (65%), Netherlands (7%), France (5%), J Am Soc Nephrol (21%), Clin J Am Soc Nephrol (8%), and N Engl J Med (6%); the most cited article (PMID = 23121377 with 473 citations) was authored by Vicente Torres from the US in 2012; and the most influential MeSH terms were drug therapy (3087.2), genetics (2997.83), and therapeutic use (2760.7). MeSH terms were evident in the prediction power of the number of article citations (CC = 0.37; t = 3.92; P < .01, n = 100). Conclusions: A breakthrough was made by developing a method using MeSH terms to predict the number of article citations based on 100PKDs. MeSH terms are evident in predicting article citations that can be applied to future research, not limited to PKD, as we did in this study. Introduction Polycystic kidney disease (PKD) is an autosomal dominant kidney disorder that cannot be cured during clinical treatment. The disease is common in both children and adults and leads to the progressive loss of kidney function. Common symptoms, including arterial hypertension, recurrent urinary tract infection, and nephrolithiasis, cause structural abnormalities as a result of increased dysfunction and abdominal pain in patients with PKD. Publications regarding PKD in the literature Approximately 0.1% of people worldwide are affected by PKD. More than half of the patients developed end-stage PKD. Recently, an increasing number of patients have been diagnosed with PKD without any symptoms due to other coexisting problems and diseases. However, patients with PKD are not easily cured. This is because of the lack of human in vitro assays for compound testing, and the development of drugs has become difficult The authors have no funding and conflicts of interest to disclose. All data generated or analyzed during this study are included in this published article . The datasets generated during and/or analyzed during the current study are available from the corresponding author on reasonable request. Supplemental Digital Content is available for this article. Medicine in clinical tests. Advanced documents for assisting patients in alleviating their PKD condition are urgently required for investigations. For instance, research reported that when patients get older, the glomerular filtration rate is lower than that in normal people. Similarly, an increasing number of articles on PKD have been published in the past. These research works are helpful in providing deeper insights to clinical physicians and researchers for better understanding the modern advancement of PKD. As such, the top-cited articles should be collected and predicted using bibliometric analysis. Nonetheless, we have not seen any that are about the top-cited PKD articles reported in PubMed Central® (PMC), although 995 papers have been searched using the keyword Polycystic + kidney + disease (MeSH + Major + Topic) as of August 4, 2021. Bibliometric analysis of the top-cited PKD articles Bibliometry is a technique that analyzes articles with quantity and quality in a disciple (or on a specific topic) through a series of statistical methods. In addition, bibliometrics can also present the relationship between authors, research institutions, and affiliated countries of orientation. The citation analysis regarding the number of articles predicted by factors (e.g., MeSH terms) was addressed in the literature. The most influential and productive authors and countries in the medical discipline were also found in the past. Thus, we are motivated to investigate whether the number of article citations on the PKD topic can be predicted. Study aims Although numerous influential articles and eminent authors have been reported, such as lung cancer, ophthalmic epidemiology, cardiovascular, and asthma. None of them were regarding PKD. This study aims to predict the number of article citations using 100 top-cited PKD articles (T100PKDs) and dissect the characteristics of influential authors and affiliated counties since 2010. Data sources We programmed Microsoft Excel's Visual Basic for Applications modules to extract the downloaded abstracts published on PKD within the article title since 2010. The search terms were defined as (PKD ). All the top 100 cited articles from the 2608 downloaded articles were published between 2010 and 2019. Because the data of this study were based on published literature, ethical approval and patient consent were not needed. Only articles labeled journal articles were included in the analyses. Others, such as those marked as "Published Erratum, Editorial, or conference proceedings," were excluded. Article citations were extracted and matched to the T100PKDs to compare author individual research achievements (RCs) and impact factors based on MeSH terms in T100PKDs. Data arrangement to fit the SNA requirement Before visualizing our results using social network analysis (SNA), we organized the data in compliance with the format and guidelines defined by the Pajek software. Microsoft Excel's Visual Basic for Applications routines were used to fit the data to the SNA requirements. The number of connections for a MeSH term in an article was computed using the weight (W i ) shown in Equation (1), where L denotes the number of MeSH terms in an article, and j represents the location in an article. In SNA, each MeSH term defined as a note earns the centrality degree (CD) computed using Equation (2), where n denotes the journal sample size, and the CD for a given MeSH term is determined by using the summed weights in the given journal. Cluster analyses combined with article citations were performed to observe the author and MeSH RCs. Absolute density was used to denote the important role of a specific cluster. In contrast, the relative density was used to represent the role of the RCs in the authors and MeSH terms using Equation (3). WCD i is the weighted RCs for entities (i.e., authors and MeSH terms in this study) computed by citations and the CD in networks. c i is the citation of the articles. J is the number of entities in an article. Two tables on affiliated countries and journals. The publications of T100PKDs have been tabulated across countries and journals over the years. The impact factor (IF = citations/ publications) was calculated for each country and journal in tables. Two figures for affiliated countries on choropleth maps. The 2608 downloaded data were counted by country/ region and individual US states and China's provinces displayed on choropleth maps. Two figures for authors and mesh terms using SNA. The authors and MeSH terms for T100PKDs were analyzed using Equation (3). The influential entities denoted by impacted factors based on T100PKDs were highlighted on the dashboards. The author-weighted CD in Equation (3) was adjusted by an author-weighted scheme. The first authors earn the most credit (approximately 63%) in their articles. The second (approximately 12%) is given to the corresponding authors (assigned to the last author in the article byline in this study), while the other middle authors are allocated with the remaining credits according to the author order in article bylines. In contrast, the weighted CDs in the MeSH terms are equal, based on Equations (1) and (2), respectively. The prediction of article citations associated with the weighted IFs of mesh terms. The IFs of MeSH terms were computed based on equal-size proportions and citations in an article. The weighted scores yielded by MeSH weights (i.e., the number of citations per article) in each article were used to predict the original citations. The computation of the weighted MeSH citations is presented in Equation (4). Statistics The correlation coefficient (CC) was used to determine the predictive power between weighted MeSH terms and original article citations. The CC t value was calculated using the following formula: CC × » Results Since 2010, 2608 publications have been retrieved from the PubMed database. The T100PKDs are listed with a link. The total citation counts ranged from 44 to 473, as of July 30, 2021, in PMC, with a total of 8092 citations. The mean number of citations was 80.92. The most productive countries/journals The most productive countries in the T100PKDs were the US (65%), the Netherlands (7%), and France (5%). Most articles were published in J Am Soc Nephrol (21%), Clin J Am Soc Nephrol (8%), and N Engl J Med (6%) (see Tables 1 and 2). The most cited countries and journals were Switzerland (211) and N Engl J Med (211). The most cited article and authors The most cited article with 473 citations (PMID = 23121377) was authored by Vucente E Tirres from the US in 2012. The most highlighted authors (with larger bubbles in Fig. 3) in SNA were Vicente Torres from the US, followed by Arlene B Chapman (US), and Emilie Cornec-Le Gall (France), linked by 3 blue lines in Figure 3. Readers are invited to scan the QR code and click on the bubble of interest to read the author's articles shown in PubMed. The most cited mesh terms in SNA Through the citation analysis, the major topics denoted by MeSH terms were clustered, as shown in Figure 4. Equations (3) and (4) were applied to highlight the most influential MeSH terms in SNA. We can see that the top 3 with larger bubbles denoted by WCD in Equation (3) were drug therapy (3087.2), genetics (2997.83), and therapeutic use (2760.7), indicating that the 3 had frequently cited citations in T100PKDs. Several other major clusters constructed by the associations between MeSH terms are presented in Figure 4. Using MeSH terms to predict the number of article citations in T100PKDs After using the MeSH weights to associate with article citations based on the scheme of equal weight in article (i.e., different AWS based on author order ), MeSH terms are evident in the predictive power of the number of article citations (CC = 0.37; t = 3.92; P < .01, n = 100) (Fig. 5). The regression equation is defined as article citation (y) = y = 4.5229 + 1.0206 × weight (x) of MeSH terms. The slope coefficient was statistically significant (F = 3.92, P < .002), as shown in Figure 5. Online dashboards shown on Google maps All dashboards in the figures would appear once the QR code is clicked on the links. Readers are advised to examine the details of each entity's information. Discussion Bibliometric analysis explores the characteristics of previously published articles based on specific features, which provides readers with important information for understanding trends and primary research concerns in certain fields. In this study, we conducted a bibliometric analysis and identified the T100PKDs published since 2010 in PMC. Our study establishes a prediction model using MeSH terms to predict the number of citations based on 100 top-cited articles downloaded from the PMC. We found that the prediction model can provide information about which MeSH terms with higher weights (i.e., the prediction power) are related to the article receiving the most citations. Such a model offers a way to recognize the influence of recent work and the value of the articles on PKD. Dominant countries and journals on PKD In this study, we found that more than half of the T100PKDs were from the US (n = 63). This can be attributed to the fact that the US spent many research grants on PKD. A study reported that the estimated total annual costs attributed to ADPKD in 2018 ranged from $7.3 to $9.6 billion in sensitivity analyses, equivalent to $51,970 to $68,091 per individual with PKD. There were 37 journals in the T100PKDs. Among them, J Am Soc Nephrol (n = 21) ranked first, followed by Clin J Am Soc Nephrol (n = 8) and N Engl J Med (n = 6). We found that these 3 deserve achievements when referring to journal impact factors, reaching 10.121, 8.237, and 91.245, respectively, in 2020. The most-cited articles The most cited article was published in 2012, and it is titled "Tolvaptan in patients with autosomal dominant polycystic kidney disease" and was authored by Vicente Torres et al It was cited 471 times. Studies of animal models have shown that tolvaptan, a vasopressin V2-receptor antagonist, can reduce the cyst burden and protect kidney function. The research progressed to a clinical trial with 63 patients with PKD and successfully demonstrated that tolvaptan can reduce the rates of worsening kidney function. The second most cited article was published in 2010, and it is titled "Everolimus in patients with autosomal dominant polycystic kidney disease" authored by Gerd Walz et al Mammalian target of rapamycin (mTOR) is hypothesized to promote cyst formation. mTOR inhibitors are used to reduce the volumes of both the kidney and liver. After a 1-year experiment, the PKD patients treated with mTOR inhibitors had a smaller kidney volume than the placebo group but did not slow the progression of renal impairment. The third-ranked article was published in 2010, and it is titled "Sirolimus and kidney growth in autosomal dominant polycystic kidney disease" authored by Andreas L Serra et al The study also tested whether sirolimus (an mTOR inhibitor) can slow down kidney volume growth in adult PKD patients. The study showed that using sirolimus for 18 months did not prevent the growth of polycystic kidneys in adult patients with PKD and early chronic kidney disease. Strengths and limitations The strength of this study is that MeSH terms were classified into research topics using SNA displaying dashboards on Google Maps, which highlighted the most dominant entities in which the PKD authors were interested. Readers can manipulate the links independently to better understand the association between the entities the authors are concerned with in this study. In addition, applying MeSH terms to predict the number of article citations is a useful and viable way to identify the most dominant research topic in the field of PKD, which will help future academic pursuits in the PKD field. The research approach used in this study has the potential for application to other topics or disciplines in the future. However, this study has some limitations. First, we used only a single database to extract the top 100 articles. The results of this study might be different if the articles were retrieved from other major citation databases, such as Scopus, Web of Science, and Embase. Second, the authors used total citations as the measurement of impact as of August 2, 2021. Total citation counts were significantly associated with the age of the article. The older the articles, the more citations they may receive from citing articles. The most recently published articles are at a disadvantage in terms of the number of citations owing to the time effect. Third, citation count does not directly reflect the quality of an article but enables a quantitative evaluation of the scientific impact of an article in a designated field. Thus, although citation statistics have been frequently criticized, analyses of citation rates provide current academic development in a certain field and may offer a historical perspective on its scientific progress. Fourth, the number of article citations might be affected by several extrinsic factors, such as journal impact factors and authors' achievements. Using MeSH terms to predict future citation counts based on T100PKD might have some limitations and biases. More factors should be considered to reach a more valid prediction in the future. Fifth, there were only 3 articles with a huge number of citations describing possible reasons in discussions due to space limitations. Readers are invited to read other articles in detail on PubMed by clicking on the link we collected in this study. Finally, dashboards in the figures are shown on Google Maps. These installments are not free of charge because the Google Maps application programming interface requires a paid project key for the Google cloud platform. Thus, the limitations of the dashboard are that it is not publicly accessible, and it is difficult for other authors to mimic its use in a short period of time. Nonetheless, the process of making dashboards with MP4 video using Microsoft Excel is provided to help readers apply the procedures to other topics, not just limited to the PDK as we did in this study. Conclusions The US and Netherlands occupied the dominant places on T100PKD since 2010, accounting for 63% and 7%, respectively. Most articles were published in Clin J Am Soc Nephrol (8%) and N Engl J Med (6%). The most frequently occurring MeSH terms were drug therapy, therapeutic use, and genetics. MeSH terms can be used to predict the number of article citations (F = 3.92; P < .002). Our study made a breakthrough to report the characteristics of the T100PKD by using SNA displaying dashboards on Google Maps and provided deep insight into the T100PKD. Most articles focused on drug therapy, therapeutic use, and genetics with a better understanding of treatment targets for PDK in the past. We suggest using similar approaches to identify the most dominant entities in article topics, authors, and research institutes using SNA. Researchers are encouraged to exploit the characteristics and spot bursts on other topics in the future using bibliometric analysis, not limited to the PKD as we did in this study.
At the end of the secular year, "top 10" lists abound. Check out our picks - in no particular order - for the most exciting moments of 2014 within the Reform Jewish world. Do you agree with our list? What would you add? Religious pluralism makes major advances in Israel: This year saw encouraging stories of the increasing acceptance of non-Orthodox Judaism in Israel. Haaretz gathered eight great examples, including the state’s agreement to begin paying salaries to rabbis representing non-orthodox movements and celebration of the first bat mitzvah at the Western Wall in modern history, complete with a tiny sefer Torah sneaked onto the women’s side of the Kotel. NFTY celebrates its 75th anniversary: For more than three quarters of a century, the North American Federation of Temple Youth – more affectionately known as NFTY – has existed as Reform Judaism’s youth movement, offering Jewish teens the opportunity to explore and live Reform Jewish values. Today, more than 500 congregations have temple youth groups affiliated with NFTY, helping more than 8,000 Jewish teens annually to forge their Reform Jewish identities. NFTY is celebrating this landmark anniversary with a year of events for current members and alumni alike. Happy birthday, NFTY! Rabbi Rick Jacobs speaks at Presbyterian Church (USA) convention: When the Presbyterian Church (USA) considered whether to divest from companies doing business in Israel due to the Israeli-Palestinian conflict, the president of the largest Jewish denomination in North America, urged them not to. In June, PC(USA) invited Rabbi Rick Jacobs, president of the Union for Reform Judaism, to speak at their General Assembly, where he implored delegates of the Presbyterians' voting body to choose engagement with Jewish partners on Israel-Palestine peace issues. To the dismay of many American Jews, PC(USA) forged ahead with a vote to divest. Rabbi David Saperstein named to prestigious U.S. ambassadorial position: In mid-December, the Senate voted 62-35 to confirm Rabbi David Saperstein, longtime director of the Religious Action Center of Reform Judaism, to the post of Ambassador-at-Large for International Religious Freedom. Saperstein, a lawyer and tireless advocate for social justice, was nominated by President Obama in July and, once sworn in, will become the first non-Christian to hold the position. In this role, he will also head the State Department’s Office of International Religious Freedom. Two new Reform summer camps open: In the summer of 2014, two new summer camps joined the URJ Camps family, rounding out the number of Reform Jewish summer camps in North America to 15 (for now!) URJ Harlam Day Camp, located near Philadelphia, is the first Reform-affiliated day camp, and URJ 6 Points Sci-Tech Academy, near Boston, is a specialty camp focused on science and technology. Both camps experienced full and successful inaugural summers and look forward to continued growth in the summer of 2015. (Registration is open now for all URJ Camps.) Reform rabbis help clinch immigration and economic justice victories: Reform rabbis help clinch victories for immigration reform and economic justice: During the High Holidays, Reform rabbis across the U.S. called Immigration and Customs Enforcement to urge them to stop the deportation of Luis Lopez Acabal, a Guatemalan refugee of gang violence and the sole breadwinner for his wife and two children. After 100 days of sanctuary in an Arizona church, Lopez Acabal received confirmation that he will not be deported, and we was able to return home to his family in time for Christmas. And over the summer in California, Reform rabbis representing a social justice movement called Reform CA mobilized congregants to tackle an affordable housing crisis at the state level. From meetings with legislators in Sacramento to sermons on the moral imperative for providing affordable housing, Reform CA successfully advocated for cap-and-trade funding to be used for affordable homes built near public transit in California. Ten Minutes of Torah turns 10! When Rabbi Eric Yoffie launched Ten Minutes of Torah, he proclaimed that Reform Jews must study Torah on a regular basis and that even 10 minutes of study each day could transform lives. Today, more than 20,000 subscribers receive Ten Minutes of Torah emails, bringing the Jewish world to their inbox every morning. From Torah commentaries to recipes for baking challah, Ten Minutes of Torah explores the great variety of Jewish life. Sign up for Ten Minutes of Torah today. Major Reform institutions welcome new leadership: It was an exciting year for several Reform Jewish organizations that saw changes in their top leadership. In June, Rabbi Aaron Panken took the helm as the twelfth president of Hebrew Union College-Jewish Institute of Religion, the Reform seminary. In September, the World Union for Progressive Judaism welcomed its new president, Rabbi Daniel Freelander, who dove into his presidency with trips to Poland and Israel on the global organization’s behalf. And in December, the Union for Reform Judaism announced two new executives: sought-after synagogue consultant Amy Asin will serve as vice president and director of strengthening congregations, and Miriam Chilton will become a vice president responsible for the URJ’s youth work, including camping, Israel, and youth group programming. Rabbi Angela Warnick Buchdahl lights the White House menorah: At this year’s annual White House Hanukkah party, President Obama invited Rabbi Angela Warnick Buchdahl to offer remarks and recite the Hanukkah blessing. Rabbi Buchdahl, who serves as senior rabbi of Central Synagogue in Manhattan and is also an ordained cantor, is the first Asian-American individual to be ordained as either a rabbi or cantor in the U.S. She told the crowd, “I have to predict that [our founding fathers] could not imagine that in 2014 that there would be a female, Asian-American rabbi lighting the menorah at the White House for an African-American president.” ReformJudaism.org passes two million unique users: ReformJudaism.org, launched in late 2012, is geared toward the Jewish community-at-large and at those seeking spiritual guidance and a community of their own. Now a top result in Jewish Google searches, the site saw its two millionth unique user in 2014 and will continue to grow in the year to come. We at ReformJudaism.org offer our thanks to you – yes, you, reading this! – for your support of this site. As the secular new year approaches, we look to the future and eagerly anticipate the “top 10” moments we’ll recap at this time next year. In 2015, we’ll have our eye on a few key events, including: the launch of the URJ Ruderman Disabilities Inclusion Learning Center, an innovative and interactive online resource center to help Reform congregations to better welcome people with disabilities and their families; the World Zionist Congress elections in October (learn more, including how American Jews can vote); and the Union for Reform Judaism’s 73rd Biennial Convention, taking place in Orlando, FL, in November. From all of us here at ReformJudaism.org, we’re wishing a very happy new year to you and yours!
<filename>src/components/index.ts<gh_stars>0 export { Button } from "./Button" export { FoodTypeTag } from "./FoodTypeTag" export { Image } from "./Image" export { BlogPost, HtmlNode } from "./BlogPost" export { Bio } from "./Bio"
// New creates a new client depending on the token type func New(ctx *context.Context) (Client, error) { if ctx.TokenType == context.TokenTypeGitHub { return NewGitHub(ctx) } if ctx.TokenType == context.TokenTypeGitLab { return NewGitLab(ctx) } return nil, nil }
/** * Mark multiple hits. * * @param hits Number of hits. */ public void onHits(long hits) { long curTs = U.currentTimeMillis(); int curPos = position(curTs); clearIfObsolete(curTs, curPos); lastHitTimes.set(curPos, curTs); taggedCounters.addAndGet(curPos, hits); }
// GetUnitMeta returns information about the "best" entity (module, path or directory) with // the given path. The module and version arguments provide additional constraints. // If the module is unknown, pass internal.UnknownModulePath; if the version is unknown, pass // internal.LatestVersion. // // The rules for picking the best are: // 1. If the version is known but the module path is not, choose the longest module path // at that version that contains fullPath. // 2. Otherwise, find the latest "good" version (in the modules table) that contains fullPath. // a. First, follow the algorithm of the go command: prefer longer module paths, and // find the latest unretracted version, using semver but preferring release to pre-release. // b. If no modules have latest-version information, find the latest by sorting the versions // we do have: again first by module path length, then by version. func (db *DB) GetUnitMeta(ctx context.Context, fullPath, requestedModulePath, requestedVersion string) (_ *internal.UnitMeta, err error) { defer derrors.WrapStack(&err, "DB.GetUnitMeta(ctx, %q, %q, %q)", fullPath, requestedModulePath, requestedVersion) defer middleware.ElapsedStat(ctx, "DB.GetUnitMeta")() modulePath := requestedModulePath version := requestedVersion var lmv *internal.LatestModuleVersions if requestedVersion == internal.LatestVersion { modulePath, version, lmv, err = db.getLatestUnitVersion(ctx, fullPath, requestedModulePath) if err != nil { return nil, err } } return db.getUnitMetaWithKnownLatestVersion(ctx, fullPath, modulePath, version, lmv) }
/** * Determine if this Report implies that the given DataSegment needs to be * resent. i.e., True if: * <ul> * <li>DataSegment is red * <li>DataSegment has not been acknowledged by a prior ReportSegment. * <li>DataSegment is in scope of the ReportSegment * </ul> * @param dataSegment Given DataSegment * @return True if resend required */ public boolean isResendRequired(DataSegment dataSegment) { long segmentLowerBound = dataSegment.getClientDataOffset(); long segmentUpperBound = segmentLowerBound + dataSegment.getClientDataLength(); if (dataSegment.isRedData() && !dataSegment.isAcked() && segmentLowerBound >= getLowerBound() && segmentUpperBound <= getUpperBound()) { return true; } else { return false; } }
def new(cls, size: tuple): return ASCIMTable([[None] * size[0]] * size[1])
Advertisement The Bill and Melinda Gates Foundation has proven of late to be a spur to developing nanotechnology-based solutions to some of the world’s problems, like a system for sterilizing medical equipment even in places where there is no electricity. The foundation's latest Grand Challenge Exploration grants are aimed at improving the humble condom. The Gates Foundation granted $100 000 to the University of Manchester to develop a condom in November of last year, reportedly using graphene, that would lead to thinner yet stronger condoms. With the University of Manchester becoming a “hub” for graphene research, it makes sense that any efforts to use graphene for the improvement of condoms would take place there. But the Gates Foundation apparently didn’t want to limit the prospects of improving prophylactics to just graphene. Last week, it was announced that the Boston University School of Medicine (BUSM) and Boston Medical Center (BMC) have been awarded a $100 000 Grand Challenge grant to develop a better condom using nanotechnology. "We are honored to be a recipient of a GCE grant project in order to examine this important public health issue," says Karen Buch MD, a third year radiology resident at BMC and Ducksoo Kim MD, professor of radiology at BUSM in a Boston Magazine article. "We look forward to using nanotechnology to create a condom that is both effective and does not diminish sensation, which could help convince more people to use condoms and potentially reduce the incidence of sexually transmitted infections." The nanotechnology that the Boston doctors intend to use for their improved condoms will be superdhydrophillic nanoparticles that coat the condom and trap water to make them more resilient and easier to use. "We believe that by altering the mechanical forces experienced by the condom, we may ultimately be able to make a thinner condom which reduces friction, thereby reducing discomfort associated with friction [and] increases pleasure, thereby increasing condom use and decreases rates of unwanted pregnancy and infection transmission," Kim says in a press release. So it appears the race is now on. Will hydrophilic nanoparticles or graphene be the nanomaterial of the future for condoms? Maybe both. Photo: iStockphoto
use super::*; use specs::prelude::*; pub struct RenderSystem; pub struct RenderSystemData { depth_texture: Texture, } impl<'a> System<'a> for RenderSystem { type SystemData = ( WriteExpect<'a, RenderState>, ReadExpect<'a, Camera>, ReadExpect<'a, RenderSystemData>, ReadStorage<'a, Light>, ReadStorage<'a, Pose>, ReadStorage<'a, Renderable>, ); fn setup(&mut self, world: &mut World) { Self::SystemData::setup(world); let render_system_data; { let render_state: WriteExpect<RenderState> = world.system_data(); let depth_texture = Texture::new_framebuffer_texture( &render_state.device, render_state.swap_chain_desc.width, render_state.swap_chain_desc.height, wgpu::TextureFormat::Depth32Float, ); render_system_data = RenderSystemData { depth_texture }; } world.insert(render_system_data); } fn run(&mut self, data: Self::SystemData) { let (mut render_state, camera, render_system_data, light, pose, renderable) = data; // Start new command buffer. let frame = render_state .swap_chain .get_next_texture() .expect("Timeout getting texture"); let mut encoder = render_state .device .create_command_encoder(&wgpu::CommandEncoderDescriptor { label: Some("Render Encoder"), }); // Clear frame. encoder.begin_render_pass(&wgpu::RenderPassDescriptor { color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { attachment: &frame.view, resolve_target: None, load_op: wgpu::LoadOp::Clear, store_op: wgpu::StoreOp::Store, clear_color: wgpu::Color::BLACK, }], depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachmentDescriptor { attachment: &render_system_data.depth_texture.view, depth_load_op: wgpu::LoadOp::Clear, depth_store_op: wgpu::StoreOp::Store, clear_depth: 1.0, stencil_load_op: wgpu::LoadOp::Clear, stencil_store_op: wgpu::StoreOp::Store, clear_stencil: 0, }), }); // Upload lighting data. let mut light_positions = Vec::new(); for (pose, _) in (&pose, &light).join() { light_positions.push(pose.model_matrix.isometry.translation.vector); } let lighting_data = LightingBindGroup { position: light_positions[0], _padding: 0, }; for (pose, renderable) in (&pose, &renderable).join() { // Upload transform data. let transform_data = TransformBindGroup { model_matrix: pose.model_matrix.to_homogeneous(), view_matrix: camera.view_matrix.to_homogeneous(), proj_matrix: camera.proj_matrix.to_homogeneous(), camera_world_position: camera.view_matrix.inverse().translation.vector, }; // Render the object. let render_pass_desc = wgpu::RenderPassDescriptor { color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { attachment: &frame.view, resolve_target: None, load_op: wgpu::LoadOp::Load, store_op: wgpu::StoreOp::Store, clear_color: wgpu::Color::BLACK, }], depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachmentDescriptor { attachment: &render_system_data.depth_texture.view, depth_load_op: wgpu::LoadOp::Load, depth_store_op: wgpu::StoreOp::Store, clear_depth: 1.0, stencil_load_op: wgpu::LoadOp::Clear, stencil_store_op: wgpu::StoreOp::Store, clear_stencil: 0, }), }; renderable.render( &render_state, &render_pass_desc, &mut encoder, &transform_data, &lighting_data, ); } // Submit command buffer to the render queue. let command_buffer = encoder.finish(); render_state.queue.submit(&[command_buffer]); } }
<filename>DrawingWithKeyboard.py import keyboard import turtle pen = True t = turtle.Turtle() turtle.getscreen() while True: if pen == True: t.pendown() else: t.penup() if keyboard.is_pressed("q"): break if keyboard.is_pressed("w"): t.forward(10) if keyboard.is_pressed("a"): t.left(10) if keyboard.is_pressed("s"): t.backward(10) if keyboard.is_pressed("d"): t.right(10) if keyboard.is_pressed("e"): if pen == True: pen = False else: pen = True if pen == True: t.pendown() else: t.penup()
/* * Enable or disable a specific channel. If something needs to be written to the * dimmer board, will do that as well. */ void KridaDimmer::enable_channel(uint8_t chan, bool en) { switch (chan) { case 0: case 1: case 2: case 3: set_brightness(chan, en ? ((0 == _channel_values[chan]) ? _channel_maxima[chan] : _channel_values[chan]) : 0); break; default: break; } }
<reponame>yoannfleurydev/formiz import React, { useEffect, useState } from 'react'; import { Slider, SliderTrack, SliderFilledTrack, SliderThumb, Stack, NumberInput, NumberInputField, NumberInputStepper, NumberIncrementStepper, NumberDecrementStepper, } from '@chakra-ui/react'; import { useField } from '@formiz/core'; import { FormGroup } from '../FormGroup'; export const FieldSlider = (props) => { const { errorMessage, id, isValid, isSubmitted, resetKey, setValue, value, otherProps, } = useField(props); const { required, name } = props; const { children, label, type, helper, min = 0, max = 100, step = 1, ...rest } = otherProps; const [isTouched, setIsTouched] = useState(false); const showError = !isValid && (isTouched || isSubmitted); useEffect(() => { setIsTouched(false); }, [resetKey]); const formGroupProps = { errorMessage, helper, id, isRequired: !!required, label, showError, name, ...rest, }; const changeValue = (val) => { const newVal = parseInt(val, 10); setValue(newVal); }; return ( <FormGroup {...formGroupProps}> <Stack direction="row" spacing="8" mt="1"> <NumberInput size="sm" maxW="6rem" id={id} value={value || 0} onChange={changeValue} onBlur={() => setIsTouched(true)} aria-invalid={showError} aria-describedby={!isValid ? `${id}-error` : undefined} min={min} max={max} step={step} > <NumberInputField /> <NumberInputStepper> <NumberIncrementStepper /> <NumberDecrementStepper /> </NumberInputStepper> </NumberInput> <Slider id={`${id}-slider`} value={value || 0} onChange={changeValue} onBlur={() => setIsTouched(true)} aria-invalid={showError} aria-describedby={!isValid ? `${id}-error` : undefined} min={min} max={max} step={step} colorScheme="brand" > <SliderTrack> <SliderFilledTrack /> </SliderTrack> <SliderThumb backgroundColor="brand.500" /> </Slider> </Stack> {children} </FormGroup> ); };
Limerick politicians united to block a move by Irish Water to draw huge amounts of water from the Parteen Basin to augment supplies to the greater Dublin area. Irish Water has set out plans to pipe over 300m litres a day from the basin to ensure supplies to the east coast meet demand. Dublin has seen water cuts in recent years and Irish Water say a new source is needed. The Parteen Basin has been identified as the best option. Members of the Limerick Metropolitan District have now come out in support of the Shannon Protection Alliance which is campaigning to block the Irish Wate plan. Proposing the move, Independent councillor John Gilligan said it was a problem of the past versus a solution of the future. Independent councillor Gilligan said authorities in London had successfully tackled inadequate supplies from the Thames to ensure ongoing supplies. Mr Gilligan said: “They have dealt with their water problem through a programme of desalination of sea water. This process is driven by renewable energy and wave power. This ticks all the boxes. “What Irish Water propose would involve huge amounts of oil being used to pump water from the Parteen Basin to the greater Dublin area over the next 30 or 40 years. “We would be mad to go along with what Irish Water propose and we will be sending the motion we have unanimously passed today to the minister. We don’t want this to become a political football over the coming election and we call on all the parties to take on board our views.” Parteen Basin Mr Gilligan said they would also be in contact with the Shannon Protection Alliance and would circulate the motion to all interested parties, such as fishing clubs along the Shannon. “What we fear is that future generations will be penalised by a stupid decision on this by Irish Water. Even in oil-rich Dubai they have huge supplies of water and this is achieved through desalination. This is a process used all over the world. So why can’t Irish Water look at this to deal with problems in Dublin?” Anti Austerity Alliance councillor Cian Prendeville said much of the water problem in Dublin was a result of leakage, old piping, and lack of proper maintenance of the system. He said: “Irish Water needs to deal with the leakage issue in the Dublin area. There are also environmental issues. Irish Water has not looked at in their model with regards to the damage it would cause along the old Shannon down from Parteen Weir to Limerick.”
// GetJobService - returns service of a type *JobService func (gs *NsGroupService) GetJobService() (vs *JobService) { if gs.jobService == nil { gs.jobService = NewJobService(gs) } return gs.jobService }
<filename>src/models/V2beta2MetricStatus.ts<gh_stars>0 /* tslint:disable */ /* eslint-disable */ /** * Kubernetes * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: release-1.19 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { KubeObject } from '../runtime' import V2beta2ExternalMetricStatus from './V2beta2ExternalMetricStatus' import V2beta2ObjectMetricStatus from './V2beta2ObjectMetricStatus' import V2beta2PodsMetricStatus from './V2beta2PodsMetricStatus' import V2beta2ResourceMetricStatus from './V2beta2ResourceMetricStatus' /** * MetricStatus describes the last-read state of a single metric. * @export * @interface V2beta2MetricStatus */ export default interface V2beta2MetricStatus extends KubeObject { /** * * @type {V2beta2ExternalMetricStatus} * @memberof V2beta2MetricStatus */ external?: V2beta2ExternalMetricStatus /** * * @type {V2beta2ObjectMetricStatus} * @memberof V2beta2MetricStatus */ object?: V2beta2ObjectMetricStatus /** * * @type {V2beta2PodsMetricStatus} * @memberof V2beta2MetricStatus */ pods?: V2beta2PodsMetricStatus /** * * @type {V2beta2ResourceMetricStatus} * @memberof V2beta2MetricStatus */ resource?: V2beta2ResourceMetricStatus /** * type is the type of metric source. It will be one of \"Object\", \"Pods\" or \"Resource\", each corresponds to a matching field in the object. * @type {string} * @memberof V2beta2MetricStatus */ type: string }
<gh_stars>0 /** ** This file was automatically generated by the Cyclone scheme compiler ** http://justinethier.github.io/cyclone/ ** ** (c) 2014-2019 <NAME> ** Version 0.11.6 ** **/ #define closcall1(td, clo,a1) \ if (obj_is_not_closure(clo)) { \ Cyc_apply(td, 0, (closure)(a1), clo); \ } else { \ ((clo)->fn)(td, 1, clo,a1);\ } #define return_closcall1(td, clo,a1) { \ char top; \ if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[1]; buf[0] = a1;\ GC(td, clo, buf, 1); \ return; \ } else {\ closcall1(td, (closure) (clo),a1); \ return;\ } \ } #define continue_or_gc1(td, clo,a1) { \ char *top = alloca(sizeof(char)); \ if (stack_overflow(top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[1]; buf[0] = a1;\ GC(td, clo, buf, 1); \ return; \ } else {\ continue;\ } \ } #define return_direct1(td, _fn,a1) { \ char top; \ if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[1]; buf[0] = a1; \ mclosure0(c1, (function_type) _fn); \ GC(td, &c1, buf, 1); \ return; \ } else { \ (_fn)(td, 1, (closure)_fn,a1); \ }} #define return_direct_with_clo1(td, clo, _fn,a1) { \ char top; \ if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[1]; buf[0] = a1;\ GC(td, clo, buf, 1); \ return; \ } else { \ (_fn)(td, 1, (closure)(clo),a1); \ }} #define closcall2(td, clo,a1,a2) \ if (obj_is_not_closure(clo)) { \ Cyc_apply(td, 1, (closure)(a1), clo,a2); \ } else { \ ((clo)->fn)(td, 2, clo,a1,a2);\ } #define return_closcall2(td, clo,a1,a2) { \ char top; \ if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[2]; buf[0] = a1;buf[1] = a2;\ GC(td, clo, buf, 2); \ return; \ } else {\ closcall2(td, (closure) (clo),a1,a2); \ return;\ } \ } #define continue_or_gc2(td, clo,a1,a2) { \ char *top = alloca(sizeof(char)); \ if (stack_overflow(top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[2]; buf[0] = a1;buf[1] = a2;\ GC(td, clo, buf, 2); \ return; \ } else {\ continue;\ } \ } #define return_direct2(td, _fn,a1,a2) { \ char top; \ if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[2]; buf[0] = a1;buf[1] = a2; \ mclosure0(c1, (function_type) _fn); \ GC(td, &c1, buf, 2); \ return; \ } else { \ (_fn)(td, 2, (closure)_fn,a1,a2); \ }} #define return_direct_with_clo2(td, clo, _fn,a1,a2) { \ char top; \ if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[2]; buf[0] = a1;buf[1] = a2;\ GC(td, clo, buf, 2); \ return; \ } else { \ (_fn)(td, 2, (closure)(clo),a1,a2); \ }} #define closcall3(td, clo,a1,a2,a3) \ if (obj_is_not_closure(clo)) { \ Cyc_apply(td, 2, (closure)(a1), clo,a2,a3); \ } else { \ ((clo)->fn)(td, 3, clo,a1,a2,a3);\ } #define return_closcall3(td, clo,a1,a2,a3) { \ char top; \ if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[3]; buf[0] = a1;buf[1] = a2;buf[2] = a3;\ GC(td, clo, buf, 3); \ return; \ } else {\ closcall3(td, (closure) (clo),a1,a2,a3); \ return;\ } \ } #define continue_or_gc3(td, clo,a1,a2,a3) { \ char *top = alloca(sizeof(char)); \ if (stack_overflow(top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[3]; buf[0] = a1;buf[1] = a2;buf[2] = a3;\ GC(td, clo, buf, 3); \ return; \ } else {\ continue;\ } \ } #define return_direct3(td, _fn,a1,a2,a3) { \ char top; \ if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[3]; buf[0] = a1;buf[1] = a2;buf[2] = a3; \ mclosure0(c1, (function_type) _fn); \ GC(td, &c1, buf, 3); \ return; \ } else { \ (_fn)(td, 3, (closure)_fn,a1,a2,a3); \ }} #define return_direct_with_clo3(td, clo, _fn,a1,a2,a3) { \ char top; \ if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[3]; buf[0] = a1;buf[1] = a2;buf[2] = a3;\ GC(td, clo, buf, 3); \ return; \ } else { \ (_fn)(td, 3, (closure)(clo),a1,a2,a3); \ }} #define closcall4(td, clo,a1,a2,a3,a4) \ if (obj_is_not_closure(clo)) { \ Cyc_apply(td, 3, (closure)(a1), clo,a2,a3,a4); \ } else { \ ((clo)->fn)(td, 4, clo,a1,a2,a3,a4);\ } #define return_closcall4(td, clo,a1,a2,a3,a4) { \ char top; \ if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[4]; buf[0] = a1;buf[1] = a2;buf[2] = a3;buf[3] = a4;\ GC(td, clo, buf, 4); \ return; \ } else {\ closcall4(td, (closure) (clo),a1,a2,a3,a4); \ return;\ } \ } #define continue_or_gc4(td, clo,a1,a2,a3,a4) { \ char *top = alloca(sizeof(char)); \ if (stack_overflow(top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[4]; buf[0] = a1;buf[1] = a2;buf[2] = a3;buf[3] = a4;\ GC(td, clo, buf, 4); \ return; \ } else {\ continue;\ } \ } #define return_direct4(td, _fn,a1,a2,a3,a4) { \ char top; \ if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[4]; buf[0] = a1;buf[1] = a2;buf[2] = a3;buf[3] = a4; \ mclosure0(c1, (function_type) _fn); \ GC(td, &c1, buf, 4); \ return; \ } else { \ (_fn)(td, 4, (closure)_fn,a1,a2,a3,a4); \ }} #define return_direct_with_clo4(td, clo, _fn,a1,a2,a3,a4) { \ char top; \ if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[4]; buf[0] = a1;buf[1] = a2;buf[2] = a3;buf[3] = a4;\ GC(td, clo, buf, 4); \ return; \ } else { \ (_fn)(td, 4, (closure)(clo),a1,a2,a3,a4); \ }} #define closcall5(td, clo,a1,a2,a3,a4,a5) \ if (obj_is_not_closure(clo)) { \ Cyc_apply(td, 4, (closure)(a1), clo,a2,a3,a4,a5); \ } else { \ ((clo)->fn)(td, 5, clo,a1,a2,a3,a4,a5);\ } #define return_closcall5(td, clo,a1,a2,a3,a4,a5) { \ char top; \ if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[5]; buf[0] = a1;buf[1] = a2;buf[2] = a3;buf[3] = a4;buf[4] = a5;\ GC(td, clo, buf, 5); \ return; \ } else {\ closcall5(td, (closure) (clo),a1,a2,a3,a4,a5); \ return;\ } \ } #define continue_or_gc5(td, clo,a1,a2,a3,a4,a5) { \ char *top = alloca(sizeof(char)); \ if (stack_overflow(top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[5]; buf[0] = a1;buf[1] = a2;buf[2] = a3;buf[3] = a4;buf[4] = a5;\ GC(td, clo, buf, 5); \ return; \ } else {\ continue;\ } \ } #define return_direct5(td, _fn,a1,a2,a3,a4,a5) { \ char top; \ if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[5]; buf[0] = a1;buf[1] = a2;buf[2] = a3;buf[3] = a4;buf[4] = a5; \ mclosure0(c1, (function_type) _fn); \ GC(td, &c1, buf, 5); \ return; \ } else { \ (_fn)(td, 5, (closure)_fn,a1,a2,a3,a4,a5); \ }} #define return_direct_with_clo5(td, clo, _fn,a1,a2,a3,a4,a5) { \ char top; \ if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[5]; buf[0] = a1;buf[1] = a2;buf[2] = a3;buf[3] = a4;buf[4] = a5;\ GC(td, clo, buf, 5); \ return; \ } else { \ (_fn)(td, 5, (closure)(clo),a1,a2,a3,a4,a5); \ }} #define closcall6(td, clo,a1,a2,a3,a4,a5,a6) \ if (obj_is_not_closure(clo)) { \ Cyc_apply(td, 5, (closure)(a1), clo,a2,a3,a4,a5,a6); \ } else { \ ((clo)->fn)(td, 6, clo,a1,a2,a3,a4,a5,a6);\ } #define return_closcall6(td, clo,a1,a2,a3,a4,a5,a6) { \ char top; \ if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[6]; buf[0] = a1;buf[1] = a2;buf[2] = a3;buf[3] = a4;buf[4] = a5;buf[5] = a6;\ GC(td, clo, buf, 6); \ return; \ } else {\ closcall6(td, (closure) (clo),a1,a2,a3,a4,a5,a6); \ return;\ } \ } #define continue_or_gc6(td, clo,a1,a2,a3,a4,a5,a6) { \ char *top = alloca(sizeof(char)); \ if (stack_overflow(top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[6]; buf[0] = a1;buf[1] = a2;buf[2] = a3;buf[3] = a4;buf[4] = a5;buf[5] = a6;\ GC(td, clo, buf, 6); \ return; \ } else {\ continue;\ } \ } #define return_direct6(td, _fn,a1,a2,a3,a4,a5,a6) { \ char top; \ if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[6]; buf[0] = a1;buf[1] = a2;buf[2] = a3;buf[3] = a4;buf[4] = a5;buf[5] = a6; \ mclosure0(c1, (function_type) _fn); \ GC(td, &c1, buf, 6); \ return; \ } else { \ (_fn)(td, 6, (closure)_fn,a1,a2,a3,a4,a5,a6); \ }} #define return_direct_with_clo6(td, clo, _fn,a1,a2,a3,a4,a5,a6) { \ char top; \ if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \ object buf[6]; buf[0] = a1;buf[1] = a2;buf[2] = a3;buf[3] = a4;buf[4] = a5;buf[5] = a6;\ GC(td, clo, buf, 6); \ return; \ } else { \ (_fn)(td, 6, (closure)(clo),a1,a2,a3,a4,a5,a6); \ }} #include "cyclone/types.h" object __glo_lib_91init_117srfi69_srfi_69 = NULL; object __glo_Cyc_91memoize_srfi_69 = NULL; object __glo_hash_91table_91values_srfi_69 = NULL; object __glo_hash_91table_91keys_srfi_69 = NULL; object __glo_hash_91table_91merge_67_srfi_69 = NULL; object __glo_hash_91table_91copy_srfi_69 = NULL; object __glo_hash_91table_91_125alist_srfi_69 = NULL; object __glo_alist_91_125hash_91table_srfi_69 = NULL; object __glo_hash_91table_91fold_srfi_69 = NULL; object __glo_hash_91table_91walk_srfi_69 = NULL; object __glo_hash_91table_91exists_127_srfi_69 = NULL; object __glo_hash_91table_91delete_67_srfi_69 = NULL; object __glo_hash_91table_91update_67_95default_srfi_69 = NULL; object __glo_hash_91table_91update_67_srfi_69 = NULL; object __glo_hash_91table_91set_67_srfi_69 = NULL; object __glo_hash_91table_91ref_95default_srfi_69 = NULL; object __glo_hash_91table_91ref_srfi_69 = NULL; object __glo__75hash_91table_91maybe_91resize_67_srfi_69 = NULL; object __glo__75hash_91table_91walk_srfi_69 = NULL; object __glo__75hash_91table_91delete_67_srfi_69 = NULL; object __glo__75hash_91table_91add_67_srfi_69 = NULL; object __glo__75hash_91table_91find_srfi_69 = NULL; object __glo__75hash_91table_91hash_srfi_69 = NULL; object __glo_make_91integer_91hash_91table_srfi_69 = NULL; object __glo_make_91string_91ci_91hash_91table_srfi_69 = NULL; object __glo_make_91string_91hash_91table_srfi_69 = NULL; object __glo_make_91symbol_91hash_91table_srfi_69 = NULL; object __glo_make_91hash_91table_91maker_srfi_69 = NULL; object __glo_make_91hash_91table_srfi_69 = NULL; object __glo_appropriate_91hash_91function_91for_srfi_69 = NULL; object __glo__85default_91table_91size_85_srfi_69 = NULL; object __glo__75make_91hash_91table_srfi_69 = NULL; object __glo_hash_91table_91set_91entries_67_srfi_69 = NULL; object __glo_hash_91table_91set_91size_67_srfi_69 = NULL; object __glo_hash_91table_91entries_srfi_69 = NULL; object __glo_hash_91table_91association_91function_srfi_69 = NULL; object __glo_hash_91table_91equivalence_91function_srfi_69 = NULL; object __glo_hash_91table_91hash_91function_srfi_69 = NULL; object __glo_hash_91table_91size_srfi_69 = NULL; object __glo_hash_91table_127_srfi_69 = NULL; object __glo__121srfi_91hash_91table_125_srfi_69 = NULL; object __glo__75hash_91node_91value_srfi_69 = NULL; object __glo__75hash_91node_91key_srfi_69 = NULL; object __glo__75hash_91node_91set_91value_67_srfi_69 = NULL; object __glo__75make_91hash_91node_srfi_69 = NULL; object __glo_vector_91hash_srfi_69 = NULL; object __glo_hash_91by_91identity_srfi_69 = NULL; object __glo_hash_srfi_69 = NULL; object __glo__75imag_91part_srfi_69 = NULL; object __glo__75real_91part_srfi_69 = NULL; object __glo_symbol_91hash_srfi_69 = NULL; object __glo_symbol_91hash_191_191inline_191_191_srfi_69 = NULL; object __glo_string_91ci_91hash_srfi_69 = NULL; object __glo_string_91hash_srfi_69 = NULL; object __glo__75string_91hash_srfi_69 = NULL; object __glo__85default_91bound_85_srfi_69 = NULL; extern object __glo_member_scheme_base; extern object __glo_assoc_scheme_base; extern object __glo_cons_91source_scheme_base; extern object __glo_syntax_91rules_scheme_base; extern object __glo_letrec_85_scheme_base; extern object __glo_guard_scheme_base; extern object __glo_guard_91aux_scheme_base; extern object __glo_define_91record_91type_scheme_base; extern object __glo_record_127_scheme_base; extern object __glo_is_91a_127_scheme_base; extern object __glo_register_91simple_91type_scheme_base; extern object __glo_make_91type_91predicate_scheme_base; extern object __glo_make_91constructor_scheme_base; extern object __glo_make_91constructor_95args_scheme_base; extern object __glo_make_91getter_scheme_base; extern object __glo_make_91setter_scheme_base; extern object __glo_slot_91ref_scheme_base; extern object __glo_slot_91set_67_scheme_base; extern object __glo_type_91slot_91offset_scheme_base; extern object __glo_receive_scheme_base; extern object __glo_abs_scheme_base; extern object __glo_max_scheme_base; extern object __glo_min_scheme_base; extern object __glo_modulo_scheme_base; extern object __glo_floor_91remainder_scheme_base; extern object __glo_even_127_scheme_base; extern object __glo_exact_91integer_127_scheme_base; extern object __glo_exact_91integer_91sqrt_scheme_base; extern object __glo_exact_127_scheme_base; extern object __glo_inexact_127_scheme_base; extern object __glo_odd_127_scheme_base; extern object __glo_complex_127_scheme_base; extern object __glo_rational_127_scheme_base; extern object __glo_bignum_127_scheme_base; extern object __glo_gcd_scheme_base; extern object __glo_lcm_scheme_base; extern object __glo_quotient_scheme_base; extern object __glo_remainder_scheme_base; extern object __glo_truncate_91quotient_scheme_base; extern object __glo_truncate_91remainder_scheme_base; extern object __glo_truncate_95_scheme_base; extern object __glo_floor_91quotient_scheme_base; extern object __glo_floor_91remainder_scheme_base; extern object __glo_floor_95_scheme_base; extern object __glo_square_scheme_base; extern object __glo_expt_scheme_base; extern object __glo_call_91with_91current_91continuation_scheme_base; extern object __glo_call_95cc_scheme_base; extern object __glo_call_91with_91values_scheme_base; extern object __glo_dynamic_91wind_scheme_base; extern object __glo_values_scheme_base; extern object __glo_char_123_127_scheme_base; extern object __glo_char_121_127_scheme_base; extern object __glo_char_125_127_scheme_base; extern object __glo_char_121_123_127_scheme_base; extern object __glo_char_125_123_127_scheme_base; extern object __glo_string_123_127_scheme_base; extern object __glo_string_121_127_scheme_base; extern object __glo_string_121_123_127_scheme_base; extern object __glo_string_125_127_scheme_base; extern object __glo_string_125_123_127_scheme_base; extern object __glo_foldl_scheme_base; extern object __glo_foldr_scheme_base; extern object __glo_not_scheme_base; extern object __glo_list_127_scheme_base; extern object __glo_zero_127_scheme_base; extern object __glo_positive_127_scheme_base; extern object __glo_negative_127_scheme_base; extern object __glo_append_scheme_base; extern object __glo__list_scheme_base; extern object __glo_make_91list_scheme_base; extern object __glo_list_91copy_scheme_base; extern object __glo_map_scheme_base; extern object __glo_Cyc_91map_91loop_911_scheme_base; extern object __glo_Cyc_91map_91loop_912_scheme_base; extern object __glo_Cyc_91for_91each_91loop_911_scheme_base; extern object __glo_Cyc_91for_91each_91loop_912_scheme_base; extern object __glo_for_91each_scheme_base; extern object __glo_list_91tail_scheme_base; extern object __glo_list_91ref_scheme_base; extern object __glo_list_91set_67_scheme_base; extern object __glo_reverse_scheme_base; extern object __glo_boolean_123_127_scheme_base; extern object __glo_symbol_123_127_scheme_base; extern object __glo_Cyc_91obj_123_127_scheme_base; extern object __glo_vector_scheme_base; extern object __glo_vector_91append_scheme_base; extern object __glo_vector_91copy_scheme_base; extern object __glo_vector_91copy_67_scheme_base; extern object __glo_vector_91fill_67_scheme_base; extern object __glo_vector_91_125list_scheme_base; extern object __glo_vector_91_125string_scheme_base; extern object __glo_vector_91map_scheme_base; extern object __glo_vector_91for_91each_scheme_base; extern object __glo_make_91string_scheme_base; extern object __glo_string_scheme_base; extern object __glo_string_91copy_scheme_base; extern object __glo_string_91copy_67_scheme_base; extern object __glo_string_91fill_67_scheme_base; extern object __glo_string_91_125list_scheme_base; extern object __glo_string_91_125vector_scheme_base; extern object __glo_string_91map_scheme_base; extern object __glo_string_91for_91each_scheme_base; extern object __glo_make_91parameter_scheme_base; extern object __glo_current_91output_91port_scheme_base; extern object __glo_current_91input_91port_scheme_base; extern object __glo_current_91error_91port_scheme_base; extern object __glo_call_91with_91port_scheme_base; extern object __glo_error_91object_127_scheme_base; extern object __glo_error_91object_91message_scheme_base; extern object __glo_error_91object_91irritants_scheme_base; extern object __glo_error_scheme_base; extern object __glo_raise_scheme_base; extern object __glo_raise_91continuable_scheme_base; extern object __glo_with_91handler_scheme_base; extern object __glo_with_91exception_91handler_scheme_base; extern object __glo_Cyc_91add_91exception_91handler_scheme_base; extern object __glo_Cyc_91remove_91exception_91handler_scheme_base; extern object __glo_newline_scheme_base; extern object __glo_write_91char_scheme_base; extern object __glo_write_91string_scheme_base; extern object __glo_flush_91output_91port_scheme_base; extern object __glo_peek_91char_scheme_base; extern object __glo_read_91char_scheme_base; extern object __glo_read_91line_scheme_base; extern object __glo_read_91string_scheme_base; extern object __glo_input_91port_127_scheme_base; extern object __glo_output_91port_127_scheme_base; extern object __glo_input_91port_91open_127_scheme_base; extern object __glo_output_91port_91open_127_scheme_base; extern object __glo_get_91output_91string_scheme_base; extern object __glo_open_91output_91string_scheme_base; extern object __glo_open_91input_91string_scheme_base; extern object __glo_get_91output_91bytevector_scheme_base; extern object __glo_open_91input_91bytevector_scheme_base; extern object __glo_open_91output_91bytevector_scheme_base; extern object __glo_features_scheme_base; extern object __glo_Cyc_91add_91feature_67_scheme_base; extern object __glo_Cyc_91version_scheme_base; extern object __glo_any_scheme_base; extern object __glo_every_scheme_base; extern object __glo_and_scheme_base; extern object __glo_or_scheme_base; extern object __glo_let_scheme_base; extern object __glo_let_85_scheme_base; extern object __glo_letrec_scheme_base; extern object __glo_let_85_91values_scheme_base; extern object __glo_let_91values_scheme_base; extern object __glo_begin_scheme_base; extern object __glo__case_scheme_base; extern object __glo_cond_scheme_base; extern object __glo_cond_91expand_scheme_base; extern object __glo__do_scheme_base; extern object __glo_when_scheme_base; extern object __glo_unless_scheme_base; extern object __glo_quasiquote_scheme_base; extern object __glo_floor_scheme_base; extern object __glo_ceiling_scheme_base; extern object __glo_truncate_scheme_base; extern object __glo_round_scheme_base; extern object __glo_exact_scheme_base; extern object __glo_inexact_scheme_base; extern object __glo_eof_91object_scheme_base; extern object __glo_syntax_91error_scheme_base; extern object __glo_bytevector_91copy_scheme_base; extern object __glo_bytevector_91copy_67_scheme_base; extern object __glo_utf8_91_125string_scheme_base; extern object __glo_string_91_125utf8_scheme_base; extern object __glo_denominator_scheme_base; extern object __glo_numerator_scheme_base; extern object __glo_parameterize_scheme_base; extern object __glo_peek_91u8_scheme_base; extern object __glo_read_91u8_scheme_base; extern object __glo_write_91u8_scheme_base; extern object __glo_char_91alphabetic_127_scheme__char; extern object __glo_char_91downcase_scheme__char; extern object __glo_char_91foldcase_scheme__char; extern object __glo_char_91lower_91case_127_scheme__char; extern object __glo_char_91numeric_127_scheme__char; extern object __glo_char_91upcase_scheme__char; extern object __glo_char_91upper_91case_127_scheme__char; extern object __glo_char_91whitespace_127_scheme__char; extern object __glo_char_91ci_121_123_127_scheme__char; extern object __glo_char_91ci_121_127_scheme__char; extern object __glo_char_91ci_123_127_scheme__char; extern object __glo_char_91ci_125_123_127_scheme__char; extern object __glo_char_91ci_125_127_scheme__char; extern object __glo_digit_91value_scheme__char; extern object __glo_string_91upcase_scheme__char; extern object __glo_string_91downcase_scheme__char; extern object __glo_string_91foldcase_scheme__char; extern object __glo_string_91ci_121_123_127_scheme__char; extern object __glo_string_91ci_121_127_scheme__char; extern object __glo_string_91ci_123_127_scheme__char; extern object __glo_string_91ci_125_123_127_scheme__char; extern object __glo_string_91ci_125_127_scheme__char; extern object __glo_string_123_127_191_191inline_191_191_scheme_base; extern object __glo_string_121_127_191_191inline_191_191_scheme_base; extern object __glo_string_121_123_127_191_191inline_191_191_scheme_base; extern object __glo_string_125_127_191_191inline_191_191_scheme_base; extern object __glo_string_125_123_127_191_191inline_191_191_scheme_base; extern object __glo_not_191_191inline_191_191_scheme_base; extern object __glo_list_127_191_191inline_191_191_scheme_base; extern object __glo_zero_127_191_191inline_191_191_scheme_base; extern object __glo_positive_127_191_191inline_191_191_scheme_base; extern object __glo_negative_127_191_191inline_191_191_scheme_base; extern object __glo_floor_191_191inline_191_191_scheme_base; extern object __glo_ceiling_191_191inline_191_191_scheme_base; extern object __glo_truncate_191_191inline_191_191_scheme_base; extern object __glo_round_191_191inline_191_191_scheme_base; extern object __glo_inexact_191_191inline_191_191_scheme_base; extern object __glo_sqrt_191_191inline_191_191_scheme_base; extern object __glo_exact_91integer_127_191_191inline_191_191_scheme_base; extern object __glo_exact_127_191_191inline_191_191_scheme_base; extern object __glo_complex_127_191_191inline_191_191_scheme_base; extern object __glo_denominator_191_191inline_191_191_scheme_base; extern object __glo_numerator_191_191inline_191_191_scheme_base; extern object __glo_quotient_191_191inline_191_191_scheme_base; extern object __glo_square_191_191inline_191_191_scheme_base; extern object __glo_eof_91object_191_191inline_191_191_scheme_base; #include "cyclone/runtime.h" defsymbol(hash); defsymbol(compare); defsymbol(associate); defsymbol(size); defsymbol(entries); defsymbol(record_91marker); static void __lambda_189(void *data, int argc, closure _,object k_73899) ; static void __lambda_190(void *data, int argc, object self_731130, object r_73946) ; static void __lambda_191(void *data, int argc, object self_731131, object r_73945) ; static void __lambda_192(void *data, int argc, object self_731132, object r_73943) ; static void __lambda_193(void *data, int argc, object self_731133, object r_73942) ; static void __lambda_194(void *data, int argc, object self_731134, object r_73940) ; static void __lambda_195(void *data, int argc, object self_731135, object r_73939) ; static void __lambda_196(void *data, int argc, object self_731136, object r_73937) ; static void __lambda_197(void *data, int argc, object self_731137, object r_73936) ; static void __lambda_198(void *data, int argc, object self_731138, object r_73934) ; static void __lambda_199(void *data, int argc, object self_731139, object r_73933) ; static void __lambda_200(void *data, int argc, object self_731140, object r_73931) ; static void __lambda_201(void *data, int argc, object self_731141, object r_73930) ; static void __lambda_202(void *data, int argc, object self_731142, object r_73928) ; static void __lambda_203(void *data, int argc, object self_731143, object r_73927) ; static void __lambda_204(void *data, int argc, object self_731144, object r_73925) ; static void __lambda_205(void *data, int argc, object self_731145, object r_73924) ; static void __lambda_206(void *data, int argc, object self_731146, object r_73923) ; static void __lambda_207(void *data, int argc, object self_731147, object r_73922) ; static void __lambda_208(void *data, int argc, object self_731148, object r_73921) ; static void __lambda_209(void *data, int argc, object self_731149, object r_73920) ; static void __lambda_181(void *data, int argc, closure _,object k_73886, object function_73320_73481) ; static void __lambda_182(void *data, int argc, object self_731123, object table_73321_73482) ; static void __lambda_183(void *data, int argc, object self_731124, object k_73888, object args_73322_73483_raw, ...) ; static void __lambda_185(void *data, int argc, object self_731126, object k_73891) ; static void __lambda_187(void *data, int argc, object self_731128, object k_73894, object results_73323_73484_raw, ...) ; static void __lambda_188(void *data, int argc, object self_731129, object r_73895) ; static void __lambda_186(void *data, int argc, object self_731127, object k_73896) ; static void __lambda_184(void *data, int argc, object self_731125, object r_73889) ; static void __lambda_179(void *data, int argc, closure _,object k_73880, object hash_91table_73316_73477) ; static void __lambda_180(void *data, int argc, object self_731122, object k_73883, object key_73317_73478, object val_73318_73479, object acc_73319_73480) ; static void __lambda_177(void *data, int argc, closure _,object k_73874, object hash_91table_73312_73473) ; static void __lambda_178(void *data, int argc, object self_731121, object k_73877, object key_73313_73474, object val_73314_73475, object acc_73315_73476) ; static void __lambda_174(void *data, int argc, closure _,object k_73868, object hash_91table1_73308_73469, object hash_91table2_73309_73470) ; static void __lambda_176(void *data, int argc, object self_731120, object k_73871, object key_73310_73471, object value_73311_73472) ; static void __lambda_175(void *data, int argc, object self_731119, object r_73869) ; static void __lambda_165(void *data, int argc, closure _,object k_73856, object hash_91table_73304_73465) ; static void __lambda_166(void *data, int argc, object self_731111, object r_73861) ; static void __lambda_167(void *data, int argc, object self_731112, object r_73862) ; static void __lambda_168(void *data, int argc, object self_731113, object r_73865) ; static void __lambda_169(void *data, int argc, object self_731114, object r_73864) ; static void __lambda_170(void *data, int argc, object self_731115, object r_73863) ; static void __lambda_171(void *data, int argc, object self_731116, object new_73305_73466) ; static void __lambda_173(void *data, int argc, object self_731118, object k_73860, object key_73306_73467, object value_73307_73468) ; static void __lambda_172(void *data, int argc, object self_731117, object r_73858) ; static void __lambda_163(void *data, int argc, closure _,object k_73849, object hash_91table_73300_73461) ; static void __lambda_164(void *data, int argc, object self_731110, object k_73852, object key_73301_73462, object val_73302_73463, object acc_73303_73464) ; static void __lambda_150(void *data, int argc, closure _,object k_73819, object alist_73271_73450, object args_73272_73451_raw, ...) ; static void __lambda_154(void *data, int argc, object self_731098, object hash_73278_73453) ; static void __lambda_158(void *data, int argc, object self_731099, object size_73281_73454) ; static void __lambda_159(void *data, int argc, object self_731100, object hash_91table_73284_73455) ; static void __lambda_161(void *data, int argc, object self_731102, object k_73826, object elem_73286_73456) ; static void __lambda_162(void *data, int argc, object self_731103, object k_73830, object x_73287_73457) ; static void __lambda_160(void *data, int argc, object self_731101, object r_73824) ; static void __lambda_155(void *data, int argc, object self_731104, object k_73831) ; static void __lambda_157(void *data, int argc, object self_731105, object r_73832) ; static void __lambda_156(void *data, int argc, object self_731106, object k_73836) ; static void __lambda_151(void *data, int argc, object self_731107, object k_73840) ; static void __lambda_153(void *data, int argc, object self_731108, object r_73841) ; static void __lambda_152(void *data, int argc, object self_731109, object k_73843) ; static void __lambda_146(void *data, int argc, closure _,object k_73812, object hash_91table_73266_73445, object f_73267_73446, object acc_73268_73447) ; static void __lambda_217(void *data, int argc, object self_731094, object acc_73268_73447) ; static void __lambda_148(void *data, int argc, object self_731096, object k_73815, object key_73269_73448, object value_73270_73449) ; static void __lambda_149(void *data, int argc, object self_731097, object r_73816) ; static void __lambda_147(void *data, int argc, object self_731095, object r_73813) ; static void __lambda_141(void *data, int argc, closure _,object k_73804, object hash_91table_73263_73442, object proc_73264_73443) ; static void __lambda_142(void *data, int argc, object self_731090, object r_73806) ; static void __lambda_143(void *data, int argc, object self_731091, object k_73807, object node_73265_73444) ; static void __lambda_144(void *data, int argc, object self_731092, object r_73808) ; static void __lambda_145(void *data, int argc, object self_731093, object r_73809) ; static void __lambda_136(void *data, int argc, closure _,object k_73797, object hash_91table_73260_73440, object key_73261_73441) ; static void __lambda_137(void *data, int argc, object self_731086, object r_73799) ; static void __lambda_138(void *data, int argc, object self_731087, object r_73800) ; static void __lambda_139(void *data, int argc, object self_731088, object r_73801) ; static void __lambda_140(void *data, int argc, object self_731089, object r_73798_73965) ; static void __lambda_129(void *data, int argc, closure _,object k_73788, object hash_91table_73258_73438, object key_73259_73439) ; static void __lambda_130(void *data, int argc, object self_731080, object r_73792) ; static void __lambda_131(void *data, int argc, object self_731081, object r_73793) ; static void __lambda_132(void *data, int argc, object self_731082, object r_73794) ; static void __lambda_133(void *data, int argc, object self_731083, object r_73789) ; static void __lambda_134(void *data, int argc, object self_731084, object r_73791) ; static void __lambda_135(void *data, int argc, object self_731085, object r_73790) ; static void __lambda_127(void *data, int argc, closure _,object k_73783, object hash_91table_73254_73434, object key_73255_73435, object function_73256_73436, object default_73257_73437) ; static void __lambda_128(void *data, int argc, object self_731079, object k_73785) ; static void __lambda_112(void *data, int argc, closure _,object k_73766, object hash_91table_73238_73426, object key_73239_73427, object function_73240_73428, object maybe_91default_73241_73429_raw, ...) ; static void __lambda_113(void *data, int argc, object self_731065, object r_73767) ; static void __lambda_114(void *data, int argc, object self_731066, object r_73768) ; static void __lambda_115(void *data, int argc, object self_731067, object hash_73242_73430, object entries_73243_73431) ; static void __lambda_116(void *data, int argc, object self_731068, object r_73780) ; static void __lambda_117(void *data, int argc, object self_731069, object tmp_73246_73248_73432_73955) ; static void __lambda_121(void *data, int argc, object self_731073, object r_73778_73959) ; static void __lambda_122(void *data, int argc, object self_731074, object r_73777_73960) ; static void __lambda_123(void *data, int argc, object self_731075, object r_73773_73961) ; static void __lambda_124(void *data, int argc, object self_731076, object r_73776_73962) ; static void __lambda_125(void *data, int argc, object self_731077, object r_73775_73963) ; static void __lambda_126(void *data, int argc, object self_731078, object r_73774_73964) ; static void __lambda_118(void *data, int argc, object self_731070, object node_73249_73433_73956) ; static void __lambda_119(void *data, int argc, object self_731071, object r_73771_73957) ; static void __lambda_120(void *data, int argc, object self_731072, object r_73770_73958) ; static void __lambda_101(void *data, int argc, closure _,object k_73755, object hash_91table_73226_73419, object key_73227_73420, object value_73228_73421) ; static void __lambda_102(void *data, int argc, object self_731055, object r_73756) ; static void __lambda_103(void *data, int argc, object self_731056, object r_73757) ; static void __lambda_104(void *data, int argc, object self_731057, object hash_73229_73422, object entries_73230_73423) ; static void __lambda_105(void *data, int argc, object self_731058, object r_73763) ; static void __lambda_106(void *data, int argc, object self_731059, object tmp_73233_73235_73424_73949) ; static void __lambda_108(void *data, int argc, object self_731061, object r_73759_73951) ; static void __lambda_109(void *data, int argc, object self_731062, object r_73762_73952) ; static void __lambda_110(void *data, int argc, object self_731063, object r_73761_73953) ; static void __lambda_111(void *data, int argc, object self_731064, object r_73760_73954) ; static void __lambda_107(void *data, int argc, object self_731060, object node_73236_73425_73950) ; static void __lambda_99(void *data, int argc, closure _,object k_73750, object hash_91table_73223_73416, object key_73224_73417, object default_73225_73418) ; static void __lambda_100(void *data, int argc, object self_731054, object k_73752) ; static void __lambda_94(void *data, int argc, closure _,object k_73741, object hash_91table_73211_73412, object key_73212_73413, object maybe_91default_73213_73414_raw, ...) ; static void __lambda_95(void *data, int argc, object self_731050, object r_73745) ; static void __lambda_96(void *data, int argc, object self_731051, object r_73746) ; static void __lambda_97(void *data, int argc, object self_731052, object r_73747) ; static void __lambda_98(void *data, int argc, object self_731053, object tmp_73216_73218_73415_73948) ; static void __lambda_82(void *data, int argc, closure _,object k_73723, object hash_91table_73192_73405) ; static void __lambda_83(void *data, int argc, object self_731039, object old_91entries_73195_73406) ; static void __lambda_84(void *data, int argc, object self_731040, object hash_91length_73198_73407) ; static void __lambda_85(void *data, int argc, object self_731041, object r_73738) ; static void __lambda_86(void *data, int argc, object self_731042, object new_91entries_73205_73409) ; static void __lambda_87(void *data, int argc, object self_731043, object hash_73208_73410) ; static void __lambda_89(void *data, int argc, object self_731045, object k_73732, object node_73210_73411) ; static void __lambda_90(void *data, int argc, object self_731046, object r_73736) ; static void __lambda_91(void *data, int argc, object self_731047, object r_73733) ; static void __lambda_92(void *data, int argc, object self_731048, object r_73734) ; static void __lambda_93(void *data, int argc, object self_731049, object r_73735) ; static void __lambda_88(void *data, int argc, object self_731044, object r_73730) ; static void __lambda_78(void *data, int argc, closure _,object k_73711, object proc_73182_73399, object entries_73183_73400) ; static void __lambda_79(void *data, int argc, object self_731035, object lp_73184_73189_73402) ; static void __lambda_216(void *data, int argc, object self_731036, object lp_73184_73189_73402) ; static void __lambda_80(void *data, int argc, object self_731037, object k_73715, object index_73190_73403) ; static void __lambda_81(void *data, int argc, object self_731038, object r_73717) ; static void __lambda_67(void *data, int argc, closure _,object k_73692, object entries_73157_73389, object compare_73158_73390, object hash_73159_73391, object key_73160_73392) ; static void __lambda_68(void *data, int argc, object self_731024, object entrylist_73161_73393) ; static void __lambda_69(void *data, int argc, object self_731025, object r_73708) ; static void __lambda_70(void *data, int argc, object self_731026, object r_73695) ; static void __lambda_71(void *data, int argc, object self_731027, object r_73698) ; static void __lambda_72(void *data, int argc, object self_731028, object current_73170_73394, object previous_73171_73395) ; static void __lambda_73(void *data, int argc, object self_731029, object loop_73172_73396) ; static void __lambda_215(void *data, int argc, object self_731030, object loop_73172_73396) ; static void __lambda_74(void *data, int argc, object self_731031, object k_73701, object current_73173_73397, object previous_73174_73398) ; static void __lambda_75(void *data, int argc, object self_731032, object r_73707) ; static void __lambda_76(void *data, int argc, object self_731033, object r_73703) ; static void __lambda_77(void *data, int argc, object self_731034, object r_73706) ; static void __lambda_64(void *data, int argc, closure _,object k_73686, object entries_73153_73385, object hash_73154_73386, object key_73155_73387, object value_73156_73388) ; static void __lambda_65(void *data, int argc, object self_731022, object r_73688) ; static void __lambda_66(void *data, int argc, object self_731023, object r_73689) ; static void __lambda_63(void *data, int argc, closure _,object k_73682, object entries_73149_73381, object associate_73150_73382, object hash_73151_73383, object key_73152_73384) ; static void __lambda_59(void *data, int argc, closure _,object k_73676, object hash_91table_73147_73379, object key_73148_73380) ; static void __lambda_60(void *data, int argc, object self_731019, object r_73677) ; static void __lambda_61(void *data, int argc, object self_731020, object r_73679) ; static void __lambda_62(void *data, int argc, object self_731021, object r_73678) ; static void __lambda_57(void *data, int argc, closure _,object k_73662, object comp_73144_73376, object hash_73145_73377) ; static void __lambda_58(void *data, int argc, object self_731018, object k_73663, object args_73146_73378_raw, ...) ; static void __lambda_36(void *data, int argc, closure _,object k_73622, object args_7393_73362_raw, ...) ; static void __lambda_40(void *data, int argc, object self_73997, object hash_7399_73364) ; static void __lambda_44(void *data, int argc, object self_73998, object size_73102_73365) ; static void __lambda_46(void *data, int argc, object self_73999, object tmp_73108_73110_73367) ; static void __lambda_55(void *data, int argc, object self_731000, object association_73105_73366) ; static void __lambda_56(void *data, int argc, object self_731001, object r_73627) ; static void __lambda_47(void *data, int argc, object self_731002, object k_73630) ; static void __lambda_49(void *data, int argc, object self_731003, object tmp_73112_73114_73368) ; static void __lambda_51(void *data, int argc, object self_731004, object tmp_73116_73118_73369) ; static void __lambda_52(void *data, int argc, object self_731005, object associate_73119_73370) ; static void __lambda_214(void *data, int argc, object self_731006, object associate_73119_73370) ; static void __lambda_53(void *data, int argc, object self_731007, object k_73635, object val_73120_73371, object alist_73121_73372) ; static void __lambda_54(void *data, int argc, object self_731008, object r_73637) ; static void __lambda_50(void *data, int argc, object self_731009, object k_73640) ; static void __lambda_48(void *data, int argc, object self_731010, object k_73642) ; static void __lambda_45(void *data, int argc, object self_731011, object k_73644) ; static void __lambda_41(void *data, int argc, object self_731012, object k_73646) ; static void __lambda_43(void *data, int argc, object self_731013, object r_73647) ; static void __lambda_42(void *data, int argc, object self_731014, object k_73649) ; static void __lambda_37(void *data, int argc, object self_731015, object k_73653) ; static void __lambda_39(void *data, int argc, object self_731016, object r_73654) ; static void __lambda_38(void *data, int argc, object self_731017, object k_73656) ; static void __lambda_31(void *data, int argc, closure _,object k_73610, object comparison_7377_73358) ; static void __lambda_33(void *data, int argc, object self_73993, object tmp_7383_7385_73360) ; static void __lambda_35(void *data, int argc, object self_73994, object tmp_7387_7389_73361) ; static void __lambda_34(void *data, int argc, object self_73995, object k_73614) ; static void __lambda_32(void *data, int argc, object self_73996, object k_73616) ; static void __lambda_30(void *data, int argc, closure _,object k_73603, object size_7372_73353, object hash_7373_73354, object compare_7374_73355, object associate_7375_73356, object entries_7376_73357) ; static void __lambda_23(void *data, int argc, closure _,object k_73562, object v_7361_73346, object bound_7362_73347) ; static void __lambda_24(void *data, int argc, object self_73985, object hashvalue_7363_73348, object len_7364_73349) ; static void __lambda_213(void *data, int argc, object self_73986, object hashvalue_7363_73348) ; static void __lambda_25(void *data, int argc, object self_73987, object lp_7365_7369_73351) ; static void __lambda_212(void *data, int argc, object self_73988, object lp_7365_7369_73351) ; static void __lambda_26(void *data, int argc, object self_73989, object k_73566, object index_7370_73352) ; static void __lambda_27(void *data, int argc, object self_73990, object r_73572) ; static void __lambda_28(void *data, int argc, object self_73991, object r_73573) ; static void __lambda_29(void *data, int argc, object self_73992, object r_73570) ; static void __lambda_21(void *data, int argc, closure _,object k_73555, object obj_7357_73342, object maybe_91bound_7358_73343_raw, ...) ; static void __lambda_22(void *data, int argc, object self_73984, object bound_7359_73344, object mem_91loc_7360_73345) ; static void __lambda_11(void *data, int argc, closure _,object k_73519, object obj_7319_73339, object maybe_91bound_7320_73340_raw, ...) ; static void __lambda_13(void *data, int argc, object self_73975, object r_73525) ; static void __lambda_19(void *data, int argc, object self_73981, object r_73541) ; static void __lambda_20(void *data, int argc, object self_73982, object r_73543) ; static void __lambda_14(void *data, int argc, object self_73976, object r_73535) ; static void __lambda_15(void *data, int argc, object self_73977, object r_73531) ; static void __lambda_16(void *data, int argc, object self_73978, object r_73534) ; static void __lambda_17(void *data, int argc, object self_73979, object r_73533) ; static void __lambda_18(void *data, int argc, object self_73980, object r_73532) ; static void __lambda_12(void *data, int argc, object self_73983, object k_73548) ; static void __lambda_221(void *data, int argc, closure _, object k, object z) ; static void __lambda_220(void *data, int argc, closure _, object k, object z) ; static object __lambda_219(void *data, object ptr, object sym) ; static void __lambda_218(void *data, int argc, closure _, object k, object sym) ; static void __lambda_10(void *data, int argc, closure _,object k_73513, object s_7316_73336, object maybe_91bound_7317_73337_raw, ...) ; static void __lambda_8(void *data, int argc, closure _,object k_73505, object s_7312_73332, object maybe_91bound_7313_73333_raw, ...) ; static void __lambda_9(void *data, int argc, object self_73974, object k_73508, object x_7315_73335) ; static void __lambda_1(void *data, int argc, closure _,object k_73489, object s_731_73324, object ch_91conv_732_73325, object bound_733_73326) ; static void __lambda_2(void *data, int argc, object self_73966, object hash_734_73327, object len_735_73328) ; static void __lambda_211(void *data, int argc, object self_73967, object hash_734_73327) ; static void __lambda_3(void *data, int argc, object self_73968, object lp_736_7310_73330) ; static void __lambda_210(void *data, int argc, object self_73969, object lp_736_7310_73330) ; static void __lambda_4(void *data, int argc, object self_73970, object k_73493, object index_7311_73331) ; static void __lambda_5(void *data, int argc, object self_73971, object r_73499) ; static void __lambda_6(void *data, int argc, object self_73972, object r_73501) ; static void __lambda_7(void *data, int argc, object self_73973, object r_73497) ; static void __lambda_189(void *data, int argc, closure _,object k_73899) { Cyc_st_add(data, "srfi/69.sld:lib-init:srfi69"); global_set(__glo__75make_91hash_91node_srfi_69, primitive_cons);global_set(__glo__75hash_91node_91set_91value_67_srfi_69, primitive_set_91cdr_67);global_set(__glo__75hash_91node_91key_srfi_69, primitive_car);global_set(__glo__75hash_91node_91value_srfi_69, primitive_cdr); closureN_type c_732468; object e_732573 [1]; c_732468.hdr.mark = gc_color_red; c_732468.hdr.grayed = 0; c_732468.tag = closureN_tag; c_732468.fn = (function_type)__lambda_190; c_732468.num_args = 1; c_732468.num_elements = 1; c_732468.elements = (object *)e_732573; c_732468.elements[0] = k_73899; make_utf8_string_with_len(c_732574, "<srfi-hash-table>", 17, 17); make_pair(c_732579,quote_entries,NULL);c_732579.hdr.immutable = 1; make_pair(c_732578,quote_associate,&c_732579);c_732578.hdr.immutable = 1; make_pair(c_732577,quote_compare,&c_732578);c_732577.hdr.immutable = 1; make_pair(c_732576,quote_hash,&c_732577);c_732576.hdr.immutable = 1; make_pair(c_732575,quote_size,&c_732576);c_732575.hdr.immutable = 1; return_closcall4(data, __glo_register_91simple_91type_scheme_base, &c_732468, &c_732574, boolean_f, &c_732575);;; } static void __lambda_190(void *data, int argc, object self_731130, object r_73946) { global_set(__glo__121srfi_91hash_91table_125_srfi_69, r_73946); closureN_type c_732471; object e_732570 [1]; c_732471.hdr.mark = gc_color_red; c_732471.hdr.grayed = 0; c_732471.tag = closureN_tag; c_732471.fn = (function_type)__lambda_191; c_732471.num_args = 1; c_732471.num_elements = 1; c_732471.elements = (object *)e_732570; c_732471.elements[0] = ((closureN)self_731130)->elements[0]; return_closcall3(data, __glo_make_91type_91predicate_scheme_base, &c_732471, obj_int2obj(0), __glo__121srfi_91hash_91table_125_srfi_69);;; } static void __lambda_191(void *data, int argc, object self_731131, object r_73945) { global_set(__glo_hash_91table_127_srfi_69, r_73945); closureN_type c_732474; object e_732567 [1]; c_732474.hdr.mark = gc_color_red; c_732474.hdr.grayed = 0; c_732474.tag = closureN_tag; c_732474.fn = (function_type)__lambda_192; c_732474.num_args = 1; c_732474.num_elements = 1; c_732474.elements = (object *)e_732567; c_732474.elements[0] = ((closureN)self_731131)->elements[0]; return_closcall3(data, __glo_type_91slot_91offset_scheme_base, &c_732474, __glo__121srfi_91hash_91table_125_srfi_69, quote_size);;; } static void __lambda_192(void *data, int argc, object self_731132, object r_73943) { closureN_type c_732476; object e_732565 [1]; c_732476.hdr.mark = gc_color_red; c_732476.hdr.grayed = 0; c_732476.tag = closureN_tag; c_732476.fn = (function_type)__lambda_193; c_732476.num_args = 1; c_732476.num_elements = 1; c_732476.elements = (object *)e_732565; c_732476.elements[0] = ((closureN)self_731132)->elements[0]; make_utf8_string_with_len(c_732566, "hash-table-size", 15, 15); return_closcall4(data, __glo_make_91getter_scheme_base, &c_732476, &c_732566, __glo__121srfi_91hash_91table_125_srfi_69, r_73943);; } static void __lambda_193(void *data, int argc, object self_731133, object r_73942) { global_set(__glo_hash_91table_91size_srfi_69, r_73942); closureN_type c_732479; object e_732562 [1]; c_732479.hdr.mark = gc_color_red; c_732479.hdr.grayed = 0; c_732479.tag = closureN_tag; c_732479.fn = (function_type)__lambda_194; c_732479.num_args = 1; c_732479.num_elements = 1; c_732479.elements = (object *)e_732562; c_732479.elements[0] = ((closureN)self_731133)->elements[0]; return_closcall3(data, __glo_type_91slot_91offset_scheme_base, &c_732479, __glo__121srfi_91hash_91table_125_srfi_69, quote_hash);;; } static void __lambda_194(void *data, int argc, object self_731134, object r_73940) { closureN_type c_732481; object e_732560 [1]; c_732481.hdr.mark = gc_color_red; c_732481.hdr.grayed = 0; c_732481.tag = closureN_tag; c_732481.fn = (function_type)__lambda_195; c_732481.num_args = 1; c_732481.num_elements = 1; c_732481.elements = (object *)e_732560; c_732481.elements[0] = ((closureN)self_731134)->elements[0]; make_utf8_string_with_len(c_732561, "hash-table-hash-function", 24, 24); return_closcall4(data, __glo_make_91getter_scheme_base, &c_732481, &c_732561, __glo__121srfi_91hash_91table_125_srfi_69, r_73940);; } static void __lambda_195(void *data, int argc, object self_731135, object r_73939) { global_set(__glo_hash_91table_91hash_91function_srfi_69, r_73939); closureN_type c_732484; object e_732557 [1]; c_732484.hdr.mark = gc_color_red; c_732484.hdr.grayed = 0; c_732484.tag = closureN_tag; c_732484.fn = (function_type)__lambda_196; c_732484.num_args = 1; c_732484.num_elements = 1; c_732484.elements = (object *)e_732557; c_732484.elements[0] = ((closureN)self_731135)->elements[0]; return_closcall3(data, __glo_type_91slot_91offset_scheme_base, &c_732484, __glo__121srfi_91hash_91table_125_srfi_69, quote_compare);;; } static void __lambda_196(void *data, int argc, object self_731136, object r_73937) { closureN_type c_732486; object e_732555 [1]; c_732486.hdr.mark = gc_color_red; c_732486.hdr.grayed = 0; c_732486.tag = closureN_tag; c_732486.fn = (function_type)__lambda_197; c_732486.num_args = 1; c_732486.num_elements = 1; c_732486.elements = (object *)e_732555; c_732486.elements[0] = ((closureN)self_731136)->elements[0]; make_utf8_string_with_len(c_732556, "hash-table-equivalence-function", 31, 31); return_closcall4(data, __glo_make_91getter_scheme_base, &c_732486, &c_732556, __glo__121srfi_91hash_91table_125_srfi_69, r_73937);; } static void __lambda_197(void *data, int argc, object self_731137, object r_73936) { global_set(__glo_hash_91table_91equivalence_91function_srfi_69, r_73936); closureN_type c_732489; object e_732552 [1]; c_732489.hdr.mark = gc_color_red; c_732489.hdr.grayed = 0; c_732489.tag = closureN_tag; c_732489.fn = (function_type)__lambda_198; c_732489.num_args = 1; c_732489.num_elements = 1; c_732489.elements = (object *)e_732552; c_732489.elements[0] = ((closureN)self_731137)->elements[0]; return_closcall3(data, __glo_type_91slot_91offset_scheme_base, &c_732489, __glo__121srfi_91hash_91table_125_srfi_69, quote_associate);;; } static void __lambda_198(void *data, int argc, object self_731138, object r_73934) { closureN_type c_732491; object e_732550 [1]; c_732491.hdr.mark = gc_color_red; c_732491.hdr.grayed = 0; c_732491.tag = closureN_tag; c_732491.fn = (function_type)__lambda_199; c_732491.num_args = 1; c_732491.num_elements = 1; c_732491.elements = (object *)e_732550; c_732491.elements[0] = ((closureN)self_731138)->elements[0]; make_utf8_string_with_len(c_732551, "hash-table-association-function", 31, 31); return_closcall4(data, __glo_make_91getter_scheme_base, &c_732491, &c_732551, __glo__121srfi_91hash_91table_125_srfi_69, r_73934);; } static void __lambda_199(void *data, int argc, object self_731139, object r_73933) { global_set(__glo_hash_91table_91association_91function_srfi_69, r_73933); closureN_type c_732494; object e_732547 [1]; c_732494.hdr.mark = gc_color_red; c_732494.hdr.grayed = 0; c_732494.tag = closureN_tag; c_732494.fn = (function_type)__lambda_200; c_732494.num_args = 1; c_732494.num_elements = 1; c_732494.elements = (object *)e_732547; c_732494.elements[0] = ((closureN)self_731139)->elements[0]; return_closcall3(data, __glo_type_91slot_91offset_scheme_base, &c_732494, __glo__121srfi_91hash_91table_125_srfi_69, quote_entries);;; } static void __lambda_200(void *data, int argc, object self_731140, object r_73931) { closureN_type c_732496; object e_732545 [1]; c_732496.hdr.mark = gc_color_red; c_732496.hdr.grayed = 0; c_732496.tag = closureN_tag; c_732496.fn = (function_type)__lambda_201; c_732496.num_args = 1; c_732496.num_elements = 1; c_732496.elements = (object *)e_732545; c_732496.elements[0] = ((closureN)self_731140)->elements[0]; make_utf8_string_with_len(c_732546, "hash-table-entries", 18, 18); return_closcall4(data, __glo_make_91getter_scheme_base, &c_732496, &c_732546, __glo__121srfi_91hash_91table_125_srfi_69, r_73931);; } static void __lambda_201(void *data, int argc, object self_731141, object r_73930) { global_set(__glo_hash_91table_91entries_srfi_69, r_73930); closureN_type c_732499; object e_732542 [1]; c_732499.hdr.mark = gc_color_red; c_732499.hdr.grayed = 0; c_732499.tag = closureN_tag; c_732499.fn = (function_type)__lambda_202; c_732499.num_args = 1; c_732499.num_elements = 1; c_732499.elements = (object *)e_732542; c_732499.elements[0] = ((closureN)self_731141)->elements[0]; return_closcall3(data, __glo_type_91slot_91offset_scheme_base, &c_732499, __glo__121srfi_91hash_91table_125_srfi_69, quote_size);;; } static void __lambda_202(void *data, int argc, object self_731142, object r_73928) { closureN_type c_732501; object e_732540 [1]; c_732501.hdr.mark = gc_color_red; c_732501.hdr.grayed = 0; c_732501.tag = closureN_tag; c_732501.fn = (function_type)__lambda_203; c_732501.num_args = 1; c_732501.num_elements = 1; c_732501.elements = (object *)e_732540; c_732501.elements[0] = ((closureN)self_731142)->elements[0]; make_utf8_string_with_len(c_732541, "hash-table-set-size!", 20, 20); return_closcall4(data, __glo_make_91setter_scheme_base, &c_732501, &c_732541, __glo__121srfi_91hash_91table_125_srfi_69, r_73928);; } static void __lambda_203(void *data, int argc, object self_731143, object r_73927) { global_set(__glo_hash_91table_91set_91size_67_srfi_69, r_73927); closureN_type c_732504; object e_732537 [1]; c_732504.hdr.mark = gc_color_red; c_732504.hdr.grayed = 0; c_732504.tag = closureN_tag; c_732504.fn = (function_type)__lambda_204; c_732504.num_args = 1; c_732504.num_elements = 1; c_732504.elements = (object *)e_732537; c_732504.elements[0] = ((closureN)self_731143)->elements[0]; return_closcall3(data, __glo_type_91slot_91offset_scheme_base, &c_732504, __glo__121srfi_91hash_91table_125_srfi_69, quote_entries);;; } static void __lambda_204(void *data, int argc, object self_731144, object r_73925) { closureN_type c_732506; object e_732535 [1]; c_732506.hdr.mark = gc_color_red; c_732506.hdr.grayed = 0; c_732506.tag = closureN_tag; c_732506.fn = (function_type)__lambda_205; c_732506.num_args = 1; c_732506.num_elements = 1; c_732506.elements = (object *)e_732535; c_732506.elements[0] = ((closureN)self_731144)->elements[0]; make_utf8_string_with_len(c_732536, "hash-table-set-entries!", 23, 23); return_closcall4(data, __glo_make_91setter_scheme_base, &c_732506, &c_732536, __glo__121srfi_91hash_91table_125_srfi_69, r_73925);; } static void __lambda_205(void *data, int argc, object self_731145, object r_73924) { global_set(__glo_hash_91table_91set_91entries_67_srfi_69, r_73924); closureN_type c_732509; object e_732532 [1]; c_732509.hdr.mark = gc_color_red; c_732509.hdr.grayed = 0; c_732509.tag = closureN_tag; c_732509.fn = (function_type)__lambda_206; c_732509.num_args = 1; c_732509.num_elements = 1; c_732509.elements = (object *)e_732532; c_732509.elements[0] = ((closureN)self_731145)->elements[0]; return_closcall3(data, __glo_make_91hash_91table_91maker_srfi_69, &c_732509, primitive_eq_127, __glo_symbol_91hash_srfi_69);;; } static void __lambda_206(void *data, int argc, object self_731146, object r_73923) { global_set(__glo_make_91symbol_91hash_91table_srfi_69, r_73923); closureN_type c_732512; object e_732529 [1]; c_732512.hdr.mark = gc_color_red; c_732512.hdr.grayed = 0; c_732512.tag = closureN_tag; c_732512.fn = (function_type)__lambda_207; c_732512.num_args = 1; c_732512.num_elements = 1; c_732512.elements = (object *)e_732529; c_732512.elements[0] = ((closureN)self_731146)->elements[0]; return_closcall3(data, __glo_make_91hash_91table_91maker_srfi_69, &c_732512, __glo_string_123_127_scheme_base, __glo_string_91hash_srfi_69);;; } static void __lambda_207(void *data, int argc, object self_731147, object r_73922) { global_set(__glo_make_91string_91hash_91table_srfi_69, r_73922); closureN_type c_732515; object e_732526 [1]; c_732515.hdr.mark = gc_color_red; c_732515.hdr.grayed = 0; c_732515.tag = closureN_tag; c_732515.fn = (function_type)__lambda_208; c_732515.num_args = 1; c_732515.num_elements = 1; c_732515.elements = (object *)e_732526; c_732515.elements[0] = ((closureN)self_731147)->elements[0]; return_closcall3(data, __glo_make_91hash_91table_91maker_srfi_69, &c_732515, __glo_string_91ci_123_127_scheme__char, __glo_string_91ci_91hash_srfi_69);;; } static void __lambda_208(void *data, int argc, object self_731148, object r_73921) { global_set(__glo_make_91string_91ci_91hash_91table_srfi_69, r_73921); closureN_type c_732518; object e_732523 [1]; c_732518.hdr.mark = gc_color_red; c_732518.hdr.grayed = 0; c_732518.tag = closureN_tag; c_732518.fn = (function_type)__lambda_209; c_732518.num_args = 1; c_732518.num_elements = 1; c_732518.elements = (object *)e_732523; c_732518.elements[0] = ((closureN)self_731148)->elements[0]; return_closcall3(data, __glo_make_91hash_91table_91maker_srfi_69, &c_732518, primitive__123, __glo_modulo_scheme_base);;; } static void __lambda_209(void *data, int argc, object self_731149, object r_73920) { return_closcall1(data, ((closureN)self_731149)->elements[0], global_set(__glo_make_91integer_91hash_91table_srfi_69, r_73920));; } static void __lambda_181(void *data, int argc, closure _,object k_73886, object function_73320_73481) { Cyc_st_add(data, "srfi/69.sld:Cyc-memoize"); closureN_type c_732429; object e_732464 [2]; c_732429.hdr.mark = gc_color_red; c_732429.hdr.grayed = 0; c_732429.tag = closureN_tag; c_732429.fn = (function_type)__lambda_182; c_732429.num_args = 1; c_732429.num_elements = 2; c_732429.elements = (object *)e_732464; c_732429.elements[0] = function_73320_73481; c_732429.elements[1] = k_73886; return_closcall1(data, __glo_make_91hash_91table_srfi_69, &c_732429);; } static void __lambda_182(void *data, int argc, object self_731123, object table_73321_73482) { closureN_type c_732432; object e_732463 [2]; c_732432.hdr.mark = gc_color_red; c_732432.hdr.grayed = 0; c_732432.tag = closureN_tag; c_732432.fn = (function_type)__lambda_183; c_732432.num_args = 0; c_732432.num_elements = 2; c_732432.elements = (object *)e_732463; c_732432.elements[0] = ((closureN)self_731123)->elements[0]; c_732432.elements[1] = table_73321_73482; return_closcall1(data, ((closureN)self_731123)->elements[1], &c_732432);; } static void __lambda_183(void *data, int argc, object self_731124, object k_73888, object args_73322_73483_raw, ...) { load_varargs(args_73322_73483, args_73322_73483_raw, argc - 1); closureN_type c_732434; object e_732440 [1]; c_732434.hdr.mark = gc_color_red; c_732434.hdr.grayed = 0; c_732434.tag = closureN_tag; c_732434.fn = (function_type)__lambda_184; c_732434.num_args = 1; c_732434.num_elements = 1; c_732434.elements = (object *)e_732440; c_732434.elements[0] = k_73888; closureN_type c_732442; object e_732462 [3]; c_732442.hdr.mark = gc_color_red; c_732442.hdr.grayed = 0; c_732442.tag = closureN_tag; c_732442.fn = (function_type)__lambda_185; c_732442.num_args = 0; c_732442.num_elements = 3; c_732442.elements = (object *)e_732462; c_732442.elements[0] = args_73322_73483; c_732442.elements[1] = ((closureN)self_731124)->elements[0]; c_732442.elements[2] = ((closureN)self_731124)->elements[1]; return_closcall4(data, __glo_hash_91table_91ref_srfi_69, &c_732434, ((closureN)self_731124)->elements[1], args_73322_73483, &c_732442);; } static void __lambda_185(void *data, int argc, object self_731126, object k_73891) { closureN_type c_732444; object e_732451 [2]; c_732444.hdr.mark = gc_color_red; c_732444.hdr.grayed = 0; c_732444.tag = closureN_tag; c_732444.fn = (function_type)__lambda_186; c_732444.num_args = 0; c_732444.num_elements = 2; c_732444.elements = (object *)e_732451; c_732444.elements[0] = ((closureN)self_731126)->elements[0]; c_732444.elements[1] = ((closureN)self_731126)->elements[1]; closureN_type c_732452; object e_732461 [2]; c_732452.hdr.mark = gc_color_red; c_732452.hdr.grayed = 0; c_732452.tag = closureN_tag; c_732452.fn = (function_type)__lambda_187; c_732452.num_args = 0; c_732452.num_elements = 2; c_732452.elements = (object *)e_732461; c_732452.elements[0] = ((closureN)self_731126)->elements[0]; c_732452.elements[1] = ((closureN)self_731126)->elements[2]; return_closcall3(data, __glo_call_91with_91values_scheme_base, k_73891, &c_732444, &c_732452);; } static void __lambda_187(void *data, int argc, object self_731128, object k_73894, object results_73323_73484_raw, ...) { load_varargs(results_73323_73484, results_73323_73484_raw, argc - 1); closureN_type c_732454; object e_732458 [2]; c_732454.hdr.mark = gc_color_red; c_732454.hdr.grayed = 0; c_732454.tag = closureN_tag; c_732454.fn = (function_type)__lambda_188; c_732454.num_args = 1; c_732454.num_elements = 2; c_732454.elements = (object *)e_732458; c_732454.elements[0] = k_73894; c_732454.elements[1] = results_73323_73484; return_closcall4(data, __glo_hash_91table_91set_67_srfi_69, &c_732454, ((closureN)self_731128)->elements[1], ((closureN)self_731128)->elements[0], results_73323_73484);; } static void __lambda_188(void *data, int argc, object self_731129, object r_73895) { return_closcall1(data, ((closureN)self_731129)->elements[0], ((closureN)self_731129)->elements[1]);; } static void __lambda_186(void *data, int argc, object self_731127, object k_73896) { object c_732448 = apply(data, k_73896,((closureN)self_731127)->elements[1], ((closureN)self_731127)->elements[0]); return_closcall1(data, k_73896, c_732448);; } static void __lambda_184(void *data, int argc, object self_731125, object r_73889) { object c_732439 = apply(data, ((closureN)self_731125)->elements[0],__glo_values_scheme_base, r_73889); return_closcall1(data, ((closureN)self_731125)->elements[0], c_732439);; } static void __lambda_179(void *data, int argc, closure _,object k_73880, object hash_91table_73316_73477) { Cyc_st_add(data, "srfi/69.sld:hash-table-values"); mclosure0(c_732422, (function_type)__lambda_180);c_732422.num_args = 3; return_closcall4(data, __glo_hash_91table_91fold_srfi_69, k_73880, hash_91table_73316_73477, &c_732422, NULL);; } static void __lambda_180(void *data, int argc, object self_731122, object k_73883, object key_73317_73478, object val_73318_73479, object acc_73319_73480) { pair_type local_732426; return_closcall1(data, k_73883, set_pair_as_expr(&local_732426, val_73318_73479, acc_73319_73480));; } static void __lambda_177(void *data, int argc, closure _,object k_73874, object hash_91table_73312_73473) { Cyc_st_add(data, "srfi/69.sld:hash-table-keys"); mclosure0(c_732415, (function_type)__lambda_178);c_732415.num_args = 3; return_closcall4(data, __glo_hash_91table_91fold_srfi_69, k_73874, hash_91table_73312_73473, &c_732415, NULL);; } static void __lambda_178(void *data, int argc, object self_731121, object k_73877, object key_73313_73474, object val_73314_73475, object acc_73315_73476) { pair_type local_732419; return_closcall1(data, k_73877, set_pair_as_expr(&local_732419, key_73313_73474, acc_73315_73476));; } static void __lambda_174(void *data, int argc, closure _,object k_73868, object hash_91table1_73308_73469, object hash_91table2_73309_73470) { Cyc_st_add(data, "srfi/69.sld:hash-table-merge!"); closureN_type c_732404; object e_732408 [2]; c_732404.hdr.mark = gc_color_red; c_732404.hdr.grayed = 0; c_732404.tag = closureN_tag; c_732404.fn = (function_type)__lambda_175; c_732404.num_args = 1; c_732404.num_elements = 2; c_732404.elements = (object *)e_732408; c_732404.elements[0] = hash_91table1_73308_73469; c_732404.elements[1] = k_73868; closureN_type c_732409; object e_732412 [1]; c_732409.hdr.mark = gc_color_red; c_732409.hdr.grayed = 0; c_732409.tag = closureN_tag; c_732409.fn = (function_type)__lambda_176; c_732409.num_args = 2; c_732409.num_elements = 1; c_732409.elements = (object *)e_732412; c_732409.elements[0] = hash_91table1_73308_73469; return_closcall3(data, __glo_hash_91table_91walk_srfi_69, &c_732404, hash_91table2_73309_73470, &c_732409);; } static void __lambda_176(void *data, int argc, object self_731120, object k_73871, object key_73310_73471, object value_73311_73472) { return_closcall4(data, __glo_hash_91table_91set_67_srfi_69, k_73871, ((closureN)self_731120)->elements[0], key_73310_73471, value_73311_73472);; } static void __lambda_175(void *data, int argc, object self_731119, object r_73869) { return_closcall1(data, ((closureN)self_731119)->elements[1], ((closureN)self_731119)->elements[0]);; } static void __lambda_165(void *data, int argc, closure _,object k_73856, object hash_91table_73304_73465) { Cyc_st_add(data, "srfi/69.sld:hash-table-copy"); closureN_type c_732367; object e_732401 [2]; c_732367.hdr.mark = gc_color_red; c_732367.hdr.grayed = 0; c_732367.tag = closureN_tag; c_732367.fn = (function_type)__lambda_166; c_732367.num_args = 1; c_732367.num_elements = 2; c_732367.elements = (object *)e_732401; c_732367.elements[0] = hash_91table_73304_73465; c_732367.elements[1] = k_73856; return_closcall2(data, __glo_hash_91table_91equivalence_91function_srfi_69, &c_732367, hash_91table_73304_73465);; } static void __lambda_166(void *data, int argc, object self_731111, object r_73861) { closureN_type c_732369; object e_732399 [3]; c_732369.hdr.mark = gc_color_red; c_732369.hdr.grayed = 0; c_732369.tag = closureN_tag; c_732369.fn = (function_type)__lambda_167; c_732369.num_args = 1; c_732369.num_elements = 3; c_732369.elements = (object *)e_732399; c_732369.elements[0] = ((closureN)self_731111)->elements[0]; c_732369.elements[1] = ((closureN)self_731111)->elements[1]; c_732369.elements[2] = r_73861; return_closcall2(data, __glo_hash_91table_91hash_91function_srfi_69, &c_732369, ((closureN)self_731111)->elements[0]);; } static void __lambda_167(void *data, int argc, object self_731112, object r_73862) { closureN_type c_732371; object e_732397 [4]; c_732371.hdr.mark = gc_color_red; c_732371.hdr.grayed = 0; c_732371.tag = closureN_tag; c_732371.fn = (function_type)__lambda_168; c_732371.num_args = 1; c_732371.num_elements = 4; c_732371.elements = (object *)e_732397; c_732371.elements[0] = ((closureN)self_731112)->elements[0]; c_732371.elements[1] = ((closureN)self_731112)->elements[1]; c_732371.elements[2] = ((closureN)self_731112)->elements[2]; c_732371.elements[3] = r_73862; return_closcall2(data, __glo_hash_91table_91size_srfi_69, &c_732371, ((closureN)self_731112)->elements[0]);; } static void __lambda_168(void *data, int argc, object self_731113, object r_73865) { closureN_type c_732373; object e_732393 [4]; c_732373.hdr.mark = gc_color_red; c_732373.hdr.grayed = 0; c_732373.tag = closureN_tag; c_732373.fn = (function_type)__lambda_169; c_732373.num_args = 1; c_732373.num_elements = 4; c_732373.elements = (object *)e_732393; c_732373.elements[0] = ((closureN)self_731113)->elements[0]; c_732373.elements[1] = ((closureN)self_731113)->elements[1]; c_732373.elements[2] = ((closureN)self_731113)->elements[2]; c_732373.elements[3] = ((closureN)self_731113)->elements[3]; complex_num_type local_732396; return_direct_with_clo1(data,(closure)&c_732373,__lambda_169, Cyc_fast_mul(data,&local_732396, obj_int2obj(2), r_73865));; } static void __lambda_169(void *data, int argc, object self_731114, object r_73864) { closureN_type c_732375; object e_732392 [4]; c_732375.hdr.mark = gc_color_red; c_732375.hdr.grayed = 0; c_732375.tag = closureN_tag; c_732375.fn = (function_type)__lambda_170; c_732375.num_args = 1; c_732375.num_elements = 4; c_732375.elements = (object *)e_732392; c_732375.elements[0] = ((closureN)self_731114)->elements[0]; c_732375.elements[1] = ((closureN)self_731114)->elements[1]; c_732375.elements[2] = ((closureN)self_731114)->elements[2]; c_732375.elements[3] = ((closureN)self_731114)->elements[3]; return_closcall3(data, __glo_max_scheme_base, &c_732375, __glo__85default_91table_91size_85_srfi_69, r_73864);; } static void __lambda_170(void *data, int argc, object self_731115, object r_73863) { closureN_type c_732377; object e_732389 [2]; c_732377.hdr.mark = gc_color_red; c_732377.hdr.grayed = 0; c_732377.tag = closureN_tag; c_732377.fn = (function_type)__lambda_171; c_732377.num_args = 1; c_732377.num_elements = 2; c_732377.elements = (object *)e_732389; c_732377.elements[0] = ((closureN)self_731115)->elements[0]; c_732377.elements[1] = ((closureN)self_731115)->elements[1]; return_closcall4(data, __glo_make_91hash_91table_srfi_69, &c_732377, ((closureN)self_731115)->elements[2], ((closureN)self_731115)->elements[3], r_73863);; } static void __lambda_171(void *data, int argc, object self_731116, object new_73305_73466) { closureN_type c_732379; object e_732383 [2]; c_732379.hdr.mark = gc_color_red; c_732379.hdr.grayed = 0; c_732379.tag = closureN_tag; c_732379.fn = (function_type)__lambda_172; c_732379.num_args = 1; c_732379.num_elements = 2; c_732379.elements = (object *)e_732383; c_732379.elements[0] = ((closureN)self_731116)->elements[1]; c_732379.elements[1] = new_73305_73466; closureN_type c_732385; object e_732388 [1]; c_732385.hdr.mark = gc_color_red; c_732385.hdr.grayed = 0; c_732385.tag = closureN_tag; c_732385.fn = (function_type)__lambda_173; c_732385.num_args = 2; c_732385.num_elements = 1; c_732385.elements = (object *)e_732388; c_732385.elements[0] = new_73305_73466; return_closcall3(data, __glo_hash_91table_91walk_srfi_69, &c_732379, ((closureN)self_731116)->elements[0], &c_732385);; } static void __lambda_173(void *data, int argc, object self_731118, object k_73860, object key_73306_73467, object value_73307_73468) { return_closcall4(data, __glo_hash_91table_91set_67_srfi_69, k_73860, ((closureN)self_731118)->elements[0], key_73306_73467, value_73307_73468);; } static void __lambda_172(void *data, int argc, object self_731117, object r_73858) { return_closcall1(data, ((closureN)self_731117)->elements[0], ((closureN)self_731117)->elements[1]);; } static void __lambda_163(void *data, int argc, closure _,object k_73849, object hash_91table_73300_73461) { Cyc_st_add(data, "srfi/69.sld:hash-table->alist"); mclosure0(c_732357, (function_type)__lambda_164);c_732357.num_args = 3; return_closcall4(data, __glo_hash_91table_91fold_srfi_69, k_73849, hash_91table_73300_73461, &c_732357, NULL);; } static void __lambda_164(void *data, int argc, object self_731110, object k_73852, object key_73301_73462, object val_73302_73463, object acc_73303_73464) { pair_type local_732361; pair_type local_732364; return_closcall1(data, k_73852, set_pair_as_expr(&local_732361, set_pair_as_expr(&local_732364, key_73301_73462, val_73302_73463), acc_73303_73464));; } static void __lambda_150(void *data, int argc, closure _,object k_73819, object alist_73271_73450, object args_73272_73451_raw, ...) { load_varargs(args_73272_73451, args_73272_73451_raw, argc - 2); object comparison_73275_73452; Cyc_st_add(data, "srfi/69.sld:alist->hash-table"); if( (boolean_f != Cyc_is_null(args_73272_73451)) ){ comparison_73275_73452 = primitive_equal_127; } else { comparison_73275_73452 = Cyc_car(data, args_73272_73451);} ; closureN_type c_732256; object e_732283 [2]; c_732256.hdr.mark = gc_color_red; c_732256.hdr.grayed = 0; c_732256.tag = closureN_tag; c_732256.fn = (function_type)__lambda_151; c_732256.num_args = 0; c_732256.num_elements = 2; c_732256.elements = (object *)e_732283; c_732256.elements[0] = args_73272_73451; c_732256.elements[1] = comparison_73275_73452; closureN_type c_732284; object e_732354 [4]; c_732284.hdr.mark = gc_color_red; c_732284.hdr.grayed = 0; c_732284.tag = closureN_tag; c_732284.fn = (function_type)__lambda_154; c_732284.num_args = 1; c_732284.num_elements = 4; c_732284.elements = (object *)e_732354; c_732284.elements[0] = alist_73271_73450; c_732284.elements[1] = args_73272_73451; c_732284.elements[2] = comparison_73275_73452; c_732284.elements[3] = k_73819; return_direct_with_clo1(data,(closure)&c_732256,__lambda_151, &c_732284);; } static void __lambda_154(void *data, int argc, object self_731098, object hash_73278_73453) { closureN_type c_732286; object e_732329 [2]; c_732286.hdr.mark = gc_color_red; c_732286.hdr.grayed = 0; c_732286.tag = closureN_tag; c_732286.fn = (function_type)__lambda_155; c_732286.num_args = 0; c_732286.num_elements = 2; c_732286.elements = (object *)e_732329; c_732286.elements[0] = ((closureN)self_731098)->elements[0]; c_732286.elements[1] = ((closureN)self_731098)->elements[1]; closureN_type c_732330; object e_732353 [4]; c_732330.hdr.mark = gc_color_red; c_732330.hdr.grayed = 0; c_732330.tag = closureN_tag; c_732330.fn = (function_type)__lambda_158; c_732330.num_args = 1; c_732330.num_elements = 4; c_732330.elements = (object *)e_732353; c_732330.elements[0] = ((closureN)self_731098)->elements[0]; c_732330.elements[1] = ((closureN)self_731098)->elements[2]; c_732330.elements[2] = hash_73278_73453; c_732330.elements[3] = ((closureN)self_731098)->elements[3]; return_direct_with_clo1(data,(closure)&c_732286,__lambda_155, &c_732330);; } static void __lambda_158(void *data, int argc, object self_731099, object size_73281_73454) { closureN_type c_732332; object e_732350 [2]; c_732332.hdr.mark = gc_color_red; c_732332.hdr.grayed = 0; c_732332.tag = closureN_tag; c_732332.fn = (function_type)__lambda_159; c_732332.num_args = 1; c_732332.num_elements = 2; c_732332.elements = (object *)e_732350; c_732332.elements[0] = ((closureN)self_731099)->elements[0]; c_732332.elements[1] = ((closureN)self_731099)->elements[3]; return_closcall4(data, __glo_make_91hash_91table_srfi_69, &c_732332, ((closureN)self_731099)->elements[1], ((closureN)self_731099)->elements[2], size_73281_73454);; } static void __lambda_159(void *data, int argc, object self_731100, object hash_91table_73284_73455) { closureN_type c_732334; object e_732338 [2]; c_732334.hdr.mark = gc_color_red; c_732334.hdr.grayed = 0; c_732334.tag = closureN_tag; c_732334.fn = (function_type)__lambda_160; c_732334.num_args = 1; c_732334.num_elements = 2; c_732334.elements = (object *)e_732338; c_732334.elements[0] = hash_91table_73284_73455; c_732334.elements[1] = ((closureN)self_731100)->elements[1]; closureN_type c_732339; object e_732348 [1]; c_732339.hdr.mark = gc_color_red; c_732339.hdr.grayed = 0; c_732339.tag = closureN_tag; c_732339.fn = (function_type)__lambda_161; c_732339.num_args = 1; c_732339.num_elements = 1; c_732339.elements = (object *)e_732348; c_732339.elements[0] = hash_91table_73284_73455; return_closcall3(data, __glo_Cyc_91for_91each_91loop_911_scheme_base, &c_732334, &c_732339, ((closureN)self_731100)->elements[0]);; } static void __lambda_161(void *data, int argc, object self_731102, object k_73826, object elem_73286_73456) { mclosure0(c_732344, (function_type)__lambda_162);c_732344.num_args = 1; return_closcall5(data, __glo_hash_91table_91update_67_95default_srfi_69, k_73826, ((closureN)self_731102)->elements[0], Cyc_car(data, elem_73286_73456), &c_732344, Cyc_cdr(data, elem_73286_73456));; } static void __lambda_162(void *data, int argc, object self_731103, object k_73830, object x_73287_73457) { return_closcall1(data, k_73830, x_73287_73457);; } static void __lambda_160(void *data, int argc, object self_731101, object r_73824) { return_closcall1(data, ((closureN)self_731101)->elements[1], ((closureN)self_731101)->elements[0]);; } static void __lambda_155(void *data, int argc, object self_731104, object k_73831) { closureN_type c_732288; object e_732313 [1]; c_732288.hdr.mark = gc_color_red; c_732288.hdr.grayed = 0; c_732288.tag = closureN_tag; c_732288.fn = (function_type)__lambda_156; c_732288.num_args = 0; c_732288.num_elements = 1; c_732288.elements = (object *)e_732313; c_732288.elements[0] = ((closureN)self_731104)->elements[1]; closureN_type c_732314; object e_732328 [3]; c_732314.hdr.mark = gc_color_red; c_732314.hdr.grayed = 0; c_732314.tag = closureN_tag; c_732314.fn = (function_type)__lambda_157; c_732314.num_args = 1; c_732314.num_elements = 3; c_732314.elements = (object *)e_732328; c_732314.elements[0] = ((closureN)self_731104)->elements[0]; c_732314.elements[1] = ((closureN)self_731104)->elements[1]; c_732314.elements[2] = k_73831; return_direct_with_clo1(data,(closure)&c_732288,__lambda_156, &c_732314);; } static void __lambda_157(void *data, int argc, object self_731105, object r_73832) { if( (boolean_f != r_73832) ){ complex_num_type local_732319; return_closcall3(data, __glo_max_scheme_base, ((closureN)self_731105)->elements[2], __glo__85default_91table_91size_85_srfi_69, Cyc_fast_mul(data,&local_732319, obj_int2obj(2), Cyc_length(data, ((closureN)self_731105)->elements[0]))); } else { return_closcall1(data, ((closureN)self_731105)->elements[2], Cyc_caddr(data, ((closureN)self_731105)->elements[1]));} ;; } static void __lambda_156(void *data, int argc, object self_731106, object k_73836) { if( (boolean_f != Cyc_is_null(((closureN)self_731106)->elements[0])) ){ return_direct_with_clo1(data, k_73836,__lambda_157, Cyc_is_null(((closureN)self_731106)->elements[0])); } else { if( (boolean_f != Cyc_is_null(Cyc_cdr(data, ((closureN)self_731106)->elements[0]))) ){ return_direct_with_clo1(data, k_73836,__lambda_157, Cyc_is_null(Cyc_cdr(data, ((closureN)self_731106)->elements[0]))); } else { return_direct_with_clo1(data, k_73836,__lambda_157, Cyc_is_null(Cyc_cddr(data, ((closureN)self_731106)->elements[0])));} ;} ;; } static void __lambda_151(void *data, int argc, object self_731107, object k_73840) { closureN_type c_732258; object e_732272 [1]; c_732258.hdr.mark = gc_color_red; c_732258.hdr.grayed = 0; c_732258.tag = closureN_tag; c_732258.fn = (function_type)__lambda_152; c_732258.num_args = 0; c_732258.num_elements = 1; c_732258.elements = (object *)e_732272; c_732258.elements[0] = ((closureN)self_731107)->elements[0]; closureN_type c_732273; object e_732282 [3]; c_732273.hdr.mark = gc_color_red; c_732273.hdr.grayed = 0; c_732273.tag = closureN_tag; c_732273.fn = (function_type)__lambda_153; c_732273.num_args = 1; c_732273.num_elements = 3; c_732273.elements = (object *)e_732282; c_732273.elements[0] = ((closureN)self_731107)->elements[0]; c_732273.elements[1] = ((closureN)self_731107)->elements[1]; c_732273.elements[2] = k_73840; return_direct_with_clo1(data,(closure)&c_732258,__lambda_152, &c_732273);; } static void __lambda_153(void *data, int argc, object self_731108, object r_73841) { if( (boolean_f != r_73841) ){ return_closcall2(data, __glo_appropriate_91hash_91function_91for_srfi_69, ((closureN)self_731108)->elements[2], ((closureN)self_731108)->elements[1]); } else { return_closcall1(data, ((closureN)self_731108)->elements[2], Cyc_cadr(data, ((closureN)self_731108)->elements[0]));} ;; } static void __lambda_152(void *data, int argc, object self_731109, object k_73843) { if( (boolean_f != Cyc_is_null(((closureN)self_731109)->elements[0])) ){ return_direct_with_clo1(data, k_73843,__lambda_153, Cyc_is_null(((closureN)self_731109)->elements[0])); } else { return_direct_with_clo1(data, k_73843,__lambda_153, Cyc_is_null(Cyc_cdr(data, ((closureN)self_731109)->elements[0])));} ;; } static void __lambda_146(void *data, int argc, closure _,object k_73812, object hash_91table_73266_73445, object f_73267_73446, object acc_73268_73447) { Cyc_st_add(data, "srfi/69.sld:hash-table-fold"); closureN_type c_732219; object e_732243 [3]; c_732219.hdr.mark = gc_color_red; c_732219.hdr.grayed = 0; c_732219.tag = closureN_tag; c_732219.fn = (function_type)__lambda_217; c_732219.num_args = 1; c_732219.num_elements = 3; c_732219.elements = (object *)e_732243; c_732219.elements[0] = f_73267_73446; c_732219.elements[1] = hash_91table_73266_73445; c_732219.elements[2] = k_73812; pair_type local_732246; return_direct_with_clo1(data,(closure)&c_732219,__lambda_217, set_cell_as_expr(&local_732246, acc_73268_73447));; } static void __lambda_217(void *data, int argc, object self_731094, object acc_73268_73447) { closureN_type c_732221; object e_732227 [2]; c_732221.hdr.mark = gc_color_red; c_732221.hdr.grayed = 0; c_732221.tag = closureN_tag; c_732221.fn = (function_type)__lambda_147; c_732221.num_args = 1; c_732221.num_elements = 2; c_732221.elements = (object *)e_732227; c_732221.elements[0] = acc_73268_73447; c_732221.elements[1] = ((closureN)self_731094)->elements[2]; closureN_type c_732229; object e_732242 [2]; c_732229.hdr.mark = gc_color_red; c_732229.hdr.grayed = 0; c_732229.tag = closureN_tag; c_732229.fn = (function_type)__lambda_148; c_732229.num_args = 2; c_732229.num_elements = 2; c_732229.elements = (object *)e_732242; c_732229.elements[0] = acc_73268_73447; c_732229.elements[1] = ((closureN)self_731094)->elements[0]; return_closcall3(data, __glo_hash_91table_91walk_srfi_69, &c_732221, ((closureN)self_731094)->elements[1], &c_732229);; } static void __lambda_148(void *data, int argc, object self_731096, object k_73815, object key_73269_73448, object value_73270_73449) { closureN_type c_732232; object e_732238 [2]; c_732232.hdr.mark = gc_color_red; c_732232.hdr.grayed = 0; c_732232.tag = closureN_tag; c_732232.fn = (function_type)__lambda_149; c_732232.num_args = 1; c_732232.num_elements = 2; c_732232.elements = (object *)e_732238; c_732232.elements[0] = ((closureN)self_731096)->elements[0]; c_732232.elements[1] = k_73815; return_closcall4(data, ((closureN)self_731096)->elements[1], &c_732232, key_73269_73448, value_73270_73449, car(((closureN)self_731096)->elements[0]));; } static void __lambda_149(void *data, int argc, object self_731097, object r_73816) { return_closcall1(data, ((closureN)self_731097)->elements[1], Cyc_set_cell(data, ((closureN)self_731097)->elements[0], r_73816));; } static void __lambda_147(void *data, int argc, object self_731095, object r_73813) { return_closcall1(data, ((closureN)self_731095)->elements[1], car(((closureN)self_731095)->elements[0]));; } static void __lambda_141(void *data, int argc, closure _,object k_73804, object hash_91table_73263_73442, object proc_73264_73443) { Cyc_st_add(data, "srfi/69.sld:hash-table-walk"); closureN_type c_732200; object e_732216 [2]; c_732200.hdr.mark = gc_color_red; c_732200.hdr.grayed = 0; c_732200.tag = closureN_tag; c_732200.fn = (function_type)__lambda_142; c_732200.num_args = 1; c_732200.num_elements = 2; c_732200.elements = (object *)e_732216; c_732200.elements[0] = k_73804; c_732200.elements[1] = proc_73264_73443; return_closcall2(data, __glo_hash_91table_91entries_srfi_69, &c_732200, hash_91table_73263_73442);; } static void __lambda_142(void *data, int argc, object self_731090, object r_73806) { closureN_type c_732203; object e_732215 [1]; c_732203.hdr.mark = gc_color_red; c_732203.hdr.grayed = 0; c_732203.tag = closureN_tag; c_732203.fn = (function_type)__lambda_143; c_732203.num_args = 1; c_732203.num_elements = 1; c_732203.elements = (object *)e_732215; c_732203.elements[0] = ((closureN)self_731090)->elements[1]; return_closcall3(data, __glo__75hash_91table_91walk_srfi_69, ((closureN)self_731090)->elements[0], &c_732203, r_73806);; } static void __lambda_143(void *data, int argc, object self_731091, object k_73807, object node_73265_73444) { closureN_type c_732205; object e_732214 [3]; c_732205.hdr.mark = gc_color_red; c_732205.hdr.grayed = 0; c_732205.tag = closureN_tag; c_732205.fn = (function_type)__lambda_144; c_732205.num_args = 1; c_732205.num_elements = 3; c_732205.elements = (object *)e_732214; c_732205.elements[0] = k_73807; c_732205.elements[1] = node_73265_73444; c_732205.elements[2] = ((closureN)self_731091)->elements[0]; return_closcall2(data, __glo__75hash_91node_91key_srfi_69, &c_732205, node_73265_73444);; } static void __lambda_144(void *data, int argc, object self_731092, object r_73808) { closureN_type c_732207; object e_732212 [3]; c_732207.hdr.mark = gc_color_red; c_732207.hdr.grayed = 0; c_732207.tag = closureN_tag; c_732207.fn = (function_type)__lambda_145; c_732207.num_args = 1; c_732207.num_elements = 3; c_732207.elements = (object *)e_732212; c_732207.elements[0] = ((closureN)self_731092)->elements[0]; c_732207.elements[1] = ((closureN)self_731092)->elements[2]; c_732207.elements[2] = r_73808; return_closcall2(data, __glo__75hash_91node_91value_srfi_69, &c_732207, ((closureN)self_731092)->elements[1]);; } static void __lambda_145(void *data, int argc, object self_731093, object r_73809) { return_closcall3(data, ((closureN)self_731093)->elements[1], ((closureN)self_731093)->elements[0], ((closureN)self_731093)->elements[2], r_73809);; } static void __lambda_136(void *data, int argc, closure _,object k_73797, object hash_91table_73260_73440, object key_73261_73441) { Cyc_st_add(data, "srfi/69.sld:hash-table-exists?"); closureN_type c_732175; object e_732197 [3]; c_732175.hdr.mark = gc_color_red; c_732175.hdr.grayed = 0; c_732175.tag = closureN_tag; c_732175.fn = (function_type)__lambda_137; c_732175.num_args = 1; c_732175.num_elements = 3; c_732175.elements = (object *)e_732197; c_732175.elements[0] = hash_91table_73260_73440; c_732175.elements[1] = k_73797; c_732175.elements[2] = key_73261_73441; return_closcall2(data, __glo_hash_91table_91entries_srfi_69, &c_732175, hash_91table_73260_73440);; } static void __lambda_137(void *data, int argc, object self_731086, object r_73799) { closureN_type c_732177; object e_732195 [4]; c_732177.hdr.mark = gc_color_red; c_732177.hdr.grayed = 0; c_732177.tag = closureN_tag; c_732177.fn = (function_type)__lambda_138; c_732177.num_args = 1; c_732177.num_elements = 4; c_732177.elements = (object *)e_732195; c_732177.elements[0] = ((closureN)self_731086)->elements[0]; c_732177.elements[1] = ((closureN)self_731086)->elements[1]; c_732177.elements[2] = ((closureN)self_731086)->elements[2]; c_732177.elements[3] = r_73799; return_closcall2(data, __glo_hash_91table_91association_91function_srfi_69, &c_732177, ((closureN)self_731086)->elements[0]);; } static void __lambda_138(void *data, int argc, object self_731087, object r_73800) { closureN_type c_732179; object e_732192 [4]; c_732179.hdr.mark = gc_color_red; c_732179.hdr.grayed = 0; c_732179.tag = closureN_tag; c_732179.fn = (function_type)__lambda_139; c_732179.num_args = 1; c_732179.num_elements = 4; c_732179.elements = (object *)e_732192; c_732179.elements[0] = ((closureN)self_731087)->elements[1]; c_732179.elements[1] = ((closureN)self_731087)->elements[2]; c_732179.elements[2] = ((closureN)self_731087)->elements[3]; c_732179.elements[3] = r_73800; return_closcall3(data, __glo__75hash_91table_91hash_srfi_69, &c_732179, ((closureN)self_731087)->elements[0], ((closureN)self_731087)->elements[2]);; } static void __lambda_139(void *data, int argc, object self_731088, object r_73801) { closureN_type c_732182; object e_732187 [1]; c_732182.hdr.mark = gc_color_red; c_732182.hdr.grayed = 0; c_732182.tag = closureN_tag; c_732182.fn = (function_type)__lambda_140; c_732182.num_args = 1; c_732182.num_elements = 1; c_732182.elements = (object *)e_732187; c_732182.elements[0] = ((closureN)self_731088)->elements[0]; return_closcall3(data, ((closureN)self_731088)->elements[3], &c_732182, ((closureN)self_731088)->elements[1], Cyc_vector_ref(data, ((closureN)self_731088)->elements[2], r_73801));; } static void __lambda_140(void *data, int argc, object self_731089, object r_73798_73965) { if( (boolean_f != r_73798_73965) ){ return_closcall1(data, ((closureN)self_731089)->elements[0], boolean_t); } else { return_closcall1(data, ((closureN)self_731089)->elements[0], boolean_f);} ;; } static void __lambda_129(void *data, int argc, closure _,object k_73788, object hash_91table_73258_73438, object key_73259_73439) { Cyc_st_add(data, "srfi/69.sld:hash-table-delete!"); closureN_type c_732141; object e_732172 [3]; c_732141.hdr.mark = gc_color_red; c_732141.hdr.grayed = 0; c_732141.tag = closureN_tag; c_732141.fn = (function_type)__lambda_130; c_732141.num_args = 1; c_732141.num_elements = 3; c_732141.elements = (object *)e_732172; c_732141.elements[0] = hash_91table_73258_73438; c_732141.elements[1] = k_73788; c_732141.elements[2] = key_73259_73439; return_closcall2(data, __glo_hash_91table_91entries_srfi_69, &c_732141, hash_91table_73258_73438);; } static void __lambda_130(void *data, int argc, object self_731080, object r_73792) { closureN_type c_732143; object e_732170 [4]; c_732143.hdr.mark = gc_color_red; c_732143.hdr.grayed = 0; c_732143.tag = closureN_tag; c_732143.fn = (function_type)__lambda_131; c_732143.num_args = 1; c_732143.num_elements = 4; c_732143.elements = (object *)e_732170; c_732143.elements[0] = ((closureN)self_731080)->elements[0]; c_732143.elements[1] = ((closureN)self_731080)->elements[1]; c_732143.elements[2] = ((closureN)self_731080)->elements[2]; c_732143.elements[3] = r_73792; return_closcall2(data, __glo_hash_91table_91equivalence_91function_srfi_69, &c_732143, ((closureN)self_731080)->elements[0]);; } static void __lambda_131(void *data, int argc, object self_731081, object r_73793) { closureN_type c_732145; object e_732167 [5]; c_732145.hdr.mark = gc_color_red; c_732145.hdr.grayed = 0; c_732145.tag = closureN_tag; c_732145.fn = (function_type)__lambda_132; c_732145.num_args = 1; c_732145.num_elements = 5; c_732145.elements = (object *)e_732167; c_732145.elements[0] = ((closureN)self_731081)->elements[0]; c_732145.elements[1] = ((closureN)self_731081)->elements[1]; c_732145.elements[2] = ((closureN)self_731081)->elements[2]; c_732145.elements[3] = ((closureN)self_731081)->elements[3]; c_732145.elements[4] = r_73793; return_closcall3(data, __glo__75hash_91table_91hash_srfi_69, &c_732145, ((closureN)self_731081)->elements[0], ((closureN)self_731081)->elements[2]);; } static void __lambda_132(void *data, int argc, object self_731082, object r_73794) { closureN_type c_732147; object e_732163 [2]; c_732147.hdr.mark = gc_color_red; c_732147.hdr.grayed = 0; c_732147.tag = closureN_tag; c_732147.fn = (function_type)__lambda_133; c_732147.num_args = 1; c_732147.num_elements = 2; c_732147.elements = (object *)e_732163; c_732147.elements[0] = ((closureN)self_731082)->elements[0]; c_732147.elements[1] = ((closureN)self_731082)->elements[1]; return_closcall5(data, __glo__75hash_91table_91delete_67_srfi_69, &c_732147, ((closureN)self_731082)->elements[3], ((closureN)self_731082)->elements[4], r_73794, ((closureN)self_731082)->elements[2]);; } static void __lambda_133(void *data, int argc, object self_731083, object r_73789) { if( (boolean_f != r_73789) ){ closureN_type c_732149; object e_732159 [2]; c_732149.hdr.mark = gc_color_red; c_732149.hdr.grayed = 0; c_732149.tag = closureN_tag; c_732149.fn = (function_type)__lambda_134; c_732149.num_args = 1; c_732149.num_elements = 2; c_732149.elements = (object *)e_732159; c_732149.elements[0] = ((closureN)self_731083)->elements[0]; c_732149.elements[1] = ((closureN)self_731083)->elements[1]; return_closcall2(data, __glo_hash_91table_91size_srfi_69, &c_732149, ((closureN)self_731083)->elements[0]); } else { return_closcall1(data, ((closureN)self_731083)->elements[1], boolean_f);} ;; } static void __lambda_134(void *data, int argc, object self_731084, object r_73791) { closureN_type c_732151; object e_732155 [2]; c_732151.hdr.mark = gc_color_red; c_732151.hdr.grayed = 0; c_732151.tag = closureN_tag; c_732151.fn = (function_type)__lambda_135; c_732151.num_args = 1; c_732151.num_elements = 2; c_732151.elements = (object *)e_732155; c_732151.elements[0] = ((closureN)self_731084)->elements[0]; c_732151.elements[1] = ((closureN)self_731084)->elements[1]; complex_num_type local_732158; return_direct_with_clo1(data,(closure)&c_732151,__lambda_135, Cyc_fast_sub(data,&local_732158, r_73791, obj_int2obj(1)));; } static void __lambda_135(void *data, int argc, object self_731085, object r_73790) { return_closcall3(data, __glo_hash_91table_91set_91size_67_srfi_69, ((closureN)self_731085)->elements[1], ((closureN)self_731085)->elements[0], r_73790);; } static void __lambda_127(void *data, int argc, closure _,object k_73783, object hash_91table_73254_73434, object key_73255_73435, object function_73256_73436, object default_73257_73437) { Cyc_st_add(data, "srfi/69.sld:hash-table-update!/default"); closureN_type c_732135; object e_732138 [1]; c_732135.hdr.mark = gc_color_red; c_732135.hdr.grayed = 0; c_732135.tag = closureN_tag; c_732135.fn = (function_type)__lambda_128; c_732135.num_args = 0; c_732135.num_elements = 1; c_732135.elements = (object *)e_732138; c_732135.elements[0] = default_73257_73437; return_closcall5(data, __glo_hash_91table_91update_67_srfi_69, k_73783, hash_91table_73254_73434, key_73255_73435, function_73256_73436, &c_732135);; } static void __lambda_128(void *data, int argc, object self_731079, object k_73785) { return_closcall1(data, k_73785, ((closureN)self_731079)->elements[0]);; } static void __lambda_112(void *data, int argc, closure _,object k_73766, object hash_91table_73238_73426, object key_73239_73427, object function_73240_73428, object maybe_91default_73241_73429_raw, ...) { load_varargs(maybe_91default_73241_73429, maybe_91default_73241_73429_raw, argc - 4); Cyc_st_add(data, "srfi/69.sld:hash-table-update!"); closureN_type c_732058; object e_732132 [5]; c_732058.hdr.mark = gc_color_red; c_732058.hdr.grayed = 0; c_732058.tag = closureN_tag; c_732058.fn = (function_type)__lambda_113; c_732058.num_args = 1; c_732058.num_elements = 5; c_732058.elements = (object *)e_732132; c_732058.elements[0] = function_73240_73428; c_732058.elements[1] = hash_91table_73238_73426; c_732058.elements[2] = k_73766; c_732058.elements[3] = key_73239_73427; c_732058.elements[4] = maybe_91default_73241_73429; return_closcall3(data, __glo__75hash_91table_91hash_srfi_69, &c_732058, hash_91table_73238_73426, key_73239_73427);; } static void __lambda_113(void *data, int argc, object self_731065, object r_73767) { closureN_type c_732060; object e_732130 [6]; c_732060.hdr.mark = gc_color_red; c_732060.hdr.grayed = 0; c_732060.tag = closureN_tag; c_732060.fn = (function_type)__lambda_114; c_732060.num_args = 1; c_732060.num_elements = 6; c_732060.elements = (object *)e_732130; c_732060.elements[0] = ((closureN)self_731065)->elements[0]; c_732060.elements[1] = ((closureN)self_731065)->elements[1]; c_732060.elements[2] = ((closureN)self_731065)->elements[2]; c_732060.elements[3] = ((closureN)self_731065)->elements[3]; c_732060.elements[4] = ((closureN)self_731065)->elements[4]; c_732060.elements[5] = r_73767; return_closcall2(data, __glo_hash_91table_91entries_srfi_69, &c_732060, ((closureN)self_731065)->elements[1]);; } static void __lambda_114(void *data, int argc, object self_731066, object r_73768) { closureN_type c_732062; object e_732128 [5]; c_732062.hdr.mark = gc_color_red; c_732062.hdr.grayed = 0; c_732062.tag = closureN_tag; c_732062.fn = (function_type)__lambda_115; c_732062.num_args = 2; c_732062.num_elements = 5; c_732062.elements = (object *)e_732128; c_732062.elements[0] = ((closureN)self_731066)->elements[0]; c_732062.elements[1] = ((closureN)self_731066)->elements[1]; c_732062.elements[2] = ((closureN)self_731066)->elements[2]; c_732062.elements[3] = ((closureN)self_731066)->elements[3]; c_732062.elements[4] = ((closureN)self_731066)->elements[4]; return_direct_with_clo2(data,(closure)&c_732062,__lambda_115, ((closureN)self_731066)->elements[5], r_73768);; } static void __lambda_115(void *data, int argc, object self_731067, object hash_73242_73430, object entries_73243_73431) { closureN_type c_732064; object e_732126 [7]; c_732064.hdr.mark = gc_color_red; c_732064.hdr.grayed = 0; c_732064.tag = closureN_tag; c_732064.fn = (function_type)__lambda_116; c_732064.num_args = 1; c_732064.num_elements = 7; c_732064.elements = (object *)e_732126; c_732064.elements[0] = entries_73243_73431; c_732064.elements[1] = ((closureN)self_731067)->elements[0]; c_732064.elements[2] = hash_73242_73430; c_732064.elements[3] = ((closureN)self_731067)->elements[1]; c_732064.elements[4] = ((closureN)self_731067)->elements[2]; c_732064.elements[5] = ((closureN)self_731067)->elements[3]; c_732064.elements[6] = ((closureN)self_731067)->elements[4]; return_closcall2(data, __glo_hash_91table_91association_91function_srfi_69, &c_732064, ((closureN)self_731067)->elements[1]);; } static void __lambda_116(void *data, int argc, object self_731068, object r_73780) { closureN_type c_732066; object e_732120 [7]; c_732066.hdr.mark = gc_color_red; c_732066.hdr.grayed = 0; c_732066.tag = closureN_tag; c_732066.fn = (function_type)__lambda_117; c_732066.num_args = 1; c_732066.num_elements = 7; c_732066.elements = (object *)e_732120; c_732066.elements[0] = ((closureN)self_731068)->elements[0]; c_732066.elements[1] = ((closureN)self_731068)->elements[1]; c_732066.elements[2] = ((closureN)self_731068)->elements[2]; c_732066.elements[3] = ((closureN)self_731068)->elements[3]; c_732066.elements[4] = ((closureN)self_731068)->elements[4]; c_732066.elements[5] = ((closureN)self_731068)->elements[5]; c_732066.elements[6] = ((closureN)self_731068)->elements[6]; return_closcall3(data, r_73780, &c_732066, ((closureN)self_731068)->elements[5], Cyc_vector_ref(data, ((closureN)self_731068)->elements[0], ((closureN)self_731068)->elements[2]));; } static void __lambda_117(void *data, int argc, object self_731069, object tmp_73246_73248_73432_73955) { if( (boolean_f != tmp_73246_73248_73432_73955) ){ closureN_type c_732068; object e_732079 [2]; c_732068.hdr.mark = gc_color_red; c_732068.hdr.grayed = 0; c_732068.tag = closureN_tag; c_732068.fn = (function_type)__lambda_118; c_732068.num_args = 1; c_732068.num_elements = 2; c_732068.elements = (object *)e_732079; c_732068.elements[0] = ((closureN)self_731069)->elements[1]; c_732068.elements[1] = ((closureN)self_731069)->elements[4]; return_direct_with_clo1(data,(closure)&c_732068,__lambda_118, tmp_73246_73248_73432_73955); } else { if( (boolean_f != Cyc_is_null(((closureN)self_731069)->elements[6])) ){ make_utf8_string_with_len(c_732085, "hash-table-update!: no value exists for key", 43, 43); return_closcall3(data, __glo_error_scheme_base, ((closureN)self_731069)->elements[4], &c_732085, ((closureN)self_731069)->elements[5]); } else { closureN_type c_732091; object e_732119 [6]; c_732091.hdr.mark = gc_color_red; c_732091.hdr.grayed = 0; c_732091.tag = closureN_tag; c_732091.fn = (function_type)__lambda_121; c_732091.num_args = 1; c_732091.num_elements = 6; c_732091.elements = (object *)e_732119; c_732091.elements[0] = ((closureN)self_731069)->elements[0]; c_732091.elements[1] = ((closureN)self_731069)->elements[1]; c_732091.elements[2] = ((closureN)self_731069)->elements[2]; c_732091.elements[3] = ((closureN)self_731069)->elements[3]; c_732091.elements[4] = ((closureN)self_731069)->elements[4]; c_732091.elements[5] = ((closureN)self_731069)->elements[5]; return_closcall1(data, Cyc_car(data, ((closureN)self_731069)->elements[6]), &c_732091);} ;} ;; } static void __lambda_121(void *data, int argc, object self_731073, object r_73778_73959) { closureN_type c_732094; object e_732118 [5]; c_732094.hdr.mark = gc_color_red; c_732094.hdr.grayed = 0; c_732094.tag = closureN_tag; c_732094.fn = (function_type)__lambda_122; c_732094.num_args = 1; c_732094.num_elements = 5; c_732094.elements = (object *)e_732118; c_732094.elements[0] = ((closureN)self_731073)->elements[0]; c_732094.elements[1] = ((closureN)self_731073)->elements[2]; c_732094.elements[2] = ((closureN)self_731073)->elements[3]; c_732094.elements[3] = ((closureN)self_731073)->elements[4]; c_732094.elements[4] = ((closureN)self_731073)->elements[5]; return_closcall2(data, ((closureN)self_731073)->elements[1], &c_732094, r_73778_73959);; } static void __lambda_122(void *data, int argc, object self_731074, object r_73777_73960) { closureN_type c_732096; object e_732114 [2]; c_732096.hdr.mark = gc_color_red; c_732096.hdr.grayed = 0; c_732096.tag = closureN_tag; c_732096.fn = (function_type)__lambda_123; c_732096.num_args = 1; c_732096.num_elements = 2; c_732096.elements = (object *)e_732114; c_732096.elements[0] = ((closureN)self_731074)->elements[2]; c_732096.elements[1] = ((closureN)self_731074)->elements[3]; return_closcall5(data, __glo__75hash_91table_91add_67_srfi_69, &c_732096, ((closureN)self_731074)->elements[0], ((closureN)self_731074)->elements[1], ((closureN)self_731074)->elements[4], r_73777_73960);; } static void __lambda_123(void *data, int argc, object self_731075, object r_73773_73961) { closureN_type c_732098; object e_732112 [2]; c_732098.hdr.mark = gc_color_red; c_732098.hdr.grayed = 0; c_732098.tag = closureN_tag; c_732098.fn = (function_type)__lambda_124; c_732098.num_args = 1; c_732098.num_elements = 2; c_732098.elements = (object *)e_732112; c_732098.elements[0] = ((closureN)self_731075)->elements[0]; c_732098.elements[1] = ((closureN)self_731075)->elements[1]; return_closcall2(data, __glo_hash_91table_91size_srfi_69, &c_732098, ((closureN)self_731075)->elements[0]);; } static void __lambda_124(void *data, int argc, object self_731076, object r_73776_73962) { closureN_type c_732100; object e_732108 [2]; c_732100.hdr.mark = gc_color_red; c_732100.hdr.grayed = 0; c_732100.tag = closureN_tag; c_732100.fn = (function_type)__lambda_125; c_732100.num_args = 1; c_732100.num_elements = 2; c_732100.elements = (object *)e_732108; c_732100.elements[0] = ((closureN)self_731076)->elements[0]; c_732100.elements[1] = ((closureN)self_731076)->elements[1]; complex_num_type local_732111; return_direct_with_clo1(data,(closure)&c_732100,__lambda_125, Cyc_fast_sum(data,&local_732111, obj_int2obj(1), r_73776_73962));; } static void __lambda_125(void *data, int argc, object self_731077, object r_73775_73963) { closureN_type c_732102; object e_732106 [2]; c_732102.hdr.mark = gc_color_red; c_732102.hdr.grayed = 0; c_732102.tag = closureN_tag; c_732102.fn = (function_type)__lambda_126; c_732102.num_args = 1; c_732102.num_elements = 2; c_732102.elements = (object *)e_732106; c_732102.elements[0] = ((closureN)self_731077)->elements[0]; c_732102.elements[1] = ((closureN)self_731077)->elements[1]; return_closcall3(data, __glo_hash_91table_91set_91size_67_srfi_69, &c_732102, ((closureN)self_731077)->elements[0], r_73775_73963);; } static void __lambda_126(void *data, int argc, object self_731078, object r_73774_73964) { return_closcall2(data, __glo__75hash_91table_91maybe_91resize_67_srfi_69, ((closureN)self_731078)->elements[1], ((closureN)self_731078)->elements[0]);; } static void __lambda_118(void *data, int argc, object self_731070, object node_73249_73433_73956) { closureN_type c_732070; object e_732078 [3]; c_732070.hdr.mark = gc_color_red; c_732070.hdr.grayed = 0; c_732070.tag = closureN_tag; c_732070.fn = (function_type)__lambda_119; c_732070.num_args = 1; c_732070.num_elements = 3; c_732070.elements = (object *)e_732078; c_732070.elements[0] = ((closureN)self_731070)->elements[0]; c_732070.elements[1] = ((closureN)self_731070)->elements[1]; c_732070.elements[2] = node_73249_73433_73956; return_closcall2(data, __glo__75hash_91node_91value_srfi_69, &c_732070, node_73249_73433_73956);; } static void __lambda_119(void *data, int argc, object self_731071, object r_73771_73957) { closureN_type c_732073; object e_732077 [2]; c_732073.hdr.mark = gc_color_red; c_732073.hdr.grayed = 0; c_732073.tag = closureN_tag; c_732073.fn = (function_type)__lambda_120; c_732073.num_args = 1; c_732073.num_elements = 2; c_732073.elements = (object *)e_732077; c_732073.elements[0] = ((closureN)self_731071)->elements[1]; c_732073.elements[1] = ((closureN)self_731071)->elements[2]; return_closcall2(data, ((closureN)self_731071)->elements[0], &c_732073, r_73771_73957);; } static void __lambda_120(void *data, int argc, object self_731072, object r_73770_73958) { return_closcall3(data, __glo__75hash_91node_91set_91value_67_srfi_69, ((closureN)self_731072)->elements[0], ((closureN)self_731072)->elements[1], r_73770_73958);; } static void __lambda_101(void *data, int argc, closure _,object k_73755, object hash_91table_73226_73419, object key_73227_73420, object value_73228_73421) { Cyc_st_add(data, "srfi/69.sld:hash-table-set!"); closureN_type c_732004; object e_732055 [4]; c_732004.hdr.mark = gc_color_red; c_732004.hdr.grayed = 0; c_732004.tag = closureN_tag; c_732004.fn = (function_type)__lambda_102; c_732004.num_args = 1; c_732004.num_elements = 4; c_732004.elements = (object *)e_732055; c_732004.elements[0] = hash_91table_73226_73419; c_732004.elements[1] = k_73755; c_732004.elements[2] = key_73227_73420; c_732004.elements[3] = value_73228_73421; return_closcall3(data, __glo__75hash_91table_91hash_srfi_69, &c_732004, hash_91table_73226_73419, key_73227_73420);; } static void __lambda_102(void *data, int argc, object self_731055, object r_73756) { closureN_type c_732006; object e_732053 [5]; c_732006.hdr.mark = gc_color_red; c_732006.hdr.grayed = 0; c_732006.tag = closureN_tag; c_732006.fn = (function_type)__lambda_103; c_732006.num_args = 1; c_732006.num_elements = 5; c_732006.elements = (object *)e_732053; c_732006.elements[0] = ((closureN)self_731055)->elements[0]; c_732006.elements[1] = ((closureN)self_731055)->elements[1]; c_732006.elements[2] = ((closureN)self_731055)->elements[2]; c_732006.elements[3] = r_73756; c_732006.elements[4] = ((closureN)self_731055)->elements[3]; return_closcall2(data, __glo_hash_91table_91entries_srfi_69, &c_732006, ((closureN)self_731055)->elements[0]);; } static void __lambda_103(void *data, int argc, object self_731056, object r_73757) { closureN_type c_732008; object e_732051 [4]; c_732008.hdr.mark = gc_color_red; c_732008.hdr.grayed = 0; c_732008.tag = closureN_tag; c_732008.fn = (function_type)__lambda_104; c_732008.num_args = 2; c_732008.num_elements = 4; c_732008.elements = (object *)e_732051; c_732008.elements[0] = ((closureN)self_731056)->elements[0]; c_732008.elements[1] = ((closureN)self_731056)->elements[1]; c_732008.elements[2] = ((closureN)self_731056)->elements[2]; c_732008.elements[3] = ((closureN)self_731056)->elements[4]; return_direct_with_clo2(data,(closure)&c_732008,__lambda_104, ((closureN)self_731056)->elements[3], r_73757);; } static void __lambda_104(void *data, int argc, object self_731057, object hash_73229_73422, object entries_73230_73423) { closureN_type c_732010; object e_732049 [6]; c_732010.hdr.mark = gc_color_red; c_732010.hdr.grayed = 0; c_732010.tag = closureN_tag; c_732010.fn = (function_type)__lambda_105; c_732010.num_args = 1; c_732010.num_elements = 6; c_732010.elements = (object *)e_732049; c_732010.elements[0] = entries_73230_73423; c_732010.elements[1] = hash_73229_73422; c_732010.elements[2] = ((closureN)self_731057)->elements[0]; c_732010.elements[3] = ((closureN)self_731057)->elements[1]; c_732010.elements[4] = ((closureN)self_731057)->elements[2]; c_732010.elements[5] = ((closureN)self_731057)->elements[3]; return_closcall2(data, __glo_hash_91table_91association_91function_srfi_69, &c_732010, ((closureN)self_731057)->elements[0]);; } static void __lambda_105(void *data, int argc, object self_731058, object r_73763) { closureN_type c_732012; object e_732043 [6]; c_732012.hdr.mark = gc_color_red; c_732012.hdr.grayed = 0; c_732012.tag = closureN_tag; c_732012.fn = (function_type)__lambda_106; c_732012.num_args = 1; c_732012.num_elements = 6; c_732012.elements = (object *)e_732043; c_732012.elements[0] = ((closureN)self_731058)->elements[0]; c_732012.elements[1] = ((closureN)self_731058)->elements[1]; c_732012.elements[2] = ((closureN)self_731058)->elements[2]; c_732012.elements[3] = ((closureN)self_731058)->elements[3]; c_732012.elements[4] = ((closureN)self_731058)->elements[4]; c_732012.elements[5] = ((closureN)self_731058)->elements[5]; return_closcall3(data, r_73763, &c_732012, ((closureN)self_731058)->elements[4], Cyc_vector_ref(data, ((closureN)self_731058)->elements[0], ((closureN)self_731058)->elements[1]));; } static void __lambda_106(void *data, int argc, object self_731059, object tmp_73233_73235_73424_73949) { if( (boolean_f != tmp_73233_73235_73424_73949) ){ closureN_type c_732014; object e_732018 [2]; c_732014.hdr.mark = gc_color_red; c_732014.hdr.grayed = 0; c_732014.tag = closureN_tag; c_732014.fn = (function_type)__lambda_107; c_732014.num_args = 1; c_732014.num_elements = 2; c_732014.elements = (object *)e_732018; c_732014.elements[0] = ((closureN)self_731059)->elements[3]; c_732014.elements[1] = ((closureN)self_731059)->elements[5]; return_direct_with_clo1(data,(closure)&c_732014,__lambda_107, tmp_73233_73235_73424_73949); } else { closureN_type c_732020; object e_732038 [2]; c_732020.hdr.mark = gc_color_red; c_732020.hdr.grayed = 0; c_732020.tag = closureN_tag; c_732020.fn = (function_type)__lambda_108; c_732020.num_args = 1; c_732020.num_elements = 2; c_732020.elements = (object *)e_732038; c_732020.elements[0] = ((closureN)self_731059)->elements[2]; c_732020.elements[1] = ((closureN)self_731059)->elements[3]; return_closcall5(data, __glo__75hash_91table_91add_67_srfi_69, &c_732020, ((closureN)self_731059)->elements[0], ((closureN)self_731059)->elements[1], ((closureN)self_731059)->elements[4], ((closureN)self_731059)->elements[5]);} ;; } static void __lambda_108(void *data, int argc, object self_731061, object r_73759_73951) { closureN_type c_732022; object e_732036 [2]; c_732022.hdr.mark = gc_color_red; c_732022.hdr.grayed = 0; c_732022.tag = closureN_tag; c_732022.fn = (function_type)__lambda_109; c_732022.num_args = 1; c_732022.num_elements = 2; c_732022.elements = (object *)e_732036; c_732022.elements[0] = ((closureN)self_731061)->elements[0]; c_732022.elements[1] = ((closureN)self_731061)->elements[1]; return_closcall2(data, __glo_hash_91table_91size_srfi_69, &c_732022, ((closureN)self_731061)->elements[0]);; } static void __lambda_109(void *data, int argc, object self_731062, object r_73762_73952) { closureN_type c_732024; object e_732032 [2]; c_732024.hdr.mark = gc_color_red; c_732024.hdr.grayed = 0; c_732024.tag = closureN_tag; c_732024.fn = (function_type)__lambda_110; c_732024.num_args = 1; c_732024.num_elements = 2; c_732024.elements = (object *)e_732032; c_732024.elements[0] = ((closureN)self_731062)->elements[0]; c_732024.elements[1] = ((closureN)self_731062)->elements[1]; complex_num_type local_732035; return_direct_with_clo1(data,(closure)&c_732024,__lambda_110, Cyc_fast_sum(data,&local_732035, obj_int2obj(1), r_73762_73952));; } static void __lambda_110(void *data, int argc, object self_731063, object r_73761_73953) { closureN_type c_732026; object e_732030 [2]; c_732026.hdr.mark = gc_color_red; c_732026.hdr.grayed = 0; c_732026.tag = closureN_tag; c_732026.fn = (function_type)__lambda_111; c_732026.num_args = 1; c_732026.num_elements = 2; c_732026.elements = (object *)e_732030; c_732026.elements[0] = ((closureN)self_731063)->elements[0]; c_732026.elements[1] = ((closureN)self_731063)->elements[1]; return_closcall3(data, __glo_hash_91table_91set_91size_67_srfi_69, &c_732026, ((closureN)self_731063)->elements[0], r_73761_73953);; } static void __lambda_111(void *data, int argc, object self_731064, object r_73760_73954) { return_closcall2(data, __glo__75hash_91table_91maybe_91resize_67_srfi_69, ((closureN)self_731064)->elements[1], ((closureN)self_731064)->elements[0]);; } static void __lambda_107(void *data, int argc, object self_731060, object node_73236_73425_73950) { return_closcall3(data, __glo__75hash_91node_91set_91value_67_srfi_69, ((closureN)self_731060)->elements[0], node_73236_73425_73950, ((closureN)self_731060)->elements[1]);; } static void __lambda_99(void *data, int argc, closure _,object k_73750, object hash_91table_73223_73416, object key_73224_73417, object default_73225_73418) { Cyc_st_add(data, "srfi/69.sld:hash-table-ref/default"); closureN_type c_731998; object e_732001 [1]; c_731998.hdr.mark = gc_color_red; c_731998.hdr.grayed = 0; c_731998.tag = closureN_tag; c_731998.fn = (function_type)__lambda_100; c_731998.num_args = 0; c_731998.num_elements = 1; c_731998.elements = (object *)e_732001; c_731998.elements[0] = default_73225_73418; return_closcall4(data, __glo_hash_91table_91ref_srfi_69, k_73750, hash_91table_73223_73416, key_73224_73417, &c_731998);; } static void __lambda_100(void *data, int argc, object self_731054, object k_73752) { return_closcall1(data, k_73752, ((closureN)self_731054)->elements[0]);; } static void __lambda_94(void *data, int argc, closure _,object k_73741, object hash_91table_73211_73412, object key_73212_73413, object maybe_91default_73213_73414_raw, ...) { load_varargs(maybe_91default_73213_73414, maybe_91default_73213_73414_raw, argc - 3); Cyc_st_add(data, "srfi/69.sld:hash-table-ref"); closureN_type c_731963; object e_731995 [4]; c_731963.hdr.mark = gc_color_red; c_731963.hdr.grayed = 0; c_731963.tag = closureN_tag; c_731963.fn = (function_type)__lambda_95; c_731963.num_args = 1; c_731963.num_elements = 4; c_731963.elements = (object *)e_731995; c_731963.elements[0] = hash_91table_73211_73412; c_731963.elements[1] = k_73741; c_731963.elements[2] = key_73212_73413; c_731963.elements[3] = maybe_91default_73213_73414; return_closcall2(data, __glo_hash_91table_91entries_srfi_69, &c_731963, hash_91table_73211_73412);; } static void __lambda_95(void *data, int argc, object self_731050, object r_73745) { closureN_type c_731965; object e_731993 [5]; c_731965.hdr.mark = gc_color_red; c_731965.hdr.grayed = 0; c_731965.tag = closureN_tag; c_731965.fn = (function_type)__lambda_96; c_731965.num_args = 1; c_731965.num_elements = 5; c_731965.elements = (object *)e_731993; c_731965.elements[0] = ((closureN)self_731050)->elements[0]; c_731965.elements[1] = ((closureN)self_731050)->elements[1]; c_731965.elements[2] = ((closureN)self_731050)->elements[2]; c_731965.elements[3] = ((closureN)self_731050)->elements[3]; c_731965.elements[4] = r_73745; return_closcall2(data, __glo_hash_91table_91association_91function_srfi_69, &c_731965, ((closureN)self_731050)->elements[0]);; } static void __lambda_96(void *data, int argc, object self_731051, object r_73746) { closureN_type c_731967; object e_731990 [5]; c_731967.hdr.mark = gc_color_red; c_731967.hdr.grayed = 0; c_731967.tag = closureN_tag; c_731967.fn = (function_type)__lambda_97; c_731967.num_args = 1; c_731967.num_elements = 5; c_731967.elements = (object *)e_731990; c_731967.elements[0] = ((closureN)self_731051)->elements[1]; c_731967.elements[1] = ((closureN)self_731051)->elements[2]; c_731967.elements[2] = ((closureN)self_731051)->elements[3]; c_731967.elements[3] = ((closureN)self_731051)->elements[4]; c_731967.elements[4] = r_73746; return_closcall3(data, __glo__75hash_91table_91hash_srfi_69, &c_731967, ((closureN)self_731051)->elements[0], ((closureN)self_731051)->elements[2]);; } static void __lambda_97(void *data, int argc, object self_731052, object r_73747) { closureN_type c_731970; object e_731985 [3]; c_731970.hdr.mark = gc_color_red; c_731970.hdr.grayed = 0; c_731970.tag = closureN_tag; c_731970.fn = (function_type)__lambda_98; c_731970.num_args = 1; c_731970.num_elements = 3; c_731970.elements = (object *)e_731985; c_731970.elements[0] = ((closureN)self_731052)->elements[0]; c_731970.elements[1] = ((closureN)self_731052)->elements[1]; c_731970.elements[2] = ((closureN)self_731052)->elements[2]; return_closcall3(data, ((closureN)self_731052)->elements[4], &c_731970, ((closureN)self_731052)->elements[1], Cyc_vector_ref(data, ((closureN)self_731052)->elements[3], r_73747));; } static void __lambda_98(void *data, int argc, object self_731053, object tmp_73216_73218_73415_73948) { if( (boolean_f != tmp_73216_73218_73415_73948) ){ return_closcall2(data, __glo__75hash_91node_91value_srfi_69, ((closureN)self_731053)->elements[0], tmp_73216_73218_73415_73948); } else { if( (boolean_f != Cyc_is_null(((closureN)self_731053)->elements[2])) ){ make_utf8_string_with_len(c_731978, "hash-table-ref: no value associated with", 40, 40); return_closcall3(data, __glo_error_scheme_base, ((closureN)self_731053)->elements[0], &c_731978, ((closureN)self_731053)->elements[1]); } else { return_closcall1(data, Cyc_car(data, ((closureN)self_731053)->elements[2]), ((closureN)self_731053)->elements[0]);} ;} ;; } static void __lambda_82(void *data, int argc, closure _,object k_73723, object hash_91table_73192_73405) { Cyc_st_add(data, "srfi/69.sld:%hash-table-maybe-resize!"); closureN_type c_731897; object e_731960 [2]; c_731897.hdr.mark = gc_color_red; c_731897.hdr.grayed = 0; c_731897.tag = closureN_tag; c_731897.fn = (function_type)__lambda_83; c_731897.num_args = 1; c_731897.num_elements = 2; c_731897.elements = (object *)e_731960; c_731897.elements[0] = hash_91table_73192_73405; c_731897.elements[1] = k_73723; return_closcall2(data, __glo_hash_91table_91entries_srfi_69, &c_731897, hash_91table_73192_73405);; } static void __lambda_83(void *data, int argc, object self_731039, object old_91entries_73195_73406) { closureN_type c_731899; object e_731957 [3]; c_731899.hdr.mark = gc_color_red; c_731899.hdr.grayed = 0; c_731899.tag = closureN_tag; c_731899.fn = (function_type)__lambda_84; c_731899.num_args = 1; c_731899.num_elements = 3; c_731899.elements = (object *)e_731957; c_731899.elements[0] = ((closureN)self_731039)->elements[0]; c_731899.elements[1] = ((closureN)self_731039)->elements[1]; c_731899.elements[2] = old_91entries_73195_73406; return_direct_with_clo1(data,(closure)&c_731899,__lambda_84, Cyc_vector_length(data, old_91entries_73195_73406));; } static void __lambda_84(void *data, int argc, object self_731040, object hash_91length_73198_73407) { closureN_type c_731901; object e_731955 [4]; c_731901.hdr.mark = gc_color_red; c_731901.hdr.grayed = 0; c_731901.tag = closureN_tag; c_731901.fn = (function_type)__lambda_85; c_731901.num_args = 1; c_731901.num_elements = 4; c_731901.elements = (object *)e_731955; c_731901.elements[0] = hash_91length_73198_73407; c_731901.elements[1] = ((closureN)self_731040)->elements[0]; c_731901.elements[2] = ((closureN)self_731040)->elements[1]; c_731901.elements[3] = ((closureN)self_731040)->elements[2]; return_closcall2(data, __glo_hash_91table_91size_srfi_69, &c_731901, ((closureN)self_731040)->elements[0]);; } static void __lambda_85(void *data, int argc, object self_731041, object r_73738) { if( (boolean_f != Cyc_num_fast_gt_op(data, r_73738, ((closureN)self_731041)->elements[0])) ){ closureN_type c_731906; object e_731945 [4]; c_731906.hdr.mark = gc_color_red; c_731906.hdr.grayed = 0; c_731906.tag = closureN_tag; c_731906.fn = (function_type)__lambda_86; c_731906.num_args = 1; c_731906.num_elements = 4; c_731906.elements = (object *)e_731945; c_731906.elements[0] = ((closureN)self_731041)->elements[0]; c_731906.elements[1] = ((closureN)self_731041)->elements[1]; c_731906.elements[2] = ((closureN)self_731041)->elements[2]; c_731906.elements[3] = ((closureN)self_731041)->elements[3]; complex_num_type local_731951; object c_731948 = Cyc_make_vector(data,(closure)&c_731906,2,Cyc_fast_mul(data,&local_731951, obj_int2obj(2), ((closureN)self_731041)->elements[0]), NULL); return_closcall1(data,(closure)&c_731906, c_731948); } else { return_closcall1(data, ((closureN)self_731041)->elements[2], boolean_f);} ;; } static void __lambda_86(void *data, int argc, object self_731042, object new_91entries_73205_73409) { closureN_type c_731908; object e_731943 [5]; c_731908.hdr.mark = gc_color_red; c_731908.hdr.grayed = 0; c_731908.tag = closureN_tag; c_731908.fn = (function_type)__lambda_87; c_731908.num_args = 1; c_731908.num_elements = 5; c_731908.elements = (object *)e_731943; c_731908.elements[0] = ((closureN)self_731042)->elements[0]; c_731908.elements[1] = ((closureN)self_731042)->elements[1]; c_731908.elements[2] = ((closureN)self_731042)->elements[2]; c_731908.elements[3] = new_91entries_73205_73409; c_731908.elements[4] = ((closureN)self_731042)->elements[3]; return_closcall2(data, __glo_hash_91table_91hash_91function_srfi_69, &c_731908, ((closureN)self_731042)->elements[1]);; } static void __lambda_87(void *data, int argc, object self_731043, object hash_73208_73410) { closureN_type c_731910; object e_731915 [3]; c_731910.hdr.mark = gc_color_red; c_731910.hdr.grayed = 0; c_731910.tag = closureN_tag; c_731910.fn = (function_type)__lambda_88; c_731910.num_args = 1; c_731910.num_elements = 3; c_731910.elements = (object *)e_731915; c_731910.elements[0] = ((closureN)self_731043)->elements[1]; c_731910.elements[1] = ((closureN)self_731043)->elements[2]; c_731910.elements[2] = ((closureN)self_731043)->elements[3]; closureN_type c_731916; object e_731941 [3]; c_731916.hdr.mark = gc_color_red; c_731916.hdr.grayed = 0; c_731916.tag = closureN_tag; c_731916.fn = (function_type)__lambda_89; c_731916.num_args = 1; c_731916.num_elements = 3; c_731916.elements = (object *)e_731941; c_731916.elements[0] = hash_73208_73410; c_731916.elements[1] = ((closureN)self_731043)->elements[0]; c_731916.elements[2] = ((closureN)self_731043)->elements[3]; return_closcall3(data, __glo__75hash_91table_91walk_srfi_69, &c_731910, &c_731916, ((closureN)self_731043)->elements[4]);; } static void __lambda_89(void *data, int argc, object self_731045, object k_73732, object node_73210_73411) { closureN_type c_731918; object e_731940 [5]; c_731918.hdr.mark = gc_color_red; c_731918.hdr.grayed = 0; c_731918.tag = closureN_tag; c_731918.fn = (function_type)__lambda_90; c_731918.num_args = 1; c_731918.num_elements = 5; c_731918.elements = (object *)e_731940; c_731918.elements[0] = ((closureN)self_731045)->elements[0]; c_731918.elements[1] = ((closureN)self_731045)->elements[1]; c_731918.elements[2] = k_73732; c_731918.elements[3] = ((closureN)self_731045)->elements[2]; c_731918.elements[4] = node_73210_73411; return_closcall2(data, __glo__75hash_91node_91key_srfi_69, &c_731918, node_73210_73411);; } static void __lambda_90(void *data, int argc, object self_731046, object r_73736) { closureN_type c_731921; object e_731935 [3]; c_731921.hdr.mark = gc_color_red; c_731921.hdr.grayed = 0; c_731921.tag = closureN_tag; c_731921.fn = (function_type)__lambda_91; c_731921.num_args = 1; c_731921.num_elements = 3; c_731921.elements = (object *)e_731935; c_731921.elements[0] = ((closureN)self_731046)->elements[2]; c_731921.elements[1] = ((closureN)self_731046)->elements[3]; c_731921.elements[2] = ((closureN)self_731046)->elements[4]; complex_num_type local_731938; return_closcall3(data, ((closureN)self_731046)->elements[0], &c_731921, r_73736, Cyc_fast_mul(data,&local_731938, obj_int2obj(2), ((closureN)self_731046)->elements[1]));; } static void __lambda_91(void *data, int argc, object self_731047, object r_73733) { closureN_type c_731923; object e_731933 [4]; c_731923.hdr.mark = gc_color_red; c_731923.hdr.grayed = 0; c_731923.tag = closureN_tag; c_731923.fn = (function_type)__lambda_92; c_731923.num_args = 1; c_731923.num_elements = 4; c_731923.elements = (object *)e_731933; c_731923.elements[0] = ((closureN)self_731047)->elements[0]; c_731923.elements[1] = ((closureN)self_731047)->elements[1]; c_731923.elements[2] = ((closureN)self_731047)->elements[2]; c_731923.elements[3] = r_73733; return_closcall2(data, __glo__75hash_91node_91key_srfi_69, &c_731923, ((closureN)self_731047)->elements[2]);; } static void __lambda_92(void *data, int argc, object self_731048, object r_73734) { closureN_type c_731925; object e_731931 [4]; c_731925.hdr.mark = gc_color_red; c_731925.hdr.grayed = 0; c_731925.tag = closureN_tag; c_731925.fn = (function_type)__lambda_93; c_731925.num_args = 1; c_731925.num_elements = 4; c_731925.elements = (object *)e_731931; c_731925.elements[0] = ((closureN)self_731048)->elements[0]; c_731925.elements[1] = ((closureN)self_731048)->elements[1]; c_731925.elements[2] = ((closureN)self_731048)->elements[3]; c_731925.elements[3] = r_73734; return_closcall2(data, __glo__75hash_91node_91value_srfi_69, &c_731925, ((closureN)self_731048)->elements[2]);; } static void __lambda_93(void *data, int argc, object self_731049, object r_73735) { return_closcall5(data, __glo__75hash_91table_91add_67_srfi_69, ((closureN)self_731049)->elements[0], ((closureN)self_731049)->elements[1], ((closureN)self_731049)->elements[2], ((closureN)self_731049)->elements[3], r_73735);; } static void __lambda_88(void *data, int argc, object self_731044, object r_73730) { return_closcall3(data, __glo_hash_91table_91set_91entries_67_srfi_69, ((closureN)self_731044)->elements[1], ((closureN)self_731044)->elements[0], ((closureN)self_731044)->elements[2]);; } static void __lambda_78(void *data, int argc, closure _,object k_73711, object proc_73182_73399, object entries_73183_73400) { Cyc_st_add(data, "srfi/69.sld:%hash-table-walk"); closureN_type c_731851; object e_731894 [3]; c_731851.hdr.mark = gc_color_red; c_731851.hdr.grayed = 0; c_731851.tag = closureN_tag; c_731851.fn = (function_type)__lambda_79; c_731851.num_args = 1; c_731851.num_elements = 3; c_731851.elements = (object *)e_731894; c_731851.elements[0] = entries_73183_73400; c_731851.elements[1] = k_73711; c_731851.elements[2] = proc_73182_73399; return_direct_with_clo1(data,(closure)&c_731851,__lambda_79, boolean_f);; } static void __lambda_79(void *data, int argc, object self_731035, object lp_73184_73189_73402) { closureN_type c_731853; object e_731890 [3]; c_731853.hdr.mark = gc_color_red; c_731853.hdr.grayed = 0; c_731853.tag = closureN_tag; c_731853.fn = (function_type)__lambda_216; c_731853.num_args = 1; c_731853.num_elements = 3; c_731853.elements = (object *)e_731890; c_731853.elements[0] = ((closureN)self_731035)->elements[0]; c_731853.elements[1] = ((closureN)self_731035)->elements[1]; c_731853.elements[2] = ((closureN)self_731035)->elements[2]; pair_type local_731893; return_direct_with_clo1(data,(closure)&c_731853,__lambda_216, set_cell_as_expr(&local_731893, lp_73184_73189_73402));; } static void __lambda_216(void *data, int argc, object self_731036, object lp_73184_73189_73402) { closureN_type c_731867; object e_731889 [3]; c_731867.hdr.mark = gc_color_red; c_731867.hdr.grayed = 0; c_731867.tag = closureN_tag; c_731867.fn = (function_type)__lambda_80; c_731867.num_args = 1; c_731867.num_elements = 3; c_731867.elements = (object *)e_731889; c_731867.elements[0] = ((closureN)self_731036)->elements[0]; c_731867.elements[1] = lp_73184_73189_73402; c_731867.elements[2] = ((closureN)self_731036)->elements[2]; Cyc_set_cell(data, lp_73184_73189_73402, &c_731867); complex_num_type local_731861; return_closcall2(data, car(lp_73184_73189_73402), ((closureN)self_731036)->elements[1], Cyc_fast_sub(data,&local_731861, Cyc_vector_length(data, ((closureN)self_731036)->elements[0]), obj_int2obj(1)));;; } static void __lambda_80(void *data, int argc, object self_731037, object k_73715, object index_73190_73403) { if( (boolean_f != Cyc_num_fast_lt_op(data, index_73190_73403, obj_int2obj(0))) ){ return_closcall1(data, k_73715, Cyc_num_fast_lt_op(data, index_73190_73403, obj_int2obj(0))); } else { closureN_type c_731874; object e_731884 [3]; c_731874.hdr.mark = gc_color_red; c_731874.hdr.grayed = 0; c_731874.tag = closureN_tag; c_731874.fn = (function_type)__lambda_81; c_731874.num_args = 1; c_731874.num_elements = 3; c_731874.elements = (object *)e_731884; c_731874.elements[0] = index_73190_73403; c_731874.elements[1] = k_73715; c_731874.elements[2] = ((closureN)self_731037)->elements[1]; return_closcall3(data, __glo_Cyc_91for_91each_91loop_911_scheme_base, &c_731874, ((closureN)self_731037)->elements[2], Cyc_vector_ref(data, ((closureN)self_731037)->elements[0], index_73190_73403));} ;; } static void __lambda_81(void *data, int argc, object self_731038, object r_73717) { complex_num_type local_731882; return_closcall2(data, car(((closureN)self_731038)->elements[2]), ((closureN)self_731038)->elements[1], Cyc_fast_sub(data,&local_731882, ((closureN)self_731038)->elements[0], obj_int2obj(1)));; } static void __lambda_67(void *data, int argc, closure _,object k_73692, object entries_73157_73389, object compare_73158_73390, object hash_73159_73391, object key_73160_73392) { Cyc_st_add(data, "srfi/69.sld:%hash-table-delete!"); closureN_type c_731757; object e_731846 [5]; c_731757.hdr.mark = gc_color_red; c_731757.hdr.grayed = 0; c_731757.tag = closureN_tag; c_731757.fn = (function_type)__lambda_68; c_731757.num_args = 1; c_731757.num_elements = 5; c_731757.elements = (object *)e_731846; c_731757.elements[0] = compare_73158_73390; c_731757.elements[1] = entries_73157_73389; c_731757.elements[2] = hash_73159_73391; c_731757.elements[3] = k_73692; c_731757.elements[4] = key_73160_73392; return_direct_with_clo1(data,(closure)&c_731757,__lambda_68, Cyc_vector_ref(data, entries_73157_73389, hash_73159_73391));; } static void __lambda_68(void *data, int argc, object self_731024, object entrylist_73161_73393) { if( (boolean_f != Cyc_is_null(entrylist_73161_73393)) ){ return_closcall1(data, ((closureN)self_731024)->elements[3], boolean_f); } else { closureN_type c_731763; object e_731843 [6]; c_731763.hdr.mark = gc_color_red; c_731763.hdr.grayed = 0; c_731763.tag = closureN_tag; c_731763.fn = (function_type)__lambda_69; c_731763.num_args = 1; c_731763.num_elements = 6; c_731763.elements = (object *)e_731843; c_731763.elements[0] = ((closureN)self_731024)->elements[0]; c_731763.elements[1] = ((closureN)self_731024)->elements[1]; c_731763.elements[2] = entrylist_73161_73393; c_731763.elements[3] = ((closureN)self_731024)->elements[2]; c_731763.elements[4] = ((closureN)self_731024)->elements[3]; c_731763.elements[5] = ((closureN)self_731024)->elements[4]; return_direct_with_clo1(data,(closure)&c_731763,__lambda_69, Cyc_caar(data, entrylist_73161_73393));} ;; } static void __lambda_69(void *data, int argc, object self_731025, object r_73708) { closureN_type c_731766; object e_731841 [6]; c_731766.hdr.mark = gc_color_red; c_731766.hdr.grayed = 0; c_731766.tag = closureN_tag; c_731766.fn = (function_type)__lambda_70; c_731766.num_args = 1; c_731766.num_elements = 6; c_731766.elements = (object *)e_731841; c_731766.elements[0] = ((closureN)self_731025)->elements[0]; c_731766.elements[1] = ((closureN)self_731025)->elements[1]; c_731766.elements[2] = ((closureN)self_731025)->elements[2]; c_731766.elements[3] = ((closureN)self_731025)->elements[3]; c_731766.elements[4] = ((closureN)self_731025)->elements[4]; c_731766.elements[5] = ((closureN)self_731025)->elements[5]; return_closcall3(data, ((closureN)self_731025)->elements[0], &c_731766, ((closureN)self_731025)->elements[5], r_73708);; } static void __lambda_70(void *data, int argc, object self_731026, object r_73695) { if( (boolean_f != r_73695) ){ Cyc_vector_set(data, ((closureN)self_731026)->elements[1], ((closureN)self_731026)->elements[3], Cyc_cdr(data, ((closureN)self_731026)->elements[2]));return_closcall1(data, ((closureN)self_731026)->elements[4], boolean_t);; } else { closureN_type c_731778; object e_731837 [4]; c_731778.hdr.mark = gc_color_red; c_731778.hdr.grayed = 0; c_731778.tag = closureN_tag; c_731778.fn = (function_type)__lambda_71; c_731778.num_args = 1; c_731778.num_elements = 4; c_731778.elements = (object *)e_731837; c_731778.elements[0] = ((closureN)self_731026)->elements[0]; c_731778.elements[1] = ((closureN)self_731026)->elements[2]; c_731778.elements[2] = ((closureN)self_731026)->elements[4]; c_731778.elements[3] = ((closureN)self_731026)->elements[5]; return_direct_with_clo1(data,(closure)&c_731778,__lambda_71, Cyc_cdr(data, ((closureN)self_731026)->elements[2]));} ;; } static void __lambda_71(void *data, int argc, object self_731027, object r_73698) { closureN_type c_731780; object e_731835 [3]; c_731780.hdr.mark = gc_color_red; c_731780.hdr.grayed = 0; c_731780.tag = closureN_tag; c_731780.fn = (function_type)__lambda_72; c_731780.num_args = 2; c_731780.num_elements = 3; c_731780.elements = (object *)e_731835; c_731780.elements[0] = ((closureN)self_731027)->elements[0]; c_731780.elements[1] = ((closureN)self_731027)->elements[2]; c_731780.elements[2] = ((closureN)self_731027)->elements[3]; return_direct_with_clo2(data,(closure)&c_731780,__lambda_72, r_73698, ((closureN)self_731027)->elements[1]);; } static void __lambda_72(void *data, int argc, object self_731028, object current_73170_73394, object previous_73171_73395) { closureN_type c_731782; object e_731834 [5]; c_731782.hdr.mark = gc_color_red; c_731782.hdr.grayed = 0; c_731782.tag = closureN_tag; c_731782.fn = (function_type)__lambda_73; c_731782.num_args = 1; c_731782.num_elements = 5; c_731782.elements = (object *)e_731834; c_731782.elements[0] = ((closureN)self_731028)->elements[0]; c_731782.elements[1] = current_73170_73394; c_731782.elements[2] = ((closureN)self_731028)->elements[1]; c_731782.elements[3] = ((closureN)self_731028)->elements[2]; c_731782.elements[4] = previous_73171_73395; return_direct_with_clo1(data,(closure)&c_731782,__lambda_73, boolean_f);; } static void __lambda_73(void *data, int argc, object self_731029, object loop_73172_73396) { closureN_type c_731784; object e_731830 [5]; c_731784.hdr.mark = gc_color_red; c_731784.hdr.grayed = 0; c_731784.tag = closureN_tag; c_731784.fn = (function_type)__lambda_215; c_731784.num_args = 1; c_731784.num_elements = 5; c_731784.elements = (object *)e_731830; c_731784.elements[0] = ((closureN)self_731029)->elements[0]; c_731784.elements[1] = ((closureN)self_731029)->elements[1]; c_731784.elements[2] = ((closureN)self_731029)->elements[2]; c_731784.elements[3] = ((closureN)self_731029)->elements[3]; c_731784.elements[4] = ((closureN)self_731029)->elements[4]; pair_type local_731833; return_direct_with_clo1(data,(closure)&c_731784,__lambda_215, set_cell_as_expr(&local_731833, loop_73172_73396));; } static void __lambda_215(void *data, int argc, object self_731030, object loop_73172_73396) { closureN_type c_731794; object e_731829 [3]; c_731794.hdr.mark = gc_color_red; c_731794.hdr.grayed = 0; c_731794.tag = closureN_tag; c_731794.fn = (function_type)__lambda_74; c_731794.num_args = 2; c_731794.num_elements = 3; c_731794.elements = (object *)e_731829; c_731794.elements[0] = ((closureN)self_731030)->elements[0]; c_731794.elements[1] = ((closureN)self_731030)->elements[3]; c_731794.elements[2] = loop_73172_73396; Cyc_set_cell(data, loop_73172_73396, &c_731794); return_closcall3(data, car(loop_73172_73396), ((closureN)self_731030)->elements[2], ((closureN)self_731030)->elements[1], ((closureN)self_731030)->elements[4]);;; } static void __lambda_74(void *data, int argc, object self_731031, object k_73701, object current_73173_73397, object previous_73174_73398) { if( (boolean_f != Cyc_is_null(current_73173_73397)) ){ return_closcall1(data, k_73701, boolean_f); } else { closureN_type c_731799; object e_731826 [6]; c_731799.hdr.mark = gc_color_red; c_731799.hdr.grayed = 0; c_731799.tag = closureN_tag; c_731799.fn = (function_type)__lambda_75; c_731799.num_args = 1; c_731799.num_elements = 6; c_731799.elements = (object *)e_731826; c_731799.elements[0] = ((closureN)self_731031)->elements[0]; c_731799.elements[1] = current_73173_73397; c_731799.elements[2] = k_73701; c_731799.elements[3] = ((closureN)self_731031)->elements[1]; c_731799.elements[4] = ((closureN)self_731031)->elements[2]; c_731799.elements[5] = previous_73174_73398; return_direct_with_clo1(data,(closure)&c_731799,__lambda_75, Cyc_caar(data, current_73173_73397));} ;; } static void __lambda_75(void *data, int argc, object self_731032, object r_73707) { closureN_type c_731802; object e_731824 [4]; c_731802.hdr.mark = gc_color_red; c_731802.hdr.grayed = 0; c_731802.tag = closureN_tag; c_731802.fn = (function_type)__lambda_76; c_731802.num_args = 1; c_731802.num_elements = 4; c_731802.elements = (object *)e_731824; c_731802.elements[0] = ((closureN)self_731032)->elements[1]; c_731802.elements[1] = ((closureN)self_731032)->elements[2]; c_731802.elements[2] = ((closureN)self_731032)->elements[4]; c_731802.elements[3] = ((closureN)self_731032)->elements[5]; return_closcall3(data, ((closureN)self_731032)->elements[0], &c_731802, ((closureN)self_731032)->elements[3], r_73707);; } static void __lambda_76(void *data, int argc, object self_731033, object r_73703) { if( (boolean_f != r_73703) ){ Cyc_set_cdr(data, ((closureN)self_731033)->elements[3], Cyc_cdr(data, ((closureN)self_731033)->elements[0]));return_closcall1(data, ((closureN)self_731033)->elements[1], boolean_t);; } else { closureN_type c_731813; object e_731820 [3]; c_731813.hdr.mark = gc_color_red; c_731813.hdr.grayed = 0; c_731813.tag = closureN_tag; c_731813.fn = (function_type)__lambda_77; c_731813.num_args = 1; c_731813.num_elements = 3; c_731813.elements = (object *)e_731820; c_731813.elements[0] = ((closureN)self_731033)->elements[0]; c_731813.elements[1] = ((closureN)self_731033)->elements[1]; c_731813.elements[2] = ((closureN)self_731033)->elements[2]; return_direct_with_clo1(data,(closure)&c_731813,__lambda_77, Cyc_cdr(data, ((closureN)self_731033)->elements[0]));} ;; } static void __lambda_77(void *data, int argc, object self_731034, object r_73706) { return_closcall3(data, car(((closureN)self_731034)->elements[2]), ((closureN)self_731034)->elements[1], r_73706, ((closureN)self_731034)->elements[0]);; } static void __lambda_64(void *data, int argc, closure _,object k_73686, object entries_73153_73385, object hash_73154_73386, object key_73155_73387, object value_73156_73388) { Cyc_st_add(data, "srfi/69.sld:%hash-table-add!"); closureN_type c_731736; object e_731754 [3]; c_731736.hdr.mark = gc_color_red; c_731736.hdr.grayed = 0; c_731736.tag = closureN_tag; c_731736.fn = (function_type)__lambda_65; c_731736.num_args = 1; c_731736.num_elements = 3; c_731736.elements = (object *)e_731754; c_731736.elements[0] = entries_73153_73385; c_731736.elements[1] = hash_73154_73386; c_731736.elements[2] = k_73686; return_closcall3(data, __glo__75make_91hash_91node_srfi_69, &c_731736, key_73155_73387, value_73156_73388);; } static void __lambda_65(void *data, int argc, object self_731022, object r_73688) { closureN_type c_731738; object e_731749 [4]; c_731738.hdr.mark = gc_color_red; c_731738.hdr.grayed = 0; c_731738.tag = closureN_tag; c_731738.fn = (function_type)__lambda_66; c_731738.num_args = 1; c_731738.num_elements = 4; c_731738.elements = (object *)e_731749; c_731738.elements[0] = ((closureN)self_731022)->elements[0]; c_731738.elements[1] = ((closureN)self_731022)->elements[1]; c_731738.elements[2] = ((closureN)self_731022)->elements[2]; c_731738.elements[3] = r_73688; return_direct_with_clo1(data,(closure)&c_731738,__lambda_66, Cyc_vector_ref(data, ((closureN)self_731022)->elements[0], ((closureN)self_731022)->elements[1]));; } static void __lambda_66(void *data, int argc, object self_731023, object r_73689) { pair_type local_731747; return_closcall1(data, ((closureN)self_731023)->elements[2], Cyc_vector_set(data, ((closureN)self_731023)->elements[0], ((closureN)self_731023)->elements[1], set_pair_as_expr(&local_731747, ((closureN)self_731023)->elements[3], r_73689)));; } static void __lambda_63(void *data, int argc, closure _,object k_73682, object entries_73149_73381, object associate_73150_73382, object hash_73151_73383, object key_73152_73384) { Cyc_st_add(data, "srfi/69.sld:%hash-table-find"); return_closcall3(data, associate_73150_73382, k_73682, key_73152_73384, Cyc_vector_ref(data, entries_73149_73381, hash_73151_73383));; } static void __lambda_59(void *data, int argc, closure _,object k_73676, object hash_91table_73147_73379, object key_73148_73380) { Cyc_st_add(data, "srfi/69.sld:%hash-table-hash"); closureN_type c_731715; object e_731729 [3]; c_731715.hdr.mark = gc_color_red; c_731715.hdr.grayed = 0; c_731715.tag = closureN_tag; c_731715.fn = (function_type)__lambda_60; c_731715.num_args = 1; c_731715.num_elements = 3; c_731715.elements = (object *)e_731729; c_731715.elements[0] = hash_91table_73147_73379; c_731715.elements[1] = k_73676; c_731715.elements[2] = key_73148_73380; return_closcall2(data, __glo_hash_91table_91hash_91function_srfi_69, &c_731715, hash_91table_73147_73379);; } static void __lambda_60(void *data, int argc, object self_731019, object r_73677) { closureN_type c_731717; object e_731727 [3]; c_731717.hdr.mark = gc_color_red; c_731717.hdr.grayed = 0; c_731717.tag = closureN_tag; c_731717.fn = (function_type)__lambda_61; c_731717.num_args = 1; c_731717.num_elements = 3; c_731717.elements = (object *)e_731727; c_731717.elements[0] = ((closureN)self_731019)->elements[1]; c_731717.elements[1] = ((closureN)self_731019)->elements[2]; c_731717.elements[2] = r_73677; return_closcall2(data, __glo_hash_91table_91entries_srfi_69, &c_731717, ((closureN)self_731019)->elements[0]);; } static void __lambda_61(void *data, int argc, object self_731020, object r_73679) { closureN_type c_731719; object e_731724 [3]; c_731719.hdr.mark = gc_color_red; c_731719.hdr.grayed = 0; c_731719.tag = closureN_tag; c_731719.fn = (function_type)__lambda_62; c_731719.num_args = 1; c_731719.num_elements = 3; c_731719.elements = (object *)e_731724; c_731719.elements[0] = ((closureN)self_731020)->elements[0]; c_731719.elements[1] = ((closureN)self_731020)->elements[1]; c_731719.elements[2] = ((closureN)self_731020)->elements[2]; return_direct_with_clo1(data,(closure)&c_731719,__lambda_62, Cyc_vector_length(data, r_73679));; } static void __lambda_62(void *data, int argc, object self_731021, object r_73678) { return_closcall3(data, ((closureN)self_731021)->elements[2], ((closureN)self_731021)->elements[0], ((closureN)self_731021)->elements[1], r_73678);; } static void __lambda_57(void *data, int argc, closure _,object k_73662, object comp_73144_73376, object hash_73145_73377) { Cyc_st_add(data, "srfi/69.sld:make-hash-table-maker"); closureN_type c_731699; object e_731712 [2]; c_731699.hdr.mark = gc_color_red; c_731699.hdr.grayed = 0; c_731699.tag = closureN_tag; c_731699.fn = (function_type)__lambda_58; c_731699.num_args = 0; c_731699.num_elements = 2; c_731699.elements = (object *)e_731712; c_731699.elements[0] = comp_73144_73376; c_731699.elements[1] = hash_73145_73377; return_closcall1(data, k_73662, &c_731699);; } static void __lambda_58(void *data, int argc, object self_731018, object k_73663, object args_73146_73378_raw, ...) { load_varargs(args_73146_73378, args_73146_73378_raw, argc - 1); pair_type local_731706; pair_type local_731710; object c_731703 = apply(data, k_73663,__glo_make_91hash_91table_srfi_69, set_pair_as_expr(&local_731706, ((closureN)self_731018)->elements[0], set_pair_as_expr(&local_731710, ((closureN)self_731018)->elements[1], args_73146_73378))); return_closcall1(data, k_73663, c_731703);; } static void __lambda_36(void *data, int argc, closure _,object k_73622, object args_7393_73362_raw, ...) { load_varargs(args_7393_73362, args_7393_73362_raw, argc - 1); object comparison_7396_73363; Cyc_st_add(data, "srfi/69.sld:make-hash-table"); if( (boolean_f != Cyc_is_null(args_7393_73362)) ){ comparison_7396_73363 = primitive_equal_127; } else { comparison_7396_73363 = Cyc_car(data, args_7393_73362);} ; closureN_type c_731531; object e_731558 [2]; c_731531.hdr.mark = gc_color_red; c_731531.hdr.grayed = 0; c_731531.tag = closureN_tag; c_731531.fn = (function_type)__lambda_37; c_731531.num_args = 0; c_731531.num_elements = 2; c_731531.elements = (object *)e_731558; c_731531.elements[0] = args_7393_73362; c_731531.elements[1] = comparison_7396_73363; closureN_type c_731559; object e_731696 [3]; c_731559.hdr.mark = gc_color_red; c_731559.hdr.grayed = 0; c_731559.tag = closureN_tag; c_731559.fn = (function_type)__lambda_40; c_731559.num_args = 1; c_731559.num_elements = 3; c_731559.elements = (object *)e_731696; c_731559.elements[0] = args_7393_73362; c_731559.elements[1] = comparison_7396_73363; c_731559.elements[2] = k_73622; return_direct_with_clo1(data,(closure)&c_731531,__lambda_37, &c_731559);; } static void __lambda_40(void *data, int argc, object self_73997, object hash_7399_73364) { closureN_type c_731561; object e_731598 [1]; c_731561.hdr.mark = gc_color_red; c_731561.hdr.grayed = 0; c_731561.tag = closureN_tag; c_731561.fn = (function_type)__lambda_41; c_731561.num_args = 0; c_731561.num_elements = 1; c_731561.elements = (object *)e_731598; c_731561.elements[0] = ((closureN)self_73997)->elements[0]; closureN_type c_731599; object e_731695 [3]; c_731599.hdr.mark = gc_color_red; c_731599.hdr.grayed = 0; c_731599.tag = closureN_tag; c_731599.fn = (function_type)__lambda_44; c_731599.num_args = 1; c_731599.num_elements = 3; c_731599.elements = (object *)e_731695; c_731599.elements[0] = ((closureN)self_73997)->elements[1]; c_731599.elements[1] = hash_7399_73364; c_731599.elements[2] = ((closureN)self_73997)->elements[2]; return_direct_with_clo1(data,(closure)&c_731561,__lambda_41, &c_731599);; } static void __lambda_44(void *data, int argc, object self_73998, object size_73102_73365) { closureN_type c_731601; object e_731607 [1]; c_731601.hdr.mark = gc_color_red; c_731601.hdr.grayed = 0; c_731601.tag = closureN_tag; c_731601.fn = (function_type)__lambda_45; c_731601.num_args = 0; c_731601.num_elements = 1; c_731601.elements = (object *)e_731607; c_731601.elements[0] = ((closureN)self_73998)->elements[0]; closureN_type c_731608; object e_731694 [4]; c_731608.hdr.mark = gc_color_red; c_731608.hdr.grayed = 0; c_731608.tag = closureN_tag; c_731608.fn = (function_type)__lambda_46; c_731608.num_args = 1; c_731608.num_elements = 4; c_731608.elements = (object *)e_731694; c_731608.elements[0] = ((closureN)self_73998)->elements[0]; c_731608.elements[1] = ((closureN)self_73998)->elements[1]; c_731608.elements[2] = ((closureN)self_73998)->elements[2]; c_731608.elements[3] = size_73102_73365; return_direct_with_clo1(data,(closure)&c_731601,__lambda_45, &c_731608);; } static void __lambda_46(void *data, int argc, object self_73999, object tmp_73108_73110_73367) { closureN_type c_731610; object e_731679 [2]; c_731610.hdr.mark = gc_color_red; c_731610.hdr.grayed = 0; c_731610.tag = closureN_tag; c_731610.fn = (function_type)__lambda_47; c_731610.num_args = 0; c_731610.num_elements = 2; c_731610.elements = (object *)e_731679; c_731610.elements[0] = ((closureN)self_73999)->elements[0]; c_731610.elements[1] = tmp_73108_73110_73367; closureN_type c_731680; object e_731693 [4]; c_731680.hdr.mark = gc_color_red; c_731680.hdr.grayed = 0; c_731680.tag = closureN_tag; c_731680.fn = (function_type)__lambda_55; c_731680.num_args = 1; c_731680.num_elements = 4; c_731680.elements = (object *)e_731693; c_731680.elements[0] = ((closureN)self_73999)->elements[0]; c_731680.elements[1] = ((closureN)self_73999)->elements[1]; c_731680.elements[2] = ((closureN)self_73999)->elements[2]; c_731680.elements[3] = ((closureN)self_73999)->elements[3]; return_direct_with_clo1(data,(closure)&c_731610,__lambda_47, &c_731680);; } static void __lambda_55(void *data, int argc, object self_731000, object association_73105_73366) { closureN_type c_731682; object e_731688 [4]; c_731682.hdr.mark = gc_color_red; c_731682.hdr.grayed = 0; c_731682.tag = closureN_tag; c_731682.fn = (function_type)__lambda_56; c_731682.num_args = 1; c_731682.num_elements = 4; c_731682.elements = (object *)e_731688; c_731682.elements[0] = association_73105_73366; c_731682.elements[1] = ((closureN)self_731000)->elements[0]; c_731682.elements[2] = ((closureN)self_731000)->elements[1]; c_731682.elements[3] = ((closureN)self_731000)->elements[2]; object c_731691 = Cyc_make_vector(data,(closure)&c_731682,2,((closureN)self_731000)->elements[3], NULL); return_closcall1(data,(closure)&c_731682, c_731691);; } static void __lambda_56(void *data, int argc, object self_731001, object r_73627) { return_closcall6(data, __glo__75make_91hash_91table_srfi_69, ((closureN)self_731001)->elements[3], obj_int2obj(0), ((closureN)self_731001)->elements[2], ((closureN)self_731001)->elements[1], ((closureN)self_731001)->elements[0], r_73627);; } static void __lambda_47(void *data, int argc, object self_731002, object k_73630) { if( (boolean_f != ((closureN)self_731002)->elements[1]) ){ return_closcall1(data, k_73630, ((closureN)self_731002)->elements[1]); } else { closureN_type c_731615; object e_731621 [1]; c_731615.hdr.mark = gc_color_red; c_731615.hdr.grayed = 0; c_731615.tag = closureN_tag; c_731615.fn = (function_type)__lambda_48; c_731615.num_args = 0; c_731615.num_elements = 1; c_731615.elements = (object *)e_731621; c_731615.elements[0] = ((closureN)self_731002)->elements[0]; closureN_type c_731622; object e_731678 [2]; c_731622.hdr.mark = gc_color_red; c_731622.hdr.grayed = 0; c_731622.tag = closureN_tag; c_731622.fn = (function_type)__lambda_49; c_731622.num_args = 1; c_731622.num_elements = 2; c_731622.elements = (object *)e_731678; c_731622.elements[0] = ((closureN)self_731002)->elements[0]; c_731622.elements[1] = k_73630; return_direct_with_clo1(data,(closure)&c_731615,__lambda_48, &c_731622);} ;; } static void __lambda_49(void *data, int argc, object self_731003, object tmp_73112_73114_73368) { if( (boolean_f != tmp_73112_73114_73368) ){ return_closcall1(data, ((closureN)self_731003)->elements[1], tmp_73112_73114_73368); } else { closureN_type c_731626; object e_731632 [1]; c_731626.hdr.mark = gc_color_red; c_731626.hdr.grayed = 0; c_731626.tag = closureN_tag; c_731626.fn = (function_type)__lambda_50; c_731626.num_args = 0; c_731626.num_elements = 1; c_731626.elements = (object *)e_731632; c_731626.elements[0] = ((closureN)self_731003)->elements[0]; closureN_type c_731633; object e_731677 [2]; c_731633.hdr.mark = gc_color_red; c_731633.hdr.grayed = 0; c_731633.tag = closureN_tag; c_731633.fn = (function_type)__lambda_51; c_731633.num_args = 1; c_731633.num_elements = 2; c_731633.elements = (object *)e_731677; c_731633.elements[0] = ((closureN)self_731003)->elements[0]; c_731633.elements[1] = ((closureN)self_731003)->elements[1]; return_direct_with_clo1(data,(closure)&c_731626,__lambda_50, &c_731633);} ;; } static void __lambda_51(void *data, int argc, object self_731004, object tmp_73116_73118_73369) { if( (boolean_f != tmp_73116_73118_73369) ){ return_closcall1(data, ((closureN)self_731004)->elements[1], tmp_73116_73118_73369); } else { closureN_type c_731637; object e_731676 [2]; c_731637.hdr.mark = gc_color_red; c_731637.hdr.grayed = 0; c_731637.tag = closureN_tag; c_731637.fn = (function_type)__lambda_52; c_731637.num_args = 1; c_731637.num_elements = 2; c_731637.elements = (object *)e_731676; c_731637.elements[0] = ((closureN)self_731004)->elements[0]; c_731637.elements[1] = ((closureN)self_731004)->elements[1]; return_direct_with_clo1(data,(closure)&c_731637,__lambda_52, boolean_f);} ;; } static void __lambda_52(void *data, int argc, object self_731005, object associate_73119_73370) { closureN_type c_731639; object e_731672 [2]; c_731639.hdr.mark = gc_color_red; c_731639.hdr.grayed = 0; c_731639.tag = closureN_tag; c_731639.fn = (function_type)__lambda_214; c_731639.num_args = 1; c_731639.num_elements = 2; c_731639.elements = (object *)e_731672; c_731639.elements[0] = ((closureN)self_731005)->elements[0]; c_731639.elements[1] = ((closureN)self_731005)->elements[1]; pair_type local_731675; return_direct_with_clo1(data,(closure)&c_731639,__lambda_214, set_cell_as_expr(&local_731675, associate_73119_73370));; } static void __lambda_214(void *data, int argc, object self_731006, object associate_73119_73370) { closureN_type c_731647; object e_731671 [2]; c_731647.hdr.mark = gc_color_red; c_731647.hdr.grayed = 0; c_731647.tag = closureN_tag; c_731647.fn = (function_type)__lambda_53; c_731647.num_args = 2; c_731647.num_elements = 2; c_731647.elements = (object *)e_731671; c_731647.elements[0] = associate_73119_73370; c_731647.elements[1] = ((closureN)self_731006)->elements[0]; Cyc_set_cell(data, associate_73119_73370, &c_731647); return_closcall1(data, ((closureN)self_731006)->elements[1], car(associate_73119_73370));;; } static void __lambda_53(void *data, int argc, object self_731007, object k_73635, object val_73120_73371, object alist_73121_73372) { if( (boolean_f != Cyc_is_null(alist_73121_73372)) ){ return_closcall1(data, k_73635, boolean_f); } else { closureN_type c_731653; object e_731668 [4]; c_731653.hdr.mark = gc_color_red; c_731653.hdr.grayed = 0; c_731653.tag = closureN_tag; c_731653.fn = (function_type)__lambda_54; c_731653.num_args = 1; c_731653.num_elements = 4; c_731653.elements = (object *)e_731668; c_731653.elements[0] = alist_73121_73372; c_731653.elements[1] = ((closureN)self_731007)->elements[0]; c_731653.elements[2] = k_73635; c_731653.elements[3] = val_73120_73371; return_closcall3(data, ((closureN)self_731007)->elements[1], &c_731653, val_73120_73371, Cyc_caar(data, alist_73121_73372));} ;; } static void __lambda_54(void *data, int argc, object self_731008, object r_73637) { if( (boolean_f != r_73637) ){ return_closcall1(data, ((closureN)self_731008)->elements[2], Cyc_car(data, ((closureN)self_731008)->elements[0])); } else { return_closcall3(data, car(((closureN)self_731008)->elements[1]), ((closureN)self_731008)->elements[2], ((closureN)self_731008)->elements[3], Cyc_cdr(data, ((closureN)self_731008)->elements[0]));} ;; } static void __lambda_50(void *data, int argc, object self_731009, object k_73640) { if( (boolean_f != Cyc_eq(((closureN)self_731009)->elements[0], primitive_equal_127)) ){ return_direct_with_clo1(data, k_73640,__lambda_51, __glo_assoc_scheme_base); } else { return_direct_with_clo1(data, k_73640,__lambda_51, boolean_f);} ;; } static void __lambda_48(void *data, int argc, object self_731010, object k_73642) { if( (boolean_f != Cyc_eq(((closureN)self_731010)->elements[0], primitive_eqv_127)) ){ return_direct_with_clo1(data, k_73642,__lambda_49, primitive_assv); } else { return_direct_with_clo1(data, k_73642,__lambda_49, boolean_f);} ;; } static void __lambda_45(void *data, int argc, object self_731011, object k_73644) { if( (boolean_f != Cyc_eq(((closureN)self_731011)->elements[0], primitive_eq_127)) ){ return_direct_with_clo1(data, k_73644,__lambda_46, primitive_assq); } else { return_direct_with_clo1(data, k_73644,__lambda_46, boolean_f);} ;; } static void __lambda_41(void *data, int argc, object self_731012, object k_73646) { closureN_type c_731563; object e_731588 [1]; c_731563.hdr.mark = gc_color_red; c_731563.hdr.grayed = 0; c_731563.tag = closureN_tag; c_731563.fn = (function_type)__lambda_42; c_731563.num_args = 0; c_731563.num_elements = 1; c_731563.elements = (object *)e_731588; c_731563.elements[0] = ((closureN)self_731012)->elements[0]; closureN_type c_731589; object e_731597 [2]; c_731589.hdr.mark = gc_color_red; c_731589.hdr.grayed = 0; c_731589.tag = closureN_tag; c_731589.fn = (function_type)__lambda_43; c_731589.num_args = 1; c_731589.num_elements = 2; c_731589.elements = (object *)e_731597; c_731589.elements[0] = ((closureN)self_731012)->elements[0]; c_731589.elements[1] = k_73646; return_direct_with_clo1(data,(closure)&c_731563,__lambda_42, &c_731589);; } static void __lambda_43(void *data, int argc, object self_731013, object r_73647) { if( (boolean_f != r_73647) ){ return_closcall1(data, ((closureN)self_731013)->elements[1], __glo__85default_91table_91size_85_srfi_69); } else { return_closcall1(data, ((closureN)self_731013)->elements[1], Cyc_caddr(data, ((closureN)self_731013)->elements[0]));} ;; } static void __lambda_42(void *data, int argc, object self_731014, object k_73649) { if( (boolean_f != Cyc_is_null(((closureN)self_731014)->elements[0])) ){ return_direct_with_clo1(data, k_73649,__lambda_43, Cyc_is_null(((closureN)self_731014)->elements[0])); } else { if( (boolean_f != Cyc_is_null(Cyc_cdr(data, ((closureN)self_731014)->elements[0]))) ){ return_direct_with_clo1(data, k_73649,__lambda_43, Cyc_is_null(Cyc_cdr(data, ((closureN)self_731014)->elements[0]))); } else { return_direct_with_clo1(data, k_73649,__lambda_43, Cyc_is_null(Cyc_cddr(data, ((closureN)self_731014)->elements[0])));} ;} ;; } static void __lambda_37(void *data, int argc, object self_731015, object k_73653) { closureN_type c_731533; object e_731547 [1]; c_731533.hdr.mark = gc_color_red; c_731533.hdr.grayed = 0; c_731533.tag = closureN_tag; c_731533.fn = (function_type)__lambda_38; c_731533.num_args = 0; c_731533.num_elements = 1; c_731533.elements = (object *)e_731547; c_731533.elements[0] = ((closureN)self_731015)->elements[0]; closureN_type c_731548; object e_731557 [3]; c_731548.hdr.mark = gc_color_red; c_731548.hdr.grayed = 0; c_731548.tag = closureN_tag; c_731548.fn = (function_type)__lambda_39; c_731548.num_args = 1; c_731548.num_elements = 3; c_731548.elements = (object *)e_731557; c_731548.elements[0] = ((closureN)self_731015)->elements[0]; c_731548.elements[1] = ((closureN)self_731015)->elements[1]; c_731548.elements[2] = k_73653; return_direct_with_clo1(data,(closure)&c_731533,__lambda_38, &c_731548);; } static void __lambda_39(void *data, int argc, object self_731016, object r_73654) { if( (boolean_f != r_73654) ){ return_closcall2(data, __glo_appropriate_91hash_91function_91for_srfi_69, ((closureN)self_731016)->elements[2], ((closureN)self_731016)->elements[1]); } else { return_closcall1(data, ((closureN)self_731016)->elements[2], Cyc_cadr(data, ((closureN)self_731016)->elements[0]));} ;; } static void __lambda_38(void *data, int argc, object self_731017, object k_73656) { if( (boolean_f != Cyc_is_null(((closureN)self_731017)->elements[0])) ){ return_direct_with_clo1(data, k_73656,__lambda_39, Cyc_is_null(((closureN)self_731017)->elements[0])); } else { return_direct_with_clo1(data, k_73656,__lambda_39, Cyc_is_null(Cyc_cdr(data, ((closureN)self_731017)->elements[0])));} ;; } static void __lambda_31(void *data, int argc, closure _,object k_73610, object comparison_7377_73358) { object tmp_7379_7381_73359; Cyc_st_add(data, "srfi/69.sld:appropriate-hash-function-for"); if( (boolean_f != Cyc_eq(comparison_7377_73358, primitive_eq_127)) ){ tmp_7379_7381_73359 = __glo_hash_91by_91identity_srfi_69; } else { tmp_7379_7381_73359 = boolean_f;} ;if( (boolean_f != tmp_7379_7381_73359) ){ return_closcall1(data, k_73610, tmp_7379_7381_73359); } else { closureN_type c_731497; object e_731503 [1]; c_731497.hdr.mark = gc_color_red; c_731497.hdr.grayed = 0; c_731497.tag = closureN_tag; c_731497.fn = (function_type)__lambda_32; c_731497.num_args = 0; c_731497.num_elements = 1; c_731497.elements = (object *)e_731503; c_731497.elements[0] = comparison_7377_73358; closureN_type c_731504; object e_731521 [2]; c_731504.hdr.mark = gc_color_red; c_731504.hdr.grayed = 0; c_731504.tag = closureN_tag; c_731504.fn = (function_type)__lambda_33; c_731504.num_args = 1; c_731504.num_elements = 2; c_731504.elements = (object *)e_731521; c_731504.elements[0] = comparison_7377_73358; c_731504.elements[1] = k_73610; return_direct_with_clo1(data,(closure)&c_731497,__lambda_32, &c_731504);} ;; } static void __lambda_33(void *data, int argc, object self_73993, object tmp_7383_7385_73360) { if( (boolean_f != tmp_7383_7385_73360) ){ return_closcall1(data, ((closureN)self_73993)->elements[1], tmp_7383_7385_73360); } else { closureN_type c_731508; object e_731514 [1]; c_731508.hdr.mark = gc_color_red; c_731508.hdr.grayed = 0; c_731508.tag = closureN_tag; c_731508.fn = (function_type)__lambda_34; c_731508.num_args = 0; c_731508.num_elements = 1; c_731508.elements = (object *)e_731514; c_731508.elements[0] = ((closureN)self_73993)->elements[0]; closureN_type c_731515; object e_731520 [1]; c_731515.hdr.mark = gc_color_red; c_731515.hdr.grayed = 0; c_731515.tag = closureN_tag; c_731515.fn = (function_type)__lambda_35; c_731515.num_args = 1; c_731515.num_elements = 1; c_731515.elements = (object *)e_731520; c_731515.elements[0] = ((closureN)self_73993)->elements[1]; return_direct_with_clo1(data,(closure)&c_731508,__lambda_34, &c_731515);} ;; } static void __lambda_35(void *data, int argc, object self_73994, object tmp_7387_7389_73361) { if( (boolean_f != tmp_7387_7389_73361) ){ return_closcall1(data, ((closureN)self_73994)->elements[0], tmp_7387_7389_73361); } else { return_closcall1(data, ((closureN)self_73994)->elements[0], __glo_hash_srfi_69);} ;; } static void __lambda_34(void *data, int argc, object self_73995, object k_73614) { if( (boolean_f != Cyc_eq(((closureN)self_73995)->elements[0], __glo_string_91ci_123_127_scheme__char)) ){ return_direct_with_clo1(data, k_73614,__lambda_35, __glo_string_91ci_91hash_srfi_69); } else { return_direct_with_clo1(data, k_73614,__lambda_35, boolean_f);} ;; } static void __lambda_32(void *data, int argc, object self_73996, object k_73616) { if( (boolean_f != Cyc_eq(((closureN)self_73996)->elements[0], __glo_string_123_127_scheme_base)) ){ return_direct_with_clo1(data, k_73616,__lambda_33, __glo_string_91hash_srfi_69); } else { return_direct_with_clo1(data, k_73616,__lambda_33, boolean_f);} ;; } static void __lambda_30(void *data, int argc, closure _,object k_73603, object size_7372_73353, object hash_7373_73354, object compare_7374_73355, object associate_7375_73356, object entries_7376_73357) { Cyc_st_add(data, "srfi/69.sld:%make-hash-table"); vector_3_type local_731484; make_pair(c_731485,quote_record_91marker,NULL);c_731485.hdr.immutable = 1; vector_5_type local_731488; return_closcall1(data, k_73603, Cyc_fast_vector_3(&local_731484, &c_731485, __glo__121srfi_91hash_91table_125_srfi_69, Cyc_fast_vector_5(&local_731488, size_7372_73353, hash_7373_73354, compare_7374_73355, associate_7375_73356, entries_7376_73357)));; } static void __lambda_23(void *data, int argc, closure _,object k_73562, object v_7361_73346, object bound_7362_73347) { Cyc_st_add(data, "srfi/69.sld:vector-hash"); closureN_type c_731408; object e_731477 [3]; c_731408.hdr.mark = gc_color_red; c_731408.hdr.grayed = 0; c_731408.tag = closureN_tag; c_731408.fn = (function_type)__lambda_24; c_731408.num_args = 2; c_731408.num_elements = 3; c_731408.elements = (object *)e_731477; c_731408.elements[0] = bound_7362_73347; c_731408.elements[1] = k_73562; c_731408.elements[2] = v_7361_73346; return_direct_with_clo2(data,(closure)&c_731408,__lambda_24, obj_int2obj(571), Cyc_vector_length(data, v_7361_73346));; } static void __lambda_24(void *data, int argc, object self_73985, object hashvalue_7363_73348, object len_7364_73349) { closureN_type c_731410; object e_731473 [4]; c_731410.hdr.mark = gc_color_red; c_731410.hdr.grayed = 0; c_731410.tag = closureN_tag; c_731410.fn = (function_type)__lambda_213; c_731410.num_args = 1; c_731410.num_elements = 4; c_731410.elements = (object *)e_731473; c_731410.elements[0] = ((closureN)self_73985)->elements[0]; c_731410.elements[1] = ((closureN)self_73985)->elements[1]; c_731410.elements[2] = len_7364_73349; c_731410.elements[3] = ((closureN)self_73985)->elements[2]; pair_type local_731476; return_direct_with_clo1(data,(closure)&c_731410,__lambda_213, set_cell_as_expr(&local_731476, hashvalue_7363_73348));; } static void __lambda_213(void *data, int argc, object self_73986, object hashvalue_7363_73348) { closureN_type c_731412; object e_731472 [5]; c_731412.hdr.mark = gc_color_red; c_731412.hdr.grayed = 0; c_731412.tag = closureN_tag; c_731412.fn = (function_type)__lambda_25; c_731412.num_args = 1; c_731412.num_elements = 5; c_731412.elements = (object *)e_731472; c_731412.elements[0] = ((closureN)self_73986)->elements[0]; c_731412.elements[1] = hashvalue_7363_73348; c_731412.elements[2] = ((closureN)self_73986)->elements[1]; c_731412.elements[3] = ((closureN)self_73986)->elements[2]; c_731412.elements[4] = ((closureN)self_73986)->elements[3]; return_direct_with_clo1(data,(closure)&c_731412,__lambda_25, boolean_f);; } static void __lambda_25(void *data, int argc, object self_73987, object lp_7365_7369_73351) { closureN_type c_731414; object e_731468 [5]; c_731414.hdr.mark = gc_color_red; c_731414.hdr.grayed = 0; c_731414.tag = closureN_tag; c_731414.fn = (function_type)__lambda_212; c_731414.num_args = 1; c_731414.num_elements = 5; c_731414.elements = (object *)e_731468; c_731414.elements[0] = ((closureN)self_73987)->elements[0]; c_731414.elements[1] = ((closureN)self_73987)->elements[1]; c_731414.elements[2] = ((closureN)self_73987)->elements[2]; c_731414.elements[3] = ((closureN)self_73987)->elements[3]; c_731414.elements[4] = ((closureN)self_73987)->elements[4]; pair_type local_731471; return_direct_with_clo1(data,(closure)&c_731414,__lambda_212, set_cell_as_expr(&local_731471, lp_7365_7369_73351));; } static void __lambda_212(void *data, int argc, object self_73988, object lp_7365_7369_73351) { closureN_type c_731422; object e_731467 [5]; c_731422.hdr.mark = gc_color_red; c_731422.hdr.grayed = 0; c_731422.tag = closureN_tag; c_731422.fn = (function_type)__lambda_26; c_731422.num_args = 1; c_731422.num_elements = 5; c_731422.elements = (object *)e_731467; c_731422.elements[0] = ((closureN)self_73988)->elements[0]; c_731422.elements[1] = ((closureN)self_73988)->elements[1]; c_731422.elements[2] = ((closureN)self_73988)->elements[3]; c_731422.elements[3] = lp_7365_7369_73351; c_731422.elements[4] = ((closureN)self_73988)->elements[4]; Cyc_set_cell(data, lp_7365_7369_73351, &c_731422); return_closcall2(data, car(lp_7365_7369_73351), ((closureN)self_73988)->elements[2], obj_int2obj(0));;; } static void __lambda_26(void *data, int argc, object self_73989, object k_73566, object index_7370_73352) { if( (boolean_f != Cyc_num_fast_gte_op(data, index_7370_73352, ((closureN)self_73989)->elements[2])) ){ return_closcall3(data, __glo_modulo_scheme_base, k_73566, car(((closureN)self_73989)->elements[1]), ((closureN)self_73989)->elements[0]); } else { closureN_type c_731432; object e_731460 [5]; c_731432.hdr.mark = gc_color_red; c_731432.hdr.grayed = 0; c_731432.tag = closureN_tag; c_731432.fn = (function_type)__lambda_27; c_731432.num_args = 1; c_731432.num_elements = 5; c_731432.elements = (object *)e_731460; c_731432.elements[0] = ((closureN)self_73989)->elements[1]; c_731432.elements[1] = index_7370_73352; c_731432.elements[2] = k_73566; c_731432.elements[3] = ((closureN)self_73989)->elements[3]; c_731432.elements[4] = ((closureN)self_73989)->elements[4]; complex_num_type local_731463; return_direct_with_clo1(data,(closure)&c_731432,__lambda_27, Cyc_fast_mul(data,&local_731463, obj_int2obj(257), car(((closureN)self_73989)->elements[1])));} ;; } static void __lambda_27(void *data, int argc, object self_73990, object r_73572) { closureN_type c_731434; object e_731455 [5]; c_731434.hdr.mark = gc_color_red; c_731434.hdr.grayed = 0; c_731434.tag = closureN_tag; c_731434.fn = (function_type)__lambda_28; c_731434.num_args = 1; c_731434.num_elements = 5; c_731434.elements = (object *)e_731455; c_731434.elements[0] = ((closureN)self_73990)->elements[0]; c_731434.elements[1] = ((closureN)self_73990)->elements[1]; c_731434.elements[2] = ((closureN)self_73990)->elements[2]; c_731434.elements[3] = ((closureN)self_73990)->elements[3]; c_731434.elements[4] = r_73572; return_closcall2(data, __glo_hash_srfi_69, &c_731434, Cyc_vector_ref(data, ((closureN)self_73990)->elements[4], ((closureN)self_73990)->elements[1]));; } static void __lambda_28(void *data, int argc, object self_73991, object r_73573) { closureN_type c_731436; object e_731450 [4]; c_731436.hdr.mark = gc_color_red; c_731436.hdr.grayed = 0; c_731436.tag = closureN_tag; c_731436.fn = (function_type)__lambda_29; c_731436.num_args = 1; c_731436.num_elements = 4; c_731436.elements = (object *)e_731450; c_731436.elements[0] = ((closureN)self_73991)->elements[0]; c_731436.elements[1] = ((closureN)self_73991)->elements[1]; c_731436.elements[2] = ((closureN)self_73991)->elements[2]; c_731436.elements[3] = ((closureN)self_73991)->elements[3]; complex_num_type local_731453; return_closcall3(data, __glo_modulo_scheme_base, &c_731436, Cyc_fast_sum(data,&local_731453, ((closureN)self_73991)->elements[4], r_73573), __glo__85default_91bound_85_srfi_69);; } static void __lambda_29(void *data, int argc, object self_73992, object r_73570) { Cyc_set_cell(data, ((closureN)self_73992)->elements[0], r_73570); complex_num_type local_731445; return_closcall2(data, car(((closureN)self_73992)->elements[3]), ((closureN)self_73992)->elements[2], Cyc_fast_sum(data,&local_731445, ((closureN)self_73992)->elements[1], obj_int2obj(1)));;; } static void __lambda_21(void *data, int argc, closure _,object k_73555, object obj_7357_73342, object maybe_91bound_7358_73343_raw, ...) { load_varargs(maybe_91bound_7358_73343, maybe_91bound_7358_73343_raw, argc - 2); object r_73556; Cyc_st_add(data, "srfi/69.sld:hash-by-identity"); if( (boolean_f != Cyc_is_null(maybe_91bound_7358_73343)) ){ r_73556 = __glo__85default_91bound_85_srfi_69; } else { r_73556 = Cyc_car(data, maybe_91bound_7358_73343);} ; closureN_type c_731399; object e_731402 [1]; c_731399.hdr.mark = gc_color_red; c_731399.hdr.grayed = 0; c_731399.tag = closureN_tag; c_731399.fn = (function_type)__lambda_22; c_731399.num_args = 2; c_731399.num_elements = 1; c_731399.elements = (object *)e_731402; c_731399.elements[0] = k_73555; complex_num_type local_731405; return_direct_with_clo2(data,(closure)&c_731399,__lambda_22, r_73556, ((inline_function_type) ((closure)__glo_symbol_91hash_191_191inline_191_191_srfi_69)->fn)(data,&local_731405, obj_7357_73342));; } static void __lambda_22(void *data, int argc, object self_73984, object bound_7359_73344, object mem_91loc_7360_73345) { return_closcall3(data, __glo_modulo_scheme_base, ((closureN)self_73984)->elements[0], mem_91loc_7360_73345, bound_7359_73344);; } static void __lambda_11(void *data, int argc, closure _,object k_73519, object obj_7319_73339, object maybe_91bound_7320_73340_raw, ...) { load_varargs(maybe_91bound_7320_73340, maybe_91bound_7320_73340_raw, argc - 2); object bound_7321_73341; Cyc_st_add(data, "srfi/69.sld:hash"); if( (boolean_f != Cyc_is_null(maybe_91bound_7320_73340)) ){ bound_7321_73341 = __glo__85default_91bound_85_srfi_69; } else { bound_7321_73341 = Cyc_car(data, maybe_91bound_7320_73340);} ; if( (boolean_f != Cyc_is_integer(obj_7319_73339)) ){ return_closcall3(data, __glo_modulo_scheme_base, k_73519, obj_7319_73339, bound_7321_73341); } else { if( (boolean_f != Cyc_is_string(obj_7319_73339)) ){ return_closcall3(data, __glo_string_91hash_srfi_69, k_73519, obj_7319_73339, bound_7321_73341); } else { if( (boolean_f != Cyc_is_symbol(obj_7319_73339)) ){ complex_num_type local_731270; return_closcall3(data, __glo_modulo_scheme_base, k_73519, ((inline_function_type) ((closure)__glo_symbol_91hash_191_191inline_191_191_srfi_69)->fn)(data,&local_731270, obj_7319_73339), bound_7321_73341); } else { closureN_type c_731272; object e_731285 [1]; c_731272.hdr.mark = gc_color_red; c_731272.hdr.grayed = 0; c_731272.tag = closureN_tag; c_731272.fn = (function_type)__lambda_12; c_731272.num_args = 0; c_731272.num_elements = 1; c_731272.elements = (object *)e_731285; c_731272.elements[0] = obj_7319_73339; closureN_type c_731286; object e_731389 [3]; c_731286.hdr.mark = gc_color_red; c_731286.hdr.grayed = 0; c_731286.tag = closureN_tag; c_731286.fn = (function_type)__lambda_13; c_731286.num_args = 1; c_731286.num_elements = 3; c_731286.elements = (object *)e_731389; c_731286.elements[0] = bound_7321_73341; c_731286.elements[1] = k_73519; c_731286.elements[2] = obj_7319_73339; return_direct_with_clo1(data,(closure)&c_731272,__lambda_12, &c_731286);} ;} ;} ;; } static void __lambda_13(void *data, int argc, object self_73975, object r_73525) { if( (boolean_f != r_73525) ){ complex_num_type local_731291; complex_num_type local_731294; complex_num_type local_731298; return_closcall3(data, __glo_modulo_scheme_base, ((closureN)self_73975)->elements[1], Cyc_fast_sum(data,&local_731291, ((inline_function_type) ((closure)__glo_numerator_191_191inline_191_191_scheme_base)->fn)(data,&local_731294, ((closureN)self_73975)->elements[2]), ((inline_function_type) ((closure)__glo_denominator_191_191inline_191_191_scheme_base)->fn)(data,&local_731298, ((closureN)self_73975)->elements[2])), ((closureN)self_73975)->elements[0]); } else { if( (boolean_f != Cyc_is_number(((closureN)self_73975)->elements[2])) ){ closureN_type c_731305; object e_731329 [3]; c_731305.hdr.mark = gc_color_red; c_731305.hdr.grayed = 0; c_731305.tag = closureN_tag; c_731305.fn = (function_type)__lambda_14; c_731305.num_args = 1; c_731305.num_elements = 3; c_731305.elements = (object *)e_731329; c_731305.elements[0] = ((closureN)self_73975)->elements[0]; c_731305.elements[1] = ((closureN)self_73975)->elements[1]; c_731305.elements[2] = ((closureN)self_73975)->elements[2]; return_closcall2(data, __glo__75real_91part_srfi_69, &c_731305, ((closureN)self_73975)->elements[2]); } else { if( (boolean_f != Cyc_is_char(((closureN)self_73975)->elements[2])) ){ return_closcall3(data, __glo_modulo_scheme_base, ((closureN)self_73975)->elements[1], Cyc_char2integer(((closureN)self_73975)->elements[2]), ((closureN)self_73975)->elements[0]); } else { if( (boolean_f != Cyc_is_vector(((closureN)self_73975)->elements[2])) ){ return_closcall3(data, __glo_vector_91hash_srfi_69, ((closureN)self_73975)->elements[1], ((closureN)self_73975)->elements[2], ((closureN)self_73975)->elements[0]); } else { if( (boolean_f != Cyc_is_pair(((closureN)self_73975)->elements[2])) ){ closureN_type c_731351; object e_731368 [3]; c_731351.hdr.mark = gc_color_red; c_731351.hdr.grayed = 0; c_731351.tag = closureN_tag; c_731351.fn = (function_type)__lambda_19; c_731351.num_args = 1; c_731351.num_elements = 3; c_731351.elements = (object *)e_731368; c_731351.elements[0] = ((closureN)self_73975)->elements[0]; c_731351.elements[1] = ((closureN)self_73975)->elements[1]; c_731351.elements[2] = ((closureN)self_73975)->elements[2]; return_closcall2(data, __glo_hash_srfi_69, &c_731351, Cyc_car(data, ((closureN)self_73975)->elements[2])); } else { if( (boolean_f != Cyc_is_null(((closureN)self_73975)->elements[2])) ){ return_closcall1(data, ((closureN)self_73975)->elements[1], obj_int2obj(0)); } else { if( (boolean_f != ((closureN)self_73975)->elements[2]) ){ if( (boolean_f != Cyc_is_procedure(data, ((closureN)self_73975)->elements[2])) ){ make_utf8_string_with_len(c_731383, "hash: procedures cannot be hashed", 33, 33); return_closcall3(data, __glo_error_scheme_base, ((closureN)self_73975)->elements[1], &c_731383, ((closureN)self_73975)->elements[2]); } else { return_closcall1(data, ((closureN)self_73975)->elements[1], obj_int2obj(1));} ; } else { return_closcall1(data, ((closureN)self_73975)->elements[1], obj_int2obj(0));} ;} ;} ;} ;} ;} ;} ;; } static void __lambda_19(void *data, int argc, object self_73981, object r_73541) { closureN_type c_731353; object e_731364 [3]; c_731353.hdr.mark = gc_color_red; c_731353.hdr.grayed = 0; c_731353.tag = closureN_tag; c_731353.fn = (function_type)__lambda_20; c_731353.num_args = 1; c_731353.num_elements = 3; c_731353.elements = (object *)e_731364; c_731353.elements[0] = ((closureN)self_73981)->elements[0]; c_731353.elements[1] = ((closureN)self_73981)->elements[1]; c_731353.elements[2] = r_73541; return_closcall2(data, __glo_hash_srfi_69, &c_731353, Cyc_cdr(data, ((closureN)self_73981)->elements[2]));; } static void __lambda_20(void *data, int argc, object self_73982, object r_73543) { complex_num_type local_731358; complex_num_type local_731362; return_closcall3(data, __glo_modulo_scheme_base, ((closureN)self_73982)->elements[1], Cyc_fast_sum(data,&local_731358, ((closureN)self_73982)->elements[2], Cyc_fast_mul(data,&local_731362, obj_int2obj(3), r_73543)), ((closureN)self_73982)->elements[0]);; } static void __lambda_14(void *data, int argc, object self_73976, object r_73535) { closureN_type c_731307; object e_731328 [3]; c_731307.hdr.mark = gc_color_red; c_731307.hdr.grayed = 0; c_731307.tag = closureN_tag; c_731307.fn = (function_type)__lambda_15; c_731307.num_args = 1; c_731307.num_elements = 3; c_731307.elements = (object *)e_731328; c_731307.elements[0] = ((closureN)self_73976)->elements[0]; c_731307.elements[1] = ((closureN)self_73976)->elements[1]; c_731307.elements[2] = ((closureN)self_73976)->elements[2]; return_closcall2(data, __glo_hash_srfi_69, &c_731307, r_73535);; } static void __lambda_15(void *data, int argc, object self_73977, object r_73531) { closureN_type c_731309; object e_731326 [3]; c_731309.hdr.mark = gc_color_red; c_731309.hdr.grayed = 0; c_731309.tag = closureN_tag; c_731309.fn = (function_type)__lambda_16; c_731309.num_args = 1; c_731309.num_elements = 3; c_731309.elements = (object *)e_731326; c_731309.elements[0] = ((closureN)self_73977)->elements[0]; c_731309.elements[1] = ((closureN)self_73977)->elements[1]; c_731309.elements[2] = r_73531; return_closcall2(data, __glo__75imag_91part_srfi_69, &c_731309, ((closureN)self_73977)->elements[2]);; } static void __lambda_16(void *data, int argc, object self_73978, object r_73534) { closureN_type c_731311; object e_731325 [3]; c_731311.hdr.mark = gc_color_red; c_731311.hdr.grayed = 0; c_731311.tag = closureN_tag; c_731311.fn = (function_type)__lambda_17; c_731311.num_args = 1; c_731311.num_elements = 3; c_731311.elements = (object *)e_731325; c_731311.elements[0] = ((closureN)self_73978)->elements[0]; c_731311.elements[1] = ((closureN)self_73978)->elements[1]; c_731311.elements[2] = ((closureN)self_73978)->elements[2]; return_closcall2(data, __glo_hash_srfi_69, &c_731311, r_73534);; } static void __lambda_17(void *data, int argc, object self_73979, object r_73533) { closureN_type c_731313; object e_731321 [3]; c_731313.hdr.mark = gc_color_red; c_731313.hdr.grayed = 0; c_731313.tag = closureN_tag; c_731313.fn = (function_type)__lambda_18; c_731313.num_args = 1; c_731313.num_elements = 3; c_731313.elements = (object *)e_731321; c_731313.elements[0] = ((closureN)self_73979)->elements[0]; c_731313.elements[1] = ((closureN)self_73979)->elements[1]; c_731313.elements[2] = ((closureN)self_73979)->elements[2]; complex_num_type local_731324; return_direct_with_clo1(data,(closure)&c_731313,__lambda_18, Cyc_fast_mul(data,&local_731324, obj_int2obj(3), r_73533));; } static void __lambda_18(void *data, int argc, object self_73980, object r_73532) { complex_num_type local_731318; return_closcall3(data, __glo_modulo_scheme_base, ((closureN)self_73980)->elements[1], Cyc_fast_sum(data,&local_731318, ((closureN)self_73980)->elements[2], r_73532), ((closureN)self_73980)->elements[0]);; } static void __lambda_12(void *data, int argc, object self_73983, object k_73548) { if( (boolean_f != Cyc_is_real(((closureN)self_73983)->elements[0])) ){ complex_num_type local_731279; complex_num_type local_731282; return_direct_with_clo1(data, k_73548,__lambda_13, ((inline_function_type) ((closure)__glo_not_191_191inline_191_191_scheme_base)->fn)(data,&local_731279, ((inline_function_type) ((closure)__glo_complex_127_191_191inline_191_191_scheme_base)->fn)(data,&local_731282, ((closureN)self_73983)->elements[0]))); } else { return_direct_with_clo1(data, k_73548,__lambda_13, boolean_f);} ;; } static void __lambda_221(void *data, int argc, closure _, object k, object z) { if (boolean_t == Cyc_is_complex(z)) { make_double(d, cimag(complex_num_value(z))); return_closcall1(data, k, &d); } else { return_closcall1(data, k, z); } } static void __lambda_220(void *data, int argc, closure _, object k, object z) { if (boolean_t == Cyc_is_complex(z)) { make_double(d, creal(complex_num_value(z))); return_closcall1(data, k, &d); } else { return_closcall1(data, k, z); } } static object __lambda_219(void *data, object ptr, object sym) { return obj_int2obj(((long)sym) & 0x7FFFFFFF); } static void __lambda_218(void *data, int argc, closure _, object k, object sym) { return_closcall1(data, k, obj_int2obj(((long)sym) & 0x7FFFFFFF)); } static void __lambda_10(void *data, int argc, closure _,object k_73513, object s_7316_73336, object maybe_91bound_7317_73337_raw, ...) { load_varargs(maybe_91bound_7317_73337, maybe_91bound_7317_73337_raw, argc - 2); object bound_7318_73338; Cyc_st_add(data, "srfi/69.sld:string-ci-hash"); if( (boolean_f != Cyc_is_null(maybe_91bound_7317_73337)) ){ bound_7318_73338 = __glo__85default_91bound_85_srfi_69; } else { bound_7318_73338 = Cyc_car(data, maybe_91bound_7317_73337);} ;return_closcall4(data, __glo__75string_91hash_srfi_69, k_73513, s_7316_73336, __glo_char_91downcase_scheme__char, bound_7318_73338);; } static void __lambda_8(void *data, int argc, closure _,object k_73505, object s_7312_73332, object maybe_91bound_7313_73333_raw, ...) { load_varargs(maybe_91bound_7313_73333, maybe_91bound_7313_73333_raw, argc - 2); object bound_7314_73334; Cyc_st_add(data, "srfi/69.sld:string-hash"); if( (boolean_f != Cyc_is_null(maybe_91bound_7313_73333)) ){ bound_7314_73334 = __glo__85default_91bound_85_srfi_69; } else { bound_7314_73334 = Cyc_car(data, maybe_91bound_7313_73333);} ; mclosure0(c_731236, (function_type)__lambda_9);c_731236.num_args = 1; return_closcall4(data, __glo__75string_91hash_srfi_69, k_73505, s_7312_73332, &c_731236, bound_7314_73334);; } static void __lambda_9(void *data, int argc, object self_73974, object k_73508, object x_7315_73335) { return_closcall1(data, k_73508, x_7315_73335);; } static void __lambda_1(void *data, int argc, closure _,object k_73489, object s_731_73324, object ch_91conv_732_73325, object bound_733_73326) { Cyc_st_add(data, "srfi/69.sld:%string-hash"); closureN_type c_731152; object e_731224 [4]; c_731152.hdr.mark = gc_color_red; c_731152.hdr.grayed = 0; c_731152.tag = closureN_tag; c_731152.fn = (function_type)__lambda_2; c_731152.num_args = 2; c_731152.num_elements = 4; c_731152.elements = (object *)e_731224; c_731152.elements[0] = bound_733_73326; c_731152.elements[1] = ch_91conv_732_73325; c_731152.elements[2] = k_73489; c_731152.elements[3] = s_731_73324; return_direct_with_clo2(data,(closure)&c_731152,__lambda_2, obj_int2obj(31), Cyc_string_length(data, s_731_73324));; } static void __lambda_2(void *data, int argc, object self_73966, object hash_734_73327, object len_735_73328) { closureN_type c_731154; object e_731220 [5]; c_731154.hdr.mark = gc_color_red; c_731154.hdr.grayed = 0; c_731154.tag = closureN_tag; c_731154.fn = (function_type)__lambda_211; c_731154.num_args = 1; c_731154.num_elements = 5; c_731154.elements = (object *)e_731220; c_731154.elements[0] = ((closureN)self_73966)->elements[0]; c_731154.elements[1] = ((closureN)self_73966)->elements[1]; c_731154.elements[2] = ((closureN)self_73966)->elements[2]; c_731154.elements[3] = len_735_73328; c_731154.elements[4] = ((closureN)self_73966)->elements[3]; pair_type local_731223; return_direct_with_clo1(data,(closure)&c_731154,__lambda_211, set_cell_as_expr(&local_731223, hash_734_73327));; } static void __lambda_211(void *data, int argc, object self_73967, object hash_734_73327) { closureN_type c_731156; object e_731219 [6]; c_731156.hdr.mark = gc_color_red; c_731156.hdr.grayed = 0; c_731156.tag = closureN_tag; c_731156.fn = (function_type)__lambda_3; c_731156.num_args = 1; c_731156.num_elements = 6; c_731156.elements = (object *)e_731219; c_731156.elements[0] = ((closureN)self_73967)->elements[0]; c_731156.elements[1] = ((closureN)self_73967)->elements[1]; c_731156.elements[2] = hash_734_73327; c_731156.elements[3] = ((closureN)self_73967)->elements[2]; c_731156.elements[4] = ((closureN)self_73967)->elements[3]; c_731156.elements[5] = ((closureN)self_73967)->elements[4]; return_direct_with_clo1(data,(closure)&c_731156,__lambda_3, boolean_f);; } static void __lambda_3(void *data, int argc, object self_73968, object lp_736_7310_73330) { closureN_type c_731158; object e_731215 [6]; c_731158.hdr.mark = gc_color_red; c_731158.hdr.grayed = 0; c_731158.tag = closureN_tag; c_731158.fn = (function_type)__lambda_210; c_731158.num_args = 1; c_731158.num_elements = 6; c_731158.elements = (object *)e_731215; c_731158.elements[0] = ((closureN)self_73968)->elements[0]; c_731158.elements[1] = ((closureN)self_73968)->elements[1]; c_731158.elements[2] = ((closureN)self_73968)->elements[2]; c_731158.elements[3] = ((closureN)self_73968)->elements[3]; c_731158.elements[4] = ((closureN)self_73968)->elements[4]; c_731158.elements[5] = ((closureN)self_73968)->elements[5]; pair_type local_731218; return_direct_with_clo1(data,(closure)&c_731158,__lambda_210, set_cell_as_expr(&local_731218, lp_736_7310_73330));; } static void __lambda_210(void *data, int argc, object self_73969, object lp_736_7310_73330) { closureN_type c_731166; object e_731214 [6]; c_731166.hdr.mark = gc_color_red; c_731166.hdr.grayed = 0; c_731166.tag = closureN_tag; c_731166.fn = (function_type)__lambda_4; c_731166.num_args = 1; c_731166.num_elements = 6; c_731166.elements = (object *)e_731214; c_731166.elements[0] = ((closureN)self_73969)->elements[0]; c_731166.elements[1] = ((closureN)self_73969)->elements[1]; c_731166.elements[2] = ((closureN)self_73969)->elements[2]; c_731166.elements[3] = ((closureN)self_73969)->elements[4]; c_731166.elements[4] = lp_736_7310_73330; c_731166.elements[5] = ((closureN)self_73969)->elements[5]; Cyc_set_cell(data, lp_736_7310_73330, &c_731166); return_closcall2(data, car(lp_736_7310_73330), ((closureN)self_73969)->elements[3], obj_int2obj(0));;; } static void __lambda_4(void *data, int argc, object self_73970, object k_73493, object index_7311_73331) { if( (boolean_f != Cyc_num_fast_gte_op(data, index_7311_73331, ((closureN)self_73970)->elements[3])) ){ return_closcall3(data, __glo_modulo_scheme_base, k_73493, car(((closureN)self_73970)->elements[2]), ((closureN)self_73970)->elements[0]); } else { closureN_type c_731176; object e_731207 [6]; c_731176.hdr.mark = gc_color_red; c_731176.hdr.grayed = 0; c_731176.tag = closureN_tag; c_731176.fn = (function_type)__lambda_5; c_731176.num_args = 1; c_731176.num_elements = 6; c_731176.elements = (object *)e_731207; c_731176.elements[0] = ((closureN)self_73970)->elements[1]; c_731176.elements[1] = ((closureN)self_73970)->elements[2]; c_731176.elements[2] = index_7311_73331; c_731176.elements[3] = k_73493; c_731176.elements[4] = ((closureN)self_73970)->elements[4]; c_731176.elements[5] = ((closureN)self_73970)->elements[5]; complex_num_type local_731210; return_direct_with_clo1(data,(closure)&c_731176,__lambda_5, Cyc_fast_mul(data,&local_731210, obj_int2obj(37), car(((closureN)self_73970)->elements[2])));} ;; } static void __lambda_5(void *data, int argc, object self_73971, object r_73499) { closureN_type c_731179; object e_731202 [5]; c_731179.hdr.mark = gc_color_red; c_731179.hdr.grayed = 0; c_731179.tag = closureN_tag; c_731179.fn = (function_type)__lambda_6; c_731179.num_args = 1; c_731179.num_elements = 5; c_731179.elements = (object *)e_731202; c_731179.elements[0] = ((closureN)self_73971)->elements[1]; c_731179.elements[1] = ((closureN)self_73971)->elements[2]; c_731179.elements[2] = ((closureN)self_73971)->elements[3]; c_731179.elements[3] = ((closureN)self_73971)->elements[4]; c_731179.elements[4] = r_73499; return_closcall2(data, ((closureN)self_73971)->elements[0], &c_731179, Cyc_string_ref(data, ((closureN)self_73971)->elements[5], ((closureN)self_73971)->elements[2]));; } static void __lambda_6(void *data, int argc, object self_73972, object r_73501) { closureN_type c_731181; object e_731195 [4]; c_731181.hdr.mark = gc_color_red; c_731181.hdr.grayed = 0; c_731181.tag = closureN_tag; c_731181.fn = (function_type)__lambda_7; c_731181.num_args = 1; c_731181.num_elements = 4; c_731181.elements = (object *)e_731195; c_731181.elements[0] = ((closureN)self_73972)->elements[0]; c_731181.elements[1] = ((closureN)self_73972)->elements[1]; c_731181.elements[2] = ((closureN)self_73972)->elements[2]; c_731181.elements[3] = ((closureN)self_73972)->elements[3]; complex_num_type local_731198; return_closcall3(data, __glo_modulo_scheme_base, &c_731181, Cyc_fast_sum(data,&local_731198, ((closureN)self_73972)->elements[4], Cyc_char2integer(r_73501)), __glo__85default_91bound_85_srfi_69);; } static void __lambda_7(void *data, int argc, object self_73973, object r_73497) { Cyc_set_cell(data, ((closureN)self_73973)->elements[0], r_73497); complex_num_type local_731190; return_closcall2(data, car(((closureN)self_73973)->elements[3]), ((closureN)self_73973)->elements[2], Cyc_fast_sum(data,&local_731190, ((closureN)self_73973)->elements[1], obj_int2obj(1)));;; } void c_srfi69_inlinable_lambdas(void *data, int argc, closure _, object cont){ make_pair(pair_732588, find_or_add_symbol("symbol-hash"), find_or_add_symbol("symbol-hash__inline__")); make_pair(c_732589, &pair_732588, NULL); (((closure)cont)->fn)(data, 1, cont, &c_732589); } void c_srfi69_entry_pt_first_lambda(data, argc, cont,value) void *data; int argc; closure cont; object value;{ Cyc_set_globals_changed((gc_thread_data *)data); quote_hash = find_or_add_symbol("hash"); quote_compare = find_or_add_symbol("compare"); quote_associate = find_or_add_symbol("associate"); quote_size = find_or_add_symbol("size"); quote_entries = find_or_add_symbol("entries"); quote_record_91marker = find_or_add_symbol("record-marker"); add_global((object *) &__glo_lib_91init_117srfi69_srfi_69); add_global((object *) &__glo_Cyc_91memoize_srfi_69); add_global((object *) &__glo_hash_91table_91values_srfi_69); add_global((object *) &__glo_hash_91table_91keys_srfi_69); add_global((object *) &__glo_hash_91table_91merge_67_srfi_69); add_global((object *) &__glo_hash_91table_91copy_srfi_69); add_global((object *) &__glo_hash_91table_91_125alist_srfi_69); add_global((object *) &__glo_alist_91_125hash_91table_srfi_69); add_global((object *) &__glo_hash_91table_91fold_srfi_69); add_global((object *) &__glo_hash_91table_91walk_srfi_69); add_global((object *) &__glo_hash_91table_91exists_127_srfi_69); add_global((object *) &__glo_hash_91table_91delete_67_srfi_69); add_global((object *) &__glo_hash_91table_91update_67_95default_srfi_69); add_global((object *) &__glo_hash_91table_91update_67_srfi_69); add_global((object *) &__glo_hash_91table_91set_67_srfi_69); add_global((object *) &__glo_hash_91table_91ref_95default_srfi_69); add_global((object *) &__glo_hash_91table_91ref_srfi_69); add_global((object *) &__glo__75hash_91table_91maybe_91resize_67_srfi_69); add_global((object *) &__glo__75hash_91table_91walk_srfi_69); add_global((object *) &__glo__75hash_91table_91delete_67_srfi_69); add_global((object *) &__glo__75hash_91table_91add_67_srfi_69); add_global((object *) &__glo__75hash_91table_91find_srfi_69); add_global((object *) &__glo__75hash_91table_91hash_srfi_69); add_global((object *) &__glo_make_91integer_91hash_91table_srfi_69); add_global((object *) &__glo_make_91string_91ci_91hash_91table_srfi_69); add_global((object *) &__glo_make_91string_91hash_91table_srfi_69); add_global((object *) &__glo_make_91symbol_91hash_91table_srfi_69); add_global((object *) &__glo_make_91hash_91table_91maker_srfi_69); add_global((object *) &__glo_make_91hash_91table_srfi_69); add_global((object *) &__glo_appropriate_91hash_91function_91for_srfi_69); add_global((object *) &__glo__85default_91table_91size_85_srfi_69); add_global((object *) &__glo__75make_91hash_91table_srfi_69); add_global((object *) &__glo_hash_91table_91set_91entries_67_srfi_69); add_global((object *) &__glo_hash_91table_91set_91size_67_srfi_69); add_global((object *) &__glo_hash_91table_91entries_srfi_69); add_global((object *) &__glo_hash_91table_91association_91function_srfi_69); add_global((object *) &__glo_hash_91table_91equivalence_91function_srfi_69); add_global((object *) &__glo_hash_91table_91hash_91function_srfi_69); add_global((object *) &__glo_hash_91table_91size_srfi_69); add_global((object *) &__glo_hash_91table_127_srfi_69); add_global((object *) &__glo__121srfi_91hash_91table_125_srfi_69); add_global((object *) &__glo__75hash_91node_91value_srfi_69); add_global((object *) &__glo__75hash_91node_91key_srfi_69); add_global((object *) &__glo__75hash_91node_91set_91value_67_srfi_69); add_global((object *) &__glo__75make_91hash_91node_srfi_69); add_global((object *) &__glo_vector_91hash_srfi_69); add_global((object *) &__glo_hash_91by_91identity_srfi_69); add_global((object *) &__glo_hash_srfi_69); add_global((object *) &__glo__75imag_91part_srfi_69); add_global((object *) &__glo__75real_91part_srfi_69); add_global((object *) &__glo_symbol_91hash_srfi_69); add_global((object *) &__glo_symbol_91hash_191_191inline_191_191_srfi_69); add_global((object *) &__glo_string_91ci_91hash_srfi_69); add_global((object *) &__glo_string_91hash_srfi_69); add_global((object *) &__glo__75string_91hash_srfi_69); add_global((object *) &__glo__85default_91bound_85_srfi_69); add_symbol(quote_hash); add_symbol(quote_compare); add_symbol(quote_associate); add_symbol(quote_size); add_symbol(quote_entries); add_symbol(quote_record_91marker); mclosure0(c_732465, (function_type)__lambda_189);c_732465.num_args = 0; __glo_lib_91init_117srfi69_srfi_69 = &c_732465; mclosure0(c_732427, (function_type)__lambda_181);c_732427.num_args = 1; __glo_Cyc_91memoize_srfi_69 = &c_732427; mclosure0(c_732420, (function_type)__lambda_179);c_732420.num_args = 1; __glo_hash_91table_91values_srfi_69 = &c_732420; mclosure0(c_732413, (function_type)__lambda_177);c_732413.num_args = 1; __glo_hash_91table_91keys_srfi_69 = &c_732413; mclosure0(c_732402, (function_type)__lambda_174);c_732402.num_args = 2; __glo_hash_91table_91merge_67_srfi_69 = &c_732402; mclosure0(c_732365, (function_type)__lambda_165);c_732365.num_args = 1; __glo_hash_91table_91copy_srfi_69 = &c_732365; mclosure0(c_732355, (function_type)__lambda_163);c_732355.num_args = 1; __glo_hash_91table_91_125alist_srfi_69 = &c_732355; mclosure0(c_732247, (function_type)__lambda_150);c_732247.num_args = 1; __glo_alist_91_125hash_91table_srfi_69 = &c_732247; mclosure0(c_732217, (function_type)__lambda_146);c_732217.num_args = 3; __glo_hash_91table_91fold_srfi_69 = &c_732217; mclosure0(c_732198, (function_type)__lambda_141);c_732198.num_args = 2; __glo_hash_91table_91walk_srfi_69 = &c_732198; mclosure0(c_732173, (function_type)__lambda_136);c_732173.num_args = 2; __glo_hash_91table_91exists_127_srfi_69 = &c_732173; mclosure0(c_732139, (function_type)__lambda_129);c_732139.num_args = 2; __glo_hash_91table_91delete_67_srfi_69 = &c_732139; mclosure0(c_732133, (function_type)__lambda_127);c_732133.num_args = 4; __glo_hash_91table_91update_67_95default_srfi_69 = &c_732133; mclosure0(c_732056, (function_type)__lambda_112);c_732056.num_args = 3; __glo_hash_91table_91update_67_srfi_69 = &c_732056; mclosure0(c_732002, (function_type)__lambda_101);c_732002.num_args = 3; __glo_hash_91table_91set_67_srfi_69 = &c_732002; mclosure0(c_731996, (function_type)__lambda_99);c_731996.num_args = 3; __glo_hash_91table_91ref_95default_srfi_69 = &c_731996; mclosure0(c_731961, (function_type)__lambda_94);c_731961.num_args = 2; __glo_hash_91table_91ref_srfi_69 = &c_731961; mclosure0(c_731895, (function_type)__lambda_82);c_731895.num_args = 1; __glo__75hash_91table_91maybe_91resize_67_srfi_69 = &c_731895; mclosure0(c_731849, (function_type)__lambda_78);c_731849.num_args = 2; __glo__75hash_91table_91walk_srfi_69 = &c_731849; mclosure0(c_731755, (function_type)__lambda_67);c_731755.num_args = 4; __glo__75hash_91table_91delete_67_srfi_69 = &c_731755; mclosure0(c_731734, (function_type)__lambda_64);c_731734.num_args = 4; __glo__75hash_91table_91add_67_srfi_69 = &c_731734; mclosure0(c_731730, (function_type)__lambda_63);c_731730.num_args = 4; __glo__75hash_91table_91find_srfi_69 = &c_731730; mclosure0(c_731713, (function_type)__lambda_59);c_731713.num_args = 2; __glo__75hash_91table_91hash_srfi_69 = &c_731713; mclosure0(c_731697, (function_type)__lambda_57);c_731697.num_args = 2; __glo_make_91hash_91table_91maker_srfi_69 = &c_731697; mclosure0(c_731522, (function_type)__lambda_36);c_731522.num_args = 0; __glo_make_91hash_91table_srfi_69 = &c_731522; mclosure0(c_731489, (function_type)__lambda_31);c_731489.num_args = 1; __glo_appropriate_91hash_91function_91for_srfi_69 = &c_731489; mclosure0(c_731480, (function_type)__lambda_30);c_731480.num_args = 5; __glo__75make_91hash_91table_srfi_69 = &c_731480; mclosure0(c_731406, (function_type)__lambda_23);c_731406.num_args = 2; __glo_vector_91hash_srfi_69 = &c_731406; mclosure0(c_731390, (function_type)__lambda_21);c_731390.num_args = 1; __glo_hash_91by_91identity_srfi_69 = &c_731390; mclosure0(c_731251, (function_type)__lambda_11);c_731251.num_args = 1; __glo_hash_srfi_69 = &c_731251; mclosure0(c_731250, (function_type)__lambda_221);c_731250.num_args = 1; __glo__75imag_91part_srfi_69 = &c_731250; mclosure0(c_731249, (function_type)__lambda_220);c_731249.num_args = 1; __glo__75real_91part_srfi_69 = &c_731249; mclosure0(c_731248, (function_type)__lambda_218);c_731248.num_args = 1; __glo_symbol_91hash_srfi_69 = &c_731248; mclosure0(c_731247, (function_type)__lambda_219);c_731247.num_args = -1; __glo_symbol_91hash_191_191inline_191_191_srfi_69 = &c_731247; mclosure0(c_731238, (function_type)__lambda_10);c_731238.num_args = 1; __glo_string_91ci_91hash_srfi_69 = &c_731238; mclosure0(c_731227, (function_type)__lambda_8);c_731227.num_args = 1; __glo_string_91hash_srfi_69 = &c_731227; mclosure0(c_731150, (function_type)__lambda_1);c_731150.num_args = 3; __glo__75string_91hash_srfi_69 = &c_731150; __glo_make_91integer_91hash_91table_srfi_69 = boolean_f; __glo_make_91string_91ci_91hash_91table_srfi_69 = boolean_f; __glo_make_91string_91hash_91table_srfi_69 = boolean_f; __glo_make_91symbol_91hash_91table_srfi_69 = boolean_f; __glo__85default_91table_91size_85_srfi_69 = obj_int2obj(64); __glo_hash_91table_91set_91entries_67_srfi_69 = boolean_f; __glo_hash_91table_91set_91size_67_srfi_69 = boolean_f; __glo_hash_91table_91entries_srfi_69 = boolean_f; __glo_hash_91table_91association_91function_srfi_69 = boolean_f; __glo_hash_91table_91equivalence_91function_srfi_69 = boolean_f; __glo_hash_91table_91hash_91function_srfi_69 = boolean_f; __glo_hash_91table_91size_srfi_69 = boolean_f; __glo_hash_91table_127_srfi_69 = boolean_f; __glo__121srfi_91hash_91table_125_srfi_69 = boolean_f; __glo__75hash_91node_91value_srfi_69 = boolean_f; __glo__75hash_91node_91key_srfi_69 = boolean_f; __glo__75hash_91node_91set_91value_67_srfi_69 = boolean_f; __glo__75make_91hash_91node_srfi_69 = boolean_f; __glo__85default_91bound_85_srfi_69 = obj_int2obj(1073741823); mclosure0(clo_732591, c_srfi69_inlinable_lambdas); make_pair(pair_732590, find_or_add_symbol("c_srfi69_inlinable_lambdas"), &clo_732591); make_cvar(cvar_732592, (object *)&__glo_lib_91init_117srfi69_srfi_69);make_pair(pair_732593, find_or_add_symbol("lib-init:srfi69"), &cvar_732592); make_cvar(cvar_732594, (object *)&__glo_Cyc_91memoize_srfi_69);make_pair(pair_732595, find_or_add_symbol("Cyc-memoize"), &cvar_732594); make_cvar(cvar_732596, (object *)&__glo_hash_91table_91values_srfi_69);make_pair(pair_732597, find_or_add_symbol("hash-table-values"), &cvar_732596); make_cvar(cvar_732598, (object *)&__glo_hash_91table_91keys_srfi_69);make_pair(pair_732599, find_or_add_symbol("hash-table-keys"), &cvar_732598); make_cvar(cvar_732600, (object *)&__glo_hash_91table_91merge_67_srfi_69);make_pair(pair_732601, find_or_add_symbol("hash-table-merge!"), &cvar_732600); make_cvar(cvar_732602, (object *)&__glo_hash_91table_91copy_srfi_69);make_pair(pair_732603, find_or_add_symbol("hash-table-copy"), &cvar_732602); make_cvar(cvar_732604, (object *)&__glo_hash_91table_91_125alist_srfi_69);make_pair(pair_732605, find_or_add_symbol("hash-table->alist"), &cvar_732604); make_cvar(cvar_732606, (object *)&__glo_alist_91_125hash_91table_srfi_69);make_pair(pair_732607, find_or_add_symbol("alist->hash-table"), &cvar_732606); make_cvar(cvar_732608, (object *)&__glo_hash_91table_91fold_srfi_69);make_pair(pair_732609, find_or_add_symbol("hash-table-fold"), &cvar_732608); make_cvar(cvar_732610, (object *)&__glo_hash_91table_91walk_srfi_69);make_pair(pair_732611, find_or_add_symbol("hash-table-walk"), &cvar_732610); make_cvar(cvar_732612, (object *)&__glo_hash_91table_91exists_127_srfi_69);make_pair(pair_732613, find_or_add_symbol("hash-table-exists?"), &cvar_732612); make_cvar(cvar_732614, (object *)&__glo_hash_91table_91delete_67_srfi_69);make_pair(pair_732615, find_or_add_symbol("hash-table-delete!"), &cvar_732614); make_cvar(cvar_732616, (object *)&__glo_hash_91table_91update_67_95default_srfi_69);make_pair(pair_732617, find_or_add_symbol("hash-table-update!/default"), &cvar_732616); make_cvar(cvar_732618, (object *)&__glo_hash_91table_91update_67_srfi_69);make_pair(pair_732619, find_or_add_symbol("hash-table-update!"), &cvar_732618); make_cvar(cvar_732620, (object *)&__glo_hash_91table_91set_67_srfi_69);make_pair(pair_732621, find_or_add_symbol("hash-table-set!"), &cvar_732620); make_cvar(cvar_732622, (object *)&__glo_hash_91table_91ref_95default_srfi_69);make_pair(pair_732623, find_or_add_symbol("hash-table-ref/default"), &cvar_732622); make_cvar(cvar_732624, (object *)&__glo_hash_91table_91ref_srfi_69);make_pair(pair_732625, find_or_add_symbol("hash-table-ref"), &cvar_732624); make_cvar(cvar_732626, (object *)&__glo__75hash_91table_91maybe_91resize_67_srfi_69);make_pair(pair_732627, find_or_add_symbol("%hash-table-maybe-resize!"), &cvar_732626); make_cvar(cvar_732628, (object *)&__glo__75hash_91table_91walk_srfi_69);make_pair(pair_732629, find_or_add_symbol("%hash-table-walk"), &cvar_732628); make_cvar(cvar_732630, (object *)&__glo__75hash_91table_91delete_67_srfi_69);make_pair(pair_732631, find_or_add_symbol("%hash-table-delete!"), &cvar_732630); make_cvar(cvar_732632, (object *)&__glo__75hash_91table_91add_67_srfi_69);make_pair(pair_732633, find_or_add_symbol("%hash-table-add!"), &cvar_732632); make_cvar(cvar_732634, (object *)&__glo__75hash_91table_91find_srfi_69);make_pair(pair_732635, find_or_add_symbol("%hash-table-find"), &cvar_732634); make_cvar(cvar_732636, (object *)&__glo__75hash_91table_91hash_srfi_69);make_pair(pair_732637, find_or_add_symbol("%hash-table-hash"), &cvar_732636); make_cvar(cvar_732638, (object *)&__glo_make_91integer_91hash_91table_srfi_69);make_pair(pair_732639, find_or_add_symbol("make-integer-hash-table"), &cvar_732638); make_cvar(cvar_732640, (object *)&__glo_make_91string_91ci_91hash_91table_srfi_69);make_pair(pair_732641, find_or_add_symbol("make-string-ci-hash-table"), &cvar_732640); make_cvar(cvar_732642, (object *)&__glo_make_91string_91hash_91table_srfi_69);make_pair(pair_732643, find_or_add_symbol("make-string-hash-table"), &cvar_732642); make_cvar(cvar_732644, (object *)&__glo_make_91symbol_91hash_91table_srfi_69);make_pair(pair_732645, find_or_add_symbol("make-symbol-hash-table"), &cvar_732644); make_cvar(cvar_732646, (object *)&__glo_make_91hash_91table_91maker_srfi_69);make_pair(pair_732647, find_or_add_symbol("make-hash-table-maker"), &cvar_732646); make_cvar(cvar_732648, (object *)&__glo_make_91hash_91table_srfi_69);make_pair(pair_732649, find_or_add_symbol("make-hash-table"), &cvar_732648); make_cvar(cvar_732650, (object *)&__glo_appropriate_91hash_91function_91for_srfi_69);make_pair(pair_732651, find_or_add_symbol("appropriate-hash-function-for"), &cvar_732650); make_cvar(cvar_732652, (object *)&__glo__85default_91table_91size_85_srfi_69);make_pair(pair_732653, find_or_add_symbol("*default-table-size*"), &cvar_732652); make_cvar(cvar_732654, (object *)&__glo__75make_91hash_91table_srfi_69);make_pair(pair_732655, find_or_add_symbol("%make-hash-table"), &cvar_732654); make_cvar(cvar_732656, (object *)&__glo_hash_91table_91set_91entries_67_srfi_69);make_pair(pair_732657, find_or_add_symbol("hash-table-set-entries!"), &cvar_732656); make_cvar(cvar_732658, (object *)&__glo_hash_91table_91set_91size_67_srfi_69);make_pair(pair_732659, find_or_add_symbol("hash-table-set-size!"), &cvar_732658); make_cvar(cvar_732660, (object *)&__glo_hash_91table_91entries_srfi_69);make_pair(pair_732661, find_or_add_symbol("hash-table-entries"), &cvar_732660); make_cvar(cvar_732662, (object *)&__glo_hash_91table_91association_91function_srfi_69);make_pair(pair_732663, find_or_add_symbol("hash-table-association-function"), &cvar_732662); make_cvar(cvar_732664, (object *)&__glo_hash_91table_91equivalence_91function_srfi_69);make_pair(pair_732665, find_or_add_symbol("hash-table-equivalence-function"), &cvar_732664); make_cvar(cvar_732666, (object *)&__glo_hash_91table_91hash_91function_srfi_69);make_pair(pair_732667, find_or_add_symbol("hash-table-hash-function"), &cvar_732666); make_cvar(cvar_732668, (object *)&__glo_hash_91table_91size_srfi_69);make_pair(pair_732669, find_or_add_symbol("hash-table-size"), &cvar_732668); make_cvar(cvar_732670, (object *)&__glo_hash_91table_127_srfi_69);make_pair(pair_732671, find_or_add_symbol("hash-table?"), &cvar_732670); make_cvar(cvar_732672, (object *)&__glo__121srfi_91hash_91table_125_srfi_69);make_pair(pair_732673, find_or_add_symbol("<srfi-hash-table>"), &cvar_732672); make_cvar(cvar_732674, (object *)&__glo__75hash_91node_91value_srfi_69);make_pair(pair_732675, find_or_add_symbol("%hash-node-value"), &cvar_732674); make_cvar(cvar_732676, (object *)&__glo__75hash_91node_91key_srfi_69);make_pair(pair_732677, find_or_add_symbol("%hash-node-key"), &cvar_732676); make_cvar(cvar_732678, (object *)&__glo__75hash_91node_91set_91value_67_srfi_69);make_pair(pair_732679, find_or_add_symbol("%hash-node-set-value!"), &cvar_732678); make_cvar(cvar_732680, (object *)&__glo__75make_91hash_91node_srfi_69);make_pair(pair_732681, find_or_add_symbol("%make-hash-node"), &cvar_732680); make_cvar(cvar_732682, (object *)&__glo_vector_91hash_srfi_69);make_pair(pair_732683, find_or_add_symbol("vector-hash"), &cvar_732682); make_cvar(cvar_732684, (object *)&__glo_hash_91by_91identity_srfi_69);make_pair(pair_732685, find_or_add_symbol("hash-by-identity"), &cvar_732684); make_cvar(cvar_732686, (object *)&__glo_hash_srfi_69);make_pair(pair_732687, find_or_add_symbol("hash"), &cvar_732686); make_cvar(cvar_732688, (object *)&__glo__75imag_91part_srfi_69);make_pair(pair_732689, find_or_add_symbol("%imag-part"), &cvar_732688); make_cvar(cvar_732690, (object *)&__glo__75real_91part_srfi_69);make_pair(pair_732691, find_or_add_symbol("%real-part"), &cvar_732690); make_cvar(cvar_732692, (object *)&__glo_symbol_91hash_srfi_69);make_pair(pair_732693, find_or_add_symbol("symbol-hash"), &cvar_732692); make_cvar(cvar_732694, (object *)&__glo_symbol_91hash_191_191inline_191_191_srfi_69);make_pair(pair_732695, find_or_add_symbol("symbol-hash__inline__"), &cvar_732694); make_cvar(cvar_732696, (object *)&__glo_string_91ci_91hash_srfi_69);make_pair(pair_732697, find_or_add_symbol("string-ci-hash"), &cvar_732696); make_cvar(cvar_732698, (object *)&__glo_string_91hash_srfi_69);make_pair(pair_732699, find_or_add_symbol("string-hash"), &cvar_732698); make_cvar(cvar_732700, (object *)&__glo__75string_91hash_srfi_69);make_pair(pair_732701, find_or_add_symbol("%string-hash"), &cvar_732700); make_cvar(cvar_732702, (object *)&__glo__85default_91bound_85_srfi_69);make_pair(pair_732703, find_or_add_symbol("*default-bound*"), &cvar_732702); make_pair(c_732760, &pair_732590,Cyc_global_variables); make_pair(c_732759, &pair_732593, &c_732760); make_pair(c_732758, &pair_732595, &c_732759); make_pair(c_732757, &pair_732597, &c_732758); make_pair(c_732756, &pair_732599, &c_732757); make_pair(c_732755, &pair_732601, &c_732756); make_pair(c_732754, &pair_732603, &c_732755); make_pair(c_732753, &pair_732605, &c_732754); make_pair(c_732752, &pair_732607, &c_732753); make_pair(c_732751, &pair_732609, &c_732752); make_pair(c_732750, &pair_732611, &c_732751); make_pair(c_732749, &pair_732613, &c_732750); make_pair(c_732748, &pair_732615, &c_732749); make_pair(c_732747, &pair_732617, &c_732748); make_pair(c_732746, &pair_732619, &c_732747); make_pair(c_732745, &pair_732621, &c_732746); make_pair(c_732744, &pair_732623, &c_732745); make_pair(c_732743, &pair_732625, &c_732744); make_pair(c_732742, &pair_732627, &c_732743); make_pair(c_732741, &pair_732629, &c_732742); make_pair(c_732740, &pair_732631, &c_732741); make_pair(c_732739, &pair_732633, &c_732740); make_pair(c_732738, &pair_732635, &c_732739); make_pair(c_732737, &pair_732637, &c_732738); make_pair(c_732736, &pair_732639, &c_732737); make_pair(c_732735, &pair_732641, &c_732736); make_pair(c_732734, &pair_732643, &c_732735); make_pair(c_732733, &pair_732645, &c_732734); make_pair(c_732732, &pair_732647, &c_732733); make_pair(c_732731, &pair_732649, &c_732732); make_pair(c_732730, &pair_732651, &c_732731); make_pair(c_732729, &pair_732653, &c_732730); make_pair(c_732728, &pair_732655, &c_732729); make_pair(c_732727, &pair_732657, &c_732728); make_pair(c_732726, &pair_732659, &c_732727); make_pair(c_732725, &pair_732661, &c_732726); make_pair(c_732724, &pair_732663, &c_732725); make_pair(c_732723, &pair_732665, &c_732724); make_pair(c_732722, &pair_732667, &c_732723); make_pair(c_732721, &pair_732669, &c_732722); make_pair(c_732720, &pair_732671, &c_732721); make_pair(c_732719, &pair_732673, &c_732720); make_pair(c_732718, &pair_732675, &c_732719); make_pair(c_732717, &pair_732677, &c_732718); make_pair(c_732716, &pair_732679, &c_732717); make_pair(c_732715, &pair_732681, &c_732716); make_pair(c_732714, &pair_732683, &c_732715); make_pair(c_732713, &pair_732685, &c_732714); make_pair(c_732712, &pair_732687, &c_732713); make_pair(c_732711, &pair_732689, &c_732712); make_pair(c_732710, &pair_732691, &c_732711); make_pair(c_732709, &pair_732693, &c_732710); make_pair(c_732708, &pair_732695, &c_732709); make_pair(c_732707, &pair_732697, &c_732708); make_pair(c_732706, &pair_732699, &c_732707); make_pair(c_732705, &pair_732701, &c_732706); make_pair(c_732704, &pair_732703, &c_732705); Cyc_global_variables = &c_732704; cont = ((closure1_type *)cont)->element; (((closure)__glo_lib_91init_117srfi69_srfi_69)->fn)(data, 1, cont, cont); } void c_srfi69_entry_pt(data, argc, cont,value) void *data; int argc; closure cont; object value;{ register_library("srfi_69"); c_srfi69_entry_pt_first_lambda(data, argc, cont,value); }
<reponame>nareshbhatia/http-utils<gh_stars>0 import { Order } from './Order'; export const order1: Order = { id: 'f95244e6-1a1a-51ea-8c9a-0bca651329c6', side: 'buy', secId: 'GRMN', quantity: 9600, executed: 0, type: 'market', status: 'pendingApproval', fundId: 'TFTBM', managerId: 'aretha.franklin', note: '', };
// Newuuid populate buf with unique set of bytes. func Newuuid(buf Uuid) (Uuid, error) { if ln := len(buf); (ln%2) != 0 && ln < 8 { return nil, ErrorUuidInvalidSize } else if _, err := rand.Read([]byte(buf)); err != nil { return nil, err } return buf, nil }
def remove_objects(self, objects, all_versions=True, **kwargs): if not isinstance(objects, (list, set)): objects = [objects] if not objects: print('No objects selected') return override = kwargs.pop('_override', False) if not override: msg = ('Are you sure you want to delete the %s object(s)? (Y/N)' % len(objects)) ans = eval(input(msg)) if not ans[0].lower().startswith('y'): print('Aborting') return ids = defaultdict(list) username = getpass.getuser() attr = 'head_id' if all_versions else 'unique_id' self.get_connection() self.db.begin() try: for obj in objects: if not override and obj.username != username: continue name = self.tablename_lut[obj.__class__] ids[name].append(getattr(obj, attr)) for (tname, trait) in obj.traits().items(): if isinstance(trait, MetList): subname = '%s_%s' % (name, tname) ids[subname].append(getattr(obj, attr)) for (table_name, uids) in ids.items(): if table_name not in self.db: continue query = 'delete from `%s` where %s in ("' query = query % (table_name, attr) query += '" , "'.join(uids) query += '")' self.db.query(query) print(('Removed %s object(s)' % len(objects))) self.db.commit() except Exception as err: rollback_and_log(self.db, err)
<filename>lib/posix/_fork.c<gh_stars>10-100 #include <lib.h> #define fork _fork #include <unistd.h> PUBLIC pid_t fork() { message m; return(_syscall(MM, FORK, &m)); }
def WaitForAccessToken(port=DEFAULT_OAUTH2_PORT): httpd = ClientRedirectServer((LOCALHOST_IP, port), ClientRedirectHandler) httpd.handle_request() if httpd.access_token is None: ErrorExit(httpd.error or OAUTH_DEFAULT_ERROR_MESSAGE) return httpd.access_token
def off_by_m_algorithm2(n, m): positions = allowed_positions(n, m) permutation = [] return _off_by_m_aux_gen(n, m, positions, permutation)
/** * This class is used for web panel declaration that do not have a custom * <code>class</code> attribute in their descriptor, but do have a * <code>location</code> attribute in their resource child element, which * points to a template file on the (plugin's) classpath. * * @see org.maera.plugin.web.descriptors.DefaultWebPanelModuleDescriptor * @since 2.5.0 */ public class ResourceTemplateWebPanel extends AbstractWebPanel { private static final Logger logger = LoggerFactory.getLogger(ResourceTemplateWebPanel.class.getName()); private String resourceFilename; public ResourceTemplateWebPanel(PluginAccessor pluginAccessor) { super(pluginAccessor); } /** * Specifies the name of the template file that is to be rendered. * This file will be loaded from the (plugin's) classpath. * * @param resourceFilename the name of the template file that is to be rendered. * May not be null. */ public void setResourceFilename(String resourceFilename) { this.resourceFilename = Preconditions.checkNotNull(resourceFilename, "resourceFilename"); } public String getHtml(Map<String, Object> context) { try { final StringWriter sink = new StringWriter(); getRenderer().render(resourceFilename, plugin, context, sink); return sink.toString(); } catch (Exception e) { final String message = String.format("Error rendering WebPanel (%s): %s", resourceFilename, e.getMessage()); logger.warn(message, e); return message; } } }
def check_headers(oe_file): num_records = [f.num_records for f in oe_file] sampling_rates = [f.header['sampleRate'] for f in oe_file] buffer_sizes = [f.header['bufferSize'] for f in oe_file] block_sizes = [f.header['blockLength'] for f in oe_file] assert len(set(num_records)) == 1 assert len(set(sampling_rates)) == 1 assert len(set(buffer_sizes)) == 1 assert len(set(block_sizes)) == 1 return num_records[0], sampling_rates[0], buffer_sizes[0], block_sizes[0]
<gh_stars>1-10 // Copyright the Hyperledger Fabric contributors. All rights reserved. // SPDX-License-Identifier: Apache-2.0 package internal import ( "testing" "github.com/stretchr/testify/assert" ) func TestSliceAsCommaSentence(t *testing.T) { slice := []string{"one", "two", "three"} assert.Equal(t, "one, two and three", sliceAsCommaSentence(slice), "should have put commas between slice elements and join last element with and") assert.Equal(t, "one", sliceAsCommaSentence([]string{"one"}), "should handle single item") }
Back in my day, cereal came with prizes. Sometimes the prizes were merely stickers or collector cards, sometimes they were posters, and sometimes, if you were really lucky, you got a toy that could pop your eye right out of your face! Here is a sampling of some of the more beloved cereal box premiums from the 1980s and 1990s. 6 – Shreddies’ Teenage Mutant Ninja Turtle Rings Ninja Turtles at the height of fashion. Shreddies, a Canadian cereal that’s pretty much a vast improvement on Shredded Wheat, came out with Teenage Mutant Ninja Turtle rings in the 1990s. I remember the boxes that advertised the rings inside, I knew I suffered through eating the Shreddies, but I don’t remember ever actually having the rings. This can only mean that my (male) neighbors at the time helped themselves to my cereal prize. Assholes. But I have to wonder about the initial idea behind this—marketing fashion rings to a predominantly male demographic? I guess it worked since the male demographic next door swiped mine. 5 – Kellogg’s DuckTales Figures You too can build your own PVC figurine army by consuming mass quantities of Rice Krispies! These DuckTales figures were pretty sweet and came in boxes of Rice Krispies (and possibly other Kellogg’s cereals) in 1991. I always thought Gizmoduck looked pretty badass and very 90s. Even if you weren’t a DuckTales fan, the opportunity to add additional action (inaction?) figures to your regular line-up was always welcomed. 4 – Cap’n Crunch’s Popper They look safe enough– oh god my eye! The Popper was essentially a giant suction cup. If you turned it inside out and laid it on a table, it would pop up in the air right-side-out again. But no one used it like that. Most kids stuck it on their arm or forehead to achieve a beautifully round bruise. In fact, Quaker put out a recall on the Poppers after receiving reports of 36 injuries, most of them involving bruised or bloodshot eyes. Those were some hardcore kids. 3 – Trix’s Color-Changing Spoons Twenty years later, these go from pink to… pink. Huh. Although a lot of my cereal box premiums met the wrath of my mom who threw everything out, somehow my two Trix Color-Changing Spoons survived and made it to my house all the way from 1991. The spoon starts out pink and turns purple when it hits the milk. My spoons have seen better days and don’t change anymore, but when they did, many fights were had over who got to use the color-changing spoons the morning after sleepovers. 2 – Cap’n Crunch’s Squirter Twenty-two years later… and this toy is just dirty. I ate a lot of Cap’n Crunch as a kid so that’s why you’re seeing another Cap’n Crunch prize listed on here. Or maybe I ate Cap’n Crunch solely because of the prizes. Or maybe I just liked it when my gums bled profusely. At any rate, among my Cap’n Crunch premiums was this water squirting toy from 1989. Fill ‘er up and squirt water (or leftover cereal milk) from the top of the Cap’n’s hat. 1 – Alphabits’ Animaniacs Pogs I think my mom still buys Alphabits. My poor dad… Growing up, I was all about Pogs. I didn’t care what was on it, if it was a Pog, I had to make it mine. Enter Alphabits cereal and the free Animaniacs Pogs housed inside the box. In 1995, I convinced my mom that I loved Alphabits cereal. I wanted the whole set of those Animaniacs Pogs and I was going to get them. I choked down box after box until I finally had the whole set. Life was pretty great, except that my mom was still convinced that I loved Alphabits cereal and continued to buy it. In large quantities. I suffered many years of eating that crappy cereal to pay for my mistakes. Did we miss your favorite cereal box premium? Have a story about fighting over who got the prize inside the cereal box in your household? Leave us a comment!
Jim McElwain didn’t exactly give away the plans to his new operation at Florida, but his first order of business in the recruiting world has made it pretty clear: He has got to get things going on offense. OK, that’s painfully obvious in Gainesville, and McElwain has wasted no time on the recruiting front getting in front of the right people and formulating his plan for the immediate future. It sounds like losing four-star quarterback commit Sheriron Jones, who was never even contacted by McElwain, and three-star offensive lineman George Brown Jr. a few days ago hasn’t fazed McElwain or derailed his plan in the least bit. Recruiting seemed to be the first, second and third thing on McElwain’s mind when he was officially introduced as the Gators’ new coach, and that’s very, very smart for the man picked to right one of the country’s premier programs. “We'll hit the road next week, get to as many places as humanly possible from the recruiting standpoint because it's one of those things recruit daily or die now,” McElwain said at his press conference Saturday. “We've got to make sure we secure a great class.” He gets it. He has some southeastern football blood pumping through those veins, so he understands that if you get too far behind when it comes to wrangling talent in this part of the country -- no matter what school logo is on your shirt -- you’re toast. Before he could even get on the road and start recruiting face-to-face, he had ESPN 300 offensive lineman commit Tyler Jordan drive over from Jacksonville, Florida, to meet with him Sunday. According to Jordan’s Twitter feed, things went well. McElwain also called fellow ESPN 300 offensive line commit Mike Horton before using his first day of recruiting travel to see ESPN 300 offensive linemen Jalen Merrick, Christian Pellage (South Carolina commit) and Martez Ivey, who is the nation’s No. 1 offensive lineman. When you return minimal depth on the offensive line, it’s probably a good idea to snag some more big bodies before you really get going at your new gig, and that’s exactly what McElwain is trying to do. He even took offensive line coach Mike Summers with him. While McElwain hasn’t made any decisions when it comes to his staff at Florida, Summers did do a very good job in developing Florida’s line and has been solid in recruiting. Then, there’s the hunt for some offensive playmakers, something the Gators have been inconsistent in getting over the past five years. The loss of Jones looked like a big one at first, but it sounds like McElwain is looking for more of a pocket passer to bring to Gainesville. What that means for running types like Treon Harris and Will Grier who are already firmly on campus? Who knows? But McElwain stressed on Saturday that he’ll play to his current roster’s strengths. And he’d like to add a little more strength before national signing day at the skill positions. Already, McElwain has been looking to upgrade Florida’s running back position, offering Miami commit Mark Walton. The Gators are also in the mix with fellow Miami running back commits Dexter Williams and Jordan Scarlett, who are clearly looking around at other schools. Clemson athlete commits Ray-Ray McCloud III, who McElwain visited this week, and Deon Cain will get a lot of attention from the Gators in the next two months, as will uncommitted ESPN 300 athlete Ryan Davis, who also met with McElwain this week. Three-star tight end prospect Daniel Imatorbhebhe and three-star Florida State receiver commit Auden Tate also got visits from McElwain. So while McElwain’s introduction to the Gator Nation has been brief, he’s taken every opportunity to really introduce himself to guys he wants to build a future with at Florida. This class won’t make or break McElwain’s legacy at Florida, but getting a few solid offensive pieces is a must in his first year, and McElwain knows that.
// readPackages consumes package info from the given reader. func readPackages(c ResolverConfig, r io.Reader, isBinaryPackages bool) (*PackageInfo, error) { packages := make(map[string]map[version.Version]*deb.Paragraph) virtualPackages := make(map[string][]*deb.Paragraph) d := deb.NewDecoder(r) for { var p deb.Paragraph err := d.Decode(&p) if err != nil { if err == io.EOF { break } return nil, err } if err := pkgInfoAppend(&p, packages, virtualPackages); err != nil { return nil, err } } return &PackageInfo{ Config: c, BinaryPackages: isBinaryPackages, Packages: packages, virtualPackages: virtualPackages, }, nil }
// newRequests creates a request with the authentication header, and with the // appropriate scheme and port in the case of self-signed TLS. func (c *Client) newRequest(method, url string, body ...io.Reader) *http.Request { var bodyR io.Reader if len(body) > 0 { bodyR = body[0] } if len(body) > 1 { panic("too many body arguments") } req, err := http.NewRequest(method, url, bodyR) if err != nil { panic(err.Error()) } if br, ok := bodyR.(*bytes.Reader); ok { req.ContentLength = int64(br.Len()) } c.authMode.AddAuthHeader(req) return req }
def hasPrivKey(self): return (self.binPrivKey32_Encr.getSize() != 0 or \ self.binPrivKey32_Plain.getSize() != 0 or \ self.createPrivKeyNextUnlock)
Extended focus imaging in digital holographic microscopy: a review Abstract. The microscope is one of the most useful tools for exploring and measuring the microscopic world. However, it has some restrictions in its applications because the microscope’s depth of field (DOF) is not sufficient for obtaining a single image with the necessary magnification in which the whole longitudinal object volume is in focus. Currently, the answer to this issue is the extended focused image. Techniques proposed over the years to overcome the limited DOF constraint of the holographic systems and to obtain a completely in-focus image are discussed. We divide them in two macro categories: the first one involves methods used to reconstruct three-dimensional generic objects (including techniques inherited from traditional microscopy, such as the sectioning and merging approach, or multiplane imaging), while the second area involves methods for objects recorded on a tilted plane with respect to hologram one (including not only the use of reconstruction techniques and rotation matrices, but also the introduction of a numerical cubic phase plate or hologram deformations). The aim is to compare these methods and to show how they work under the same conditions, proposing different applications for each.
package com.tszh.entity; import org.hibernate.annotations.CreationTimestamp; import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.Type; import org.hibernate.annotations.UpdateTimestamp; import javax.persistence.*; import java.util.Date; /** * Created by Administrator on 2018/4/17 0017. */ @Entity @Table(name = "t_address") public class Address { @Id @Column(name = "address_id") @GenericGenerator(name="gen_identity",strategy = "identity") @GeneratedValue(generator = "gen_identity") private int id; @Column(length = 32) private String province; @Column(length = 32) private String city; @Column(length = 32) private String county; @Column(length = 64) private String street; @OneToOne(targetEntity = User.class,cascade = CascadeType.ALL,fetch = FetchType.LAZY) @JoinColumn(name = "user_id",referencedColumnName = "user_id",unique = true) private User user; @CreationTimestamp @Temporal(TemporalType.TIMESTAMP) private Date createAt; @UpdateTimestamp @Temporal(TemporalType.TIMESTAMP) private Date updateAt; @Column private boolean deleted=false; public Address() { } public Address(String province, String city, String county, String street) { this.province = province; this.city = city; this.county = county; this.street = street; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getProvince() { return province; } public void setProvince(String province) { this.province = province; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getCounty() { return county; } public void setCounty(String county) { this.county = county; } public String getStreet() { return street; } public void setStreet(String street) { this.street = street; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public Date getCreateAt() { return createAt; } public void setCreateAt(Date createAt) { this.createAt = createAt; } public Date getUpdateAt() { return updateAt; } public void setUpdateAt(Date updateAt) { this.updateAt = updateAt; } public boolean isDeleted() { return deleted; } public void setDeleted(boolean deleted) { this.deleted = deleted; } @Override public String toString() { return "Address{" + "id=" + id + ", province='" + province + '\'' + ", city='" + city + '\'' + ", county='" + county + '\'' + ", streetAddress='" + street + '\'' + ", user=" + user + ", createAt=" + createAt + ", updateAt=" + updateAt + ", deleted=" + deleted + '}'; } }
/** * Simulation manager contact. Used to run simulations remotely. */ public class SmContact extends Contact { private static final Logger LOGGER = LogManager.getLogger(SmContact.class); private SimulationManager simulationManager; private WorkItem currentWorkItem; private String simulationConfigurationId; private String simulationId; private long currentWorkItemStartMillis; /** * Creates a new {@code SmContact} instance with the specified wrapper, jid and status. * * @param wrapper the wrapper * @param jid the jid * @param status the initial status */ public SmContact(FrevoWrapper wrapper, Jid jid, SimulationManagerStatus status) { super(wrapper, jid); LOGGER.debug("Created SmContact: {}", jid.toString()); simulationManager = wrapper.getSimulationManager(); handleStatus(status); } @Override protected void handleStatus(String statusString) { var status = JsonSerializer.toStatus(statusString); if (status instanceof SimulationManagerStatus) { handleStatus((SimulationManagerStatus) status); } else { LOGGER.warn("Unable to process status: {}", statusString); } } @Override protected void handleMessage(String messageString) { var message = JsonSerializer.toMessage(messageString); if (message instanceof SimulationResultMessage) { handleSimulationResultMessage((SimulationResultMessage) message); } else { LOGGER.warn("Unable to process message: {}", messageString); } } /** * Handles an incoming simulation result message to finish processing the current work item. * * @param message the message */ private synchronized void handleSimulationResultMessage(SimulationResultMessage message) { LOGGER.trace("handleSimulationResultMessage: {}", JsonSerializer.toJson(message)); if (currentWorkItem == null) { return; } if (message.getSimulationId().equals(currentWorkItem.getSimulationId())) { if (message.getSuccess()) { currentWorkItem.getEvaluation().setFitness(message.getFitnessValue()); currentWorkItem.markComplete(); currentWorkItem = null; } else { putBackWorkItem(); } } } /** * Handles an incoming status. * * @param status the status */ private synchronized void handleStatus(SimulationManagerStatus status) { LOGGER.trace("handleStatus: {}", JsonSerializer.toJson(status)); // parse fields simulationConfigurationId = status.getSimulationConfigurationId(); if ((simulationConfigurationId != null) && (simulationConfigurationId.length() == 0)) { simulationConfigurationId = null; } simulationId = status.getSimulationId(); if ((simulationId != null) && (simulationId.length() == 0)) { simulationId = null; } // cancel current work item if required if (currentWorkItem != null) { // cancel if SM has gone offline if (!isAvailable()) { putBackWorkItem(); } // cancel if SM is working on something else else if ((simulationId != null) && !simulationId.equals(currentWorkItem.getSimulationId())) { putBackWorkItem(); } // cancel if SM has configured for a different sort of simulation else if ((simulationConfigurationId != null) && !simulationConfigurationId.equals(currentWorkItem.getSimulationConfigurationId())) { putBackWorkItem(); } } } /** * Determines if the simulation manager is likely free and can accept work. * * @return {@code true} if the simulation manager is likely free. */ public synchronized boolean isFree() { // check for timeout if (currentWorkItem != null) { if (currentWorkItem.getSimulationTimeoutSeconds() != 0) { var simulationTimeSeconds = (System.currentTimeMillis() - currentWorkItemStartMillis) / 1000.0; if (simulationTimeSeconds > currentWorkItem.getSimulationTimeoutSeconds()) { putBackWorkItem(); } } } // check all conditions if (!isAvailable()) { return false; } if (currentWorkItem != null) { return false; } if (simulationId != null) { return false; } return true; } /** * Gets the simulation configuration id. * * @return the simulation configuration id */ public synchronized String getSimulationConfigurationId() { return simulationConfigurationId; } /** * Tries to run a simulation by sending the simulation manager a {@code RunSimulationMessage}. * * @param workItem the work item to run * @return {@code true} if success */ public boolean runSimulation(WorkItem workItem) { // try to set the current work item synchronized (this) { if (!isFree()) { return false; } if (!workItem.getSimulationConfigurationId().equals(simulationConfigurationId)) { return false; } currentWorkItem = workItem; currentWorkItemStartMillis = System.currentTimeMillis(); } if (sendMessage(JsonSerializer.toJson(new RunSimulationMessage(workItem.getOptimizationId(), workItem.getSimulationId(), workItem.getEvaluation().getSeed(), Transport.toParameterList(workItem.getEvaluation().getRepresentation()))))) { return true; } else { putBackWorkItem(); return false; } } /** * Puts the current work item back in the simulation manager's queue. */ private synchronized void putBackWorkItem() { if (currentWorkItem != null) { simulationManager.addWork(currentWorkItem); currentWorkItem = null; } } }
def load_plugins(): return load_dynamic_modules(pathfinder.plugins_path(), abstractplugin.AbstractPlugin)
A,B,T=map(int,input().split()) a=0 ans = 0 for t in range(1,T+1): a += 1 # print(t,a) if a == A: a=0 ans+=B print(ans)
// DecrementIP4By returns a v4 net.IP that is lower than the supplied net.IP // by the supplied integer value. If you underflow the IP space it will return // 0.0.0.0 func DecrementIP4By(ip net.IP, count uint32) net.IP { i := IP4ToUint32(ip) d := i - count if d > i { return generateNetLimits(4, 0) } return Uint32ToIP4(d) }
def convert(self, views, form_type='add'): if not isinstance(views, list) and (isinstance(views, Form) or issubclass(views, Form)): return super().convert(views) try: iter(views) except TypeError: views = [views] schema = OrderedDict([ ('type', 'object'), ('definitions', OrderedDict([])), ('properties', OrderedDict([])) ]) for view in views: name, view_schema = self.convert_view(view, form_type) for k, v in view_schema['definitions'].items(): schema['definitions'][k] = v for k, v in view_schema['properties'].items(): schema['properties'][k] = v return schema
package xkcd import ( "encoding/json" "fmt" "io/ioutil" "math/rand" "net/http" "github.com/botlabs-gg/yagpdb/commands" "github.com/jonas747/dcmd/v4" "github.com/jonas747/discordgo/v2" ) type Xkcd struct { Month string Num int64 Link string Year string News string SafeTitle string Transcript string Alt string Img string Title string Day string } var XkcdHost = "https://xkcd.com/" var XkcdJson = "info.0.json" var Command = &commands.YAGCommand{ CmdCategory: commands.CategoryFun, Name: "Xkcd", Description: "An xkcd comic, by default returns random comic strip", Arguments: []*dcmd.ArgDef{ {Name: "Comic-number", Type: dcmd.Int}, }, ArgSwitches: []*dcmd.ArgDef{ {Name: "l", Help: "Latest comic"}, }, SlashCommandEnabled: true, DefaultEnabled: true, RunFunc: func(data *dcmd.Data) (interface{}, error) { //first query to get latest number latest := false xkcd, err := getComic() if err != nil { return "Something happened whilst getting the comic!", err } xkcdNum := rand.Int63n(xkcd.Num) + 1 //latest comic strip flag, already got that data if data.Switches["l"].Value != nil && data.Switches["l"].Value.(bool) { latest = true } //specific comic strip number if data.Args[0].Value != nil { n := data.Args[0].Int64() if n >= 1 && n <= xkcd.Num { xkcdNum = n } else { return fmt.Sprintf("There's no comic numbered %d, current range is 1-%d", n, xkcd.Num), nil } } //if no latest flag is set, fetches a comic by number if !latest { xkcd, err = getComic(xkcdNum) if err != nil { return "Something happened whilst getting the comic!", err } } embed := &discordgo.MessageEmbed{ Title: fmt.Sprintf("#%d: %s", xkcd.Num, xkcd.Title), Description: fmt.Sprintf("[%s](%s%d/)", xkcd.Alt, XkcdHost, xkcd.Num), Color: int(rand.Int63n(16777215)), Image: &discordgo.MessageEmbedImage{ URL: xkcd.Img, }, } return embed, nil }, } func getComic(number ...int64) (*Xkcd, error) { xkcd := Xkcd{} queryUrl := XkcdHost + XkcdJson if len(number) >= 1 { queryUrl = fmt.Sprintf(XkcdHost+"%d/"+XkcdJson, number[0]) } req, err := http.NewRequest("GET", queryUrl, nil) if err != nil { return nil, err } req.Header.Set("User-Agent", "curl/7.65.1") resp, err := http.DefaultClient.Do(req) if err != nil { return nil, err } body, err := ioutil.ReadAll(resp.Body) if err != nil { return nil, err } queryErr := json.Unmarshal(body, &xkcd) if queryErr != nil { return nil, queryErr } return &xkcd, nil }
// Contains (Public) - returns true if key is in map func (t *TreeMap) Contains(key string) bool { current := t.root for { if current == nil { return false } result := current.compareTo(key) if result == 0 { break } else if result > 0 { current = current.left } else { current = current.right } } return true }
<reponame>jeremiahpslewis/oxigraph<gh_stars>0 //! Data structures for [RDF 1.1 Concepts](https://www.w3.org/TR/rdf11-concepts/) like IRI, literal or triples. use std::fmt; use std::fmt::Write; /// An RDF [IRI](https://www.w3.org/TR/rdf11-concepts/#dfn-iri). /// /// The default string formatter is returning an N-Triples, Turtle and SPARQL compatible representation. /// /// ``` /// use spargebra::term::NamedNode; /// /// assert_eq!( /// "<http://example.com/foo>", /// NamedNode { iri: "http://example.com/foo".into() }.to_string() /// ) /// ``` #[derive(Eq, PartialEq, Ord, PartialOrd, Debug, Clone, Hash)] pub struct NamedNode { /// The [IRI](https://www.w3.org/TR/rdf11-concepts/#dfn-iri) itself. pub iri: String, } impl NamedNode { /// Formats using the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html). pub(crate) fn fmt_sse(&self, f: &mut impl Write) -> fmt::Result { write!(f, "<{}>", self.iri) } } impl fmt::Display for NamedNode { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "<{}>", self.iri) } } impl TryFrom<NamedNodePattern> for NamedNode { type Error = (); #[inline] fn try_from(pattern: NamedNodePattern) -> Result<Self, ()> { match pattern { NamedNodePattern::NamedNode(t) => Ok(t), NamedNodePattern::Variable(_) => Err(()), } } } /// An RDF [blank node](https://www.w3.org/TR/rdf11-concepts/#dfn-blank-node). /// /// /// The default string formatter is returning an N-Triples, Turtle and SPARQL compatible representation. /// /// ``` /// use spargebra::term::BlankNode; /// /// assert_eq!( /// "_:a1", /// BlankNode { id: "a1".into() }.to_string() /// ) /// ``` #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub struct BlankNode { /// The [blank node identifier](https://www.w3.org/TR/rdf11-concepts/#dfn-blank-node-identifier). pub id: String, } impl BlankNode { /// Formats using the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html). pub(crate) fn fmt_sse(&self, f: &mut impl Write) -> fmt::Result { write!(f, "_:{}", self.id) } } impl fmt::Display for BlankNode { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "_:{}", self.id) } } /// An RDF [literal](https://www.w3.org/TR/rdf11-concepts/#dfn-literal). /// /// The default string formatter is returning an N-Triples, Turtle and SPARQL compatible representation. /// /// The language tags should be lowercased [as suggested by the RDF specification](https://www.w3.org/TR/rdf11-concepts/#dfn-language-tagged-string). /// /// ``` /// use spargebra::term::NamedNode; /// use spargebra::term::Literal; /// /// assert_eq!( /// "\"foo\\nbar\"", /// Literal::Simple { value: "foo\nbar".into() }.to_string() /// ); /// /// assert_eq!( /// "\"1999-01-01\"^^<http://www.w3.org/2001/XMLSchema#date>", /// Literal::Typed { value: "1999-01-01".into(), datatype: NamedNode { iri: "http://www.w3.org/2001/XMLSchema#date".into() }}.to_string() /// ); /// /// assert_eq!( /// "\"foo\"@en", /// Literal::LanguageTaggedString { value: "foo".into(), language: "en".into() }.to_string() /// ); /// ``` #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub enum Literal { /// A [simple literal](https://www.w3.org/TR/rdf11-concepts/#dfn-simple-literal) without datatype or language form. Simple { /// The [lexical form](https://www.w3.org/TR/rdf11-concepts/#dfn-lexical-form). value: String, }, /// A [language-tagged string](https://www.w3.org/TR/rdf11-concepts/#dfn-language-tagged-string) LanguageTaggedString { /// The [lexical form](https://www.w3.org/TR/rdf11-concepts/#dfn-lexical-form). value: String, /// The [language tag](https://www.w3.org/TR/rdf11-concepts/#dfn-language-tag). language: String, }, /// A literal with an explicit datatype Typed { /// The [lexical form](https://www.w3.org/TR/rdf11-concepts/#dfn-lexical-form). value: String, /// The [datatype IRI](https://www.w3.org/TR/rdf11-concepts/#dfn-datatype-iri). datatype: NamedNode, }, } impl Literal { /// Formats using the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html). pub(crate) fn fmt_sse(&self, f: &mut impl Write) -> fmt::Result { match self { Literal::Simple { value } => print_quoted_str(value, f), Literal::LanguageTaggedString { value, language } => { print_quoted_str(value, f)?; write!(f, "@{}", language) } Literal::Typed { value, datatype } => { print_quoted_str(value, f)?; write!(f, "^^{}", datatype) } } } } impl fmt::Display for Literal { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Literal::Simple { value } => print_quoted_str(value, f), Literal::LanguageTaggedString { value, language } => { print_quoted_str(value, f)?; write!(f, "@{}", language) } Literal::Typed { value, datatype } => { print_quoted_str(value, f)?; write!(f, "^^{}", datatype) } } } } /// The union of [IRIs](https://www.w3.org/TR/rdf11-concepts/#dfn-iri) and [blank nodes](https://www.w3.org/TR/rdf11-concepts/#dfn-blank-node). /// /// The default string formatter is returning an N-Triples, Turtle and SPARQL compatible representation. #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub enum Subject { NamedNode(NamedNode), BlankNode(BlankNode), #[cfg(feature = "rdf-star")] Triple(Box<Triple>), } impl Subject { /// Formats using the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html). pub(crate) fn fmt_sse(&self, f: &mut impl Write) -> fmt::Result { match self { Self::NamedNode(node) => node.fmt_sse(f), Self::BlankNode(node) => node.fmt_sse(f), #[cfg(feature = "rdf-star")] Self::Triple(triple) => triple.fmt_sse(f), } } } impl fmt::Display for Subject { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::NamedNode(node) => node.fmt(f), Self::BlankNode(node) => node.fmt(f), #[cfg(feature = "rdf-star")] Self::Triple(triple) => write!( f, "<<{} {} {}>>", triple.subject, triple.predicate, triple.object ), } } } impl From<NamedNode> for Subject { #[inline] fn from(node: NamedNode) -> Self { Self::NamedNode(node) } } impl From<BlankNode> for Subject { #[inline] fn from(node: BlankNode) -> Self { Self::BlankNode(node) } } #[cfg(feature = "rdf-star")] impl From<Triple> for Subject { #[inline] fn from(triple: Triple) -> Self { Self::Triple(Box::new(triple)) } } impl TryFrom<TermPattern> for Subject { type Error = (); #[inline] fn try_from(term: TermPattern) -> Result<Self, ()> { match term { TermPattern::NamedNode(t) => Ok(t.into()), TermPattern::BlankNode(t) => Ok(t.into()), #[cfg(feature = "rdf-star")] TermPattern::Triple(t) => Ok(Triple::try_from(*t)?.into()), TermPattern::Literal(_) | TermPattern::Variable(_) => Err(()), } } } /// The union of [IRIs](https://www.w3.org/TR/rdf11-concepts/#dfn-iri) and [triples](https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-triple). /// /// The default string formatter is returning an N-Triples, Turtle and SPARQL compatible representation. #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub enum GroundSubject { NamedNode(NamedNode), #[cfg(feature = "rdf-star")] Triple(Box<GroundTriple>), } impl GroundSubject { /// Formats using the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html). pub(crate) fn fmt_sse(&self, f: &mut impl Write) -> fmt::Result { match self { Self::NamedNode(node) => node.fmt_sse(f), #[cfg(feature = "rdf-star")] Self::Triple(triple) => triple.fmt_sse(f), } } } impl fmt::Display for GroundSubject { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::NamedNode(node) => node.fmt(f), #[cfg(feature = "rdf-star")] Self::Triple(triple) => write!( f, "<<{} {} {}>>", triple.subject, triple.predicate, triple.object ), } } } impl From<NamedNode> for GroundSubject { #[inline] fn from(node: NamedNode) -> Self { Self::NamedNode(node) } } #[cfg(feature = "rdf-star")] impl From<GroundTriple> for GroundSubject { #[inline] fn from(triple: GroundTriple) -> Self { Self::Triple(Box::new(triple)) } } impl TryFrom<Subject> for GroundSubject { type Error = (); #[inline] fn try_from(subject: Subject) -> Result<Self, ()> { match subject { Subject::NamedNode(t) => Ok(t.into()), Subject::BlankNode(_) => Err(()), #[cfg(feature = "rdf-star")] Subject::Triple(t) => Ok(GroundTriple::try_from(*t)?.into()), } } } impl TryFrom<GroundTerm> for GroundSubject { type Error = (); #[inline] fn try_from(term: GroundTerm) -> Result<Self, ()> { match term { GroundTerm::NamedNode(t) => Ok(t.into()), GroundTerm::Literal(_) => Err(()), #[cfg(feature = "rdf-star")] GroundTerm::Triple(t) => Ok((*t).into()), } } } /// An RDF [term](https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-term). /// /// It is the union of [IRIs](https://www.w3.org/TR/rdf11-concepts/#dfn-iri), [blank nodes](https://www.w3.org/TR/rdf11-concepts/#dfn-blank-node) and [literals](https://www.w3.org/TR/rdf11-concepts/#dfn-literal). /// /// The default string formatter is returning an N-Triples, Turtle and SPARQL compatible representation. #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub enum Term { NamedNode(NamedNode), BlankNode(BlankNode), Literal(Literal), #[cfg(feature = "rdf-star")] Triple(Box<Triple>), } impl Term { /// Formats using the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html). pub(crate) fn fmt_sse(&self, f: &mut impl Write) -> fmt::Result { match self { Self::NamedNode(node) => node.fmt_sse(f), Self::BlankNode(node) => node.fmt_sse(f), Self::Literal(literal) => literal.fmt_sse(f), #[cfg(feature = "rdf-star")] Self::Triple(triple) => triple.fmt_sse(f), } } } impl fmt::Display for Term { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::NamedNode(node) => node.fmt(f), Self::BlankNode(node) => node.fmt(f), Self::Literal(literal) => literal.fmt(f), #[cfg(feature = "rdf-star")] Self::Triple(triple) => write!( f, "<<{} {} {}>>", triple.subject, triple.predicate, triple.object ), } } } impl From<NamedNode> for Term { #[inline] fn from(node: NamedNode) -> Self { Self::NamedNode(node) } } impl From<BlankNode> for Term { #[inline] fn from(node: BlankNode) -> Self { Self::BlankNode(node) } } impl From<Literal> for Term { #[inline] fn from(literal: Literal) -> Self { Self::Literal(literal) } } #[cfg(feature = "rdf-star")] impl From<Triple> for Term { #[inline] fn from(triple: Triple) -> Self { Self::Triple(Box::new(triple)) } } impl From<Subject> for Term { #[inline] fn from(resource: Subject) -> Self { match resource { Subject::NamedNode(node) => node.into(), Subject::BlankNode(node) => node.into(), #[cfg(feature = "rdf-star")] Subject::Triple(t) => (*t).into(), } } } impl TryFrom<TermPattern> for Term { type Error = (); #[inline] fn try_from(pattern: TermPattern) -> Result<Self, ()> { match pattern { TermPattern::NamedNode(t) => Ok(t.into()), TermPattern::BlankNode(t) => Ok(t.into()), TermPattern::Literal(t) => Ok(t.into()), #[cfg(feature = "rdf-star")] TermPattern::Triple(t) => Ok(Triple::try_from(*t)?.into()), TermPattern::Variable(_) => Err(()), } } } /// The union of [IRIs](https://www.w3.org/TR/rdf11-concepts/#dfn-iri), [literals](https://www.w3.org/TR/rdf11-concepts/#dfn-literal) and [triples](https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-triple). /// /// The default string formatter is returning an N-Triples, Turtle and SPARQL compatible representation. #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub enum GroundTerm { NamedNode(NamedNode), Literal(Literal), #[cfg(feature = "rdf-star")] Triple(Box<GroundTriple>), } impl GroundTerm { /// Formats using the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html). pub(crate) fn fmt_sse(&self, f: &mut impl Write) -> fmt::Result { match self { Self::NamedNode(node) => node.fmt_sse(f), Self::Literal(literal) => literal.fmt_sse(f), #[cfg(feature = "rdf-star")] Self::Triple(triple) => triple.fmt_sse(f), } } } impl fmt::Display for GroundTerm { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::NamedNode(node) => node.fmt(f), Self::Literal(literal) => literal.fmt(f), #[cfg(feature = "rdf-star")] Self::Triple(triple) => write!( f, "<<{} {} {}>>", triple.subject, triple.predicate, triple.object ), } } } impl From<NamedNode> for GroundTerm { #[inline] fn from(node: NamedNode) -> Self { Self::NamedNode(node) } } impl From<Literal> for GroundTerm { #[inline] fn from(literal: Literal) -> Self { Self::Literal(literal) } } #[cfg(feature = "rdf-star")] impl From<GroundTriple> for GroundTerm { #[inline] fn from(triple: GroundTriple) -> Self { Self::Triple(Box::new(triple)) } } impl TryFrom<Term> for GroundTerm { type Error = (); #[inline] fn try_from(term: Term) -> Result<Self, ()> { match term { Term::NamedNode(t) => Ok(t.into()), Term::BlankNode(_) => Err(()), Term::Literal(t) => Ok(t.into()), #[cfg(feature = "rdf-star")] Term::Triple(t) => Ok(GroundTriple::try_from(*t)?.into()), } } } /// A [RDF triple](https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-triple). /// /// The default string formatter is returning a N-Quads representation. /// /// ``` /// use spargebra::term::NamedNode; /// use spargebra::term::Triple; /// /// assert_eq!( /// "<http://example.com/foo> <http://schema.org/sameAs> <http://example.com/foo>", /// Triple { /// subject: NamedNode { iri: "http://example.com/foo".into() }.into(), /// predicate: NamedNode { iri: "http://schema.org/sameAs".into() }, /// object: NamedNode { iri: "http://example.com/foo".into() }.into(), /// }.to_string() /// ) /// ``` #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub struct Triple { pub subject: Subject, pub predicate: NamedNode, pub object: Term, } impl Triple { /// Formats using the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html). pub(crate) fn fmt_sse(&self, f: &mut impl Write) -> fmt::Result { write!(f, "(triple ")?; self.subject.fmt_sse(f)?; write!(f, " ")?; self.predicate.fmt_sse(f)?; write!(f, " ")?; self.object.fmt_sse(f)?; write!(f, ")") } } impl fmt::Display for Triple { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{} {} {}", self.subject, self.predicate, self.object) } } impl TryFrom<TriplePattern> for Triple { type Error = (); #[inline] fn try_from(triple: TriplePattern) -> Result<Self, ()> { Ok(Self { subject: triple.subject.try_into()?, predicate: triple.predicate.try_into()?, object: triple.object.try_into()?, }) } } /// A [RDF triple](https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-triple) without blank nodes. /// /// The default string formatter is returning a N-Quads representation. /// /// ``` /// use spargebra::term::NamedNode; /// use spargebra::term::GroundTriple; /// /// assert_eq!( /// "<http://example.com/foo> <http://schema.org/sameAs> <http://example.com/foo>", /// GroundTriple { /// subject: NamedNode { iri: "http://example.com/foo".into() }.into(), /// predicate: NamedNode { iri: "http://schema.org/sameAs".into() }, /// object: NamedNode { iri: "http://example.com/foo".into() }.into(), /// }.to_string() /// ) /// ``` #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub struct GroundTriple { pub subject: GroundSubject, pub predicate: NamedNode, pub object: GroundTerm, } impl GroundTriple { /// Formats using the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html). pub(crate) fn fmt_sse(&self, f: &mut impl Write) -> fmt::Result { write!(f, "(triple ")?; self.subject.fmt_sse(f)?; write!(f, " ")?; self.predicate.fmt_sse(f)?; write!(f, " ")?; self.object.fmt_sse(f)?; write!(f, ")") } } impl fmt::Display for GroundTriple { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{} {} {}", self.subject, self.predicate, self.object) } } impl TryFrom<Triple> for GroundTriple { type Error = (); #[inline] fn try_from(triple: Triple) -> Result<Self, ()> { Ok(Self { subject: triple.subject.try_into()?, predicate: triple.predicate, object: triple.object.try_into()?, }) } } /// A possible graph name. /// /// It is the union of [IRIs](https://www.w3.org/TR/rdf11-concepts/#dfn-iri) and the [default graph name](https://www.w3.org/TR/rdf11-concepts/#dfn-default-graph). #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub enum GraphName { NamedNode(NamedNode), DefaultGraph, } impl GraphName { /// Formats using the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html). pub(crate) fn fmt_sse(&self, f: &mut impl Write) -> fmt::Result { match self { Self::NamedNode(node) => node.fmt_sse(f), Self::DefaultGraph => write!(f, "default"), } } } impl fmt::Display for GraphName { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::NamedNode(node) => node.fmt(f), Self::DefaultGraph => write!(f, "DEFAULT"), } } } impl From<NamedNode> for GraphName { #[inline] fn from(node: NamedNode) -> Self { Self::NamedNode(node) } } impl TryFrom<GraphNamePattern> for GraphName { type Error = (); #[inline] fn try_from(pattern: GraphNamePattern) -> Result<Self, ()> { match pattern { GraphNamePattern::NamedNode(t) => Ok(t.into()), GraphNamePattern::DefaultGraph => Ok(Self::DefaultGraph), GraphNamePattern::Variable(_) => Err(()), } } } /// A [RDF triple](https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-triple) in a [RDF dataset](https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-dataset). /// /// The default string formatter is returning a N-Quads representation. /// /// ``` /// use spargebra::term::NamedNode; /// use spargebra::term::Quad; /// /// assert_eq!( /// "<http://example.com/foo> <http://schema.org/sameAs> <http://example.com/foo> <http://example.com/>", /// Quad { /// subject: NamedNode { iri: "http://example.com/foo".into() }.into(), /// predicate: NamedNode { iri: "http://schema.org/sameAs".into() }, /// object: NamedNode { iri: "http://example.com/foo".into() }.into(), /// graph_name: NamedNode { iri: "http://example.com/".into() }.into(), /// }.to_string() /// ) /// ``` #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub struct Quad { pub subject: Subject, pub predicate: NamedNode, pub object: Term, pub graph_name: GraphName, } impl Quad { /// Formats using the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html). pub(crate) fn fmt_sse(&self, f: &mut impl Write) -> fmt::Result { if self.graph_name != GraphName::DefaultGraph { write!(f, "(graph ")?; self.graph_name.fmt_sse(f)?; write!(f, " (")?; } write!(f, "(triple ")?; self.subject.fmt_sse(f)?; write!(f, " ")?; self.predicate.fmt_sse(f)?; write!(f, " ")?; self.object.fmt_sse(f)?; write!(f, ")")?; if self.graph_name != GraphName::DefaultGraph { write!(f, "))")?; } Ok(()) } } impl fmt::Display for Quad { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if self.graph_name == GraphName::DefaultGraph { write!(f, "{} {} {}", self.subject, self.predicate, self.object) } else { write!( f, "{} {} {} {}", self.subject, self.predicate, self.object, self.graph_name ) } } } impl TryFrom<QuadPattern> for Quad { type Error = (); #[inline] fn try_from(quad: QuadPattern) -> Result<Self, ()> { Ok(Self { subject: quad.subject.try_into()?, predicate: quad.predicate.try_into()?, object: quad.object.try_into()?, graph_name: quad.graph_name.try_into()?, }) } } /// A [RDF triple](https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-triple) in a [RDF dataset](https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-dataset) without blank nodes. /// /// The default string formatter is returning a N-Quads representation. /// /// ``` /// use spargebra::term::NamedNode; /// use spargebra::term::GroundQuad; /// /// assert_eq!( /// "<http://example.com/foo> <http://schema.org/sameAs> <http://example.com/foo> <http://example.com/>", /// GroundQuad { /// subject: NamedNode { iri: "http://example.com/foo".into() }.into(), /// predicate: NamedNode { iri: "http://schema.org/sameAs".into() }, /// object: NamedNode { iri: "http://example.com/foo".into() }.into(), /// graph_name: NamedNode { iri: "http://example.com/".into() }.into(), /// }.to_string() /// ) /// ``` #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub struct GroundQuad { pub subject: GroundSubject, pub predicate: NamedNode, pub object: GroundTerm, pub graph_name: GraphName, } impl GroundQuad { /// Formats using the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html). pub(crate) fn fmt_sse(&self, f: &mut impl Write) -> fmt::Result { if self.graph_name != GraphName::DefaultGraph { write!(f, "(graph ")?; self.graph_name.fmt_sse(f)?; write!(f, " (")?; } write!(f, "(triple ")?; self.subject.fmt_sse(f)?; write!(f, " ")?; self.predicate.fmt_sse(f)?; write!(f, " ")?; self.object.fmt_sse(f)?; write!(f, ")")?; if self.graph_name != GraphName::DefaultGraph { write!(f, "))")?; } Ok(()) } } impl fmt::Display for GroundQuad { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if self.graph_name == GraphName::DefaultGraph { write!(f, "{} {} {}", self.subject, self.predicate, self.object) } else { write!( f, "{} {} {} {}", self.subject, self.predicate, self.object, self.graph_name ) } } } impl TryFrom<Quad> for GroundQuad { type Error = (); #[inline] fn try_from(quad: Quad) -> Result<Self, ()> { Ok(Self { subject: quad.subject.try_into()?, predicate: quad.predicate, object: quad.object.try_into()?, graph_name: quad.graph_name, }) } } /// A [SPARQL query variable](https://www.w3.org/TR/sparql11-query/#sparqlQueryVariables). /// /// ``` /// use spargebra::term::Variable; /// /// assert_eq!( /// "?foo", /// Variable { name: "foo".into() }.to_string() /// ); /// ``` #[derive(Eq, PartialEq, Ord, PartialOrd, Debug, Clone, Hash)] pub struct Variable { pub name: String, } impl Variable { /// Formats using the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html). pub(crate) fn fmt_sse(&self, f: &mut impl Write) -> fmt::Result { write!(f, "?{}", self.name) } } impl fmt::Display for Variable { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "?{}", self.name) } } /// The union of [IRIs](https://www.w3.org/TR/rdf11-concepts/#dfn-iri) and [variables](https://www.w3.org/TR/sparql11-query/#sparqlQueryVariables). #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub enum NamedNodePattern { NamedNode(NamedNode), Variable(Variable), } impl NamedNodePattern { /// Formats using the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html). pub(crate) fn fmt_sse(&self, f: &mut impl Write) -> fmt::Result { match self { Self::NamedNode(node) => node.fmt_sse(f), Self::Variable(var) => var.fmt_sse(f), } } } impl fmt::Display for NamedNodePattern { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::NamedNode(node) => node.fmt(f), Self::Variable(var) => var.fmt(f), } } } impl From<NamedNode> for NamedNodePattern { #[inline] fn from(node: NamedNode) -> Self { Self::NamedNode(node) } } impl From<Variable> for NamedNodePattern { #[inline] fn from(var: Variable) -> Self { Self::Variable(var) } } /// The union of [terms](https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-term) and [variables](https://www.w3.org/TR/sparql11-query/#sparqlQueryVariables). #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub enum TermPattern { NamedNode(NamedNode), BlankNode(BlankNode), Literal(Literal), #[cfg(feature = "rdf-star")] Triple(Box<TriplePattern>), Variable(Variable), } impl TermPattern { /// Formats using the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html). pub(crate) fn fmt_sse(&self, f: &mut impl Write) -> fmt::Result { match self { Self::NamedNode(term) => term.fmt_sse(f), Self::BlankNode(term) => term.fmt_sse(f), Self::Literal(term) => term.fmt_sse(f), #[cfg(feature = "rdf-star")] Self::Triple(triple) => triple.fmt_sse(f), Self::Variable(var) => var.fmt_sse(f), } } } impl fmt::Display for TermPattern { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::NamedNode(term) => term.fmt(f), Self::BlankNode(term) => term.fmt(f), Self::Literal(term) => term.fmt(f), #[cfg(feature = "rdf-star")] Self::Triple(triple) => write!(f, "<<{}>>", triple), Self::Variable(var) => var.fmt(f), } } } impl From<NamedNode> for TermPattern { #[inline] fn from(node: NamedNode) -> Self { Self::NamedNode(node) } } impl From<BlankNode> for TermPattern { #[inline] fn from(node: BlankNode) -> Self { Self::BlankNode(node) } } impl From<Literal> for TermPattern { #[inline] fn from(literal: Literal) -> Self { Self::Literal(literal) } } #[cfg(feature = "rdf-star")] impl From<TriplePattern> for TermPattern { #[inline] fn from(triple: TriplePattern) -> Self { Self::Triple(Box::new(triple)) } } impl From<Variable> for TermPattern { fn from(var: Variable) -> Self { Self::Variable(var) } } impl From<Subject> for TermPattern { #[inline] fn from(subject: Subject) -> Self { match subject { Subject::NamedNode(node) => node.into(), Subject::BlankNode(node) => node.into(), #[cfg(feature = "rdf-star")] Subject::Triple(t) => TriplePattern::from(*t).into(), } } } impl From<Term> for TermPattern { #[inline] fn from(term: Term) -> Self { match term { Term::NamedNode(node) => node.into(), Term::BlankNode(node) => node.into(), Term::Literal(literal) => literal.into(), #[cfg(feature = "rdf-star")] Term::Triple(t) => TriplePattern::from(*t).into(), } } } impl From<NamedNodePattern> for TermPattern { #[inline] fn from(element: NamedNodePattern) -> Self { match element { NamedNodePattern::NamedNode(node) => node.into(), NamedNodePattern::Variable(var) => var.into(), } } } /// The union of [terms](https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-term) and [variables](https://www.w3.org/TR/sparql11-query/#sparqlQueryVariables) without blank nodes. #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub enum GroundTermPattern { NamedNode(NamedNode), Literal(Literal), Variable(Variable), Triple(Box<GroundTriplePattern>), } impl GroundTermPattern { /// Formats using the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html). pub(crate) fn fmt_sse(&self, f: &mut impl Write) -> fmt::Result { match self { Self::NamedNode(term) => term.fmt_sse(f), Self::Literal(term) => term.fmt_sse(f), Self::Variable(var) => var.fmt_sse(f), Self::Triple(triple) => triple.fmt_sse(f), } } } impl fmt::Display for GroundTermPattern { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::NamedNode(term) => term.fmt(f), Self::Literal(term) => term.fmt(f), Self::Variable(var) => var.fmt(f), Self::Triple(triple) => write!(f, "<<{}>>", triple), } } } impl From<NamedNode> for GroundTermPattern { #[inline] fn from(node: NamedNode) -> Self { Self::NamedNode(node) } } impl From<Literal> for GroundTermPattern { #[inline] fn from(literal: Literal) -> Self { Self::Literal(literal) } } impl From<GroundTriplePattern> for GroundTermPattern { #[inline] fn from(triple: GroundTriplePattern) -> Self { Self::Triple(Box::new(triple)) } } impl From<Variable> for GroundTermPattern { #[inline] fn from(var: Variable) -> Self { Self::Variable(var) } } impl From<GroundSubject> for GroundTermPattern { #[inline] fn from(term: GroundSubject) -> Self { match term { GroundSubject::NamedNode(node) => node.into(), #[cfg(feature = "rdf-star")] GroundSubject::Triple(triple) => GroundTriplePattern::from(*triple).into(), } } } impl From<GroundTerm> for GroundTermPattern { #[inline] fn from(term: GroundTerm) -> Self { match term { GroundTerm::NamedNode(node) => node.into(), GroundTerm::Literal(literal) => literal.into(), #[cfg(feature = "rdf-star")] GroundTerm::Triple(triple) => GroundTriplePattern::from(*triple).into(), } } } impl From<NamedNodePattern> for GroundTermPattern { #[inline] fn from(element: NamedNodePattern) -> Self { match element { NamedNodePattern::NamedNode(node) => node.into(), NamedNodePattern::Variable(var) => var.into(), } } } impl TryFrom<TermPattern> for GroundTermPattern { type Error = (); #[inline] fn try_from(pattern: TermPattern) -> Result<Self, ()> { Ok(match pattern { TermPattern::NamedNode(named_node) => named_node.into(), TermPattern::BlankNode(_) => return Err(()), TermPattern::Literal(literal) => literal.into(), #[cfg(feature = "rdf-star")] TermPattern::Triple(triple) => GroundTriplePattern::try_from(*triple)?.into(), TermPattern::Variable(variable) => variable.into(), }) } } /// The union of [IRIs](https://www.w3.org/TR/rdf11-concepts/#dfn-iri), [default graph name](https://www.w3.org/TR/rdf11-concepts/#dfn-default-graph) and [variables](https://www.w3.org/TR/sparql11-query/#sparqlQueryVariables). #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub enum GraphNamePattern { NamedNode(NamedNode), DefaultGraph, Variable(Variable), } impl GraphNamePattern { /// Formats using the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html). pub(crate) fn fmt_sse(&self, f: &mut impl Write) -> fmt::Result { match self { Self::NamedNode(node) => node.fmt_sse(f), Self::DefaultGraph => write!(f, "default"), Self::Variable(var) => var.fmt_sse(f), } } } impl fmt::Display for GraphNamePattern { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::NamedNode(node) => node.fmt(f), Self::DefaultGraph => write!(f, "DEFAULT"), Self::Variable(var) => var.fmt(f), } } } impl From<NamedNode> for GraphNamePattern { #[inline] fn from(node: NamedNode) -> Self { Self::NamedNode(node) } } impl From<Variable> for GraphNamePattern { #[inline] fn from(var: Variable) -> Self { Self::Variable(var) } } impl From<GraphName> for GraphNamePattern { #[inline] fn from(graph_name: GraphName) -> Self { match graph_name { GraphName::NamedNode(node) => node.into(), GraphName::DefaultGraph => Self::DefaultGraph, } } } impl From<NamedNodePattern> for GraphNamePattern { #[inline] fn from(graph_name: NamedNodePattern) -> Self { match graph_name { NamedNodePattern::NamedNode(node) => node.into(), NamedNodePattern::Variable(var) => var.into(), } } } /// A [triple pattern](https://www.w3.org/TR/sparql11-query/#defn_TriplePattern) #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub struct TriplePattern { pub subject: TermPattern, pub predicate: NamedNodePattern, pub object: TermPattern, } impl TriplePattern { pub(crate) fn new( subject: impl Into<TermPattern>, predicate: impl Into<NamedNodePattern>, object: impl Into<TermPattern>, ) -> Self { Self { subject: subject.into(), predicate: predicate.into(), object: object.into(), } } } impl TriplePattern { /// Formats using the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html). pub(crate) fn fmt_sse(&self, f: &mut impl Write) -> fmt::Result { write!(f, "(triple ")?; self.subject.fmt_sse(f)?; write!(f, " ")?; self.predicate.fmt_sse(f)?; write!(f, " ")?; self.object.fmt_sse(f)?; write!(f, ")") } } impl fmt::Display for TriplePattern { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{} {} {}", self.subject, self.predicate, self.object) } } impl From<Triple> for TriplePattern { #[inline] fn from(triple: Triple) -> Self { Self { subject: triple.subject.into(), predicate: triple.predicate.into(), object: triple.object.into(), } } } /// A [triple pattern](https://www.w3.org/TR/sparql11-query/#defn_TriplePattern) without blank nodes #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub struct GroundTriplePattern { pub subject: GroundTermPattern, pub predicate: NamedNodePattern, pub object: GroundTermPattern, } impl GroundTriplePattern { /// Formats using the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html). pub(crate) fn fmt_sse(&self, f: &mut impl Write) -> fmt::Result { write!(f, "(triple ")?; self.subject.fmt_sse(f)?; write!(f, " ")?; self.predicate.fmt_sse(f)?; write!(f, " ")?; self.object.fmt_sse(f)?; write!(f, ")") } } impl fmt::Display for GroundTriplePattern { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{} {} {}", self.subject, self.predicate, self.object) } } impl From<GroundTriple> for GroundTriplePattern { #[inline] fn from(triple: GroundTriple) -> Self { Self { subject: triple.subject.into(), predicate: triple.predicate.into(), object: triple.object.into(), } } } impl TryFrom<TriplePattern> for GroundTriplePattern { type Error = (); #[inline] fn try_from(triple: TriplePattern) -> Result<Self, Self::Error> { Ok(Self { subject: triple.subject.try_into()?, predicate: triple.predicate, object: triple.object.try_into()?, }) } } /// A [triple pattern](https://www.w3.org/TR/sparql11-query/#defn_TriplePattern) in a specific graph #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub struct QuadPattern { pub subject: TermPattern, pub predicate: NamedNodePattern, pub object: TermPattern, pub graph_name: GraphNamePattern, } impl QuadPattern { pub(crate) fn new( subject: impl Into<TermPattern>, predicate: impl Into<NamedNodePattern>, object: impl Into<TermPattern>, graph_name: impl Into<GraphNamePattern>, ) -> Self { Self { subject: subject.into(), predicate: predicate.into(), object: object.into(), graph_name: graph_name.into(), } } } impl QuadPattern { /// Formats using the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html). pub(crate) fn fmt_sse(&self, f: &mut impl Write) -> fmt::Result { if self.graph_name != GraphNamePattern::DefaultGraph { write!(f, "(graph ")?; self.graph_name.fmt_sse(f)?; write!(f, " (")?; } write!(f, "(triple ")?; self.subject.fmt_sse(f)?; write!(f, " ")?; self.predicate.fmt_sse(f)?; write!(f, " ")?; self.object.fmt_sse(f)?; write!(f, ")")?; if self.graph_name != GraphNamePattern::DefaultGraph { write!(f, "))")?; } Ok(()) } } impl fmt::Display for QuadPattern { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if self.graph_name == GraphNamePattern::DefaultGraph { write!(f, "{} {} {}", self.subject, self.predicate, self.object) } else { write!( f, "GRAPH {} {{ {} {} {} }}", self.graph_name, self.subject, self.predicate, self.object ) } } } /// A [triple pattern](https://www.w3.org/TR/sparql11-query/#defn_TriplePattern) in a specific graph without blank nodes #[derive(Eq, PartialEq, Debug, Clone, Hash)] pub struct GroundQuadPattern { pub subject: GroundTermPattern, pub predicate: NamedNodePattern, pub object: GroundTermPattern, pub graph_name: GraphNamePattern, } impl GroundQuadPattern { /// Formats using the [SPARQL S-Expression syntax](https://jena.apache.org/documentation/notes/sse.html). pub(crate) fn fmt_sse(&self, f: &mut impl Write) -> fmt::Result { if self.graph_name != GraphNamePattern::DefaultGraph { write!(f, "(graph ")?; self.graph_name.fmt_sse(f)?; write!(f, " (")?; } write!(f, "(triple ")?; self.subject.fmt_sse(f)?; write!(f, " ")?; self.predicate.fmt_sse(f)?; write!(f, " ")?; self.object.fmt_sse(f)?; write!(f, ")")?; if self.graph_name != GraphNamePattern::DefaultGraph { write!(f, "))")?; } Ok(()) } } impl fmt::Display for GroundQuadPattern { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if self.graph_name == GraphNamePattern::DefaultGraph { write!(f, "{} {} {}", self.subject, self.predicate, self.object) } else { write!( f, "GRAPH {} {{ {} {} {} }}", self.graph_name, self.subject, self.predicate, self.object ) } } } impl TryFrom<QuadPattern> for GroundQuadPattern { type Error = (); #[inline] fn try_from(pattern: QuadPattern) -> Result<Self, ()> { Ok(Self { subject: pattern.subject.try_into()?, predicate: pattern.predicate, object: pattern.object.try_into()?, graph_name: pattern.graph_name, }) } } #[inline] pub(crate) fn print_quoted_str(string: &str, f: &mut impl Write) -> fmt::Result { f.write_char('"')?; for c in string.chars() { match c { '\n' => f.write_str("\\n"), '\r' => f.write_str("\\r"), '"' => f.write_str("\\\""), '\\' => f.write_str("\\\\"), c => f.write_char(c), }?; } f.write_char('"') }
/** * frwr_reminv - handle a remotely invalidated mr on the @mrs list * @rep: Received reply * @mrs: list of MRs to check * */ void frwr_reminv(struct rpcrdma_rep *rep, struct list_head *mrs) { struct rpcrdma_mr *mr; list_for_each_entry(mr, mrs, mr_list) if (mr->mr_handle == rep->rr_inv_rkey) { list_del_init(&mr->mr_list); trace_xprtrdma_mr_reminv(mr); frwr_mr_put(mr); break; } }
// NewMatcher creates a Matcher. func (cfg *Configuration) NewMatcher( cache cache.Cache, kvCluster client.Client, clockOpts clock.Options, instrumentOpts instrument.Options, ) (Matcher, error) { opts, err := cfg.NewOptions(kvCluster, clockOpts, instrumentOpts) if err != nil { return nil, err } return NewMatcher(cache, opts) }
<reponame>RP0001/ms2ldaviz<gh_stars>1-10 # see http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html from __future__ import absolute_import, unicode_literals from .celery_tasks import app as celery_app __all__ = ['celery_app']
import { Stack, StackProps } from 'aws-cdk-lib'; import * as ec2 from 'aws-cdk-lib/aws-ec2'; import { Construct } from 'constructs'; import { DBSettings } from '../bin/db-settings'; import { Database } from './database'; interface DbDefinerStackProps extends StackProps { dbSettings: DBSettings; } export class DbDefinerStack extends Stack { constructor(scope: Construct, id: string, props: DbDefinerStackProps) { super(scope, id, props); const vpc = new ec2.Vpc(this, 'Vpc', { subnetConfiguration: [ { cidrMask: 24, name: 'db', subnetType: ec2.SubnetType.PRIVATE_ISOLATED, }, ], }); new Database(this, 'DB', { vpc, dbSettings: props.dbSettings, }); } }
import { Task } from 'fp-ts/lib/Task'; // all processors share these generic processor types export type Context = Array<string>; export type QueryProcessor<Q, R> = (q: Q) => Task<R>; export type ResultProcessor<R> = (r: R) => Task<void>; export type Build<P, A, C extends Context> = (a: A) => (c: C) => P;
Isolation, structure, and functional elucidation of a modified pentapeptide, cysteine protease inhibitor (CPI-2081) from Streptomyces species 2081 that exhibit inhibitory effect on cancer cell migration. Cysteine proteases play an important role in cell migration and tumor metastasis. Therefore, their inhibitors are of colossal interest, having potential to be developed as effective antimetastatic drugs for tumor chemotherapy. Traditionally, secondary metabolites from streptomyces show a wide range of diversity with respect to their biological activity and chemical nature. In this article, we have described the characterization of small molecule cysteine protease inhibitor, CPI-2081 (compound 1), a mixture of two novel pentapeptides, compound 1a (736.71 Da), and compound 1b (842.78 Da), isolated from Streptomyces species NCIM2081, following solvent extraction and repeated HPLC based on C18 chemistry, and completely characterized using a variety of both 1D and 2D NMR spectroscopy. Further, it was found that nanomolar concentration of compound 1 is able to inhibit papain hydrolytic activity. Also, compound 1 significantly inhibits tumor cell migration at sub cytotoxic concentration, indicating its remarkable potential to be developed as antimetastatic drug, which will make chemotherapy more localized and specific, thereby minimizing the hazardous side effects on normal tissues.
import styled from "styled-components"; import { Link } from "react-router-dom"; import { colors } from "../../mainStyles/colors"; import { typography } from "../../mainStyles/typography"; export const LogoText = styled.p<{ textAlign?: string; margin?: string }>` font-family: "Lato", sans-serif; font-size: ${typography.veryLarge}; font-weight: 700; color: ${colors.fontMain}; border-bottom: 3px solid ${colors.themeGreen}; text-align: ${({ textAlign }) => (textAlign ? textAlign : "start")}; margin: ${({ margin }) => (margin ? margin : 0)}; user-select: none; span { color: ${colors.themeGreen}; } `; export const LogoTextLight = styled(LogoText)` color: ${colors.backgroundMain}; `; export const LogoLink = styled(Link)<{ textAlign?: string; margin?: string }>` font-family: "Lato", sans-serif; font-size: ${typography.veryLarge}; font-weight: 700; text-decoration: none; color: ${colors.fontMain}; border-bottom: 3px solid ${colors.themeGreen}; text-align: center; user-select: none; span { color: ${colors.themeGreen}; } `;
import * as React from 'react'; import { View, StyleSheet, Button } from 'react-native'; import DateField, { MonthDateYearField, YearMonthDateField, } from 'react-native-datefield'; const App = () => { const [date, setDate] = React.useState<Date | null>(null); return ( <View style={styles.container}> <DateField onSubmit={(value) => console.log(value)} /> <DateField styleInput={styles.underline} onSubmit={(value) => console.log(value)} maximumDate={new Date(2023, 3, 10)} minimumDate={new Date(2021, 4, 21)} handleErrors={() => console.log('ERROR')} /> <DateField styleInput={styles.input} onSubmit={(value) => console.log('DateField', value)} /> <DateField hideDate styleInput={[styles.input, styles.inputStart]} containerStyle={styles.containerStyle} onSubmit={(value) => console.log('DateField', value)} /> <MonthDateYearField labelDate="Enter date" labelMonth="Enter month" labelYear="Enter year" containerStyle={styles.inputBackground} onSubmit={(value) => console.log('MonthDateYearField', value)} /> <View style={styles.spacer} /> <YearMonthDateField value={date} styleInput={styles.inputBorder} styleInputYear={styles.inputYear} onSubmit={(value) => setDate(value)} /> <Button title="Show value" onPress={() => console.log(date)} /> <Button title="Reset value" onPress={() => setDate(null)} /> </View> ); }; const styles = StyleSheet.create({ container: { padding: 20, }, input: { width: '30%', borderRadius: 8, backgroundColor: '#f4f4f4', marginBottom: 20, }, underline: { width: '30%', borderBottomColor: '#cacaca', borderBottomWidth: 1, marginBottom: 20, }, containerStyle: { justifyContent: 'flex-start', }, inputStart: { marginRight: 20, }, inputBorder: { width: '30%', borderRadius: 8, borderColor: '#cacaca', borderWidth: 1, marginBottom: 20, }, inputBackground: { borderRadius: 15, backgroundColor: '#f4f4f4', paddingHorizontal: 25, marginBottom: 20, }, spacer: { borderTopColor: '#cacaca', borderTopWidth: 1, paddingTop: 20, }, inputYear: { width: '40%', backgroundColor: 'red', }, }); export default App;
// UnsetOutPort removes an external outport from the graph func (n *Graph) UnsetOutPort(name string) bool { port, exists := n.outPorts[name] if !exists { return false } if proc, ok := n.procs[port.proc]; ok { unsetProcPort(proc, port.proc, true) } delete(n.outPorts, name) return true }
/** * * Handler for Business Action Event Items * */ public class BusinessActionRefHandler { public final Map<String, Object> execute(final BusinessActionItemDataObject businessActionItemDataObject, final ApplicationContext context, final DataIdentifier dataId) throws ExternalException { final BusinessAction businessAction = context.getApplicationMapping().getBusinessTier() .getBusinessAction(businessActionItemDataObject.getBusinessActionId()); Map<String, Object> outputValues = new HashMap<String, Object>(); try { final String sessionId = businessActionItemDataObject.getSessionId(); final String windowId = businessActionItemDataObject.getWindowId(); storeValues(businessActionItemDataObject.getInputValues(), dataId, windowId, sessionId); storeValues(businessActionItemDataObject.getInternalVariables(), dataId, windowId, sessionId); context.getBusinessManager().manage(context, dataId, businessAction); outputValues = collectOutputValues(businessActionItemDataObject, dataId); } catch (final ExternalException e) { throw e; } return outputValues; } private Map<String, Object> collectOutputValues(final BusinessActionItemDataObject businessActionItemDataObject, final DataIdentifier dataId) { Map<String, Object> outputValues = new HashMap<String, Object>(); Map<String, String> outputVariables = businessActionItemDataObject.getOutputVariables(); for(String outName : outputVariables.keySet()) { String outReference = outputVariables.get(outName); Object value = DataStore.getValue(dataId, outReference); outputValues.put(outName, value); } // For sending the updated internal variables back to the client-side collectInternalVariables(dataId, outputValues); collectBuiltInsFromBackend(dataId, outputValues); return outputValues; } private void collectInternalVariables(final DataIdentifier dataId, Map<String, Object> outputValues) { for (String keyword : DataStore.KEY_WORDS) { Object value = DataStore.findValue(dataId, keyword); if (value != null) { outputValues.put(keyword, value); } } } private void collectBuiltInsFromBackend(DataIdentifier dataId, Map<String, Object> outputValues) { Object builtInList = DataStore.findValue(dataId, DataStore.KEY_WORD_QAFE_BUILT_IN_LIST); if (builtInList == null || !(builtInList instanceof String)) { return; } BuiltinConvertor builtInConverter = new BuiltinConvertorImpl(); List<BuiltInFunction> builtIns = builtInConverter.convert((String) builtInList); if (builtIns == null) { return; } outputValues.put(DataStore.KEY_WORD_QAFE_BUILT_IN_LIST, builtIns); } private void storeValues(final Map<String, Object> values, final DataIdentifier dataId , final String windowId, final String sessionId) { if (values == null) { return; } for (String key : values.keySet()) { Object value = values.get(key); if (EventItemExecuteHelper.isLookupData(value)) { Parameter parameter = new Parameter(); parameter.setName(key); value = EventItemExecuteHelper.resolveLookupData(dataId, windowId, sessionId, parameter, value); } DataStore.store(dataId, key, value); } } }
<filename>alipay/aop/api/response/AlipayTradeAppPayResponse.py #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse class AlipayTradeAppPayResponse(AlipayResponse): def __init__(self): super(AlipayTradeAppPayResponse, self).__init__() self._merchant_order_no = None self._out_trade_no = None self._seller_id = None self._total_amount = None self._trade_no = None @property def merchant_order_no(self): return self._merchant_order_no @merchant_order_no.setter def merchant_order_no(self, value): self._merchant_order_no = value @property def out_trade_no(self): return self._out_trade_no @out_trade_no.setter def out_trade_no(self, value): self._out_trade_no = value @property def seller_id(self): return self._seller_id @seller_id.setter def seller_id(self, value): self._seller_id = value @property def total_amount(self): return self._total_amount @total_amount.setter def total_amount(self, value): self._total_amount = value @property def trade_no(self): return self._trade_no @trade_no.setter def trade_no(self, value): self._trade_no = value def parse_response_content(self, response_content): response = super(AlipayTradeAppPayResponse, self).parse_response_content(response_content) if 'merchant_order_no' in response: self.merchant_order_no = response['merchant_order_no'] if 'out_trade_no' in response: self.out_trade_no = response['out_trade_no'] if 'seller_id' in response: self.seller_id = response['seller_id'] if 'total_amount' in response: self.total_amount = response['total_amount'] if 'trade_no' in response: self.trade_no = response['trade_no']
import { FormControl } from '@angular/forms'; import { BwcProvider } from '../providers/bwc/bwc'; export class AddressValidator { static bitcore: BwcProvider; constructor(bwc: BwcProvider) { AddressValidator.bitcore = bwc; } isValid(control: FormControl): any { let b = AddressValidator.bitcore.getBitcore(); let c = AddressValidator.bitcore.getBitcoreCash(); let URI = b.URI; let Address = b.Address; let URICash = c.URI; let AddressCash = c.Address; // Regular url if (/^https?:\/\//.test(control.value)) { return null; } // Bip21 uri let uri, isAddressValidLivenet, isAddressValidTestnet; if (/^bitcoin:/.test(control.value)) { let isUriValid = URI.isValid(control.value); if (isUriValid) { uri = new URI(control.value); isAddressValidLivenet = Address.isValid( uri.address.toString(), 'livenet' ); isAddressValidTestnet = Address.isValid( uri.address.toString(), 'testnet' ); } if (isUriValid && (isAddressValidLivenet || isAddressValidTestnet)) { return null; } } else if (/^bitcoincash:/.test(control.value)) { let isUriValid = URICash.isValid(control.value); if (isUriValid) { uri = new URICash(control.value); isAddressValidLivenet = AddressCash.isValid( uri.address.toString(), 'livenet' ); } if (isUriValid && isAddressValidLivenet) { return null; } } // Regular Address: try Bitcoin and Bitcoin Cash let regularAddressLivenet = Address.isValid(control.value, 'livenet'); let regularAddressTestnet = Address.isValid(control.value, 'testnet'); let regularAddressCashLivenet = AddressCash.isValid( control.value, 'livenet' ); if ( regularAddressLivenet || regularAddressTestnet || regularAddressCashLivenet ) { return null; } return { 'Invalid Address': true }; } }
<reponame>stardustapp/dust-typescript import { clr, combine, iter, readableStreamFromReader, readerFromIterable, } from "../deps.ts"; const KnownDirs = new Array<[string,string]>(); const signals = [ Deno.signal(Deno.Signal.SIGINT), Deno.signal(Deno.Signal.SIGTERM), ]; export function disregardSignals() { signals.forEach(x => x.dispose()); signals.length = 0; } const cleaningUp = Promise.race(signals).then(disregardSignals); export class ServiceRunner { constructor(cwd?: string) { this.cwd = cwd || Deno.cwd(); cleaningUp.then(this.onInterrupt); } cwd: string; processes = new Array<ChildProcess>(); tempDirs = new Array<string>(); shuttingDown = false; setDefaultWorkDir(workDir: string) { console.log(` `, clr.gray(clr.bold('cd')), clr.gray(this.formatArgs([workDir]))); this.cwd = workDir; } static registerKnownDir(prefix: string, variable: string) { console.log(` `, clr.blue(variable.slice(1)) +clr.gray('='+prefix)); KnownDirs.push([prefix, variable]); } addTempDir(tempDir: string) { this.tempDirs.push(tempDir); } formatArgs(args: string[]) { return args.map(arg => { const knownDir = KnownDirs .find(([prefix]) => arg.startsWith(prefix)); if (knownDir) { arg = clr.blue(knownDir[1])+arg.slice(knownDir[0].length); } else if (arg.startsWith(this.cwd)) { arg = clr.blue('$PWD')+arg.slice(this.cwd.length); } if (arg.includes(' ')) { return `"${arg}"`; } return arg; }).join(' '); } onInterrupt = async () => { if (this.shuttingDown) return; console.log(); console.log('--> Interrupted, cleaning up...'); await this.shutdown(); console.log(' Caio!'); console.log(); } // Purpose-specific entrypoints async createTempDir({andSwitch=false} = {}) { let cmdStr = `${clr.bold('mktemp')} -d`; if (andSwitch) { cmdStr = `${clr.bold('cd')} "$(${cmdStr})"`; } cmdStr = clr.gray(cmdStr); await Deno.stdout.write(new TextEncoder().encode(' '+cmdStr)); try { const proc = Deno.run({cmd: [`mktemp`, `-d`], stdout: 'piped'}); const stdout = new TextDecoder('utf-8').decode(await proc.output()).trim(); this.tempDirs.push(stdout); await Deno.stdout.write(new TextEncoder().encode(clr.blue(` # ${stdout}`))); if (andSwitch) { this.cwd = stdout; } return stdout; } finally { await Deno.stdout.write(new TextEncoder().encode(`\n`)); } } // Generic execution async execUtility(cmd: string, args: string[], opts: {cwd?: string} = {}): Promise<{stdout: string, stderr: string, status: Deno.ProcessStatus}> { if (opts.cwd && opts.cwd !== this.cwd) { console.log(` `, clr.gray(clr.bold('cd')), clr.gray(this.formatArgs([opts.cwd]))); } await Deno.stdout.write(new TextEncoder().encode( ` ${clr.gray(clr.bold(cmd))} ${clr.gray(this.formatArgs(args))}`)); try { const proc = Deno.run({ cmd: [cmd, ...args], cwd: opts.cwd ?? this.cwd, stdout: 'piped', stderr: 'piped', }); const [stdoutRaw, stderrRaw, status] = await Promise.all([proc.output(), proc.stderrOutput(), proc.status()]); const stdout = new TextDecoder().decode(stdoutRaw); const stderr = new TextDecoder().decode(stderrRaw); if (!status.success) { throw new Error(`Command '${cmd}' exited with status ${JSON.stringify(status)}.\n-----\n`+stderr+`\n-----\n`+stdout); } return {stdout, stderr, status}; } finally { await Deno.stdout.write(new TextEncoder().encode(`\n`)); } } launchBackgroundProcess(cmd: string, opts: { args?: string[]; cwd?: string; env?: Record<string,string>; }): ChildProcess { if (opts.cwd && opts.cwd !== this.cwd) { console.log(` `, clr.gray(clr.bold('cd')), clr.gray(this.formatArgs([opts.cwd]))); } console.log(` `, clr.gray(clr.bold(cmd)), clr.gray(this.formatArgs(opts.args ?? [])), clr.gray(clr.bold('&'))); // actually launch the process const proc = new ChildProcess(Deno.run({ cmd: [cmd, ...(opts.args ?? [])], cwd: opts.cwd ?? this.cwd, env: opts.env, stdin: 'null', stdout: 'piped', stderr: 'piped', })); this.addBackgroundProcess(proc); return proc; } // add a process to the background list // these will be monitored and also stopped when we want to exit addBackgroundProcess(process: ChildProcess) { this.processes.push(process); process.status.then(status => { if (this.shuttingDown) return; console.log('Process', process.proc.pid, 'ended:', status.code); }); } async shutdown() { this.shuttingDown = true; // signals.forEach(x => x.dispose()); // prevent future interupts const processPromises = this.processes .map(p => p.status.catch(() => {})); for (const process of this.processes) { console.log(' ', clr.gray(clr.bold('kill')), clr.gray(process.proc.pid.toString(10)), clr.blue(`# ${this.formatArgs(['TODO', 'process.spawnargs'])}`)); process.cancel(); } await Promise.all(processPromises); for (const dir of this.tempDirs) { await this.execUtility('rm', ['-rf', dir]); } } } import { ReadLineTransformer, } from 'https://deno.land/x/[email protected]/lib/stream-transformers.ts'; class ChildProcess { proc: Deno.Process<Deno.RunOptions & {stdout: 'piped', stderr: 'piped'}>; status: Promise<Deno.ProcessStatus>; constructor(proc: Deno.Process<Deno.RunOptions & {stdout: 'piped', stderr: 'piped'}>) { this.proc = proc; this.status = proc.status(); this.status.then(x => { console.log(' ', 'child', proc.pid, 'exited with', x.code); }) } cancel() { this.proc.kill(15); // SIGTERM } perLine() { const combined = readerFromIterable(combine([ iter(this.proc.stderr, {bufSize: 1024}), iter(this.proc.stdout, {bufSize: 1024}), ])); return readableStreamFromReader({ read: combined.read.bind(combined), close: this.cancel.bind(this), }).pipeThrough(new ReadLineTransformer('utf-8')); } async stdout() { return new TextDecoder('utf-8').decode(await this.proc.output()); } }
package com.algaworks.algafood.api.v2.model.input; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import lombok.Getter; import lombok.Setter; @Getter @Setter public class CidadeInputV2 { @NotBlank private String nomeCidade; @NotNull private Long idEstado; }
def activity(self, comp): stats = dict() stats['component'] = comp if comp in self.db_activity: data = self.db_activity[comp] del self.db_activity[comp] stats['activity'] = data else: stats['activity'] = [] yield self.session.publish('com.bigsql.onActivity', stats)
/** * Make a combo box to select vertical separation of wind barbs, in m * @return component for vertical interval selection */ protected JComponent doMakeVerticalIntervalComponent() { JComboBox intervalBox = GuiUtils.createValueBox(this, CMD_INTERVAL, (int) verticalIntervalValue, Misc.createIntervalList(250, 1000, 250), true); return GuiUtils.label(" Vertical interval (m): ", GuiUtils.wrap(intervalBox)); }
<reponame>fang19911030/Leetcode public class Solution{ public int[][] updateMetrix(int[][]matrix){ int m = matrix.length; int n = matrix[0].length; Queue<int[]>queue = new LinkedList<>(); for(int i=0;i<m;i++){ for(int j=0;j<n;j++){ if(matrix[i][j]==0){ queue.offer(new int[]{i,j}) }else{ matrix[i][j] = Integer.MAX_VALUE; } } } int[][] dirs = {{-1,0},{1,0},{0,-1},{0,1}}; while(!queue.isEmpty()){ int[] cell = queue.poll(); for(int[] d:dirs){ int r = cell[0]+d[0]; int c = cell[1]+d[1]; if(r<0 || r>=m || c<0 || c>=n || matrix[r][c]<=matrix[col[0]][col[1]]+1){ continue; } queue.offer(new int[]{r,c}); matrix.[r][c] = matrix[col[0]][col[1]]+1; } } return matrix; } }
/** * Parses the {@link Reader}'s contents assuming it is in the <i>default * syntax</i>. * * @param r the {@link Reader} whose contents are assumed to be a JAAS Login * Configuration Module file written in the <i>default syntax</i>. * @throws IOException if an exception occurs while parsing the input. */ public void parse(Reader r) throws IOException { initParser(r); while (parseAppOrOtherEntry()) { /* do nothing */ } }
/** * Created by patrice on 09.04.16. */ public class GeoJsonItemPath extends GeoJsonItem { private Deque<GeoJsonItemPoint> points = new LinkedList<>(); private double distance = 0; private long elevationGain; private long verticalDrop; public GeoJsonItemPath() { } public GeoJsonItemPath(String name) { super(name); } public void addPoint(double longitude, double latitude) { points.add(new GeoJsonItemPoint(longitude, latitude)); } public Deque<GeoJsonItemPoint> getPoints() { return points; } public double getDistance() { return distance; } public void setDistance(double distance) { this.distance = distance; } public long getElevationGain() { return elevationGain; } public void setElevationGain(long elevationGain) { this.elevationGain = elevationGain; } public long getVerticalDrop() { return verticalDrop; } public void setVerticalDrop(long verticalDrop) { this.verticalDrop = verticalDrop; } public class GeoJsonItemPoint { private double longitude; private double latitude; private int altitude; public GeoJsonItemPoint() { } public GeoJsonItemPoint(double longitude, double latitude) { this.longitude = longitude; this.latitude = latitude; } public void setLongitude(double longitude) { this.longitude = longitude; } public double getLongitude() { return longitude; } public void setLatitude(double latitude) { this.latitude = latitude; } public double getLatitude() { return latitude; } public int getAltitude() { return altitude; } public void setAltitude(int altitude) { this.altitude = altitude; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GeoJsonItemPoint that = (GeoJsonItemPoint) o; return Double.compare(that.longitude, longitude) == 0 && Double.compare(that.latitude, latitude) == 0; } @Override public int hashCode() { int result; long temp; temp = Double.doubleToLongBits(longitude); result = (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(latitude); result = 31 * result + (int) (temp ^ (temp >>> 32)); return result; } @Override public String toString() { return "[" + longitude + ", " + latitude + ']'; } } @Override public String toString() { if (points == null || points.isEmpty()) { return "GeoJsonItemPath[EMPTY]"; } return getName() + points.getFirst() + "->" + points.getLast() + ']'; } }
/** * Operation used to denote the creation of a limit order on the blockchain. * * The blockchain will atempt to sell amount_to_sell.asset_id for as much min_to_receive.asset_id as possible. * The fee will be paid by the seller's account. Market fees will apply as specified by the issuer of both the * selling asset and the receiving asset as a percentage of the amount exchanged. * * If either the selling asset or the receiving asset is white list restricted, the order will only be created * if the seller is on the white list of the restricted asset type. * * Market orders are matched in the order they are included in the block chain. */ public class LimitOrderCreateOperation extends BaseOperation { // Number of bytes used for the expiration field. private final int EXPIRATION_BYTE_LENGTH = 4; // Constants used in the JSON representation public static final String KEY_SELLER = "seller"; public static final String KEY_AMOUNT_TO_SELL = "amount_to_sell"; public static final String KEY_MIN_TO_RECEIVE = "min_to_receive"; public static final String KEY_EXPIRATION = "expiration"; public static final String KEY_FILL_OR_KILL = "fill_or_kill"; // Inner fields of a limit order private AssetAmount fee; private UserAccount seller; private AssetAmount amountToSell; private AssetAmount minToReceive; private int expiration; private boolean fillOrKill; /** * @param seller: Id of the seller * @param toSell: Id of the asset to sell * @param minToReceive: The minimum amount of the asset to receive * @param expiration: Expiration in seconds * @param fillOrKill: If this flag is set the entire order must be filled or the operation is rejected. */ public LimitOrderCreateOperation(UserAccount seller, AssetAmount toSell, AssetAmount minToReceive, int expiration, boolean fillOrKill){ super(OperationType.LIMIT_ORDER_CREATE_OPERATION); this.seller = seller; this.amountToSell = toSell; this.minToReceive = minToReceive; this.expiration = expiration; this.fillOrKill = fillOrKill; } @Override public String toJsonString() { return null; } @Override public JsonElement toJsonObject() { JsonArray array = (JsonArray) super.toJsonObject(); JsonObject jsonObject = new JsonObject(); if(fee != null) jsonObject.add(KEY_FEE, fee.toJsonObject()); jsonObject.addProperty(KEY_SELLER, seller.getObjectId()); jsonObject.add(KEY_AMOUNT_TO_SELL, amountToSell.toJsonObject()); jsonObject.add(KEY_MIN_TO_RECEIVE, minToReceive.toJsonObject()); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(Util.TIME_DATE_FORMAT); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); jsonObject.addProperty(KEY_EXPIRATION, simpleDateFormat.format(new Date(((long) expiration) * 1000))); jsonObject.addProperty(KEY_FILL_OR_KILL, this.fillOrKill ? "true" : "false"); jsonObject.add(KEY_EXTENSIONS, new JsonArray()); array.add(jsonObject); return array; } @Override public void setFee(AssetAmount assetAmount) { this.fee = assetAmount; } public AssetAmount getFee(){ return this.fee; } public UserAccount getSeller() { return seller; } public void setSeller(UserAccount seller) { this.seller = seller; } public AssetAmount getAmountToSell() { return amountToSell; } public void setAmountToSell(AssetAmount amountToSell) { this.amountToSell = amountToSell; } public AssetAmount getMinToReceive() { return minToReceive; } public void setMinToReceive(AssetAmount minToReceive) { this.minToReceive = minToReceive; } public int getExpiration() { return expiration; } public void setExpiration(int expiration) { this.expiration = expiration; } public boolean isFillOrKill() { return fillOrKill; } public void setFillOrKill(boolean fillOrKill) { this.fillOrKill = fillOrKill; } @Override public byte[] toBytes() { byte[] feeBytes = this.fee.toBytes(); byte[] sellerBytes = this.seller.toBytes(); byte[] amountBytes = this.amountToSell.toBytes(); byte[] minAmountBytes = this.minToReceive.toBytes(); ByteBuffer buffer = ByteBuffer.allocate(EXPIRATION_BYTE_LENGTH); buffer.putInt(this.expiration); byte[] expirationBytes = Util.revertBytes(buffer.array()); byte[] fillOrKill = this.fillOrKill ? new byte[]{ 0x1 } : new byte[]{ 0x0 }; byte[] extensions = this.extensions.toBytes(); return Bytes.concat(feeBytes, sellerBytes, amountBytes, minAmountBytes, expirationBytes, fillOrKill, extensions); } /** * Deserializer used to convert the JSON-formatted representation of a limit_order_create_operation * into its java object version. * * The following is an example of the serialized form of this operation: * * [ * 1, * { * "fee": { * "amount": 14676, * "asset_id": "1.3.0" * }, * "seller": "1.2.36449", * "amount_to_sell": { * "amount": 945472, * "asset_id": "1.3.850" * }, * "min_to_receive": { * "amount": 4354658, * "asset_id": "1.3.861" * }, * "expiration": "1963-11-25T06:31:44", * "fill_or_kill": false, * "extensions": [] * } * ] * * */ public static class LimitOrderCreateDeserializer implements JsonDeserializer<LimitOrderCreateOperation> { @Override public LimitOrderCreateOperation deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { if(json.isJsonArray()){ // This block is used just to check if we are in the first step of the deserialization // when we are dealing with an array. JsonArray serializedTransfer = json.getAsJsonArray(); if(serializedTransfer.get(0).getAsInt() != OperationType.LIMIT_ORDER_CREATE_OPERATION.ordinal()){ // If the operation type does not correspond to a transfer operation, we return null return null; }else{ // Calling itself recursively, this is only done once, so there will be no problems. return context.deserialize(serializedTransfer.get(1), LimitOrderCreateOperation.class); } }else{ // This block is called in the second recursion and takes care of deserializing the // limit order data itself. JsonObject jsonObject = json.getAsJsonObject(); AssetAmount fee = context.deserialize(jsonObject.get(KEY_FEE), AssetAmount.class); UserAccount seller = context.deserialize(jsonObject.get(KEY_SELLER), UserAccount.class); AssetAmount amountToSell = context.deserialize(jsonObject.get(KEY_AMOUNT_TO_SELL), AssetAmount.class); AssetAmount minToReceive = context.deserialize(jsonObject.get(KEY_MIN_TO_RECEIVE), AssetAmount.class); String expiration = jsonObject.get(KEY_EXPIRATION).getAsString(); boolean fillOrKill = jsonObject.get(KEY_FILL_OR_KILL).getAsBoolean(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(Util.TIME_DATE_FORMAT); int expirationPosix = 0; try { Date expirationDate = simpleDateFormat.parse(expiration); expirationPosix = (int) (expirationDate.getTime() / 1000); } catch (ParseException e) { e.printStackTrace(); } // Creating an instance of the LimitOrderCreateOperation and setting the fee LimitOrderCreateOperation operation = new LimitOrderCreateOperation(seller, amountToSell, minToReceive, expirationPosix, fillOrKill); operation.setFee(fee); return operation; } } } }
def convert_sfh(self, agebins, mformed, epsilon=1e-4, maxage=None): agebins_yrs = 10**agebins.T dt = agebins_yrs[1, :] - agebins_yrs[0, :] bin_edges = np.unique(agebins_yrs) if maxage is None: maxage = agebins_yrs.max() t = np.concatenate((bin_edges * (1.-epsilon), bin_edges * (1+epsilon))) t.sort() t = t[1:-1] fsps_time = maxage - t sfr = mformed / dt sfrout = np.zeros_like(t) sfrout[::2] = sfr sfrout[1::2] = sfr return (fsps_time / 1e9)[::-1], sfrout[::-1], maxage / 1e9
/** Retrieves body of a vertex shader that should be used by the test program. * * @return Requested string. **/ std::string FunctionalTest17::getVertexShaderBody() const { return "#version 400\n" "\n" "#extension GL_ARB_shader_subroutine : require\n" "\n" "out VS_DATA\n" "{\n" " vec4 vs_data;\n" "} result;\n" "\n" "subroutine void subroutineTypeVS(out vec4 result);\n" "\n" "subroutine(subroutineTypeVS) void subroutine1(out vec4 result)\n" "{\n" " result = vec4(1, 2, 3, 4);\n" "}\n" "\n" "subroutine uniform subroutineTypeVS function;\n" "\n" "void main()\n" "{\n" " function(result.vs_data);\n" "}\n"; }
// Fill out your copyright notice in the Description page of Project Settings. #include "MainGameMode.h" #include "EngineUtils.h" #include "Components/PointLightComponent.h" #include "Components/SpotLightComponent.h" #include "UObject/UObjectIterator.h" #include "DrawDebugHelpers.h" #include "UObject/ConstructorHelpers.h" #include "BasicFloor.h" #include "BasicWall.h" #include "BasicDoor.h" #include "WallLamp.h" #include "Flashlight.h" #include "Lighter.h" #include "Doorcard.h" #include "ExitVolume.h" #include "LabPassage.h" #include "LabRoom.h" // #include "LabHallway.h" #include "DarknessController.h" #include "Darkness.h" #include "MainPlayerController.h" #include "MainCharacter.h" #include "GameHUD.h" // For on screen debug #include "EngineGlobals.h" #include "Engine/Engine.h" // Probabilities const float AMainGameMode::ReshapeDarknessOnEnterProbability = 0.7f; const float AMainGameMode::ReshapeDarknessOnTickProbability = 0.6f; const float AMainGameMode::LampsTurnOnOnEnterProbability = 0.6f; const float AMainGameMode::LampsTurnOffPerSecondProbability = 0.04f; const float AMainGameMode::AllLampsInRoomTurnOffProbability = 0.15f; const float AMainGameMode::ConnectToOtherRoomProbability = 0.8f; const float AMainGameMode::DeletePassageToFixProbability = 0.0f; // TODO increase or delete? const float AMainGameMode::PassageIsDoorProbability = 0.45f; const float AMainGameMode::DoorIsNormalProbability = 1.f; // 0.90f; TODO decrease if we need some big doors const float AMainGameMode::DoorIsExitProbability = 0.17f; const float AMainGameMode::SpawnFlashlightProbability = 0.17f; // TODO decrease const float AMainGameMode::SpawnDoorcardProbability = 0.28f; const float AMainGameMode::MakeRoomSpecialForCardProbability = 0.0f; // TODO increase or delete? const float AMainGameMode::BlueProbability = 0.14f; const float AMainGameMode::GreenProbability = 0.12f; const float AMainGameMode::YellowProbability = 0.10f; const float AMainGameMode::RedProbability = 0.08f; const float AMainGameMode::BlackProbability = 0.06f; // Other constants const float AMainGameMode::ReshapeDarknessTick = 4.f; // Returns true with certain probability bool AMainGameMode::RandBool(const float probability) { float temp = FMath::FRand(); temp = temp >= 1.f ? 0.f : temp; return temp < probability; } // Returns random color with certain probabilities FLinearColor AMainGameMode::RandColor() { // TODO make colors constants somewhere // Blue float temp = FMath::FRand(); if (temp <= BlueProbability) return FLinearColor::FromSRGBColor(FColor(30, 144, 239)); // Green temp -= BlueProbability; if (temp <= GreenProbability) return FLinearColor::Green; // Yellow temp -= GreenProbability; if (temp <= YellowProbability) return FLinearColor::Yellow; // Red temp -= YellowProbability; if (temp <= RedProbability) return FLinearColor::Red; // Black temp -= RedProbability; if (temp <= BlackProbability) return FLinearColor::Black; // White return FLinearColor::White; } // Returns random direction EDirectionEnum AMainGameMode::RandDirection() { int direction = FMath::RandRange(0, 3); if (direction == 0) return EDirectionEnum::VE_Left; if (direction == 1) return EDirectionEnum::VE_Right; if (direction == 2) return EDirectionEnum::VE_Down; return EDirectionEnum::VE_Up; } // Returns the light level and the location of the brightest light float AMainGameMode::GetLightingAmount(FVector& lightLoc, const AActor* actor, const bool sixPoints, const float sixPointsRadius, const bool fourMore, const bool returnFirstPositive) { if (!actor) return 0.0f; return GetLightingAmount(lightLoc, actor, actor->GetActorLocation(), sixPoints, sixPointsRadius, fourMore, returnFirstPositive); } float AMainGameMode::GetLightingAmount(FVector & lightLoc, const FVector location, const bool sixPoints, const float sixPointsRadius, const bool fourMore, const bool returnFirstPositive) { return GetLightingAmount(lightLoc, nullptr, location, sixPoints, sixPointsRadius, fourMore, returnFirstPositive); } float AMainGameMode::GetLightingAmount(FVector & lightLoc, const TArray<FVector> locations, const bool returnFirstPositive) { return GetLightingAmount(lightLoc, nullptr, locations, returnFirstPositive); } float AMainGameMode::GetLightingAmount(FVector& lightLoc, const AActor* actor, const FVector location, const bool sixPoints, const float sixPointsRadius, const bool fourMore, const bool returnFirstPositive) { TArray<FVector> locations; locations.Add(location); if (sixPoints) { // We add six locations around the point locations.Add(location + FVector::UpVector * sixPointsRadius); locations.Add(location - FVector::UpVector * sixPointsRadius); locations.Add(location + FVector::RightVector * sixPointsRadius); locations.Add(location - FVector::RightVector * sixPointsRadius); locations.Add(location + FVector::ForwardVector * sixPointsRadius); locations.Add(location - FVector::ForwardVector * sixPointsRadius); // We add four more locations around the point (diagonally) if (fourMore) { FVector temp = FVector(1, 1, 0); temp.Normalize(); locations.Add(location + temp * sixPointsRadius); locations.Add(location - temp * sixPointsRadius); temp = FVector(-1, 1, 0); temp.Normalize(); locations.Add(location + temp * sixPointsRadius); locations.Add(location - temp * sixPointsRadius); } } return GetLightingAmount(lightLoc, actor, locations, returnFirstPositive); } float AMainGameMode::GetLightingAmount(FVector& lightLoc, const AActor* actor, const TArray<FVector> locations, const bool returnFirstPositive) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::GetLightingAmount")); float result = 0.0f; // First we find all the point lights (spot lights count as point lights) TArray<UPointLightComponent*> pointLights; UWorld* gameWorld = GetWorld(); for (TObjectIterator<UPointLightComponent> Itr; Itr; ++Itr) { // World Check if (Itr->GetWorld() != gameWorld) continue; // We don't care about invisible lights if ((!Itr->IsVisible()) || Itr->bHiddenInGame || Itr->GetOwner()->bHidden) continue; pointLights.Add(*Itr); } // We find local results for all locations for (FVector location : locations) { if (bShowDebug) DrawDebugPoint(gameWorld, location, 5, FColor::Red); // This will be used for the spot lights FBoxSphereBounds bounds = FBoxSphereBounds(location, FVector(1, 1, 1), 1); // We take the highest local result among lights for (UPointLightComponent* lightComp : pointLights) { // First we check if it's a spotlight and whether location is in the cone USpotLightComponent* spotLight = Cast<USpotLightComponent>(lightComp); if (spotLight && !spotLight->AffectsBounds(bounds)) continue; FVector lightLocation = lightComp->GetComponentLocation(); float distance = FVector::Dist(location, lightLocation); float lightRadius = lightComp->AttenuationRadius; // UE_LOG(LogTemp, Warning, TEXT("dist: %f, rad: %f"), distance, lightRadius); if (distance > lightRadius) continue; // If location could be lit if (CanSee(actor, location, lightLocation)) { /*if (bShowDebug) DrawDebugLine(gameWorld, location, lightLocation, FColor::Cyan);*/ // 1 if near the edge of light, 0 if in center float temp = distance / lightRadius; // We take into account the inverse squared falloff // temp = FMath::Pow(temp, 0.5f); temp = FMath::Pow(temp, 2.f); // Now it's 0 near the edge and 1 in center temp = 1 - temp; // Finally we take intensity into account temp *= lightComp->Intensity / 150.f; // We also take color into account FLinearColor lightColor = lightComp->GetLightColor(); temp *= FMath::Pow((lightColor.R * lightColor.R + lightColor.G * lightColor.G + lightColor.B * lightColor.B) / 3.0f, 0.35f); // 0.5f); // UE_LOG(LogTemp, Warning, TEXT("%f"), temp); // It always counts the brightest light if (temp > result) { result = temp; lightLoc = lightLocation; if (returnFirstPositive) return result; } } } } // UE_LOG(LogTemp, Warning, TEXT("Final %f"), result); return result; } // Returns true if one actor/location can see other actor/location // Its not about visibility to human eye, doesn't take light into account bool AMainGameMode::CanSee(const AActor * actor1, const AActor * actor2) { if (!actor1 || !actor2) return false; return CanSee(actor1, actor1->GetActorLocation(), actor2, actor2->GetActorLocation()); } bool AMainGameMode::CanSee(const FVector location1, const AActor * actor2) { if (!actor2) return false; return CanSee(nullptr, location1, actor2, actor2->GetActorLocation()); } bool AMainGameMode::CanSee(const AActor * actor1, const FVector location2) { if (!actor1) return false; return CanSee(actor1, actor1->GetActorLocation(), nullptr, location2); } bool AMainGameMode::CanSee(const FVector location1, const FVector location2) { return CanSee(nullptr, location1, nullptr, location2); } bool AMainGameMode::CanSee(const AActor * actor1, const FVector location1, const AActor * actor2) { if (!actor2) return false; return CanSee(actor1, location1, actor2, actor2->GetActorLocation()); } bool AMainGameMode::CanSee(const AActor * actor1, const AActor * actor2, const FVector location2) { if (!actor1) return false; return CanSee(actor1, actor1->GetActorLocation(), actor2, location2); } bool AMainGameMode::CanSee(const AActor * actor1, const FVector location1, const FVector location2) { return CanSee(actor1, location1, nullptr, location2); } bool AMainGameMode::CanSee(const FVector location1, const AActor * actor2, const FVector location2) { return CanSee(nullptr, location1, actor2, location2); } bool AMainGameMode::CanSee(const AActor * actor1, const FVector location1, const AActor * actor2, const FVector location2) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::CanSee")); UWorld* gameWorld = GetWorld(); if (!gameWorld) return false; FCollisionQueryParams params = FCollisionQueryParams(FName(TEXT("LightTrace")), true); if (actor1) { params.AddIgnoredActor(actor1); TInlineComponentArray<UActorComponent*> components; actor1->GetComponents(components, true); for (UActorComponent* component : components) params.AddIgnoredComponent(Cast<UPrimitiveComponent>(component)); } if (actor2) { params.AddIgnoredActor(actor2); TInlineComponentArray<UActorComponent*> components; actor2->GetComponents(components, true); for (UActorComponent* component : components) params.AddIgnoredComponent(Cast<UPrimitiveComponent>(component)); } if (bShowDebug) { DrawDebugPoint(gameWorld, location1, 5, FColor::Red); DrawDebugPoint(gameWorld, location2, 5, FColor::Red); } bool bHit = gameWorld->LineTraceTestByChannel(location1, location2, ECC_Visibility, params); // TODO delete if affects performance too much // This is a line trace in a different direction helpful in cases when location1 is positioned inside something like a wall which is ignored by the line trace if (!bHit) bHit = gameWorld->LineTraceTestByChannel(location2, location1, ECC_Visibility, params); if (bShowDebug && !bHit) DrawDebugLine(gameWorld, location1, location2, FColor::Cyan); return !bHit; } // Returns the light level for a passage float AMainGameMode::GetPassageLightingAmount(LabPassage * passage, bool oneSide, bool innerSide, const bool returnFirstPositive) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::GetPassageLightingAmount")); if (!passage) return 0.f; TArray<FVector> locations; float centerX, centerY; GridToWorld(passage->BotLeftX, passage->BotLeftY, passage->GridDirection == EDirectionEnum::VE_Up || passage->GridDirection == EDirectionEnum::VE_Down ? passage->Width : 1, passage->GridDirection == EDirectionEnum::VE_Up || passage->GridDirection == EDirectionEnum::VE_Down ? 1 : passage->Width, centerX, centerY); FVector center = FVector(centerX, centerY, 30); // Small offset to avoid floor // We create vectors for points assuming GridDirection is Up and innerSide is true // Then we rotate them based on actual direction and bool value TArray<FVector> localPoints; // localPoints.Add(FVector(-25, 0, 0)); int step = 2; // TODO make constant for (int x = step; 2 * x - step < passage->Width; x += step) { localPoints.Add(FVector(-25, x * 50.f - step * 50.f / 2, 0)); localPoints.Add(FVector(-25, -x * 50.f + step * 50.f / 2, 0)); } switch (passage->GridDirection) { case EDirectionEnum::VE_Up: if (innerSide) break; for (int i = 0; i < localPoints.Num(); ++i) localPoints[i] = localPoints[i].RotateAngleAxis(180, FVector(0, 0, 1)); break; case EDirectionEnum::VE_Down: if (!innerSide) break; for (int i = 0; i < localPoints.Num(); ++i) localPoints[i] = localPoints[i].RotateAngleAxis(180, FVector(0, 0, 1)); break; case EDirectionEnum::VE_Right: for (int i = 0; i < localPoints.Num(); ++i) localPoints[i] = localPoints[i].RotateAngleAxis(innerSide ? 90 : -90, FVector(0, 0, 1)); break; case EDirectionEnum::VE_Left: for (int i = 0; i < localPoints.Num(); ++i) localPoints[i] = localPoints[i].RotateAngleAxis(innerSide ? -90 : 90, FVector(0, 0, 1)); break; } locations.Add(center); for (FVector localPoint : localPoints) locations.Add(center + localPoint); if(!oneSide) for (FVector localPoint : localPoints) locations.Add(center - localPoint); FVector lightLoc; return GetLightingAmount(lightLoc, locations, returnFirstPositive); } // Returns true if passage is illuminated bool AMainGameMode::IsPassageIlluminated(LabPassage * passage, bool oneSide, bool innerSide) { return GetPassageLightingAmount(passage, oneSide, innerSide, true) > 0.f; } // Returns the light level for a room float AMainGameMode::GetRoomLightingAmount(LabRoom * room, const bool returnFirstPositive) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::GetRoomLightingAmount")); if (!room) return 0.f; float light = 0.f; // for (LabPassage* passage : room->Passages) for (int i = 0; i < room->Passages.Num(); ++i) { LabPassage* passage = room->Passages[i]; if (!passage) continue; // TODO shouldn't always be oneSide float temp = GetPassageLightingAmount(passage, true, passage->From == room, returnFirstPositive); light = temp > light ? temp : light; if (returnFirstPositive && light > 0.f) return light; } TArray<FVector> locations; int step = 2; // TODO make constant for (int x = step; x < room->SizeX - 1; x += step) { for (int y = step; y < room->SizeY - 1; y += step) { float pointX, pointY; GridToWorld(room->BotLeftX + x, room->BotLeftY + y, pointX, pointY); FVector point = FVector(pointX, pointY, 30); // Z is set to avoid interferance with floor locations.Add(point); } } FVector lightLoc; float temp = GetLightingAmount(lightLoc, locations, returnFirstPositive); light = temp > light ? temp : light; return light; } // Returns true if the room is in light bool AMainGameMode::IsRoomIlluminated(LabRoom * room) { return SpawnedRoomObjects.Contains(room) && GetRoomLightingAmount(room, true) > 0.f; } // Changes world location into grid location void AMainGameMode::WorldToGrid(const float worldX, const float worldY, int & gridX, int & gridY) { // We reverse x and y gridX = worldY / 50 + (worldY >= 0 ? 0 : -1); gridY = worldX / 50 + (worldX >= 0 ? 0 : -1); } // Changes grid location into world location void AMainGameMode::GridToWorld(const int gridX, const int gridY, float & worldX, float & worldY) { GridToWorld(gridX, gridY, 1, 1, worldX, worldY); } void AMainGameMode::GridToWorld(const int botLeftX, const int botLeftY, const int sizeX, const int sizeY, float & worldX, float & worldY) { // We reverse x and y worldX = botLeftY * 50.f + sizeY * 25.f; // -25.f worldY = botLeftX * 50.f + sizeX * 25.f; // -25.f } // Places an object on the map // TODO return false if can't place? void AMainGameMode::PlaceObject(TScriptInterface<IPlaceable> object, const int botLeftX, const int botLeftY, const EDirectionEnum direction) { PlaceObject(object, FIntVector(botLeftX, botLeftY, 0), direction); } void AMainGameMode::PlaceObject(TScriptInterface<IPlaceable> object, const int botLeftX, const int botLeftY, const int sizeX, const int sizeY) { PlaceObject(object, FIntVector(botLeftX, botLeftY, 0), EDirectionEnum::VE_Up, sizeX, sizeY); } void AMainGameMode::PlaceObject(TScriptInterface<IPlaceable> object, const int botLeftX, const int botLeftY, const int sizeX, const int sizeY, const int sizeZ) { PlaceObject(object, FIntVector(botLeftX, botLeftY, 0), EDirectionEnum::VE_Up, sizeX, sizeY, sizeZ); } void AMainGameMode::PlaceObject(TScriptInterface<IPlaceable> object, const int botLeftX, const int botLeftY, const EDirectionEnum direction, const int sizeX, const int sizeY) { PlaceObject(object, FIntVector(botLeftX, botLeftY, 0), direction, sizeX, sizeY); } void AMainGameMode::PlaceObject(TScriptInterface<IPlaceable> object, const int botLeftX, const int botLeftY, const EDirectionEnum direction, const int sizeX, const int sizeY, const int sizeZ) { PlaceObject(object, FIntVector(botLeftX, botLeftY, 0), direction, sizeX, sizeY, sizeZ); } void AMainGameMode::PlaceObject(TScriptInterface<IPlaceable> object, const FIntVector botLeftLoc, const EDirectionEnum direction) { UObject* obj = object->_getUObject(); object->Execute_Place(obj, botLeftLoc, direction); } void AMainGameMode::PlaceObject(TScriptInterface<IPlaceable> object, const FIntVector botLeftLoc, const int sizeX, const int sizeY) { PlaceObject(object, botLeftLoc, EDirectionEnum::VE_Up, sizeX, sizeY); } void AMainGameMode::PlaceObject(TScriptInterface<IPlaceable> object, const FIntVector botLeftLoc, const int sizeX, const int sizeY, const int sizeZ) { PlaceObject(object, botLeftLoc, EDirectionEnum::VE_Up, sizeX, sizeY, sizeZ); } void AMainGameMode::PlaceObject(TScriptInterface<IPlaceable> object, const FIntVector botLeftLoc, const EDirectionEnum direction, const int sizeX, const int sizeY) { UObject* obj = object->_getUObject(); object->Execute_SetSizeXY(obj, sizeX, sizeY); object->Execute_Place(obj, botLeftLoc, direction); } void AMainGameMode::PlaceObject(TScriptInterface<IPlaceable> object, const FIntVector botLeftLoc, const EDirectionEnum direction, const int sizeX, const int sizeY, const int sizeZ) { UObject* obj = object->_getUObject(); object->Execute_SetSize(obj, FIntVector(sizeX, sizeY, sizeZ)); object->Execute_Place(obj, botLeftLoc, direction); } // Returns by reference character's location on the grid void AMainGameMode::GetCharacterLocation(int & x, int & y) { FVector characterLocation = MainPlayerController->GetCharacter()->GetActorLocation(); WorldToGrid(characterLocation.X, characterLocation.Y, x, y); } // Returns the room the character is in LabRoom * AMainGameMode::GetCharacterRoom() { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::GetCharacterRoom")); int x, y; GetCharacterLocation(x, y); if (!ActualPlayerRoom || !PlayerRoom) MapSpaceIsFree(false, true, x, y, 1, 1, ActualPlayerRoom); else { // On left passage if (PlayerRoom->BotLeftX == x) MapSpaceIsFree(false, true, x - 1, y, 1, 1, ActualPlayerRoom); // On bottom passage else if (PlayerRoom->BotLeftY == y) MapSpaceIsFree(false, true, x, y - 1, 1, 1, ActualPlayerRoom); // On right passage else if (PlayerRoom->BotLeftX + PlayerRoom->SizeX - 1 == x) MapSpaceIsFree(false, true, x + 1, y, 1, 1, ActualPlayerRoom); // On top passage else if (PlayerRoom->BotLeftY + PlayerRoom->SizeY - 1 == y) MapSpaceIsFree(false, true, x, y + 1, 1, 1, ActualPlayerRoom); // Not on the passage else MapSpaceIsFree(false, true, x, y, 1, 1, ActualPlayerRoom); } /*if (!(ActualPlayerRoom && ActualPlayerRoom->BotLeftX <= x && ActualPlayerRoom->BotLeftY <= y && ActualPlayerRoom->BotLeftX + ActualPlayerRoom->SizeX - 1 >= x && ActualPlayerRoom->BotLeftY + ActualPlayerRoom->SizeY - 1 >= y)) MapSpaceIsFree(false, true, x, y, 1, 1, ActualPlayerRoom);*/ int d = 1; // Used to avoid situations when character is stuck in passage // Still in last room if (PlayerRoom && PlayerRoom->BotLeftX - d <= x && PlayerRoom->BotLeftY - d <= y && PlayerRoom->BotLeftX + PlayerRoom->SizeX - 1 + d >= x && PlayerRoom->BotLeftY + PlayerRoom->SizeY - 1 + d >= y) return PlayerRoom; if (ActualPlayerRoom) OnEnterRoom(); // PlayerRoom, characterRoom); return PlayerRoom; } // Called when character enters new room void AMainGameMode::OnEnterRoom() // LabRoom* lastRoom, LabRoom* newRoom) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::OnEnterRoom")); LabRoom* lastRoom = PlayerRoom; PlayerRoom = ActualPlayerRoom; // UE_LOG(LogTemp, Warning, TEXT("Entered new room")); bool toActivateLamps = false; if (!VisitedRooms.Contains(PlayerRoom)) { if (!lastRoom || RandBool(LampsTurnOnOnEnterProbability)) toActivateLamps = true; // ActivateRoomLamps(PlayerRoom); VisitedRooms.Add(PlayerRoom); VisitedOverall++; } if (lastRoom) { // ReshapeDarkness(lastRoom, ReshapeDarknessDepth, false); // TODO smth about last room here } // CompleteReshapeAllDarknessAround(); // We do it before reshaping cause we may accidentally trap ourselves if we turn light on after if (toActivateLamps) ActivateRoomLamps(PlayerRoom); if(RandBool(ReshapeDarknessOnEnterProbability)) ReshapeAllDarkness(); ExpandInDepth(PlayerRoom, ExpandDepth); SpawnFillInDepth(PlayerRoom, SpawnFillDepth); } // Called when character loses all of his lives void AMainGameMode::OnLoss() { if (!bHasWon) { UE_LOG(LogTemp, Warning, TEXT("You actually lost!")); GameHUD->ShowLossMessage(); } } // Called when character is enabled to reset the map void AMainGameMode::OnCharacterEnabled() { ResetMap(); } // Called when character reached the exit void AMainGameMode::OnExitReached() { bHasWon = true; UE_LOG(LogTemp, Warning, TEXT("Reached the exit!")); GameHUD->ShowVictoryMessage(); // TODO stop character from moving? } // Called when character picks up an object to delete it from arrays without pooling void AMainGameMode::OnPickUp(TScriptInterface<class IPickupable> object) { AActor* actor = Cast<AActor>(object->_getUObject()); if (!actor) return; FVector location = actor->GetActorLocation(); int x, y; WorldToGrid(location.X, location.Y, x, y); LabRoom* room; if (!MapSpaceIsFree(false, true, x, y, 1, 1, room)) { if (SpawnedRoomObjects.Contains(room)) SpawnedRoomObjects[room].Remove(object->_getUObject()); // TODO also deallocate room space } } // Called when exit door is opened to void AMainGameMode::OnExitOpened(ABasicDoor* door) { int x, y; FVector doorLoc = door->GetActorLocation(); WorldToGrid(doorLoc.X, doorLoc.Y, x, y); if (door->GridDirection == EDirectionEnum::VE_Right) x++; else if (door->GridDirection == EDirectionEnum::VE_Left) x--; else if (door->GridDirection == EDirectionEnum::VE_Up) y++; else if (door->GridDirection == EDirectionEnum::VE_Down) y--; LabRoom* intersected; if (MapSpaceIsFree(false, true, x, y, 1, 1, intersected)) return; // Trying to find exit volume for (TScriptInterface<IDeactivatable> object : SpawnedRoomObjects[intersected]) { AExitVolume* exitVolume = Cast<AExitVolume>(object->_getUObject()); if (!exitVolume) continue; exitVolume->ActivateLight(); GameHUD->ShowHideWarning(true, FText::FromString("The light engulfs you, coming from the open exit. It's almost blinding. You feel a welcoming breeze from the passage ahead. Time to leave the lab behind")); break; } } // Gets the pool for the object/class TArray<TScriptInterface<IDeactivatable>>& AMainGameMode::GetCorrectPool(TScriptInterface<IDeactivatable> object) { UClass* cl = object->_getUObject()->GetClass(); return GetCorrectPool(cl); } TArray<TScriptInterface<IDeactivatable>>& AMainGameMode::GetCorrectPool(UClass * cl) { if (cl == BasicFloorBP) return BasicFloorPool; if (cl == BasicWallBP) return BasicWallPool; if (cl == BasicDoorBP) return BasicDoorPool; if (cl == WallLampBP) return WallLampPool; if (cl == FlashlightBP) return FlashlightPool; if (cl == DoorcardBP) return DoorcardPool; if (cl == ExitVolumeBP) return ExitVolumePool; return DefaultPool; } // Deactivates and adds to a pool void AMainGameMode::PoolObject(TScriptInterface<IDeactivatable> object) { object->Execute_SetActive(object->_getUObject(), false); GetCorrectPool(object).Add(object); } void AMainGameMode::PoolObjects(TArray<TScriptInterface<IDeactivatable>>& objects) { for (TScriptInterface<IDeactivatable> object : objects) PoolObject(object); } // Pool full parts of the lab void AMainGameMode::PoolRoom(LabRoom * room) { DespawnRoom(room); AllocatedRoomSpace.Remove(room); AllocatedRooms.Remove(room); if (PlayerRoom == room) PlayerRoom = nullptr; if (ActualPlayerRoom == room) ActualPlayerRoom = nullptr; delete room; } void AMainGameMode::PoolPassage(LabPassage* passage) { if (!SpawnedPassageObjects.Contains(passage)) return; PoolObjects(SpawnedPassageObjects[passage]); SpawnedPassageObjects.Remove(passage); // We don't delete passage from here as it's deleted during room's destruction } void AMainGameMode::PoolMap() { // Pool and clear all saved rooms TArray<LabRoom*> allRooms; AllocatedRoomSpace.GetKeys(allRooms); for (int i = allRooms.Num() - 1; i >= 0; --i) PoolRoom(allRooms[i]); // Should already be empty but we do this just in case SpawnedRoomObjects.Empty(); AllocatedRoomSpace.Empty(); ExpandedRooms.Empty(); VisitedRooms.Empty(); RoomsWithLampsOn.Empty(); AllocatedRooms.Empty(); PlayerRoom = nullptr; ActualPlayerRoom = nullptr; VisitedOverall = 0; } // Pools dark area returning all rooms that now need fixing void AMainGameMode::PoolDarkness(LabRoom * start, int depth, TArray<LabRoom*>& toFix, bool stopAtFirstIfLit) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::PoolDarkness1")); if (!start) return; TArray<LabRoom*> toPool; PoolDarkness(start, depth, toFix, toPool, stopAtFirstIfLit); for (int i = toPool.Num() - 1; i >= 0; --i) { toFix.Remove(toPool[i]); PoolRoom(toPool[i]); } } void AMainGameMode::PoolDarkness(LabRoom * start, int depth, TArray<LabRoom*>& toFix, TArray<LabRoom*>& toPool, bool stopAtFirstIfLit) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::PoolDarkness2")); if (!start) return; // If we found a room that is not in the darkness, we add it for the fix and return, same if depth <= 0 or if character is in that room if (depth <= 0 || PlayerRoom == start || ActualPlayerRoom == start || IsRoomIlluminated(start)) { toFix.AddUnique(start); if(depth <= 0 || stopAtFirstIfLit) return; } else { bool poolIt = true; // We check if room has exit cause if it does, we only want to delete it when both this room and the room behind exit are going to be pooled for (LabPassage* passage : start->Passages) { // found exit if (passage->bIsDoor && passage->Width == ExitDoorWidth) { LabRoom* otherRoom = passage->To == start ? passage->From : passage->To; if (depth - 1 <= 0 || PlayerRoom == otherRoom || ActualPlayerRoom == otherRoom || IsRoomIlluminated(otherRoom)) { poolIt = false; break; } } } if (poolIt) toPool.AddUnique(start); else { toFix.AddUnique(start); if (stopAtFirstIfLit) return; } } for (LabPassage* passage : start->Passages) { if (passage->From != start) PoolDarkness(passage->From, depth - 1, toFix, toPool, stopAtFirstIfLit); // !! else if (passage->To != start) PoolDarkness(passage->To, depth - 1, toFix, toPool, stopAtFirstIfLit); // !! } } // Pools dark area and fixes every room that needs fixing void AMainGameMode::ReshapeDarkness(LabRoom * start, int depth, bool stopAtFirstIfLit) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::ReshapeDarkness")); TArray<LabRoom*> toFix; PoolDarkness(start, depth, toFix, stopAtFirstIfLit); for (LabRoom* roomToFix : toFix) FixRoom(roomToFix); } // Reshapes darkness and expands, spawns and fills rooms void AMainGameMode::CompleteReshapeDarkness(LabRoom * start, bool stopAtFirstIfLit) { ReshapeDarkness(start, ReshapeDarknessDepth, stopAtFirstIfLit); ExpandInDepth(start, ExpandDepth); SpawnFillInDepth(start, SpawnFillDepth); } // Reshapes darkness in player room void AMainGameMode::CompleteReshapeDarknessAround() { if (!PlayerRoom) return; CompleteReshapeDarkness(PlayerRoom, false); } // Pools all dark rooms on the map and fixes every room that needs fixing void AMainGameMode::ReshapeAllDarkness() { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::ReshapeAllDarkness")); TArray<LabRoom*> allRooms; AllocatedRoomSpace.GetKeys(allRooms); TArray<LabRoom*> toPool; TArray<LabRoom*> toFix; for (LabRoom* room : allRooms) { // If we found a room that is not in the darkness, we add it for the fix and continue, same if character is in that room if (PlayerRoom == room || ActualPlayerRoom == room || IsRoomIlluminated(room)) toFix.AddUnique(room); else { bool poolIt = true; // We check if room has exit cause if it does, we only want to delete it when both this room and the room behind exit are going to be pooled for (LabPassage* passage : room->Passages) { // found exit if (passage->bIsDoor && passage->Width == ExitDoorWidth) { LabRoom* otherRoom = passage->To == room ? passage->From : passage->To; if (PlayerRoom == otherRoom || ActualPlayerRoom == otherRoom || IsRoomIlluminated(otherRoom)) { poolIt = false; break; } } } if (poolIt) toPool.AddUnique(room); else toFix.AddUnique(room); } } for (int i = toPool.Num() - 1; i >= 0; --i) PoolRoom(toPool[i]); // We want player's room to be fixed first so nothing interferes with it FixRoom(PlayerRoom); FixRoom(ActualPlayerRoom); for (LabRoom* roomToFix : toFix) FixRoom(roomToFix); } // Reshapes all darkness and also expands spawns and fills around player's room void AMainGameMode::CompleteReshapeAllDarknessAround() { if (!PlayerRoom) return; ReshapeAllDarkness(); ExpandInDepth(PlayerRoom, ExpandDepth); SpawnFillInDepth(PlayerRoom, SpawnFillDepth); } // Calls CompleteReshapeAllDarknessAround with specified probability void AMainGameMode::CompleteReshapeAllDarknessAroundOnTick() { if (RandBool(ReshapeDarknessOnTickProbability)) CompleteReshapeAllDarknessAround(); } // Tries to find a poolable object UObject* AMainGameMode::TryGetPoolable(UClass* cl) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::TryGetPoolable")); TArray<TScriptInterface<IDeactivatable>>& pool = GetCorrectPool(cl); if (pool.Num() == 0) return nullptr; int index = -1; TScriptInterface<IDeactivatable> object; if (pool != DefaultPool) index = 0; else { for (int i = 0; i < pool.Num(); ++i) { TScriptInterface<IDeactivatable> temp = pool[i]; if (temp->_getUObject()->GetClass() == cl) { index = i; break; } } } if (index < 0) return nullptr; object = pool[index]; UObject* obj = object->_getUObject(); // object->Execute_SetActive(obj, true); pool.RemoveAt(index); return obj; } // Spawn specific objects ABasicFloor* AMainGameMode::SpawnBasicFloor(const int botLeftX, const int botLeftY, const int sizeX, const int sizeY, LabRoom* room) { ABasicFloor* floor = Cast<ABasicFloor>(TryGetPoolable(BasicFloorBP)); if (!floor) { floor = GetWorld()->SpawnActor<ABasicFloor>(BasicFloorBP); floor->Execute_SetActive(floor, false); } PlaceObject(floor, botLeftX, botLeftY, sizeX, sizeY); floor->Execute_SetActive(floor, true); if (room && SpawnedRoomObjects.Contains(room)) SpawnedRoomObjects[room].Add(floor); // UE_LOG(LogTemp, Warning, TEXT("Spawned a basic floor")); return floor; } ABasicFloor* AMainGameMode::SpawnBasicFloor(const int botLeftX, const int botLeftY, const int sizeX, const int sizeY, LabPassage* passage) { ABasicFloor* floor = SpawnBasicFloor(botLeftX, botLeftY, sizeX, sizeY); if (passage && SpawnedPassageObjects.Contains(passage)) SpawnedPassageObjects[passage].Add(floor); return floor; } ABasicWall* AMainGameMode::SpawnBasicWall(const int botLeftX, const int botLeftY, const int sizeX, const int sizeY, LabRoom* room) { ABasicWall* wall = Cast<ABasicWall>(TryGetPoolable(BasicWallBP)); if (!wall) { wall = GetWorld()->SpawnActor<ABasicWall>(BasicWallBP); wall->Execute_SetActive(wall, false); } PlaceObject(wall, botLeftX, botLeftY, sizeX, sizeY); wall->Execute_SetActive(wall, true); if (room && SpawnedRoomObjects.Contains(room)) SpawnedRoomObjects[room].Add(wall); // UE_LOG(LogTemp, Warning, TEXT("Spawned a basic wall")); return wall; } ABasicDoor * AMainGameMode::SpawnBasicDoor(const int botLeftX, const int botLeftY, const EDirectionEnum direction, const FLinearColor color, const int width, LabPassage* passage) { ABasicDoor* door = Cast<ABasicDoor>(TryGetPoolable(BasicDoorBP)); if (!door) { door = GetWorld()->SpawnActor<ABasicDoor>(BasicDoorBP); door->Execute_SetActive(door, false); } door->ResetDoor(width == ExitDoorWidth); // Clothes the door if it was open door->DoorColor = color; // Sets door's color PlaceObject(door, botLeftX, botLeftY, direction, width); door->Execute_SetActive(door, true); if (passage && SpawnedPassageObjects.Contains(passage)) SpawnedPassageObjects[passage].Add(door); // UE_LOG(LogTemp, Warning, TEXT("Spawned a basic door")); return door; } AWallLamp * AMainGameMode::SpawnWallLamp(const int botLeftX, const int botLeftY, const EDirectionEnum direction, const FLinearColor color, const int width, LabRoom* room) { AWallLamp* lamp = Cast<AWallLamp>(TryGetPoolable(WallLampBP)); if (!lamp) { lamp = GetWorld()->SpawnActor<AWallLamp>(WallLampBP); lamp->Execute_SetActive(lamp, false); } lamp->Reset(); // Disables light if it was on lamp->SetColor(color); // Sets correct color PlaceObject(lamp, botLeftX, botLeftY, direction, width); lamp->Execute_SetActive(lamp, true); if (room) { if (SpawnedRoomObjects.Contains(room)) SpawnedRoomObjects[room].Add(lamp); if (AllocatedRoomSpace.Contains(room)) AllocateRoomSpace(room, botLeftX, botLeftY, direction, width, false); } // UE_LOG(LogTemp, Warning, TEXT("Spawned a wall lamp")); return lamp; } AFlashlight* AMainGameMode::SpawnFlashlight(const int botLeftX, const int botLeftY, const EDirectionEnum direction, LabRoom* room) { AFlashlight* flashlight = Cast<AFlashlight>((TryGetPoolable(FlashlightBP))); if (!flashlight) { flashlight = GetWorld()->SpawnActor<AFlashlight>(FlashlightBP); flashlight->Execute_SetActive(flashlight, false); } flashlight->Reset(); // Disables light if it was on PlaceObject(flashlight, botLeftX, botLeftY, direction); flashlight->Execute_SetActive(flashlight, true); if (room) { if (SpawnedRoomObjects.Contains(room)) SpawnedRoomObjects[room].Add(flashlight); if (AllocatedRoomSpace.Contains(room)) AllocateRoomSpace(room, botLeftX, botLeftY, 1, 1, false); } // UE_LOG(LogTemp, Warning, TEXT("Spawned a flashlight")); return flashlight; } ALighter * AMainGameMode::SpawnLighter(const int botLeftX, const int botLeftY, const EDirectionEnum direction, LabRoom * room) { //ALighter* lighter = Cast<ALighter>((TryGetPoolable(LighterBP))); //if (!lighter) //{ ALighter* lighter = GetWorld()->SpawnActor<ALighter>(LighterBP); lighter->Execute_SetActive(lighter, false); //} lighter->Reset(); // Disables light if it was on PlaceObject(lighter, botLeftX, botLeftY, direction); lighter->Execute_SetActive(lighter, true); if (room) { if (SpawnedRoomObjects.Contains(room)) SpawnedRoomObjects[room].Add(lighter); if (AllocatedRoomSpace.Contains(room)) AllocateRoomSpace(room, botLeftX, botLeftY, 1, 1, false); } // UE_LOG(LogTemp, Warning, TEXT("Spawned a lighter")); return lighter; } ADoorcard* AMainGameMode::SpawnDoorcard(const int botLeftX, const int botLeftY, const EDirectionEnum direction, const FLinearColor color, LabRoom* room) { ADoorcard* doorcard = Cast<ADoorcard>((TryGetPoolable(DoorcardBP))); if (!doorcard) { doorcard = GetWorld()->SpawnActor<ADoorcard>(DoorcardBP); doorcard->Execute_SetActive(doorcard, false); } doorcard->SetColor(color); // Sets correct color PlaceObject(doorcard, botLeftX, botLeftY, direction); doorcard->Execute_SetActive(doorcard, true); if (room) { if (SpawnedRoomObjects.Contains(room)) SpawnedRoomObjects[room].Add(doorcard); if (AllocatedRoomSpace.Contains(room)) AllocateRoomSpace(room, botLeftX, botLeftY, 1, 1, false); } // UE_LOG(LogTemp, Warning, TEXT("Spawned a flashlight")); return doorcard; } AExitVolume * AMainGameMode::SpawnExitVolume(const int botLeftX, const int botLeftY, const EDirectionEnum direction, LabRoom * room) { AExitVolume* exit = Cast<AExitVolume>(TryGetPoolable(ExitVolumeBP)); if (!exit) { exit = GetWorld()->SpawnActor<AExitVolume>(ExitVolumeBP); exit->Execute_SetActive(exit, false); } exit->Reset(); // Disables light if it was on PlaceObject(exit, botLeftX, botLeftY, direction, ExitDoorWidth); exit->Execute_SetActive(exit, true); if (room && SpawnedRoomObjects.Contains(room)) SpawnedRoomObjects[room].Add(exit); // UE_LOG(LogTemp, Warning, TEXT("Spawned an exit volume")); return nullptr; } // Spawn full parts of the lab void AMainGameMode::SpawnRoom(LabRoom * room) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::SpawnRoom")); if (!room) return; // We don't spawn one room twice if (SpawnedRoomObjects.Contains(room)) return; /*if (!PlayerRoom || room == PlayerRoom) { UE_LOG(LogTemp, Warning, TEXT("%s"), (!room->Passages[0]->bIsDoor ? TEXT("YES") : TEXT("NO"))); }*/ DeallocateRoom(room); SpawnedRoomObjects.Add(room); // Spawning floor // Doesn't include walls and passages SpawnBasicFloor(room->BotLeftX + 1, room->BotLeftY + 1, room->SizeX - 2, room->SizeY - 2, room); // For spawning walls TArray<int> leftWallPositions; TArray<int> topWallPositions; TArray<int> rightWallPositions; TArray<int> bottomWallPositions; leftWallPositions.Add(0); leftWallPositions.Add(room->SizeY - 1); topWallPositions.Add(0); topWallPositions.Add(room->SizeX - 1); rightWallPositions.Add(0); rightWallPositions.Add(room->SizeY - 1); bottomWallPositions.Add(0); bottomWallPositions.Add(room->SizeX - 1); // Add positions for spawning walls based on passages in walls // Also spawn doors for (LabPassage* passage : room->Passages) { // Left wall if (passage->BotLeftX == room->BotLeftX) { leftWallPositions.Add(passage->BotLeftY - 1 - room->BotLeftY); leftWallPositions.Add(passage->BotLeftY + passage->Width - room->BotLeftY); // Take space inside room so nothing can be spawned there AllocateRoomSpace(room, passage->BotLeftX + 1, passage->BotLeftY, MinDistanceInsideToPassage, passage->Width, false); } // Top wall else if (passage->BotLeftY == room->BotLeftY + room->SizeY - 1) { topWallPositions.Add(passage->BotLeftX - 1 - room->BotLeftX); topWallPositions.Add(passage->BotLeftX + passage->Width - room->BotLeftX); // Take space inside room so nothing can be spawned there AllocateRoomSpace(room, passage->BotLeftX, passage->BotLeftY - MinDistanceInsideToPassage, passage->Width, MinDistanceInsideToPassage, false); } // Right wall else if (passage->BotLeftX == room->BotLeftX + room->SizeX - 1) { rightWallPositions.Add(passage->BotLeftY - 1 - room->BotLeftY); rightWallPositions.Add(passage->BotLeftY + passage->Width - room->BotLeftY); // Take space inside room so nothing can be spawned there AllocateRoomSpace(room, passage->BotLeftX - MinDistanceInsideToPassage, passage->BotLeftY, MinDistanceInsideToPassage, passage->Width, false); } // Bottom wall else if (passage->BotLeftY == room->BotLeftY) { bottomWallPositions.Add(passage->BotLeftX - 1 - room->BotLeftX); bottomWallPositions.Add(passage->BotLeftX + passage->Width - room->BotLeftX); // Take space inside room so nothing can be spawned there AllocateRoomSpace(room, passage->BotLeftX, passage->BotLeftY + 1, passage->Width, MinDistanceInsideToPassage, false); } // Spawn the passage SpawnPassage(passage, room); } leftWallPositions.Sort(); topWallPositions.Sort(); rightWallPositions.Sort(); bottomWallPositions.Sort(); // Spawning left walls for (int i = 0; i + 1 < leftWallPositions.Num(); i += 2) { int wallLength = leftWallPositions[i + 1] - leftWallPositions[i] + 1; SpawnBasicWall(room->BotLeftX, room->BotLeftY + leftWallPositions[i], 1, wallLength, room); } // Spawning top walls for (int i = 0; i + 1 < topWallPositions.Num(); i += 2) { int wallLength = topWallPositions[i + 1] - topWallPositions[i] + 1; SpawnBasicWall(room->BotLeftX + topWallPositions[i], room->BotLeftY + room->SizeY - 1, wallLength, 1, room); } // Spawning right walls for (int i = 0; i + 1 < rightWallPositions.Num(); i += 2) { int wallLength = rightWallPositions[i + 1] - rightWallPositions[i] + 1; SpawnBasicWall(room->BotLeftX + room->SizeX - 1, room->BotLeftY + rightWallPositions[i], 1, wallLength, room); } // Spawning bottom walls for (int i = 0; i + 1 < bottomWallPositions.Num(); i += 2) { int wallLength = bottomWallPositions[i + 1] - bottomWallPositions[i] + 1; SpawnBasicWall(room->BotLeftX + bottomWallPositions[i], room->BotLeftY, wallLength, 1, room); } // UE_LOG(LogTemp, Warning, TEXT("Spawned a room")); } void AMainGameMode::SpawnPassage(LabPassage* passage, LabRoom* room) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::SpawnPassage")); if (!passage) return; // We don't spawn one passage twice if (SpawnedPassageObjects.Contains(passage)) return; SpawnedPassageObjects.Add(passage); // Spawns floor under the passage if (passage->GridDirection == EDirectionEnum::VE_Up || passage->GridDirection == EDirectionEnum::VE_Down) SpawnBasicFloor(passage->BotLeftX, passage->BotLeftY, passage->Width, 1, passage); else SpawnBasicFloor(passage->BotLeftX, passage->BotLeftY, 1, passage->Width, passage); // Spawn door if needed if (passage->bIsDoor) { SpawnBasicDoor(passage->BotLeftX, passage->BotLeftY, passage->GridDirection, passage->Color, passage->Width, passage); } // UE_LOG(LogTemp, Warning, TEXT("> Spawned a passage")); } // Despawns room so it can be respawned later void AMainGameMode::DespawnRoom(LabRoom * room) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::DespawnRoom")); if (!room) return; if (SpawnedRoomObjects.Contains(room)) { PoolObjects(SpawnedRoomObjects[room]); for (LabPassage* passage : room->Passages) { if (!passage) continue; // We pool passage if it isn't connected to some other spawned room if (passage->From == room) { if (!passage->To || !SpawnedRoomObjects.Contains(passage->To)) PoolPassage(passage); } else if (passage->To == room) { if (!passage->From || !SpawnedRoomObjects.Contains(passage->From)) PoolPassage(passage); } // else // This is a weird case that should never happen // Room is not responsible for the passage pooling is this DOES happen somehow } } SpawnedRoomObjects.Remove(room); AllocatedRoomSpace[room].Empty(); ExpandedRooms.Remove(room); VisitedRooms.Remove(room); // ? RoomsWithLampsOn.Remove(room); AllocateRoom(room); } // Room is allocated and can't be allocated again void AMainGameMode::AllocateRoom(LabRoom * room) { if (!room) return; AllocatedRooms.AddUnique(room); } // Room is not allocated anymore void AMainGameMode::DeallocateRoom(LabRoom * room) { if (!room) return; AllocatedRooms.Remove(room); } // Space in the room is allocated and can't be allocated again void AMainGameMode::AllocateRoomSpace(LabRoom * room, FRectSpaceStruct space, bool local) { AllocateRoomSpace(room, space.BotLeftX, space.BotLeftY, space.SizeX, space.SizeY, local); } void AMainGameMode::AllocateRoomSpace(LabRoom * room, const int xOffset, const int yOffset, const EDirectionEnum direction, const int width, bool local) { AllocateRoomSpace(room, xOffset, yOffset, direction == EDirectionEnum::VE_Up || direction == EDirectionEnum::VE_Down ? width : 1, direction == EDirectionEnum::VE_Up || direction == EDirectionEnum::VE_Down ? 1 : width, local); } void AMainGameMode::AllocateRoomSpace(LabRoom * room, const int xOffset, const int yOffset, const int sizeX, const int sizeY, bool local) { if (!room || !AllocatedRoomSpace.Contains(room)) return; if (local) AllocatedRoomSpace[room].Add(FRectSpaceStruct(xOffset, yOffset, sizeX, sizeY)); else AllocatedRoomSpace[room].Add(FRectSpaceStruct(xOffset - room->BotLeftX, yOffset - room->BotLeftY, sizeX, sizeY)); } // Space in the room is not allocated anymore void AMainGameMode::DeallocateRoomSpace(LabRoom * room, FRectSpaceStruct space) { // TODO } // Returns true if there is free rectangular space // Returns another room that intersected the sent space bool AMainGameMode::MapSpaceIsFree(bool amongAllocated, bool amongSpawned, FRectSpaceStruct space) { LabRoom* intersected = nullptr; return MapSpaceIsFree(amongAllocated, amongSpawned, space, intersected); } bool AMainGameMode::MapSpaceIsFree(bool amongAllocated, bool amongSpawned, const int botLeftX, const int botLeftY, const int sizeX, const int sizeY) { LabRoom* intersected = nullptr; return MapSpaceIsFree(amongAllocated, amongSpawned, botLeftX, botLeftY, sizeX, sizeY, intersected); } bool AMainGameMode::MapSpaceIsFree(bool amongAllocated, bool amongSpawned, FRectSpaceStruct space, LabRoom*& intersected) { return MapSpaceIsFree(amongAllocated, amongSpawned, space.BotLeftX, space.BotLeftY, space.SizeX, space.SizeY, intersected); } bool AMainGameMode::MapSpaceIsFree(bool amongAllocated, bool amongSpawned, const int botLeftX, const int botLeftY, const int sizeX, const int sizeY, LabRoom*& intersected) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::MapSpaceIsFree")); /*if (sizeX < 1 || sizeY < 1) return false;*/ if (amongAllocated) { bool intersectedAllocated = AllocatedRooms.ContainsByPredicate([botLeftX, botLeftY, sizeX, sizeY, &intersected](LabRoom* room) { if (!room) return false; // Not intersecting on X axis if (room->BotLeftX + room->SizeX - 1 <= botLeftX) return false; if (room->BotLeftX >= botLeftX + sizeX - 1) return false; // Not intersecting on Y axis if (room->BotLeftY + room->SizeY - 1 <= botLeftY) return false; if (room->BotLeftY >= botLeftY + sizeY - 1) return false; // Intersecting on both axis intersected = room; return true; }); if (intersectedAllocated) return false; } if (amongSpawned) { TArray<LabRoom*> spawnedRooms; SpawnedRoomObjects.GetKeys(spawnedRooms); bool intersectedSpawned = spawnedRooms.ContainsByPredicate([botLeftX, botLeftY, sizeX, sizeY, &intersected](LabRoom* room) { if (!room) return false; // Not intersecting on X axis if (room->BotLeftX + room->SizeX - 1 <= botLeftX) return false; if (room->BotLeftX >= botLeftX + sizeX - 1) return false; // Not intersecting on Y axis if (room->BotLeftY + room->SizeY - 1 <= botLeftY) return false; if (room->BotLeftY >= botLeftY + sizeY - 1) return false; // Intersecting on both axis intersected = room; return true; }); if (intersectedSpawned) return false; } return true; } // Returns true if there is free rectangular space in a room bool AMainGameMode::RoomSpaceIsFree(LabRoom * room, FRectSpaceStruct space, const bool forPassage, const bool forDoor) { return RoomSpaceIsFree(room, space.BotLeftX, space.BotLeftY, space.SizeX, space.SizeY, forPassage, forDoor); } bool AMainGameMode::RoomSpaceIsFree(LabRoom * room, const int xOffset, const int yOffset, EDirectionEnum direction, const int width, const bool forPassage, const bool forDoor) { return RoomSpaceIsFree(room, xOffset, yOffset, direction == EDirectionEnum::VE_Up || direction == EDirectionEnum::VE_Down ? width : 1, direction == EDirectionEnum::VE_Up || direction == EDirectionEnum::VE_Down ? 1 : width, forPassage, forDoor); } bool AMainGameMode::RoomSpaceIsFree(LabRoom * room, const int xOffset, const int yOffset, const int sizeX, const int sizeY, const bool forPassage, const bool forDoor) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::RoomSpaceIsFree")); if (!room) return false; if (forPassage) { if (xOffset < 0 || yOffset < 0 || sizeX < 1 || sizeY < 1 || xOffset + sizeX > room->SizeX || yOffset + sizeY > room->SizeY) return false; // Space is withing room borders // Determining what wall is passage on EDirectionEnum wallDirection; if (xOffset == 0 && sizeX == 1) wallDirection = EDirectionEnum::VE_Left; else if (xOffset == room->SizeX - 1) wallDirection = EDirectionEnum::VE_Right; else if (yOffset == 0 && sizeY == 1) wallDirection = EDirectionEnum::VE_Down; else if (yOffset == room->SizeY - 1) wallDirection = EDirectionEnum::VE_Up; else return false; if (wallDirection == EDirectionEnum::VE_Left || wallDirection == EDirectionEnum::VE_Right) { int extra = !forDoor ? MinDistanceBetweenPassages : FMath::Max(MinDistanceBetweenPassages, sizeY / 2 + sizeY % 2); if (yOffset < extra || yOffset + sizeY > room->SizeY - extra) return false; bool intersected = room->Passages.ContainsByPredicate([extra, wallDirection, room, yOffset, sizeY](LabPassage* passage) { if (!passage) return false; // Different wall if ((wallDirection == EDirectionEnum::VE_Left && passage->BotLeftX != room->BotLeftX) || (wallDirection == EDirectionEnum::VE_Right && passage->BotLeftX != room->BotLeftX + room->SizeX - 1)) return false; int localExtra = !passage->bIsDoor ? extra : FMath::Max(extra, passage->Width / 2 + passage->Width % 2); // Not intersecting on Y axis if (passage->BotLeftY - room->BotLeftY + passage->Width - 1 + localExtra < yOffset) return false; if (passage->BotLeftY - room->BotLeftY > yOffset + sizeY - 1 + localExtra) return false; // Intersecting return true; }); return !intersected; } else { int extra = !forDoor ? MinDistanceBetweenPassages : FMath::Max(MinDistanceBetweenPassages, sizeX / 2 + sizeX % 2); if (xOffset < extra || xOffset + sizeX > room->SizeX - extra) return false; bool intersected = room->Passages.ContainsByPredicate([extra, wallDirection, room, xOffset, sizeX](LabPassage* passage) { if (!passage) return false; // Different wall if ((wallDirection == EDirectionEnum::VE_Down && passage->BotLeftY != room->BotLeftY) || (wallDirection == EDirectionEnum::VE_Up && passage->BotLeftY != room->BotLeftY + room->SizeY - 1)) return false; int localExtra = !passage->bIsDoor ? extra : FMath::Max(extra, passage->Width / 2 + passage->Width % 2); // Not intersecting on X axis if (passage->BotLeftX - room->BotLeftX + passage->Width - 1 + localExtra < xOffset) return false; if (passage->BotLeftX - room->BotLeftX > xOffset + sizeX - 1 + localExtra) return false; // Intersecting return true; }); return !intersected; } } else { if (xOffset < 1 || yOffset < 1 || sizeX < 1 || sizeY < 1 || xOffset + sizeX > room->SizeX - 1 || yOffset + sizeY > room->SizeY - 1) return false; // Space is withing room borders including walls bool intersected = AllocatedRoomSpace[room].ContainsByPredicate([xOffset, yOffset, sizeX, sizeY](FRectSpaceStruct space) { // Not intersecting on X axis if (space.BotLeftX + space.SizeX - 1 < xOffset) return false; if (space.BotLeftX > xOffset + sizeX - 1) return false; // Not intersecting on Y axis if (space.BotLeftY + space.SizeY - 1 < yOffset) return false; if (space.BotLeftY > yOffset + sizeY - 1) return false; // Intersecting on both axis return true; }); return !intersected; } } // Returns true is one intersects the other (more than just side) bool AMainGameMode::Intersect(LabRoom * room1, LabRoom * room2) { if (!room1 || !room2) return false; return Intersect(FRectSpaceStruct(room1->BotLeftX, room1->BotLeftY, room1->SizeX, room1->SizeY), FRectSpaceStruct(room2->BotLeftX, room2->BotLeftY, room2->SizeX, room2->SizeY)); } bool AMainGameMode::Intersect(FRectSpaceStruct space1, LabRoom * room2) { if (!room2) return false; return Intersect(space1, FRectSpaceStruct(room2->BotLeftX, room2->BotLeftY, room2->SizeX, room2->SizeY)); } bool AMainGameMode::Intersect(LabRoom * room1, FRectSpaceStruct space2) { if (!room1) return false; return Intersect(FRectSpaceStruct(room1->BotLeftX, room1->BotLeftY, room1->SizeX, room1->SizeY), space2); } bool AMainGameMode::Intersect(FRectSpaceStruct space1, FRectSpaceStruct space2) { // Not intersecting on X axis if (space1.BotLeftX + space1.SizeX - 1 <= space2.BotLeftX) return false; if (space1.BotLeftX >= space2.BotLeftX + space2.SizeX - 1) return false; // Not intersecting on Y axis if (space1.BotLeftY + space1.SizeY - 1 <= space2.BotLeftY) return false; if (space1.BotLeftY >= space2.BotLeftY + space2.SizeY - 1) return false; // Intersecting on both axis return true; } // Returns true is first is inside second bool AMainGameMode::IsInside(LabRoom * room1, LabRoom * room2) { if (!room1 || !room2) return false; return IsInside(FRectSpaceStruct(room1->BotLeftX, room1->BotLeftY, room1->SizeX, room1->SizeY), FRectSpaceStruct(room2->BotLeftX, room2->BotLeftY, room2->SizeX, room2->SizeY)); } bool AMainGameMode::IsInside(FRectSpaceStruct space1, LabRoom * room2) { if (!room2) return false; return IsInside(space1, FRectSpaceStruct(room2->BotLeftX, room2->BotLeftY, room2->SizeX, room2->SizeY)); } bool AMainGameMode::IsInside(LabRoom * room1, FRectSpaceStruct space2) { if (!room1) return false; return IsInside(FRectSpaceStruct(room1->BotLeftX, room1->BotLeftY, room1->SizeX, room1->SizeY), space2); } bool AMainGameMode::IsInside(FRectSpaceStruct space1, FRectSpaceStruct space2) { // Out on the left if (space1.BotLeftX < space2.BotLeftX) return false; // Out on the bottom if (space1.BotLeftY < space2.BotLeftY) return false; // Out on the right if (space1.BotLeftX + space1.SizeX > space2.BotLeftX + space2.SizeX) return false; // Out on the top if (space1.BotLeftY + space1.SizeY > space2.BotLeftY + space2.SizeY) return false; // Everything is fine return true; } // Tries to create a room and allocate space for it LabRoom* AMainGameMode::CreateRoom(FRectSpaceStruct space) { return CreateRoom(space.BotLeftX, space.BotLeftY, space.SizeX, space.SizeY); } LabRoom* AMainGameMode::CreateRoom(const int botLeftX, const int botLeftY, const int sizeX, const int sizeY) { /*if(sizeX < 4 || sizeY < 4 || !MapSpaceIsFree(true, true, botLeftX, botLeftY, sizeX, sizeY)) return nullptr;*/ LabRoom* room = new LabRoom(botLeftX, botLeftY, sizeX, sizeY); AllocateRoom(room); AllocatedRoomSpace.Add(room); return room; } // Creates starting room LabRoom * AMainGameMode::CreateStartRoom() { FRectSpaceStruct minSpace(-3, -3, 7, 7); return CreateRandomRoom(minSpace);; } // Reverses direction EDirectionEnum AMainGameMode::GetReverseDirection(EDirectionEnum direction) { switch (direction) { case EDirectionEnum::VE_Down: return EDirectionEnum::VE_Up; case EDirectionEnum::VE_Left: return EDirectionEnum::VE_Right; case EDirectionEnum::VE_Right: return EDirectionEnum::VE_Left; case EDirectionEnum::VE_Up: return EDirectionEnum::VE_Down; } UE_LOG(LogTemp, Warning, TEXT("Somehow reached the end of GetReverseDirection")) return EDirectionEnum::VE_Up; } // Creates random space for a future passage (not world location but offsets) // Doesn't take other passages into account. Direction is always out FRectSpaceStruct AMainGameMode::CreateRandomPassageSpace(LabRoom * room, EDirectionEnum& direction, const bool forDoor) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::CreateRandomPassageSpace")); FRectSpaceStruct space; // Choose wall direction = RandDirection(); switch (direction) { case EDirectionEnum::VE_Left: space.BotLeftX = 0; break; case EDirectionEnum::VE_Right: space.BotLeftX = room->SizeX - 1; break; case EDirectionEnum::VE_Down: space.BotLeftY = 0; break; case EDirectionEnum::VE_Up: space.BotLeftY = room->SizeY - 1; break; } int doorWidth = !forDoor ? 0 : (VisitedOverall < MinVisitedBeforeExitCanSpawn || !RandBool(DoorIsExitProbability) ? (RandBool(DoorIsNormalProbability) ? NormalDoorWidth : BigDoorWidth) : ExitDoorWidth); int minPos = !forDoor ? MinDistanceBetweenPassages : FMath::Max(MinDistanceBetweenPassages, doorWidth / 2 + doorWidth % 2); // Left or right if (direction == EDirectionEnum::VE_Left || direction == EDirectionEnum::VE_Right) { space.SizeX = 1; if (forDoor) space.SizeY = doorWidth; else space.SizeY = FMath::RandRange(MinPassageWidth, FMath::Min(MaxPassageWidth, room->SizeY - 2 * MinDistanceBetweenPassages)); int maxYpos = room->SizeY - 1 - minPos - space.SizeY; space.BotLeftY = FMath::RandRange(minPos, maxYpos); } // Bottom or top else { space.SizeY = 1; if (forDoor) space.SizeX = doorWidth; else space.SizeX = FMath::RandRange(MinPassageWidth, FMath::Min(MaxPassageWidth, room->SizeX - 2 * MinDistanceBetweenPassages)); int maxXpos = room->SizeX - 1 - minPos - space.SizeX; space.BotLeftX = FMath::RandRange(minPos, maxXpos); } return space; } // Creates a passage space for existing passage FRectSpaceStruct AMainGameMode::CreatePassageSpaceFromPassage(LabRoom* room, LabPassage * passage) { return FRectSpaceStruct(passage->BotLeftX - room->BotLeftX, passage->BotLeftY - room->BotLeftY, passage->GridDirection == EDirectionEnum::VE_Up || passage->GridDirection == EDirectionEnum::VE_Down ? passage->Width : 1, passage->GridDirection == EDirectionEnum::VE_Up || passage->GridDirection == EDirectionEnum::VE_Down ? 1 : passage->Width); } // Creates minimum space for a room near passage space for tests and allocation // TODO maybe it should take room size just in case other room gets destroyed FRectSpaceStruct AMainGameMode::CreateMinimumRoomSpace(LabRoom* room, FRectSpaceStruct passageSpace, EDirectionEnum direction, bool widerForDoor) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::CreateMinimumRoomSpace1")); FRectSpaceStruct space; int width = direction == EDirectionEnum::VE_Left || direction == EDirectionEnum::VE_Right ? passageSpace.SizeY : passageSpace.SizeX; int delta = !widerForDoor ? MinDistanceBetweenPassages : FMath::Max(MinDistanceBetweenPassages, width / 2 + width % 2); // int delta = MinDistanceBetweenPassages; switch (direction) { case EDirectionEnum::VE_Left: space.BotLeftX = room->BotLeftX - MinRoomSize + 1; break; case EDirectionEnum::VE_Right: space.BotLeftX = room->BotLeftX + room->SizeX - 1; case EDirectionEnum::VE_Down: space.BotLeftY = room->BotLeftY - MinRoomSize + 1; break; case EDirectionEnum::VE_Up: space.BotLeftY = room->BotLeftY + room->SizeY - 1; } // Left or right if (direction == EDirectionEnum::VE_Left || direction == EDirectionEnum::VE_Right) { space.BotLeftY = room->BotLeftY + passageSpace.BotLeftY - delta; space.SizeX = MinRoomSize; space.SizeY = passageSpace.SizeY + 2 * delta; } // Bottom or top else { space.BotLeftX = room->BotLeftX + passageSpace.BotLeftX - delta; space.SizeX = passageSpace.SizeX + 2 * delta; space.SizeY = MinRoomSize; } return space; } // Creates minimum space for a room near passage for tests and allocation FRectSpaceStruct AMainGameMode::CreateMinimumRoomSpace(LabRoom * room, LabPassage * passage) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::CreateMinimumRoomSpace2")); EDirectionEnum direction = !passage->To ? passage->GridDirection : GetReverseDirection(passage->GridDirection); FRectSpaceStruct pasSpace = CreatePassageSpaceFromPassage(room, passage); bool doorOutOfRoomBorders = false; if (passage->bIsDoor) { int extra = passage->Width / 2 + passage->Width % 2; if (direction == EDirectionEnum::VE_Up || direction == EDirectionEnum::VE_Down) doorOutOfRoomBorders = room->BotLeftX > passage->BotLeftX - extra || room->BotLeftX + room->SizeX < passage->BotLeftX + passage->Width + extra; else doorOutOfRoomBorders = room->BotLeftY > passage->BotLeftY - extra || room->BotLeftY + room->SizeY < passage->BotLeftY + passage->Width + extra; } return CreateMinimumRoomSpace(room, pasSpace, direction, doorOutOfRoomBorders); } // Creates random room space based on minimum room space FRectSpaceStruct AMainGameMode::CreateRandomRoomSpace(FRectSpaceStruct minSpace, bool fromPassage, EDirectionEnum direction) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::CreateRandomRoomSpace")); FRectSpaceStruct randomSpace; int area = FMath::RandRange(FMath::Max(minSpace.SizeX * minSpace.SizeY, MinRoomArea), MaxRoomArea); // We randomize what we make first if (FMath::RandBool()) { randomSpace.SizeX = FMath::RandRange(minSpace.SizeX, FMath::Min(area / minSpace.SizeY, MaxRoomSize)); randomSpace.SizeY = FMath::Max(minSpace.SizeY, area / randomSpace.SizeX); } else { randomSpace.SizeY = FMath::RandRange(minSpace.SizeY, FMath::Min(area / minSpace.SizeX, MaxRoomSize)); randomSpace.SizeX = FMath::Max(minSpace.SizeX, area / randomSpace.SizeY); } if (!fromPassage) { randomSpace.BotLeftX = FMath::RandRange(minSpace.BotLeftX - randomSpace.SizeX + minSpace.SizeX, minSpace.BotLeftX); randomSpace.BotLeftY = FMath::RandRange(minSpace.BotLeftY - randomSpace.SizeY + minSpace.SizeY, minSpace.BotLeftY); } else { if (direction == EDirectionEnum::VE_Left || direction == EDirectionEnum::VE_Right) { randomSpace.BotLeftY = FMath::RandRange(minSpace.BotLeftY - randomSpace.SizeY + minSpace.SizeY, minSpace.BotLeftY); if (direction == EDirectionEnum::VE_Right) randomSpace.BotLeftX = minSpace.BotLeftX; else randomSpace.BotLeftX = minSpace.BotLeftX - randomSpace.SizeX + minSpace.SizeX; } else { randomSpace.BotLeftX = FMath::RandRange(minSpace.BotLeftX - randomSpace.SizeX + minSpace.SizeX, minSpace.BotLeftX); if (direction == EDirectionEnum::VE_Up) randomSpace.BotLeftY = minSpace.BotLeftY; else randomSpace.BotLeftY = minSpace.BotLeftY - randomSpace.SizeY + minSpace.SizeY; } } return randomSpace; } // Shrinks space to not include specified room but still include minSpace // If prioritize horizontal is true, it tries to shrink horizontal part, otherwise vertival bool AMainGameMode::ShrinkSpace(FRectSpaceStruct & currentSpace, FRectSpaceStruct minSpace, LabRoom * toAvoid, bool prioritizeX) { if (!toAvoid) return false; if (prioritizeX) return TryShrinkX(currentSpace, minSpace, toAvoid) || TryShrinkY(currentSpace, minSpace, toAvoid); else return TryShrinkY(currentSpace, minSpace, toAvoid) || TryShrinkX(currentSpace, minSpace, toAvoid); } bool AMainGameMode::TryShrinkX(FRectSpaceStruct & currentSpace, FRectSpaceStruct minSpace, LabRoom * toAvoid) { // Check that intersect on X exists if (currentSpace.BotLeftX + currentSpace.SizeX - 1 > toAvoid->BotLeftX && toAvoid->BotLeftX + toAvoid->SizeX - 1 > currentSpace.BotLeftX) { // minSpace is to the left of toAvoid if (minSpace.BotLeftX + minSpace.SizeX - 1 <= toAvoid->BotLeftX) { currentSpace.SizeX = toAvoid->BotLeftX - currentSpace.BotLeftX + 1; return true; } // minSpace is to the right of toAvoid else if (toAvoid->BotLeftX + toAvoid->SizeX - 1 <= minSpace.BotLeftX) { int delta = toAvoid->BotLeftX + toAvoid->SizeX - 1 - currentSpace.BotLeftX; currentSpace.BotLeftX += delta; currentSpace.SizeX -= delta; return true; } // Intersects minSpace, no solution exists else return false; } // Does not intersect currentSpace and thus there is no problem to solve // This shouldn't happen if sent data is correct (intersecting) else return false; } bool AMainGameMode::TryShrinkY(FRectSpaceStruct & currentSpace, FRectSpaceStruct minSpace, LabRoom * toAvoid) { // Check that intersect on Y exists if (currentSpace.BotLeftY + currentSpace.SizeY - 1 > toAvoid->BotLeftY && toAvoid->BotLeftY + toAvoid->SizeY - 1 > currentSpace.BotLeftY) { // minSpace is below the toAvoid if (minSpace.BotLeftY + minSpace.SizeY - 1 <= toAvoid->BotLeftY) { currentSpace.SizeY = toAvoid->BotLeftY - currentSpace.BotLeftY + 1; return true; } // minSpace is above the toAvoid else if (toAvoid->BotLeftY + toAvoid->SizeY - 1 <= minSpace.BotLeftY) { int delta = toAvoid->BotLeftY + toAvoid->SizeY - 1 - currentSpace.BotLeftY; currentSpace.BotLeftY += delta; currentSpace.SizeY -= delta; return true; } // Intersects minSpace, no solution exists else return false; } // Does not intersect currentSpace and thus there is no problem to solve // This shouldn't happen if sent data is correct (intersecting) else return false; } // Creates a random room based on minimum room space LabRoom * AMainGameMode::CreateRandomRoom(FRectSpaceStruct minSpace, bool fromPassage, EDirectionEnum direction, bool keepMinimum) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::CreateRandomRoom")); if (keepMinimum) return CreateRoom(minSpace); FRectSpaceStruct currentSpace = CreateRandomRoomSpace(minSpace, fromPassage, direction); // TArray<LabPassage*> additionalPassages; LabRoom* intersected; bool prioritizeX = FMath::RandBool(); // TODO should depend on smth bool swapPriority = false; while (!MapSpaceIsFree(true, false, currentSpace, intersected) && intersected) { UE_LOG(LogTemp, Warning, TEXT("> Shrinking among allocated")); // TODO should try to include intersected and add its passages // IsInside() UE_LOG(LogTemp, Warning, TEXT("> x: %d, y: %d, sX: %d, sY: %d"), currentSpace.BotLeftX, currentSpace.BotLeftY, currentSpace.SizeX, currentSpace.SizeY); if (!ShrinkSpace(currentSpace, minSpace, intersected, prioritizeX)) { UE_LOG(LogTemp, Warning, TEXT("> Failed to shrink")); return nullptr; } UE_LOG(LogTemp, Warning, TEXT("> x: %d, y: %d, sX: %d, sY: %d"), currentSpace.BotLeftX, currentSpace.BotLeftY, currentSpace.SizeX, currentSpace.SizeY); if (swapPriority) prioritizeX = !prioritizeX; else prioritizeX = FMath::RandBool(); } while (!MapSpaceIsFree(false, true, currentSpace, intersected) && intersected) { UE_LOG(LogTemp, Warning, TEXT("> Shrinking among spawned")); UE_LOG(LogTemp, Warning, TEXT("> x: %d, y: %d, sX: %d, sY: %d"), currentSpace.BotLeftX, currentSpace.BotLeftY, currentSpace.SizeX, currentSpace.SizeY); if (!ShrinkSpace(currentSpace, minSpace, intersected, prioritizeX)) { UE_LOG(LogTemp, Warning, TEXT("> Failed to shrink")); return nullptr; } UE_LOG(LogTemp, Warning, TEXT("> x: %d, y: %d, sX: %d, sY: %d"), currentSpace.BotLeftX, currentSpace.BotLeftY, currentSpace.SizeX, currentSpace.SizeY); if (swapPriority) prioritizeX = !prioritizeX; else prioritizeX = FMath::RandBool(); } LabRoom* room = CreateRoom(currentSpace); return room; } // Creates and adds a random passage to the room, returns passage or nullptr, also allocates room space and returns allocated room space by reference LabPassage * AMainGameMode::CreateAndAddRandomPassage(LabRoom * room, FRectSpaceStruct & roomSpace, LabRoom*& possibleRoomConnection) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::CreateAndAddRandomPassage")); // bool roomIsSpawned = SpawnedRoomObjects.Contains(room); bool forDoor = RandBool(PassageIsDoorProbability); EDirectionEnum direction; // Find random position for the new passage FRectSpaceStruct pasSpace = CreateRandomPassageSpace(room, direction, forDoor); // Test if it works in the room if (!RoomSpaceIsFree(room, pasSpace, true, forDoor)) // || (roomIsSpawned // && (IsPassageIlluminated(&LabPassage(room->BotLeftX + pasSpace.BotLeftX, room->BotLeftY + pasSpace.BotLeftY, direction)) // || ))) return nullptr; bool pasIsExit = forDoor && (pasSpace.SizeX == ExitDoorWidth || pasSpace.SizeY == ExitDoorWidth); // Find minimum space for a new room on the other side of this passage roomSpace = CreateMinimumRoomSpace(room, pasSpace, direction); LabRoom* intersected = nullptr; // Intersects something spawned if (!MapSpaceIsFree(false, true, roomSpace, intersected)) { // return nullptr; // Exit is only created as a new room if (pasIsExit) return nullptr; // If we don't want to connect if (!RandBool(ConnectToOtherRoomProbability)) return nullptr; // We found something that intersects roomSpace and is spawned // We check if instead of creating new room (which we can't do since we intersected) we can connect to this room instead // Room shouldn't be illuminated if (PlayerRoom == intersected || ActualPlayerRoom == intersected || IsRoomIlluminated(intersected)) return nullptr; // Room shouldn't be inner side of the exit for (LabPassage* interPas : intersected->Passages) { bool interPasIsExit = interPas->bIsDoor && interPas->To == intersected && interPas->Width == ExitDoorWidth; if (interPasIsExit) return nullptr; } // Other room should include the room space if (!IsInside(roomSpace, intersected)) return nullptr; // Despawn that room so it can be respawned later DespawnRoom(intersected); // At this point other room should be considered good possibleRoomConnection = intersected; } else { intersected = nullptr; // Intersects something allocated bool spaceIsFree = MapSpaceIsFree(true, false, roomSpace, intersected); if (!spaceIsFree) { // Exit is only created as a new room if (pasIsExit) return nullptr; // If we don't want to connect if (!RandBool(ConnectToOtherRoomProbability)) return nullptr; // We found something that intersects roomSpace but is not spawned yet // We check if instead of creating new room (which we can't do since we intersected) we can connect to this room instead // Room shouldn't be inner side of the exit for (LabPassage* interPas : intersected->Passages) { bool interPasIsExit = interPas->bIsDoor && interPas->To == intersected && interPas->Width == ExitDoorWidth; if (interPasIsExit) return nullptr; } // Other room should include the room space if (!IsInside(roomSpace, intersected)) return nullptr; // TODO maybe we should delete this since other room should always be able to include passage if it includes roomSpace // Now we check if other room can include our passage FRectSpaceStruct pasSpaceForOther = FRectSpaceStruct(pasSpace.BotLeftX - intersected->BotLeftX + room->BotLeftX, pasSpace.BotLeftY - intersected->BotLeftY + room->BotLeftY, pasSpace.SizeX, pasSpace.SizeY); if (!RoomSpaceIsFree(intersected, pasSpaceForOther, true)) // We don't check for door since we already have good walls for sliding door in original room return nullptr; // At this point other room should be considered good possibleRoomConnection = intersected; } } // Add this passage to the room LabPassage* passage; if (!forDoor) passage = room->AddPassage(room->BotLeftX + pasSpace.BotLeftX, room->BotLeftY + pasSpace.BotLeftY, direction, possibleRoomConnection, direction == EDirectionEnum::VE_Up || direction == EDirectionEnum::VE_Down ? pasSpace.SizeX : pasSpace.SizeY); else { // TODO maybe it shouldn't allow every color FLinearColor color = !pasIsExit ? RandColor() : FLinearColor::Black; passage = room->AddPassage(room->BotLeftX + pasSpace.BotLeftX, room->BotLeftY + pasSpace.BotLeftY, direction, possibleRoomConnection, forDoor, color, direction == EDirectionEnum::VE_Up || direction == EDirectionEnum::VE_Down ? pasSpace.SizeX : pasSpace.SizeY); } // if (roomIsSpawned) // RespawnRoomWalls(room); // Doesn't spawn new passage return passage; } // Creates new passages in the room // Create new rooms for passages // Returns new rooms TArray<LabRoom*> AMainGameMode::ExpandRoom(LabRoom * room, int desiredNumOfPassagesOverride) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::ExpandRoom")); TArray<LabRoom*> newRooms; if (!room) return newRooms; ExpandedRooms.AddUnique(room); // Room shouldn't be inner side of the exit for (LabPassage* interPas : room->Passages) { if (!interPas) continue; bool interPasIsExit = interPas->bIsDoor && interPas->To == room && interPas->Width == ExitDoorWidth; if (interPasIsExit) return newRooms; } UE_LOG(LogTemp, Warning, TEXT("> Not inner exit")); //if (desiredNumOfPassagesOverride < MinRoomNumOfPassages && room->Passages.Num() == 1 && room->Passages[0]->bIsDoor && room->Passages[0]->Color != FLinearColor::White && RandBool(MakeRoomSpecialForCardProbability)) //{ // // We don't expand so this room becomes a vault for card // return newRooms; //} // The number of passages we want to have in the room // These are not just new but overall int desiredNumOfPassages = desiredNumOfPassagesOverride < MinRoomNumOfPassages ?FMath::RandRange(MinRoomNumOfPassages, MaxRoomNumOfPassages) : desiredNumOfPassagesOverride; // UE_LOG(LogTemp, Warning, TEXT("> Trying to add %d passages"), desiredNumOfPassages); // Maximum number of tries int maxTries = MaxRoomPassageCreationTriesPerDesired * desiredNumOfPassages; // Creates new passages in the room // Allocates minimum room space for passages // Create rooms for the passages if rooms weren't found already for (int i = 0; room->Passages.Num() < MinRoomNumOfPassages || (i < maxTries && room->Passages.Num() < desiredNumOfPassages); ++i) { FRectSpaceStruct minRoomSpace; LabRoom* possibleRoomConnection = nullptr; LabPassage* passage = CreateAndAddRandomPassage(room, minRoomSpace, possibleRoomConnection); if (passage) { // TODO it shouldn't be like this // For start room if (desiredNumOfPassagesOverride >= MinRoomNumOfPassages && !SpawnedPassageObjects.Contains(passage)) { // UE_LOG(LogTemp, Warning, TEXT("Made it doorless")); // passage->bIsDoor = true; // false; // UE_LOG(LogTemp, Warning, TEXT("Made it white")); passage->Color = FLinearColor::White; } if (!possibleRoomConnection) { bool pasIsExit = passage->bIsDoor && passage->Width == ExitDoorWidth; // UE_LOG(LogTemp, Warning, TEXT("> %s"), TEXT("success")); // We create new room from min space, it also allocates room's space LabRoom* newRoom = CreateRandomRoom(minRoomSpace, true, passage->GridDirection, pasIsExit); if (!newRoom) continue; // We add passage to the room newRoom->AddPassage(passage); newRooms.Add(newRoom); } else { // UE_LOG(LogTemp, Warning, TEXT("> %s"), TEXT("found a room to connect to")); } } else { // UE_LOG(LogTemp, Warning, TEXT("> %s"), TEXT("failure")); } } return newRooms; } // Fixes room's passages that lead nowhere, creating a room for them or deleting them // Also spawns a wall over previous passage if room was spawned void AMainGameMode::FixRoom(LabRoom * room, int depth) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::FixRoom")); if (depth > MaxFixDepth) return; if (!room) return; for (int i = room->Passages.Num() - 1; i >= 0; --i) { LabPassage* passage = room->Passages[i]; // We remove anything broken if (!passage) { room->Passages.RemoveAt(i); continue; } // TODO shouldn't use try/catch //try //{ // We're not interested in normal passages if (passage->To && passage->From) continue; //} //catch (...) //{ // UE_LOG(LogTemp, Warning, TEXT("GOT THAT EXCEPTION WITH PASSAGES")); // room->Passages.RemoveAt(i); // continue; //} // UE_LOG(LogTemp, Warning, TEXT("Trying to fix passage: x: %d, y: %d"), passage->BotLeftX, passage->BotLeftY); bool absolutelyUndeleteable = (room == PlayerRoom || room == ActualPlayerRoom);// && room->Passages.Num() <= 1; bool canNotDelete = absolutelyUndeleteable || IsPassageIlluminated(passage); if (canNotDelete || !RandBool(DeletePassageToFixProbability)) { // We try to keep passage, though we may still have to delete it FRectSpaceStruct minRoomSpace = CreateMinimumRoomSpace(room, passage); // UE_LOG(LogTemp, Warning, TEXT("> Create a room: x: %d, y: %d, sX: %d, sY: %d"), minRoomSpace.BotLeftX, minRoomSpace.BotLeftY, minRoomSpace.SizeX, minRoomSpace.SizeY); LabRoom* intersected; // Intersects something spawned if (MapSpaceIsFree(false, true, minRoomSpace, intersected)) { // Intersects something allocated if (MapSpaceIsFree(true, false, minRoomSpace, intersected)) { // We create new room from min space, it also allocates room's space LabRoom* newRoom = CreateRandomRoom(minRoomSpace, true, !passage->To ? passage->GridDirection : GetReverseDirection(passage->GridDirection)); if (newRoom) { // We add passage to the room newRoom->AddPassage(passage); continue; } // else delete } else { // We found something that intersects roomSpace but is not spawned yet // We check if instead of creating new room (which we can't do since we intersected) we can connect to this room instead // Other room should include the room space if (IsInside(minRoomSpace, intersected)) { // At this point other room should be considered good intersected->AddPassage(passage); continue; } else if (canNotDelete) { // UE_LOG(LogTemp, Warning, TEXT("> Can not delete")); // TODO // if (TryEnlargeRoomToIncludeSpace(intersected, minRoomSpace) // { // intersected->AddPassage(passage); // continue; // } // else // { // We may delete smth and we will have new rooms to fix TArray<LabRoom*> toFix; do { // If intersected can be deleted if (!(intersected == PlayerRoom || intersected == ActualPlayerRoom)) // && intersected->Passages.Num() <= 1)) { bool noImportantPassages = true; if (!absolutelyUndeleteable) { for (LabPassage* interPassage : intersected->Passages) { if (IsPassageIlluminated(interPassage)) { noImportantPassages = false; break; } } } if (noImportantPassages || absolutelyUndeleteable) { // UE_LOG(LogTemp, Warning, TEXT("> Forced refix")); for (LabPassage* interPassage : intersected->Passages) { if (interPassage->To && interPassage->To != intersected) toFix.Add(interPassage->To); if (interPassage->From && interPassage->From != intersected) toFix.Add(interPassage->From); } // toFix.Remove(room); PoolRoom(intersected); // We should exit the do/while cycle at this point but sometimes we don't, cause we may still intersect with something else } else break; } else break; } while (!MapSpaceIsFree(true, false, minRoomSpace, intersected)); // If we deleted some room(s) and now space is free if (MapSpaceIsFree(true, false, minRoomSpace, intersected)) { // We create new room from min space LabRoom* newRoom = CreateRandomRoom(minRoomSpace, true, !passage->To ? passage->GridDirection : GetReverseDirection(passage->GridDirection)); if (newRoom) newRoom->AddPassage(passage); for (LabRoom* roomToFix : toFix) FixRoom(roomToFix, depth + 1); if (newRoom) continue; // else delete } // else delete } // else delete } } else { // We found something that intersects roomSpace and is spawned // We check if instead of creating new room (which we can't do since we intersected) we can connect to this room instead // Room shouldn't be illuminated if (PlayerRoom != intersected && ActualPlayerRoom != intersected && !IsRoomIlluminated(intersected)) { // Other room should include the room space if (IsInside(minRoomSpace, intersected)) { // Despawn that room so it can be respawned later DespawnRoom(intersected); // At this point other room should be considered good intersected->AddPassage(passage); continue; } // TODO add same as in intersection above? // else delete } // else delete } } // else delete // TODO check if this doesn't break ways into unknown // TODO check if at least one connection exists room->Passages.RemoveAt(i); // We pool and delete passage and spawn a wall instead if (SpawnedRoomObjects.Contains(room)) { PoolPassage(passage); SpawnBasicWall(passage->BotLeftX, passage->BotLeftY, passage->GridDirection == EDirectionEnum::VE_Up || passage->GridDirection == EDirectionEnum::VE_Down ? passage->Width : 1, passage->GridDirection == EDirectionEnum::VE_Up || passage->GridDirection == EDirectionEnum::VE_Down ? 1 : passage->Width, room); } delete passage; } } // Creates random space in the room with specified size for a future object in the room (not world location but offset) // Returns false if couldn't create bool AMainGameMode::CreateRandomInsideSpaceOfSize(LabRoom * room, int& xOffset, int& yOffset, const int sizeX, const int sizeY, const bool canBeTaken) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::CreateRandomInsideSpaceOfSize")); if (sizeX < 1 || sizeY < 1 || sizeX > room->SizeX - 2 || sizeY > room->SizeY - 2) return false; xOffset = FMath::RandRange(1, room->SizeX - 1 - sizeX); yOffset = FMath::RandRange(1, room->SizeY - 1 - sizeY); // Test if it works in the room return canBeTaken || RoomSpaceIsFree(room, xOffset, yOffset, sizeX, sizeY); } // Same but near wall and returns direction from wall (width is along wall) bool AMainGameMode::CreateRandomInsideSpaceOfWidthNearWall(LabRoom * room, int& xOffset, int& yOffset, const int width, EDirectionEnum & direction, const bool canBeTaken) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::CreateRandomInsideSpaceOfWidthNearWall")); // Choose wall direction = RandDirection(); // Direction here are INTO room, so wall is the opposite switch (direction) { case EDirectionEnum::VE_Right: // Left wall xOffset = 1; break; case EDirectionEnum::VE_Left: // Right wall xOffset = room->SizeX - 2; break; case EDirectionEnum::VE_Up: // Bottom wall yOffset = 1; break; case EDirectionEnum::VE_Down: // Top wall yOffset = room->SizeY - 2; break; } // Left or right if (direction == EDirectionEnum::VE_Left || direction == EDirectionEnum::VE_Right) yOffset = FMath::RandRange(1, room->SizeY - 1 - width); // Bottom or top else xOffset = FMath::RandRange(1, room->SizeX - 1 - width); // Test if it works in the room return canBeTaken || RoomSpaceIsFree(room, xOffset, yOffset, direction, width); } // Fills room with random objects, spawns and returns them // Should always be called on a room that is already spawned TArray<AActor*> AMainGameMode::FillRoom(LabRoom* room, int minNumOfLampsOverride) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::FillRoom")); TArray<AActor*> spawnedActors; bool isExitRoom = room && room->Passages.Num() == 1 && room->Passages[0]->bIsDoor && room->Passages[0]->Width == ExitDoorWidth; if (!isExitRoom) { // Used for lamps and for doorcards FLinearColor color; bool colorIsDetermined = false; // In rooms with only one door that also isn't white card is almost always given and it has next level, also lamp is almost always spawned if (room->Passages.Num() == 1 && room->Passages[0]->bIsDoor && room->Passages[0]->Color != FLinearColor::White) { colorIsDetermined = true; FLinearColor roomColor = room->Passages[0]->Color; if (roomColor == FLinearColor::FromSRGBColor(FColor(30, 144, 239))) color = FLinearColor::Green; else if (roomColor == FLinearColor::Green) color = FLinearColor::Yellow; else if (roomColor == FLinearColor::Yellow) color = FLinearColor::Red; else if (roomColor == FLinearColor::Red) color = FLinearColor::Black; else colorIsDetermined = false; } // The number of lamps we want to have in the room int desiredNumOfLamps = FMath::RandRange(MinRoomNumOfLamps, 1 + MaxRoomNumOfLampsPerHundredArea * room->SizeX * room->SizeY / 100); // Maximum number of tries int maxTries = MaxRoomLampCreationTriesPerDesired * desiredNumOfLamps; // Creates new lamps in the room for (int i = 0; spawnedActors.Num() < MinRoomNumOfLamps || (i < maxTries && spawnedActors.Num() < desiredNumOfLamps) || spawnedActors.Num() < minNumOfLampsOverride; ++i) { int xOff; int yOff; int width = FMath::RandRange(MinLampWidth, MaxLampWidth); EDirectionEnum direction; if (CreateRandomInsideSpaceOfWidthNearWall(room, xOff, yOff, width, direction)) { if (!colorIsDetermined) { color = RandColor(); while (color == FLinearColor::Black && spawnedActors.Num() < minNumOfLampsOverride) color = RandColor(); } AWallLamp* lamp = SpawnWallLamp(room->BotLeftX + xOff, room->BotLeftY + yOff, direction, color, width, room); spawnedActors.Add(lamp); } } // Creates a doorcard bool shouldSpawnDoorcard = colorIsDetermined || RandBool(SpawnDoorcardProbability); for (int i = 0; shouldSpawnDoorcard && i < MaxGenericSpawnTries; ++i) { int xOff; int yOff; if (CreateRandomInsideSpaceOfSize(room, xOff, yOff, 1, 1, true)) { // In random rooms cards are almost always blue if (!colorIsDetermined) { // color = FLinearColor::FromSRGBColor(FColor(30, 144, 239)); color = RandColor(); while (color == FLinearColor::White || (color == FLinearColor::Black && VisitedOverall < MinVisitedBeforeBlackDoorcardCanSpawn)) color = RandColor(); } EDirectionEnum direction = RandDirection(); ADoorcard* doorcard = SpawnDoorcard(room->BotLeftX + xOff, room->BotLeftY + yOff, direction, color, room); spawnedActors.Add(doorcard); break; // We only spawn once } } // Creates a flashlight bool shouldSpawnFlashlight = RandBool(SpawnFlashlightProbability); for (int i = 0; shouldSpawnFlashlight && i < MaxGenericSpawnTries; ++i) { int xOff; int yOff; if (CreateRandomInsideSpaceOfSize(room, xOff, yOff, 1, 1, false)) { EDirectionEnum direction = RandDirection(); AFlashlight* flashlight = SpawnFlashlight(room->BotLeftX + xOff, room->BotLeftY + yOff, direction, room); spawnedActors.Add(flashlight); break; // We only spawn once } } } else { LabPassage* passage = room->Passages[0]; int x = passage->BotLeftX; int y = passage->BotLeftY; if (passage->GridDirection == EDirectionEnum::VE_Right) x++; else if (passage->GridDirection == EDirectionEnum::VE_Left) x--; else if (passage->GridDirection == EDirectionEnum::VE_Up) y++; else if (passage->GridDirection == EDirectionEnum::VE_Down) y--; AExitVolume* exitVolume = SpawnExitVolume(x, y, GetReverseDirection(passage->GridDirection), room); } return spawnedActors; } // Activates all lamps in a single room void AMainGameMode::ActivateRoomLamps(LabRoom * room, bool forceAll) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::ActivateRoomLamps")); if (!room) return; if (!SpawnedRoomObjects.Contains(room)) return; // Turn on if (!RoomsWithLampsOn.Contains(room)) { bool atLeastOneLamp = false; for (TScriptInterface<IDeactivatable> obj : SpawnedRoomObjects[room]) { AWallLamp* lamp = Cast<AWallLamp>(obj->_getUObject()); if (!lamp) continue; atLeastOneLamp = true; lamp->Execute_ActivateIndirectly(lamp); } if(atLeastOneLamp) RoomsWithLampsOn.Add(room); } // Turn off else { bool turnedOffOne = false; bool atLeastOneLampLeft = false; bool turnOffAll = forceAll || RandBool(AllLampsInRoomTurnOffProbability); for (TScriptInterface<IDeactivatable> obj : SpawnedRoomObjects[room]) { AWallLamp* lamp = Cast<AWallLamp>(obj->_getUObject()); if (!lamp) continue; if (turnOffAll) { if (lamp->IsOn()) lamp->Execute_ActivateIndirectly(lamp); } else if (!turnedOffOne) { if (lamp->IsOn()) { lamp->Execute_ActivateIndirectly(lamp); turnedOffOne = true; } } else { if (lamp->IsOn()) { atLeastOneLampLeft = true; break; } } } if (turnOffAll || !atLeastOneLampLeft) RoomsWithLampsOn.Remove(room); } } // Returns true if unexpanded rooms are reachable from here bool AMainGameMode::CanReachUnexpanded(LabRoom * start, TArray<LabRoom*>& checkedRooms) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::CanReachUnexpanded")); if (!start) return false; checkedRooms.Add(start); if (!ExpandedRooms.Contains(start)) return true; AMainCharacter* character = Cast<AMainCharacter>(MainPlayerController->GetCharacter()); for (LabPassage* passage : start->Passages) { if (passage->bIsDoor && passage->Color != FLinearColor::White && !character->HasDoorcardOfColor(passage->Color)) continue; if (passage->From != start && !checkedRooms.Contains(passage->From)) if (CanReachUnexpanded(passage->From, checkedRooms)) return true; if (passage->To != start && !checkedRooms.Contains(passage->To)) if (CanReachUnexpanded(passage->To, checkedRooms)) return true;; } return false; } bool AMainGameMode::CanReachUnexpanded(LabRoom * start) { TArray<LabRoom*> checkedRooms; return CanReachUnexpanded(start, checkedRooms); } // Expands room if it's not spawned yet // Repeats with all adjasent rooms recursively void AMainGameMode::ExpandInDepth(LabRoom* start, int depth, LabPassage* fromPassage, bool expandExpanded) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::ExpandInDepth1")); if (!start) return; // If not spawned and not expanded (unless we expand expanded) if ((expandExpanded || !ExpandedRooms.Contains(start)) && !SpawnedRoomObjects.Contains(start)) ExpandRoom(start); if (depth <= 1) return; // We need a copy to avoid errors during expansion TArray<LabPassage*> passagesCopy = start->Passages; for (LabPassage* passage : passagesCopy) { if (passage == fromPassage) continue; if (passage->From != start) ExpandInDepth(passage->From, depth - 1, passage, expandExpanded); if (passage->To != start) ExpandInDepth(passage->To, depth - 1, passage, expandExpanded); } } void AMainGameMode::ExpandInDepth(LabRoom * start, int depth) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::ExpandInDepth2")); // UE_LOG(LogTemp, Warning, TEXT("Expanding:")); // UE_LOG(LogTemp, Warning, TEXT("> Try 1")); ExpandInDepth(start, depth, nullptr); int expandTries = 2; AMainCharacter* character = Cast<AMainCharacter>(MainPlayerController->GetCharacter()); while (!CanReachUnexpanded(start)) { // Make some doors white int maxNumPassagesToMakeWhite = 5; // TODO make constant for (LabRoom* room : AllocatedRooms) { for (LabPassage* pas : room->Passages) { if (!pas->bIsDoor || pas->Color == FLinearColor::White || pas->Width == ExitDoorWidth || SpawnedPassageObjects.Contains(pas) || character->HasDoorcardOfColor(pas->Color)) continue; pas->Color = FLinearColor::White; --maxNumPassagesToMakeWhite; if (maxNumPassagesToMakeWhite <= 0) break; } if (maxNumPassagesToMakeWhite <= 0) break; } if (CanReachUnexpanded(start)) break; // Disable nearby lamps if (expandTries == MaxExpandTriesBeforeDisablingLights + 1) { UE_LOG(LogTemp, Warning, TEXT("> !!! Disabled a lot of lamps")); // TODO should not turn off ALL lamps for (int i = RoomsWithLampsOn.Num() - 1; i >= 0; --i) { LabRoom* room = RoomsWithLampsOn[i]; ActivateRoomLamps(room, true); } } if (expandTries <= MaxExpandTriesOverall) { // UE_LOG(LogTemp, Warning, TEXT("> Try %d"), expandTries); if (expandTries > MinExpandTriesBeforeReshaping) ReshapeAllDarkness(); // We do his to prevend being stuck // ExpandInDepth(start, depth + expandTries / 2, nullptr, true); ExpandInDepth(start, depth, nullptr, true); ++expandTries; } else { UE_LOG(LogTemp, Warning, TEXT("> !!! Failed to get a pass to unexpanded")); break; } } } // Spawns and fills room if it's not spawned yet // Repeats with all adjasent rooms recursively void AMainGameMode::SpawnFillInDepth(LabRoom * start, int depth, LabPassage* fromPassage, FVector initialPasLoc) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::SpawnFillInDepth1")); if (!start) return; // If not spawned if (!SpawnedRoomObjects.Contains(start)) { SpawnRoom(start); FillRoom(start); } if (depth <= 1) return; for (LabPassage* passage : start->Passages) { if (passage == fromPassage) continue; // location of the floor FVector pasLoc = Cast<AActor>(SpawnedPassageObjects[passage][0]->_getUObject())->GetActorLocation() + FVector(0, 0, 30); if (CanSee(initialPasLoc, pasLoc)) { if (passage->From != start) SpawnFillInDepth(passage->From, depth - 1, passage, initialPasLoc); if (passage->To != start) SpawnFillInDepth(passage->To, depth - 1, passage, initialPasLoc); } } } void AMainGameMode::SpawnFillInDepth(LabRoom* start, int depth) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::SpawnFillInDepth2")); if (!start) return; // If not spawned if (!SpawnedRoomObjects.Contains(start)) { SpawnRoom(start); FillRoom(start); } if (depth <= 1) return; for (LabPassage* passage : start->Passages) { // location of the floor FVector initialPasLoc = Cast<AActor>(SpawnedPassageObjects[passage][0]->_getUObject())->GetActorLocation() + FVector(0, 0, 30); if ((passage->From == start && passage->GridDirection == EDirectionEnum::VE_Right) || (passage->To == start && passage->GridDirection == EDirectionEnum::VE_Left)) initialPasLoc += FVector(0, 30, 0); else if ((passage->From == start && passage->GridDirection == EDirectionEnum::VE_Left) || (passage->To == start && passage->GridDirection == EDirectionEnum::VE_Right)) initialPasLoc += FVector(0, -30, 0); else if ((passage->From == start && passage->GridDirection == EDirectionEnum::VE_Up) || (passage->To == start && passage->GridDirection == EDirectionEnum::VE_Down)) initialPasLoc += FVector(30, 0, 0); else if ((passage->From == start && passage->GridDirection == EDirectionEnum::VE_Down) || (passage->To == start && passage->GridDirection == EDirectionEnum::VE_Up)) initialPasLoc += FVector(-30, 0, 0); if (passage->From != start) SpawnFillInDepth(passage->From, depth - 1, passage, initialPasLoc); if (passage->To != start) SpawnFillInDepth(passage->To, depth - 1, passage, initialPasLoc); } } // Generates map void AMainGameMode::GenerateMap() { LabRoom* startRoom = CreateStartRoom(); ExpandRoom(startRoom, 1); SpawnRoom(startRoom); FillRoom(startRoom, 1); MainPlayerController->GetCharacter()->SetActorLocation(FVector(25, 25, 90)); //, false, nullptr, ETeleportType::TeleportPhysics); // GetCharacterRoom(); } // Resets the map void AMainGameMode::ResetMap() { PoolMap(); GenerateMap(); } // Shows/hides debug void AMainGameMode::ShowHideDebug() { bShowDebug = !bShowDebug; } // Sets default values AMainGameMode::AMainGameMode() { // Find blueprints and save found classes for future spawns static ConstructorHelpers::FObjectFinder<UClass> basicFloorBP(TEXT("Class'/Game/Blueprints/BasicFloorBP.BasicFloorBP_C'")); if (basicFloorBP.Succeeded()) BasicFloorBP = basicFloorBP.Object; static ConstructorHelpers::FObjectFinder<UClass> basicWallBP(TEXT("Class'/Game/Blueprints/BasicWallBP.BasicWallBP_C'")); if (basicWallBP.Succeeded()) BasicWallBP = basicWallBP.Object; static ConstructorHelpers::FObjectFinder<UClass> basicDoorBP(TEXT("Class'/Game/Blueprints/BasicDoorBP.BasicDoorBP_C'")); if (basicDoorBP.Succeeded()) BasicDoorBP = basicDoorBP.Object; static ConstructorHelpers::FObjectFinder<UClass> wallLampBP(TEXT("Class'/Game/Blueprints/WallLampBP.WallLampBP_C'")); if (wallLampBP.Succeeded()) WallLampBP = wallLampBP.Object; static ConstructorHelpers::FObjectFinder<UClass> flashlightBP(TEXT("Class'/Game/Blueprints/FlashlightBP.FlashlightBP_C'")); if (flashlightBP.Succeeded()) FlashlightBP = flashlightBP.Object; static ConstructorHelpers::FObjectFinder<UClass> lighterBP(TEXT("Class'/Game/Blueprints/LighterBP.LighterBP_C'")); if (lighterBP.Succeeded()) LighterBP = lighterBP.Object; static ConstructorHelpers::FObjectFinder<UClass> doorcardBP(TEXT("Class'/Game/Blueprints/DoorcardBP.DoorcardBP_C'")); if (doorcardBP.Succeeded()) DoorcardBP = doorcardBP.Object; static ConstructorHelpers::FObjectFinder<UClass> exitVolumeBP(TEXT("Class'/Game/Blueprints/ExitVolumeBP.ExitVolumeBP_C'")); if (exitVolumeBP.Succeeded()) ExitVolumeBP = exitVolumeBP.Object; // Set to call Tick() every frame PrimaryActorTick.bCanEverTick = true; } // Called when the game starts or when spawned void AMainGameMode::BeginPlay() { Super::BeginPlay(); // TODO remove before shipping // ShowHideDebug(); // We find darkness controller UWorld* gameWorld = GetWorld(); for (TObjectIterator<ADarknessController> Itr; Itr; ++Itr) { // World Check if (Itr->GetWorld() != gameWorld) continue; DarknessController = *Itr; break; // We only need one (and there should be only one) } // Then we find the character controller APlayerController* controller = gameWorld->GetFirstPlayerController(); MainPlayerController = Cast<AMainPlayerController>(controller); // Finally we generate map GenerateMap(); // Make world reshape every few seconds even if character doesn't change rooms FTimerHandle handler; ((AActor*)this)->GetWorldTimerManager().SetTimer(handler, this, &AMainGameMode::CompleteReshapeAllDarknessAroundOnTick, ReshapeDarknessTick, true, ReshapeDarknessTick); // TODO delete, used only for tests sometimes /*((AActor*)this)->GetWorldTimerManager().SetTimer(handler, this, &AMainGameMode::ResetMap, 2, true, 2);*/ } // Called every frame void AMainGameMode::Tick(const float deltaTime) { UE_LOG(LogTemp, Warning, TEXT("MainGameMode::Tick")); Super::Tick(deltaTime); // Updates PlayerRoom, calls OnEnterRoom GetCharacterRoom(); // Turns off some lamps from time to time for (int i = RoomsWithLampsOn.Num() - 1; i >= 0; --i) { LabRoom* room = RoomsWithLampsOn[i]; if (RandBool(LampsTurnOffPerSecondProbability * deltaTime)) ActivateRoomLamps(room); } ACharacter* tempCharacter = MainPlayerController->GetCharacter(); AMainCharacter* character = tempCharacter ? Cast<AMainCharacter>(tempCharacter) : nullptr; // If player finds black card, we make darkness know if (character && DarknessController && !DarknessController->bIsPersistent && character->HasDoorcardOfColor(FLinearColor::Black)) DarknessController->OnPlayerFindsBlackCard(); // On screen debug if (bShowDebug && GEngine) { // Pools debug // GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, FString::Printf(TEXT("Pools: default: %d, floor: %d, wall: %d, door: %d, lamp: %d, flashlight: %d"), DefaultPool.Num(), BasicFloorPool.Num(), BasicWallPool.Num(), BasicDoorPool.Num(), WallLampPool.Num(), FlashlightPool.Num()), true); // Darkness debug APawn* tempDarkness = DarknessController->GetPawn(); if (tempDarkness) { ADarkness* darkness = Cast<ADarkness>(tempDarkness); // Title GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, TEXT("Darkness:"), false); // Current location int darkX, darkY; FVector darknessLocation = darkness->GetActorLocation(); WorldToGrid(darknessLocation.X, darknessLocation.Y, darkX, darkY); GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, FString::Printf(TEXT("> Location: X: %d, Y: %d"), darkX, darkY), false); // Current state FString state = "Unknown"; switch (DarknessController->State) { case EDarkStateEnum::VE_Passive: state = "Passive"; break; case EDarkStateEnum::VE_Hunting: state = "Hunting"; break; case EDarkStateEnum::VE_Retreating: state = "Retreating"; break; } GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, FString::Printf(TEXT("> State: %s"), *state), false); // Current luminosity GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, FString::Printf(TEXT("> Luminosity: %f"), darkness->Luminosity), false); // Light resistance GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, FString::Printf(TEXT("> Resistance: %f"), darkness->LightResistance), false); // Empty line GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, TEXT(""), false); } // Character debug if (character) { // Title GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, TEXT("Character:"), false); // Current location int charX, charY; GetCharacterLocation(charX, charY); GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, FString::Printf(TEXT("> Location: X: %d, Y: %d"), charX, charY), false); // Current room // GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, FString::Printf(TEXT("> Room: X: %d, Y: %d, sX: %d, sY: %d"), PlayerRoom->BotLeftX, PlayerRoom->BotLeftY, PlayerRoom->SizeX, PlayerRoom->SizeY), false); // Light in current room // GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, FString::Printf(TEXT("> room luminosity: %f"), GetRoomLightingAmount(PlayerRoom)), true); // Number of "lives" left GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, FString::Printf(TEXT("> Lives: %d"), MainPlayerController->Lives), false); // Number of visited rooms GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, FString::Printf(TEXT("> Visited rooms: %d"), VisitedOverall), false); // Doorcards GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, FString::Printf(TEXT("> Doorcards: %s%s%s%s%s"), character->HasDoorcardOfColor(FLinearColor::FromSRGBColor(FColor(30, 144, 239))) ? TEXT("Blue ") : TEXT(""), character->HasDoorcardOfColor(FLinearColor::Green) ? TEXT("Green ") : TEXT(""), character->HasDoorcardOfColor(FLinearColor::Yellow) ? TEXT("Yellow ") : TEXT(""), character->HasDoorcardOfColor(FLinearColor::Red) ? TEXT("Red ") : TEXT(""), character->HasDoorcardOfColor(FLinearColor::Black) ? TEXT("Black") : TEXT("")), false); // Activatable and equipped TArray<IInformative*> informativeObjects; TArray<FString> informativeNames; // Get activatable TScriptInterface<IActivatable> activatable = character->GetActivatable(); informativeObjects.Add(activatable ? Cast<IInformative>(activatable->_getUObject()) : nullptr); informativeNames.Add("> Activatable"); // Get equipped informativeObjects.Add(character->EquipedObject ? Cast<IInformative>(character->EquipedObject->_getUObject()) : nullptr); informativeNames.Add("> Equipped"); // Finally print for (int i = 0; i < informativeObjects.Num(); ++i) { IInformative* informative = informativeObjects[i]; FString name = informativeNames[i]; if (informative) { GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, FString::Printf(TEXT("%s: %s"), *name, *(informative->Execute_GetName(informative->_getUObject())).ToString()), false); GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, FString::Printf(TEXT(" > %s"), *(informative->Execute_GetBasicInfo(informative->_getUObject())).ToString()), false); } else GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, FString::Printf(TEXT("%s: %s"), *name, TEXT("None")), false); } /*if (character->LighterIndex >= 0) GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, FString::Printf(TEXT("Lighter gas: %f"), Cast<ALighter>(character->Inventory[character->LighterIndex]->_getUObject())->PowerLevel * 100), false);*/ if (character->FlashlightIndex >= 0) GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, FString::Printf(TEXT("Flashlight power: %f"), Cast<AFlashlight>(character->Inventory[character->FlashlightIndex]->_getUObject())->PowerLevel * 100), false); // Empty line GEngine->AddOnScreenDebugMessage(-1, 0.0f, FColor::Yellow, TEXT(""), false); } } } // Called when actor is being removed from the play void AMainGameMode::EndPlay(const EEndPlayReason::Type EndPlayReason) { Super::EndPlay(EndPlayReason); UE_LOG(LogTemp, Warning, TEXT("EndPlay called")); // Clear all saved rooms TArray<LabRoom*> allRooms; AllocatedRoomSpace.GetKeys(allRooms); for (int i = allRooms.Num() - 1; i >= 0; --i) delete allRooms[i]; } // TODO delete? // Called at start of seamless travel, or right before map change for hard travel void AMainGameMode::StartToLeaveMap() { Super::StartToLeaveMap(); UE_LOG(LogTemp, Warning, TEXT("StartToLeaveMap called")); }
#include "platform.h" #include <library/cpp/unittest/registar.h> class TPlatformTest: public TTestBase { UNIT_TEST_SUITE(TPlatformTest); UNIT_TEST(TestSizeOf) UNIT_TEST_SUITE_END(); private: inline void TestSizeOf() { UNIT_ASSERT_EQUAL(SIZEOF_PTR, sizeof(void*)); UNIT_ASSERT_EQUAL(SIZEOF_CHAR, sizeof(char)); UNIT_ASSERT_EQUAL(SIZEOF_SHORT, sizeof(short)); UNIT_ASSERT_EQUAL(SIZEOF_INT, sizeof(int)); UNIT_ASSERT_EQUAL(SIZEOF_LONG, sizeof(long)); UNIT_ASSERT_EQUAL(SIZEOF_LONG_LONG, sizeof(long long)); UNIT_ASSERT_EQUAL(SIZEOF_SIZE_T, sizeof(size_t)); UNIT_ASSERT_EQUAL(SIZEOF_UNSIGNED_CHAR, sizeof(unsigned char)); UNIT_ASSERT_EQUAL(SIZEOF_UNSIGNED_INT, sizeof(unsigned int)); UNIT_ASSERT_EQUAL(SIZEOF_UNSIGNED_LONG, sizeof(unsigned long)); UNIT_ASSERT_EQUAL(SIZEOF_UNSIGNED_LONG_LONG, sizeof(unsigned long long)); UNIT_ASSERT_EQUAL(SIZEOF_UNSIGNED_SHORT, sizeof(unsigned short)); } }; UNIT_TEST_SUITE_REGISTRATION(TPlatformTest);
package org.freifeld.navigator; /** * @author royif * @since 24/02/17 */ public interface SerializationFactory { <T> Serializer<T> createSerializer(Class<T> cls); <T> Deserializer<T> createDeserializer(Class<T> cls); }
Dear Reader, As you can imagine, more people are reading The Jerusalem Post than ever before. Nevertheless, traditional business models are no longer sustainable and high-quality publications, like ours, are being forced to look for new ways to keep going. Unlike many other news organizations, we have not put up a paywall. We want to keep our journalism open and accessible and be able to keep providing you with news and analysis from the frontlines of Israel, the Middle East and the Jewish World. Amazing as it may sound, until lately the most notorious terrorist group on Earth was not considered illegal in Israel. Only on Wednesday evening did Defense Minister Moshe Ya’alon, based on the recommendation of the Shin Bet security service, issue a decree defining the Islamic State as an “unlawful association.” It must have been bureaucratic amnesia, nothing else. Israel has been at the front against terrorism with innovative counterterrorism and security methods, doctrines, and measures for decades and does not need a wake-up call to understand the danger of Islamic State. But the truth is that Islamic State does not at the moment pose any serious threat to Israel’s security.As a senior Israeli military source told me earlier this week, Islamic State has no presence in the 100-km. strip along the Israeli-Syrian border in the Golan Heights.That area is mainly controlled by the al-Qaida-affiliated Nusra Front, local groups of the disfranchised Free Syrian Army, and some loosely associated units of the Muslim Brotherhood.Both Nusra Front and the Muslim Brotherhood are radical Islamist organizations that hate and oppose Israel, but relative to Islamic State they can be considered as relatively “moderate.” Yet, according to the military source, it was noticed that in some villages in the area, some individuals – still very few of them – have started to preach the Islamic State ideology.The same can be said also about the Palestinian territories.In the West Bank and even more so in Gaza there have been a few attempts in the last few years to recruit members for local versions of Islamic State among Salafist associations. The Shin Bet is monitoring such efforts, as are the security agencies of the Palestinian Authority and even more so those of Hamas.The Hamas police and security agency showed much more cruelty when cracking down, in several cases, on preachers in Gaza mosques and their disciples who tried to preach Islamic State sermons, to issue decrees in the spirit of its ideology, and to announce the establishment of a caliphate.There have been dozens of Israeli Arabs who traveled to Syria, usually via Turkey, to join the fight against the regime of President Bashar Assad. At least one of them has been killed in action. A few who survived the fighting and returned were arrested by the Shin Bet and indicted.But all of the known cases were of volunteers who joined the Nusra Front.There is so far only one known case of Israeli citizens who joined the jihad war in Syria in Islamic State style.They are two members of the Alkian family from Hura, a Beduin community in the Negev. The Shin Bet arrested another member of the family who assisted them with financial support and arranged for them to meet an Islamic State liaison in Turkey.The fate of his relatives in Syria is unknown.This week witnessed another development against the Islamic State front as a result of the beheading of Steven Sotloff , the American-Israeli journalist who wrote also for The Jerusalem Report. US Secretary of State John Kerry phoned Prime Minister Binyamin Netanyahu in preparation for his upcoming trip to the Middle East to rally regional support and coordinate efforts to design a coherent strategy against Islamic State.The phone call aroused curiosity and generated questions about a possible Israeli role if an international coalition is indeed created to fight the Islamic State barbarians in Iraq and Syria.The truth of the matter is that Israel can do very little.Israel’s contribution to such a coalition would be marginal. Israel can share intelligence mainly about its areas of interest: Gaza, the West Bank and the border area with Syria. Israeli intelligence coverage of Iraq is very limited, but Israel does have good relations with the Kurds in Iraq who are now the spearhead in the war against Islamic State.Incidentally, the Kurds are supported also by Iran. It was the Iranian foreign minister who admitted last week in a joint press conference with Kurdish President Masoud Barzani that his country supplied the Kurds with weapons and ammunition. It can be said about this indirect Israeli- Kurdish-Iranian triangle that Middle Eastern politics sometimes make strange bedfellows.Even if Israel wished to play a bigger role in the international battle against Islamic State terrorism, this would be almost impossible. The Muslim states that are the potential partners for such a coalition – Saudi Arabia, UAE, Turkey and Egypt – would not wish to see Israel among their ranks. They may well be ready to accept secret Israeli cooperation, but not in the open.Israel shared such an experience more than 20 years ago. In 1990-91 when the US and the West built an international coalition against Iraqi dictator Saddam Hussein after his invasion of Kuwait, Israel was asked to stay away from Iraq and not interfere. Israel actually was intimidated and threatened by the George H.W. Bush administration to swallow its pride and not even retaliate when Hussein’s 39 Scud missiles hit the country.Israeli leaders were warned that any intervention would undermine the international effort and lead to the disintegration of the coalition. Join Jerusalem Post Premium Plus now for just $5 and upgrade your experience with an ads-free website and exclusive content. Click here>>
Zubir Said B.B.M. (22 July 1907 – 16 November 1987) was a Singaporean composer originally from the Minangkabau highlands of Indonesia who composed the national anthem of Singapore, "Majulah Singapura" ("Onward Singapore"). A self-taught musician, Zubir also worked as a score arranger and songwriter for Cathay-Keris Film Productions for 12 years, composing numerous songs for the company's Malay films. He is believed to have written about 1,500 songs, with less than 10% of them ever recorded.[1] It has been said that Zubir was viewed by many as a composer with a "true Malay soul", as his songs were interwoven with historical messages and Malay truisms, and that he and his Minangkabau contemporaries awoke a wave of national consciousness in the 1950s. Early years [ edit ] Majulah Singapura" on 6 September 1958. The song later became independent Singapore's The Victoria Theatre and Concert Hall as it appeared in January 2006. Victoria Theatre was the venue for the first public performance of Zubir Said's compositions, including "" on 6 September 1958. The song later became independent Singapore's national anthem The eldest child in a family of three boys and five girls, Zubir Said was born on 22 July 1907 in Bukittinggi (formerly known as Fort De Kock) in the Minangkabau highlands of West Sumatra, Indonesia.[2] His mother died when he was seven years old. He attended a Dutch school but had no interest in academic studies. His involvement with music started when he was introduced to the Solfa music system by a teacher. A primary-school classmate subsequently taught him how to make and play a flute, and in middle school, he learned to play the guitar and drums from fellow students and the keroncong group he was involved in.[3] Move to Singapore [ edit ] In 1928 at the age of 21, Zubir went to Singapore to make a living as a musician, taking up the suggestion of a sailor friend who had described the island as a place of "glittering lights, kopi susu [coffee with milk] and butter". This was done in the face of objections from his village chieftain father, Mohamad Said bin Sanang, who believed music to be against religion. Zubir's first job was as a musician with City Opera, a bangsawan or Malay opera troupe. He became the troupe's bandleader. Thereafter, in 1936, he joined the recording company His Master's Voice. Zubir went to Java to marry Tarminah Kario Wikromo, a keroncong singer, in 1938; they returned to Zubir's home town of Bukittinggi in 1941 just before the outbreak of World War II. Coming back to Singapore in 1947, Zubir worked as a part-time photographer with the Utusan Melayu newspaper[4] while composing and performing music and songs. In 1949 he took up the post of orchestra conductor at Shaw Brothers' Malay Film Production, and in 1952 he joined Cathay-Keris Film Productions as a score arranger and songwriter for the company's Malay films, including Sumpah Pontianak (Blood of Pontianak, 1958) and Chuchu Datuk Merah (Grandchildren of Datuk Merah, 1963).[5] In 1957, he received his first public recognition when his songs were performed at the Victoria Theatre.[2][3][6] "Majulah Singapura" [ edit ] Singapore, then a British colony, had been conferred city status by a royal charter from King George VI in 1951. In 1958, the City Council of Singapore approached Zubir to compose a song for the city to be titled "Majulah Singapura", which was a motto to be displayed in the Victoria Theatre after its renovation.[7] Zubir's song, "Majulah Singapura" ("Onward Singapore"), was first performed by the Singapore Chamber Ensemble during the grand finale of a concert staged in the Victoria Theatre on 6 September 1958 to celebrate its official reopening. When Singapore attained self-government in 1959, the Government felt that a national anthem was needed to unite the different races in Singapore. It decided that the City Council's song, which was already popular, would serve this purpose. After some revisions were made to the song, it was adopted by the Legislative Assembly on 11 November 1959, and on 30 November the Singapore State Arms and Flag and National Anthem Ordinance 1959[8] was passed. This statute regulated the use and display of the State Arms and State Flag and the performance of the National Anthem. "Majulah Singapura" was presented to the nation on 3 December at the launch of "Loyalty Week", replacing the colonial anthem "God Save the Queen". After Singapore's full independence from Malaysia on 9 August 1965, "Majulah Singapura" was formally adopted as the Republic's national anthem. In a 1984 oral history interview, to sum up his philosophy when composing the anthem, Zubir cited the Malay proverb "Di mana bumi dipijak, di situ langit dijunjung" ("You should hold up the sky of the land where you live").[9] Later years [ edit ] In 1962, Zubir's songs for the movie Dang Anom won an award at the Ninth Asian Film Festival in Seoul, South Korea.[10] He continued working for Cathay-Keris Film Productions until he retired in 1964, composing numerous songs for Malay films. He also gave music lessons, and often had other music artists visiting him to talk about music and asking for advice. His third and youngest daughter Puan Sri Dr. Rohana Zubir, a retired lecturer with the University of Malaya,[1] recalled how the family home in Singapore was always filled with music. He was the heart of the conversation, very enthused and willing to share pearls of wisdom so that others could benefit from his work. This generosity extended to other areas of his life. He helped his own family in Sumatra and families in Singapore he had "adopted", sending them medicine and other items with what little he could afford, even though his own family was not well off at the time.[11] Zubir said he was never driven by money. He believed that money was essential for his survival and to look after the family, and that the money he earned from giving music lessons and his compositions for the film world sufficed. He valued honesty and sincerity in his work and placed importance on purity and originality, whether in his music, lyrics or style of singing. He stopped composing songs for the film company when he was upset about the management's decision to cut production costs by borrowing existing music to be used for dubbing on to the background music of some films.[11] Zubir died at the age of 80 on 16 November 1987 at Joo Chiat Place in Singapore, survived by four daughters and a son. Despite his legacy, Zubir left only S$20,000 to his name and the family had no home to call its own. In 1990 Zubir's life and passion as a musician were documented in a book titled Zubir Said: His Songs, and in 2004 a S$20,000 bronze bust of a bespectacled Zubir was installed in Gallery 6 of the Malay Heritage Centre which pays tribute to icons in Malay arts and culture.[11] Awards and honours [ edit ] Zubir receives dozens of awards and honours from in and outside of Singapore for his massive contributions to the Malay world in songs and music and to Singapore. Some of his awards and honours were not in the list below. In recognition of his contributions to the State, Zubir was conferred the Sijil Kemuliaan (Certificate of Honour) on 16 March 1963[9] and the Bintang Bakti Masyarakat (Public Service Star) in the same year.[12] In 1971, he received the Jasawan Seni (cultural medallion) award from eight Malay cultural organisations, and the Asean Cultural and Communications Award in 1987. He also received a Certificate of Commendation from the Amalgamated Union of Public Employees (AUPE) for composing the AUPE song. In 1995, Zubir was posthumously[13] given a Lifetime Achievement Award by the Composers and Authors Society of Singapore (COMPASS).[2] On 8 May 2009 the Acting Minister for Information, Communications and the Arts, Rear Admiral (NS) Lui Tuck Yew, announced that the address of the permanent campus for the School of the Arts (Sota) near The Cathay will be 1 Zubir Said Drive, in honour of the late composer.[14] Music [ edit ] Zubir is primarily remembered for composing Singapore's national anthem, "Majulah Singapura" ("Onward Singapore"). The Malay lyrics exhort Singaporeans to "progress towards happiness together" ("Sama-sama menuju bahagia") so that their "noble aspiration[s] bring Singapore success" ("Cita-cita kita yang mulia / Berjaya Singapura"), and to "unite in a new spirit" ("Marilah kita bersatu / Dengan semangat yang baru"). In 1956, he also submitted three song compositions to the Malayan – later Malaysian – Government for consideration for their national anthem. However, a different song, "Negaraku", was selected in the end.[1] Zubir is also remembered for his composition "Semoga Bahagia" ("May You Achieve Happiness") which was aimed at primary-school students, advising them to work hard for their future. It has become a Children's Day song for Singaporean children, and is thus often sung in schools on 1 October. It is also performed during the Singapore Youth Festival. Zubir is estimated to have written about 1,500 songs, including those written for Cathay-Keris Film Productions' Malay films in the 1950s and 1960s. Less than 10% of these songs were recorded. On 22 August 2007, Zubir's family signed an agreement with Universal Music in Malaysia for the latter to manage his works. The copyright in the songs remains with his family. The idea to do so came after his daughter Dr. Rohana met Sandy Monteiro, senior vice-president (Asean) of the Universal Music Publishing Group in 2005 through Monteiro's wife, who was a good friend of hers. Dr. Rohana was reported as saying: "It is time to hand over the songs in order to revive them two decades after my father's passing. I hope to ensure that his songs continue to live in the hearts of young artists in Malaysia."[1] It is said that Zubir was viewed by many as a composer with a "true Malay soul", as his songs, traditional but yet modern and patriotic, were interwoven with historical messages and Malay truisms. Journalist A. Samad Ismail commented that Zubir and his Minangkabau contemporaries awoke a wave of national consciousness in the 1950s.[3] Works [ edit ] Zubir Said (1965), Membacha Musik [Reading Music Scores], Singapore: Zubir Said (in Malay). See also [ edit ] Notes [ edit ] References [ edit ] Further reading [ edit ] News reports [ edit ] Books [ edit ] Sulaiman Jeem; Abdul Ghani Hamid (1988), Mengenang Pak Zubir [Remembering "Father" Zubir], Singapore: Pustaka Melayu, ISBN 981-00-0636-5 (in Malay).
/** * A {@code ClientFactory} creates Http clients to access services within the SDA Platform or * external services. */ public class ClientFactory { private final Environment environment; private final String consumerToken; private final Tracer tracer; ClientFactory(Environment environment, String consumerToken, Tracer tracer) { this.environment = environment; this.consumerToken = consumerToken; this.tracer = tracer; } /** * Starts creation of a client that calls APIs within the SDA SE Platform. This clients * automatically send a {@code Trace-Token} from the incoming request or a new {@code Trace-Token} * to the API resources and can optionally send a {@code Consumer-Token} or pass through the * {@code Authorization} header from the incoming request. * * <p>The client is using gzip compression. * * @return a builder to configure the client */ public PlatformClientBuilder platformClient() { return platformClient(new HttpClientConfiguration()); } /** * Starts creation of a client that calls APIs within the SDA SE Platform. This clients * automatically send a {@code Trace-Token} from the incoming request or a new {@code Trace-Token} * to the API resources and can optionally send a {@code Consumer-Token} or pass through the * {@code Authorization} header from the incoming request. * * @param httpClientConfiguration Allows to pass additional configuration for the http client. * @return a builder to configure the client */ public PlatformClientBuilder platformClient(HttpClientConfiguration httpClientConfiguration) { return new PlatformClientBuilder( createClientBuilder(httpClientConfiguration), tracer, consumerToken); } /** * Starts creation of a client that calls APIs within the SDA SE Platform. This clients * automatically send a {@code Trace-Token} from the incoming request or a new {@code Trace-Token} * to the API resources and can optionally send a {@code Consumer-Token} or pass through the * {@code Authorization} header from the incoming request. * * @param disableGzipCompression if gzip compression of requests should be disabled. This may be * needed if the server can not communicate with gzip enabled * @return a builder to configure the client * @deprecated Use {@link #externalClient(HttpClientConfiguration)} instead. */ @Deprecated public PlatformClientBuilder platformClient(boolean disableGzipCompression) { return platformClient(new HttpClientConfiguration().setGzipEnabled(!disableGzipCompression)); } /** * Starts creation of a client that calls APIs outside of the SDA SE Platform. This clients does * no header magic. * * <p>The client is using gzip compression. * * @return a builder to configure the client */ public ExternalClientBuilder externalClient() { return externalClient(new HttpClientConfiguration()); } /** * Starts creation of a client that calls APIs outside of the SDA SE Platform. This clients does * no header magic. * * @param httpClientConfiguration Allows to pass additional configuration for the http client. * @return a builder to configure the client */ public ExternalClientBuilder externalClient(HttpClientConfiguration httpClientConfiguration) { return new ExternalClientBuilder(createClientBuilder(httpClientConfiguration), tracer); } /** * Starts creation of a client that calls APIs outside of the SDA SE Platform. This clients does * no header magic. * * @param disableGzipCompression if gzip compression of requests should be disabled. This may be * needed if the server can not communicate with gzip enabled * @return a builder to configure the client * @deprecated Use {@link #externalClient(HttpClientConfiguration)} instead. */ @Deprecated public ExternalClientBuilder externalClient(boolean disableGzipCompression) { return externalClient(new HttpClientConfiguration().setGzipEnabled(!disableGzipCompression)); } private JerseyClientBuilder createClientBuilder(HttpClientConfiguration httpClientConfiguration) { JerseyClientConfiguration configuration = new JerseyClientConfiguration(); configuration.setChunkedEncodingEnabled(httpClientConfiguration.isChunkedEncodingEnabled()); configuration.setGzipEnabled(httpClientConfiguration.isGzipEnabled()); configuration.setGzipEnabledForRequests(httpClientConfiguration.isGzipEnabledForRequests()); return new JerseyClientBuilder(environment).using(configuration); } }
#include "FWCore/Framework/interface/Event.h" #include "EMTFCollections.h" namespace l1t { namespace stage2 { EMTFCollections::~EMTFCollections() { // std::cout << "Inside EMTFCollections.cc: ~EMTFCollections" << std::endl; // Sort by processor to match uGMT unpacked order L1TMuonEndCap::sort_uGMT_muons(*regionalMuonCands_); // Apply ZeroSuppression: Only save RPC hits if there is at least one CSC LCT in the sector bool has_LCT[12] = {false}; for (int iSect = 0; iSect < 12; iSect++) { for (const auto& h : *EMTFHits_) { if (h.Is_CSC() && h.Sector_idx() == iSect) { has_LCT[iSect] = true; break; } } } for (const auto& h : *EMTFHits_) { if (has_LCT[h.Sector_idx()] || (h.Is_RPC() == 0 && h.Is_GEM() == 0)) { EMTFHits_ZS_->push_back(h); } } for (const auto& c : *EMTFCPPFs_) { int sect_idx = c.emtf_sector() - 1 + 6 * (c.rpcId().region() == -1); if (has_LCT[sect_idx]) { EMTFCPPFs_ZS_->push_back(c); } } // TODO: Do we need something equivalent for GEMs - JS 03.07.20 // for (const auto& g : *EMTFGEMPadClusters_) { // int sect_idx = g.emtf_sector() - 1 + 6 * (g.gemId().region() == -1); // if (has_LCT[sect_idx]) { // EMTFGEMPadClusters_ZS_->push_back(g); // } // } event_.put(std::move(regionalMuonCands_)); event_.put(std::move(regionalMuonShowers_)); event_.put(std::move(EMTFDaqOuts_)); event_.put(std::move(EMTFHits_ZS_)); event_.put(std::move(EMTFTracks_)); event_.put(std::move(EMTFLCTs_)); event_.put(std::move(EMTFCSCShowers_)); event_.put(std::move(EMTFCPPFs_ZS_)); event_.put(std::move(EMTFGEMPadClusters_)); // event_.put(std::move(EMTFGEMPadClusters_ZS_)); } } // namespace stage2 } // namespace l1t
use crate::builder::traits::{ Associative, Builder, Multilevel, Policy, Profiler, Sequential, }; use crate::Array; use std::marker::PhantomData; /// `Array` builder. /// /// This builder can be consumed later to spawn an /// [`Array`](../../struct.Array.html) container. /// /// ## Examples /// ``` /// use byoc::BuildingBlock; /// use byoc::builder::traits::*; /// use byoc::builder::builders::ArrayBuilder; /// /// let mut array = ArrayBuilder::new(2).build(); /// array.push(vec![(1, 2)]); /// ``` pub struct ArrayBuilder<T> { capacity: usize, unused: PhantomData<T>, } impl<T> ArrayBuilder<T> { /// The [Array](../../struct.Array.html) container /// spawned by this builder will have a maximum `capacity`. pub fn new(capacity: usize) -> Self { ArrayBuilder { capacity, unused: PhantomData, } } } impl<T> Clone for ArrayBuilder<T> { fn clone(&self) -> Self { ArrayBuilder { capacity: self.capacity, unused: PhantomData, } } } impl<T> Policy<Array<T>> for ArrayBuilder<T> {} impl<T, H: std::hash::Hasher + Clone> Associative<Array<T>, H> for ArrayBuilder<T> { } impl<T> Sequential<Array<T>> for ArrayBuilder<T> {} impl<T> Profiler<Array<T>> for ArrayBuilder<T> {} impl<T, R, RB: Builder<R>> Multilevel<Array<T>, R, RB> for ArrayBuilder<T> { } impl<T> Builder<Array<T>> for ArrayBuilder<T> { fn build(self) -> Array<T> { Array::new(self.capacity) } }
<gh_stars>1-10 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package controller import ( "fmt" "github.com/apache/submarine/submarine-cloud/pkg/controller/pod" "github.com/apache/submarine/submarine-cloud/pkg/controller/sanitycheck" "github.com/apache/submarine/submarine-cloud/pkg/submarine" "github.com/golang/glog" apiv1 "k8s.io/api/core/v1" policyv1 "k8s.io/api/policy/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/wait" kubeinformers "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes/scheme" typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1" corev1listers "k8s.io/client-go/listers/core/v1" policyv1listers "k8s.io/client-go/listers/policy/v1beta1" "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/record" "k8s.io/client-go/util/workqueue" "math" "reflect" "time" rapi "github.com/apache/submarine/submarine-cloud/pkg/apis/submarine/v1alpha1" sClient "github.com/apache/submarine/submarine-cloud/pkg/client/clientset/versioned" sInformers "github.com/apache/submarine/submarine-cloud/pkg/client/informers/externalversions" sListers "github.com/apache/submarine/submarine-cloud/pkg/client/listers/submarine/v1alpha1" clientset "k8s.io/client-go/kubernetes" ) // Controller contains all controller fields type Controller struct { kubeClient clientset.Interface submarineClient sClient.Interface submarineClusterLister sListers.SubmarineClusterLister SubmarineClusterSynced cache.InformerSynced podLister corev1listers.PodLister PodSynced cache.InformerSynced serviceLister corev1listers.ServiceLister ServiceSynced cache.InformerSynced podDisruptionBudgetLister policyv1listers.PodDisruptionBudgetLister PodDiscruptionBudgetSynced cache.InformerSynced podControl pod.SubmarineClusterControlInterface serviceControl ServicesControlInterface podDisruptionBudgetControl PodDisruptionBudgetsControlInterface updateHandler func(cluster *rapi.SubmarineCluster) (*rapi.SubmarineCluster, error) // callback to update SubmarineCluster. Added as member for testing queue workqueue.RateLimitingInterface // SubmarineClusters to be synced recorder record.EventRecorder config *Config } // NewController builds and return new controller instance func NewController(cfg *Config, kubeClient clientset.Interface, submarineClient sClient.Interface, kubeInformer kubeinformers.SharedInformerFactory, rInformer sInformers.SharedInformerFactory) *Controller { glog.Info("NewController()") eventBroadcaster := record.NewBroadcaster() eventBroadcaster.StartLogging(glog.Infof) eventBroadcaster.StartRecordingToSink(&typedcorev1.EventSinkImpl{Interface: kubeClient.CoreV1().Events("")}) serviceInformer := kubeInformer.Core().V1().Services() podInformer := kubeInformer.Core().V1().Pods() submarineInformer := rInformer.Submarine().V1alpha1().SubmarineClusters() podDisruptionBudgetInformer := kubeInformer.Policy().V1beta1().PodDisruptionBudgets() ctrl := &Controller{ kubeClient: kubeClient, submarineClient: submarineClient, submarineClusterLister: submarineInformer.Lister(), SubmarineClusterSynced: submarineInformer.Informer().HasSynced, podLister: podInformer.Lister(), PodSynced: podInformer.Informer().HasSynced, serviceLister: serviceInformer.Lister(), ServiceSynced: serviceInformer.Informer().HasSynced, podDisruptionBudgetLister: podDisruptionBudgetInformer.Lister(), PodDiscruptionBudgetSynced: podDisruptionBudgetInformer.Informer().HasSynced, queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "submarinecluster"), recorder: eventBroadcaster.NewRecorder(scheme.Scheme, apiv1.EventSource{Component: "submarinecluster-controller"}), config: cfg, } submarineInformer.Informer().AddEventHandler( cache.ResourceEventHandlerFuncs{ AddFunc: ctrl.onAddSubmarineCluster, UpdateFunc: ctrl.onUpdateSubmarineCluster, DeleteFunc: ctrl.onDeleteSubmarineCluster, }, ) podInformer.Informer().AddEventHandler( cache.ResourceEventHandlerFuncs{ AddFunc: ctrl.onAddPod, UpdateFunc: ctrl.onUpdatePod, DeleteFunc: ctrl.onDeletePod, }, ) ctrl.updateHandler = ctrl.updateSubmarineCluster ctrl.podControl = pod.NewSubmarineClusterControl(ctrl.podLister, ctrl.kubeClient, ctrl.recorder) ctrl.serviceControl = NewServicesControl(ctrl.kubeClient, ctrl.recorder) ctrl.podDisruptionBudgetControl = NewPodDisruptionBudgetsControl(ctrl.kubeClient, ctrl.recorder) return ctrl } // Run executes the Controller func (c *Controller) Run(stop <-chan struct{}) error { glog.Infof("Starting SubmarineCluster controller") if !cache.WaitForCacheSync(stop, c.PodSynced, c.SubmarineClusterSynced, c.ServiceSynced) { return fmt.Errorf("Timed out waiting for caches to sync") } for i := 0; i < c.config.NbWorker; i++ { go wait.Until(c.runWorker, time.Second, stop) } <-stop return nil } func (c *Controller) runWorker() { for c.processNextItem() { } } func (c *Controller) processNextItem() bool { glog.Infof("processNextItem") key, quit := c.queue.Get() if quit { return false } defer c.queue.Done(key) needRequeue, err := c.sync(key.(string)) if err == nil { c.queue.Forget(key) } else { utilruntime.HandleError(fmt.Errorf("Error syncing submarinecluster: %v", err)) c.queue.AddRateLimited(key) return true } if needRequeue { glog.V(4).Info("processNextItem: Requeue key:", key) c.queue.AddRateLimited(key) } return true } func (c *Controller) sync(key string) (bool, error) { glog.V(2).Infof("sync() key:%s", key) startTime := metav1.Now() defer func() { glog.V(2).Infof("Finished syncing SubmarineCluster %q (%v", key, time.Since(startTime.Time)) }() namespace, name, err := cache.SplitMetaNamespaceKey(key) if err != nil { return false, err } glog.V(6).Infof("Syncing %s/%s", namespace, name) sharedSubmarineCluster, err := c.submarineClusterLister.SubmarineClusters(namespace).Get(name) if err != nil { glog.Errorf("unable to get SubmarineCluster %s/%s: %v. Maybe deleted", namespace, name, err) return false, nil } if !rapi.IsDefaultedSubmarineCluster(sharedSubmarineCluster) { defaultedSubmarineCluster := rapi.DefaultSubmarineCluster(sharedSubmarineCluster) if _, err = c.updateHandler(defaultedSubmarineCluster); err != nil { glog.Errorf("SubmarineCluster %s/%s updated error:, err", namespace, name) return false, fmt.Errorf("unable to default SubmarineCluster %s/%s: %v", namespace, name, err) } glog.V(6).Infof("SubmarineCluster-Operator.sync Defaulted %s/%s", namespace, name) return false, nil } // TODO add validation // TODO: add test the case of graceful deletion if sharedSubmarineCluster.DeletionTimestamp != nil { return false, nil } submarinecluster := sharedSubmarineCluster.DeepCopy() // Init status.StartTime if submarinecluster.Status.StartTime == nil { submarinecluster.Status.StartTime = &startTime if _, err := c.updateHandler(submarinecluster); err != nil { glog.Errorf("SubmarineCluster %s/%s: unable init startTime: %v", namespace, name, err) return false, nil } glog.V(4).Infof("SubmarineCluster %s/%s: startTime updated", namespace, name) return false, nil } return c.syncCluster(submarinecluster) } func (c *Controller) syncCluster(submarineCluster *rapi.SubmarineCluster) (forceRequeue bool, err error) { glog.Info("syncCluster START") defer glog.Info("syncCluster STOP") forceRequeue = false submarineClusterService, err := c.getSubmarineClusterService(submarineCluster) if err != nil { glog.Errorf("SubmarineCluster-Operator.sync unable to retrieves service associated to the SubmarineCluster: %s/%s", submarineCluster.Namespace, submarineCluster.Name) return forceRequeue, err } if submarineClusterService == nil { if _, err = c.serviceControl.CreateSubmarineClusterService(submarineCluster); err != nil { glog.Errorf("SubmarineCluster-Operator.sync unable to create service associated to the SubmarineCluster: %s/%s", submarineCluster.Namespace, submarineCluster.Name) return forceRequeue, err } } submarineClusterPodDisruptionBudget, err := c.getSubmarineClusterPodDisruptionBudget(submarineCluster) if err != nil { glog.Errorf("SubmarineCluster-Operator.sync unable to retrieves podDisruptionBudget associated to the SubmarineCluster: %s/%s", submarineCluster.Namespace, submarineCluster.Name) return forceRequeue, err } if submarineClusterPodDisruptionBudget == nil { if _, err = c.podDisruptionBudgetControl.CreateSubmarineClusterPodDisruptionBudget(submarineCluster); err != nil { glog.Errorf("SubmarineCluster-Operator.sync unable to create podDisruptionBudget associated to the SubmarineCluster: %s/%s", submarineCluster.Namespace, submarineCluster.Name) return forceRequeue, err } } submarineClusterPods, err := c.podControl.GetSubmarineClusterPods(submarineCluster) if err != nil { glog.Errorf("SubmarineCluster-Operator.sync unable to retrieves pod associated to the SubmarineCluster: %s/%s", submarineCluster.Namespace, submarineCluster.Name) return forceRequeue, err } Pods, LostPods := filterLostNodes(submarineClusterPods) if len(LostPods) != 0 { for _, p := range LostPods { err := c.podControl.DeletePodNow(submarineCluster, p.Name) glog.Errorf("Lost node with pod %s. Deleting... %v", p.Name, err) } submarineClusterPods = Pods } // SubmarineAdmin is used access the Submarine process in the different pods. admin, err := NewSubmarineAdmin(submarineClusterPods, &c.config.submarine) if err != nil { return forceRequeue, fmt.Errorf("unable to create the submarine.Admin, err:%v", err) } defer admin.Close() clusterInfos, errGetInfos := admin.GetClusterInfos() if errGetInfos != nil { glog.Errorf("Error when get cluster infos to rebuild bom : %v", errGetInfos) if clusterInfos.Status == submarine.ClusterInfosPartial { return false, fmt.Errorf("partial Cluster infos") } } // From the Submarine cluster nodes connections, build the cluster status // Calculate the actual cluster status through node information, cluster Pod list, and CR // The cluster status includes: whether it is normal, the number of Ready Pods, the number of Masters, // the number of Submarine instances in operation, the list of Submarine instances, replication factors, etc. clusterStatus, err := c.buildClusterStatus(clusterInfos, submarineClusterPods) if err != nil { glog.Errorf("unable to build the SubmarineClusterStatus, err:%v", err) return forceRequeue, fmt.Errorf("unable to build clusterStatus, err:%v", err) } // If the cluster status (Status.Cluster) in the CR does not match the actual situation, update updated, err := c.updateClusterIfNeed(submarineCluster, clusterStatus) if err != nil { return forceRequeue, err } if updated { // If the cluster status changes requeue the key. Because we want to apply Submarine Cluster operation only on stable cluster, // already stored in the API server. glog.V(3).Infof("cluster updated %s-%s", submarineCluster.Namespace, submarineCluster.Name) forceRequeue = true return forceRequeue, nil } // If the CR state matches the actual state of the Submarine cluster, then check if reconciliation is required-let the actual state match the expected state allPodsNotReady := true if (clusterStatus.NbPods - clusterStatus.NbSubmarineRunning) != 0 { glog.V(3).Infof("All pods not ready wait to be ready, nbPods: %d, nbPodsReady: %d", clusterStatus.NbPods, clusterStatus.NbSubmarineRunning) allPodsNotReady = false } // Now check if the Operator need to execute some operation the submarine cluster. if yes run the clusterAction(...) method. needSanitize, err := c.checkSanityCheck(submarineCluster, admin, clusterInfos) if err != nil { glog.Errorf("checkSanityCheck, error happened in dryrun mode, err:%v", err) return false, err } // If all Pods are not ready and need rolling updates (Pod and PodTemplate do not match), more or fewer Pods are needed, // or the number of master nodes and replication factor are incorrect // Or, need to perform "clean up" // Then, perform Submarine cluster management operations to approximate the expected state and update the status of SubmarineCluster if (allPodsNotReady && needClusterOperation(submarineCluster)) || needSanitize { var requeue bool forceRequeue = false // Perform cluster management operations, including creating / deleting pods and configuring Submarine requeue, err = c.clusterAction(admin, submarineCluster, clusterInfos) if err != nil { glog.Errorf("error during action on cluster: %s-%s, err: %v", submarineCluster.Namespace, submarineCluster.Name, err) } else if requeue { forceRequeue = true } _, err = c.updateSubmarineCluster(submarineCluster) return forceRequeue, err } // Reset all conditions and reconcile if setRebalancingCondition(&submarineCluster.Status, false) || setRollingUpdateCondition(&submarineCluster.Status, false) || setScalingCondition(&submarineCluster.Status, false) || setClusterStatusCondition(&submarineCluster.Status, true) { _, err = c.updateHandler(submarineCluster) return forceRequeue, err } return false, nil } func (c *Controller) onAddSubmarineCluster(obj interface{}) { glog.Infof("onAddSubmarineCluster(%v)", obj) submarineCluster, ok := obj.(*rapi.SubmarineCluster) if !ok { glog.Errorf("adding SubmarineCluster, expected SubmarineCluster object. Got: %+v", obj) return } glog.V(6).Infof("onAddSubmarineCluster %s/%s", submarineCluster.Namespace, submarineCluster.Name) if !reflect.DeepEqual(submarineCluster.Status, rapi.SubmarineClusterStatus{}) { glog.Errorf("submarinecluster %s/%s created with non empty status. Going to be removed", submarineCluster.Namespace, submarineCluster.Name) if _, err := cache.MetaNamespaceKeyFunc(submarineCluster); err != nil { glog.Errorf("couldn't get key for SubmarineCluster (to be deleted) %s/%s: %v", submarineCluster.Namespace, submarineCluster.Name, err) return } // TODO: how to remove a submarineCluster created with an invalid or even with a valid status. What in case of error for this delete? if err := c.deleteSubmarineCluster(submarineCluster.Namespace, submarineCluster.Name); err != nil { glog.Errorf("unable to delete non empty status SubmarineCluster %s/%s: %v. No retry will be performed.", submarineCluster.Namespace, submarineCluster.Name, err) } return } c.enqueue(submarineCluster) } func (c *Controller) onDeleteSubmarineCluster(obj interface{}) { glog.Infof("onDeleteSubmarineCluster(%v)", obj) } func (c *Controller) onUpdateSubmarineCluster(oldObj, newObj interface{}) { glog.Infof("onUpdateSubmarineCluster(%v, %v)", oldObj, newObj) submarineCluster, ok := newObj.(*rapi.SubmarineCluster) if !ok { glog.Errorf("Expected SubmarineCluster object. Got: %+v", newObj) return } glog.V(6).Infof("onUpdateSubmarineCluster %s/%s", submarineCluster.Namespace, submarineCluster.Name) c.enqueue(submarineCluster) } func (c *Controller) onAddPod(obj interface{}) { glog.Infof("onAddPod()") pod, ok := obj.(*apiv1.Pod) if !ok { glog.Errorf("adding Pod, expected Pod object. Got: %+v", obj) return } if _, ok := pod.GetObjectMeta().GetLabels()[rapi.ClusterNameLabelKey]; !ok { return } submarineCluster, err := c.getSubmarineClusterFromPod(pod) if err != nil { glog.Errorf("unable to retrieve the associated submarinecluster for pod %s/%s:%v", pod.Namespace, pod.Name, err) return } if submarineCluster == nil { glog.Errorf("empty submarineCluster. Unable to retrieve the associated submarinecluster for the pod %s/%s", pod.Namespace, pod.Name) return } c.enqueue(submarineCluster) } func (c *Controller) onUpdatePod(oldObj, newObj interface{}) { glog.Infof("onUpdatePod()") oldPod := oldObj.(*apiv1.Pod) newPod := newObj.(*apiv1.Pod) if oldPod.ResourceVersion == newPod.ResourceVersion { // Since periodic resync will send update events for all known Pods. return } if _, ok := newPod.GetObjectMeta().GetLabels()[rapi.ClusterNameLabelKey]; !ok { return } glog.V(6).Infof("onUpdatePod old=%v, cur=%v ", oldPod.Name, newPod.Name) submarineCluster, err := c.getSubmarineClusterFromPod(newPod) if err != nil { glog.Errorf("SubmarineCluster-Operator.onUpdateJob cannot get submarineclusters for Pod %s/%s: %v", newPod.Namespace, newPod.Name, err) return } if submarineCluster == nil { glog.Errorf("empty submarineCluster .onUpdateJob cannot get submarineclusters for Pod %s/%s", newPod.Namespace, newPod.Name) return } c.enqueue(submarineCluster) // TODO: in case of relabelling ? // TODO: in case of labelSelector relabelling? } func (c *Controller) onDeletePod(obj interface{}) { glog.Infof("onDeletePod()") pod, ok := obj.(*apiv1.Pod) if _, ok := pod.GetObjectMeta().GetLabels()[rapi.ClusterNameLabelKey]; !ok { return } glog.V(6).Infof("onDeletePod old=%v", pod.Name) if !ok { tombstone, ok := obj.(cache.DeletedFinalStateUnknown) if !ok { glog.Errorf("Couldn't get object from tombstone %+v", obj) return } pod, ok = tombstone.Obj.(*apiv1.Pod) if !ok { glog.Errorf("Tombstone contained object that is not a pod %+v", obj) return } } submarineCluster, err := c.getSubmarineClusterFromPod(pod) if err != nil { glog.Errorf("SubmarineCluster-Operator.onDeletePod: %v", err) return } if submarineCluster == nil { glog.Errorf("empty submarineCluster . SubmarineCluster-Operator.onDeletePod") return } c.enqueue(submarineCluster) } func (c *Controller) updateSubmarineCluster(submarineCluster *rapi.SubmarineCluster) (*rapi.SubmarineCluster, error) { rc, err := c.submarineClient.SubmarineV1alpha1().SubmarineClusters(submarineCluster.Namespace).Update(submarineCluster) if err != nil { glog.Errorf("updateSubmarineCluster cluster: [%v] error: %v", *submarineCluster, err) return rc, err } glog.V(6).Infof("SubmarineCluster %s/%s updated", submarineCluster.Namespace, submarineCluster.Name) return rc, nil } // enqueue adds key in the controller queue func (c *Controller) enqueue(submarinecluster *rapi.SubmarineCluster) { key, err := cache.MetaNamespaceKeyFunc(submarinecluster) if err != nil { glog.Errorf("SubmarineCluster-Controller:enqueue: couldn't get key for SubmarineCluster %s/%s: %v", submarinecluster.Namespace, submarinecluster.Name, err) return } c.queue.Add(key) } func (c *Controller) getSubmarineClusterService(submarineCluster *rapi.SubmarineCluster) (*apiv1.Service, error) { serviceName := getServiceName(submarineCluster) labels, err := pod.GetLabelsSet(submarineCluster) if err != nil { return nil, fmt.Errorf("couldn't get cluster label, err: %v ", err) } svcList, err := c.serviceLister.Services(submarineCluster.Namespace).List(labels.AsSelector()) if err != nil { return nil, fmt.Errorf("couldn't list service with label:%s, err:%v ", labels.String(), err) } var svc *apiv1.Service for i, s := range svcList { if s.Name == serviceName { svc = svcList[i] } } return svc, nil } func (c *Controller) getSubmarineClusterPodDisruptionBudget(submarineCluster *rapi.SubmarineCluster) (*policyv1.PodDisruptionBudget, error) { podDisruptionBudgetName := submarineCluster.Name labels, err := pod.GetLabelsSet(submarineCluster) if err != nil { return nil, fmt.Errorf("couldn't get cluster label, err: %v ", err) } pdbList, err := c.podDisruptionBudgetLister.PodDisruptionBudgets(submarineCluster.Namespace).List(labels.AsSelector()) if err != nil { return nil, fmt.Errorf("couldn't list PodDisruptionBudget with label:%s, err:%v ", labels.String(), err) } var pdb *policyv1.PodDisruptionBudget for i, p := range pdbList { if p.Name == podDisruptionBudgetName { pdb = pdbList[i] } } return pdb, nil } func (c *Controller) buildClusterStatus(clusterInfos *submarine.ClusterInfos, pods []*apiv1.Pod) (*rapi.SubmarineClusterClusterStatus, error) { clusterStatus := &rapi.SubmarineClusterClusterStatus{} clusterStatus.NbPodsReady = 0 clusterStatus.NbSubmarineRunning = 0 clusterStatus.MaxReplicationFactor = 0 clusterStatus.MinReplicationFactor = 0 clusterStatus.NbPods = int32(len(pods)) var nbSubmarineRunning, nbPodsReady int32 nbMaster := int32(0) nbSlaveByMaster := map[string]int{} for _, pod := range pods { if podready, _ := IsPodReady(pod); podready { nbPodsReady++ } newNode := rapi.SubmarineClusterNode{ PodName: pod.Name, IP: pod.Status.PodIP, Pod: pod, Slots: []string{}, } // find corresponding Submarine node submarineNodes, err := clusterInfos.GetNodes().GetNodesByFunc(func(node *submarine.Node) bool { return node.IP == pod.Status.PodIP }) if err != nil { glog.Errorf("Unable to retrieve the associated Submarine Node with the pod: %s, ip:%s, err:%v", pod.Name, pod.Status.PodIP, err) continue } if len(submarineNodes) == 1 { submarineNode := submarineNodes[0] if submarine.IsMasterWithSlot(submarineNode) { if _, ok := nbSlaveByMaster[submarineNode.ID]; !ok { nbSlaveByMaster[submarineNode.ID] = 0 } nbMaster++ } newNode.ID = submarineNode.ID newNode.Role = submarineNode.GetRole() newNode.Port = submarineNode.Port newNode.Slots = []string{} if submarine.IsSlave(submarineNode) && submarineNode.MasterReferent != "" { nbSlaveByMaster[submarineNode.MasterReferent] = nbSlaveByMaster[submarineNode.MasterReferent] + 1 newNode.MasterRef = submarineNode.MasterReferent } ///if len(submarineNode.Slots) > 0 { /// slots := submarine.SlotRangesFromSlots(submarineNode.Slots) /// for _, slot := range slots { /// newNode.Slots = append(newNode.Slots, slot.String()) /// } ///} nbSubmarineRunning++ } clusterStatus.Nodes = append(clusterStatus.Nodes, newNode) } clusterStatus.NbSubmarineRunning = nbSubmarineRunning clusterStatus.NumberOfMaster = nbMaster clusterStatus.NbPodsReady = nbPodsReady clusterStatus.Status = rapi.ClusterStatusOK minReplicationFactor := math.MaxInt32 maxReplicationFactor := 0 for _, counter := range nbSlaveByMaster { if counter > maxReplicationFactor { maxReplicationFactor = counter } if counter < minReplicationFactor { minReplicationFactor = counter } } if len(nbSlaveByMaster) == 0 { minReplicationFactor = 0 } clusterStatus.MaxReplicationFactor = int32(maxReplicationFactor) clusterStatus.MinReplicationFactor = int32(minReplicationFactor) glog.V(3).Infof("Build Bom, current Node list : %s ", clusterStatus.String()) return clusterStatus, nil } func (c *Controller) updateClusterIfNeed(cluster *rapi.SubmarineCluster, newStatus *rapi.SubmarineClusterClusterStatus) (bool, error) { if compareStatus(&cluster.Status.Cluster, newStatus) { glog.V(3).Infof("Status changed for cluster: %s-%s", cluster.Namespace, cluster.Name) // the status have been update, needs to update the SubmarineCluster cluster.Status.Cluster = *newStatus _, err := c.updateSubmarineCluster(cluster) return true, err } // TODO improve this by checking properly the kapi.Pod informations inside each Node cluster.Status.Cluster.Nodes = newStatus.Nodes return false, nil } func (c *Controller) checkSanityCheck(cluster *rapi.SubmarineCluster, admin submarine.AdminInterface, infos *submarine.ClusterInfos) (bool, error) { return sanitycheck.RunSanityChecks(admin, &c.config.submarine, c.podControl, cluster, infos, true) } func (c *Controller) deleteSubmarineCluster(namespace, name string) error { return nil } func (c *Controller) getSubmarineClusterFromPod(pod *apiv1.Pod) (*rapi.SubmarineCluster, error) { if len(pod.Labels) == 0 { return nil, fmt.Errorf("no submarineCluster found for pod. Pod %s/%s has no labels", pod.Namespace, pod.Name) } clusterName, ok := pod.Labels[rapi.ClusterNameLabelKey] if !ok { return nil, fmt.Errorf("no submarineCluster name found for pod. Pod %s/%s has no labels %s", pod.Namespace, pod.Name, rapi.ClusterNameLabelKey) } return c.submarineClusterLister.SubmarineClusters(pod.Namespace).Get(clusterName) }
def merge_infrequent_targets(self): value_counts = self.learning_data[self.target_column].value_counts( ).to_frame() top_targets = value_counts.head(self.top_x_targets).index.to_list() self.learning_data[self.target_column] = self.learning_data[self.target_column].apply( lambda x: self.combine_targets(x, top_targets))