text:
package cn.lambdacraft.crafting.block.crafter;

import net.minecraft.tileentity.TileEntityFurnace;
import cn.lambdacraft.crafting.recipe.RecipeWeapons;
import cn.lambdacraft.crafting.register.CBCBlocks;

/**
 * 武器合成机和高级武器合成机的TileEntity类。
 * @author WeAthFolD
 */
public class TileWeaponCrafter extends TileCrafterBase {

    public static final int
        MAX_HEAT_NORMAL = 4000,
        MAX_HEAT_ADVANCED = 7000;

    public int burnTimeLeft,
            maxBurnTime;
    protected boolean isBurning;
    protected boolean isAdvanced;

    /**
     * inventory: 1-18:材料存储 19:燃料槽 20:合成结果槽
     * craftingStacks: 4*3 的合成表显示槽。
     */
    public TileWeaponCrafter() {}

    /**
     * 尝试消耗燃料,FFFFFFFFFFFFFFFF
     */
    public void tryBurn() {
        if (inventory[1] != null
                && TileEntityFurnace.getItemBurnTime(inventory[1]) > 0) {
            this.burnTimeLeft = TileEntityFurnace.getItemBurnTime(inventory[1]) / 2;
            this.maxBurnTime = this.burnTimeLeft;
            inventory[1].splitStack(1);
            if (inventory[1].stackSize <= 1)
                inventory[1] = null;
            isBurning = true;
            blockType.setLightLevel(0.4F);
        }
    }

    //------------------TICKUPDATE-------------------------
    @Override
    public void updateEntity() {
        super.updateEntity();

        //热量下降
        if (heat > 0)
            heat--;

        if(!worldObj.isRemote && isCrafting && !isBurning)
            tryBurn();

        //燃烧状态检查
        if (isBurning) {
            burnTimeLeft--;
            heat = Math.min(maxHeat, heat + 3);
            if (burnTimeLeft <= 0) {
                isBurning = false;
            }
        }

    }

    //---------------------MISC---------------------
    @Override
    public String getInventoryName() {
        return "lambdacraft:weaponcrafter";
    }

    @Override
    protected boolean onCrafterLoad() {
        if (this.getBlockType() == null)
            return false;
        isAdvanced = !(this.blockType == CBCBlocks.weaponCrafter);
        recipes = RecipeWeapons.getMachineRecipes(isAdvanced ? 1 : 0);
        this.maxHeat = isAdvanced ? MAX_HEAT_ADVANCED : MAX_HEAT_NORMAL;
        this.writeRecipeInfoToSlot();
        return true;
    }

}

redpajama_set_name: RedPajamaGithub


text:
local ContentProvider = import("./ContentProvider")

describe("instances.ContentProvider", function()
	it("should instantiate", function()
		local instance = ContentProvider:new()

		assert.not_nil(instance)
	end)

	it("should have a string property BaseUrl", function()
		local instance = ContentProvider:new()

		assert.equals(type(instance.BaseUrl), "string")
	end)
end)


text:
package com.facebook.buck.cxx.platform;

import com.facebook.buck.model.BuildTarget;
import com.facebook.buck.parser.NoSuchBuildTargetException;
import com.facebook.buck.rules.SourcePath;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;

/**
 * Interface for {@link com.facebook.buck.rules.BuildRule} objects (e.g. C++ libraries) which can
 * contribute to the top-level link of a native binary (e.g. C++ binary).
 */
public interface NativeLinkable {

  BuildTarget getBuildTarget();

  /**
   * @return All native linkable dependencies that are required by this linkable on a specific
   *     platform.
   */
  @SuppressWarnings("unused")
  default Iterable<? extends NativeLinkable> getNativeLinkableDepsForPlatform(
      CxxPlatform cxxPlatform) {
    return getNativeLinkableDeps();
  }

  /**
   * @return All native linkable exported dependencies that are required by this linkable on a
   *     specific platform.
   */
  @SuppressWarnings("unused")
  default Iterable<? extends NativeLinkable> getNativeLinkableExportedDepsForPlatform(
      CxxPlatform cxxPlatform) {
    return getNativeLinkableExportedDeps();
  }

  /**
   * @return All native linkable dependencies that might be required by this linkable on any
   *     platform.
   */
  Iterable<? extends NativeLinkable> getNativeLinkableDeps();

  /**
   * @return All native linkable exported dependencies that might be required by this linkable on
   *     any platform.
   */
  Iterable<? extends NativeLinkable> getNativeLinkableExportedDeps();

  enum LanguageExtensions {
    HS_PROFILE
  }

  /**
   * Return input that *dependents* should put on their link line when linking against this
   * linkable.
   */
  NativeLinkableInput getNativeLinkableInput(
      CxxPlatform cxxPlatform,
      Linker.LinkableDepType type,
      boolean forceLinkWhole,
      ImmutableSet<LanguageExtensions> languageExtensions)
      throws NoSuchBuildTargetException;

  /**
   * Return input that *dependents* should put on their link line when linking against this
   * linkable.
   */
  default NativeLinkableInput getNativeLinkableInput(
      CxxPlatform cxxPlatform, Linker.LinkableDepType type) throws NoSuchBuildTargetException {
    return getNativeLinkableInput(cxxPlatform, type, false, ImmutableSet.of());
  }

  Linkage getPreferredLinkage(CxxPlatform cxxPlatform);

  /**
   * @return a map of shared library SONAME to shared library path for the given {@link
   *     CxxPlatform}.
   */
  ImmutableMap<String, SourcePath> getSharedLibraries(CxxPlatform cxxPlatform)
      throws NoSuchBuildTargetException;

  enum Linkage {
    ANY,
    STATIC,
    SHARED,
  }
}


text:
package org.apache.calcite.rel.core;

import org.apache.calcite.plan.RelOptCluster;
import org.apache.calcite.plan.RelTraitSet;
import org.apache.calcite.rel.RelCollation;
import org.apache.calcite.rel.RelNode;
import org.apache.calcite.rel.RelWriter;
import org.apache.calcite.rel.SingleRel;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.rex.RexCall;
import org.apache.calcite.rex.RexNode;
import org.apache.calcite.rex.RexPatternFieldRef;
import org.apache.calcite.rex.RexVisitorImpl;
import org.apache.calcite.sql.SqlAggFunction;
import org.apache.calcite.sql.fun.SqlBitOpAggFunction;
import org.apache.calcite.sql.fun.SqlMinMaxAggFunction;
import org.apache.calcite.sql.fun.SqlStdOperatorTable;
import org.apache.calcite.sql.fun.SqlSumAggFunction;
import org.apache.calcite.sql.fun.SqlSumEmptyIsZeroAggFunction;
import org.apache.calcite.util.ImmutableBitSet;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSortedMap;
import com.google.common.collect.ImmutableSortedSet;

import org.checkerframework.checker.nullness.qual.Nullable;

import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.NavigableSet;
import java.util.Objects;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;

/**
 * Relational expression that represent a MATCH_RECOGNIZE node.
 *
 * <p>Each output row has the columns defined in the measure statements.
 */
public abstract class Match extends SingleRel {
  //~ Instance fields ---------------------------------------------
  private static final String STAR = "*";
  protected final ImmutableMap<String, RexNode> measures;
  protected final RexNode pattern;
  protected final boolean strictStart;
  protected final boolean strictEnd;
  protected final boolean allRows;
  protected final RexNode after;
  protected final ImmutableMap<String, RexNode> patternDefinitions;
  protected final Set<RexMRAggCall> aggregateCalls;
  protected final Map<String, SortedSet<RexMRAggCall>> aggregateCallsPreVar;
  protected final ImmutableMap<String, SortedSet<String>> subsets;
  protected final ImmutableBitSet partitionKeys;
  protected final RelCollation orderKeys;
  protected final @Nullable RexNode interval;

  //~ Constructors -----------------------------------------------

  /**
   * Creates a Match.
   *
   * @param cluster Cluster
   * @param traitSet Trait set
   * @param input Input relational expression
   * @param rowType Row type
   * @param pattern Regular expression that defines pattern variables
   * @param strictStart Whether it is a strict start pattern
   * @param strictEnd Whether it is a strict end pattern
   * @param patternDefinitions Pattern definitions
   * @param measures Measure definitions
   * @param after After match definitions
   * @param subsets Subsets of pattern variables
   * @param allRows Whether all rows per match (false means one row per match)
   * @param partitionKeys Partition by columns
   * @param orderKeys Order by columns
   * @param interval Interval definition, null if WITHIN clause is not defined
   */
  protected Match(RelOptCluster cluster, RelTraitSet traitSet, RelNode input,
      RelDataType rowType, RexNode pattern,
      boolean strictStart, boolean strictEnd,
      Map<String, RexNode> patternDefinitions, Map<String, RexNode> measures,
      RexNode after, Map<String, ? extends SortedSet<String>> subsets,
      boolean allRows, ImmutableBitSet partitionKeys, RelCollation orderKeys,
      @Nullable RexNode interval) {
    super(cluster, traitSet, input);
    this.rowType = Objects.requireNonNull(rowType);
    this.pattern = Objects.requireNonNull(pattern);
    Preconditions.checkArgument(patternDefinitions.size() > 0);
    this.strictStart = strictStart;
    this.strictEnd = strictEnd;
    this.patternDefinitions = ImmutableMap.copyOf(patternDefinitions);
    this.measures = ImmutableMap.copyOf(measures);
    this.after = Objects.requireNonNull(after);
    this.subsets = copyMap(subsets);
    this.allRows = allRows;
    this.partitionKeys = Objects.requireNonNull(partitionKeys);
    this.orderKeys = Objects.requireNonNull(orderKeys);
    this.interval = interval;

    final AggregateFinder aggregateFinder = new AggregateFinder();
    for (RexNode rex : this.patternDefinitions.values()) {
      if (rex instanceof RexCall) {
        aggregateFinder.go((RexCall) rex);
      }
    }

    for (RexNode rex : this.measures.values()) {
      if (rex instanceof RexCall) {
        aggregateFinder.go((RexCall) rex);
      }
    }

    aggregateCalls = ImmutableSortedSet.copyOf(aggregateFinder.aggregateCalls);
    aggregateCallsPreVar =
        copyMap(aggregateFinder.aggregateCallsPerVar);
  }

  /** Creates an immutable map of a map of sorted sets. */
  private static <K extends Comparable<K>, V>
      ImmutableSortedMap<K, SortedSet<V>>
      copyMap(Map<K, ? extends SortedSet<V>> map) {
    final ImmutableSortedMap.Builder<K, SortedSet<V>> b =
        ImmutableSortedMap.naturalOrder();
    for (Map.Entry<K, ? extends SortedSet<V>> e : map.entrySet()) {
      b.put(e.getKey(), ImmutableSortedSet.copyOf(e.getValue()));
    }
    return b.build();
  }

  //~ Methods --------------------------------------------------

  public ImmutableMap<String, RexNode> getMeasures() {
    return measures;
  }

  public RexNode getAfter() {
    return after;
  }

  public RexNode getPattern() {
    return pattern;
  }

  public boolean isStrictStart() {
    return strictStart;
  }

  public boolean isStrictEnd() {
    return strictEnd;
  }

  public boolean isAllRows() {
    return allRows;
  }

  public ImmutableMap<String, RexNode> getPatternDefinitions() {
    return patternDefinitions;
  }

  public ImmutableMap<String, SortedSet<String>> getSubsets() {
    return subsets;
  }

  public ImmutableBitSet getPartitionKeys() {
    return partitionKeys;
  }

  public RelCollation getOrderKeys() {
    return orderKeys;
  }

  public @Nullable RexNode getInterval() {
    return interval;
  }

  @Override public RelWriter explainTerms(RelWriter pw) {
    return super.explainTerms(pw)
        .item("partition", getPartitionKeys().asList())
        .item("order", getOrderKeys())
        .item("outputFields", getRowType().getFieldNames())
        .item("allRows", isAllRows())
        .item("after", getAfter())
        .item("pattern", getPattern())
        .item("isStrictStarts", isStrictStart())
        .item("isStrictEnds", isStrictEnd())
        .itemIf("interval", getInterval(), getInterval() != null)
        .item("subsets", getSubsets().values().asList())
        .item("patternDefinitions", getPatternDefinitions().values().asList())
        .item("inputFields", getInput().getRowType().getFieldNames());
  }

  /**
   * Find aggregate functions in operands.
   */
  private static class AggregateFinder extends RexVisitorImpl<Void> {
    final NavigableSet<RexMRAggCall> aggregateCalls = new TreeSet<>();
    final Map<String, NavigableSet<RexMRAggCall>> aggregateCallsPerVar =
        new TreeMap<>();

    AggregateFinder() {
      super(true);
    }

    @Override public Void visitCall(RexCall call) {
      SqlAggFunction aggFunction = null;
      switch (call.getKind()) {
      case SUM:
        aggFunction = new SqlSumAggFunction(call.getType());
        break;
      case SUM0:
        aggFunction = new SqlSumEmptyIsZeroAggFunction();
        break;
      case MAX:
      case MIN:
        aggFunction = new SqlMinMaxAggFunction(call.getKind());
        break;
      case COUNT:
        aggFunction = SqlStdOperatorTable.COUNT;
        break;
      case ANY_VALUE:
        aggFunction = SqlStdOperatorTable.ANY_VALUE;
        break;
      case BIT_AND:
      case BIT_OR:
      case BIT_XOR:
        aggFunction = new SqlBitOpAggFunction(call.getKind());
        break;
      default:
        visitEach(call.operands);
      }
      if (aggFunction != null) {
        RexMRAggCall aggCall = new RexMRAggCall(aggFunction,
            call.getType(), call.getOperands(), aggregateCalls.size());
        aggregateCalls.add(aggCall);
        Set<String> pv = new PatternVarFinder().go(call.getOperands());
        if (pv.size() == 0) {
          pv.add(STAR);
        }
        for (String alpha : pv) {
          final NavigableSet<RexMRAggCall> set;
          if (aggregateCallsPerVar.containsKey(alpha)) {
            set = aggregateCallsPerVar.get(alpha);
          } else {
            set = new TreeSet<>();
            aggregateCallsPerVar.put(alpha, set);
          }
          boolean update = true;
          for (RexMRAggCall rex : set) {
            if (rex.equals(aggCall)) {
              update = false;
              break;
            }
          }
          if (update) {
            set.add(aggCall);
          }
        }
      }
      return null;
    }

    public void go(RexCall call) {
      call.accept(this);
    }
  }

  /**
   * Visits the operands of an aggregate call to retrieve relevant pattern
   * variables.
   */
  private static class PatternVarFinder extends RexVisitorImpl<Void> {
    final Set<String> patternVars = new HashSet<>();

    PatternVarFinder() {
      super(true);
    }

    @Override public Void visitPatternFieldRef(RexPatternFieldRef fieldRef) {
      patternVars.add(fieldRef.getAlpha());
      return null;
    }

    @Override public Void visitCall(RexCall call) {
      visitEach(call.operands);
      return null;
    }

    public Set<String> go(RexNode rex) {
      rex.accept(this);
      return patternVars;
    }

    public Set<String> go(List<RexNode> rexNodeList) {
      visitEach(rexNodeList);
      return patternVars;
    }
  }

  /**
   * Aggregate calls in match recognize.
   */
  public static final class RexMRAggCall extends RexCall
      implements Comparable<RexMRAggCall> {
    public final int ordinal;

    RexMRAggCall(SqlAggFunction aggFun,
        RelDataType type,
        List<RexNode> operands,
        int ordinal) {
      super(type, aggFun, operands);
      this.ordinal = ordinal;
      digest = toString(); // can compute here because class is final
    }

    @Override public int compareTo(RexMRAggCall o) {
      return toString().compareTo(o.toString());
    }

    @Override public boolean equals(@Nullable Object obj) {
      return obj == this
          || obj instanceof RexMRAggCall
          && toString().equals(obj.toString());
    }

    @Override public int hashCode() {
      return toString().hashCode();
    }
  }
}


text:
package com.jaamsim.Graphics;

import java.net.URI;
import java.util.ArrayList;

import com.jaamsim.Commands.KeywordCommand;
import com.jaamsim.basicsim.Entity;
import com.jaamsim.basicsim.GUIListener;
import com.jaamsim.basicsim.JaamSimModel;
import com.jaamsim.controllers.PolarInfo;
import com.jaamsim.datatypes.IntegerVector;
import com.jaamsim.input.BooleanInput;
import com.jaamsim.input.EntityInput;
import com.jaamsim.input.FileInput;
import com.jaamsim.input.InputAgent;
import com.jaamsim.input.IntegerListInput;
import com.jaamsim.input.KeyedVec3dInput;
import com.jaamsim.input.Keyword;
import com.jaamsim.input.KeywordIndex;
import com.jaamsim.input.Output;
import com.jaamsim.input.StringInput;
import com.jaamsim.input.Vec3dInput;
import com.jaamsim.math.Transform;
import com.jaamsim.math.Vec3d;
import com.jaamsim.math.Vec4d;
import com.jaamsim.render.CameraInfo;
import com.jaamsim.units.DistanceUnit;

public class View extends Entity {

	public static final int OMNI_VIEW_ID = -1;
	public static final int NO_VIEW_ID = 0;

	private final int viewID;

	@Keyword(description = "The region in which the view's coordinates are given.",
	         exampleList = {"Region1"})
	private final EntityInput<Region> region;

	@Keyword(description = "The position at which the view camera is pointed.",
	         exampleList = {"0 0 0 m"})
	private final Vec3dInput center;

	@Keyword(description = "The position of the view camera.",
	         exampleList = {"0 0 50 m"})
	private final Vec3dInput position;

	@Keyword(description = "The size of the window in pixels (width, height).",
	         exampleList = {"500 300"})
	private final IntegerListInput windowSize;

	@Keyword(description = "The position of the upper left corner of the window in pixels "
	                     + "measured from the top left corner of the screen.",
	         exampleList = {"220 110"})
	private final IntegerListInput windowPos;

	@Keyword(description = "Text to place in the title bar of the view window. The window must "
	                     + "be closed and re-opened manually after changing the title.",
	         exampleList = {"'An Example Title'"})
	private final StringInput titleBar;

	@Keyword(description = "If TRUE, the view window is displayed on screen.",
	         exampleList = {"FALSE"})
	private final BooleanInput showWindow;

	@Keyword(description = "A Boolean indicating whether the view can be panned or rotated.",
	         exampleList = {"FALSE"})
	private final BooleanInput movable;

	@Keyword(description = "A Boolean indicating whether the view is locked to a downward view "
	                     + "(the 2D default).",
	         exampleList = {"FALSE"})
	private final BooleanInput lock2D;

	@Keyword(description = "The (optional) entity for this view to follow. Setting this input "
	                     + "makes the view ignore ViewCenter and interprets ViewPosition as a "
	                     + "relative offset to this entity.",
	         exampleList = {"Ship1"})
	private final EntityInput<DisplayEntity> followEntityInput;

	@Keyword(description = "The (optional) scripted curve for the view position to follow.",
	         exampleList = {"{{ 0 h } { 0 0 0 m }} {{ 100 h } { 100 0 0 m }}"})
	private final KeyedVec3dInput positionScriptInput;

	@Keyword(description = "The (optional) scripted curve for the view center to follow.",
	         exampleList = {"{{ 0 h } { 0 0 0 m }} {{ 100 h } { 100 0 0 m }}"})
	private final KeyedVec3dInput centerScriptInput;

	@Keyword(description = "The image file to use as the background for this view.",
	         exampleList = {"'<res>/images/sky_map_2048x1024.jpg'"})
	private final FileInput skyboxImage;

	private final Object setLock = new Object();

	private double cachedSimTime = 0;

	private static IntegerVector defPos = new IntegerVector(2);
	private static IntegerVector defSize = new IntegerVector(2);

	static {
		defPos.fillWithEntriesOf(2, 0);
		defSize.fillWithEntriesOf(2, 0);
	}

	{
		attributeDefinitionList.setHidden(true);
		namedExpressionInput.setHidden(true);

		region = new EntityInput<>(Region.class, "Region", GRAPHICS, null);
		this.addInput(region);

		center = new Vec3dInput("ViewCenter", GRAPHICS, new Vec3d());
		center.setUnitType(DistanceUnit.class);
		center.setPromptReqd(false);
		this.addInput(center);

		position = new Vec3dInput("ViewPosition", GRAPHICS, new Vec3d(10.0d, -10.0d, 10.0d));
		position.setUnitType(DistanceUnit.class);
		position.setPromptReqd(false);
		this.addInput(position);

		windowSize = new IntegerListInput("WindowSize", GRAPHICS, defSize);
		windowSize.setValidCount(2);
		windowSize.setValidRange(1, 8192);
		windowSize.setPromptReqd(false);
		this.addInput(windowSize);

		windowPos = new IntegerListInput("WindowPosition", GRAPHICS, defPos);
		windowPos.setValidCount(2);
		windowPos.setValidRange(-8192, 8192);
		windowPos.setPromptReqd(false);
		this.addInput(windowPos);

		titleBar = new StringInput("TitleBarText", GRAPHICS, null);
		this.addInput(titleBar);

		showWindow = new BooleanInput("ShowWindow", GRAPHICS, false);
		showWindow.setPromptReqd(false);
		this.addInput(showWindow);

		movable = new BooleanInput("Movable", GRAPHICS, true);
		this.addInput(movable);

		lock2D = new BooleanInput("Lock2D", GRAPHICS, false);
		this.addInput(lock2D);

		followEntityInput = new EntityInput<>(DisplayEntity.class, "FollowEntity", GRAPHICS, null);
		this.addInput(followEntityInput);

		positionScriptInput = new KeyedVec3dInput("ScriptedViewPosition", GRAPHICS);
		positionScriptInput.setUnitType(DistanceUnit.class);
		this.addInput(positionScriptInput);

		centerScriptInput = new KeyedVec3dInput("ScriptedViewCenter", GRAPHICS);
		centerScriptInput.setUnitType(DistanceUnit.class);
		this.addInput(centerScriptInput);

		skyboxImage = new FileInput("SkyboxImage", GRAPHICS, null);
		this.addInput(skyboxImage);

	}

	public View() {
		GUIListener gui = getJaamSimModel().getGUIListener();
		if (gui == null) {
			viewID = -1;
			return;
		}
		gui.addView(this);
		viewID = gui.getNextViewID();
	}

	@Override
	public void kill() {
		super.kill();
		GUIListener gui = getJaamSimModel().getGUIListener();
		if (gui == null)
			return;
		gui.removeView(this);
		gui.closeWindow(this);
	}

	@Override
	public void restore(String name) {
		super.restore(name);
		GUIListener gui = getJaamSimModel().getGUIListener();
		if (gui == null)
			return;
		gui.addView(this);
		gui.createWindow(this);
	}

	public static void setDefaultPosition(int x, int y) {
		defPos.set(0, x);
		defPos.set(1, y);
	}

	public static void setDefaultSize(int width, int height) {
		defSize.set(0, width);
		defSize.set(1, height);
	}

	public Vec3d getViewCenter() {
		return center.getValue();
	}

	public Vec3d getViewPosition() {
		return position.getValue();
	}

	/**
	 * Returns the point on the x-y plane at which the camera is aimed.
	 * @return point on the x-y plane
	 */
	public Vec3d getEffViewCenter() {
		Vec3d camPos = getViewPosition();
		if (camPos.z == 0.0d)
			return camPos;
		Vec3d center = getViewCenter();
		Vec3d vec = new Vec3d();
		vec.sub3(camPos, center);
		double factor = camPos.z/vec.z;
		vec.scale3(factor);
		Vec3d ret = new Vec3d(camPos);
		ret.sub3(vec);
		return ret;
	}

	public Vec3d getGlobalPosition() {
		synchronized (setLock) {

			// Check if this is following a script
			if (positionScriptInput.hasKeys()) {
				return positionScriptInput.getValueForTime(cachedSimTime);
			}

			// Is this view following an entity?
			DisplayEntity follow = followEntityInput.getValue();
			if (follow != null) {
				Vec3d ret = follow.getGlobalPosition();
				ret.add3(position.getValue());
				return ret;
			}

			Vec3d tmp = position.getValue();
			Vec4d ret = new Vec4d(tmp.x, tmp.y, tmp.z, 1.0d);
			if (region.getValue() != null) {
				Transform regTrans = region.getValue().getRegionTrans();
				regTrans.apply(ret, ret);
			}
			return ret;
		}
	}

	public Vec3d getGlobalCenter() {
		synchronized (setLock) {

			// Check if this is following a script
			if (centerScriptInput.hasKeys()) {
				return centerScriptInput.getValueForTime(cachedSimTime);
			}

			DisplayEntity follow = followEntityInput.getValue();
			if (follow != null) {
				return follow.getGlobalPosition();
			}

			Vec3d tmp = center.getValue();
			Vec4d ret = new Vec4d(tmp.x, tmp.y, tmp.z, 1.0d);
			if (region.getValue() != null) {
				Transform regTrans = region.getValue().getRegionTrans();
				regTrans.apply(ret, ret);
			}
			return ret;
		}
	}

	/**
	 * updateCenterAndPos is used only by the mouse interaction code. It takes the camera view center and camera position in global
	 * coordinates and sets the corresponding inputs (in region coordinates).
	 * @param center - view center in world coordinates
	 * @param pos - camera position in world coordinates
	 */
	public void updateCenterAndPos(Vec3d center, Vec3d pos) {
		synchronized (setLock){

			if (isScripted())
				return;

			Vec3d tempPos = new Vec3d(pos);
			Vec3d tempCent = new Vec3d(center);

			if (region.getValue() != null) {
				Transform regTrans = region.getValue().getRegionTrans();
				regTrans.inverse(regTrans);
				regTrans.multAndTrans(pos, tempPos);
				regTrans.multAndTrans(center, tempCent);
			}

			// If this is following an entity, subtract that entity's position from the camera position (as it is interpreted as relative)

			if (isFollowing()) {
				tempPos.sub3(followEntityInput.getValue().getGlobalPosition(), tempPos);
			}

			JaamSimModel simModel = getJaamSimModel();
			KeywordIndex posKw = simModel.formatVec3dInput("ViewPosition", tempPos, DistanceUnit.class);
			KeywordIndex ctrKw = simModel.formatVec3dInput("ViewCenter", tempCent, DistanceUnit.class);
			InputAgent.storeAndExecute(new KeywordCommand(this, posKw, ctrKw));
		}
	}

	public String getTitle() {
		if (titleBar.getValue() != null)
			return titleBar.getValue();
	    else
		    return this.getName();
	}

	public boolean showWindow() {
		return showWindow.getValue();
	}

	public Region getRegion() {
		return region.getValue();
	}

	public void setWindowPos(int x, int y, int width, int height) {
		ArrayList<KeywordIndex> kwList = new ArrayList<>(2);

		IntegerVector pos = windowPos.getValue();
		if (pos.get(0) != x || pos.get(1) != y) {
			KeywordIndex posKw = InputAgent.formatIntegers(windowPos.getKeyword(), x, y);
			kwList.add(posKw);
		}

		IntegerVector size = windowSize.getValue();
		if (size.get(0) != width || size.get(1) != height) {
			KeywordIndex sizeKw = InputAgent.formatIntegers(windowSize.getKeyword(), width, height);
			kwList.add(sizeKw);
		}

		if (kwList.isEmpty())
			return;

		KeywordIndex[] kws = new KeywordIndex[kwList.size()];
		kwList.toArray(kws);
		InputAgent.storeAndExecute(new KeywordCommand(this, kws));
	}

	public IntegerVector getWindowPos() {
		return windowPos.getValue();
	}

	public IntegerVector getWindowSize() {
		return windowSize.getValue();
	}

	public int getID() {
		return viewID;
	}

	public boolean isMovable() {
		return movable.getValue();
	}

	public boolean isFollowing() {
		return followEntityInput.getValue() != null;
	}

	public boolean isScripted() {
		return positionScriptInput.hasKeys() || centerScriptInput.hasKeys();
	}

	public void setLock2D(boolean bLock2D) {
		synchronized (setLock) {

			// Set the Lock2D keyword
			KeywordIndex kw = InputAgent.formatBoolean(lock2D.getKeyword(), bLock2D);

			// Set the camera position
			Vec3d viewCenter = new Vec3d(getEffViewCenter());
			Vec3d camPos = new Vec3d(getViewPosition());
			Vec3d vec = new Vec3d();
			vec.sub3(viewCenter, camPos);
			double dist = vec.mag3();
			Vec3d pos = new Vec3d(viewCenter);
			if (bLock2D) {
				pos.z += dist;
			}
			else {
				dist = dist/Math.sqrt(3);
				pos.x += dist;
				pos.y -= dist;
				pos.z += dist;
			}
			JaamSimModel simModel = getJaamSimModel();
			KeywordIndex posKw = simModel.formatVec3dInput(position.getKeyword(), pos, DistanceUnit.class);
			KeywordIndex ctrKw = simModel.formatVec3dInput(center.getKeyword(), viewCenter, DistanceUnit.class);

			InputAgent.storeAndExecute(new KeywordCommand(this, kw, posKw, ctrKw));
		}
	}

	public boolean is2DLocked() {
		return lock2D.getValue();
	}

	public URI getSkyboxTexture() {
		URI file = skyboxImage.getValue();
		if (file == null || file.toString().equals("")) {
			return null;
		}
		return file;
	}

	public void update(double simTime) {
		cachedSimTime = simTime;
	}

	public CameraInfo getCameraInfo() {
		Vec3d cameraPos = getGlobalPosition();
		Vec3d cameraCenter = getGlobalCenter();
		PolarInfo pi = new PolarInfo(cameraCenter, cameraPos);

		Transform trans = new Transform(cameraPos, pi.getRotation(), 1);
		return new CameraInfo(Math.PI/3, trans, getSkyboxTexture());
	}

	@Output(name = "PointOfInterest",
	 description = "The point at which the view will zoom towards or rotate around.",
	    unitType = DistanceUnit.class,
	    sequence = 1)
	public Vec3d getPointOfInterest(double simTime) {
		GUIListener gui = getJaamSimModel().getGUIListener();
		if (gui == null)
			return new Vec3d();
		return gui.getPOI(this);
	}

	@Output(name = "DistanceToPOI",
	 description = "The distance from the camera position to the point of interest.",
	    unitType = DistanceUnit.class,
	    sequence = 2)
	public double geDistanceToPOI(double simTime) {
		GUIListener gui = getJaamSimModel().getGUIListener();
		if (gui == null)
			return Double.NaN;

		Vec3d poi = gui.getPOI(this);
		if (poi == null)
			return Double.NaN;

		Vec3d vec = new Vec3d(getViewPosition());
		vec.sub3(poi);
		return vec.mag3();
	}

}


text:
package com.github.fhtw.swp.tutorium;

/**
 * A Factory allows the user to define arbitrary construction-logic when construct a certain object.
 * This is usually necessary if the target-class does not provide a zero-argument constructor.
 *
 * Implementations of this interface MUST provide a zero-argument constructor.
 * Example:
 *
 * <pre>
 *
 *    {@literal @}Subject(factory = ComplexSubjectFactory.class)
 *     public class ComplexSubject {
 *
 *         public ComplexSubject(Object dependency) {
 *              // ComplexSubject relies on this parameter
 *         }
 *     }
 *
 *     public class ComplexSubjectFactory implements Factory {
 *
 *         public Object getInstance() {
 *              return new ComplexSubject(new Object());
 *         }
 *     }
 *
 * </pre>
 *
 * Note that without the factory, no instances of ComplexSubject could be created because the values of the parameters cannot be reliably guessed at runtime.
 * Also note that this concrete mechanism is only necessary for testing the given classes and should not be used for solving production issues.
 */
public interface Factory {

    Object getInstance();

}


text:
#pragma once
#include <aws/imagebuilder/Imagebuilder_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/imagebuilder/model/ImageSummary.h>
#include <utility>

namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;

namespace Utils
{
namespace Json
{
  class JsonValue;
} // namespace Json
} // namespace Utils
namespace imagebuilder
{
namespace Model
{
  class AWS_IMAGEBUILDER_API ListImagePipelineImagesResult
  {
  public:
    ListImagePipelineImagesResult();
    ListImagePipelineImagesResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
    ListImagePipelineImagesResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);

    /**
     *
The request ID that uniquely identifies this request.

     */
    inline const Aws::String& GetRequestId() const{ return m_requestId; }

    /**
     *
The request ID that uniquely identifies this request.

     */
    inline void SetRequestId(const Aws::String& value) { m_requestId = value; }

    /**
     *
The request ID that uniquely identifies this request.

     */
    inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); }

    /**
     *
The request ID that uniquely identifies this request.

     */
    inline void SetRequestId(const char* value) { m_requestId.assign(value); }

    /**
     *
The request ID that uniquely identifies this request.

     */
    inline ListImagePipelineImagesResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;}

    /**
     *
The request ID that uniquely identifies this request.

     */
    inline ListImagePipelineImagesResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;}

    /**
     *
The request ID that uniquely identifies this request.

     */
    inline ListImagePipelineImagesResult& WithRequestId(const char* value) { SetRequestId(value); return *this;}

    /**
     *
The list of images built by this pipeline.

     */
    inline const Aws::Vector<ImageSummary>& GetImageSummaryList() const{ return m_imageSummaryList; }

    /**
     *
The list of images built by this pipeline.

     */
    inline void SetImageSummaryList(const Aws::Vector<ImageSummary>& value) { m_imageSummaryList = value; }

    /**
     *
The list of images built by this pipeline.

     */
    inline void SetImageSummaryList(Aws::Vector<ImageSummary>&& value) { m_imageSummaryList = std::move(value); }

    /**
     *
The list of images built by this pipeline.

     */
    inline ListImagePipelineImagesResult& WithImageSummaryList(const Aws::Vector<ImageSummary>& value) { SetImageSummaryList(value); return *this;}

    /**
     *
The list of images built by this pipeline.

     */
    inline ListImagePipelineImagesResult& WithImageSummaryList(Aws::Vector<ImageSummary>&& value) { SetImageSummaryList(std::move(value)); return *this;}

    /**
     *
The list of images built by this pipeline.

     */
    inline ListImagePipelineImagesResult& AddImageSummaryList(const ImageSummary& value) { m_imageSummaryList.push_back(value); return *this; }

    /**
     *
The list of images built by this pipeline.

     */
    inline ListImagePipelineImagesResult& AddImageSummaryList(ImageSummary&& value) { m_imageSummaryList.push_back(std::move(value)); return *this; }

    /**
     *
The next token used for paginated responses. When this is not empty, there
     * are additional elements that the service has not included in this request. Use
     * this token with the next request to retrieve additional objects.

     */
    inline const Aws::String& GetNextToken() const{ return m_nextToken; }

    /**
     *
The next token used for paginated responses. When this is not empty, there
     * are additional elements that the service has not included in this request. Use
     * this token with the next request to retrieve additional objects.

     */
    inline void SetNextToken(const Aws::String& value) { m_nextToken = value; }

    /**
     *
The next token used for paginated responses. When this is not empty, there
     * are additional elements that the service has not included in this request. Use
     * this token with the next request to retrieve additional objects.

     */
    inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); }

    /**
     *
The next token used for paginated responses. When this is not empty, there
     * are additional elements that the service has not included in this request. Use
     * this token with the next request to retrieve additional objects.

     */
    inline void SetNextToken(const char* value) { m_nextToken.assign(value); }

    /**
     *
The next token used for paginated responses. When this is not empty, there
     * are additional elements that the service has not included in this request. Use
     * this token with the next request to retrieve additional objects.

     */
    inline ListImagePipelineImagesResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;}

    /**
     *
The next token used for paginated responses. When this is not empty, there
     * are additional elements that the service has not included in this request. Use
     * this token with the next request to retrieve additional objects.

     */
    inline ListImagePipelineImagesResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;}

    /**
     *
The next token used for paginated responses. When this is not empty, there
     * are additional elements that the service has not included in this request. Use
     * this token with the next request to retrieve additional objects.

     */
    inline ListImagePipelineImagesResult& WithNextToken(const char* value) { SetNextToken(value); return *this;}

  private:

    Aws::String m_requestId;

    Aws::Vector<ImageSummary> m_imageSummaryList;

    Aws::String m_nextToken;
  };

} // namespace Model
} // namespace imagebuilder
} // namespace Aws


text:
using System;
using System.Globalization;
using NimatorCouchBase.NimatorBooster.L.Parser.Storage;

namespace NimatorCouchBase.NimatorBooster.L.Parser
{
    public static class ExpressionUtils
    {
        public static dynamic GetValueFromExpression(IExpression pExpression)
        {
            dynamic expressionValue = pExpression.Value;
            try
            {
                if (pExpression is LongExpression)
                {
                    expressionValue = Convert.ToInt64(pExpression.Value);
                }
                else if (pExpression is DoubleExpression)
                {
                    expressionValue = Convert.ToDouble(pExpression.Value, CultureInfo.InvariantCulture);
                }
                else if (pExpression is BaseArithmeticOperatorExpression)
                {
                    object value = pExpression.Value;
                    expressionValue = ExpressionValueIsDouble(value)
                        ? Convert.ToDouble(value, CultureInfo.InvariantCulture)
                        : Convert.ToInt64(value, CultureInfo.InvariantCulture);
                }
                else if (pExpression is VariableExpression)
                {
                    var variable = (MemorySlot)expressionValue;
                    if (variable.IsEmpty())
                    {
                        throw new AccessingEmptyMemoryException($"Memory Slot {variable.Key} is empty");
                    }
                    expressionValue = Convert.ChangeType(variable.Value, variable.ValueType);
                }
                else
                {
                    throw new UnableToValidateExpressionException("");
                }
            }
            catch (Exception e)
            {
                throw new UnableToValidateExpressionException($"Incorrent L Validation Sintax. Unable To Validate Value {pExpression.Value}: {e.Message}");
            }
            return expressionValue;
        }

        private static bool ExpressionValueIsDouble(object pValue)
        {
            double isDouble;
            return double.TryParse(Convert.ToString(pValue, CultureInfo.InvariantCulture), out isDouble);
        }
    }
}


text:
package org.openkilda.wfm.topology.network.utils;

import org.openkilda.model.SwitchId;

public class SwitchOnlineStatusMonitor
        extends BaseMonitor<SwitchId, SwitchOnlineStatusListener, Boolean, SwitchOnlineStatusMonitorEntry> {
    public void cleanup(SwitchId reference) {
        monitors.remove(reference);
    }

    @Override
    protected SwitchOnlineStatusMonitorEntry makeEntry(SwitchId reference) {
        return new SwitchOnlineStatusMonitorEntry();
    }
}


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * AdminPasswords.java
 *
 * Created on May 20, 2010, 9:20:54 PM
 */

package integartedfarmsystem;

import java.sql.*;
import javax.swing.JOptionPane;

/**
 *
 * @author Magondu
 */
public class AdminPasswords extends javax.swing.JFrame {
char oldpassword[] = new char [20] ;
char newpassword[] = new char [20];
char repeatpassword[] = new char [20];
    /** Creates new form AdminPasswords */
    public AdminPasswords() {
        initComponents();
        setLocationRelativeTo(null);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        OldPassword = new javax.swing.JPasswordField();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        NewPassword = new javax.swing.JPasswordField();
        jLabel3 = new javax.swing.JLabel();
        RepeatPassword = new javax.swing.JPasswordField();
        jLabel4 = new javax.swing.JLabel();
        OkButton = new javax.swing.JButton();
        Cancel = new javax.swing.JButton();
        Backbutton = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);

        jLabel1.setText("Old password:");

        jLabel2.setText("New password:");

        jLabel3.setText("Repeat new password:");

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel4.setForeground(new java.awt.Color(0, 255, 0));
        jLabel4.setText("CHANGE ADMIN PASSWORD");

        OkButton.setText("OK");
        OkButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                OkButtonActionPerformed(evt);
            }
        });

        Cancel.setText("Cancel");
        Cancel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CancelActionPerformed(evt);
            }
        });

        Backbutton.setText("Back");
        Backbutton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BackbuttonActionPerformed(evt);
            }
        });

        jLabel5.setFont(new java.awt.Font("Trebuchet MS", 1, 18));
        jLabel5.setForeground(new java.awt.Color(51, 255, 51));
        jLabel5.setText("MARINA LIVESTOCK FARM");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(62, 62, 62)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel5)
                    .addComponent(jLabel4))
                .addContainerGap(14, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(OkButton))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(jLabel3)
                            .addComponent(jLabel1))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(RepeatPassword)
                            .addComponent(OldPassword, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(Cancel)
                                .addGap(18, 18, 18)
                                .addComponent(Backbutton))
                            .addComponent(NewPassword))))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(1, 1, 1)
                .addComponent(jLabel4)
                .addGap(22, 22, 22)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(OldPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(NewPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(RepeatPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(OkButton)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(Cancel)
                    .addComponent(Backbutton))
                .addContainerGap(13, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void BackbuttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BackbuttonActionPerformed

       AdminTask win = new AdminTask();
        win.setVisible(true);
        this.dispose();
}//GEN-LAST:event_BackbuttonActionPerformed

    private void OkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OkButtonActionPerformed
      try{

      oldpassword = OldPassword.getPassword();
      newpassword = NewPassword.getPassword();
      repeatpassword = RepeatPassword.getPassword();
      String Oldpasswordstring = String.copyValueOf(oldpassword);
      String newpasswordstring = String.copyValueOf(newpassword);
      String repeatpasswordstring = String.copyValueOf(repeatpassword);

         Class.forName("com.mysql.jdbc.Driver");
   Connection conect = DriverManager.getConnection("jdbc:mysql://localhost:3306/integratedfarmsystemnnew", "root", "");
             Statement stmt = conect.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                                     ResultSet.CONCUR_READ_ONLY);
ResultSet srs = stmt.executeQuery(
    "SELECT password FROM loginadmin");
while (srs.next()) {
      String Dbasepassword = srs.getString("password");

      if (Dbasepassword.compareTo(Oldpasswordstring)==0)
      {
          if (newpasswordstring.compareTo(repeatpasswordstring)==0)
      {
         PreparedStatement pstmt0 = conect.prepareStatement("DELETE FROM `integratedfarmsystemnnew`.`loginadmin` WHERE password =\"" +Dbasepassword+"\"");
         pstmt0.executeUpdate();
          PreparedStatement pstmt = conect.prepareStatement("INSERT INTO loginadmin(password) value(?)") ;
          pstmt.setString(1, newpasswordstring);
          pstmt.executeUpdate();
          JOptionPane.showMessageDialog(null, "The password has been changed");      }
          else if(newpasswordstring.compareTo(repeatpasswordstring)!=0)
          { JOptionPane.showMessageDialog(null, "your new passwords do not match");}

      }
      else if(Dbasepassword.compareTo(Oldpasswordstring)!=0)
      {JOptionPane.showMessageDialog(null, "The password you have entered does not match with the one in the database");}
}}
catch(SQLException e)
			{
				System.out.println("2 Error : "+e);
			}
			catch(Exception ex)
			{
				System.out.println("Error 1:"+ex);
			}

    }//GEN-LAST:event_OkButtonActionPerformed

    private void CancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelActionPerformed
        int yesNo =JOptionPane.YES_NO_OPTION;
        int option = JOptionPane.showConfirmDialog(this, "Are you sure you want to exit?", "CONFIRMATION", yesNo);

if (option == JOptionPane.YES_OPTION)
{
    this.dispose();
}
else
{
JOptionPane.showMessageDialog(null, "YOU HAVE ABORTED THE CANCEL OPERATION");
}
    }//GEN-LAST:event_CancelActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new AdminPasswords().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton Backbutton;
    private javax.swing.JButton Cancel;
    private javax.swing.JPasswordField NewPassword;
    private javax.swing.JButton OkButton;
    private javax.swing.JPasswordField OldPassword;
    private javax.swing.JPasswordField RepeatPassword;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    // End of variables declaration//GEN-END:variables

}


text:
<!doctype html>

      <meta charset="UTF-8">
      <link rel="shortcut icon" href="favicon.ico">
      <title>Gauges</title>
      <link rel="stylesheet" href="jqueryui/css/ui-lightness/jquery-ui-1.8.23.custom.css">
      <link rel="stylesheet" href="css/gauges.css">

               Gauges

            Gauge state synched across all browser tabs subscribed to the same channel.

            Built with JustGage.

            Open 2nd instance
            Source Code

               Crossbar.io Homepage

               Controller Channel: <input type="text" id="controller-channel" size="6" maxlength="6" value="{{channel}}">
               <button id="controller-channel-switch" class="button">Switch</button>
               <button id="controller-channel-cancel" class="button">Cancel</button>

            Status:

            There is also a version of this demo using PyQt5


text:
set -eux

cat /etc/apt/sources.list

cp /etc/apt/sources.list /etc/apt/sources.list.bak

sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list

cat /etc/apt/sources.list


text:
//
//  SettingsViewController.m
//  moments
//
//  Created by MobileMan GmbH on 13/04/15.
//  Copyright (c) 2015 MobileMan GmbH. All rights reserved.
//

#import "SettingsViewController.h"
#import "SettingsTableViewCell.h"
#import "FriendsViewController.h"
#import "MyMomentsViewController.h"
#import "ShareViewController.h"
#import "StreamSettingsViewController.h"
#import "ServiceFactory.h"
#import "fe_defines.h"

@implementation SettingsViewController

- (id) init {
    self = [super init];
    if(self){

    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    self.title = @"Settings";

    self.settingsButton.backgroundColor = [UIColor clearColor];
    UIImage *settingsButtonImage = [UIImage imageNamed:@"Logo_48.png"];
    [self.settingsButton setBackgroundImage:settingsButtonImage forState:UIControlStateNormal];
    [self.settingsButton setBackgroundImage:settingsButtonImage forState:UIControlStateHighlighted];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void) viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    self.settingsButton.hidden = NO;
}

- (IBAction)back:(id)sender
{
    [self dismissViewControllerAnimated:YES completion:^{
        [self.delegate didCloseSettings];
    }];
}

- (void)logout
{
    [[ServiceFactory userService] signout:^{
        [self dismissViewControllerAnimated:YES completion:^{
            [self.delegate didLogout];
        }];
    } failure:^(NSError *error) {
        NSLog(@"LOGOUT ERROR");
        [self dismissViewControllerAnimated:YES completion:^{
            [self.delegate didLogout];
        }];
    }];
}

- (void)share
{
    FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
    content.contentTitle = @"Moments";
    content.contentDescription = @"Stream moments with friends and families around the world!";
    content.contentURL = [NSURL URLWithString:MOMENTS_APP_LINK];
    content.imageURL = [NSURL URLWithString:MOMENTS_INVITE_IMAGE_LINK];
    [FBSDKShareDialog showFromViewController:self
                                 withContent:content
                                    delegate:self];

}

- (StreamSettingsViewController *) getStreamSettingsViewController
{
    StreamSettingsViewController *result = nil;

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
    result = [storyboard instantiateViewControllerWithIdentifier:@"streamSettingsViewController"];

    return result;
}

- (FriendsViewController *) getFriendsViewController
{
    FriendsViewController *result = nil;

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
    result = [storyboard instantiateViewControllerWithIdentifier:@"friendsViewController"];

    return result;
}

- (MyMomentsViewController *) getMyMomentsViewController
{
    MyMomentsViewController *result = nil;

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
    result = [storyboard instantiateViewControllerWithIdentifier:@"myMomentsViewController"];

    return result;
}

- (ShareViewController *) getShareViewController
{
    ShareViewController *result = nil;

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
    result = [storyboard instantiateViewControllerWithIdentifier:@"shareViewController"];

    return result;
}

#pragma mark FBSDKSharingDelegate

- (void)sharer:(id<FBSDKSharing>)sharer didCompleteWithResults:(NSDictionary *)results
{
    NSLog(@"");
}

- (void)sharer:(id<FBSDKSharing>)sharer didFailWithError:(NSError *)error
{
    NSLog(@"");
}

- (void)sharerDidCancel:(id<FBSDKSharing>)sharer
{
    NSLog(@"");
}

#pragma mark UITableViewDelegate

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 72.0;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 4;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSInteger row = indexPath.row;
    //int section = indexPath.section;

    static NSString *cellIdentifier = @"SettingsTableViewCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];

    SettingsTableViewCell *settingsTableViewCell = (SettingsTableViewCell *)cell;
    if (settingsTableViewCell == nil) {
        settingsTableViewCell = [[SettingsTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];

    }

    switch (row) {
        case 0:
            settingsTableViewCell.nameLabel.text = @"My friends";
            break;
        case 1:
            settingsTableViewCell.nameLabel.text = @"My Moments";
            break;
        case 2:
            settingsTableViewCell.nameLabel.text = @"Share";
            break;
        case 3:
            settingsTableViewCell.nameLabel.text = @"Logout";
            break;
        case 4:
            settingsTableViewCell.nameLabel.text = @"Video settings";
            break;
    }

    if (row == 0) {
        settingsTableViewCell.isFirstCell = YES;
    }

    cell = settingsTableViewCell;
    //cell.selectionStyle = UITableViewCellSelectionStyleNone;

    [cell setNeedsDisplay];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    [self.tableView deselectRowAtIndexPath:indexPath animated:NO];

    NSInteger row = indexPath.row;
    //int section = indexPath.section;

    UIViewController *controllerToPush = nil;

    switch (row) {
        case 0:
            controllerToPush = [self getFriendsViewController];
            break;
        case 1:
            controllerToPush = [self getMyMomentsViewController];
            break;
        case 2:
            //controllerToPush = [self getShareViewController];
            [self share];
            break;
        case 3:
            [self logout];
            break;
        case 4:
            controllerToPush = [self getStreamSettingsViewController];
            break;
        default:
            break;
    }

    if (controllerToPush != nil) {
        [self.navigationController pushViewController:controllerToPush animated:YES];
    }
}

@end


text:
#include <entity-system/GenericSystem.hpp>
#include <entity-system/ESCore.hpp>
#include <gtest/gtest.h>
#include <memory>
#include <glm/glm.hpp>

namespace es = CPM_ES_NS;

namespace {

// We may want to enforce that these components have bson serialization members
// (possibly a static assert?).

struct CompStaticLightDir
{
  CompStaticLightDir() {}
  CompStaticLightDir(const glm::vec3& dir) {lightDir = dir;}

  void checkEqual(const CompStaticLightDir& dir) const
  {
    EXPECT_FLOAT_EQ(lightDir.x, dir.lightDir.x);
    EXPECT_FLOAT_EQ(lightDir.y, dir.lightDir.y);
    EXPECT_FLOAT_EQ(lightDir.z, dir.lightDir.z);
  }

  glm::vec3 lightDir;
};

std::vector<CompStaticLightDir> lightDirs = {
  glm::vec3(0.0, 1.0, 0.0),
  glm::vec3(0.7333, 0.7333, 0.0),
};

struct CompStaticCamera
{
  CompStaticCamera() : dummy(0)         {}
  CompStaticCamera(int in) : dummy(in)  {}

  void checkEqual(const CompStaticCamera& in) const
  {
    EXPECT_EQ(in.dummy, dummy);
  }

  int dummy;
};

std::vector<CompStaticCamera> cameras = {
  12, 45, 982, 823, 53
};

// This basic system will apply, every frame, to entities with the CompPosition,
// CompHomPos, and CompGameplay components.
class BasicSystem : public es::GenericSystem<true, CompStaticLightDir, CompStaticCamera>
{
public:

  static int numCall;

  void groupExecute(es::ESCoreBase&, uint64_t /* entityID */,
                    const es::ComponentGroup<CompStaticLightDir>& lightDir,
                    const es::ComponentGroup<CompStaticCamera>& cam) override
  {
    ++numCall;

    for (size_t i = 0; i < lightDir.numComponents; ++i)
    {
      lightDir.components[i].component.checkEqual(lightDirs[i]);
    }

    for (size_t i = 0; i < cam.numComponents; ++i)
    {
      cam.components[i].component.checkEqual(cameras[i]);
    }
  }
};

int BasicSystem::numCall = 0;

TEST(EntitySystem, StaticOnlyGroupTest)
{
  // Generate entity system core.
  std::shared_ptr<es::ESCore> core(new es::ESCore());

  // Add static light directions
  std::vector<size_t> lightDirIndices;
  for (auto it = lightDirs.begin(); it != lightDirs.end(); ++it)
  {
    lightDirIndices.push_back(core->addStaticComponent(*it));
  }
  int count = 0;
  for (size_t index : lightDirIndices)
  {
    EXPECT_EQ(index, count);
    ++count;
  }

  // Add static 'cameras'
  std::vector<size_t> cameraIndices;
  for (auto it = cameras.begin(); it != cameras.end(); ++it)
  {
    cameraIndices.push_back(core->addStaticComponent(*it));
  }
  count = 0;
  for (size_t index : cameraIndices)
  {
    EXPECT_EQ(index, count);
    ++count;
  }

  std::shared_ptr<BasicSystem> sys(new BasicSystem());

  core->renormalize();
  sys->walkComponents(*core);

  EXPECT_EQ(1, BasicSystem::numCall);
}

}


text:
package org.pmw.benchmark.benchmarks;

import org.pmw.benchmark.frameworks.Framework;

public interface Benchmark {

	Framework getFramework();

	boolean isValidLogEntry(String line);

	long countTriggeredLogEntries();

	long countWrittenLogEntries();

	void run() throws Exception;

}


text:
<?php namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Services\RottenTomatoes;

use DB;

class ReviewController extends Controller {

  public function create(Request $request, $id)
  {
    $dvd_query = DB::table('dvds')
      ->select([
        DB::raw('title as title'),
        DB::raw('format_name as format'),
        DB::raw('genre_name as genre'),
        DB::raw('label_name as label'),
        DB::raw('rating_name as rating'),
        DB::raw('sound_name as sound'),
        DB::raw('DATE_FORMAT(release_date, "%d %M %Y") as date')
      ])
      ->join('formats', 'dvds.format_id', '=', 'formats.id')
      ->join('genres', 'dvds.genre_id', '=', 'genres.id')
      ->join('labels', 'dvds.label_id', '=', 'labels.id')
      ->join('ratings', 'dvds.rating_id', '=', 'ratings.id')
      ->join('sounds', 'dvds.sound_id', '=', 'sounds.id')
      ->where('dvds.id', '=', $id);
    $dvd_array = $dvd_query->get();
    if (sizeof($dvd_array) > 0) {
      $dvd = $dvd_array[0];
    } else {
      return redirect('/dvds/');
    }

    $rt_data = RottenTomatoes::search($dvd->title);

    $reviews_query = DB::table('reviews')
      ->select('title', 'description', 'rating')
      ->where('dvd_id', '=', $id);
    $reviews = $reviews_query->get();
    return view('reviews', [
        'dvd' => $dvd,
        'dvd_id' => $id,
        'reviews' => $reviews,
        'rt_data' => $rt_data
    ]);
  }

  public function store(Request $request)
  {
    $id = $request->input('dvd_id');
    $validation = \Validator::make($request->all(), [
      'dvd_id' => 'required|integer',
      'title' => 'required|min:5',
      'rating' => 'required|integer|min:1|max:10',
      'description' => 'required|min:20'
      ]);
    if ($validation->passes()) {
      DB::table('reviews')->insert([
        'dvd_id' => $request->input('dvd_id'),
        'title' => $request->input('title'),
        'rating' => $request->input('rating'),
        'description' => $request->input('description')
        ]);
      return redirect('/dvds/' . $id)->with('success', 'Review successfully saved!');
    } else {
      return redirect('/dvds/' . $id)
      ->withInput()
      ->withErrors($validation);
    }
  }

}


text:
#include "error_check.h"

#include "locale_utils.h"
#include "../error.h"
#include "../memblock.h"
#include "../stream.h"

bool gmio_check_memblock(int *error, const struct gmio_memblock* mblock)
{
    if (mblock == NULL || mblock->ptr == NULL)
        *error = GMIO_ERROR_NULL_MEMBLOCK;
    else if (mblock->size == 0)
        *error = GMIO_ERROR_INVALID_MEMBLOCK_SIZE;
    return gmio_no_error(*error);
}

bool gmio_check_memblock_size(
        int *error, const struct gmio_memblock *mblock, size_t minsize)
{
    if (gmio_check_memblock(error, mblock) && mblock->size < minsize)
        *error = GMIO_ERROR_INVALID_MEMBLOCK_SIZE;
    return gmio_no_error(*error);
}

bool gmio_check_lc_numeric(int *error)
{
    if (!gmio_lc_numeric_is_C())
        *error = GMIO_ERROR_BAD_LC_NUMERIC;
    return gmio_no_error(*error);
}

bool gmio_check_istream(int *error, const struct gmio_stream *stream)
{
    if (stream == NULL)
        *error = GMIO_ERROR_NULL_STREAM;
    else if (stream->func_at_end == NULL)
        *error = GMIO_ERROR_STREAM_FUNC_REQUIRED;
    else if (stream->func_error == NULL)
        *error = GMIO_ERROR_STREAM_FUNC_REQUIRED;
    else if (stream->func_read == NULL)
        *error = GMIO_ERROR_STREAM_FUNC_REQUIRED;
    else if (stream->func_size == NULL)
        *error = GMIO_ERROR_STREAM_FUNC_REQUIRED;
    else if (stream->func_get_pos == NULL)
        *error = GMIO_ERROR_STREAM_FUNC_REQUIRED;
    else if (stream->func_set_pos == NULL)
        *error = GMIO_ERROR_STREAM_FUNC_REQUIRED;
    return gmio_no_error(*error);
}

bool gmio_check_ostream(int *error, const struct gmio_stream *stream)
{
    if (stream == NULL)
        *error = GMIO_ERROR_NULL_STREAM;
    else if (stream->func_error == NULL)
        *error = GMIO_ERROR_STREAM_FUNC_REQUIRED;
    else if (stream->func_write == NULL)
        *error = GMIO_ERROR_STREAM_FUNC_REQUIRED;
    else if (stream->func_get_pos == NULL)
        *error = GMIO_ERROR_STREAM_FUNC_REQUIRED;
    else if (stream->func_set_pos == NULL)
        *error = GMIO_ERROR_STREAM_FUNC_REQUIRED;
    return gmio_no_error(*error);
}

bool gmio_check_stream(int *error, const struct gmio_stream *stream)
{
    return gmio_check_istream(error, stream)
           && gmio_check_ostream(error, stream);
}


text:
{% extends "mdotdevs/base.html" %}

{% block title %}Building Apps Home{% endblock %}

{% block content %}

Submit your App for Review

Ready to submit your app for inclusion in the UW Development App Stores? Does it meet our publishing guidelines?

If so, please fill out the form below. We will review your app and let you know the next steps.

        <form method="post">

            {% csrf_token %}
            {{ form.non_field_errors }}

                    {{ form.campus_audience.label }}
                    {% if form.campus_audience.errors %}
                        {% for error in form.campus_audience.errors %}
                         * {{ error|escape }}
                        {% endfor %}
                    {% else %}
                    * Required
                    {% endif %}
                    {{ form.campus_audience }}

                    {{ form.campus_need.label }}
                    {% if form.campus_need.errors %}
                        {% for error in form.campus_need.errors %}
                        * {{ error|escape }}
                        {% endfor %}
                    {% else %}
                    * Required
                    {% endif %}
                    {{ form.campus_need }}

                <fieldset>
                <legend> Official UW Sponsor:</legend>
                {{ form.sponsor_name.label }}
                    {% if form.sponsor_name.errors %}
                        {% for error in form.sponsor_name.errors %}
                        * {{ error|escape }}
                        {% endfor %}
                    {% else %}
                    * Required
                    {% endif %}
                {{ form.sponsor_name }}
                {{ form.sponsor_netid.label }}
                    {% if form.sponsor_netid.errors %}
                        {% for error in form.sponsor_netid.errors %}
                        * {{ error|escape }}
                        {% endfor %}
                    {% else %}
                    * Required
                    {% endif %}
                {{ form.sponsor_netid }}
                {{ form.sponsor_email.label }}
                    {% if form.sponsor_email.errors %}
                        {% for error in form.sponsor_email.errors %}
                        * {{ error|escape }}
                        {% endfor %}
                    {% else %}
                    * Required
                    {% endif %}
                {{ form.sponsor_email }}
                </fieldset>
                <fieldset>
                <legend> Who will maintain the app codebase?</legend>
                {{ form.dev_name.label }}
                    {% if form.dev_name.errors %}
                        {% for error in form.dev_name.errors %}
                        * {{ error|escape }}
                        {% endfor %}
                    {% else %}
                    * Required
                    {% endif %}
                {{ form.dev_name }}
                {{ form.dev_email.label }}
                    {% if form.dev_email.errors %}
                        {% for error in form.dev_email.errors %}
                        * {{ error|escape }}
                        {% endfor %}
                    {% else %}
                    * Required
                    {% endif %}
                {{ form.dev_email }}
                </fieldset>
                <fieldset>
                <legend>Who do clients contact for app support?</legend>
                {{ form.support_name.label }}
                    {% if form.support_name.errors %}
                        {% for error in form.support_name.errors %}
                        * {{ error|escape }}
                        {% endfor %}
                    {% else %}
                    * Required
                    {% endif %}
                {{ form.support_name }}
                {{ form.support_email.label }}
                    {% if form.support_email.errors %}
                        {% for error in form.support_email.errors %}
                        * {{ error|escape }}
                        {% endfor %}
                    {% else %}
                    * Required
                    {% endif %}
                {{ form.support_email }}
                {{ form.support_contact.label }}
                    {% if form.support_contact.errors %}
                        {% for error in form.support_contact.errors %}
                        {{ error|escape }}
                        {% endfor %}
                    {% endif %}
                {{ form.support_contact }}
                </fieldset>
                <fieldset class="checkbox-list">
                <legend>What reviews have you conducted?</legend>

{{ form.ats_review }}
                {{ form.ats_review.label_tag }}

{{ form.ux_review }}
                {{ form.ux_review.label_tag }}

{{ form.brand_review }}
                {{ form.brand_review.label_tag }}

                </fieldset>

                    {{ form.app_documentation.label }}
                    {% if form.app_documentation.errors %}
                        {% for error in form.app_documentation.errors %}
                        {{ error|escape }}
                        {% endfor %}
                    {% endif %}
                    {{ form.app_documentation }}

                    {{ form.app_code.label }}
                    {% if form.app_code.errors %}
                        {% for error in form.app_code.errors %}
                        * {{ error|escape }}
                        {% endfor %}
                    {% else %}
                    * Required
                    {% endif %}
                    {{ form.app_code }}

                    {{ form.anything_else.label_tag }}
                    {{ form.anything_else }}

Cancel
            <input type="submit" class="btn btn-primary" name="submit" value="Submit for Review">

        </form>

{% endblock %}


text:
package com.strobel.decompiler.languages.java.ast;

import com.strobel.decompiler.patterns.INode;
import com.strobel.decompiler.patterns.Match;

public class LabelStatement extends Statement {
    public LabelStatement(final int offset, final String name) {
        super(offset);
        setLabel(name);
    }

    public final String getLabel() {
        return getChildByRole(Roles.LABEL).getName();
    }

    public final void setLabel(final String value) {
        setChildByRole(Roles.LABEL, Identifier.create(value));
    }

    public final Identifier getLabelToken() {
        return getChildByRole(Roles.LABEL);
    }

    public final void setLabelToken(final Identifier value) {
        setChildByRole(Roles.LABEL, value);
    }

    public final JavaTokenNode getColonToken() {
        return getChildByRole(Roles.COLON);
    }

    @Override
    public <T, R> R acceptVisitor(final IAstVisitor<? super T, ? extends R> visitor, final T data) {
        return visitor.visitLabelStatement(this, data);
    }

    @Override
    public boolean matches(final INode other, final Match match) {
        return other instanceof LabelStatement &&
               matchString(getLabel(), ((LabelStatement) other).getLabel());
    }
}


text:
<?php

namespace App\Controllers;

use App\Models\User;

class HomeController extends Controller
{

	public function index($request,$response)
	{
		return $this->view->render($response,'home.twig');
	}
	public function shop($request,$response){
		return $this->view->render($response,'shop.twig');
	}
	public function support($request,$response){
		return $this->view->render($response,'support.twig');
	}
	public function qrcode($request,$resposne){

	}

}


text:
/****************************************************************************
 * Included Files
 ****************************************************************************/

#include <tinyara/config.h>
#include <stdio.h>
#include <signal.h>
#include <mqueue.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <apps/builtin.h>
#include <tinyara/sched.h>
#include <tinyara/fs/ioctl.h>
#include <tinyara/taskmgt.h>
#include <task_manager/task_manager.h>
#include "task_manager_internal.h"

/****************************************************************************
 * Private Structs
 ****************************************************************************/
struct task_list_s {
	int pid;
	void *addr;
};
typedef struct task_list_s task_list_t;

struct task_list_data_s {
	int builtin_idx;
	int pid;
	int tm_gid;
	int status;
	int permission;
};
typedef struct task_list_data_s task_list_data_t;

/****************************************************************************
 * Private Definitions
 ****************************************************************************/
#define TASK_LIST_ADDR(i)   ((task_list_data_t *)tm_task_list[i].addr)
#define TASK_PID(i)         tm_task_list[i].pid
#define TASK_BUILTIN_IDX(i) TASK_LIST_ADDR(i)->builtin_idx
#define TASK_TM_GID(i)      TASK_LIST_ADDR(i)->tm_gid
#define TASK_STATUS(i)      TASK_LIST_ADDR(i)->status
#define TASK_PERMISSION(i)  TASK_LIST_ADDR(i)->permission

static int builtin_cnt;
static mqd_t g_tm_recv_mqfd;
/* [0] : tm_gid, [1] : the address of task list data */
static task_list_t tm_task_list[CONFIG_TASK_MANAGER_MAX_TASKS];

/****************************************************************************
 * Private Functions
 ****************************************************************************/
static void tm_update_task_state(int handle)
{
	struct tcb_s *tcb;

	tcb = sched_gettcb(TASK_PID(handle));
	/* if terminated normally, tcb will be released, but task list is not updated yet. */
	if (tcb == NULL && TASK_LIST_ADDR(handle) != NULL) {
		TASK_STATUS(handle) = TM_TASK_STATE_STOP;
	}
}

static int tm_get_task_state(int handle)
{
	if (handle >= CONFIG_TASK_MANAGER_MAX_TASKS || TASK_LIST_ADDR(handle) == NULL) {
		return TM_TASK_STATE_UNREGISTERED;
	}

	return (TASK_STATUS(handle));
}

static int tm_check_permission(int handle, pid_t pid)
{
	int ret = TM_FAIL_NOT_PERMITTED;
	int chk_idx;
	int caller_gid = -1;

	switch (TASK_PERMISSION(handle)) {
	case TM_TASK_PERMISSION_DEDICATE:
		if (TASK_TM_GID(handle) == pid) {
			ret = OK;
		}
		break;
	case TM_TASK_PERMISSION_GROUP:
		/* If requester's pid is as same as handle's gid, then requester registered that handle. */
		if (pid == TASK_TM_GID(handle)) {
			ret = OK;
			break;
		}
		/* check pid's group id */
		for (chk_idx = 0; chk_idx < builtin_cnt; chk_idx++) {
			if (TASK_PID(chk_idx) == pid) {
				caller_gid = TASK_TM_GID(chk_idx);
				break;
			}
		}

		if (caller_gid == TASK_TM_GID(handle)) {
			ret = OK;
		}
		break;
	case TM_TASK_PERMISSION_ALL:
		ret = OK;
		break;
	default:
		tmdbg("Invalid permission\n");
		break;
	}
	return ret;
}

static int tm_handle_private_queue(char *q_name, tm_response_t *msg)
{
	int ret;
	mqd_t priv_q;
	struct mq_attr attr;
	attr.mq_maxmsg = CONFIG_TASK_MANAGER_MAX_MSG;
	attr.mq_msgsize = sizeof(tm_response_t);
	attr.mq_flags = 0;

	priv_q = mq_open(q_name, O_WRONLY | O_CREAT, 0666, &attr);
	if (priv_q == (mqd_t)-1) {
		tmdbg("mq_open failed!\n");
		return ERROR;
	}

	ret = mq_send(priv_q, (char *)msg, sizeof(tm_response_t), TM_MQ_PRIO);
	if (ret != OK) {
		tmdbg("mq_send failed!\n");
		mq_close(priv_q);
		return ERROR;
	}

	mq_close(priv_q);

	return OK;
}

/****************************************************************************
 * Public Functions
 ****************************************************************************/

int tm_get_task_info(task_info_list_t **data, int handle)
{
	int len;
	task_info_list_t *item;

	item = (task_info_list_t *)TM_ALLOC(sizeof(task_info_list_t));
	if (item == NULL) {
		tmdbg("Memory allocation Failed\n");
		return -1;
	}

	len = strlen(builtin_list[TASK_BUILTIN_IDX(handle)].name);
	item->task.name = (char *)TM_ALLOC(len + 1);
	if (item->task.name == NULL) {
		tmdbg("Memory allocation for name Failed\n");
		TM_FREE(item);
		return -1;
	}
	strncpy(item->task.name, builtin_list[TASK_BUILTIN_IDX(handle)].name, len + 1);
	item->task.gid = TASK_TM_GID(handle);
	item->task.handle = handle;
	item->task.status = TASK_STATUS(handle);
	item->task.permission = TASK_PERMISSION(handle);
	item->next = *data;

	*data = item;

	return OK;
}

static int tm_search_task_list(tm_request_t *msg, tm_response_t *response_msg)
{
	int chk_idx;
	int cnt = 0;
	int type = msg->cmd;

	if (type != TASKMGT_SCAN_NAME && type  != TASKMGT_SCAN_GROUP) {
		return TM_INVALID_PARAM;
	}

	for (chk_idx = 0; chk_idx < CONFIG_MAX_TASKS; chk_idx++) {
		if (TASK_LIST_ADDR(chk_idx) == NULL) {
			continue;
		}
		if ((type == TASKMGT_SCAN_NAME && strncmp(builtin_list[TASK_BUILTIN_IDX(chk_idx)].name, msg->data, strlen(msg->data)) == 0) \
			|| (type == TASKMGT_SCAN_GROUP && TASK_TM_GID(chk_idx) == msg->handle)) {
				tmvdbg("FIND!!!!!!! handle = %d\n", chk_idx);
				tm_get_task_info(&response_msg->data, chk_idx);
				cnt++;
		}
	}
	return cnt;
}

int task_manager(int argc, char *argv[])
{
	int nbytes;
	int ret;
	tm_request_t request_msg;
	tm_response_t response_msg;
	int fd;
	int chk_idx;
	int register_permission;
	struct mq_attr attr;
#ifdef CONFIG_SCHED_HAVE_PARENT
	sigignore(SIGCHLD);
#endif
	attr.mq_maxmsg = CONFIG_TASK_MANAGER_MAX_MSG;
	attr.mq_msgsize = sizeof(tm_request_t);
	attr.mq_flags = 0;

	builtin_cnt = get_builtin_list_cnt();
	if (builtin_cnt < 2) {
		tmdbg("Failed to start task manager\n");
		return 0;
	}
	/* service register : register, set tm_gid to its pid */

	fd = open(TASKMGT_DRVPATH, O_RDWR);
	if (fd < 0) {
		tmdbg("Failed to open task management driver %d\n", errno);
		return 0;
	}

	g_tm_recv_mqfd = mq_open(TM_PUBLIC_MQ, O_RDONLY | O_CREAT, 0666, &attr);
	while (1) {
		ret = ERROR;

		nbytes = mq_receive(g_tm_recv_mqfd, (char *)&request_msg, sizeof(tm_request_t), NULL);
		if (nbytes <= 0) {
			continue;
		}

		sched_lock();

		tmvdbg("Recevied Request msg : cmd = %d\n", request_msg.cmd);
		switch (request_msg.cmd) {
		case TASKMGT_REGISTER_TASK:
			register_permission = request_msg.handle;
			if (request_msg.data == NULL) {
				ret = TM_INVALID_PARAM;
				break;
			}
			/* Check that task is in builtin-list or not */
			for (chk_idx = 0; chk_idx < builtin_cnt; chk_idx++) {
				if (strncmp((char *)builtin_list[chk_idx].name, request_msg.data, CONFIG_TASK_NAME_SIZE) == 0) {
					/* Requested name is in builtin-list */
					ret = ioctl(fd, TMIOC_REGISTER_TASK, &request_msg);
					break;
				}
			}
			/* In this case, there is no info in builtin with its name */
			if (chk_idx >= builtin_cnt) {
				tmdbg("Cannot find the task\n");
				ret = TM_FAIL_NOT_REGISTERED;
				break;
			}

			if (ret == OK) {
				tm_task_list[request_msg.handle].addr = (void *)TM_ALLOC(sizeof(task_list_data_t));
				if (tm_task_list[request_msg.handle].addr != NULL) {
					TASK_BUILTIN_IDX(request_msg.handle) = chk_idx;
					TASK_TM_GID(request_msg.handle) = request_msg.caller_pid;
					TASK_STATUS(request_msg.handle) = TM_TASK_STATE_STOP;
					TASK_PERMISSION(request_msg.handle) = register_permission;
					ret = request_msg.handle;
				} else {
					ret = TM_OUT_OF_MEMORY;
				}
			}
			break;

		case TASKMGT_UNREGISTER_TASK:
			ret = tm_get_task_state(request_msg.handle);
			if (ret == TM_TASK_STATE_UNREGISTERED) {
				ret = TM_FAIL_UNREGISTERED_TASK;
				break;
			}
			TASK_PID(request_msg.handle) = 0;
			TM_FREE(tm_task_list[request_msg.handle].addr);
			tm_task_list[request_msg.handle].addr = NULL;

			ret = ioctl(fd, TMIOC_UNREGISTER_TASK, &request_msg);
			break;

		case TASKMGT_START:
			tm_update_task_state(request_msg.handle);
			ret = tm_get_task_state(request_msg.handle);
			if (ret != TM_TASK_STATE_STOP) {
				ret = -ret;
				break;
			}
			/* handle is for starting task, pid is for caller */
			ret = tm_check_permission(request_msg.handle, request_msg.caller_pid);
			if (ret != OK) {
				break;
			}
			/* handle is in task_list */
			ret = ioctl(fd, TMIOC_START, &builtin_list[TASK_BUILTIN_IDX(request_msg.handle)]);
			if (ret > 0) {
				/* task created well */
				TASK_PID(request_msg.handle) = ret;
				TASK_STATUS(request_msg.handle) = TM_TASK_STATE_RUNNING;
				ret = OK;
			} else {
				/* task created fail */
				ret = TM_FAIL_START_NOT_CREATED;
			}
			break;

		case TASKMGT_TERMINATE:
			tm_update_task_state(request_msg.handle);
			ret = tm_get_task_state(request_msg.handle);
			if (ret == TM_TASK_STATE_UNREGISTERED || ret == TM_TASK_STATE_STOP) {
				ret = -ret;
				break;
			}
			ret = tm_check_permission(request_msg.handle, request_msg.caller_pid);
			if (ret != OK) {
				break;
			}
			/* handle is in task_list */
			ret = ioctl(fd, TMIOC_TERMINATE, TASK_PID(request_msg.handle));
			if (ret >= 0) {
				/* task deleted well */
				TASK_STATUS(request_msg.handle) = TM_TASK_STATE_STOP;
				ret = OK;
			}
			break;

		case TASKMGT_RESTART:
			break;

		case TASKMGT_PAUSE:
			tm_update_task_state(request_msg.handle);
			ret = tm_get_task_state(request_msg.handle);
			if (ret != TM_TASK_STATE_RUNNING) {
				ret = -ret;
				break;
			}
			ret = tm_check_permission(request_msg.handle, request_msg.caller_pid);
			if (ret != OK) {
				break;
			}
			ret = ioctl(fd, TMIOC_PAUSE, TASK_PID(request_msg.handle));
			if (ret == OK) {
				ret = kill(TASK_PID(request_msg.handle), SIGTM_PAUSE);
				if (ret != 0) {
					ret  = TM_FAIL_PAUSE;
					break;
				}
			} else {
				ret = TM_FAIL_PAUSE;
				break;
			}
			TASK_STATUS(request_msg.handle) = TM_TASK_STATE_PAUSE;
			break;

		case TASKMGT_RESUME:
			tm_update_task_state(request_msg.handle);
			ret = tm_get_task_state(request_msg.handle);
			if (ret != TM_TASK_STATE_PAUSE) {
				ret = -ret;
				break;
			}
			ret = tm_check_permission(request_msg.handle, request_msg.caller_pid);
			if (ret != OK) {
				break;
			}
			ret = kill(TASK_PID(request_msg.handle), SIGTM_RESUME);
			if (ret != 0) {
				ret  = TM_FAIL_RESUME;
			}
			TASK_STATUS(request_msg.handle) = TM_TASK_STATE_RUNNING;
			break;

		case TASKMGT_SCAN_NAME:
		case TASKMGT_SCAN_GROUP:
			tm_update_task_state(request_msg.handle);
			response_msg.data = NULL;
			ret = tm_search_task_list(&request_msg, &response_msg);
			if (ret <= 0) {
				ret = TM_FAIL_NOT_REGISTERED;
			} else {
				ret = OK;
			}
			break;

		case TASKMGT_SCAN_HANDLE:
			tm_update_task_state(request_msg.handle);
			ret = tm_get_task_state(request_msg.handle);
			if (ret == TM_TASK_STATE_UNREGISTERED) {
				break;
			}
			response_msg.status = OK;
			tm_get_task_info(&response_msg.data, request_msg.handle);
			break;

		case TASKMGT_UNICAST:
			tm_update_task_state(request_msg.handle);
			ret = tm_get_task_state(request_msg.handle);
			if (ret != TM_TASK_STATE_RUNNING) {
				ret = -ret;
				break;
			}
			ret = tm_check_permission(request_msg.handle, request_msg.caller_pid);
			if (ret != OK) {
				break;
			}

			ret = ioctl(fd, TMIOC_UNICAST, TASK_PID(request_msg.handle));
			if (ret < 0) {
				ret = TM_FAIL_NO_HANDLER;
				break;
			}

			/* handle is in task_list */
			union sigval msg;
			msg.sival_ptr = request_msg.data;
			ret = sigqueue(TASK_PID(request_msg.handle), SIGTM_UNICAST, msg);
			if (ret != OK) {
				tmdbg("Fail to send signal, errno : %d\n", errno);
				ret = TM_FAIL_SEND_MSG;
			}
			break;

		case TASKMGT_BROADCAST:
			break;

		default:
			break;
		}

		if (request_msg.timeout != TM_NO_RESPONSE) {
			response_msg.status = ret;
			tm_handle_private_queue((char *)request_msg.q_name, &response_msg);
		}

		if (request_msg.data != NULL) {
			TM_FREE(request_msg.data);
			request_msg.data = NULL;
		}
		sched_unlock();
	}

	tmdbg("Task manager OUT\n");
	return 0;
}


text:
package org.deidentifier.arx.criteria;

import org.deidentifier.arx.AttributeType.Hierarchy;
import org.deidentifier.arx.framework.check.groupify.HashGroupifyEntry;
import org.deidentifier.arx.framework.data.DataManager;

/**
 * The t-closeness criterion with hierarchical-distance EMD.
 *
 * @author Fabian Prasser
 * @author Florian Kohlmayer
 */
public class HierarchicalDistanceTCloseness extends TCloseness {

    /**  SVUID */
    private static final long serialVersionUID = -2142590190479670706L;

    /** The hierarchy used for the EMD. */
    private final Hierarchy   hierarchy;

    /** Internal tree. */
    private int[]             tree;

    /** Internal offset. */
    private int               start;

    /** Internal empty tree. */
    private int[]             empty;

    /**
     * Creates a new instance of the t-closeness criterion with hierarchical earth-movers-distance as proposed in:
     * Li N, Li T, Venkatasubramanian S.
     * t-Closeness: Privacy beyond k-anonymity and l-diversity.
     * 23rd International Conference on Data Engineering. 2007:106-115.
     *
     * @param attribute
     * @param t
     * @param h
     */
    public HierarchicalDistanceTCloseness(String attribute, double t, Hierarchy h) {
        super(attribute, t);
        this.hierarchy = h;
    }

    /**
     * Returns the hierarchy backing the EMD calculations.
     *
     * @return
     */
    public Hierarchy getHierarchy() {
        return hierarchy;
    }

    @Override
    public void initialize(DataManager manager) {
        super.initialize(manager);
        this.tree = manager.getTree(attribute);
        this.start = this.tree[1] + 3;
        this.empty = new int[this.tree[1]];
    }

    @Override
    public boolean isAnonymous(HashGroupifyEntry entry) {

        // Empty data in tree
        System.arraycopy(empty, 0, tree, start, empty.length);

        // init parameters
        final int totalElementsP = tree[0];
        final int numLeafs = tree[1];
        final double height = tree[2]; // cast to double as it is used in double
                                       // calculations
        final int extraStartPos = numLeafs + 3;
        final int extraEndPos = extraStartPos + numLeafs;

        // Copy and count
        int totalElementsQ = 0;
        int[] buckets = entry.distributions[index].getBuckets();
        for (int i = 0; i < buckets.length; i += 2) {
            if (buckets[i] != -1) { // bucket not empty
                final int value = buckets[i];
                final int frequency = buckets[i + 1];
                tree[value + extraStartPos] = frequency;
                totalElementsQ += frequency;
            }
        }
        // Tree data format: #p_count, #leafs, height, freqLeaf_1, ...,
        // freqLeaf_n, extra_1,..., extra_n, [#childs, level, child_1, ...
        // child_x, pos_e, neg_e], ...
        double cost = 0;

        // leafs
        for (int i = extraStartPos; i < extraEndPos; i++) {
            tree[i] = (tree[i - numLeafs] * totalElementsQ) -
                      (tree[i] * totalElementsP); // p_i - q_i
        }

        // innerNodes
        for (int i = extraEndPos; i < tree.length; i++) {
            int pos_e = 0;
            int neg_e = 0;

            final int numChilds = tree[i++];
            final int level = tree[i++];

            // iterate over all children
            for (int j = 0; j < numChilds; j++) {
                // differentiate between first level and rest

                int extra = 0;
                if (level == 1) {
                    extra = tree[tree[i + j]];
                } else {
                    final int extra_child_index = tree[i + j] +
                                                  tree[tree[i + j]] + 2; // pointer to the pos_e of node
                    final int pos_child = tree[extra_child_index];
                    final int neg_child = tree[extra_child_index + 1];
                    extra = pos_child - neg_child;
                }

                if (extra > 0) { // positive
                    pos_e += extra;
                } else { // negative
                    neg_e += (-extra);
                }
            }

            // save extras
            i += numChilds; // increment pointer to extra
            tree[i++] = pos_e;
            tree[i] = neg_e;

            // sum
            final double cost_n = (level / height) * Math.min(pos_e, neg_e);
            cost += cost_n;
        }

        cost /= ((double) totalElementsP * (double) totalElementsQ);

        // check
        return cost <= t;
    }

	@Override
	public String toString() {
		return t+"-closeness with hierarchical distance for attribute '"+attribute+"'";
	}
}


text:
<?php

/* ProjectGamingCornerBundle:Page:index.html.twig */
class __TwigTemplate_3caa41c726cd4e8c10e6a10d7a12d92f2a6ff58d42863c29ac171a4bec406847 extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->parent = $this->env->loadTemplate("ProjectGamingCornerBundle::layout.html.twig");

        $this->blocks = array(
        );
    }

    protected function doGetParent(array $context)
    {
        return "ProjectGamingCornerBundle::layout.html.twig";
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        $this->parent->display($context, array_merge($this->blocks, $blocks));
    }

    public function getTemplateName()
    {
        return "ProjectGamingCornerBundle:Page:index.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array ();
    }
}


text:
std::vector<char> ResourceUtil::LoadBinaryFile(const std::string& filename)
{
	std::ifstream file(filename, std::ios::binary);
      if(file.fail())
	  {
		SingletonLogger::Log("Loader", LogType::ERROR).Log("Could not open file " + filename);
		assert(false);
      }

      std::streampos begin = file.tellg();;
	  std::streampos end;
      file.seekg( 0, std::ios::end );
      end = file.tellg();

      std::vector<char> result(static_cast<size_t>(end - begin));
      file.seekg(0, std::ios::beg);
      file.read(&result[0], end - begin);
      file.close();

      return(result);
}