text:
package de.evorepair.analysis.operator;

import org.eclipse.emf.ecore.EObject;

import de.evorepair.analysis.provider.EvoResourceProvider;
import de.evorepair.evolution.variable.EvoFeatureVariable;
import de.evorepair.evolution.variable.EvoVariable;
import de.evorepair.feature.mapping.repair.evomappingrepair.EvoMappingReplace;
import de.evorepair.logic.EvoVariableExpression;
import eu.hyvar.feature.HyFeature;
import eu.hyvar.feature.expression.HyAdditionExpression;
import eu.hyvar.feature.expression.HyAndExpression;
import eu.hyvar.feature.expression.HyAttributeReferenceExpression;
import eu.hyvar.feature.expression.HyBinaryExpression;
import eu.hyvar.feature.expression.HyBooleanValueExpression;
import eu.hyvar.feature.expression.HyConditionalFeatureReferenceExpression;
import eu.hyvar.feature.expression.HyContextInformationReferenceExpression;
import eu.hyvar.feature.expression.HyDivisionExpression;
import eu.hyvar.feature.expression.HyEqualExpression;
import eu.hyvar.feature.expression.HyEquivalenceExpression;
import eu.hyvar.feature.expression.HyExpression;
import eu.hyvar.feature.expression.HyExpressionFactory;
import eu.hyvar.feature.expression.HyFeatureReferenceExpression;
import eu.hyvar.feature.expression.HyGreaterExpression;
import eu.hyvar.feature.expression.HyGreaterOrEqualExpression;
import eu.hyvar.feature.expression.HyIfPossibleExpression;
import eu.hyvar.feature.expression.HyImpliesExpression;
import eu.hyvar.feature.expression.HyLessExpression;
import eu.hyvar.feature.expression.HyLessOrEqualExpression;
import eu.hyvar.feature.expression.HyMaximumExpression;
import eu.hyvar.feature.expression.HyMinimumExpression;
import eu.hyvar.feature.expression.HyModuloExpression;
import eu.hyvar.feature.expression.HyMultiplicationExpression;
import eu.hyvar.feature.expression.HyNegationExpression;
import eu.hyvar.feature.expression.HyNestedExpression;
import eu.hyvar.feature.expression.HyNotEqualExpression;
import eu.hyvar.feature.expression.HyNotExpression;
import eu.hyvar.feature.expression.HyOrExpression;
import eu.hyvar.feature.expression.HySetExpression;
import eu.hyvar.feature.expression.HySubtractionExpression;
import eu.hyvar.feature.expression.HyUnaryExpression;
import eu.hyvar.feature.expression.HyValueExpression;
import eu.hyvar.feature.mapping.HyMapping;
import eu.hyvar.feature.mapping.HyMappingModel;

public class EvoGuidanceMappingRepairOperator extends EvoGuidanceRepairOperator{
	/**
	 * Checks if two features are the same (same id).
	 * @param feature1
	 * @param feature2
	 * @return true if both features are the same or have the same id
	 */
	private static boolean featureMatch(HyFeature feature1, HyFeature feature2) {
		return feature1.equals(feature2) || feature1.getId().equals(feature2.getId());
	}

	/**
	 * Check if two expressions match. Checks only if the types of the expressions match not the content.
	 * @param expression1
	 * @param expression2
	 * @return true if both expressions match
	 */
	private static boolean expressionsMatch(HyExpression expression1, HyExpression expression2) {
		if(expression1 instanceof HyAndExpression && expression2  instanceof HyAndExpression) {
			return true;
		}else if(expression1 instanceof HyOrExpression && expression2  instanceof HyOrExpression) {
			return true;
		}else if(expression1 instanceof HyNotExpression && expression2  instanceof HyNotExpression) {
			return true;
		}else if(expression1 instanceof HyEquivalenceExpression && expression2  instanceof HyEquivalenceExpression) {
			return true;
		}else if(expression1 instanceof HyImpliesExpression && expression2  instanceof HyImpliesExpression) {
			return true;
		}else if(expression1 instanceof HyNestedExpression && expression2  instanceof HyNestedExpression) {
			return true;
		}else if(expression1 instanceof HyFeatureReferenceExpression && expression2  instanceof HyFeatureReferenceExpression) {
			return featureMatch(((HyFeatureReferenceExpression)expression1).getFeature(), ((HyFeatureReferenceExpression)expression2).getFeature());
		}else if(expression1 instanceof HyFeatureReferenceExpression && expression2 instanceof EvoVariableExpression) {
			EvoVariable variable = ((EvoVariableExpression)expression2).getVariable();

			if(variable instanceof EvoFeatureVariable) {
				return featureMatch(((HyFeatureReferenceExpression)expression1).getFeature(), ((EvoFeatureVariable)variable).getFeature());
			}

			return false;
		}else if(expression1 instanceof EvoVariableExpression && expression2 instanceof EvoVariableExpression) {
			EvoVariable variable1 = ((EvoVariableExpression)expression1).getVariable();
			EvoVariable variable2 = ((EvoVariableExpression)expression2).getVariable();

			if(variable1 instanceof EvoFeatureVariable && variable2 instanceof EvoFeatureVariable) {
				return featureMatch(((EvoFeatureVariable)variable1).getFeature(), ((EvoFeatureVariable)variable2).getFeature());
			}

			return false;
		}else if(expression1 instanceof HyBooleanValueExpression && expression2  instanceof HyBooleanValueExpression) {
			return true;
		}else if(expression1 instanceof HyConditionalFeatureReferenceExpression && expression2  instanceof HyConditionalFeatureReferenceExpression) {
			return true;
		}else if(expression1 instanceof HyValueExpression && expression2  instanceof HyValueExpression) {
			return true;
		}else if(expression1 instanceof HyAttributeReferenceExpression && expression2  instanceof HyAttributeReferenceExpression) {
			return true;
		}else if(expression1 instanceof HyGreaterExpression && expression2  instanceof HyGreaterExpression) {
			return true;
		}else if(expression1 instanceof HyLessExpression && expression2  instanceof HyLessExpression) {
			return true;
		}else if(expression1 instanceof HyGreaterOrEqualExpression && expression2  instanceof HyGreaterOrEqualExpression) {
			return true;
		}else if(expression1 instanceof HyLessOrEqualExpression && expression2  instanceof HyLessOrEqualExpression) {
			return true;
		}else if(expression1 instanceof HyEqualExpression && expression2  instanceof HyEqualExpression) {
			return true;
		}else if(expression1 instanceof HyNotEqualExpression && expression2  instanceof HyNotEqualExpression) {
			return true;
		}else if(expression1 instanceof HyAdditionExpression && expression2  instanceof HyAdditionExpression) {
			return true;
		}else if(expression1 instanceof HySubtractionExpression && expression2  instanceof HySubtractionExpression) {
			return true;
		}else if(expression1 instanceof HyMultiplicationExpression && expression2  instanceof HyMultiplicationExpression) {
			return true;
		}else if(expression1 instanceof HyDivisionExpression && expression2  instanceof HyDivisionExpression) {
			return true;
		}else if(expression1 instanceof HyModuloExpression && expression2  instanceof HyModuloExpression) {
			return true;
		}else if(expression1 instanceof HyNegationExpression && expression2  instanceof HyNegationExpression) {
			return true;
		}else if(expression1 instanceof HyContextInformationReferenceExpression && expression2  instanceof HyContextInformationReferenceExpression) {
			return true;
		}else if(expression1 instanceof HyMaximumExpression && expression2  instanceof HyMaximumExpression) {
			return true;
		}else if(expression1 instanceof HyMinimumExpression && expression2  instanceof HyMinimumExpression) {
			return true;
		}else if(expression1 instanceof HyIfPossibleExpression && expression2  instanceof HyIfPossibleExpression) {
			return true;
		}else if(expression1 instanceof HySetExpression && expression2  instanceof HySetExpression) {
			return true;
		}

		return false;
	}

	/**
	 * Replace the reference of a variable with another
	 *
	 * @param replacementExpression
	 * @return the modified reference with the new variable reference
	 */
	private static HyExpression replaceVariableReferenceExpressionWithFeatureReferenceExpression(HyExpression replacementExpression) {
		// replace the expression containing the reference to the variable with a actual feature reference like it is used in HyExpressions per default
		if(replacementExpression instanceof EvoVariableExpression) {
			EvoVariable variable = ((EvoVariableExpression)replacementExpression).getVariable();

			if(variable instanceof EvoFeatureVariable) {
				HyFeatureReferenceExpression correctReplacementExpression = HyExpressionFactory.eINSTANCE.createHyFeatureReferenceExpression();
				correctReplacementExpression.setFeature(((EvoFeatureVariable)variable).getFeature());

				return correctReplacementExpression;
			}
		}else if(replacementExpression instanceof HyBinaryExpression) {
			HyBinaryExpression binaryReplacementExpression = (HyBinaryExpression)replacementExpression;
			binaryReplacementExpression.setOperand1(replaceVariableReferenceExpressionWithFeatureReferenceExpression(binaryReplacementExpression.getOperand1()));
			binaryReplacementExpression.setOperand2(replaceVariableReferenceExpressionWithFeatureReferenceExpression(binaryReplacementExpression.getOperand2()));
		}

		return replacementExpression;
	}

	/**
	 * Replaces an expression by another
	 * @param expression the original expression that is will be searched for
	 * @param searchExpression the expression that should be replaced
	 * @param replacementExpression the expression that will replace the searchExpression
	 */
	private static void replaceExpression(HyExpression expression, HyExpression searchExpression, HyExpression replacementExpression) {
		replacementExpression = replaceVariableReferenceExpressionWithFeatureReferenceExpression(replacementExpression);

		if(expression.eContainer() instanceof HyMapping) {
			((HyMapping)expression.eContainer()).setExpression(replacementExpression);
		}else if(expression.eContainer() instanceof HyUnaryExpression) {
			((HyUnaryExpression)expression.eContainer()).setOperand(replacementExpression);
		}else if(expression.eContainer() instanceof HyBinaryExpression) {

			HyBinaryExpression container = (HyBinaryExpression)expression.eContainer();

			if(expressionsMatch(container.getOperand1(), searchExpression))
				container.setOperand1(replacementExpression);
			else
				container.setOperand2(replacementExpression);
		}
	}

	/**
	 * Checks if an expression is contained within another expression or if both expressions are equal
	 * @param expression
	 * @param searchExpression
	 * @return true if contained within another expression or if both expressions are equal
	 */
	public static boolean expressionIsContainedInExpression(HyExpression expression, HyExpression searchExpression) {
		// subtree is not specified and therefore per definition contained within expression
		if(searchExpression == null)
			return true;

		// expression is null so the new expression cannot be contained within a null object
		if(expression == null)
			return false;

		if(expressionsAreIdentical(expression, searchExpression)) {
			return true;
		}

		if(expression instanceof HyBinaryExpression) {
			HyBinaryExpression binaryExpression = (HyBinaryExpression)expression;

			return expressionIsContainedInExpression(binaryExpression.getOperand1(), searchExpression) ||
					expressionIsContainedInExpression(binaryExpression.getOperand2(), searchExpression);
		}else if(expression instanceof HyUnaryExpression) {
			HyUnaryExpression unaryExpression = (HyUnaryExpression)expression;

			return expressionIsContainedInExpression(unaryExpression.getOperand(), searchExpression);
		}else if(expression instanceof HyFeatureReferenceExpression) {
			if(searchExpression instanceof HyFeatureReferenceExpression) {
				return featureMatch(((HyFeatureReferenceExpression)expression).getFeature(), ((HyFeatureReferenceExpression)searchExpression).getFeature());
			}else
				return false;
		}else if(expression instanceof EvoVariableExpression) {
			return false;
		}else {
			return false;
		}
	}

	private void searchAndReplaceExpressionWithinExpression(HyExpression expression, HyExpression searchExpression, HyExpression replacementExpression) {
		if(expressionsAreIdentical(expression, searchExpression)) {
			// replace the expression and return true
			if(replacementExpression != null) {
				replaceExpression(expression, searchExpression, replacementExpression);
			}
		}

		if(expression instanceof HyBinaryExpression) {
			HyBinaryExpression binaryExpression = (HyBinaryExpression)expression;

			searchAndReplaceExpressionWithinExpression(binaryExpression.getOperand1(), searchExpression, replacementExpression);
			searchAndReplaceExpressionWithinExpression(binaryExpression.getOperand2(), searchExpression, replacementExpression);
		}else if(expression instanceof HyUnaryExpression) {
			HyUnaryExpression unaryExpression = (HyUnaryExpression)expression;

			searchAndReplaceExpressionWithinExpression(unaryExpression.getOperand(), searchExpression, replacementExpression);
		}else if(expression instanceof HyFeatureReferenceExpression) {
			if(searchExpression instanceof HyFeatureReferenceExpression) {
				featureMatch(((HyFeatureReferenceExpression)expression).getFeature(), ((HyFeatureReferenceExpression)searchExpression).getFeature());
			}
		}
	}

	private static boolean expressionsAreIdentical(HyExpression expression, HyExpression searchExpression){
		boolean match = expressionsMatch(expression, searchExpression);

		if(expression instanceof HyBinaryExpression) {
			HyBinaryExpression binaryExpression = (HyBinaryExpression)expression;

			if(searchExpression instanceof HyBinaryExpression) {
				return  match &&
						expressionsAreIdentical(binaryExpression.getOperand1(), ((HyBinaryExpression)searchExpression).getOperand1()) &&
						expressionsAreIdentical(binaryExpression.getOperand2(), ((HyBinaryExpression)searchExpression).getOperand2());
			}else {
				return match &&
						expressionsAreIdentical(binaryExpression.getOperand1(), ((HyUnaryExpression)searchExpression).getOperand()) &&
						expressionsAreIdentical(binaryExpression.getOperand2(), ((HyUnaryExpression)searchExpression).getOperand());
			}
		}else if(expression instanceof HyUnaryExpression){
			HyUnaryExpression unaryExpression = (HyUnaryExpression)expression;

			if(searchExpression instanceof HyBinaryExpression) {
				return match &&
						(expressionsAreIdentical(unaryExpression.getOperand(), ((HyBinaryExpression)searchExpression).getOperand1()) ||
						 expressionsAreIdentical(unaryExpression.getOperand(), ((HyBinaryExpression)searchExpression).getOperand2()));
			}else if(searchExpression instanceof HyUnaryExpression) {
				return match &&
						(expressionsAreIdentical(unaryExpression.getOperand(), ((HyUnaryExpression)searchExpression).getOperand()));
			}else {
				return match;
			}
		}else if(expression instanceof HyFeatureReferenceExpression) {
			if(searchExpression instanceof HyBinaryExpression) {
				return match &&
						(expressionsAreIdentical(expression, ((HyBinaryExpression)searchExpression).getOperand1()) ||
						 expressionsAreIdentical(expression, ((HyBinaryExpression)searchExpression).getOperand2()));
			}else if(searchExpression instanceof HyUnaryExpression) {
				return match &&
						(expressionsAreIdentical(expression, ((HyUnaryExpression)searchExpression).getOperand()));
			}else if(searchExpression instanceof EvoVariableExpression) {
				EvoVariable variable = ((EvoVariableExpression)searchExpression).getVariable();

				if(variable instanceof EvoFeatureVariable) {
					return featureMatch(((EvoFeatureVariable)variable).getFeature(), ((HyFeatureReferenceExpression)expression).getFeature());
				}else
					return match;
			}else {
				return match;
			}

		}else {
			System.err.println("No valid expression object");
			return false;
		}
	}

	@Override
	public EObject perform(EObject model, EObject linkedModel, HyExpression expression, EvoResourceProvider resourceProvider) {
		this.model = model;

		// do nothing in case the parameter have the wrong type
		if(!(model instanceof HyMappingModel) || !(expression instanceof EvoMappingReplace))
			return model;

		EvoMappingReplace replaceExpression = (EvoMappingReplace)expression;

		//EcoreIOUtil.copyResourceTo(model.eResource(), newFile)
		for(HyMapping mapping : ((HyMappingModel)model).getMappings()) {
			searchAndReplaceExpressionWithinExpression(mapping.getExpression(), replaceExpression.getOperand1(), replaceExpression.getOperand2());
		}

		return model;
	}
}


text:
package com.google.android.exoplayer2.extractor.ts;

import com.google.android.exoplayer2.C;

/**
 * Offsets timestamps according to an initial sample timestamp offset. MPEG-2 TS timestamps scaling
 * and adjustment is supported, taking into account timestamp rollover.
 */
public final class TimestampAdjuster {

  /**
   * A special {@code firstSampleTimestampUs} value indicating that presentation timestamps should
   * not be offset.
   */
  public static final long DO_NOT_OFFSET = Long.MAX_VALUE;

  /**
   * The value one greater than the largest representable (33 bit) MPEG-2 TS presentation timestamp.
   */
  private static final long MAX_PTS_PLUS_ONE = 0x200000000L;

  private final long firstSampleTimestampUs;

  private long timestampOffsetUs;

  // Volatile to allow isInitialized to be called on a different thread to adjustSampleTimestamp.
  private volatile long lastSampleTimestamp;

  /**
   * @param firstSampleTimestampUs The desired result of the first call to
   *     {@link #adjustSampleTimestamp(long)}, or {@link #DO_NOT_OFFSET} if presentation timestamps
   *     should not be offset.
   */
  public TimestampAdjuster(long firstSampleTimestampUs) {
    this.firstSampleTimestampUs = firstSampleTimestampUs;
    lastSampleTimestamp = C.TIME_UNSET;
  }

  /**
   * Resets the instance to its initial state.
   */
  public void reset() {
    lastSampleTimestamp = C.TIME_UNSET;
  }

  /**
   * Scales and offsets an MPEG-2 TS presentation timestamp considering wraparound.
   *
   * @param pts The MPEG-2 TS presentation timestamp.
   * @return The adjusted timestamp in microseconds.
   */
  public long adjustTsTimestamp(long pts) {
    if (lastSampleTimestamp != C.TIME_UNSET) {
      // The wrap count for the current PTS may be closestWrapCount or (closestWrapCount - 1),
      // and we need to snap to the one closest to lastSampleTimestamp.
      long lastPts = usToPts(lastSampleTimestamp);
      long closestWrapCount = (lastPts + (MAX_PTS_PLUS_ONE / 2)) / MAX_PTS_PLUS_ONE;
      long ptsWrapBelow = pts + (MAX_PTS_PLUS_ONE * (closestWrapCount - 1));
      long ptsWrapAbove = pts + (MAX_PTS_PLUS_ONE * closestWrapCount);
      pts = Math.abs(ptsWrapBelow - lastPts) < Math.abs(ptsWrapAbove - lastPts)
          ? ptsWrapBelow : ptsWrapAbove;
    }
    return adjustSampleTimestamp(ptsToUs(pts));
  }

  /**
   * Offsets a sample timestamp in microseconds.
   *
   * @param timeUs The timestamp of a sample to adjust.
   * @return The adjusted timestamp in microseconds.
   */
  public long adjustSampleTimestamp(long timeUs) {
    // Record the adjusted PTS to adjust for wraparound next time.
    if (lastSampleTimestamp != C.TIME_UNSET) {
      lastSampleTimestamp = timeUs;
    } else {
      if (firstSampleTimestampUs != DO_NOT_OFFSET) {
        // Calculate the timestamp offset.
        timestampOffsetUs = firstSampleTimestampUs - timeUs;
      }
      synchronized (this) {
        lastSampleTimestamp = timeUs;
        // Notify threads waiting for this adjuster to be initialized.
        notifyAll();
      }
    }
    return timeUs + timestampOffsetUs;
  }

  /**
   * Blocks the calling thread until this adjuster is initialized.
   *
   * @throws InterruptedException If the thread was interrupted.
   */
  public synchronized void waitUntilInitialized() throws InterruptedException {
    while (lastSampleTimestamp == C.TIME_UNSET) {
      wait();
    }
  }

  /**
   * Converts a value in MPEG-2 timestamp units to the corresponding value in microseconds.
   *
   * @param pts A value in MPEG-2 timestamp units.
   * @return The corresponding value in microseconds.
   */
  public static long ptsToUs(long pts) {
    return (pts * C.MICROS_PER_SECOND) / 90000;
  }

  /**
   * Converts a value in microseconds to the corresponding values in MPEG-2 timestamp units.
   *
   * @param us A value in microseconds.
   * @return The corresponding value in MPEG-2 timestamp units.
   */
  public static long usToPts(long us) {
    return (us * 90000) / C.MICROS_PER_SECOND;
  }

}

redpajama_set_name: RedPajamaGithub


text:
namespace chrono {
namespace vehicle {
namespace fmtv {

const double FMTV_SimplePowertrain::m_max_torque = 2400 / 8.851;
const double FMTV_SimplePowertrain::m_max_speed = 2000;
const double FMTV_SimplePowertrain::m_fwd_gear_ratio = 0.3;
const double FMTV_SimplePowertrain::m_rev_gear_ratio = -0.3;

FMTV_SimplePowertrain::FMTV_SimplePowertrain(const std::string& name) : ChSimplePowertrain(name) {}

void FMTV_SimplePowertrain::SetGearRatios(std::vector<double>& fwd, double& rev) {
    rev = m_rev_gear_ratio;
    fwd.push_back(m_fwd_gear_ratio);
}

}  // namespace fmtv
}  // end namespace vehicle
}  // end namespace chrono


text:
<!DOCTYPE html>

	<wicket:extend>
		<form role="form" wicket:id="form">

Recovery Repayment Loan Account

						<wicket:container wicket:id="transactionDateIContainer">
							Transaction Date
							<input wicket:id="transactionDateField" type="text"
								class="form-control" />

						</wicket:container>

						<wicket:container wicket:id="transactionAmountIContainer">
							Transaction
								Amount
							<input wicket:id="transactionAmountField" type="text"
								class="form-control" />

						</wicket:container>

						<wicket:container wicket:id="principleVContainer">
							Principle

						</wicket:container>

						<wicket:container wicket:id="interestAmountVContainer">
							Interest Amount

						</wicket:container>

						<wicket:container wicket:id="paymentTypeIContainer">
							Payment Type
							<select wicket:id="paymentTypeField" class="form-control"></select>

						</wicket:container>

						<wicket:container wicket:id="paymentDetailIContainer">

							  <input
									type="checkbox" wicket:id="paymentDetailField"> Is
									Payment Detail?

						</wicket:container>

						<wicket:container wicket:id="accountIContainer">
							Account#
							<input wicket:id="accountField" type="text" class="form-control" />

						</wicket:container>

						<wicket:container wicket:id="chequeIContainer">
							Cheque#
							<input wicket:id="chequeField" type="text" class="form-control" />

						</wicket:container>

						<wicket:container wicket:id="routingIContainer">
							Routing code
							<input wicket:id="routingField" type="text" class="form-control" />

						</wicket:container>

						<wicket:container wicket:id="receiptIContainer">
							Receipt#
							<input wicket:id="receiptField" type="text" class="form-control" />

						</wicket:container>

						<wicket:container wicket:id="bankIContainer">
							Bank#
							<input wicket:id="bankField" type="text" class="form-control" />

						</wicket:container>

						<wicket:container wicket:id="noteIContainer">
							Note
							<textarea wicket:id="noteField" class="form-control"></textarea>

						</wicket:container>

					<button wicket:id="saveButton" type="submit" class="btn btn-info">Save</button>
					Close

		</form>
	</wicket:extend>


text:
/*
 * 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 com.facebook.presto.sql.tree;

public abstract class DefaultTraversalVisitor<R, C>
        extends AstVisitor<R, C>
{
    @Override
    protected R visitExtract(Extract node, C context)
    {
        return process(node.getExpression(), context);
    }

    @Override
    protected R visitCast(Cast node, C context)
    {
        return process(node.getExpression(), context);
    }

    @Override
    protected R visitArithmeticBinary(ArithmeticBinaryExpression node, C context)
    {
        process(node.getLeft(), context);
        process(node.getRight(), context);

        return null;
    }

    @Override
    protected R visitBetweenPredicate(BetweenPredicate node, C context)
    {
        process(node.getValue(), context);
        process(node.getMin(), context);
        process(node.getMax(), context);

        return null;
    }

    @Override
    protected R visitCoalesceExpression(CoalesceExpression node, C context)
    {
        node.getOperands().forEach(operand -> process(operand, context));

        return null;
    }

    @Override
    protected R visitAtTimeZone(AtTimeZone node, C context)
    {
        process(node.getValue(), context);
        process(node.getTimeZone(), context);

        return null;
    }

    @Override
    protected R visitArrayConstructor(ArrayConstructor node, C context)
    {
        node.getValues().forEach(expression -> process(expression, context));

        return null;
    }

    @Override
    protected R visitSubscriptExpression(SubscriptExpression node, C context)
    {
        process(node.getBase(), context);
        process(node.getIndex(), context);

        return null;
    }

    @Override
    protected R visitComparisonExpression(ComparisonExpression node, C context)
    {
        process(node.getLeft(), context);
        process(node.getRight(), context);

        return null;
    }

    @Override
    protected R visitQuery(Query node, C context)
    {
        node.getWith().ifPresent(with -> process(with, context));

        process(node.getQueryBody(), context);

        node.getOrderBy().ifPresent(orderBy -> process(orderBy, context));

        return null;
    }

    @Override
    protected R visitWith(With node, C context)
    {
        node.getQueries().forEach(query -> process(query, context));

        return null;
    }

    @Override
    protected R visitWithQuery(WithQuery node, C context)
    {
        return process(node.getQuery(), context);
    }

    @Override
    protected R visitSelect(Select node, C context)
    {
        node.getSelectItems().forEach(item -> process(item, context));

        return null;
    }

    @Override
    protected R visitSingleColumn(SingleColumn node, C context)
    {
        process(node.getExpression(), context);

        return null;
    }

    @Override
    protected R visitWhenClause(WhenClause node, C context)
    {
        process(node.getOperand(), context);
        process(node.getResult(), context);

        return null;
    }

    @Override
    protected R visitInPredicate(InPredicate node, C context)
    {
        process(node.getValue(), context);
        process(node.getValueList(), context);

        return null;
    }

    @Override
    protected R visitFunctionCall(FunctionCall node, C context)
    {
        node.getArguments().forEach(argument -> process(argument, context));

        node.getOrderBy().ifPresent(orderBy -> process(orderBy, context));
        node.getWindow().ifPresent(window -> process(window, context));
        node.getFilter().ifPresent(filter -> process(filter, context));

        return null;
    }

    @Override
    protected R visitGroupingOperation(GroupingOperation node, C context)
    {
        node.getGroupingColumns().forEach(columnArgument -> process(columnArgument, context));

        return null;
    }

    @Override
    protected R visitDereferenceExpression(DereferenceExpression node, C context)
    {
        process(node.getBase(), context);
        return null;
    }

    @Override
    public R visitWindow(Window node, C context)
    {
        node.getPartitionBy().forEach(expression -> process(expression, context));

        node.getOrderBy().ifPresent(orderBy -> process(orderBy, context));
        node.getFrame().ifPresent(frame -> process(frame, context));

        return null;
    }

    @Override
    public R visitWindowFrame(WindowFrame node, C context)
    {
        process(node.getStart(), context);
        node.getEnd().ifPresent(end -> process(end, context));

        return null;
    }

    @Override
    public R visitFrameBound(FrameBound node, C context)
    {
        node.getValue().ifPresent(value -> process(value, context));

        return null;
    }

    @Override
    protected R visitSimpleCaseExpression(SimpleCaseExpression node, C context)
    {
        process(node.getOperand(), context);

        node.getWhenClauses().forEach(clause -> process(clause, context));

        node.getDefaultValue()
                .ifPresent(value -> process(value, context));

        return null;
    }

    @Override
    protected R visitInListExpression(InListExpression node, C context)
    {
        node.getValues().forEach(value -> process(value, context));

        return null;
    }

    @Override
    protected R visitNullIfExpression(NullIfExpression node, C context)
    {
        process(node.getFirst(), context);
        process(node.getSecond(), context);

        return null;
    }

    @Override
    protected R visitIfExpression(IfExpression node, C context)
    {
        process(node.getCondition(), context);
        process(node.getTrueValue(), context);
        node.getFalseValue().ifPresent(falseValue -> process(falseValue, context));

        return null;
    }

    @Override
    protected R visitTryExpression(TryExpression node, C context)
    {
        process(node.getInnerExpression(), context);
        return null;
    }

    @Override
    protected R visitBindExpression(BindExpression node, C context)
    {
        node.getValues().forEach(value -> process(value, context));
        process(node.getFunction(), context);

        return null;
    }

    @Override
    protected R visitArithmeticUnary(ArithmeticUnaryExpression node, C context)
    {
        return process(node.getValue(), context);
    }

    @Override
    protected R visitNotExpression(NotExpression node, C context)
    {
        return process(node.getValue(), context);
    }

    @Override
    protected R visitSearchedCaseExpression(SearchedCaseExpression node, C context)
    {
        node.getWhenClauses().forEach(clause -> process(clause, context));
        node.getDefaultValue()
                .ifPresent(value -> process(value, context));

        return null;
    }

    @Override
    protected R visitLikePredicate(LikePredicate node, C context)
    {
        process(node.getValue(), context);
        process(node.getPattern(), context);
        node.getEscape().ifPresent(value -> process(value, context));

        return null;
    }

    @Override
    protected R visitIsNotNullPredicate(IsNotNullPredicate node, C context)
    {
        return process(node.getValue(), context);
    }

    @Override
    protected R visitIsNullPredicate(IsNullPredicate node, C context)
    {
        return process(node.getValue(), context);
    }

    @Override
    protected R visitLogicalBinaryExpression(LogicalBinaryExpression node, C context)
    {
        process(node.getLeft(), context);
        process(node.getRight(), context);

        return null;
    }

    @Override
    protected R visitSubqueryExpression(SubqueryExpression node, C context)
    {
        return process(node.getQuery(), context);
    }

    @Override
    protected R visitOrderBy(OrderBy node, C context)
    {
        node.getSortItems().forEach(sortItem -> process(sortItem, context));
        return null;
    }

    @Override
    protected R visitSortItem(SortItem node, C context)
    {
        return process(node.getSortKey(), context);
    }

    @Override
    protected R visitQuerySpecification(QuerySpecification node, C context)
    {
        process(node.getSelect(), context);
        node.getFrom().ifPresent(from -> process(from, context));
        node.getWhere().ifPresent(where -> process(where, context));
        node.getGroupBy().ifPresent(groupBy -> process(groupBy, context));
        node.getHaving().ifPresent(having -> process(having, context));
        node.getOrderBy().ifPresent(orderBy -> process(orderBy, context));

        return null;
    }

    @Override
    protected R visitSetOperation(SetOperation node, C context)
    {
        node.getRelations().forEach(relation -> process(relation, context));
        return null;
    }

    @Override
    protected R visitValues(Values node, C context)
    {
        node.getRows().forEach(row -> process(row, context));
        return null;
    }

    @Override
    protected R visitRow(Row node, C context)
    {
        node.getItems().forEach(expression -> process(expression, context));
        return null;
    }

    @Override
    protected R visitTableSubquery(TableSubquery node, C context)
    {
        return process(node.getQuery(), context);
    }

    @Override
    protected R visitAliasedRelation(AliasedRelation node, C context)
    {
        return process(node.getRelation(), context);
    }

    @Override
    protected R visitSampledRelation(SampledRelation node, C context)
    {
        process(node.getRelation(), context);
        process(node.getSamplePercentage(), context);
        return null;
    }

    @Override
    protected R visitJoin(Join node, C context)
    {
        process(node.getLeft(), context);
        process(node.getRight(), context);

        node.getCriteria()
                .filter(criteria -> criteria instanceof JoinOn)
                .map(criteria -> process(((JoinOn) criteria).getExpression(), context));

        return null;
    }

    @Override
    protected R visitUnnest(Unnest node, C context)
    {
        node.getExpressions().forEach(expression -> process(expression, context));

        return null;
    }

    @Override
    protected R visitGroupBy(GroupBy node, C context)
    {
        node.getGroupingElements().forEach(groupingElement -> process(groupingElement, context));

        return null;
    }

    @Override
    protected R visitCube(Cube node, C context)
    {
        return null;
    }

    @Override
    protected R visitRollup(Rollup node, C context)
    {
        return null;
    }

    @Override
    protected R visitSimpleGroupBy(SimpleGroupBy node, C context)
    {
        node.getExpressions().forEach(expression -> process(expression, context));

        return null;
    }

    @Override
    protected R visitGroupingSets(GroupingSets node, C context)
    {
        return null;
    }

    @Override
    protected R visitInsert(Insert node, C context)
    {
        process(node.getQuery(), context);

        return null;
    }

    @Override
    protected R visitDelete(Delete node, C context)
    {
        process(node.getTable(), context);
        node.getWhere().ifPresent(where -> process(where, context));

        return null;
    }

    @Override
    protected R visitCreateTableAsSelect(CreateTableAsSelect node, C context)
    {
        process(node.getQuery(), context);
        node.getProperties().forEach(property -> process(property, context));

        return null;
    }

    @Override
    protected R visitProperty(Property node, C context)
    {
        process(node.getName(), context);
        process(node.getValue(), context);

        return null;
    }

    @Override
    protected R visitAnalyze(Analyze node, C context)
    {
        node.getProperties().forEach(property -> process(property, context));

        return null;
    }

    @Override
    protected R visitCreateView(CreateView node, C context)
    {
        process(node.getQuery(), context);

        return null;
    }

    @Override
    protected R visitCreateMaterializedView(CreateMaterializedView node, C context)
    {
        process(node.getQuery(), context);
        node.getProperties().forEach(property -> process(property, context));

        return null;
    }

    @Override
    protected R visitRefreshMaterializedView(RefreshMaterializedView node, C context)
    {
        process(node.getTarget(), context);
        process(node.getWhere(), context);

        return null;
    }

    @Override
    protected R visitSetSession(SetSession node, C context)
    {
        process(node.getValue(), context);

        return null;
    }

    @Override
    protected R visitAddColumn(AddColumn node, C context)
    {
        process(node.getColumn(), context);

        return null;
    }

    @Override
    protected R visitCreateTable(CreateTable node, C context)
    {
        node.getElements().forEach(tableElement -> process(tableElement, context));
        node.getProperties().forEach(property -> process(property, context));

        return null;
    }

    @Override
    protected R visitStartTransaction(StartTransaction node, C context)
    {
        node.getTransactionModes().forEach(transactionMode -> process(transactionMode, context));

        return null;
    }

    @Override
    protected R visitExplain(Explain node, C context)
    {
        process(node.getStatement(), context);

        node.getOptions().forEach(option -> process(option, context));

        return null;
    }

    @Override
    protected R visitQuantifiedComparisonExpression(QuantifiedComparisonExpression node, C context)
    {
        process(node.getValue(), context);
        process(node.getSubquery(), context);

        return null;
    }

    @Override
    protected R visitExists(ExistsPredicate node, C context)
    {
        process(node.getSubquery(), context);

        return null;
    }

    @Override
    protected R visitLateral(Lateral node, C context)
    {
        process(node.getQuery(), context);

        return super.visitLateral(node, context);
    }
}


text:
/**
 *
 * $Id$
 */
package Variation_Diff.validation;

import Variation_Diff.TypeHint;

import org.eclipse.emf.common.util.EList;

/**
 * A sample validator interface for {@link Variation_Diff.TypeDifference}.
 * This doesn't really do anything, and it's not a real EMF artifact.
 * It was generated by the org.eclipse.emf.examples.generator.validator plug-in to illustrate how EMF's code generator can be extended.
 * This can be disabled with -vmargs -Dorg.eclipse.emf.examples.generator.validator=false.
 */
public interface TypeDifferenceValidator
{
  boolean validate();

  boolean validateName(String value);
  boolean validateHints(EList<TypeHint> value);
}


text:
package org.colorcoding.ibas.bobas.data.measurement;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

import org.colorcoding.ibas.bobas.MyConsts;
import org.colorcoding.ibas.bobas.data.Decimal;
import org.colorcoding.ibas.bobas.i18n.i18n;

/**
 * 数量
 */
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(name = "Quantity", namespace = MyConsts.NAMESPACE_BOBAS_DATA)
public class Quantity extends MeasurementDecimal<String> {

	/**
	 *
	 */
	private static final long serialVersionUID = -125358402117609587L;

	public Quantity() {

	}

	public Quantity(Decimal value, String unit) {
		super(value);
		this.setUnit(unit);
	}

	public Quantity(double value, String unit) {
		super(value);
		this.setUnit(unit);
	}

	private String unit;

	@Override
	@XmlElement(name = "Unit")
	public String getUnit() {
		if (this.unit == null) {
			this.unit = "";
		}
		return this.unit;
	}

	@Override
	public void setUnit(Object value) {
		this.setUnit((String) value);
	}

	public void setUnit(String value) {
		String oldValue = this.unit;
		this.unit = value;
		this.firePropertyChange("Unit", oldValue, this.unit);
	}

	@Override
	public int compareTo(IMeasurement<Decimal, String> o) {
		if (!this.getUnit().equals(o.getUnit())) {
			throw new ClassCastException(i18n.prop("msg_bobas_measurement_unit_not_match"));
		}
		return this.getValue().compareTo(o.getValue());
	}

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>ListLevel (POI API Documentation)</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.apache.poi.hwpf.model

Class ListLevel

java.lang.Object

org.apache.poi.hwpf.model.ListLevel

@Internal
public final class ListLevel
extends java.lang.Object

"The LVL structure contains formatting information about a specific level in
 a list. When a paragraph is formatted as part of this level, each placeholder
 in xst is replaced with the inherited level number of the most recent or
 current paragraph in the same list that is in the zero-based level specified
 by that placeholder. The level number that replaces a placeholder is
 formatted according to the lvlf.nfc of the LVL structure that corresponds to
 the level that the placeholder specifies, unless the lvlf.fLegal of this LVL
 structure is nonzero." -- Page 388 of 621 -- [MS-DOC] -- v20110315 Word
 (.doc) Binary File Format

Constructor Summary

Constructors

Constructor and Description

ListLevel(byte[] buf,
         int startOffset)

Deprecated.

ListLevel(int level,
         boolean numbered)

ListLevel(int startAt,
         int numberFormatCode,
         int alignment,
         byte[] numberProperties,
         byte[] entryProperties,
         java.lang.String numberText)

Method Summary

Methods

Modifier and Type
Method and Description

boolean
equals(java.lang.Object obj)

int
getAlignment()

"Alignment (left, right, or centered) of the paragraph number."

byte[]
getGrpprlChpx()

byte[]
getGrpprlPapx()

byte[]
getLevelProperties()

int
getNumberFormat()

"Number format code (see anld.nfc for a list of options)"

java.lang.String
getNumberText()

int
getSizeInBytes()

int
getStartAt()

byte
getTypeOfCharFollowingTheNumber()

"The type of character following the number text for the paragraph: 0 == tab, 1 == space, 2 == nothing."

void
setAlignment(int alignment)

void
setLevelProperties(byte[] grpprl)

void
setNumberFormat(int numberFormatCode)

void
setNumberProperties(byte[] grpprl)

void
setStartAt(int startAt)

void
setTypeOfCharFollowingTheNumber(byte value)

byte[]
toByteArray()

java.lang.String
toString()

Methods inherited from class java.lang.Object

clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail

ListLevel

@Deprecated
public ListLevel(byte[] buf,
                    int startOffset)

Deprecated.

ListLevel

public ListLevel(int level,
         boolean numbered)

ListLevel

public ListLevel(int startAt,
         int numberFormatCode,
         int alignment,
         byte[] numberProperties,
         byte[] entryProperties,
         java.lang.String numberText)

Method Detail

equals

public boolean equals(java.lang.Object obj)

Overrides:

equals in class java.lang.Object

getAlignment

public int getAlignment()

"Alignment (left, right, or centered) of the paragraph number."

getGrpprlChpx

public byte[] getGrpprlChpx()

getGrpprlPapx

public byte[] getGrpprlPapx()

getLevelProperties

public byte[] getLevelProperties()

getNumberFormat

public int getNumberFormat()

"Number format code (see anld.nfc for a list of options)"

getNumberText

public java.lang.String getNumberText()

getSizeInBytes

public int getSizeInBytes()

getStartAt

public int getStartAt()

getTypeOfCharFollowingTheNumber

public byte getTypeOfCharFollowingTheNumber()

"The type of character following the number text for the paragraph: 0 == tab, 1 == space, 2 == nothing."

setAlignment

public void setAlignment(int alignment)

setLevelProperties

public void setLevelProperties(byte[] grpprl)

setNumberFormat

public void setNumberFormat(int numberFormatCode)

setNumberProperties

public void setNumberProperties(byte[] grpprl)

setStartAt

public void setStartAt(int startAt)

setTypeOfCharFollowingTheNumber

public void setTypeOfCharFollowingTheNumber(byte value)

toByteArray

public byte[] toByteArray()

toString

public java.lang.String toString()

Overrides:

toString in class java.lang.Object

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

                Copyright 2014 The Apache Software Foundation or
        its licensors, as applicable.


text:
var state = {};
var d     = require('debug')('schema-check:state');

function init(token) {
  state[token] = state[token] || {};
  d('init: state[%s] %o', token, state[token]);
}

exports.getSocket = function getSocket(token) {
  init(token);
  d('getSocket: getting socket for token %s', token);
  return state[token].socket;
};

exports.setSocket = function setSocket(token, socket) {
  init(token);
  d('setSocket: setting socket for token %s with socket.id %s', token, socket.id);
  return state[token].socket = socket;
};

exports.removeSocket = function removeSocket(token) {
  init(token);
  d('removeSocket: removing socket for token %s', token);
  return delete state[token].socket;
};

exports.getVisitor = function getVisitor(token) {
  init(token);
  d('getVisitor: getting visitor for token %s', token);
  return state[token].visitor;
};

exports.setVisitor = function setVisitor(token, visitor) {
  init(token);
  d('setVisitor: setting visitor for token %s as visitor %o', token, visitor);
  return state[token].visitor = visitor;
};

exports.removeVisitor = function removeVisitor(token) {
  init(token);
  d('removeVisitor: removing visitor for token %s', token);
  return delete state[token].visitor;
};


text:
SERVICE_NAME="Granula monitor-client"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PATH_TO_JAR=$SCRIPT_DIR/../target/granula-monitor-1.0-SNAPSHOT.jar
MAIN_CLASS=science.atlarge.granula.monitor.executor.GranulaMonitorClient
PNAME=GranulaMonitorClient

cd $SCRIPT_DIR/../
java -cp $PATH_TO_JAR $MAIN_CLASS


text:
extern "C"
{
	#include <extlibs/headers/PhysFS/physfs.h>
}

#include <sfml/System/InputStream.hpp>

namespace sf{

	class PhysFsStream : public sf::InputStream
	{
	public:

		PhysFsStream(const char* filename = 0x0) :
			m_File(0x0)
		{
			if (filename)
				open(filename);
		}

		virtual ~PhysFsStream()
		{
			close();
		}

		bool isOpen() const
		{
			return (m_File != 0x0);
		}

		bool open(const char* filename)
		{
			close();
			m_File = PHYSFS_openRead(filename);
			return isOpen();
		}

		void close()
		{
			if (isOpen())
				PHYSFS_close(m_File);
			m_File = 0x0;
		}

		virtual sf::Int64 read(void* data, sf::Int64 size)
		{
			if (!isOpen())
				return -1;

			// PHYSFS_read returns the number of 'objects' read or -1 on error.
			// We assume our objects are single bytes and request to read size
			// amount of them.
			return PHYSFS_read(m_File, data, 1, static_cast<PHYSFS_uint32>(size));
		}

		virtual sf::Int64 seek(sf::Int64 position)
		{
			if (!isOpen())
				return -1;

			// PHYSFS_seek return 0 on error and non zero on success
			if (PHYSFS_seek(m_File, position))
				return tell();
			else
				return -1;
		}

		virtual sf::Int64 tell()
		{
			if (!isOpen())
				return -1;

			// PHYSFS_tell returns the offset in bytes or -1 on error just like SFML wants.
			return PHYSFS_tell(m_File);
		}

		virtual sf::Int64 getSize()
		{
			if (!isOpen())
				return -1;

			// PHYSFS_fileLength also the returns length of file or -1 on error just like SFML wants.
			return PHYSFS_fileLength(m_File);
		}

	private:
		PHYSFS_File* m_File;

	};

}

#endif


text:
package in.dealo.svc;

public class MessageTemplateSvcImpl implements MessageTemplateSvc {
}


text:
@interface SocialOk : CDVPlugin
{
    NSString*     clientId;
}

@property (nonatomic, retain) NSString*     clientId;

- (void)initSocialOk:(CDVInvokedUrlCommand*)command;
- (void)login:(CDVInvokedUrlCommand*)command;
- (void)logout:(CDVInvokedUrlCommand*)command;
- (void)share:(CDVInvokedUrlCommand*)command;
- (void)friendsGet:(CDVInvokedUrlCommand*)command;
- (void)friendsGetOnline:(CDVInvokedUrlCommand*)command;
- (void)streamPublish:(CDVInvokedUrlCommand*)command;
- (void)usersGetInfo:(CDVInvokedUrlCommand*)command;
- (void)callApiMethod:(CDVInvokedUrlCommand*)command;
- (void)isOkAppInstalled:(CDVInvokedUrlCommand*)command;
- (void)reportPayment:(CDVInvokedUrlCommand*)command;
- (void)getInstallSource:(CDVInvokedUrlCommand*)command;

- (void)performPosting:(CDVInvokedUrlCommand*)command;
- (void)performSuggest:(CDVInvokedUrlCommand*)command;
- (void)performInvite:(CDVInvokedUrlCommand*)command;
- (void)reportStats:(CDVInvokedUrlCommand*)command;

@end


text:
> Palestra realizada dia 17/05/2018 no canal [hhbr](http://youtube.com/hhbr-tech)

# Gravação da palestra
[![Alt text](https://i.ytimg.com/vi/7bpMMASVHfk/hqdefault.jpg)](https://www.youtube.com/watch?v=7bpMMASVHfk)

# Dados da palestra

Tema: "Projeto Statik Stack"

Palestrante: Roberto Achar

Site: https://showmethecode.com.br

Email: robertoachar@showmethecode.com.br

Twitter: https://twitter.com/robertoachar

LinkedIn: https://www.linkedin.com/in/roberto-achar/

Facebook: https://www.facebook.com/showmethecode

YouTube: https://www.youtube.com/user/robertoachar

GitHub: https://github.com/robertoachar

Perfil iMasters: https://imasters.com.br/perfil/robertoachar/

# Links Mencionados

GitHub: https://github.com/statikstack

Youtube: https://www.youtube.com/watch?v=WiGqKNQdVQ0

# Contatos Canal
Site: http://hhbr.net.br/

E-mail: hackershousebr@gmail.com

Twitter: [@hackershousebr](twitter.com/hackershousebr)

# Contato Diego Brocanelli
http://www.diegobrocanelli.com.br


text:
namespace gameplay
{

PhysicsRigidBody::PhysicsRigidBody(Node* node, const PhysicsCollisionShape::Definition& shape, const Parameters& parameters, int group, int mask)
        : PhysicsCollisionObject(node, group, mask), _body(NULL), _mass(parameters.mass), _constraints(NULL), _inDestructor(false)
{
    GP_ASSERT(Game::getInstance()->getPhysicsController());
    GP_ASSERT(_node);

    // Create our collision shape.
    Vector3 centerOfMassOffset;
    _collisionShape = Game::getInstance()->getPhysicsController()->createShape(node, shape, &centerOfMassOffset, parameters.mass != 0.0f);
    GP_ASSERT(_collisionShape && _collisionShape->getShape());

    // Create motion state object.
    _motionState = new PhysicsMotionState(node, this, (centerOfMassOffset.lengthSquared() > MATH_EPSILON) ? &centerOfMassOffset : NULL);

    // If the mass is non-zero, then the object is dynamic so we calculate the local
    // inertia. However, if the collision shape is a triangle mesh, we don't calculate
    // inertia since Bullet doesn't currently support this.
    btVector3 localInertia(0.0, 0.0, 0.0);
    if (parameters.mass != 0.0)
        _collisionShape->getShape()->calculateLocalInertia(parameters.mass, localInertia);

    // Create the Bullet physics rigid body object.
    btRigidBody::btRigidBodyConstructionInfo rbInfo(parameters.mass, NULL, _collisionShape->getShape(), localInertia);
    rbInfo.m_friction = parameters.friction;
    rbInfo.m_restitution = parameters.restitution;
    rbInfo.m_linearDamping = parameters.linearDamping;
    rbInfo.m_angularDamping = parameters.angularDamping;

    // Create + assign the new bullet rigid body object.
    _body = bullet_new<btRigidBody>(rbInfo);

    // Set motion state after rigid body assignment, since bullet will callback on the motion state interface to query
    // the initial transform and it will need to access to rigid body (_body).
    _body->setMotionState(_motionState);
	btTransform trans;
	_motionState->getWorldTransform(trans);
	_body->setInterpolationWorldTransform(trans);

    // Set other initially defined properties.
    setKinematic(parameters.kinematic);
    setAnisotropicFriction(parameters.anisotropicFriction);
    setAngularFactor(parameters.angularFactor);
    setLinearFactor(parameters.linearFactor);

    // Add ourself to the physics world.
    Game::getInstance()->getPhysicsController()->addCollisionObject(this);

    if (_collisionShape->getType() == PhysicsCollisionShape::SHAPE_HEIGHTFIELD)
    {
        // Add a listener on the node's transform so we can track dirty changes to calculate
        // an inverse matrix for transforming heightfield points between world and local space.
        _node->addListener(this);
    }
}

PhysicsRigidBody::~PhysicsRigidBody()
{
    GP_ASSERT(Game::getInstance()->getPhysicsController());
    GP_ASSERT(_collisionShape);
    GP_ASSERT(_node);

    // Clean up all constraints linked to this rigid body.
    _inDestructor = true;
    if (_constraints)
    {
        for (unsigned int i = 0; i < _constraints->size(); ++i)
        {
            SAFE_DELETE((*_constraints)[i]);
        }
        SAFE_DELETE(_constraints);
    }

    // Remove collision object from physics controller.
    Game::getInstance()->getPhysicsController()->removeCollisionObject(this, true);

    // Clean up the rigid body and its related objects.
    SAFE_DELETE(_body);

    // Unregister node listener (only registered for heihgtfield collision shape types).
    if (_collisionShape->getType() == PhysicsCollisionShape::SHAPE_HEIGHTFIELD)
    {
        _node->removeListener(this);
    }
}

PhysicsCollisionObject::Type PhysicsRigidBody::getType() const
{
    return PhysicsCollisionObject::RIGID_BODY;
}

btCollisionObject* PhysicsRigidBody::getCollisionObject() const
{
    return _body;
}

void PhysicsRigidBody::applyForce(const Vector3& force, const Vector3* relativePosition)
{
    // If the force is significant enough, activate the rigid body
    // to make sure that it isn't sleeping and apply the force.
    if (force.lengthSquared() > MATH_EPSILON)
    {
        GP_ASSERT(_body);
        _body->activate();
        if (relativePosition)
            _body->applyForce(BV(force), BV(*relativePosition));
        else
            _body->applyCentralForce(BV(force));
    }
}

void PhysicsRigidBody::applyImpulse(const Vector3& impulse, const Vector3* relativePosition)
{
    // If the impulse is significant enough, activate the rigid body
    // to make sure that it isn't sleeping and apply the impulse.
    if (impulse.lengthSquared() > MATH_EPSILON)
    {
        GP_ASSERT(_body);
        _body->activate();
        if (relativePosition)
        {
            _body->applyImpulse(BV(impulse), BV(*relativePosition));
        }
        else
            _body->applyCentralImpulse(BV(impulse));
    }
}

void PhysicsRigidBody::applyTorque(const Vector3& torque)
{
    // If the torque is significant enough, activate the rigid body
    // to make sure that it isn't sleeping and apply the torque.
    if (torque.lengthSquared() > MATH_EPSILON)
    {
        GP_ASSERT(_body);
        _body->activate();
        _body->applyTorque(BV(torque));
    }
}

void PhysicsRigidBody::applyTorqueImpulse(const Vector3& torque)
{
    // If the torque impulse is significant enough, activate the rigid body
    // to make sure that it isn't sleeping and apply the torque impulse.
    if (torque.lengthSquared() > MATH_EPSILON)
    {
        GP_ASSERT(_body);
        _body->activate();
        _body->applyTorqueImpulse(BV(torque));
    }
}

PhysicsRigidBody* PhysicsRigidBody::create(Node* node, Properties* properties, const char* nspace)
{
    // Check if the properties is valid and has a valid namespace.
    if (!properties || !(strcmp(properties->getNamespace(), "collisionObject") == 0))
    {
        GP_ERROR("Failed to load rigid body from properties object: must be non-null object and have namespace equal to 'collisionObject'.");
        return NULL;
    }

    // Check that the type is specified and correct.
    const char* type = properties->getString("type");
    if (!type)
    {
        GP_ERROR("Failed to load physics rigid body from properties object; required attribute 'type' is missing.");
        return NULL;
    }
    if (strcmp(type, nspace) != 0)
    {
        GP_ERROR("Failed to load physics rigid body from properties object; attribute 'type' must be equal to '%s'.", nspace);
        return NULL;
    }

    // Load the physics collision shape definition.
    PhysicsCollisionShape::Definition shape = PhysicsCollisionShape::Definition::create(node, properties);
    if (shape.isEmpty())
    {
        GP_ERROR("Failed to create collision shape during rigid body creation.");
        return NULL;
    }

    // Set the rigid body parameters to their defaults.
    Parameters parameters;
    Vector3* gravity = NULL;

    // Load the defined rigid body parameters.
    properties->rewind();
    const char* name;
    while ((name = properties->getNextProperty()) != NULL)
    {
        if (strcmp(name, "mass") == 0)
        {
            parameters.mass = properties->getFloat();
        }
        else if (strcmp(name, "friction") == 0)
        {
            parameters.friction = properties->getFloat();
        }
        else if (strcmp(name, "restitution") == 0)
        {
            parameters.restitution = properties->getFloat();
        }
        else if (strcmp(name, "linearDamping") == 0)
        {
            parameters.linearDamping = properties->getFloat();
        }
        else if (strcmp(name, "angularDamping") == 0)
        {
            parameters.angularDamping = properties->getFloat();
        }
        else if (strcmp(name, "kinematic") == 0)
        {
            parameters.kinematic = properties->getBool();
        }
        else if (strcmp(name, "anisotropicFriction") == 0)
        {
            properties->getVector3(NULL, &parameters.anisotropicFriction);
        }
        else if (strcmp(name, "gravity") == 0)
        {
            gravity = new Vector3();
            properties->getVector3(NULL, gravity);
        }
        else if (strcmp(name, "angularFactor") == 0)
        {
            properties->getVector3(NULL, &parameters.angularFactor);
        }
        else if (strcmp(name, "linearFactor") == 0)
        {
            properties->getVector3(NULL, &parameters.linearFactor);
        }
        else
        {
            // Ignore this case (the attributes for the rigid body's collision shape would end up here).
        }
    }

    // Create the rigid body.
    PhysicsRigidBody* body = new PhysicsRigidBody(node, shape, parameters);

    if (gravity)
    {
        body->setGravity(*gravity);
        SAFE_DELETE(gravity);
    }

    return body;
}

void PhysicsRigidBody::setKinematic(bool kinematic)
{
    GP_ASSERT(_body);

    if (kinematic)
    {
        _body->setCollisionFlags(_body->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT);
        _body->setActivationState(DISABLE_DEACTIVATION);
    }
    else
    {
        _body->setCollisionFlags(_body->getCollisionFlags() & ~btCollisionObject::CF_KINEMATIC_OBJECT);
        _body->setActivationState(ACTIVE_TAG);
    }
}

void PhysicsRigidBody::setEnabled(bool enable)
{
    PhysicsCollisionObject::setEnabled(enable);
    if (enable)
        _body->setMotionState(_motionState);
}

float PhysicsRigidBody::getHeight(float x, float z) const
{
    GP_ASSERT(_collisionShape);
    GP_ASSERT(_node);

    // If our node has a terrain, call getHeight() on it since we need to factor in local
    // scaling on the terrain into the height calculation.
    Terrain* terrain = dynamic_cast<Terrain*>(_node->getDrawable());
    if (terrain)
        return terrain->getHeight(x, z);

    // This function is only supported for heightfield rigid bodies.
    if (_collisionShape->getType() != PhysicsCollisionShape::SHAPE_HEIGHTFIELD)
    {
        GP_WARN("Attempting to get the height of a non-heightfield rigid body.");
        return 0.0f;
    }

    GP_ASSERT(_collisionShape->_shapeData.heightfieldData);

    // Ensure inverse matrix is updated so we can transform from world back into local heightfield coordinates for indexing
    if (_collisionShape->_shapeData.heightfieldData->inverseIsDirty)
    {
        _collisionShape->_shapeData.heightfieldData->inverseIsDirty = false;

        _node->getWorldMatrix().invert(&_collisionShape->_shapeData.heightfieldData->inverse);
    }

    // Calculate the correct x, z position relative to the heightfield data.
    float cols = _collisionShape->_shapeData.heightfieldData->heightfield->getColumnCount();
    float rows = _collisionShape->_shapeData.heightfieldData->heightfield->getRowCount();

    GP_ASSERT(cols > 0);
    GP_ASSERT(rows > 0);

    Vector3 v = _collisionShape->_shapeData.heightfieldData->inverse * Vector3(x, 0.0f, z);
    x = v.x + (cols - 1) * 0.5f;
    z = v.z + (rows - 1) * 0.5f;

    // Get the unscaled height value from the HeightField
    float height = _collisionShape->_shapeData.heightfieldData->heightfield->getHeight(x, z);

    // Apply scale back to height
    Vector3 worldScale;
    _node->getWorldMatrix().getScale(&worldScale);
    height *= worldScale.y;

    return height;
}

void PhysicsRigidBody::addConstraint(PhysicsConstraint* constraint)
{
    GP_ASSERT(constraint);
    if (_constraints == NULL)
        _constraints = new std::vector<PhysicsConstraint*>();

    _constraints->push_back(constraint);
}

void PhysicsRigidBody::removeConstraint(PhysicsConstraint* constraint)
{
    // Ensure that the rigid body has constraints and that we are
    // not currently in the rigid body's destructor (in this case,
    // the constraints will be destroyed from there).
    if (_constraints && !_inDestructor)
    {
        for (unsigned int i = 0; i < _constraints->size(); ++i)
        {
            if ((*_constraints)[i] == constraint)
            {
                _constraints->erase(_constraints->begin() + i);
                break;
            }
        }
    }
}

bool PhysicsRigidBody::supportsConstraints()
{
    return (getShapeType() != PhysicsCollisionShape::SHAPE_HEIGHTFIELD && getShapeType() != PhysicsCollisionShape::SHAPE_MESH);
}

void PhysicsRigidBody::transformChanged(Transform* transform, long cookie)
{
    if (getShapeType() == PhysicsCollisionShape::SHAPE_HEIGHTFIELD)
    {
        GP_ASSERT(_collisionShape && _collisionShape->_shapeData.heightfieldData);

        // Dirty the heightfield's inverse matrix (used to compute height values from world-space coordinates)
        _collisionShape->_shapeData.heightfieldData->inverseIsDirty = true;

        // Update local scaling for the heightfield.
        Vector3 scale;
        _node->getWorldMatrix().getScale(&scale);

        // If the node has a terrain attached, factor in the terrain local scaling as well for the collision shape
        Terrain* terrain = dynamic_cast<Terrain*>(_node->getDrawable());
        if (terrain)
        {
            const Vector3& tScale = terrain->_localScale;
            scale.set(scale.x * tScale.x, scale.y * tScale.y, scale.z * tScale.z);
        }

        _collisionShape->_shape->setLocalScaling(BV(scale));

        // Update center of mass offset
        float minHeight = _collisionShape->_shapeData.heightfieldData->minHeight;
        float maxHeight = _collisionShape->_shapeData.heightfieldData->maxHeight;
        _motionState->setCenterOfMassOffset(Vector3(0, -(minHeight + (maxHeight-minHeight)*0.5f) * scale.y, 0));
    }
}

}


text:
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-106782774-1"></script>
<script>
    window.dataLayer = window.dataLayer || [];

    function gtag() {
        dataLayer.push(arguments)
    };
    gtag('js', new Date());

    gtag('config', 'UA-106782774-1');
</script>
<link href="/public/stylesheets/application.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/public/stylesheets/custom.css" media="screen" rel="stylesheet" type="text/css" />
<link href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet">
<!--<link rel="stylesheet" href="https://openlayers.org/en/v3.0.0/css/ol.css" type="text/css">-->
<link rel="stylesheet" href="https://openlayers.org/en/v4.2.0/css/ol.css" type="text/css">
<!--<link rel="stylesheet" media="screen" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous">
<link rel="stylesheet" href="https://js.arcgis.com/3.21/dijit/themes/nihilo/nihilo.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.21/esri/css/esri.css">


text:
using System;
using NUnit.Framework;
using Infra;
using NSubstitute;
using System.Threading.Tasks;
using FluentAssertions;
using System.Linq;

namespace FSM.Tests {

    [TestFixture]
    public class StateMachineCoreTests {

        [Test]
        public async Task MachineWithNoStates_ShouldAbend() {
            await AsyncAssert.Throws<ApplicationException>(async () => {
                await CreateMachine.Start();
            });
        }

        [Test]
        public async Task MachineWithNoStartState_ShouldAbend() {
            await AsyncAssert.Throws<ApplicationException>(async () => {
                var mc = CreateMachine;
                mc.DefineState<EmptyState>();
                await CreateMachine.Start();
            });
        }

        [Test]
        public async Task MachineWithTrivialStartState_ShouldBeStartable() {
            var mc = CreateMachine;
            mc.DefineState<EmptyState>().AsStartState();
            await mc.Start();
        }

        [Test]
        public async Task States_ShouldBeAutomaticallyClosedDuringDefinition() {
            var mc = CreateMachine;
            mc.DefineState<EmptyState>().AsStartState();
            mc.DefineState<FaultingState>();
            await mc.Start();
            mc.ConfiguredStates.Should().HaveCount(2, "States should be auto completed added");
        }

        [Test]
        public async Task SingletonStates_ShouldGetCached() {
            var mc = CreateMachine;
            mc.DefineState<EmptyState>().AsStartState().Singleton();
            await mc.Start();
            mc.ConfiguredStates.First().CachedState.Should().NotBeNull("A singleton state should be cached after activation");
        }

        [Test]
        public async Task TransientStates_ShouldNotBeCached() {
            var mc = CreateMachine;
            mc.DefineState<EmptyState>().AsStartState();
            await mc.Start();
            mc.ConfiguredStates.First().CachedState.Should().BeNull("Non singleton states should be not cached after activation");
        }

        private IStateMachine<EmptyContext> CreateMachine {
            get {
                return new SimpleStateMachine<EmptyContext>(Substitute.For<IEventQueue>(), Substitute.For<IEventStatistician>(), false)
                    .WithContext(new EmptyContext());
            }
        }

    }
}


text:
<?php

namespace PSX\Framework\Schema\Discovery;

use PSX\Schema\SchemaAbstract;

/**
 * Link
 *
 * @author  Christoph Kappestein <christoph.kappestein@gmail.com>
 * @license http://www.apache.org/licenses/LICENSE-2.0
 * @link    http://phpsx.org
 */
class Link extends SchemaAbstract
{
    public function build(): void
    {
        $type = $this->newStruct('Discovery_Link');
        $type->addString('rel');
        $type->addString('href');
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>NamaStudy</title>

    <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
    <link href='https://fonts.googleapis.com/css?family=Kaushan+Script' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700' rel='stylesheet' type='text/css'>

    <link href="css/agency.min.css" rel="stylesheet">

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    Toggle navigation Menu
                </button>
                NamaStudy

                        Home

                        About

                        Activity Log

                        Logout

NamaStudy

Making studying a good habit, one assignment at a time

                      <form id="create_account_form" action="index.html">

                              <input id="usr_name" class="login" type="text" name="first" placeholder=" Username" />

                              <input id="password" class="login pswd" type="password" name="pswd" placeholder=" Password" />

                              <input class="login pswd" type="password" name="pswd" placeholder=" Retype Password" />

                          <input id="create_button" class="btn-primary btn-lg" align="center" type="submit" value="Create acount" onclick="checkUsrNpass()"></input>
                        </form>


text:
var creationCallbackCalled1 = false;
var db1Name = "OpenDatabaseCreationCallback1" + (new Date()).getTime();
var db2Name = "OpenDatabaseCreationCallback2" + (new Date()).getTime();
var db1 = openDatabaseSync(db1Name, "1.0", "", 1,
                           function(db) {
                               postMessage("PASS: Creation callback was called.");
                               if (db.version != "")
                                   postMessage("FAIL: Wrong version " + db.version + "; empty string expected.");
                               else
                                   postMessage("PASS: Version set to empty string as expected.");
                           });

var db1Fail = null;
try {
    db1Fail = openDatabaseSync(db1Name, "1.0", "", 1);
    postMessage("FAIL: An INVALID_STATE_ERR exception should've been thrown.");
} catch(err) {
    if (db1Fail)
        postMessage("FAIL: db1Fail should have been null.");
    else
        postMessage("PASS: An exception was thrown and db1Fail is null as expected.");
}

// Open a handle to another database, first without a creation callback, then with one.
// Make sure the creation callback is not called.
var db2 = openDatabaseSync(db2Name, "1.0", "", 1);
db2 = openDatabaseSync(db2Name, "1.0", "", 1, function(db) { postMessage("FAIL: Creation callback should not have been called."); });

postMessage("done");


text:
ANSIBLE_METADATA = {'metadata_version': '1.1',
                    'status': ['stableinterface'],
                    'supported_by': 'community'}

DOCUMENTATION = '''
---
module: cs_facts
short_description: Gather facts on instances of Apache CloudStack based clouds.
description:
     - This module fetches data from the metadata API in CloudStack. The module must be called from within the instance itself.
version_added: '2.0'
author: René Moser (@resmo)
options:
  filter:
    description:
      - Filter for a specific fact.
    type: str
    choices:
      - cloudstack_service_offering
      - cloudstack_availability_zone
      - cloudstack_public_hostname
      - cloudstack_public_ipv4
      - cloudstack_local_hostname
      - cloudstack_local_ipv4
      - cloudstack_instance_id
      - cloudstack_user_data
  meta_data_host:
    description:
      - Host or IP of the meta data API service.
      - If not set, determination by parsing the dhcp lease file.
    type: str
    version_added: '2.4'
requirements: [ yaml ]
'''

EXAMPLES = '''
# Gather all facts on instances
- name: Gather cloudstack facts
  cs_facts:

# Gather specific fact on instances
- name: Gather cloudstack facts
  cs_facts: filter=cloudstack_instance_id

# Gather specific fact on instances with a given meta_data_host
- name: Gather cloudstack facts
  cs_facts:
    filter: cloudstack_instance_id
    meta_data_host: 169.254.169.254
'''

RETURN = '''
---
cloudstack_availability_zone:
  description: zone the instance is deployed in.
  returned: success
  type: str
  sample: ch-gva-2
cloudstack_instance_id:
  description: UUID of the instance.
  returned: success
  type: str
  sample: ab4e80b0-3e7e-4936-bdc5-e334ba5b0139
cloudstack_local_hostname:
  description: local hostname of the instance.
  returned: success
  type: str
  sample: VM-ab4e80b0-3e7e-4936-bdc5-e334ba5b0139
cloudstack_local_ipv4:
  description: local IPv4 of the instance.
  returned: success
  type: str
  sample: 185.19.28.35
cloudstack_public_hostname:
  description: public IPv4 of the router. Same as I(cloudstack_public_ipv4).
  returned: success
  type: str
  sample: VM-ab4e80b0-3e7e-4936-bdc5-e334ba5b0139
cloudstack_public_ipv4:
  description: public IPv4 of the router.
  returned: success
  type: str
  sample: 185.19.28.35
cloudstack_service_offering:
  description: service offering of the instance.
  returned: success
  type: str
  sample: Micro 512mb 1cpu
cloudstack_user_data:
  description: data of the instance provided by users.
  returned: success
  type: dict
  sample: { "bla": "foo" }
'''

import os
import traceback
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils.urls import fetch_url
from ansible.module_utils.facts import ansible_collector, default_collectors

YAML_IMP_ERR = None
try:
    import yaml
    HAS_LIB_YAML = True
except ImportError:
    YAML_IMP_ERR = traceback.format_exc()
    HAS_LIB_YAML = False

CS_METADATA_BASE_URL = "http://%s/latest/meta-data"
CS_USERDATA_BASE_URL = "http://%s/latest/user-data"

class CloudStackFacts(object):

    def __init__(self):
        collector = ansible_collector.get_ansible_collector(all_collector_classes=default_collectors.collectors,
                                                            filter_spec='default_ipv4',
                                                            gather_subset=['!all', 'network'],
                                                            gather_timeout=10)
        self.facts = collector.collect(module)

        self.api_ip = None
        self.fact_paths = {
            'cloudstack_service_offering': 'service-offering',
            'cloudstack_availability_zone': 'availability-zone',
            'cloudstack_public_hostname': 'public-hostname',
            'cloudstack_public_ipv4': 'public-ipv4',
            'cloudstack_local_hostname': 'local-hostname',
            'cloudstack_local_ipv4': 'local-ipv4',
            'cloudstack_instance_id': 'instance-id'
        }

    def run(self):
        result = {}
        filter = module.params.get('filter')
        if not filter:
            for key, path in self.fact_paths.items():
                result[key] = self._fetch(CS_METADATA_BASE_URL + "/" + path)
            result['cloudstack_user_data'] = self._get_user_data_json()
        else:
            if filter == 'cloudstack_user_data':
                result['cloudstack_user_data'] = self._get_user_data_json()
            elif filter in self.fact_paths:
                result[filter] = self._fetch(CS_METADATA_BASE_URL + "/" + self.fact_paths[filter])
        return result

    def _get_user_data_json(self):
        try:
            # this data come form users, we try what we can to parse it...
            return yaml.safe_load(self._fetch(CS_USERDATA_BASE_URL))
        except Exception:
            return None

    def _fetch(self, path):
        api_ip = self._get_api_ip()
        if not api_ip:
            return None
        api_url = path % api_ip
        (response, info) = fetch_url(module, api_url, force=True)
        if response:
            data = response.read()
        else:
            data = None
        return data

    def _get_dhcp_lease_file(self):
        """Return the path of the lease file."""
        default_iface = self.facts['default_ipv4']['interface']
        dhcp_lease_file_locations = [
            '/var/lib/dhcp/dhclient.%s.leases' % default_iface,  # debian / ubuntu
            '/var/lib/dhclient/dhclient-%s.leases' % default_iface,  # centos 6
            '/var/lib/dhclient/dhclient--%s.lease' % default_iface,  # centos 7
            '/var/db/dhclient.leases.%s' % default_iface,  # openbsd
        ]
        for file_path in dhcp_lease_file_locations:
            if os.path.exists(file_path):
                return file_path
        module.fail_json(msg="Could not find dhclient leases file.")

    def _get_api_ip(self):
        """Return the IP of the DHCP server."""
        if module.params.get('meta_data_host'):
            return module.params.get('meta_data_host')
        elif not self.api_ip:
            dhcp_lease_file = self._get_dhcp_lease_file()
            for line in open(dhcp_lease_file):
                if 'dhcp-server-identifier' in line:
                    # get IP of string "option dhcp-server-identifier 185.19.28.176;"
                    line = line.translate(None, ';')
                    self.api_ip = line.split()[2]
                    break
            if not self.api_ip:
                module.fail_json(msg="No dhcp-server-identifier found in leases file.")
        return self.api_ip

def main():
    global module
    module = AnsibleModule(
        argument_spec=dict(
            filter=dict(default=None, choices=[
                'cloudstack_service_offering',
                'cloudstack_availability_zone',
                'cloudstack_public_hostname',
                'cloudstack_public_ipv4',
                'cloudstack_local_hostname',
                'cloudstack_local_ipv4',
                'cloudstack_instance_id',
                'cloudstack_user_data',
            ]),
            meta_data_host=dict(),
        ),
        supports_check_mode=True
    )

    if not HAS_LIB_YAML:
        module.fail_json(msg=missing_required_lib("PyYAML"), exception=YAML_IMP_ERR)

    cs_facts = CloudStackFacts().run()
    cs_facts_result = dict(changed=False, ansible_facts=cs_facts)
    module.exit_json(**cs_facts_result)

if __name__ == '__main__':
    main()


text:
<?php

namespace Google\Service\Sasportal;

class SasPortalListCustomersResponse extends \Google\Collection
{
  protected $collection_key = 'customers';
  protected $customersType = SasPortalCustomer::class;
  protected $customersDataType = 'array';
  /**
   * @var string
   */
  public $nextPageToken;

  /**
   * @param SasPortalCustomer[]
   */
  public function setCustomers($customers)
  {
    $this->customers = $customers;
  }
  /**
   * @return SasPortalCustomer[]
   */
  public function getCustomers()
  {
    return $this->customers;
  }
  /**
   * @param string
   */
  public function setNextPageToken($nextPageToken)
  {
    $this->nextPageToken = $nextPageToken;
  }
  /**
   * @return string
   */
  public function getNextPageToken()
  {
    return $this->nextPageToken;
  }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(SasPortalListCustomersResponse::class, 'Google_Service_Sasportal_SasPortalListCustomersResponse');


text:
var isReady = false,
	actions = {},
	apis = {};

function get(action) {
	if (!isReady) return false;

	var json = Array.prototype.slice.call(arguments);
	json = json.slice(1);

	action = action.slice(1);
	var ret = actions[action](json);
}

function on() {
	isReady = true;
}

actions['get'] = function(obj) {
	var path = obj[0],
		property = obj[1],
		callback = obj[2];

	var api = getApi(path);
	outlet(0, '/_get_reply', callback, api.get(property));
};

actions['set'] = function(obj) {
	var path = obj[0],
		property = obj[1],
		value = obj[2];

	var api = getApi(path);
	api.set(property, value);
};

actions['call'] = function(obj) {
	var path = obj[0],
		method = obj[1];

	var api = getApi(path);
	api.call(method);
};

actions['observe'] = function(obj) {
	var path = obj[0],
		property = obj[1],
		callback = obj[2];

	var handler = handleCallbacks(callback);

	var api = new LiveAPI(handler, path);
	api.property = property;
};

actions['count'] = function(obj) {
	var path = obj[0],
		property = obj[1],
		callback = obj[2];

	var api = getApi(path);
	outlet(0, '/_get_reply', callback, api.getcount(property));
};

function getApi(path) {
	if (apis[path])
		return apis[path];

	apis[path] = new LiveAPI(path);
	return apis[path];
}

function handleCallbacks(callback) {
	return function(value) {
		outlet(0, '/_observer_reply', callback, value);
	}
}

function log() {
  for(var i=0,len=arguments.length; i<len; i++) {
    var message = arguments[i];
    if(message && message.toString) {
      var s = message.toString();
      if(s.indexOf("[object ") >= 0) {
        s = JSON.stringify(message);
      }
      post(s);
    }
    else if(message === null) {
      post("<null>");
    }
    else {
      post(message);
    }
  }
  post("\n");
}


text:
<?php

namespace Drupal\Tests\Core\Menu;

use Drupal\Core\Session\AccountInterface;

/**
 * Defines a mock implementation of a dynamic menu link used in tests only.
 *
 * Has a dynamic route and title. This is rather contrived, but there are valid
 * use cases.
 *
 * @see \Drupal\user\Plugin\Menu\LoginLogoutMenuLink
 */
class DynamicMenuLinkMock extends MenuLinkMock {

  /**
   * The current user.
   *
   * @var \Drupal\Core\Session\AccountInterface
   */
  protected $currentUser;

  /**
   * Sets the current user.
   *
   * Allows the menu link to return the right title and route.
   *
   * @param \Drupal\Core\Session\AccountInterface $current_user
   *   The current user.
   *
   * @return $this
   */
  public function setCurrentUser(AccountInterface $current_user) {
    $this->currentUser = $current_user;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getTitle() {
    if ($this->currentUser->isAuthenticated()) {
      return 'Log out';
    }
    else {
      return 'Log in';
    }
  }

  /**
   * {@inheritdoc}
   */
  public function getRouteName() {
    if ($this->currentUser->isAuthenticated()) {
      return 'user.logout';
    }
    else {
      return 'user.login';
    }
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheContexts() {
    return ['user.roles:authenticated'];
  }

}


text:
package com.max.soundboard;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

class FileManager {
    private FileManager() {
    }

    public static List<String> getSubdirectories(String path) {
        List<String> subdirectories = new ArrayList<>();

        for (File file : new File(path).listFiles()) {
            if (file.isDirectory()) {
                subdirectories.add(file.getName());
            }
        }
        return subdirectories;
    }

    public static List<String> getSoundFileNames(String path) {
        List<String> soundFiles = new ArrayList<>();

        for (File file : new File(path).listFiles()) {
            if (file.isFile() && isSoundFileName(file.getName())) {
                soundFiles.add(file.getName());
            }
        }
        return soundFiles;
    }

    private static boolean isSoundFileName(String filename) {
        return filename.endsWith(".mp3") || filename.endsWith(".wav");
    }
}


text:
package xyz.upperlevel.uppercore.itemstack.meta;

import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.meta.FireworkEffectMeta;
import org.bukkit.inventory.meta.ItemMeta;
import xyz.upperlevel.uppercore.config.Config;
import xyz.upperlevel.uppercore.config.ConfigConstructor;
import xyz.upperlevel.uppercore.config.ConfigProperty;
import xyz.upperlevel.uppercore.config.ConfigUtil;
import xyz.upperlevel.uppercore.itemstack.UItem;
import xyz.upperlevel.uppercore.placeholder.PlaceholderValue;

import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import static xyz.upperlevel.uppercore.config.ConfigUtil.parseFireworkEffectType;

public class UFireworkEffectItem extends UItem {
    private FireworkEffect effect;

    @ConfigConstructor
    public UFireworkEffectItem(
            @ConfigProperty("type") Material type,
            @ConfigProperty(value = "data", optional = true) PlaceholderValue<Short> data,
            @ConfigProperty(value = "amount", optional = true) PlaceholderValue<Integer> amount,
            @ConfigProperty(value = "name", optional = true) String rawName,
            @ConfigProperty(value = "lore", optional = true) List<PlaceholderValue<String>> lore,
            @ConfigProperty(value = "flags", optional = true) List<ItemFlag> flags,
            @ConfigProperty(value = "enchantments", optional = true) Map<Enchantment, PlaceholderValue<Integer>> enchantments,
            @ConfigProperty(value = "effect", optional = true) FireworkEffect effect
    ) {
        super(type, data, amount, rawName, lore, flags, enchantments);
        this.effect = effect;
    }

    @Override
    public void processMeta(Player player, ItemMeta m) {
        super.processMeta(player, m);
        FireworkEffectMeta meta = (FireworkEffectMeta) m;
        meta.setEffect(effect);
    }

    @SuppressWarnings("unchecked")
    public static FireworkEffect parse(Config config) {
        boolean flicker = config.getBool("flicker", false);
        boolean trail = config.getBool("trail", false);
        List<Color> colors = ((Collection<String>) config.getCollection("colors", Collections.emptyList()))
                .stream()
                .map(ConfigUtil::parseColor)
                .collect(Collectors.toList());
        List<Color> fadeColors = ((Collection<String>) config.getCollection("fade-colors", Collections.emptyList()))
                .stream()
                .map(ConfigUtil::parseColor)
                .collect(Collectors.toList());
        FireworkEffect.Type type = parseFireworkEffectType(config.getString("type", FireworkEffect.Type.BALL.name()));
        return FireworkEffect.builder()
                .flicker(flicker)
                .trail(trail)
                .withColor(colors)
                .withFade(fadeColors)
                .with(type)
                .build();
    }
}


text:
package org.apache.ignite.binary;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Collection;
import java.util.Date;
import java.util.Map;
import java.util.UUID;

/**
 * Reader for binary objects used in {@link Binarylizable} implementations.
 * Useful for the cases when user wants a fine-grained control over serialization.
 * <p>
 * Note that Ignite never writes full strings for field or type names. Instead,
 * for performance reasons, Ignite writes integer hash codes for type and field names.
 * It has been tested that hash code conflicts for the type names or the field names
 * within the same type are virtually non-existent and, to gain performance, it is safe
 * to work with hash codes. For the cases when hash codes for different types or fields
 * actually do collide, Ignite provides {@link BinaryIdMapper} which
 * allows to override the automatically generated hash code IDs for the type and field names.
 */
public interface BinaryReader {
    /**
     * @param fieldName Field name.
     * @return Byte value.
     * @throws BinaryObjectException In case of error.
     */
    public byte readByte(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Short value.
     * @throws BinaryObjectException In case of error.
     */
    public short readShort(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Integer value.
     * @throws BinaryObjectException In case of error.
     */
    public int readInt(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Long value.
     * @throws BinaryObjectException In case of error.
     */
    public long readLong(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @throws BinaryObjectException In case of error.
     * @return Float value.
     */
    public float readFloat(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Double value.
     * @throws BinaryObjectException In case of error.
     */
    public double readDouble(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Char value.
     * @throws BinaryObjectException In case of error.
     */
    public char readChar(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Boolean value.
     * @throws BinaryObjectException In case of error.
     */
    public boolean readBoolean(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Decimal value.
     * @throws BinaryObjectException In case of error.
     */
    public BigDecimal readDecimal(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return String value.
     * @throws BinaryObjectException In case of error.
     */
    public String readString(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return UUID.
     * @throws BinaryObjectException In case of error.
     */
    public UUID readUuid(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Date.
     * @throws BinaryObjectException In case of error.
     */
    public Date readDate(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Timestamp.
     * @throws BinaryObjectException In case of error.
     */
    public Timestamp readTimestamp(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Object.
     * @throws BinaryObjectException In case of error.
     */
    public <T> T readObject(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Byte array.
     * @throws BinaryObjectException In case of error.
     */
    public byte[] readByteArray(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Short array.
     * @throws BinaryObjectException In case of error.
     */
    public short[] readShortArray(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Integer array.
     * @throws BinaryObjectException In case of error.
     */
    public int[] readIntArray(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Long array.
     * @throws BinaryObjectException In case of error.
     */
    public long[] readLongArray(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Float array.
     * @throws BinaryObjectException In case of error.
     */
    public float[] readFloatArray(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Byte array.
     * @throws BinaryObjectException In case of error.
     */
    public double[] readDoubleArray(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Char array.
     * @throws BinaryObjectException In case of error.
     */
    public char[] readCharArray(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Boolean array.
     * @throws BinaryObjectException In case of error.
     */
    public boolean[] readBooleanArray(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Decimal array.
     * @throws BinaryObjectException In case of error.
     */
    public BigDecimal[] readDecimalArray(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return String array.
     * @throws BinaryObjectException In case of error.
     */
    public String[] readStringArray(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return UUID array.
     * @throws BinaryObjectException In case of error.
     */
    public UUID[] readUuidArray(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Date array.
     * @throws BinaryObjectException In case of error.
     */
    public Date[] readDateArray(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Timestamp array.
     * @throws BinaryObjectException In case of error.
     */
    public Timestamp[] readTimestampArray(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Object array.
     * @throws BinaryObjectException In case of error.
     */
    public Object[] readObjectArray(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Collection.
     * @throws BinaryObjectException In case of error.
     */
    public <T> Collection<T> readCollection(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @param factory Collection factory.
     * @return Collection.
     * @throws BinaryObjectException In case of error.
     */
    public <T> Collection<T> readCollection(String fieldName, BinaryCollectionFactory<T> factory)
        throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Map.
     * @throws BinaryObjectException In case of error.
     */
    public <K, V> Map<K, V> readMap(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @param factory Map factory.
     * @return Map.
     * @throws BinaryObjectException In case of error.
     */
    public <K, V> Map<K, V> readMap(String fieldName, BinaryMapFactory<K, V> factory) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Value.
     * @throws BinaryObjectException In case of error.
     */
    public <T extends Enum<?>> T readEnum(String fieldName) throws BinaryObjectException;

    /**
     * @param fieldName Field name.
     * @return Value.
     * @throws BinaryObjectException In case of error.
     */
    public <T extends Enum<?>> T[] readEnumArray(String fieldName) throws BinaryObjectException;

    /**
     * Gets raw reader. Raw reader does not use field name hash codes, therefore,
     * making the format even more compact. However, if the raw reader is used,
     * dynamic structure changes to the binary objects are not supported.
     *
     * @return Raw reader.
     */
    public BinaryRawReader rawReader();
}


text:
[Parking Pal](https://parkingpal.herokuapp.com)
====

A platform where users can rent their private parking spots (e.g. garages, driveways etc) on a pay per length basis.