hexsha stringlengths 40 40 | size int64 8 1.04M | content stringlengths 8 1.04M | avg_line_length float64 2.24 100 | max_line_length int64 4 1k | alphanum_fraction float64 0.25 0.97 |
|---|---|---|---|---|---|
c424a8611ba063082e594e1dbccae455413694f3 | 2,962 | package com.example.liu.ad_detection.model;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import java.io.Serializable;
/**
* Created by liu on 2017/9/12.
*/
public class AppInfo{
private String appLabel; //应用程序标签
private Drawable appIcon ; //应用程序图像
private Intent intent ; //启动应用程序的Intent,一般是Action为Main和Category为Lancher的Activity
private String pkgName ; //应用程序所对应的包名
private boolean isShow ; // 是否显示CheckBox
private boolean isChecked ; // 是否选中CheckBox
private String sourceDir; //应用程序安装路径
private String hash; //应用程序hash值(sha-256)
private String size; //应用程序大小
private int uploadFlag; //是否上传完成
private int process; //更新进度
private String time; //服务器返回检测结果时间
private String message; //服务器端分析结果
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public int getProcess() {
return process;
}
public void setProcess(int process) {
this.process = process;
}
public int getUploadFlag() {
return uploadFlag;
}
public void setUploadFlag(int uploadFlag) {
this.uploadFlag = uploadFlag;
}
public String getHash() {
return hash;
}
public void setHash(String hash) {
this.hash = hash;
}
public String getSize() {
return size;
}
public void setSize(String size) {
this.size = size;
}
public AppInfo(){}
public AppInfo(String appLabel,String pkgName,String hash,String time,String message){
this.appLabel = appLabel;
this.pkgName = pkgName;
this.hash = hash;
this.time = time;
this.message = message;
}
public String getAppLabel() {
return appLabel;
}
public void setAppLabel(String appName) {
this.appLabel = appName;
}
public Drawable getAppIcon() {
return appIcon;
}
public void setAppIcon(Drawable appIcon) {
this.appIcon = appIcon;
}
public Intent getIntent() {
return intent;
}
public void setIntent(Intent intent) {
this.intent = intent;
}
public String getPkgName(){
return pkgName ;
}
public void setPkgName(String pkgName){
this.pkgName=pkgName ;
}
public boolean isShow() {
return isShow;
}
public void setShow(boolean show) {
isShow = show;
}
public boolean isChecked() {
return isChecked;
}
public void setChecked(boolean checked) {
isChecked = checked;
}
public String getSourceDir() {
return sourceDir;
}
public void setSourceDir(String sourceDir) {
this.sourceDir = sourceDir;
}
} | 22.104478 | 90 | 0.610736 |
2d03d2c5bc4baeb40293413bb04266347ab2baa3 | 6,427 | package de.fraunhofer.iais.eis.ids.index.common.main;
import de.fraunhofer.iais.eis.ids.component.core.SecurityTokenProvider;
import de.fraunhofer.iais.eis.ids.component.core.SelfDescriptionProvider;
import de.fraunhofer.iais.eis.ids.component.interaction.multipart.MultipartComponentInteractor;
import de.fraunhofer.iais.eis.ids.index.common.persistence.NullIndexing;
import de.fraunhofer.iais.eis.ids.index.common.persistence.spi.Indexing;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.URI;
import java.util.Collection;
import java.util.ServiceLoader;
/**
* Template class for AppConfig of an index service.
* This template should be used to reduce code redundancy and to improve maintainability of various index services
*/
public abstract class AppConfigTemplate {
final private Logger logger = LoggerFactory.getLogger(AppConfigTemplate.class);
public String sparqlEndpointUrl = "";
public String contextDocumentUrl;
public URI catalogUri;
public SelfDescriptionProvider selfDescriptionProvider;
//Try to find some indexing on classpath. If not present, use Null Indexing
public Indexing indexing = ServiceLoader.load(Indexing.class).findFirst().orElse(new NullIndexing<>());
public SecurityTokenProvider securityTokenProvider = new SecurityTokenProvider() {
@Override
public String getSecurityToken() {
return "";
}
};
/**
* This function can be used to overwrite the default behaviour of trying to find any indexing in the classpath
* @param indexing Desired indexing implementation to be used
* @return AppConfigTemplate with new value set for indexing
*/
public AppConfigTemplate setIndexing(Indexing indexing)
{
logger.info("Setting indexing to " + indexing.getClass().getSimpleName());
this.indexing = indexing;
return this;
}
public Collection<String> trustedJwksHosts;
public boolean dapsValidateIncoming;
public URI responseSenderAgent;
public boolean performShaclValidation;
/**
* Constructor
* @param selfDescriptionProvider Object providing a self-description of this indexing service
*/
public AppConfigTemplate(SelfDescriptionProvider selfDescriptionProvider) {
this.selfDescriptionProvider = selfDescriptionProvider;
}
/**
* Call this function to set the URL of the SPARQL endpoint. If none is set, an in-memory solution will be used, not permanently persisting data.
* @param sparqlEndpointUrl Address of the SPARQL endpoint as String
* @return AppConfig as Builder Object
*/
public AppConfigTemplate sparqlEndpointUrl(String sparqlEndpointUrl) {
this.sparqlEndpointUrl = sparqlEndpointUrl;
logger.info("SPARQL endpoint set to " +sparqlEndpointUrl);
return this;
}
/**
* URL of the context document to be used for JSON-LD context
* @param contextDocumentUrl URL of the context document
* @return AppConfig as Builder Object
*/
public AppConfigTemplate contextDocumentUrl(String contextDocumentUrl) {
this.contextDocumentUrl = contextDocumentUrl;
logger.info("Context document URL set to " +contextDocumentUrl);
return this;
}
/**
* This function allows to set the URI of the catalog of this indexing service. This is required for it to know when the catalog is requested, and to rewrite URIs for the REST scheme
* @param catalogUri URI of the own catalog.
* @return AppConfig as Builder Object
* TODO: Theoretically, this could be a list of URIs in case of multiple Catalogs. Possibly useful to distinguish between ResourceCatalogUri and ConnectorCatalogUri
*/
public AppConfigTemplate catalogUri(URI catalogUri) {
this.catalogUri = catalogUri;
logger.info("Catalog URI set to " + catalogUri.toString());
return this;
}
/**
* Use this function to turn SHACL validation on or off (configurable at startup only)
* @param performValidation boolean, indicating whether SHACL validation should be performed
* @return AppConfig as Builder Object
*/
public AppConfigTemplate performShaclValidation(boolean performValidation)
{
this.performShaclValidation = performValidation;
logger.info("Perform SHACL Validation is set to " + performValidation);
return this;
}
/**
* Use this function to set a SecurityTokenProvider for this indexing service, allowing it to send messages with a Dynamic Attribute Token signed by the DAPS
* @param securityTokenProvider Object
* @return AppConfig as Builder Object
*/
public AppConfigTemplate securityTokenProvider(SecurityTokenProvider securityTokenProvider) {
this.securityTokenProvider = securityTokenProvider;
return this;
}
/**
* List of hosts whose signature we can trust. Used by DAT validation
* @param trustedJwksHosts list of hosts
* @return AppConfig as Builder Object
*/
public AppConfigTemplate trustedJwksHosts(Collection<String> trustedJwksHosts) {
this.trustedJwksHosts = trustedJwksHosts;
return this;
}
/**
* Sets the senderAgent property in all response messages
* @param responseSenderAgent URI of the senderAgent to be used
* @return AppConfig as Builder Object
*/
public AppConfigTemplate responseSenderAgent(URI responseSenderAgent) {
this.responseSenderAgent = responseSenderAgent;
return this;
}
/**
* Function to toggle validating incoming messages for having a correct DAT. This should ALWAYS be turned on. Only turn this off if required for debugging!
* @param dapsValidateIncoming boolean, determining whether messages should be checked for having valid security tokens
* @return AppConfig as Builder Object
*/
public AppConfigTemplate dapsValidateIncoming(boolean dapsValidateIncoming) {
this.dapsValidateIncoming = dapsValidateIncoming;
logger.info("Incoming messages DAPS token verification enabled: " +dapsValidateIncoming);
return this;
}
/**
* Build function, turning Builder Object into an actual MultipartComponentInteractor
* @return MultipartComponentInteractor with previously set settings
*/
public abstract MultipartComponentInteractor build();
}
| 40.677215 | 186 | 0.730512 |
290cd3124469ede42526f276bbd19117dd88332c | 1,241 | package signumj.entity.response.http.attachment;
import signumj.entity.response.TransactionAttachment;
import signumj.response.attachment.ATCreationAttachment;
import com.google.gson.annotations.SerializedName;
import org.bouncycastle.util.encoders.Hex;
public final class ATCreationAttachmentResponse extends TransactionAttachmentResponse {
private final String name;
private final String description;
private final String creationBytes;
@SerializedName("version.AutomatedTransactionsCreation")
private final int version;
public ATCreationAttachmentResponse(String name, String description, String creationBytes, int version) {
this.name = name;
this.description = description;
this.creationBytes = creationBytes;
this.version = version;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public String getCreationBytes() {
return creationBytes;
}
public int getVersion() {
return version;
}
@Override
public TransactionAttachment toAttachment() {
return new ATCreationAttachment(version, name, description, Hex.decode(creationBytes));
}
}
| 28.204545 | 109 | 0.726833 |
ab0a274125b40219692e11a97b3b968049ba4c13 | 2,526 | /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is "SMS Library for the Java platform".
*
* The Initial Developer of the Original Code is Markus Eriksson.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* ***** END LICENSE BLOCK ***** */
package org.marre.sms.nokia;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.marre.sms.SmsPort;
import org.marre.sms.SmsPortAddressedMessage;
import org.marre.sms.SmsUserData;
/**
* Nokia Group Graphic (CLI) message
* <p>
* <b>Note!</b> I haven't been able to verify that this class works since
* I don't have access to a phone that can handle Group Graphic.
* @author Markus Eriksson
* @version $Id$
*/
public class NokiaGroupGraphic extends SmsPortAddressedMessage
{
/**
*
*/
private static final long serialVersionUID = -7879633793031802695L;
protected final byte[] bitmapData_;
/**
* Creates a group graphic SMS message
*
* @param otaBitmap An OtaBitmap object representing the
* image to send
*/
public NokiaGroupGraphic(OtaBitmap otaBitmap)
{
this(otaBitmap.getBytes());
}
/**
* Creates a group graphic SMS message
* <p>
* The given byte array must be in the Nokia OTA image format.
*
* @param bitmapData The ota image as a byte-array
*/
public NokiaGroupGraphic(byte[] bitmapData)
{
super(SmsPort.NOKIA_CLI_LOGO, SmsPort.ZERO);
bitmapData_ = bitmapData;
}
public SmsUserData getUserData()
{
ByteArrayOutputStream baos = new ByteArrayOutputStream(140);
try
{
// Type?
baos.write(0x30);
// bitmap
baos.write(bitmapData_);
baos.close();
}
catch (IOException ex)
{
// Should not happen!
}
return new SmsUserData(baos.toByteArray());
}
}
| 26.87234 | 78 | 0.649644 |
a2b74a2fa945d8dc8776e924c28d041a825b5815 | 6,733 | /*
BSD 2-Clause License
Copyright (c) 2018, Timo Rantalainen
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package sc.fiji.pQCT.selectroi;
import java.awt.Polygon;
import java.util.Collections;
import java.util.List;
import java.util.Vector;
import java.util.concurrent.ExecutionException;
import java.util.stream.IntStream;
import ij.ImagePlus;
import ij.gui.Roi;
import sc.fiji.pQCT.io.ImageAndAnalysisDetails;
import sc.fiji.pQCT.io.ScaledImageData;
public class SelectSoftROI extends RoiSelector {
public byte[] eroded;
// ImageJ constructor
public SelectSoftROI(final ScaledImageData dataIn,
final ImageAndAnalysisDetails detailsIn, final ImagePlus imp)
throws ExecutionException
{
super(dataIn, detailsIn, imp);
// Soft tissue analysis
softSieve = null;
if (details.stOn) {
// Get rid of measurement tube used at the UKK institute
final byte[] sleeve;
if (details.sleeveOn) {
sleeve = removeSleeve(softScaledImage, 25.0);
final int size = width * height;
IntStream.range(0, size).filter(i -> sleeve[i] == 1).forEach(
i -> softScaledImage[i] = minimum);
}
// Ignore data outside manually selected ROI, if manualRoi has been
// selected
final Roi ijROI = imp.getRoi();
if (ijROI != null && details.manualRoi) {
// Set pixels outside the manually selected ROI to zero
final double[] tempScaledImage = softScaledImage.clone();
// Check whether pixel is within ROI, mark with bone threshold
for (int j = 0; j < height; j++) {
for (int i = 0; i < width; i++) {
if (!ijROI.contains(i, j)) {
softScaledImage[i + j * width] = minimum;
}
}
}
// Check whether a polygon can be acquired and include polygon points
// too
final Polygon polygon = ijROI.getPolygon();
if (polygon != null) {
for (int j = 0; j < polygon.npoints; j++) {
final int index = polygon.xpoints[j] + polygon.ypoints[j] * width;
softScaledImage[index] = tempScaledImage[index];
}
}
}
final Vector<Object> masks = getSieve(softScaledImage, airThreshold,
details.roiChoiceSt, details.guessStacked, details.stacked, false,
true);
softSieve = (byte[]) masks.get(0);
// Erode three layers of pixels from the fat sieve to get rid of higher
// density layer (i.e. skin) on top of fat to enable finding muscle border
byte[] muscleSieve = softSieve.clone();
final double[] muscleImage = softScaledImage.clone();
// Remove skin by eroding three layers of pixels
for (int i = 0; i < 3; ++i) {
muscleSieve = erode(muscleSieve);
}
// The three layers of skin removed
final byte[] subCutaneousFat = muscleSieve.clone();
// Remove everything other than the selected limb from the image
for (int i = 0; i < muscleSieve.length; ++i) {
if (muscleSieve[i] < 1) {
muscleImage[i] = minimum;
}
}
// Look for muscle outline
final Vector<Object> muscleMasks = getSieve(muscleImage,
details.muscleThreshold, "Bigger", details.guessStacked,
details.stacked, false, false);
final List<DetectedEdge> muscleEdges = (Vector<DetectedEdge>) muscleMasks
.get(2);
muscleEdges.sort(Collections.reverseOrder());
int tempMuscleArea = 0;
muscleSieve = new byte[softSieve.length];
int areaToAdd = 0;
// Include areas that contribute more than 1.0% on top of what is already
// included
while (areaToAdd < muscleEdges.size() && tempMuscleArea *
0.01 < muscleEdges.get(areaToAdd).area)
{
final byte[] tempMuscleSieve = fillSieve(muscleEdges.get(areaToAdd).iit,
muscleEdges.get(areaToAdd).jiit, width, height, muscleImage,
details.muscleThreshold);
for (int i = 0; i < tempMuscleSieve.length; ++i) {
if (tempMuscleSieve[i] > 0) {
muscleSieve[i] = tempMuscleSieve[i];
}
}
tempMuscleArea += muscleEdges.get(areaToAdd).area;
areaToAdd++;
}
// Dilate the sieve to include all muscle pixels
byte[] tempMuscleSieve = muscleSieve.clone();
tempMuscleSieve = dilate(tempMuscleSieve, (byte) 1, (byte) 0, (byte) 2);
eroded = new byte[softSieve.length];
for (int i = 0; i < tempMuscleSieve.length; ++i) {
if (tempMuscleSieve[i] == 1) {
subCutaneousFat[i] = 0;
}
}
// create temp boneResult to wipe out bone and marrow
final Vector<Object> masks2 = getSieve(softScaledImage, softThreshold,
details.roiChoiceSt, details.guessStacked, details.stacked, false,
false);
final byte[] boneResult = (byte[]) masks2.get(1);
for (int i = 0; i < softSieve.length; ++i) {
if (softSieve[i] == 1 && softScaledImage[i] >= airThreshold &&
softScaledImage[i] < fatThreshold)
{
// Fat
softSieve[i] = 2;
}
if (muscleSieve[i] == 1 && boneResult[i] == 0) {
if (softScaledImage[i] >= muscleThreshold &&
softScaledImage[i] < softThreshold)
{
// Muscle
softSieve[i] = 3;
}
if (softScaledImage[i] >= airThreshold &&
softScaledImage[i] < muscleThreshold)
{
// Intra/Intermuscular fat
softSieve[i] = 4;
}
}
if (subCutaneousFat[i] == 1) {
// Subcut fat
softSieve[i] = 5;
}
if (boneResult[i] == 1) {
if (softScaledImage[i] >= fatThreshold) {
// Bone & marrow
softSieve[i] = 6;
}
else {
// Marrow fat
softSieve[i] = 7;
}
}
if (softSieve[i] > 0 && subCutaneousFat[i] == 0 &&
tempMuscleSieve[i] == 0)
{
// Skin eroded pixels
eroded[i] = 1;
}
}
}
}
}
| 33.331683 | 78 | 0.677855 |
d918d3b7199746dfada90e71cff90c00c83b7985 | 17,899 | package com.tuya.smart.android.demo.camera.utils;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.text.TextUtils;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.alibaba.fastjson.JSONObject;
import com.tuya.drawee.view.DecryptImageView;
import com.tuya.smart.android.camera.sdk.TuyaIPCSdk;
import com.tuya.smart.android.camera.sdk.api.ITuyaIPCPTZ;
import com.tuya.smart.android.camera.sdk.bean.CollectionPointBean;
import com.tuya.smart.android.camera.sdk.constant.PTZDPModel;
import com.tuya.smart.android.demo.R;
import com.tuya.smart.android.device.bean.EnumSchemaBean;
import com.tuya.smart.home.sdk.callback.ITuyaResultCallback;
import com.tuya.smart.sdk.api.IResultCallback;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by HuangXin on 2021/9/25.
*/
public class CameraPTZHelper implements View.OnClickListener, View.OnLongClickListener {
private static final String TAG = "CameraPTZHelper";
private final ITuyaIPCPTZ tuyaIPCPTZ;
private View ptzBoard;
private Context context;
private ProgressDialog progressDialog;
private int collectionPointSize;
public CameraPTZHelper(String devId) {
tuyaIPCPTZ = TuyaIPCSdk.getPTZInstance(devId);
}
@SuppressLint("ClickableViewAccessibility")
public void bindPtzBoard(View ptzBoard) {
this.ptzBoard = ptzBoard;
this.context = ptzBoard.getContext();
progressDialog = new ProgressDialog(ptzBoard.getContext());
ptzBoard.findViewById(R.id.tv_ptz_close).setOnClickListener(this);
//PTZ Control
ptzBoard.findViewById(R.id.tv_ptz_left).setOnTouchListener(new PTZControlTouchListener("6"));
ptzBoard.findViewById(R.id.tv_ptz_top).setOnTouchListener(new PTZControlTouchListener("0"));
ptzBoard.findViewById(R.id.tv_ptz_right).setOnTouchListener(new PTZControlTouchListener("2"));
ptzBoard.findViewById(R.id.tv_ptz_bottom).setOnTouchListener(new PTZControlTouchListener("4"));
boolean isPTZControl = tuyaIPCPTZ.querySupportByDPCode(PTZDPModel.DP_PTZ_CONTROL);
ptzBoard.findViewById(R.id.group_ptz_control).setVisibility(isPTZControl ? View.VISIBLE : View.GONE);
//Focal
ptzBoard.findViewById(R.id.tv_focal_increase).setOnTouchListener(new FocalTouchListener("1"));
ptzBoard.findViewById(R.id.tv_focal_reduce).setOnTouchListener(new FocalTouchListener("0"));
boolean isSupportZoom = tuyaIPCPTZ.querySupportByDPCode(PTZDPModel.DP_ZOOM_CONTROL);
ptzBoard.findViewById(R.id.group_focal).setVisibility(isSupportZoom ? View.VISIBLE : View.GONE);
//Collection Point
ptzBoard.findViewById(R.id.tv_collection_add).setOnClickListener(this);
ptzBoard.findViewById(R.id.tv_collection_delete).setOnClickListener(this);
ptzBoard.findViewById(R.id.tv_collection_item).setOnClickListener(this);
ptzBoard.findViewById(R.id.tv_collection_item).setOnLongClickListener(this);
boolean isSupportCollection = tuyaIPCPTZ.querySupportByDPCode(PTZDPModel.DP_MEMORY_POINT_SET);
ptzBoard.findViewById(R.id.group_collection).setVisibility(isSupportCollection ? View.VISIBLE : View.GONE);
//Cruise
TextView tvCruiseSwitch = ptzBoard.findViewById(R.id.tv_cruise_switch);
tvCruiseSwitch.setOnClickListener(this);
boolean isCruiseOpen = Boolean.TRUE == tuyaIPCPTZ.getCurrentValue(PTZDPModel.DP_CRUISE_SWITCH, Boolean.class);
tvCruiseSwitch.setText(isCruiseOpen ? "Opened" : "closed");
ptzBoard.findViewById(R.id.tv_cruise_mode).setOnClickListener(this);
ptzBoard.findViewById(R.id.tv_cruise_time).setOnClickListener(this);
boolean isSupportCruise = tuyaIPCPTZ.querySupportByDPCode(PTZDPModel.DP_CRUISE_SWITCH);
ptzBoard.findViewById(R.id.group_cruise).setVisibility(isSupportCruise ? View.VISIBLE : View.GONE);
//Tracking
TextView tTrackingSwitch = ptzBoard.findViewById(R.id.tv_tracking_switch);
tTrackingSwitch.setOnClickListener(this);
boolean isTrackingOpen = Boolean.TRUE == tuyaIPCPTZ.getCurrentValue(PTZDPModel.DP_MOTION_TRACKING, Boolean.class);
tTrackingSwitch.setText(isTrackingOpen ? "Opened" : "closed");
boolean isSupportTracking = tuyaIPCPTZ.querySupportByDPCode(PTZDPModel.DP_MOTION_TRACKING);
ptzBoard.findViewById(R.id.group_tracking).setVisibility(isSupportTracking ? View.VISIBLE : View.GONE);
//Preset Point
ptzBoard.findViewById(R.id.tv_preset_select).setOnClickListener(this);
boolean isSupportPreset = tuyaIPCPTZ.querySupportByDPCode(PTZDPModel.DP_PRESET_POINT);
ptzBoard.findViewById(R.id.group_preset).setVisibility(isSupportPreset ? View.VISIBLE : View.GONE);
View tvPtzEmpty = ptzBoard.findViewById(R.id.tv_ptz_empty);
boolean isNotSupportPTZ = !isPTZControl && !isSupportZoom && !isSupportCollection && !isSupportCruise && !isSupportTracking && !isSupportPreset;
tvPtzEmpty.setVisibility(isNotSupportPTZ ? View.VISIBLE : View.GONE);
}
public void show() {
if (ptzBoard == null) {
return;
}
ptzBoard.setAlpha(0f);
ptzBoard.setVisibility(View.VISIBLE);
ptzBoard.animate().alpha(1f).setDuration(200).start();
requestCollectionPointList();
}
public void dismiss() {
if (ptzBoard == null) {
return;
}
ptzBoard.animate().alpha(0f).setDuration(200).start();
ptzBoard.postDelayed(() -> ptzBoard.setVisibility(View.INVISIBLE), 200);
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.tv_ptz_close) {
dismiss();
} else if (v.getId() == R.id.tv_collection_add) {
addCollectionPoint();
} else if (v.getId() == R.id.tv_collection_delete) {
deleteCollectionPoint();
} else if (v.getId() == R.id.tv_collection_item) {
if (v.getTag() instanceof CollectionPointBean) {
tuyaIPCPTZ.viewCollectionPoint((CollectionPointBean) v.getTag(), new ResultCallback("viewCollectionPoint"));
}
} else if (v.getId() == R.id.tv_cruise_switch) {
boolean isOpen = Boolean.TRUE == tuyaIPCPTZ.getCurrentValue(PTZDPModel.DP_CRUISE_SWITCH, Boolean.class);
tuyaIPCPTZ.publishDps(PTZDPModel.DP_CRUISE_SWITCH, !isOpen, new ResultCallback("cruise_switch") {
@Override
public void onSuccess() {
super.onSuccess();
boolean isOpen = Boolean.TRUE == tuyaIPCPTZ.getCurrentValue(PTZDPModel.DP_CRUISE_SWITCH, Boolean.class);
((TextView) v).setText(isOpen ? "Opened" : "closed");
}
});
} else if (v.getId() == R.id.tv_cruise_mode) {
Map<String, String> map = new HashMap<>();
map.put("0", context.getString(R.string.ipc_panoramic_cruise));
map.put("1", context.getString(R.string.ipc_collection_point_cruise));
List<String> itemList = new ArrayList<>();
List<String> modeList = new ArrayList<>();
EnumSchemaBean enumSchemaBean = tuyaIPCPTZ.getSchemaProperty(PTZDPModel.DP_CRUISE_MODE, EnumSchemaBean.class);
String[] range = enumSchemaBean.getRange().toArray(new String[0]);
for (String s : range) {
String title = map.get(s);
if (!TextUtils.isEmpty(title)) {
itemList.add(title);
modeList.add(s);
}
}
showSelectDialog(itemList.toArray(new String[0]), (dialog, which) -> {
String mode = modeList.get(which);
tuyaIPCPTZ.setCruiseMode(mode, new ResultCallback("setCruiseMode " + mode));
});
} else if (v.getId() == R.id.tv_cruise_time) {
String[] items = new String[]{context.getString(R.string.ipc_full_day_cruise), context.getString(R.string.ipc_custom_cruise)};
showSelectDialog(items, (dialog, which) -> {
if (which == 0) {
tuyaIPCPTZ.publishDps(PTZDPModel.DP_CRUISE_TIME_MODE, "0", new ResultCallback("cruise_time_mode 0"));
} else if (which == 1) {
tuyaIPCPTZ.setCruiseTiming("09:00", "16:00", new ResultCallback("cruise_time_mode 1"));
}
});
} else if (v.getId() == R.id.tv_tracking_switch) {
onClickTracking((TextView) v);
} else if (v.getId() == R.id.tv_preset_select) {
onClickPreset();
}
}
private void onClickTracking(TextView textView) {
progressDialog.show();
boolean isOpen = Boolean.TRUE == tuyaIPCPTZ.getCurrentValue(PTZDPModel.DP_MOTION_TRACKING, Boolean.class);
tuyaIPCPTZ.publishDps(PTZDPModel.DP_MOTION_TRACKING, !isOpen, new ResultCallback("motion_tracking") {
@Override
public void onSuccess() {
super.onSuccess();
boolean isOpen = Boolean.TRUE == tuyaIPCPTZ.getCurrentValue(PTZDPModel.DP_MOTION_TRACKING, Boolean.class);
textView.setText(isOpen ? "Opened" : "closed");
progressDialog.dismiss();
}
@Override
public void onError(String code, String error) {
super.onError(code, error);
progressDialog.dismiss();
}
});
}
private void onClickPreset() {
EnumSchemaBean enumSchemaBean = tuyaIPCPTZ.getSchemaProperty(PTZDPModel.DP_PRESET_POINT, EnumSchemaBean.class);
String[] items = enumSchemaBean.getRange().toArray(new String[0]);
showSelectDialog(items, (dialog, which) -> tuyaIPCPTZ.publishDps(PTZDPModel.DP_PRESET_POINT, items[which], new ResultCallback("ipc_preset_set " + items[which])));
}
public void ptzControl(String direction) {
tuyaIPCPTZ.publishDps(PTZDPModel.DP_PTZ_CONTROL, direction, new ResultCallback("ptzControl"));
}
public void ptzStop() {
tuyaIPCPTZ.publishDps(PTZDPModel.DP_PTZ_STOP, true, new ResultCallback("ptzStop"));
}
private void requestCollectionPointList() {
tuyaIPCPTZ.requestCollectionPointList(new ITuyaResultCallback<List<CollectionPointBean>>() {
@Override
public void onSuccess(List<CollectionPointBean> result) {
DecryptImageView decryptImageView = ptzBoard.findViewById(R.id.iv_collection);
TextView tvName = ptzBoard.findViewById(R.id.tv_collection_item);
if (result != null && result.size() > 0) {
collectionPointSize = result.size();
CollectionPointBean collectionPointBean = result.get(result.size() - 1);
try {
for (int i = 0; i < result.size(); i++) {
CollectionPointBean item = result.get(i);
if (Integer.parseInt(item.getMpId()) > Integer.parseInt(collectionPointBean.getMpId())) {
collectionPointBean = item;
}
}
} catch (Exception e) {
e.printStackTrace();
}
tvName.setText(collectionPointBean.getName());
if (collectionPointBean.getEncryption() instanceof JSONObject) {
JSONObject jsonObject = (JSONObject) collectionPointBean.getEncryption();
Object key = jsonObject.get("key");
if (key == null) {
decryptImageView.setImageURI(collectionPointBean.getPic());
} else {
decryptImageView.setImageURI(collectionPointBean.getPic(), key.toString().getBytes());
}
} else {
decryptImageView.setImageURI(collectionPointBean.getPic());
}
tvName.setTag(collectionPointBean);
} else {
collectionPointSize = 0;
tvName.setText("");
tvName.setTag(null);
decryptImageView.setImageResource(0);
}
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
}
private void addCollectionPoint() {
progressDialog.show();
tuyaIPCPTZ.addCollectionPoint("Collection" + collectionPointSize++, new IResultCallback() {
@Override
public void onError(String code, String error) {
Log.d(TAG, "addCollectionPoint invoke error");
progressDialog.dismiss();
}
@Override
public void onSuccess() {
ptzBoard.postDelayed(() -> {
requestCollectionPointList();
progressDialog.dismiss();
},1000);
}
});
}
private void deleteCollectionPoint() {
TextView tvCollectionItem = ptzBoard.findViewById(R.id.tv_collection_item);
if (!(tvCollectionItem.getTag() instanceof CollectionPointBean)) {
Toast.makeText(context, "Operation failed", Toast.LENGTH_SHORT).show();
return;
}
progressDialog.show();
List<CollectionPointBean> items = new ArrayList<>();
CollectionPointBean item = (CollectionPointBean) tvCollectionItem.getTag();
items.add(item);
tuyaIPCPTZ.deleteCollectionPoints(items, new IResultCallback() {
@Override
public void onError(String code, String error) {
Log.d(TAG, "deleteCollectionPoint invoke error");
progressDialog.dismiss();
}
@Override
public void onSuccess() {
requestCollectionPointList();
progressDialog.dismiss();
}
});
}
@Override
public boolean onLongClick(View v) {
if (v.getId() == R.id.tv_collection_item) {
TextView tvCollectionItem = ptzBoard.findViewById(R.id.tv_collection_item);
if (tvCollectionItem.getTag() instanceof CollectionPointBean) {
CollectionPointBean item = (CollectionPointBean) tvCollectionItem.getTag();
String nameNew = item.getName() + " New";
tuyaIPCPTZ.modifyCollectionPoint(item, nameNew, new IResultCallback() {
@Override
public void onError(String code, String error) {
Toast.makeText(context, "Operation failed", Toast.LENGTH_SHORT).show();
}
@SuppressLint("SetTextI18n")
@Override
public void onSuccess() {
((TextView) v).setText(nameNew);
Toast.makeText(context, "Operation success", Toast.LENGTH_SHORT).show();
}
});
}
}
return true;
}
private void showSelectDialog(String[] items, DialogInterface.OnClickListener onClickListener) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setItems(items, onClickListener);
builder.setNegativeButton("Close", (dialog, which) -> dialog.dismiss());
builder.create().show();
}
class ResultCallback implements IResultCallback {
private final String method;
public ResultCallback(String method) {
this.method = method;
}
@Override
public void onError(String code, String error) {
Log.d(TAG, method + " invoke error: " + error);
Toast.makeText(context, "Operation failed", Toast.LENGTH_SHORT).show();
}
@Override
public void onSuccess() {
Log.d(TAG, method + " invoke success");
Toast.makeText(context, "Operation success", Toast.LENGTH_SHORT).show();
}
}
private class PTZControlTouchListener implements View.OnTouchListener {
String direction;
public PTZControlTouchListener(String direction) {
this.direction = direction;
}
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
ptzControl(direction);
break;
case MotionEvent.ACTION_UP:
ptzStop();
default:
break;
}
return true;
}
}
private class FocalTouchListener implements View.OnTouchListener {
String zoom;
public FocalTouchListener(String zoom) {
this.zoom = zoom;
}
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
tuyaIPCPTZ.publishDps(PTZDPModel.DP_ZOOM_CONTROL, zoom, new ResultCallback("zoom_control" + zoom));
break;
case MotionEvent.ACTION_UP:
tuyaIPCPTZ.publishDps(PTZDPModel.DP_ZOOM_STOP, true, new ResultCallback("zoom_stop"));
default:
break;
}
return true;
}
}
}
| 44.972362 | 170 | 0.621152 |
4f10aeb70e3a2f03f057b3f0b58b1fd34ffa80d4 | 2,371 | // This file was automatically generated from IFCDOC at https://technical.buildingsmart.org/.
// Very slight modifications were made to made content align with ifcXML reference examples.
// Use this class library to create IFC-compliant (web) applications with XML and JSON data.
// Author: Pieter Pauwels, Eindhoven University of Technology
package com.buildingsmart.tech.ifc.IfcSharedBldgElements;
import com.buildingsmart.tech.annotations.*;
import com.buildingsmart.tech.ifc.IfcProductExtension.IfcSpace;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
@Guid("d7038275-a6b7-4293-86c1-f69337a29534")
@JsonIgnoreProperties(ignoreUnknown=true)
public class IfcRelCoversSpaces extends com.buildingsmart.tech.ifc.IfcKernel.IfcRelConnects
{
@Description("Relationship to the space object that is covered. <blockquote class=\"change-ifc2x4\">IFC4 CHANGE The attribute name has been changed from <em>RelatedSpace</em> to <em>RelatingSpace</em> with upward compatibility for file based exchange.</blockquote>")
@DataMember(Order = 0)
@Required()
@Guid("934695b7-b499-4d39-a698-18b232840eaf")
@JacksonXmlProperty(isAttribute=false, localName = "relatingSpace")
private IfcSpace relatingSpace;
@Description("Relationship to the set of coverings covering that cover surfaces of this space.")
@DataMember(Order = 1)
@Required()
@Guid("18964ad6-f7f4-49e7-b15b-0b72b0b504e5")
@MinLength(1)
@JacksonXmlProperty(isAttribute = false, localName = "IfcCovering")
@JacksonXmlElementWrapper(useWrapping = true, localName = "relatedCoverings")
private Set<IfcCovering> relatedCoverings;
public IfcRelCoversSpaces()
{
}
public IfcRelCoversSpaces(String globalId, IfcSpace relatingSpace, IfcCovering[] relatedCoverings)
{
super(globalId);
this.relatingSpace = relatingSpace;
this.relatedCoverings = new HashSet<>(Arrays.asList(relatedCoverings));
}
public IfcSpace getRelatingSpace() {
return this.relatingSpace;
}
public void setRelatingSpace(IfcSpace relatingSpace) {
this.relatingSpace = relatingSpace;
}
public Set<IfcCovering> getRelatedCoverings() {
return this.relatedCoverings;
}
}
| 36.476923 | 274 | 0.797554 |
4521ab0de27fc6923a22f2b16de7ab8d70638364 | 2,942 | /*
* Copyright 2015 Octavian Hasna
*
* 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 ro.hasna.ts.math.ml.distance;
import org.apache.commons.math3.util.FastMath;
import ro.hasna.ts.math.representation.IndexableSymbolicAggregateApproximation;
import ro.hasna.ts.math.type.SaxPair;
/**
* Calculates the L<sub>2</sub> (Euclidean) distance between two vectors using the iSAX representation.
*
* @since 0.7
*/
public class IndexableSaxEuclideanDistance implements GenericDistanceMeasure<SaxPair[]> {
private static final long serialVersionUID = -4740907293933039859L;
private final IndexableSymbolicAggregateApproximation isax;
public IndexableSaxEuclideanDistance(IndexableSymbolicAggregateApproximation isax) {
this.isax = isax;
}
@Override
public double compute(SaxPair[] a, SaxPair[] b) {
return compute(a, b, Double.POSITIVE_INFINITY);
}
@Override
public double compute(SaxPair[] symbolsA, SaxPair[] symbolsB, double cutoff) {
double sum = 0.0;
int w = symbolsA.length;
double transformedCutoff = cutoff * cutoff;
for (int i = 0; i < w; i++) {
double[] boundsA = getBounds(symbolsA[i]);
double[] boundsB = getBounds(symbolsB[i]);
double diff = 0.0;
if (boundsA[1] != Double.POSITIVE_INFINITY && boundsB[0] != Double.NEGATIVE_INFINITY && boundsA[1] < boundsB[0]) {
diff = boundsA[1] - boundsB[0];
} else if (boundsA[0] != Double.NEGATIVE_INFINITY && boundsB[1] != Double.POSITIVE_INFINITY && boundsA[0] > boundsB[1]) {
diff = boundsA[0] - boundsB[1];
}
sum += diff * diff;
if (sum >= transformedCutoff) {
return Double.POSITIVE_INFINITY;
}
}
return FastMath.sqrt(sum);
}
private double[] getBounds(SaxPair saxPair) {
double[] bounds = {Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY};
double[] breakpoints = isax.getBreakpoints(saxPair.getAlphabetSize());
int symbol = saxPair.getSymbol();
if (symbol == 0) {
bounds[1] = breakpoints[0];
} else if (symbol == breakpoints.length) {
bounds[0] = breakpoints[symbol - 1];
} else {
bounds[0] = breakpoints[symbol - 1];
bounds[1] = breakpoints[symbol];
}
return bounds;
}
}
| 35.02381 | 133 | 0.6431 |
e2c4a858359dcebaf53638d5058dc1d54cae4dc7 | 46,594 | package com.rmtheis.langdetect.profile;
import java.util.HashMap;
import com.cybozu.labs.langdetect.util.LangProfile;
import com.cybozu.labs.langdetect.util.NGram;
public class SW {
private static final String name = "sw";
private static final HashMap<String, Integer> freq = new HashMap<String, Integer>();
private static final int[] n_words = new int[NGram.N_GRAM];
public SW() {
init();
}
public final LangProfile getLangProfile() {
return new LangProfile(name, freq, n_words);
}
private void init() {
n_words[0] = 1316698;
n_words[1] = 1560317;
n_words[2] = 1165243;
freq.put("alo", 269);
freq.put("ufi", 189);
freq.put("Okt", 259);
freq.put("mwa", 6205);
freq.put("aut", 148);
freq.put("mwe", 383);
freq.put("mwi", 345);
freq.put(" Gu", 142);
freq.put(" Gr", 177);
freq.put("ل", 165);
freq.put(" Ge", 229);
freq.put(" Ga", 196);
freq.put(" Go", 142);
freq.put("ala", 1026);
freq.put("au ", 993);
freq.put("Gu", 142);
freq.put("Gr", 177);
freq.put("upi", 311);
freq.put("upa", 554);
freq.put("Ge", 229);
freq.put("Ga", 198);
freq.put("Go", 143);
freq.put(" ka", 16147);
freq.put("me ", 516);
freq.put(" ki", 3027);
freq.put(" ko", 150);
freq.put(" km", 140);
freq.put(" kw", 2736);
freq.put(" ku", 5668);
freq.put("air", 222);
freq.put("neo", 505);
freq.put("kuz", 236);
freq.put("kuw", 2713);
freq.put("kuu", 1305);
freq.put("kut", 1795);
freq.put("kus", 492);
freq.put("kur", 190);
freq.put("kup", 186);
freq.put("kun", 409);
freq.put("kum", 210);
freq.put("kul", 297);
freq.put("kuj", 187);
freq.put("kuh", 134);
freq.put("kuf", 233);
freq.put("nes", 161);
freq.put("kua", 620);
freq.put("aja", 293);
freq.put("men", 492);
freq.put("met", 211);
freq.put("mer", 252);
freq.put("mez", 387);
freq.put("Zi", 141);
freq.put(" ya", 17428);
freq.put("k", 76835);
freq.put("Za", 152);
freq.put("ne ", 911);
freq.put("aki", 644);
freq.put("ako", 215);
freq.put("aka", 10583);
freq.put("ake", 1982);
freq.put("ku ", 187);
freq.put("Jer", 215);
freq.put("Kon", 197);
freq.put("bru", 221);
freq.put("m ", 727);
freq.put("to", 4407);
freq.put("er ", 615);
freq.put("is", 9376);
freq.put("V", 1116);
freq.put("iv", 385);
freq.put("me", 2630);
freq.put("eru", 498);
freq.put("mf", 564);
freq.put("ma", 8274);
freq.put("mc", 173);
freq.put("mb", 6660);
freq.put("mm", 321);
freq.put("ml", 210);
freq.put("mo", 6079);
freq.put("mn", 1546);
freq.put("mi", 3477);
freq.put("mh", 261);
freq.put("mk", 1733);
freq.put("mj", 5199);
freq.put("mu", 6394);
freq.put("mt", 753);
freq.put("mw", 6988);
freq.put("era", 456);
freq.put("ms", 447);
freq.put("mr", 140);
freq.put("eri", 650);
freq.put("Le", 210);
freq.put("La", 231);
freq.put("Lo", 213);
freq.put("Lin", 225);
freq.put("uar", 494);
freq.put("la ", 8089);
freq.put("uat", 317);
freq.put("Li", 441);
freq.put("Lu", 315);
freq.put("uan", 690);
freq.put("ena", 283);
freq.put("ki ", 2193);
freq.put("end", 498);
freq.put("ene", 704);
freq.put("eng", 671);
freq.put("eni", 486);
freq.put("Kai", 144);
freq.put("Kan", 354);
freq.put("Kal", 167);
freq.put("Kas", 372);
freq.put("Kar", 232);
freq.put("ens", 4087);
freq.put("ent", 441);
freq.put("Kat", 474);
freq.put("eny", 1803);
freq.put("A", 4461);
freq.put("lam", 497);
freq.put("lan", 660);
freq.put("lai", 293);
freq.put("lak", 564);
freq.put("laa", 157);
freq.put("II ", 207);
freq.put("ove", 320);
freq.put("lat", 186);
freq.put("ua ", 369);
freq.put("en ", 297);
freq.put("ho ", 334);
freq.put("Ali", 478);
freq.put(" Hu", 173);
freq.put("Jim", 174);
freq.put(" Hi", 392);
freq.put("zam", 177);
freq.put(" Ho", 177);
freq.put(" Ha", 622);
freq.put("uwa", 2760);
freq.put(" He", 218);
freq.put("ima", 914);
freq.put("imb", 2471);
freq.put("ime", 354);
freq.put("imf", 161);
freq.put("imi", 180);
freq.put("imo", 196);
freq.put("imu", 392);
freq.put("fik", 168);
freq.put("fil", 269);
freq.put(" Vi", 666);
freq.put("zwa", 252);
freq.put("l", 42025);
freq.put("uo ", 238);
freq.put("nt ", 232);
freq.put("rt", 620);
freq.put("ru", 2279);
freq.put("gon", 205);
freq.put(" zi", 456);
freq.put("rr", 220);
freq.put("rs", 467);
freq.put(" za", 1702);
freq.put("ry", 287);
freq.put("rd", 556);
freq.put("re", 3855);
freq.put("rg", 403);
freq.put("ra", 5018);
freq.put("rb", 136);
freq.put("rc", 143);
freq.put("rl", 223);
freq.put("rm", 257);
freq.put("rn", 619);
freq.put("ro", 1786);
freq.put("ri", 8157);
freq.put("gos", 279);
freq.put("rk", 320);
freq.put("kip", 379);
freq.put("nti", 403);
freq.put("W", 4730);
freq.put("nta", 151);
freq.put("nte", 177);
freq.put("ate", 225);
freq.put("ata", 10070);
freq.put("Vij", 328);
freq.put("ato", 634);
freq.put("isp", 140);
freq.put("go ", 920);
freq.put("ath", 135);
freq.put("ist", 592);
freq.put("isi", 902);
freq.put("ish", 5756);
freq.put("r ", 1622);
freq.put("isa", 694);
freq.put("i ", 52347);
freq.put("tem", 384);
freq.put("tor", 246);
freq.put("tok", 1553);
freq.put("ton", 281);
freq.put("tol", 482);
freq.put("tom", 167);
freq.put("tob", 268);
freq.put(" le", 184);
freq.put("B", 2717);
freq.put(" la", 7153);
freq.put(" li", 859);
freq.put(" lu", 341);
freq.put("Sep", 283);
freq.put("nza", 3817);
freq.put("kto", 308);
freq.put("uka", 247);
freq.put("nzi", 1111);
freq.put("thu", 171);
freq.put("rad", 150);
freq.put("rab", 297);
freq.put("ran", 867);
freq.put("ram", 226);
freq.put("ty ", 146);
freq.put("rai", 160);
freq.put("lba", 165);
freq.put("rat", 173);
freq.put("ras", 256);
freq.put("do ", 429);
freq.put("Asi", 146);
freq.put("on ", 838);
freq.put("ra ", 1932);
freq.put("Chu", 136);
freq.put("y", 38832);
freq.put("don", 150);
freq.put("dol", 151);
freq.put("dom", 308);
freq.put("m", 53651);
freq.put("dog", 335);
freq.put("Ita", 147);
freq.put("一一", 144);
freq.put(" We", 188);
freq.put(" Wa", 1003);
freq.put("d ", 1205);
freq.put(" Wi", 3377);
freq.put("Bib", 137);
freq.put("ba ", 2178);
freq.put("do", 1639);
freq.put("dh", 617);
freq.put("di", 4816);
freq.put("de", 1841);
freq.put("da", 3239);
freq.put("dw", 136);
freq.put("du", 838);
freq.put("dr", 203);
freq.put("eme", 314);
freq.put("ema", 157);
freq.put("emb", 1055);
freq.put("emi", 276);
freq.put("kub", 762);
freq.put("emu", 365);
freq.put("bab", 179);
freq.put("baa", 227);
freq.put("ban", 516);
freq.put("bao", 277);
freq.put("bal", 619);
freq.put("bam", 230);
freq.put("bah", 147);
freq.put("w ", 435);
freq.put("nus", 133);
freq.put("nua", 282);
freq.put("Ufa", 219);
freq.put("muz", 374);
freq.put("iri", 997);
freq.put("iro", 173);
freq.put("ira", 314);
freq.put("ire", 164);
freq.put("muj", 3839);
freq.put("omb", 303);
freq.put("we", 2203);
freq.put("wa", 56175);
freq.put("wo", 202);
freq.put("omi", 249);
freq.put(" Is", 141);
freq.put("omo", 182);
freq.put("wi", 1773);
freq.put(" Ik", 143);
freq.put(" Il", 224);
freq.put(" In", 316);
freq.put(" Id", 148);
freq.put("ile", 321);
freq.put("han", 444);
freq.put("ila", 4379);
freq.put("ilo", 373);
freq.put("ill", 288);
freq.put("ili", 8251);
freq.put(" II", 154);
freq.put("und", 747);
freq.put("mu ", 1602);
freq.put("ung", 1193);
freq.put("uni", 940);
freq.put("kwa", 2512);
freq.put(" me", 184);
freq.put(" mf", 368);
freq.put("kwe", 591);
freq.put(" ma", 3449);
freq.put(" mb", 469);
freq.put(" mc", 155);
freq.put("Mko", 3178);
freq.put(" mm", 157);
freq.put(" mn", 1501);
freq.put(" mo", 680);
freq.put(" mi", 1257);
freq.put(" mj", 5191);
freq.put(" mk", 1617);
freq.put(" mt", 648);
freq.put(" mu", 4335);
freq.put("Mku", 138);
freq.put(" mw", 6857);
freq.put(" mp", 280);
freq.put(" ms", 331);
freq.put("hag", 267);
freq.put("ana", 4702);
freq.put("fri", 445);
freq.put("ai ", 477);
freq.put("mch", 170);
freq.put("Utu", 261);
freq.put("Ch", 770);
freq.put("Co", 364);
freq.put("Ca", 592);
freq.put("ais", 2933);
freq.put("n", 90468);
freq.put("ain", 393);
freq.put("akr", 376);
freq.put("aid", 437);
freq.put("aif", 267);
freq.put("iy", 4997);
freq.put("iz", 1362);
freq.put("ip", 1169);
freq.put("ni ", 18823);
freq.put("ir", 1982);
freq.put("iu", 466);
freq.put("it", 2904);
freq.put("iw", 2556);
freq.put(" ye", 258);
freq.put("ii", 989);
freq.put("ih", 490);
freq.put("ik", 19966);
freq.put("ij", 1580);
freq.put("im", 4832);
freq.put("il", 13887);
freq.put("io", 4395);
freq.put("in", 17333);
freq.put("ia", 11251);
freq.put("ic", 1403);
freq.put("ib", 5595);
freq.put("ie", 672);
freq.put("id", 1813);
freq.put("ig", 1252);
freq.put("if", 1790);
freq.put("ado", 269);
freq.put("dhi", 240);
freq.put("dha", 302);
freq.put("th ", 160);
freq.put("kis", 520);
freq.put("nia", 4199);
freq.put("kiw", 279);
freq.put("kit", 315);
freq.put("kik", 333);
freq.put("kij", 166);
freq.put("kio", 148);
freq.put("kin", 442);
freq.put("kim", 258);
freq.put("kil", 389);
freq.put("Y", 517);
freq.put("nis", 530);
freq.put("kia", 390);
freq.put("bia", 222);
freq.put("kif", 518);
freq.put("mil", 749);
freq.put("Vi", 670);
freq.put("ept", 299);
freq.put("thi", 213);
freq.put("the", 225);
freq.put("epa", 149);
freq.put("yen", 237);
freq.put("op ", 143);
freq.put("hai", 238);
freq.put("haj", 163);
freq.put("hak", 611);
freq.put("hal", 314);
freq.put("ham", 522);
freq.put("ell", 177);
freq.put("hab", 181);
freq.put("ela", 204);
freq.put("had", 740);
freq.put("ele", 786);
freq.put("hap", 154);
freq.put("har", 1714);
freq.put("has", 255);
freq.put("hat", 148);
freq.put("rni", 283);
freq.put("D", 1805);
freq.put("ye ", 1320);
freq.put("rne", 169);
freq.put("adi", 1538);
freq.put("opo", 325);
freq.put("Aru", 195);
freq.put("ha ", 2668);
freq.put("el ", 260);
freq.put("ola", 427);
freq.put("ole", 357);
freq.put(" Ju", 691);
freq.put("oli", 431);
freq.put("olo", 331);
freq.put(" Jo", 255);
freq.put(" Ji", 535);
freq.put(" Je", 286);
freq.put(" Ja", 792);
freq.put("umu", 162);
freq.put("ich", 830);
freq.put("for", 356);
freq.put("ica", 140);
freq.put("Hu", 173);
freq.put("ume", 297);
freq.put("Hi", 393);
freq.put("uma", 686);
freq.put("Ho", 179);
freq.put("umb", 661);
freq.put("umo", 2705);
freq.put("Ha", 622);
freq.put("umi", 484);
freq.put("He", 219);
freq.put("o", 57043);
freq.put("oba", 375);
freq.put("fo ", 342);
freq.put("mbo", 2343);
freq.put("Feb", 214);
freq.put("mbi", 361);
freq.put("mbe", 389);
freq.put("ahi", 308);
freq.put("mba", 3047);
freq.put("son", 242);
freq.put("mbu", 267);
freq.put("wan", 3901);
freq.put("wam", 169);
freq.put("wal", 617);
freq.put("wak", 9923);
freq.put("gir", 232);
freq.put("wai", 2667);
freq.put("wah", 176);
freq.put("giz", 193);
freq.put("gid", 165);
freq.put("way", 141);
freq.put("gin", 349);
freq.put("wat", 368);
freq.put("was", 172);
freq.put("war", 238);
freq.put("wap", 4111);
freq.put("aru", 316);
freq.put("so ", 134);
freq.put("mb ", 139);
freq.put("Z", 395);
freq.put("azi", 5401);
freq.put("azo", 205);
freq.put("aza", 186);
freq.put("mtu", 175);
freq.put("mto", 226);
freq.put("gi ", 572);
freq.put("mta", 228);
freq.put("nne", 236);
freq.put("Sin", 201);
freq.put("ni", 24361);
freq.put("nj", 567);
freq.put("nk", 135);
freq.put("nn", 478);
freq.put("no", 1318);
freq.put("na", 23279);
freq.put("nc", 2788);
freq.put("nd", 5575);
freq.put("ne", 2353);
freq.put("ng", 6858);
freq.put("ny", 7307);
freq.put("nz", 5093);
freq.put("tio", 199);
freq.put("tik", 8147);
freq.put("ns", 4895);
freq.put("nt", 1270);
freq.put("nu", 591);
freq.put(" ni", 9330);
freq.put(" nj", 147);
freq.put("E", 874);
freq.put(" na", 6269);
freq.put(" nc", 2455);
freq.put(" nd", 690);
freq.put(" ng", 147);
freq.put(" ny", 523);
freq.put("Afr", 406);
freq.put("Ida", 135);
freq.put("n ", 3144);
freq.put("Wil", 3077);
freq.put("Wik", 149);
freq.put("rk ", 191);
freq.put("ti ", 2389);
freq.put("ron", 135);
freq.put("ost", 309);
freq.put("rog", 253);
freq.put("lli", 198);
freq.put("lla", 138);
freq.put("lle", 153);
freq.put("gu ", 424);
freq.put("di ", 2661);
freq.put("Dar", 167);
freq.put("vem", 244);
freq.put("ert", 152);
freq.put("ro ", 593);
freq.put("os ", 178);
freq.put("ll ", 147);
freq.put("din", 291);
freq.put("dik", 302);
freq.put("guj", 253);
freq.put("ers", 339);
freq.put("dia", 330);
freq.put("p", 13501);
freq.put("diy", 201);
freq.put("Tab", 164);
freq.put("guz", 429);
freq.put("Tan", 3407);
freq.put(" de", 224);
freq.put("dis", 387);
freq.put(" Yo", 250);
freq.put("ere", 660);
freq.put("ufa", 176);
freq.put("bo ", 2326);
freq.put("mp", 578);
freq.put("Me", 621);
freq.put("bo", 2905);
freq.put("Ma", 4263);
freq.put("Mb", 461);
freq.put("Mo", 643);
freq.put("Mi", 690);
freq.put("Mk", 3388);
freq.put("Mj", 478);
freq.put("Mu", 475);
freq.put("Mt", 420);
freq.put("Mw", 546);
freq.put("Mp", 146);
freq.put("eke", 267);
freq.put("eka", 1754);
freq.put("Mor", 279);
freq.put("eku", 184);
freq.put("ipa", 165);
freq.put("uzi", 743);
freq.put("ipe", 219);
freq.put("ipi", 265);
freq.put("ipo", 224);
freq.put("ayo", 638);
freq.put(" Ka", 2225);
freq.put(" Ke", 708);
freq.put("aye", 284);
freq.put(" Ki", 3568);
freq.put("aya", 4140);
freq.put(" Ko", 414);
freq.put("ngw", 363);
freq.put(" Kw", 4009);
freq.put(" Ku", 695);
freq.put("F", 1081);
freq.put("ibi", 603);
freq.put("ibl", 142);
freq.put("iba", 566);
freq.put("ulu", 258);
freq.put("uli", 1405);
freq.put("ula", 478);
freq.put("ibu", 4111);
freq.put("ule", 192);
freq.put("ao ", 4649);
freq.put(" of", 164);
freq.put("Mic", 182);
freq.put("ma ", 2611);
freq.put("spa", 151);
freq.put("Mis", 147);
freq.put("nyi", 4239);
freq.put("nya", 1379);
freq.put("nye", 1338);
freq.put("mas", 613);
freq.put("mar", 439);
freq.put("mat", 406);
freq.put("use", 183);
freq.put("aoi", 1233);
freq.put("maa", 449);
freq.put("mae", 140);
freq.put("mad", 206);
freq.put("mag", 342);
freq.put("Kag", 175);
freq.put("mak", 522);
freq.put("maj", 397);
freq.put("mam", 161);
freq.put("mal", 159);
freq.put("man", 1055);
freq.put("ght", 136);
freq.put("ss", 500);
freq.put("sp", 289);
freq.put("sw", 308);
freq.put("su", 644);
freq.put("st", 1842);
freq.put("sk", 865);
freq.put("si", 4764);
freq.put("sh", 8151);
freq.put("so", 683);
freq.put("gha", 925);
freq.put("sm", 139);
freq.put("sl", 142);
freq.put("sc", 179);
freq.put("sa", 7736);
freq.put("se", 5649);
freq.put("Cha", 300);
freq.put("tts", 142);
freq.put("Chi", 216);
freq.put("no ", 948);
freq.put("Jan", 271);
freq.put("Re", 188);
freq.put("Jam", 281);
freq.put("Ra", 354);
freq.put("eno", 221);
freq.put("Ri", 138);
freq.put("jib", 3854);
freq.put("jia", 221);
freq.put("jin", 4267);
freq.put(" ai", 153);
freq.put("jil", 163);
freq.put("jim", 1500);
freq.put("jij", 492);
freq.put(" am", 1335);
freq.put(" an", 488);
freq.put(" as", 220);
freq.put(" at", 195);
freq.put(" au", 941);
freq.put("Shi", 315);
freq.put("ji ", 6234);
freq.put(" wa", 33135);
freq.put("em", 2423);
freq.put("el", 2120);
freq.put("eo", 1165);
freq.put("en", 9965);
freq.put("ei", 650);
freq.put("eh", 737);
freq.put("ek", 2577);
freq.put("ej", 155);
freq.put("ee", 307);
freq.put("ed", 686);
freq.put("eg", 644);
freq.put("ef", 303);
freq.put("ea", 1091);
freq.put("ec", 251);
freq.put("eb", 539);
freq.put("ey", 739);
freq.put("ex", 163);
freq.put("ez", 1828);
freq.put("eu", 261);
freq.put("et", 1296);
freq.put("ew", 912);
freq.put("ev", 332);
freq.put("ep", 643);
freq.put("or ", 161);
freq.put("er", 4147);
freq.put("Ken", 632);
freq.put("bli", 173);
freq.put("Joh", 134);
freq.put("G", 1202);
freq.put("ort", 147);
freq.put("e ", 10467);
freq.put("orn", 300);
freq.put("oro", 673);
freq.put("ori", 369);
freq.put("ore", 188);
freq.put("lme", 241);
freq.put("ora", 378);
freq.put("Apr", 266);
freq.put("aen", 162);
freq.put("lay", 3727);
freq.put("zan", 3194);
freq.put("zal", 783);
freq.put("oni", 784);
freq.put("zaj", 254);
freq.put("zai", 249);
freq.put("ona", 230);
freq.put("ong", 860);
freq.put("ond", 383);
freq.put("one", 151);
freq.put("zar", 173);
freq.put("ian", 874);
freq.put("iak", 142);
freq.put("ukw", 139);
freq.put("uku", 302);
freq.put("yin", 213);
freq.put("yik", 3954);
freq.put("uko", 457);
freq.put("uki", 429);
freq.put("ias", 364);
freq.put("iar", 235);
freq.put(" Zi", 141);
freq.put("hul", 146);
freq.put("hum", 2789);
freq.put("hun", 282);
freq.put("huo", 175);
freq.put(" Za", 152);
freq.put("za ", 2981);
freq.put("huk", 345);
freq.put("huu", 1333);
freq.put("hur", 418);
freq.put("hus", 506);
freq.put("ia ", 9119);
freq.put("r", 27443);
freq.put("and", 2300);
freq.put("ane", 261);
freq.put("ang", 1660);
freq.put("san", 482);
freq.put("anc", 133);
freq.put("sac", 139);
freq.put("sab", 458);
freq.put("ann", 141);
freq.put("ano", 638);
freq.put("pri", 298);
freq.put("ani", 7747);
freq.put("anj", 260);
freq.put("ant", 323);
freq.put("anu", 344);
freq.put("ans", 490);
freq.put("sas", 180);
freq.put("any", 4453);
freq.put("anz", 4756);
freq.put("Do", 469);
freq.put("Di", 169);
freq.put("De", 497);
freq.put("Da", 365);
freq.put("msh", 144);
freq.put("an ", 1167);
freq.put("iwa", 2430);
freq.put("sa ", 5643);
freq.put("zo ", 612);
freq.put(" Le", 207);
freq.put(" La", 231);
freq.put(" Lo", 213);
freq.put(" Li", 441);
freq.put(" Lu", 315);
freq.put("Uch", 175);
freq.put("x ", 213);
freq.put("ge ", 611);
freq.put("We", 189);
freq.put("Wa", 1003);
freq.put("ce ", 176);
freq.put("Wi", 3380);
freq.put("а", 137);
freq.put("ger", 781);
freq.put("H", 1677);
freq.put(" pa", 632);
freq.put(" pe", 176);
freq.put(" pi", 931);
freq.put("ssa", 198);
freq.put("gen", 204);
freq.put("ute", 137);
freq.put("uti", 211);
freq.put("uto", 1436);
freq.put("tu ", 896);
freq.put("wa ", 33121);
freq.put("vu ", 165);
freq.put("ju", 713);
freq.put("tur", 369);
freq.put("utu", 215);
freq.put("jo", 133);
freq.put("ji", 17145);
freq.put("tun", 270);
freq.put("je", 934);
freq.put("ja", 2368);
freq.put("gwe", 166);
freq.put("z", 18893);
freq.put("gwa", 280);
freq.put("C", 2251);
freq.put(" bi", 222);
freq.put("fiz", 146);
freq.put("s", 35298);
freq.put("tum", 424);
freq.put("ei ", 346);
freq.put(" ba", 679);
freq.put("po ", 743);
freq.put("oku", 141);
freq.put("ivy", 133);
freq.put("pap", 248);
freq.put(" Me", 615);
freq.put("Te", 258);
freq.put("pat", 4120);
freq.put(" Ma", 4258);
freq.put(" Mb", 461);
freq.put(" Mo", 643);
freq.put(" Mi", 685);
freq.put(" Mj", 478);
freq.put(" Mk", 3388);
freq.put(" Mt", 420);
freq.put(" Mu", 471);
freq.put(" Mw", 545);
freq.put(" Mp", 146);
freq.put("I ", 397);
freq.put("pak", 235);
freq.put("pam", 300);
freq.put("pan", 895);
freq.put("I", 2605);
freq.put("II", 286);
freq.put("ois", 1291);
freq.put("Is", 141);
freq.put("Ir", 284);
freq.put("It", 181);
freq.put("pa ", 765);
freq.put("Ik", 143);
freq.put("Il", 226);
freq.put("In", 317);
freq.put("Id", 148);
freq.put("一", 303);
freq.put("am ", 337);
freq.put("Mwa", 460);
freq.put("mo ", 4413);
freq.put("Mac", 287);
freq.put("oko", 236);
freq.put("ami", 838);
freq.put("amh", 222);
freq.put("Mag", 282);
freq.put("amo", 1890);
freq.put("ama", 1868);
freq.put("amb", 1658);
freq.put("ame", 637);
freq.put("moj", 1127);
freq.put("mon", 163);
freq.put("amp", 179);
freq.put("amu", 1047);
freq.put("tia", 156);
freq.put("t", 40551);
freq.put("Kus", 393);
freq.put("ezo", 172);
freq.put("ezi", 237);
freq.put("New", 381);
freq.put("eza", 1136);
freq.put(" ch", 2090);
freq.put("ae ", 291);
freq.put("Mei", 250);
freq.put("o ", 24303);
freq.put("Mji", 464);
freq.put("oo", 318);
freq.put("on", 3853);
freq.put("om", 1846);
freq.put("ol", 1930);
freq.put("ok", 2328);
freq.put("oj", 1425);
freq.put("oi", 1488);
freq.put("oh", 360);
freq.put("og", 855);
freq.put("of", 4380);
freq.put("od", 678);
freq.put("oc", 308);
freq.put("ob", 631);
freq.put("oa", 4118);
freq.put("oz", 397);
freq.put("oy", 154);
freq.put("ow", 244);
freq.put("ov", 580);
freq.put("ou", 534);
freq.put("ot", 1280);
freq.put("os", 1066);
freq.put("or", 2938);
freq.put("op", 845);
freq.put("Ni", 437);
freq.put("No", 466);
freq.put("Na", 466);
freq.put("Ne", 518);
freq.put("Ny", 247);
freq.put("her", 275);
freq.put("hes", 336);
freq.put("loj", 136);
freq.put("hez", 299);
freq.put("lom", 136);
freq.put("ehe", 647);
freq.put("hem", 395);
freq.put("hen", 226);
freq.put("J", 2641);
freq.put("jul", 257);
freq.put("jum", 177);
freq.put("juu", 155);
freq.put(" ak", 183);
freq.put("lo ", 347);
freq.put("agh", 475);
freq.put("as ", 271);
freq.put("he ", 544);
freq.put("aa", 1773);
freq.put("ac", 1224);
freq.put("ab", 2568);
freq.put("ae", 682);
freq.put("ad", 3126);
freq.put("ag", 1596);
freq.put("af", 1092);
freq.put("ai", 5267);
freq.put("ah", 1414);
freq.put("ak", 14678);
freq.put("aj", 1998);
freq.put("am", 9111);
freq.put("al", 8458);
freq.put("ao", 6210);
freq.put("an", 29556);
freq.put("ap", 5739);
freq.put("as", 4908);
freq.put("ar", 9773);
freq.put("au", 1667);
freq.put("at", 22079);
freq.put("aw", 1490);
freq.put("av", 414);
freq.put("ay", 5308);
freq.put("az", 6015);
freq.put("yof", 3874);
freq.put("iga", 224);
freq.put("igo", 169);
freq.put("yot", 286);
freq.put("igi", 384);
freq.put("igh", 170);
freq.put("gom", 190);
freq.put("hwa", 473);
freq.put("yo ", 973);
freq.put("u", 57506);
freq.put("gw", 483);
freq.put("all", 133);
freq.put("alm", 262);
freq.put("ali", 5324);
freq.put("pte", 287);
freq.put("ale", 476);
freq.put("alb", 152);
freq.put("aju", 170);
freq.put("mna", 1501);
freq.put("fa ", 488);
freq.put("ty", 166);
freq.put("tw", 473);
freq.put("tt", 391);
freq.put("tu", 2287);
freq.put("tr", 455);
freq.put("ts", 343);
freq.put("Jin", 277);
freq.put("tl", 220);
freq.put("th", 999);
freq.put("ti", 12092);
freq.put("и", 142);
freq.put("te", 2280);
freq.put("ta", 14867);
freq.put("edi", 297);
freq.put("mpa", 160);
freq.put("far", 316);
freq.put("goz", 233);
freq.put("al ", 304);
freq.put("mpi", 142);
freq.put("fan", 4203);
freq.put("fal", 292);
freq.put("fam", 283);
freq.put("ius", 183);
freq.put(" Ni", 435);
freq.put("is ", 521);
freq.put(" No", 466);
freq.put(" Na", 464);
freq.put(" Ne", 518);
freq.put("ge", 1928);
freq.put(" Ny", 247);
freq.put("gor", 306);
freq.put("t ", 1231);
freq.put("tel", 171);
freq.put("ga", 2900);
freq.put("ten", 273);
freq.put("go", 2336);
freq.put("ter", 432);
freq.put("aba", 751);
freq.put("gl", 145);
freq.put("abe", 140);
freq.put("abi", 660);
freq.put("ast", 167);
freq.put("abo", 208);
freq.put("abu", 582);
freq.put("te ", 507);
freq.put("K", 12188);
freq.put(" ra", 432);
freq.put(" ri", 188);
freq.put("su ", 198);
freq.put("mmo", 145);
freq.put("aku", 502);
freq.put("vin", 183);
freq.put("vil", 200);
freq.put("vis", 284);
freq.put("vit", 187);
freq.put("eya", 259);
freq.put("twa", 450);
freq.put("de ", 752);
freq.put("Su", 178);
freq.put("St", 260);
freq.put("Si", 424);
freq.put("Sh", 518);
freq.put("So", 239);
freq.put("Sa", 668);
freq.put("Se", 532);
freq.put("ey ", 361);
freq.put("der", 146);
freq.put(" da", 146);
freq.put("del", 152);
freq.put("v", 3863);
freq.put(" du", 302);
freq.put("deg", 261);
freq.put("f ", 246);
freq.put("ati", 9962);
freq.put("atu", 749);
freq.put("fr", 504);
freq.put("fu", 1927);
freq.put("Dod", 240);
freq.put("fa", 6104);
freq.put("fe", 174);
freq.put("fi", 1075);
freq.put("fo", 752);
freq.put("a", 289584);
freq.put("ry ", 194);
freq.put("ege", 351);
freq.put("ito", 288);
freq.put("iti", 334);
freq.put("y ", 1239);
freq.put("ite", 213);
freq.put("uvu", 174);
freq.put("ita", 1061);
freq.put("itw", 269);
freq.put("itu", 317);
freq.put(" Ok", 277);
freq.put("yi", 4283);
freq.put("Bar", 140);
freq.put("yo", 5888);
freq.put("ya", 24129);
freq.put("ye", 2395);
freq.put("L", 1530);
freq.put("uhi", 136);
freq.put("oka", 1580);
freq.put("uhu", 267);
freq.put("oke", 163);
freq.put("yu", 306);
freq.put("Bah", 237);
freq.put("ifu", 393);
freq.put("Rai", 176);
freq.put("ifa", 585);
freq.put("ifo", 606);
freq.put(" sh", 318);
freq.put(" si", 369);
freq.put(" sa", 589);
freq.put(" se", 4480);
freq.put("iza", 568);
freq.put("izi", 413);
freq.put("izo", 242);
freq.put("ass", 197);
freq.put("jer", 348);
freq.put(" Af", 443);
freq.put(" Ag", 372);
freq.put(" Al", 833);
freq.put(" Am", 240);
freq.put(" An", 463);
freq.put(" Ap", 290);
freq.put(" Ar", 474);
freq.put(" As", 222);
freq.put(" Au", 181);
freq.put("Ung", 252);
freq.put("ask", 665);
freq.put("asi", 1169);
freq.put("ash", 895);
freq.put("w", 60984);
freq.put(" el", 223);
freq.put(" en", 369);
freq.put("st ", 167);
freq.put("aa ", 361);
freq.put("kon", 141);
freq.put("koa", 3734);
freq.put("jen", 305);
freq.put(" es", 141);
freq.put("nch", 2504);
freq.put("eli", 360);
freq.put("ste", 192);
freq.put("b", 19688);
freq.put("sta", 295);
freq.put("aam", 185);
freq.put("ko ", 1214);
freq.put("sto", 444);
freq.put("sti", 401);
freq.put("str", 197);
freq.put("aar", 236);
freq.put("ka ", 19783);
freq.put("lif", 397);
freq.put("k ", 628);
freq.put("lia", 1497);
freq.put("lic", 340);
freq.put("Kis", 329);
freq.put("Kir", 165);
freq.put("lin", 627);
freq.put("lio", 738);
freq.put("lih", 179);
freq.put("efu", 197);
freq.put("Kit", 204);
freq.put("Kik", 287);
freq.put("Kii", 249);
freq.put("liw", 979);
freq.put("lip", 257);
freq.put("Kin", 148);
freq.put("Kim", 202);
freq.put("Kil", 453);
freq.put("Kib", 138);
freq.put("Kia", 309);
freq.put("Kig", 295);
freq.put("liy", 4415);
freq.put("liz", 411);
freq.put("uji", 4010);
freq.put("kab", 375);
freq.put("kad", 160);
freq.put("ofu", 134);
freq.put("kao", 197);
freq.put("kan", 2795);
freq.put("kam", 1048);
freq.put("kal", 354);
freq.put("kas", 316);
freq.put("kar", 374);
freq.put("kaw", 137);
freq.put("kat", 14149);
freq.put("kaz", 5045);
freq.put("The", 164);
freq.put("Kwa", 3975);
freq.put("ka", 45110);
freq.put("li ", 2787);
freq.put("ke", 2748);
freq.put("ki", 6922);
freq.put("kh", 154);
freq.put("ko", 5804);
freq.put("km", 156);
freq.put("uja", 302);
freq.put("ks", 210);
freq.put("kr", 669);
freq.put("kw", 3124);
freq.put("ku", 10532);
freq.put("kt", 463);
freq.put("ugh", 514);
freq.put("hi ", 3880);
freq.put("oja", 1149);
freq.put("Has", 225);
freq.put("ugu", 137);
freq.put("oji", 173);
freq.put("Ju", 691);
freq.put("Jo", 255);
freq.put("Ji", 536);
freq.put("Je", 286);
freq.put("Ja", 792);
freq.put("hir", 394);
freq.put("his", 266);
freq.put("rt ", 160);
freq.put("aad", 302);
freq.put("hiy", 239);
freq.put("hii", 230);
freq.put("hil", 432);
freq.put("him", 244);
freq.put("hin", 1991);
freq.put("hio", 2603);
freq.put("aal", 140);
freq.put("x", 501);
freq.put(" Be", 362);
freq.put("Ago", 254);
freq.put("set", 147);
freq.put(" Ba", 766);
freq.put("ser", 175);
freq.put(" Bo", 282);
freq.put(" Bi", 308);
freq.put("sey", 212);
freq.put(" Bu", 429);
freq.put("ara", 2057);
freq.put("ard", 317);
freq.put("are", 1998);
freq.put(" Br", 278);
freq.put("sen", 4083);
freq.put("sem", 335);
freq.put("uu ", 2892);
freq.put("seh", 319);
freq.put("iku", 2496);
freq.put("ar ", 568);
freq.put("ika", 13864);
freq.put("iki", 2488);
freq.put("leo", 178);
freq.put("iko", 612);
freq.put("to ", 986);
freq.put(" Pr", 150);
freq.put("c", 9784);
freq.put(" Pa", 857);
freq.put(" Pe", 270);
freq.put(" Pi", 163);
freq.put(" Po", 195);
freq.put("Wan", 148);
freq.put("wen", 1037);
freq.put("ga ", 1334);
freq.put("pr", 381);
freq.put("pw", 193);
freq.put("pt", 348);
freq.put("pu", 357);
freq.put("swa", 181);
freq.put("pa", 6921);
freq.put("fu ", 810);
freq.put("pe", 836);
freq.put("ph", 151);
freq.put("pi", 2193);
freq.put("po", 1264);
freq.put("gaz", 140);
freq.put("ach", 840);
freq.put(" tu", 189);
freq.put("gar", 155);
freq.put("N", 2782);
freq.put(" to", 170);
freq.put("gan", 693);
freq.put(" th", 289);
freq.put(" te", 201);
freq.put(" ta", 1410);
freq.put("iye", 227);
freq.put("fup", 194);
freq.put("iyo", 4644);
freq.put("p ", 352);
freq.put("fua", 317);
freq.put("fun", 167);
freq.put("fum", 143);
freq.put("bor", 262);
freq.put("riw", 166);
freq.put("ris", 508);
freq.put("rin", 373);
freq.put("Iri", 209);
freq.put("ril", 300);
freq.put("rik", 1688);
freq.put("aha", 751);
freq.put("rib", 1011);
freq.put("ric", 160);
freq.put("ria", 769);
freq.put("ewa", 358);
freq.put("ewe", 148);
freq.put("tis", 158);
freq.put("ri ", 2373);
freq.put(" fu", 177);
freq.put("Mbe", 273);
freq.put("ew ", 355);
freq.put(" fa", 353);
freq.put("lil", 529);
freq.put("vya", 351);
freq.put("lim", 922);
freq.put(" fi", 274);
freq.put("vyo", 257);
freq.put("bi ", 662);
freq.put("lik", 2742);
freq.put("tin", 351);
freq.put("lit", 241);
freq.put("ee ", 156);
freq.put("bin", 256);
freq.put("bil", 315);
freq.put("Ok", 277);
freq.put("lis", 337);
freq.put("uza", 470);
freq.put("biw", 209);
freq.put("bis", 191);
freq.put("d", 15034);
freq.put("apo", 406);
freq.put("b ", 211);
freq.put("ru ", 273);
freq.put("ija", 140);
freq.put("ije", 137);
freq.put("iji", 1232);
freq.put("ped", 156);
freq.put("be", 1280);
freq.put("ba", 6016);
freq.put("rum", 452);
freq.put("bl", 321);
freq.put("M", 12761);
freq.put("rua", 234);
freq.put("ruf", 262);
freq.put("bi", 2134);
freq.put("O", 860);
freq.put("bu", 5373);
freq.put("bw", 843);
freq.put("br", 408);
freq.put("rus", 423);
freq.put("ufu", 352);
freq.put("zis", 240);
freq.put("Rom", 180);
freq.put("idi", 551);
freq.put("ide", 157);
freq.put("ida", 813);
freq.put("nsi", 211);
freq.put(" ut", 249);
freq.put("nsa", 4269);
freq.put(" up", 502);
freq.put(" us", 165);
freq.put(" ul", 573);
freq.put(" um", 247);
freq.put(" un", 1571);
freq.put(" uh", 139);
freq.put(" uk", 210);
freq.put("ush", 417);
freq.put(" uc", 144);
freq.put("mko", 539);
freq.put("mku", 1038);
freq.put("u ", 13704);
freq.put("chu", 596);
freq.put(" Ch", 768);
freq.put(" Co", 362);
freq.put("ns ", 140);
freq.put(" Ca", 582);
freq.put("pwa", 189);
freq.put("Ula", 150);
freq.put("uta", 560);
freq.put("uz", 1451);
freq.put("uu", 3068);
freq.put("ut", 2784);
freq.put("uw", 2877);
freq.put("uv", 252);
freq.put("up", 1077);
freq.put("us", 3274);
freq.put("ur", 1919);
freq.put("um", 5397);
freq.put("ul", 2575);
freq.put("uo", 368);
freq.put("un", 5099);
freq.put("ui", 563);
freq.put("uh", 626);
freq.put("uk", 1643);
freq.put("uj", 4429);
freq.put("ue", 357);
freq.put("ud", 534);
freq.put("ug", 901);
freq.put("uf", 741);
freq.put("ua", 2111);
freq.put("Ni ", 218);
freq.put("uc", 476);
freq.put("ub", 1112);
freq.put("Tu", 237);
freq.put("To", 205);
freq.put("Th", 275);
freq.put("Nya", 144);
freq.put("Ta", 3841);
freq.put("nac", 183);
freq.put("Mas", 472);
freq.put("Mar", 1940);
freq.put("naf", 402);
freq.put("nad", 288);
freq.put("naj", 196);
freq.put("nak", 251);
freq.put("nai", 158);
freq.put("nan", 221);
freq.put("nao", 1457);
freq.put("nal", 257);
freq.put("nam", 1855);
freq.put("nas", 439);
freq.put("nap", 185);
freq.put("nat", 353);
freq.put("Mak", 206);
freq.put("nay", 454);
freq.put("Man", 216);
freq.put("na ", 15738);
freq.put("e", 46694);
freq.put("Ag", 372);
freq.put("Af", 445);
freq.put("age", 227);
freq.put("Am", 241);
freq.put("Al", 840);
freq.put("aga", 223);
freq.put("An", 463);
freq.put("ruk", 315);
freq.put("Ap", 290);
freq.put("As", 222);
freq.put("Ar", 475);
freq.put("Au", 181);
freq.put("agu", 395);
freq.put(" b", 1252);
freq.put(" c", 2191);
freq.put("gu", 1858);
freq.put(" a", 6533);
freq.put(" f", 914);
freq.put(" g", 257);
freq.put(" d", 1010);
freq.put(" e", 802);
freq.put(" j", 5212);
freq.put(" k", 27977);
freq.put(" h", 7652);
freq.put(" i", 9059);
freq.put(" n", 19872);
freq.put(" o", 327);
freq.put(" l", 8602);
freq.put(" m", 27935);
freq.put(" r", 837);
freq.put(" s", 6097);
freq.put(" p", 2154);
freq.put(" v", 1482);
freq.put(" w", 34366);
freq.put(" t", 2402);
freq.put(" u", 4361);
freq.put(" z", 2257);
freq.put(" y", 17767);
freq.put("gi", 1836);
freq.put("gh", 1233);
freq.put(" B", 2646);
freq.put(" C", 2112);
freq.put(" A", 4277);
freq.put(" F", 1046);
freq.put(" G", 1172);
freq.put(" D", 1740);
freq.put(" E", 782);
freq.put(" J", 2627);
freq.put(" K", 12017);
freq.put(" H", 1638);
freq.put(" I", 2128);
freq.put(" N", 2678);
freq.put(" O", 803);
freq.put(" L", 1487);
freq.put(" M", 12665);
freq.put(" R", 1588);
freq.put(" S", 3229);
freq.put(" P", 2015);
freq.put(" V", 1031);
freq.put(" W", 4707);
freq.put(" T", 5117);
freq.put(" U", 3052);
freq.put(" Z", 375);
freq.put("Nov", 242);
freq.put(" Y", 513);
freq.put("ch ", 165);
freq.put("ed ", 154);
freq.put("P", 2090);
freq.put("g ", 607);
freq.put("evi", 165);
freq.put("us ", 536);
freq.put("le ", 1011);
freq.put("zo", 952);
freq.put("zi", 8597);
freq.put("ze", 368);
freq.put("za", 8043);
freq.put("odo", 288);
freq.put("zu", 272);
freq.put("zw", 257);
freq.put("rd ", 213);
freq.put("lek", 133);
freq.put("z ", 191);
freq.put("lem", 198);
freq.put("len", 254);
freq.put("ozi", 165);
freq.put("les", 155);
freq.put("lev", 140);
freq.put("lew", 193);
freq.put("lez", 192);
freq.put("wim", 286);
freq.put(" Do", 469);
freq.put(" Di", 167);
freq.put(" De", 495);
freq.put("wil", 741);
freq.put(" Da", 365);
freq.put("api", 162);
freq.put("ii ", 525);
freq.put("apa", 4869);
freq.put("cha", 2430);
freq.put("Fr", 177);
freq.put("che", 571);
freq.put("usa", 176);
freq.put("uso", 141);
freq.put("chi", 3152);
freq.put("usi", 1319);
freq.put("cho", 370);
freq.put("Fa", 160);
freq.put("usu", 216);
freq.put("ust", 207);
freq.put("Fe", 311);
freq.put("zia", 533);
freq.put("zin", 815);
freq.put("zil", 197);
freq.put("zik", 548);
freq.put("iin", 242);
freq.put(" Ru", 370);
freq.put("f", 11048);
freq.put(" Re", 188);
freq.put(" ju", 300);
freq.put(" Ra", 354);
freq.put("zi ", 5785);
freq.put(" Ro", 385);
freq.put(" Ri", 138);
freq.put("tat", 292);
freq.put("taw", 344);
freq.put("tar", 668);
freq.put("taa", 220);
freq.put("tab", 242);
freq.put("tal", 339);
freq.put("tam", 288);
freq.put("tan", 641);
freq.put("tao", 3872);
freq.put("tai", 280);
freq.put("taj", 233);
freq.put("tak", 462);
freq.put("sis", 157);
freq.put("siw", 355);
freq.put("afi", 303);
freq.put("Yo", 250);
freq.put(" vi", 1013);
freq.put("afa", 411);
freq.put("sia", 608);
freq.put(" vy", 396);
freq.put("afu", 225);
freq.put("sin", 881);
freq.put("sim", 158);
freq.put("sil", 283);
freq.put("ta ", 6480);
freq.put(" ja", 134);
freq.put("mji", 5175);
freq.put("si ", 1365);
freq.put("da ", 1525);
freq.put("lf", 159);
freq.put("ld", 221);
freq.put("le", 2997);
freq.put("lb", 250);
freq.put("la", 14880);
freq.put("lo", 1408);
freq.put("ll", 791);
freq.put("lm", 337);
freq.put("li", 17984);
freq.put("lt", 178);
freq.put("lu", 868);
freq.put("ls", 182);
freq.put("asa", 1084);
freq.put("ly", 147);
freq.put("dad", 386);
freq.put("dae", 220);
freq.put("dam", 173);
freq.put("dan", 305);
freq.put("sik", 319);
freq.put("dar", 151);
freq.put("Cal", 307);
freq.put("bar", 432);
freq.put("s ", 3025);
freq.put("l ", 1018);
freq.put("Sal", 197);
freq.put(" hu", 4749);
freq.put(" hi", 990);
freq.put(" ho", 139);
freq.put(" ha", 1606);
freq.put(" he", 144);
freq.put("bay", 333);
freq.put("bu ", 4649);
freq.put("rez", 420);
freq.put("rek", 1672);
freq.put("reh", 266);
freq.put("ren", 163);
freq.put("rea", 148);
freq.put("ref", 154);
freq.put("unz", 137);
freq.put("bwa", 786);
freq.put("g", 13829);
freq.put("re ", 305);
freq.put("K ", 152);
freq.put("ihi", 187);
freq.put("art", 243);
freq.put("ihe", 138);
freq.put("be ", 229);
freq.put(" St", 248);
freq.put(" Su", 178);
freq.put(" Sh", 517);
freq.put(" Si", 421);
freq.put(" So", 239);
freq.put(" Sa", 668);
freq.put(" Se", 528);
freq.put("Ka", 2234);
freq.put("Ke", 708);
freq.put("rse", 228);
freq.put("Ki", 3577);
freq.put("Ko", 415);
freq.put("ogo", 593);
freq.put("R", 1632);
freq.put("Kw", 4009);
freq.put("Ku", 695);
freq.put("udi", 174);
freq.put("bel", 151);
freq.put("bey", 251);
freq.put("ber", 216);
freq.put("Pap", 368);
freq.put("ari", 3153);
freq.put("mik", 321);
freq.put("ck ", 143);
freq.put("min", 192);
freq.put("mia", 630);
freq.put("aro", 249);
freq.put("mit", 295);
freq.put("awi", 190);
freq.put("Uje", 235);
freq.put("awa", 1126);
freq.put("ure", 140);
freq.put("ura", 183);
freq.put("mi ", 359);
freq.put("uri", 491);
freq.put("uru", 630);
freq.put("bun", 177);
freq.put("Ru", 370);
freq.put("nge", 937);
freq.put("nga", 1742);
freq.put("jaw", 201);
freq.put("ngo", 958);
freq.put("jar", 185);
freq.put("ngi", 1065);
freq.put("jan", 137);
freq.put("ngu", 1084);
freq.put(" ik", 274);
freq.put(" il", 4878);
freq.put(" im", 145);
freq.put(" in", 3363);
freq.put(" id", 219);
freq.put(" we", 275);
freq.put("ng ", 405);
freq.put("shu", 187);
freq.put("shw", 458);
freq.put("h", 32492);
freq.put(" wi", 862);
freq.put("sha", 1745);
freq.put("she", 240);
freq.put("shi", 5099);
freq.put("ael", 172);
freq.put("ja ", 1529);
freq.put("sho", 271);
freq.put("Pr", 150);
freq.put("oma", 766);
freq.put("ke ", 1988);
freq.put("Pa", 858);
freq.put("ebr", 313);
freq.put("Pe", 270);
freq.put("Pi", 163);
freq.put("Po", 195);
freq.put("Ro", 385);
freq.put("ا", 240);
freq.put("lug", 350);
freq.put(" Ir", 284);
freq.put("kem", 150);
freq.put(" It", 181);
freq.put("kea", 156);
freq.put("S", 3343);
freq.put("ett", 212);
freq.put("lu ", 155);
freq.put("eta", 229);
freq.put("ete", 154);
freq.put("eti", 253);
freq.put(" aj", 134);
freq.put("ck", 301);
freq.put("ci", 283);
freq.put("ch", 7388);
freq.put("co", 390);
freq.put(" al", 2589);
freq.put("ca", 364);
freq.put("ce", 365);
freq.put("uch", 343);
freq.put("Jun", 259);
freq.put("Jul", 285);
freq.put("yar", 252);
freq.put("yam", 250);
freq.put("yao", 167);
freq.put("yan", 567);
freq.put("yak", 657);
freq.put("oto", 331);
freq.put("ota", 195);
freq.put("c ", 192);
freq.put("ote", 378);
freq.put("Ana", 176);
freq.put("é", 167);
freq.put("ya ", 21762);
freq.put("va", 328);
freq.put(" Fr", 177);
freq.put("ve", 578);
freq.put("vi", 1632);
freq.put("vo", 138);
freq.put(" Fa", 159);
freq.put(" Fe", 311);
freq.put("vu", 418);
freq.put("vy", 671);
freq.put("io ", 2960);
freq.put("of ", 150);
freq.put("ing", 1959);
freq.put("una", 1741);
freq.put("iop", 279);
freq.put("ion", 720);
freq.put("ofa", 3991);
freq.put("i", 164978);
freq.put(" Tu", 231);
freq.put(" To", 205);
freq.put(" Th", 274);
freq.put(" Te", 257);
freq.put(" Ta", 3838);
freq.put("mfa", 152);
freq.put("mfu", 373);
freq.put("Be", 362);
freq.put("Ba", 771);
freq.put("Bo", 282);
freq.put("Bi", 308);
freq.put("Bu", 429);
freq.put("ska", 599);
freq.put("Br", 278);
freq.put("ada", 637);
freq.put("wez", 265);
freq.put("sko", 136);
freq.put("adh", 288);
freq.put(" Ui", 243);
freq.put("T", 5185);
freq.put("we ", 401);
freq.put("Uin", 218);
freq.put("mhu", 232);
freq.put("nja", 269);
freq.put("a ", 143240);
freq.put("nji", 138);
freq.put("ts ", 214);
freq.put("est", 247);
freq.put("nd ", 409);
freq.put("ese", 306);
freq.put("esa", 279);
freq.put("esh", 359);
freq.put("Ut", 325);
freq.put("Us", 172);
freq.put("Ur", 181);
freq.put("Ul", 189);
freq.put("Un", 355);
freq.put("Ui", 244);
freq.put("Uh", 170);
freq.put("Uk", 150);
freq.put("Uj", 249);
freq.put("Uf", 251);
freq.put("Uc", 175);
freq.put("ndi", 1835);
freq.put("dun", 335);
freq.put("ndo", 574);
freq.put("nda", 1162);
freq.put("nde", 1085);
freq.put("kri", 520);
freq.put(" ji", 4522);
freq.put("es ", 640);
freq.put(" je", 226);
freq.put("ndu", 263);
freq.put("ea ", 663);
freq.put("h ", 704);
freq.put("aan", 389);
freq.put("Ame", 158);
freq.put("bur", 149);
freq.put("Des", 272);
freq.put("hw", 492);
freq.put("ht", 198);
freq.put("hu", 6825);
freq.put("hi", 11111);
freq.put("hn", 150);
freq.put("ho", 1180);
freq.put("ha", 8898);
freq.put("he", 2541);
freq.put("j", 21456);
freq.put("pil", 189);
freq.put("iny", 275);
freq.put("pin", 267);
freq.put("pia", 789);
freq.put("ins", 133);
freq.put("ino", 181);
freq.put("ini", 4598);
freq.put("ind", 834);
freq.put("ine", 479);
freq.put("pis", 162);
freq.put("pit", 144);
freq.put("ina", 8001);
freq.put("eo ", 852);
freq.put(" Ut", 325);
freq.put("oan", 188);
freq.put(" Ur", 181);
freq.put(" Us", 172);
freq.put(" Ul", 189);
freq.put(" Un", 355);
freq.put(" Uh", 170);
freq.put("es", 2258);
freq.put(" Uj", 249);
freq.put(" Uk", 150);
freq.put(" Uf", 251);
freq.put(" Uc", 175);
freq.put("ubw", 695);
freq.put("pi ", 233);
freq.put("Mtw", 147);
freq.put("U", 3120);
freq.put("uba", 185);
freq.put("aji", 1355);
freq.put("in ", 378);
freq.put("oa ", 3810);
}
}
| 25.885556 | 86 | 0.493089 |
86976a50a1b8a7f31a3abc8d7e72aa4bb756fab8 | 6,458 | /*
* Copyright (c) 2014. FRC Team 3309 All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer. Redistributions in binary
* form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided
* with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.team3309.friarlib.constants;
import com.sun.squawk.microedition.io.FileConnection;
import org.team3309.friarlib.util.Util;
import javax.microedition.io.Connector;
import java.io.IOException;
import java.io.InputStream;
import java.util.Hashtable;
import java.util.Vector;
public class ConstantsManager {
private static Hashtable constants = new Hashtable();
/**
* Add constant to the map
*
* @param c
*/
protected static void addConstant(Constant c) {
constants.put(c.getName(), c);
}
public static Constant getConstant(String key){
return (Constant) constants.get(key);
}
/**
* Load constants from a txt file on the cRIO
*
* @param path
* @throws java.io.IOException
*/
public static void loadConstantsFromFile(String path) throws IOException {
FileConnection fileConnection = (FileConnection) Connector.open("file:///" + path, Connector.READ);
loadConstants(fileConnection.openInputStream());
}
public static void loadConstants(InputStream inputStream) throws IOException {
byte[] buffer = new byte[255];
String content = "";
try {
// Read everything from the file into one string.
while (inputStream.read(buffer) != -1) {
content += new String(buffer);
}
inputStream.close();
// Extract each line separately.
String[] lines = split(content, "\n");
for (int j = 0; j < lines.length; j++) {
String line = lines[j].trim();
line = Util.remove(line, ' ');
line = Util.remove(line, '\t');
if (line.startsWith("#") || line.startsWith("//") || line.equals("")) {
continue;
}
if (!Util.contains(line, "=")) {
throw new IOException("Invalid format, line <" + line + "> does not contain equals sign");
}
String key = line.substring(0, line.indexOf("=")).trim();
String value = line.substring(line.indexOf("=") + 1);
//value is a list
if (Util.contains(value, ",")) {
String[] valStrings = split(value, ",");
boolean successful = true;
double[] val = new double[valStrings.length];
for (int i = 0; i < valStrings.length; i++) {
if (valStrings[i].equals("")) {
System.err.println("Malformed line <" + line + "> empty string in array");
successful = false;
break;
}
val[i] = Double.parseDouble(valStrings[i]);
}
if (successful) {
if (!constants.containsKey(key)) {
addConstant(new Constant(key, val));
} else {
System.err.println("Constant <" + key + "> will not be used");
}
}
} else {
if (constants.containsKey(key)) {
if (value.equals("")) {
System.err.println("Malformed line <" + line + "> empty string as value");
continue;
}
if (value.equals("true"))
((Constant) constants.get(key)).set(true);
else if (value.equals("false"))
((Constant) constants.get(key)).set(false);
else
((Constant) constants.get(key)).set(Double.parseDouble(value));
} else {
System.err.println("Constant <" + key + "> will not be used. Size of constants " + constants.size());
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
/**
* Returns the array of substrings obtained by dividing the given input
* string at each occurrence of the given delimiter.
*/
private static String[] split(String input, String delimiter) {
Vector node = new Vector();
int index = input.indexOf(delimiter);
while (index >= 0) {
node.addElement(input.substring(0, index));
input = input.substring(index + delimiter.length());
index = input.indexOf(delimiter);
}
node.addElement(input);
String[] retString = new String[node.size()];
for (int i = 0; i < node.size(); ++i) {
retString[i] = (String) node.elementAt(i);
}
return retString;
}
}
| 40.3625 | 126 | 0.533757 |
0c746372ad7bb96a15e858aad626c183b1859213 | 2,578 | // This class implements a Celsius-Fahrenheit converter
import java.awt.Color;
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JOptionPane;
public class Temperature extends JFrame
implements ActionListener
{
private JTextField displayF, displayC;
// Constructor
public Temperature()
{
Container c = getContentPane();
c.setLayout(new GridLayout(2, 2, 10, 0));
c.add(new JLabel(" Fahrenheit:"));
c.add(new JLabel(" Celsius:"));
displayF = new JTextField(6);
displayF.setBackground(Color.YELLOW);
displayF.addActionListener(this);
c.add(displayF);
displayC = new JTextField(6);
displayC.setBackground(Color.YELLOW);
displayC.addActionListener(this);
c.add(displayC);
}
// Invoked when <Enter> is pressed
public void actionPerformed(ActionEvent e)
{
FCConverter fc = new FCConverter();
if ((JTextField)e.getSource() == displayF)
{
// Fahrenheit to Celsius
double degrees = stringToDouble(displayF.getText());
if (!Double.isNaN(degrees))
{
fc.setFahrenheit(degrees);
degrees = fc.getCelsius();
displayC.setText(String.format("%1.1f", degrees));
}
else
{
displayF.selectAll();
}
}
else
{
// Celsius to Fahrenheit
double degrees = stringToDouble(displayC.getText());
if (!Double.isNaN(degrees))
{
fc.setCelsius(degrees);
degrees = fc.getFahrenheit();
displayF.setText(String.format("%1.1f", degrees));
}
else
{
displayC.selectAll();
}
}
}
// Extracts a double value from a string
private double stringToDouble(String s)
{
double degrees;
try
{
degrees = Double.parseDouble(s);
}
catch (NumberFormatException ex)
{
JOptionPane.showMessageDialog(null,
"Invalid Input", "Error", JOptionPane.ERROR_MESSAGE);
degrees = Double.NaN;
}
return degrees;
}
//**********************************************************************
public static void main(String[] args)
{
Temperature window = new Temperature();
window.setBounds(300, 300, 200, 80);
window.setDefaultCloseOperation(EXIT_ON_CLOSE);
window.setVisible(true);
}
}
| 25.029126 | 75 | 0.606284 |
b8421da91d3f882da7fe8b72236d3cfb57b044dd | 2,101 | package sql;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.sql.*;
import java.util.*;
public class JdbcConnection implements ActionListener
{
Connection conn;
JButton jb1=new JButton("插入");
JTextField jt1=new JTextField(8);
JTextField jt2=new JTextField(8);
JTextField jt3=new JTextField(8);
JTextField jt4=new JTextField(8);
JTextField jt5=new JTextField(8);
public JdbcConnection()
{
JFrame jf=new JFrame("插入框架");
jf.setBounds(400,300,500,400);
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel jp=new JPanel();
JLabel jl1=new JLabel("请输入要插入的学号:");
JLabel jl2=new JLabel("请输入要插入的姓名:");
JLabel jl3=new JLabel("请输入要插入的性别:");
JLabel jl4=new JLabel("请输入要插入的年龄:");
JLabel jl5=new JLabel("请输入要插入的院系:");
jb1.addActionListener(this);
jp.add(jl1);
jp.add(jt1);
jp.add(jl2);
jp.add(jt2);
jp.add(jl3);
jp.add(jt3);
jp.add(jl4);
jp.add(jt4);
jp.add(jl5);
jp.add(jt5);
jp.add(jb1);
jf.add(jp);
jf.setVisible(true);
}
public void insert()
{
String Sno=jt1.getText();
String Sname=jt2.getText();
String Ssex=jt3.getText();
int Sage=Integer.parseInt(jt4.getText());
String Sdept=jt5.getText();
try
{
PreparedStatement psm=conn.prepareStatement("insert into 学生表Students values(?,?,?,?,?)");
psm.setString(1,Sno);
psm.setString(2,Sname);
psm.setString(3,Ssex);
psm.setInt(4, Sage);
psm.setString(5,Sdept);
psm.executeUpdate();
psm.close();
conn.close();
JOptionPane.showMessageDialog(null,"记录保存成功!");
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"插入失败!");
}
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==jb1)
insert();
}
public static void main(String args[])
{
String url="jdbc:odbc:source2";
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection(url,"sa","");
System.out.println("连接成功!");
}
catch(Exception e)
{
System.out.println("连接失败!");
}
new JdbcConnection();
}
}
| 19.453704 | 92 | 0.658734 |
94f7e59c63899f0abb5bcac9b4da29bbdd9b163e | 443 | package com.zscat.mallplus.marking.vo;
import com.zscat.mallplus.pms.entity.PmsProduct;
import lombok.Getter;
import lombok.Setter;
import java.math.BigDecimal;
/**
* 秒杀信息和商品对象封装
* https://github.com/shenzhuan/mallplus on 2019/1/28.
*/
@Getter
@Setter
public class FlashPromotionProduct extends PmsProduct {
private BigDecimal flashPromotionPrice;
private Integer flashPromotionCount;
private Integer flashPromotionLimit;
}
| 21.095238 | 55 | 0.783296 |
65d0e8926931f1bebd85b6e9d48a5de9f8d5ec86 | 748 | package mil.dds.anet.emails;
import java.util.HashMap;
import java.util.Map;
import mil.dds.anet.AnetObjectEngine;
import mil.dds.anet.beans.Report;
public class ReportReleasedEmail extends AnetEmailAction {
Report report;
public ReportReleasedEmail() {
templateName = "/emails/reportReleased.ftl";
subject = "ANET Report Approved";
}
@Override
public Map<String, Object> execute() {
Report r = AnetObjectEngine.getInstance().getReportDao().getById(report.getId());
Map<String,Object> context = new HashMap<String,Object>();
context.put("report", r);
return context;
}
public Report getReport() {
return report;
}
public void setReport(Report report) {
this.report = Report.createWithId(report.getId());
}
}
| 21.371429 | 83 | 0.729947 |
b828b5e6af8cef3aedb6cf8cf76313e1bf6ac8cb | 19,584 | /*
* Copyright (C) 2014 Indeed Inc.
*
* 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.indeed.imhotep.web;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.indeed.util.core.io.Closeables2;
import com.indeed.imhotep.DatasetInfo;
import com.indeed.imhotep.client.ImhotepClient;
import com.indeed.imhotep.metadata.DatasetMetadata;
import com.indeed.imhotep.metadata.FieldMetadata;
import com.indeed.imhotep.metadata.FieldType;
import com.indeed.imhotep.metadata.MetricMetadata;
import org.apache.log4j.Logger;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.FileSystemResource;
import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.Nonnull;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.regex.Pattern;
/**
* @author vladimir
*/
public class ImhotepMetadataCache {
private static final Logger log = Logger.getLogger(ImhotepMetadataCache.class);
private LinkedHashMap<String, DatasetMetadata> datasets = Maps.newLinkedHashMap();
// TODO: integrate into the metadata above?
private volatile Map<String, Set<String>> datasetToKeywordAnaylzerWhitelist = Maps.newHashMap();
private final ImhotepClient imhotepClient;
private String ramsesMetadataPath;
private final List<Pattern> disabledFields = Lists.newArrayList();
public ImhotepMetadataCache(ImhotepClient client, String ramsesMetadataPath, String disabledFields) {
imhotepClient = client;
this.ramsesMetadataPath = ramsesMetadataPath;
if(disabledFields != null) {
for(String field : disabledFields.split(",")) {
try {
this.disabledFields.add(Pattern.compile(field.trim()));
} catch (Exception e) {
log.warn("Failed to compile regex pattern for disabled field: " + field);
}
}
}
}
// updated every 60s and actual shards in ImhotepClient are reloaded every 60s
@Scheduled(fixedRate = 60000)
public void updateDatasets() {
Map<String, DatasetInfo> datasetToShardList = imhotepClient.getDatasetToShardList();
List<String> datasetNames = new ArrayList<String>(datasetToShardList.keySet());
Collections.sort(datasetNames);
if(datasetNames.size() == 0) { // if we get no data, just keep what we already have
log.warn("Imhotep returns no datasets");
return;
}
// First make empty DatasetMetadata instances
final LinkedHashMap<String, DatasetMetadata> newDatasets = Maps.newLinkedHashMap();
for(String datasetName : datasetNames) {
final DatasetMetadata datasetMetadata = new DatasetMetadata(datasetName);
newDatasets.put(datasetName, datasetMetadata);
}
// Now pre-fill the metadata with fields from Imhotep
for(DatasetInfo datasetInfo : datasetToShardList.values()) {
List<String> dsIntFields = Lists.newArrayList(datasetInfo.getIntFields());
List<String> dsStringFields = Lists.newArrayList(datasetInfo.getStringFields());
removeDisabledFields(dsIntFields);
removeDisabledFields(dsStringFields);
Collections.sort(dsIntFields);
Collections.sort(dsStringFields);
final String datasetName = datasetInfo.getDataset();
final DatasetMetadata datasetMetadata = newDatasets.get(datasetName);
final LinkedHashMap<String, FieldMetadata> fieldMetadatas = datasetMetadata.getFields();
for(String intField : dsIntFields) {
fieldMetadatas.put(intField, new FieldMetadata(intField, FieldType.Integer));
}
for(String stringField : dsStringFields) {
fieldMetadatas.put(stringField, new FieldMetadata(stringField, FieldType.String));
}
}
// now load the metadata from files
loadMetadataFromFiles(newDatasets);
for(final DatasetMetadata datasetMetadata : newDatasets.values()) {
addStandardAliases(datasetMetadata);
datasetMetadata.finishLoading();
}
// new metadata instance is ready for use
datasets = newDatasets;
}
private void removeDisabledFields(List<String> fields) {
Iterator<String> iterator = fields.iterator();
while(iterator.hasNext()) {
final String field = iterator.next();
for(Pattern regex : disabledFields) {
if(regex.matcher(field).matches()) {
iterator.remove();
}
}
}
}
public LinkedHashMap<String, DatasetMetadata> getDatasets() {
return datasets;
}
@Nonnull
public DatasetMetadata getDataset(String dataset) {
if(!datasets.containsKey(dataset)) {
return new DatasetMetadata(dataset); // empty
}
return datasets.get(dataset);
}
public Set<String> getKeywordAnalyzerWhitelist(String dataset) {
if(!datasetToKeywordAnaylzerWhitelist.containsKey(dataset)) {
return Collections.emptySet();
}
return Collections.unmodifiableSet(datasetToKeywordAnaylzerWhitelist.get(dataset));
}
@Scheduled(fixedRate = 60000)
private void updateKeywordAnalyzerWhitelist() {
try {
File whitelistFile = new File(ramsesMetadataPath, "keywordAnalyzerWhitelist.json");
if (whitelistFile.exists()) {
final Map<String, Set<String>> newKeywordAnaylzerWhitelist = Maps.newHashMap();
FileInputStream is = new FileInputStream(whitelistFile);
ObjectMapper mapper = new ObjectMapper();
Map<String, List<String>> tmpMap = mapper.readValue(is, new TypeReference<Map<String,List<String>>>(){});
for (final String indexName : tmpMap.keySet()) {
final Set<String> whitelistedFields = Sets.newHashSet(tmpMap.get(indexName));
newKeywordAnaylzerWhitelist.put(indexName, whitelistedFields);
}
datasetToKeywordAnaylzerWhitelist = newKeywordAnaylzerWhitelist;
}
} catch (Exception e) {
log.warn("Failed to process keywordAnalyzerWhitelist.json", e);
}
}
private boolean loadMetadataFromFiles(LinkedHashMap<String, DatasetMetadata> newDatasetToAliases) {
File ramsesDir = new File(ramsesMetadataPath);
if(!ramsesDir.exists() || !ramsesDir.isDirectory()) {
log.error("Directory not found at " + ramsesMetadataPath);
return false;
}
File[] files = ramsesDir.listFiles();
if(files == null) {
log.error("Failed to stat directory at " + ramsesMetadataPath);
return false;
}
for(File indexDir : files) {
if(!indexDir.isDirectory()) {
continue;
}
final String indexName = indexDir.getName();
final DatasetMetadata datasetMetadata = newDatasetToAliases.get(indexName);
if(datasetMetadata == null) {
log.trace("Found dimensions data for unknown dataset: " + indexName);
continue;
}
loadDimensions(indexDir, datasetMetadata);
loadSuggestions(indexDir, datasetMetadata);
}
return true;
}
// aliases applicable to all indexes
private void addStandardAliases(DatasetMetadata datasetMetadata) {
MetricMetadata countsMetadata = datasetMetadata.getMetric("counts");
if(countsMetadata == null) {
countsMetadata = new MetricMetadata("counts");
datasetMetadata.getMetrics().put("counts", countsMetadata);
}
if(!datasetMetadata.isRamsesDataset()) { // for Ramses datasets we should allow counts to be pushed so that scaling can be applied
countsMetadata.setExpression("count()");
}
countsMetadata.setDescription("Count of all documents");
final String timeField = datasetMetadata.getTimeFieldName();
// make sure we have time field in Ramses indexes // TODO: why is it not returned by Imhotep?
if(datasetMetadata.isRamsesDataset()) {
final String ramsesTimeField = "time";
final String timeDescription = "Unix timestamp (seconds since epoch)";
MetricMetadata timeMetric = datasetMetadata.getMetric(ramsesTimeField);
if(timeMetric == null) {
timeMetric = new MetricMetadata(ramsesTimeField);
datasetMetadata.getMetrics().put(ramsesTimeField, timeMetric);
}
timeMetric.setDescription(timeDescription);
timeMetric.setUnit("seconds");
FieldMetadata timeFieldMetadata = datasetMetadata.getField(ramsesTimeField);
if(timeFieldMetadata == null) {
timeFieldMetadata = new FieldMetadata(ramsesTimeField, FieldType.String);
datasetMetadata.getFields().put(ramsesTimeField, timeFieldMetadata);
}
timeFieldMetadata.setDescription(timeDescription);
timeFieldMetadata.setType(FieldType.Integer);
}
tryAddMetricAlias("dayofweek", "(((" + timeField + "-280800)%604800)\\86400)", "day of week (days since Sunday)", datasetMetadata);
tryAddMetricAlias("timeofday", "((" + timeField + "-21600)%86400)", "time of day (seconds since midnight)", datasetMetadata);
}
private static Set<String> RESERVED_KEYWORDS = ImmutableSet.of("time", "bucket", "buckets", "lucene", "in");
private boolean tryAddMetricAlias(String metricName, String replacement, String description, DatasetMetadata datasetMetadata) {
// only add the alias if it's safe to do so. it shouldn't hide an existing field or be a reserved keyword
if(datasetMetadata.hasField(metricName)
&& !replacement.startsWith("floatscale") // allow floatscale operation to replace the original field as floats are not usable as is
|| RESERVED_KEYWORDS.contains(metricName)) {
log.trace("Skipped adding alias due to conflict: " + datasetMetadata.getName() + "." + metricName + "->" + replacement);
return false;
}
MetricMetadata metricMetadata = datasetMetadata.getMetric(metricName);
if(metricMetadata == null) {
metricMetadata = new MetricMetadata(metricName);
datasetMetadata.getMetrics().put(metricName, metricMetadata);
}
metricMetadata.setExpression(replacement);
if(description != null) {
metricMetadata.setDescription(description);
}
return true;
}
private void loadSuggestions(File indexDir, DatasetMetadata datasetMetadata) {
final File suggestionsXml = new File(indexDir, "suggestions.xml");
if (!suggestionsXml.exists()) {
return;
}
@SuppressWarnings("unchecked")
final Map<String, String> suggestions = (Map<String, String>) new XmlBeanFactory(new FileSystemResource(suggestionsXml)).getBean("suggestionMap");
if (suggestions != null) {
for(Map.Entry<String, String> suggestion : suggestions.entrySet()) {
datasetMetadata.addFieldMetricDescription(suggestion.getKey(), suggestion.getValue(), null, false, true, false);
}
}
}
/**
* Loads metrics descriptions and aliases for an index from a Ramses dimensions file
*/
private void loadDimensions(File indexDir, DatasetMetadata datasetMetadata) {
final File dimensionsFile = new File(indexDir, "dimensions.desc");
if(!dimensionsFile.exists()) {
return;
}
BufferedReader reader = null;
try {
final Map<String, Alias> fieldToAlias = Maps.newHashMap();
reader = new BufferedReader(new InputStreamReader(new FileInputStream(dimensionsFile)));
for(String line = reader.readLine(); line != null; line = reader.readLine()) {
if(line.startsWith("#")) {
if(line.startsWith("#/")) {
// dimension only for IQL but not ramses hack
line = line.substring(2);
} else {
continue;
}
}
String[] split = line.split(",");
if(split.length < 5) {
continue; // invalid field entry?
}
String name = split[0].trim();
String desc = split[1].trim();
String unit = split[2].trim();
final String dimType = split[3].trim();
if(Strings.isNullOrEmpty(unit) || "null".equals(unit)) {
unit = null;
}
if(Strings.isNullOrEmpty(desc) || "null".equals(desc)) {
desc = null;
}
boolean isHidden = name.startsWith("!");
if(isHidden) {
name = name.substring(1);
}
if(name.equals("time")) {
continue; // time is a reserved field/keyword
}
boolean metricHasField = false;
Alias alias = null;
if ("add".equals(dimType) || "subtract".equals(dimType) ||
"multiply".equals(dimType) || "divide".equals(dimType)) {
String dim1 = split[4].trim();
String dim2 = split[5].trim();
if (dim1.startsWith("!")) dim1 = dim1.substring(1);
if (dim2.startsWith("!")) dim2 = dim2.substring(1);
final String op;
if ("add".equals(dimType)) {
op = "+";
} else if ("subtract".equals(dimType)) {
op = "-";
} else if("divide".equals(dimType)) {
op = "\\";
} else {
op = "*";
}
alias = new CompositeOp(op, dim1, dim2, isHidden);
} else if("lossless".equals(dimType)) {
String realField = split[4].trim();
if(!name.equals(realField)) {
if(realField.startsWith("floatscale")) {
realField = realField.replace(' ', '(').replace('*', ',').replace('+', ',') + ')';
}
alias = new SimpleField(realField, isHidden);
} else {
metricHasField = true;
}
}
if(!(isHidden && alias != null)) { // if it's an aliased hidden metric, it's intermediary and we can skip it
datasetMetadata.addFieldMetricDescription(name, desc, unit, isHidden, metricHasField, true);
}
if(alias != null) {
fieldToAlias.put(name, alias);
}
}
// now that we have all the aliases loaded we can resolve them
for(Map.Entry<String, Alias> entry : fieldToAlias.entrySet()) {
final Alias alias = entry.getValue();
if(alias.hidden) {
continue; // this is just an intermediate metric
}
final String metricName = entry.getKey();
final String resolvedAlias = alias.resolve(fieldToAlias);
if(resolvedAlias == null) {
log.warn("Found a metric alias with a circular dependency which is illegal: " + datasetMetadata.getName() + "." + metricName);
continue;
}
tryAddMetricAlias(metricName, resolvedAlias, null, datasetMetadata);
log.trace("Aliasing: " + datasetMetadata.getName() + "." + metricName + "->" + resolvedAlias);
}
} catch (FileNotFoundException e) {
log.warn("Dimensions file read failed for " + indexDir, e);
} catch (IOException e) {
log.warn("Dimensions file read failed for " + indexDir, e);
} finally {
if(reader != null) {
Closeables2.closeQuietly(reader, log);
}
}
}
private static abstract class Alias {
boolean hidden;
protected Alias(boolean hidden) {
this.hidden = hidden;
}
abstract String resolve(Map<String,Alias> fieldToAlias);
}
private static class SimpleField extends Alias {
String fieldName;
private SimpleField(String fieldName, boolean hidden){
super(hidden);
this.fieldName = fieldName;
}
@Override
public String resolve(Map<String, Alias> fieldToAlias) {
return fieldName;
}
}
private static class CompositeOp extends Alias {
String operator;
String dim1;
String dim2;
boolean isSeen; // keeps track of whether the resolve process has already encountered this object
private CompositeOp(String operator, String dim1, String dim2, boolean hidden) {
super(hidden);
this.operator = operator;
this.dim1 = dim1;
this.dim2 = dim2;
}
@Override
public String resolve(Map<String, Alias> fieldToAlias) {
if(isSeen) { // protection from infinite recursion
return null;
}
final String dim1Resolved;
final String dim2Resolved;
isSeen = true;
try {
final Alias dim1Alias = fieldToAlias.get(dim1);
if(dim1Alias != null) {
dim1Resolved = dim1Alias.resolve(fieldToAlias);
} else {
dim1Resolved = dim1;
}
final Alias dim2Alias = fieldToAlias.get(dim2);
if(dim2Alias != null) {
dim2Resolved = dim2Alias.resolve(fieldToAlias);
} else {
dim2Resolved = dim2;
}
if(dim1Resolved == null || dim2Resolved == null) { // encountered a loop
return null;
}
} finally {
isSeen = false;
}
return "(" + dim1Resolved + operator + dim2Resolved + ")";
}
}
}
| 41.579618 | 154 | 0.595129 |
11ea635d619d0a3ec8b3a94a070b4445dfb05398 | 313 | package net.inconnection.charge.admin.account.model;
import net.inconnection.charge.admin.account.model.base.BaseZcurdField;
/**
* Generated by JFinal.
*/
@SuppressWarnings("serial")
public class ZcurdField extends BaseZcurdField<ZcurdField> {
public static final ZcurdField dao = new ZcurdField().dao();
}
| 24.076923 | 71 | 0.779553 |
a2a7eddb56394f53fa630749ae2c057079ad024e | 4,412 | /*
* Copyright 2021 the original author or authors.
* <p>
* 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
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openrewrite.java.cleanup;
import org.openrewrite.ExecutionContext;
import org.openrewrite.Incubating;
import org.openrewrite.Recipe;
import org.openrewrite.TreeVisitor;
import org.openrewrite.java.JavaIsoVisitor;
import org.openrewrite.java.JavaTemplate;
import org.openrewrite.java.JavaVisitor;
import org.openrewrite.java.MethodMatcher;
import org.openrewrite.java.search.UsesMethod;
import org.openrewrite.java.tree.J;
import java.time.Duration;
import java.util.Collections;
import java.util.Set;
@Incubating(since = "7.10.0")
public class IndexOfReplaceableByContains extends Recipe {
private static final MethodMatcher STRING_INDEX_MATCHER = new MethodMatcher("java.lang.String indexOf(String)");
private static final MethodMatcher LIST_INDEX_MATCHER = new MethodMatcher("java.util.List indexOf(Object)");
@Override
public String getDisplayName() {
return "`indexOf()` replaceable by `contains()`";
}
@Override
public String getDescription() {
return "Checking if a value is included in a `String` or `List` using `indexOf(value)>-1` or `indexOf(value)>=0` can be replaced with `contains(value)`.";
}
@Override
public Set<String> getTags() {
return Collections.singleton("RSPEC-2692");
}
@Override
public Duration getEstimatedEffortPerOccurrence() {
return Duration.ofMinutes(5);
}
@Override
protected TreeVisitor<?, ExecutionContext> getVisitor() {
return new IndexOfReplaceableByContainsVisitor();
}
@Override
protected TreeVisitor<?, ExecutionContext> getSingleSourceApplicableTest() {
return new JavaIsoVisitor<ExecutionContext>() {
@Override
public J.CompilationUnit visitCompilationUnit(J.CompilationUnit cu, ExecutionContext executionContext) {
doAfterVisit(new UsesMethod<>(STRING_INDEX_MATCHER));
doAfterVisit(new UsesMethod<>(LIST_INDEX_MATCHER));
return cu;
}
};
}
private static class IndexOfReplaceableByContainsVisitor extends JavaVisitor<ExecutionContext> {
private final JavaTemplate stringContains = JavaTemplate.builder(this::getCursor, "#{any(java.lang.String)}.contains(#{any(java.lang.String)})").build();
private final JavaTemplate listContains = JavaTemplate.builder(this::getCursor, "#{any(java.util.List)}.contains(#{any(java.lang.Object)})").build();
@Override
public J visitBinary(J.Binary binary, ExecutionContext ctx) {
J j = super.visitBinary(binary, ctx);
J.Binary asBinary = (J.Binary) j;
if (asBinary.getLeft() instanceof J.MethodInvocation) {
J.MethodInvocation mi = ((J.MethodInvocation) asBinary.getLeft());
if (STRING_INDEX_MATCHER.matches(mi) || LIST_INDEX_MATCHER.matches(mi)) {
if (asBinary.getRight() instanceof J.Literal) {
String valueSource = ((J.Literal) asBinary.getRight()).getValueSource();
boolean isGreaterThanNegativeOne = asBinary.getOperator() == J.Binary.Type.GreaterThan && "-1".equals(valueSource);
boolean isGreaterThanOrEqualToZero = asBinary.getOperator() == J.Binary.Type.GreaterThanOrEqual && "0".equals(valueSource);
if (isGreaterThanNegativeOne || isGreaterThanOrEqualToZero) {
j = mi.withTemplate(STRING_INDEX_MATCHER.matches(mi) ? stringContains : listContains,
mi.getCoordinates().replace(), mi.getSelect(), mi.getArguments().get(0)).withPrefix(asBinary.getPrefix());
}
}
}
}
return j;
}
}
}
| 43.254902 | 162 | 0.674071 |
1ece105cf22aae742b5020ec658ea4b361fcecbf | 2,787 | package controller.operations;
import controller.IImageProcessorController;
import controller.imageutil.ImageUtil;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Objects;
import javax.imageio.ImageIO;
import model.IImageProcessorModel;
import model.image.IImage;
import view.IImageProcessorModelView;
/**
* This class contains the operation necessary to export a single layer to a destination of the
* user's choice.
*/
public class ExportLayerOperation implements IProcessorOperation {
private final String format;
/**
* Constructs an instance of ExportLayerOperation containing the information necessary to export
* a single layer to the desktop.
* @param format the desired format
*/
public ExportLayerOperation(String format) {
this.format = format;
}
@Override
public void operate(
IImageProcessorModel model,
IImageProcessorModelView view,
IImageProcessorController controller) {
Objects.requireNonNull(this.format);
String home = System.getProperty("user.dir");
String imagePath = home + File.separator + "images" + File.separator;
IImage image = null;
String id = null;
try {
id = model.getTopVisibleLayerID();
image = model.getLayer(id);
} catch (IllegalStateException ise) {
try {
view.renderMessage(ise.getMessage() + "\n");
} catch (IOException ioe) {
// do nothing
}
}
catch (NullPointerException npe) {
try {
view.renderMessage("Can't export null layer\n");
} catch (IOException ioe) {
// do nothing
}
}
File outputfile = new File(imagePath + id + "." + this.format);
if (this.format.equals("ppm")) {
try {
ImageUtil.exportRGBImageAsPPM(image, outputfile);
try {
view.renderMessage("PPM image exported\n");
} catch (IOException ioe) {
// do nothing
}
} catch (NullPointerException npe) {
try {
view.renderMessage("Can't export null image\n");
} catch (IOException ioe) {
// do nothing
}
}
} else {
try {
BufferedImage bi = ImageUtil.convertRGBImageToBufferedImage(image);
outputfile = new File(imagePath + model.getTopVisibleLayerID() + "." + this.format);
ImageIO.write(bi, this.format, outputfile);
} catch (NullPointerException npe) {
try {
view.renderMessage("Can't export null image\n");
} catch (IOException ioe) {
// do nothing
}
} catch (IOException e) {
try {
view.renderMessage("Failed to export image\n");
} catch (IOException ioe) {
// do nothing
}
}
}
}
}
| 27.594059 | 98 | 0.635091 |
a8afe653ccec3db26f0141ac261ffdef2c72401f | 2,909 | /*
* The MIT License (MIT)
*
* Copyright (c) liachmodded <https://github.com/liachmodded>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.github.liachmodded.liachlitemod;
import com.google.common.collect.Lists;
import com.mumfrey.liteloader.PostRenderListener;
import com.mumfrey.liteloader.Tickable;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityFallingBlock;
import java.awt.Color;
import java.io.File;
import java.util.List;
/**
* Created by liach on 4/23/2016.
*
* @author liach
*/
public class LiteModLiachLitemod implements Tickable, PostRenderListener {
private static final String NAME = "liachlitemod";
private static final String VERSION = "0.1-SNAPSHOT";
private final List<Entity> blocks = Lists.newCopyOnWriteArrayList();
@Override public String getVersion() {
return VERSION;
}
@Override public void init(File configPath) {
}
@Override public void upgradeSettings(String version, File configPath, File oldConfigPath) {
}
@Override public String getName() {
return NAME;
}
@Override public void onPostRenderEntities(float partialTicks) {
}
@Override public void onPostRender(float partialTicks) {
blocks.stream().forEach(entity -> Util.drawESPForEntity(entity, Color.RED));
}
@Override public void onTick(Minecraft minecraft, float partialTicks, boolean inGame, boolean clock) {
if (inGame && clock) {
WorldClient world = minecraft.theWorld;
if (world == null) {
return;
}
blocks.clear();
world.loadedEntityList.stream().filter(e -> e instanceof EntityFallingBlock).forEach(blocks::add);
}
}
}
| 33.056818 | 110 | 0.720179 |
3b726ca839b094c9b5be5ccab26c7a54592935a7 | 5,064 | /*
* Copyright (c) 2013 Philipp Meinen <philipp@bind.ch>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software
* is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
* THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package ch.bind.philib.util;
import ch.bind.philib.TestUtil;
import ch.bind.philib.math.Calc;
import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.Semaphore;
public class QueueBench {
public static void main(String[] args) throws Exception {
printHeader();
testRange(new LinkedBlockingQueue<>());
testRange(new ArrayBlockingQueue<>(10000));
testRange(new ConcurrentLinkedQueue<>());
}
private static void printHeader() {
System.out.print("name,");
for (int np = 1; np <= 5; np++) {
for (int nc = 1; nc <= 5; nc++) {
System.out.printf("%dp%dc,", np, nc);
}
}
System.out.println();
}
private static void testRange(Queue<Integer> queue) throws Exception {
final int N = 10000000;
System.out.print(queue.getClass().getSimpleName() + ',');
for (int np = 1; np <= 5; np++) {
for (int nc = 1; nc <= 5; nc++) {
long t = test(np, nc, N, queue);
double nsPerOp = ((double) t) / ((double) N);
System.out.printf("%.3f,", nsPerOp);
}
}
System.out.println();
}
private static long test(int nProducer, int nConsumer, int n, Queue<Integer> queue) throws Exception {
Semaphore ctrl = new Semaphore(0);
Producer[] ps = new Producer[nProducer];
Consumer[] cs = new Consumer[nConsumer];
int workPerP = n / nProducer;
int workLastP = n - ((nProducer - 1) * workPerP);
int workPerC = n / nConsumer;
int workLastC = n - ((nConsumer - 1) * workPerC);
for (int i = 0, start = 1; i < nProducer; i++, start += workPerP) {
int work = workPerP;
if (i == nProducer - 1) {
work = workLastP;
}
ps[i] = new Producer(queue, work, start, ctrl);
Thread t = new Thread(ps[i], "producer-" + i);
t.start();
}
for (int i = 0; i < nConsumer; i++) {
int work = workPerC;
if (i == nConsumer - 1) {
work = workLastC;
}
cs[i] = new Consumer(queue, work, ctrl);
Thread t = new Thread(cs[i], "consumer-" + i);
t.start();
}
TestUtil.gcAndSleep(2000);
long tstart = System.nanoTime();
ctrl.release(nProducer + nConsumer);
while (ctrl.availablePermits() > 0) {
Thread.yield();
}
ctrl.acquire(nProducer + nConsumer);
long tend = System.nanoTime();
long t = tend - tstart;
// System.out.println("time: " + t);
long expsum = Calc.sumOfRange(n);
long gotsum = 0;
for (Consumer c : cs) {
gotsum += c.sum;
}
if (expsum != gotsum) {
System.out.printf("sums do not line uf, expected=%d, got=%d\n", expsum, gotsum);
}
return t;
}
private static final class Producer implements Runnable {
final Queue<Integer> queue;
final int num;
final int start;
final Semaphore ctrl;
public Producer(Queue<Integer> queue, int num, int start, Semaphore ctrl) {
this.queue = queue;
this.num = num;
this.start = start;
this.ctrl = ctrl;
}
@Override
public void run() {
try {
ctrl.acquire();
for (int i = 0, v = start; i < num; i++, v++) {
Integer vi = v;
while (!queue.offer(vi)) {
Thread.yield();
}
}
} catch (InterruptedException e) {
System.out.println("producer interrupted");
System.exit(1);
} finally {
ctrl.release();
}
}
}
private static final class Consumer implements Runnable {
final Queue<Integer> queue;
final int num;
final Semaphore ctrl;
long sum;
public Consumer(Queue<Integer> queue, int num, Semaphore ctrl) {
this.queue = queue;
this.num = num;
this.ctrl = ctrl;
}
@Override
public void run() {
try {
ctrl.acquire();
for (int i = 0; i < num; i++) {
Integer v;
while ((v = queue.poll()) == null) {
Thread.yield();
}
sum += v;
}
} catch (InterruptedException e) {
System.out.println("consumer interrupted");
System.exit(1);
} finally {
ctrl.release();
}
}
}
}
| 26.793651 | 103 | 0.649882 |
038936f7356dff45739c600e0fe024c59457a4c0 | 2,604 | /*
* 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.
*
* Copyright 2012-2018 the original author or authors.
*/
package org.assertj.swing.awt;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.swing.core.BasicRobot.robotWithNewAwtHierarchy;
import static org.assertj.swing.edt.GuiActionRunner.execute;
import static org.assertj.swing.test.query.ContainerInsetsQuery.insetsOf;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import org.assertj.swing.annotation.RunsInEDT;
import org.assertj.swing.core.Robot;
import org.assertj.swing.test.swing.TestWindow;
import org.junit.Test;
/**
* Tests for {@link AWT#insetsFrom(java.awt.Container)}.
*
* @author Alex Ruiz
*/
public class AWT_insetsFromContainer_Test {
private static final Insets EMPTY_INSETS = new Insets(0, 0, 0, 0);
@Test
public void should_Return_Insets_From_Container() {
Robot robot = robotWithNewAwtHierarchy();
TestWindow window = TestWindow.createNewWindow(getClass());
try {
robot.showWindow(window, new Dimension(500, 300));
Insets insets = insetsFrom(window);
assertThat(insets).isEqualTo(insetsOf(window));
} finally {
robot.cleanUp();
}
}
@Test
public void should_Return_Empty_Insets_If_Exception_Thrown() {
Insets insets = insetsFrom(null);
assertThat(insets).isEqualTo(EMPTY_INSETS);
}
@Test
public void should_Return_Empty_Insets_If_Container_Insets_Is_Null() {
TestWindow window = WindowWithNullInsets.createNew();
Insets insets = insetsFrom(window);
assertThat(insets).isEqualTo(EMPTY_INSETS);
}
@RunsInEDT
private static Insets insetsFrom(final Container c) {
return execute(() -> AWT.insetsFrom(c));
}
private static class WindowWithNullInsets extends TestWindow {
@RunsInEDT
static WindowWithNullInsets createNew() {
return execute(() -> new WindowWithNullInsets());
}
private WindowWithNullInsets() {
super(AWT_insetsFromContainer_Test.class);
}
@Override
public Insets getInsets() {
return null;
}
}
}
| 31 | 118 | 0.740399 |
2e049d4227a2957148b9552bda8ac9c735284a72 | 864 | package com.skcraft.plume.common.util.event;
import static com.google.common.base.Preconditions.checkNotNull;
class Subscriber {
private final Class<?> eventClass;
private final Handler handler;
private final Order order;
Subscriber(Class<?> eventClass, Handler handler) {
this(eventClass, handler, Order.DEFAULT);
}
Subscriber(Class<?> eventClass, Handler handler, Order order) {
checkNotNull(eventClass, "eventClass");
checkNotNull(handler, "handler");
checkNotNull(order, "order");
this.eventClass = eventClass;
this.handler = handler;
this.order = order;
}
public Class<?> getEventClass() {
return this.eventClass;
}
public Handler getHandler() {
return this.handler;
}
public Order getOrder() {
return this.order;
}
}
| 23.351351 | 67 | 0.645833 |
d662b4e22076e35ce7cb0df9dea5a1ecf29e0eeb | 759 | package org.openqa.selenium.devtools.network.model;
import org.openqa.selenium.Beta;
import org.openqa.selenium.json.JsonInput;
/**
* Monotonically increasing time in seconds since an arbitrary point in the past.
*/
public class MonotonicTime {
private final java.lang.Number monotonicTime;
public MonotonicTime(java.lang.Number monotonicTime) {
this.monotonicTime = java.util.Objects.requireNonNull(monotonicTime, "Missing value for MonotonicTime");
}
private static MonotonicTime fromJson(JsonInput input) {
return new MonotonicTime(input.nextNumber());
}
public String toJson() {
return monotonicTime.toString();
}
public String toString() {
return monotonicTime.toString();
}
}
| 26.172414 | 112 | 0.719368 |
6c2e7cc1c627ff3dd5c1f813f73c683ab0cd6bf6 | 2,484 | /*
* Copyright (c) 2018 Paweł Cholewa
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.mcpg.nbt;
public enum TagType
{
TAG_END("TAG_End", 0, TagEnd.class),
TAG_BYTE("TAG_Byte", 1, TagByte.class),
TAG_SHORT("TAG_Short", 2, TagShort.class),
TAG_INT("TAG_Int", 3, TagInt.class),
TAG_LONG("TAG_Long", 4, TagLong.class),
TAG_FLOAT("TAG_Float", 5, TagFloat.class),
TAG_DOUBLE("TAG_Double", 6, TagDouble.class),
TAG_BYTE_ARRAY("TAG_Byte_Array", 7, TagByteArray.class),
TAG_STRING("TAG_String", 8, TagString.class),
TAG_LIST("TAG_List", 9, TagList.class),
TAG_COMPOUND("TAG_Compound", 10, TagCompound.class),
TAG_INT_ARRAY("TAG_Int_Array", 11, TagIntArray.class),
TAG_LONG_ARRAY("TAG_Long_Array", 12, TagLongArray.class);
private final String name;
private final int id;
private final Class<? extends Tag<?>> clazz;
TagType(String name, int id, Class<? extends Tag<?>> clazz)
{
this.name = name;
this.id = id;
this.clazz = clazz;
}
public String getName()
{
return name;
}
public int getId()
{
return id;
}
public Class<? extends Tag<?>> getClazz()
{
return clazz;
}
public static TagType byId(int id)
{
for (TagType type : values())
{
if (type.id == id)
{
return type;
}
}
return null;
}
}
| 33.12 | 121 | 0.667874 |
4f3870829c32d13c4cd9a883d57d1e1e50905764 | 7,518 | /**
DERT is a viewer for digital terrain models created from data collected during NASA missions.
DERT is Released in under the NASA Open Source Agreement (NOSA) found in the “LICENSE” folder where you
downloaded DERT.
DERT includes 3rd Party software. The complete copyright notice listing for DERT is:
Copyright © 2015 United States Government as represented by the Administrator of the National Aeronautics and
Space Administration. No copyright is claimed in the United States under Title 17, U.S.Code. All Other Rights
Reserved.
Desktop Exploration of Remote Terrain (DERT) could not have been written without the aid of a number of free,
open source libraries. These libraries and their notices are listed below. Find the complete third party license
listings in the separate “DERT Third Party Licenses” pdf document found where you downloaded DERT in the
LICENSE folder.
JogAmp Ardor3D Continuation
Copyright © 2008-2012 Ardor Labs, Inc.
JogAmp
Copyright 2010 JogAmp Community. All rights reserved.
JOGL Portions Sun Microsystems
Copyright © 2003-2009 Sun Microsystems, Inc. All Rights Reserved.
JOGL Portions Silicon Graphics
Copyright © 1991-2000 Silicon Graphics, Inc.
Light Weight Java Gaming Library Project (LWJGL)
Copyright © 2002-2004 LWJGL Project All rights reserved.
Tile Rendering Library - Brian Paul
Copyright © 1997-2005 Brian Paul. All Rights Reserved.
OpenKODE, EGL, OpenGL , OpenGL ES1 & ES2
Copyright © 2007-2010 The Khronos Group Inc.
Cg
Copyright © 2002, NVIDIA Corporation
Typecast - David Schweinsberg
Copyright © 1999-2003 The Apache Software Foundation. All rights reserved.
PNGJ - Herman J. Gonzalez and Shawn Hartsock
Copyright © 2004 The Apache Software Foundation. All rights reserved.
Apache Harmony - Open Source Java SE
Copyright © 2006, 2010 The Apache Software Foundation.
Guava
Copyright © 2010 The Guava Authors
GlueGen Portions
Copyright © 2010 JogAmp Community. All rights reserved.
GlueGen Portions - Sun Microsystems
Copyright © 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
SPICE
Copyright © 2003, California Institute of Technology.
U.S. Government sponsorship acknowledged.
LibTIFF
Copyright © 1988-1997 Sam Leffler
Copyright © 1991-1997 Silicon Graphics, Inc.
PROJ.4
Copyright © 2000, Frank Warmerdam
LibJPEG - Independent JPEG Group
Copyright © 1991-2018, Thomas G. Lane, Guido Vollbeding
Disclaimers
No Warranty: THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY OF ANY KIND,
EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY
THAT THE SUBJECT SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR FREEDOM FROM INFRINGEMENT, ANY
WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR FREE, OR ANY WARRANTY THAT
DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE SUBJECT SOFTWARE. THIS AGREEMENT
DOES NOT, IN ANY MANNER, CONSTITUTE AN ENDORSEMENT BY GOVERNMENT AGENCY OR ANY
PRIOR RECIPIENT OF ANY RESULTS, RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR
ANY OTHER APPLICATIONS RESULTING FROM USE OF THE SUBJECT SOFTWARE. FURTHER,
GOVERNMENT AGENCY DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING THIRD-PARTY
SOFTWARE, IF PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES IT "AS IS."
Waiver and Indemnity: RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST THE UNITED
STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR
RECIPIENT. IF RECIPIENT'S USE OF THE SUBJECT SOFTWARE RESULTS IN ANY LIABILITIES,
DEMANDS, DAMAGES, EXPENSES OR LOSSES ARISING FROM SUCH USE, INCLUDING ANY DAMAGES
FROM PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT'S USE OF THE SUBJECT SOFTWARE,
RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE UNITED STATES GOVERNMENT, ITS
CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT, TO THE EXTENT
PERMITTED BY LAW. RECIPIENT'S SOLE REMEDY FOR ANY SUCH MATTER SHALL BE THE IMMEDIATE,
UNILATERAL TERMINATION OF THIS AGREEMENT.
**/
package gov.nasa.arc.dert.scene.featureset;
import gov.nasa.arc.dert.landscape.quadtree.QuadTree;
import gov.nasa.arc.dert.scenegraph.GroupNode;
import gov.nasa.arc.dert.state.FeatureSetState;
import gov.nasa.arc.dert.view.Console;
import java.awt.EventQueue;
import java.util.ArrayList;
import java.util.Properties;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.swing.JTextField;
import com.ardor3d.renderer.state.TextureState;
import com.ardor3d.renderer.state.ZBufferState;
import com.ardor3d.scenegraph.Spatial;
import com.ardor3d.scenegraph.event.DirtyType;
import com.ardor3d.scenegraph.hint.CullHint;
/**
* Provides a set of FeatureSet map elements.
*
*/
public class FeatureSets extends GroupNode {
// List of FeatureSets
private ArrayList<FeatureSetState> featureSetList;
// Thread service for updating
private ExecutorService executor;
private ZBufferState zBufferState;
/**
* Constructor
*
* @param featureSetList
*/
public FeatureSets(ArrayList<FeatureSetState> featureSetList) {
super("FeatureSets");
this.featureSetList = featureSetList;
executor = Executors.newFixedThreadPool(5);
}
/**
* Initialize this FeatureSets object
*/
public void initialize() {
TextureState ts = new TextureState();
ts.setEnabled(false);
setRenderState(ts);
getSceneHints().setCullHint(CullHint.Dynamic);
for (int i = 0; i < featureSetList.size(); ++i) {
FeatureSetState state = featureSetList.get(i);
addFeatureSet(state, false, null);
}
zBufferState = new ZBufferState();
zBufferState.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo);
zBufferState.setEnabled(true);
setRenderState(zBufferState);
}
/**
* The landscape has changed, update the elevation of all the FeatureSets
*
* @param quadTree
*/
public void landscapeChanged(final QuadTree quadTree) {
for (int i = 0; i < getNumberOfChildren(); ++i) {
final Spatial child = getChild(i);
Runnable runnable = new Runnable() {
@Override
public void run() {
Thread.yield();
boolean modified = ((FeatureSet) child).updateElevation(quadTree);
if (modified) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
child.markDirty(DirtyType.Bounding);
}
});
}
}
};
executor.execute(runnable);
}
}
/**
* Add a FeatureSet to the list
*
* @param state
* @param update
* @return
*/
public FeatureSet addFeatureSet(FeatureSetState state, boolean update, JTextField msgField) {
try {
FeatureSet featureSet = new FeatureSet(state);
attachChild(featureSet);
markDirty(DirtyType.RenderState);
if (update) {
featureSet.updateGeometricState(0, true);
}
return (featureSet);
} catch (Exception e) {
Console.println(e.getMessage());
if (msgField != null)
msgField.setText(e.getMessage());
e.printStackTrace();
return (null);
}
}
/**
* Show all FeatureSets
*
* @param visible
*/
public void setAllVisible(boolean visible) {
for (int i = 0; i < getNumberOfChildren(); ++i) {
((FeatureSet) getChild(i)).setVisible(visible);
}
}
public void setOnTop(boolean onTop) {
zBufferState.setEnabled(!onTop);
}
public boolean isOnTop() {
return(!zBufferState.isEnabled());
}
/**
* Save defaults
*
* @param properties
*/
public static void saveDefaultsToProperties(Properties properties) {
FeatureSet.saveDefaultsToProperties(properties);
}
}
| 30.192771 | 112 | 0.757249 |
d15e4dbb2102a08b7c753b17cd703366d0fbfa63 | 4,341 | package com.ctrip.hermes.core.transport.command.processor;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.unidal.lookup.annotation.Inject;
import org.unidal.lookup.annotation.Named;
import com.ctrip.hermes.core.config.CoreConfig;
import com.ctrip.hermes.core.constants.CatConstants;
import com.ctrip.hermes.core.status.StatusMonitor;
import com.ctrip.hermes.core.transport.ManualRelease;
import com.ctrip.hermes.core.transport.command.Command;
import com.ctrip.hermes.core.transport.command.CommandType;
import com.ctrip.hermes.core.utils.HermesThreadFactory;
import com.dianping.cat.Cat;
@Named(type = CommandProcessorManager.class)
public class CommandProcessorManager implements Initializable {
private static final Logger log = LoggerFactory.getLogger(CommandProcessorManager.class);
@Inject
private CommandProcessorRegistry m_registry;
@Inject
private CoreConfig m_config;
private Map<CommandProcessor, ExecutorService> m_executors = new ConcurrentHashMap<CommandProcessor, ExecutorService>();
private AtomicBoolean m_stopped = new AtomicBoolean(false);
public void offer(final CommandProcessorContext ctx) {
if (m_stopped.get()) {
return;
}
Command cmd = ctx.getCommand();
final CommandType type = cmd.getHeader().getType();
final CommandProcessor processor = m_registry.findProcessor(type);
if (processor == null) {
log.error("Command processor not found for type {}", type);
} else {
StatusMonitor.INSTANCE.commandReceived(type, ctx.getRemoteIp());
ExecutorService executorService = m_executors.get(processor);
if (executorService == null) {
throw new IllegalArgumentException(String.format("No executor associated to processor %s", processor
.getClass().getSimpleName()));
} else {
executorService.submit(new Runnable() {
@Override
public void run() {
Command cmd = ctx.getCommand();
if (cmd.getReceiveTime() > 0
&& (System.currentTimeMillis() - cmd.getReceiveTime()) > m_config
.getCommandProcessorCmdExpireMillis()) {
Cat.logEvent(CatConstants.TYPE_CMD_DROP, cmd.getHeader().getType().toString());
if (cmd.getClass().isAnnotationPresent(ManualRelease.class)) {
cmd.release();
}
return;
}
long start = System.currentTimeMillis();
try {
processor.process(ctx);
} catch (Exception e) {
StatusMonitor.INSTANCE.commandProcessorException(type, processor);
log.error("Exception occurred while process command.", e);
} finally {
StatusMonitor.INSTANCE.commandProcessed(type, (System.currentTimeMillis() - start));
}
}
});
}
}
}
@Override
public void initialize() throws InitializationException {
Set<CommandProcessor> cmdProcessors = m_registry.listAllProcessors();
for (CommandProcessor cmdProcessor : cmdProcessors) {
String threadNamePrefix = String.format("CmdProcessor-%s", cmdProcessor.getClass().getSimpleName());
ExecutorService executor = null;
BlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<Runnable>();
int threadCount = m_config.getCommandProcessorDefaultThreadCount();
if (cmdProcessor.getClass().isAnnotationPresent(ThreadCount.class)) {
threadCount = cmdProcessor.getClass().getAnnotation(ThreadCount.class).value();
}
executor = new ThreadPoolExecutor(threadCount, threadCount, 0L, TimeUnit.MILLISECONDS, workQueue,
HermesThreadFactory.create(threadNamePrefix, false));
m_executors.put(cmdProcessor, executor);
StatusMonitor.INSTANCE.watchCommandProcessorQueue(threadNamePrefix, workQueue);
}
}
public void stop() {
if (m_stopped.compareAndSet(false, true)) {
for (ExecutorService executor : m_executors.values()) {
executor.shutdown();
}
}
}
}
| 34.181102 | 121 | 0.750749 |
9cdf1fe46282d3f4819cce6e22a8abce8ed07486 | 1,174 | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.webbeans.portable.events;
public abstract class EventBase
{
private boolean started;
public void setStarted()
{
started = true;
}
protected void checkState()
{
if (started)
{
throw new IllegalStateException("only call container event methods in their correct lifecycle");
}
}
}
| 30.894737 | 108 | 0.713799 |
4065abc8c46d94707e5e7c759ac6197cd4349c35 | 6,194 | package com.egoveris.te.base.model;
import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
/**
* Solicitante del inicio de un expediente.
*
* @author rgalloci
*
*/
@Entity
@Table(name="SOLICITANTE")
public class Solicitante implements Serializable{
private static final long serialVersionUID = 2977983441580077390L;
@Id
@Column(name="ID_SOLICITANTE")
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name="ID_DOCUMENTO")
private DocumentoDeIdentidad documento;
@Column(name="EMAIL")
private String email;
@Column(name="TELEFONO")
private String telefono;
@Column(name="NOMBRE_SOLICITANTE")
private String nombreSolicitante;
@Column(name="SEGUNDO_NOMBRE_SOLICITANTE")
private String segundoNombreSolicitante;
@Column(name="TERCER_NOMBRE_SOLICITANTE")
private String tercerNombreSolicitante;
@Column(name="APELLIDO_SOLICITANTE")
private String apellidoSolicitante;
@Column(name="SEGUNDO_APELLIDO_SOLICITANTE")
private String segundoApellidoSolicitante;
@Column(name="TERCER_APELLIDO_SOLICITANTE")
private String tercerApellidoSolicitante;
@Column(name="RAZON_SOCIAL_SOLICITANTE")
private String razonSocialSolicitante;
@Column(name="CUIT_CUIL")
private String cuitCuil;
@Column(name="DOMICILIO")
private String domicilio;
@Column(name="PISO")
private String piso;
@Column(name="DEPARTAMENTO")
private String departamento;
@Column(name="CODIGO_POSTAL")
private String codigoPostal;
/**
* @return the id
*/
public Long getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return the documento
*/
public DocumentoDeIdentidad getDocumento() {
return documento;
}
/**
* @param documento the documento to set
*/
public void setDocumento(DocumentoDeIdentidad documento) {
this.documento = documento;
}
/**
* @return the email
*/
public String getEmail() {
return email;
}
/**
* @param email the email to set
*/
public void setEmail(String email) {
this.email = email;
}
/**
* @return the telefono
*/
public String getTelefono() {
return telefono;
}
/**
* @param telefono the telefono to set
*/
public void setTelefono(String telefono) {
this.telefono = telefono;
}
/**
* @return the nombreSolicitante
*/
public String getNombreSolicitante() {
return nombreSolicitante;
}
/**
* @param nombreSolicitante the nombreSolicitante to set
*/
public void setNombreSolicitante(String nombreSolicitante) {
this.nombreSolicitante = nombreSolicitante;
}
/**
* @return the segundoNombreSolicitante
*/
public String getSegundoNombreSolicitante() {
return segundoNombreSolicitante;
}
/**
* @param segundoNombreSolicitante the segundoNombreSolicitante to set
*/
public void setSegundoNombreSolicitante(String segundoNombreSolicitante) {
this.segundoNombreSolicitante = segundoNombreSolicitante;
}
/**
* @return the tercerNombreSolicitante
*/
public String getTercerNombreSolicitante() {
return tercerNombreSolicitante;
}
/**
* @param tercerNombreSolicitante the tercerNombreSolicitante to set
*/
public void setTercerNombreSolicitante(String tercerNombreSolicitante) {
this.tercerNombreSolicitante = tercerNombreSolicitante;
}
/**
* @return the apellidoSolicitante
*/
public String getApellidoSolicitante() {
return apellidoSolicitante;
}
/**
* @param apellidoSolicitante the apellidoSolicitante to set
*/
public void setApellidoSolicitante(String apellidoSolicitante) {
this.apellidoSolicitante = apellidoSolicitante;
}
/**
* @return the segundoApellidoSolicitante
*/
public String getSegundoApellidoSolicitante() {
return segundoApellidoSolicitante;
}
/**
* @param segundoApellidoSolicitante the segundoApellidoSolicitante to set
*/
public void setSegundoApellidoSolicitante(String segundoApellidoSolicitante) {
this.segundoApellidoSolicitante = segundoApellidoSolicitante;
}
/**
* @return the tercerApellidoSolicitante
*/
public String getTercerApellidoSolicitante() {
return tercerApellidoSolicitante;
}
/**
* @param tercerApellidoSolicitante the tercerApellidoSolicitante to set
*/
public void setTercerApellidoSolicitante(String tercerApellidoSolicitante) {
this.tercerApellidoSolicitante = tercerApellidoSolicitante;
}
/**
* @return the razonSocialSolicitante
*/
public String getRazonSocialSolicitante() {
return razonSocialSolicitante;
}
/**
* @param razonSocialSolicitante the razonSocialSolicitante to set
*/
public void setRazonSocialSolicitante(String razonSocialSolicitante) {
this.razonSocialSolicitante = razonSocialSolicitante;
}
/**
* @return the cuitCuil
*/
public String getCuitCuil() {
return cuitCuil;
}
/**
* @param cuitCuil the cuitCuil to set
*/
public void setCuitCuil(String cuitCuil) {
this.cuitCuil = cuitCuil;
}
/**
* @return the domicilio
*/
public String getDomicilio() {
return domicilio;
}
/**
* @param domicilio the domicilio to set
*/
public void setDomicilio(String domicilio) {
this.domicilio = domicilio;
}
/**
* @return the piso
*/
public String getPiso() {
return piso;
}
/**
* @param piso the piso to set
*/
public void setPiso(String piso) {
this.piso = piso;
}
/**
* @return the departamento
*/
public String getDepartamento() {
return departamento;
}
/**
* @param departamento the departamento to set
*/
public void setDepartamento(String departamento) {
this.departamento = departamento;
}
/**
* @return the codigoPostal
*/
public String getCodigoPostal() {
return codigoPostal;
}
/**
* @param codigoPostal the codigoPostal to set
*/
public void setCodigoPostal(String codigoPostal) {
this.codigoPostal = codigoPostal;
}
}
| 20.442244 | 79 | 0.738457 |
5e195f7b420bfd34a924d84f2c19f115dd49a9c2 | 2,406 | /*
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file 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.amazon.opendistroforelasticsearch.ad.model;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import java.io.IOException;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import test.com.amazon.opendistroforelasticsearch.ad.util.JsonDeserializer;
import com.amazon.opendistroforelasticsearch.ad.AbstractADTest;
import com.amazon.opendistroforelasticsearch.ad.common.exception.JsonPathNotFoundException;
import com.amazon.opendistroforelasticsearch.ad.constant.CommonName;
public class EntityProfileTests extends AbstractADTest {
public void testMerge() {
EntityProfile profile1 = new EntityProfile(null, null, null, -1, -1, null, null, EntityState.INIT);
EntityProfile profile2 = new EntityProfile(null, null, null, -1, -1, null, null, EntityState.UNKNOWN);
profile1.merge(profile2);
assertEquals(profile1.getState(), EntityState.INIT);
}
public void testToXContent() throws IOException, JsonPathNotFoundException {
EntityProfile profile1 = new EntityProfile(null, null, null, -1, -1, null, null, EntityState.INIT);
XContentBuilder builder = jsonBuilder();
profile1.toXContent(builder, ToXContent.EMPTY_PARAMS);
String json = Strings.toString(builder);
assertEquals("INIT", JsonDeserializer.getTextValue(json, CommonName.STATE));
EntityProfile profile2 = new EntityProfile(null, null, null, -1, -1, null, null, EntityState.UNKNOWN);
builder = jsonBuilder();
profile2.toXContent(builder, ToXContent.EMPTY_PARAMS);
json = Strings.toString(builder);
assertTrue(false == JsonDeserializer.hasChildNode(json, CommonName.STATE));
}
}
| 40.1 | 110 | 0.749377 |
57eb6ccc25184e059c50d1b5bb0460a878f333a0 | 1,993 | package com.wondernect.stars.file.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.wondernect.elements.rdb.response.BaseStringResponseDTO;
import com.wondernect.stars.file.em.FileType;
import com.wondernect.stars.file.em.FileUploadType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* Copyright (C), 2017-2019, wondernect.com
* FileName: FileResponseDTO
* Author: chenxun
* Date: 2019/6/3 14:39
* Description:
*/
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "文件响应对象")
public class FileResponseDTO extends BaseStringResponseDTO {
@JsonProperty("upload_type")
@ApiModelProperty(notes = "文件上传类型")
private FileUploadType uploadType;
@JsonProperty("type")
@ApiModelProperty(notes = "文件类型")
private FileType type;
@JsonProperty("name")
@ApiModelProperty(notes = "文件名称")
private String name;
@JsonProperty("size")
@ApiModelProperty(notes = "文件大小")
private Long size;
@JsonProperty("ext")
@ApiModelProperty(notes = "文件扩展名")
private String ext;
@JsonProperty("local_path_id")
@ApiModelProperty(notes = "文件存储路径id")
private String localPathId;
@JsonProperty("local_path")
@ApiModelProperty(notes = "文件资源服务器唯一路径")
private String localPath;
@JsonProperty("path")
@ApiModelProperty(notes = "访问url路径")
private String path;
@JsonProperty("thumb_image_path")
@ApiModelProperty(notes = "图片文件缩略图访问服务器路径")
private String thumbImagePath;
@JsonProperty("thumb_path")
@ApiModelProperty(notes = "缩略图访问url路径")
private String thumbPath;
@JsonProperty("meta_data")
@ApiModelProperty(notes = "文件元信息")
private String metaData;
@JsonProperty("deleted")
@ApiModelProperty(notes = "文件是否已删除")
private Boolean deleted;
}
| 26.223684 | 66 | 0.733567 |
5a2db4cbbf1fc8398cab013d2f38ebc9b81031a8 | 2,896 | package org.nix.movieticketingsystem.web.contorller;
import org.nix.movieticketingsystem.commons.enums.RoleEnum;
import org.nix.movieticketingsystem.commons.utils.ResultMvcMap;
import org.nix.movieticketingsystem.pojo.dao.MovieRepository;
import org.nix.movieticketingsystem.pojo.entity.Movie;
import org.nix.movieticketingsystem.pojo.server.MovieServer;
import org.nix.movieticketingsystem.web.annotation.Authority;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/**
* Create by zhangpe0312@qq.com on 2018/5/14.
*/
@RestController
@RequestMapping(value = "/movie")
public class MovieController {
@Autowired
private MovieRepository movieRepository;
@Autowired
private MovieServer movieServer;
/**
* 发现热度前几的电影
*
* @return 查询结果
*/
@GetMapping(value = "/findTopMovie")
public Map<String, Object> findTopMovie(@RequestParam("count") int count) {
return new ResultMvcMap()
.success(movieServer.findTopTenMovie(count))
.send();
}
@GetMapping(value = "/findMovieById")
public Map<String, Object> findMovieById(@RequestParam("movieId") int movieId) {
return new ResultMvcMap()
.success(movieServer.findMovieById(movieId))
.send();
}
/**
* 管理员新增一个影片
*
* @return 操作结果
*/
@PostMapping(value = "/addMovie")
@Authority(role = RoleEnum.ROLE_MANGER)
public Map<String, Object> addMovie(@RequestParam(value = "picture" , required = false) MultipartFile picture,
@RequestParam("movieName") String movieName,
@RequestParam("director") String director,
@RequestParam("starring") String starring,
@RequestParam("movieType") String movieType,
@RequestParam("hot") int hot,
@RequestParam("score") double score,
HttpServletRequest request) {
Movie movie = new Movie();
movie.setStarring(starring);
movie.setScore(score);
movie.setMovieName(movieName);
movie.setHot(hot);
movie.setDirector(director);
movie.setMovieType(movieType);
if (movieServer.addMovie(movie, picture, request)) {
return new ResultMvcMap()
.success()
.send();
} else {
return new ResultMvcMap()
.fail(HttpStatus.BAD_REQUEST, "文件上传失败")
.send();
}
}
}
| 32.539326 | 114 | 0.60808 |
b011cd8c7cec90c3fcce1b014425b666513ddbbf | 990 | package jua.ast;
import java.util.Objects;
import jua.evaluator.LuaRuntimeException;
import jua.evaluator.Scope;
import jua.objects.LuaObject;
import jua.token.Token;
public class StatementBlock extends Statement {
private StatementList list;
public StatementBlock(Token token, StatementList statement) {
super(token);
this.list = statement;
}
@Override
public String toString() {
return String.format("do\n%s\nend", util.Util.indent(list.toString()));
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
StatementBlock that = (StatementBlock) o;
return Objects.equals(list, that.list);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), list);
}
@Override
public LuaObject evaluate(Scope scope) throws LuaRuntimeException {
return list.evaluate(scope.createChild());
}
}
| 23.571429 | 75 | 0.70303 |
1943aeeb01214b1fd9ab35b85dcd679574ca8e87 | 5,322 | package fr.inra.urgi.rarebasket.dao;
import java.time.Instant;
import java.util.Objects;
import fr.inra.urgi.rarebasket.domain.CustomerType;
import fr.inra.urgi.rarebasket.domain.OrderStatus;
import fr.inra.urgi.rarebasket.domain.SupportedLanguage;
/**
* An object returned by the reporting queries of the {@link OrderDao}
* @author JB Nizet
*/
public final class ReportingOrder {
private final Long orderId;
private final String basketReference;
private final String customerEmail;
private final CustomerType customerType;
private final SupportedLanguage customerLanguage;
private final Instant basketConfirmationInstant;
private final String grcName;
private final String accessionHolderName;
private final OrderStatus status;
private final Instant finalizationInstant;
private final String accessionName;
private final String accessionIdentifier;
private final Integer accessionQuantity;
private final String accessionUnit;
public ReportingOrder(Long orderId,
String basketReference,
String customerEmail,
CustomerType customerType,
SupportedLanguage customerLanguage,
Instant basketConfirmationInstant,
String grcName,
String accessionHolderName,
OrderStatus status,
Instant finalizationInstant,
String accessionName,
String accessionIdentifier,
Integer accessionQuantity,
String accessionUnit) {
this.orderId = orderId;
this.basketReference = basketReference;
this.customerEmail = customerEmail;
this.customerType = customerType;
this.customerLanguage = customerLanguage;
this.basketConfirmationInstant = basketConfirmationInstant;
this.grcName = grcName;
this.accessionHolderName = accessionHolderName;
this.status = status;
this.finalizationInstant = finalizationInstant;
this.accessionName = accessionName;
this.accessionIdentifier = accessionIdentifier;
this.accessionQuantity = accessionQuantity;
this.accessionUnit = accessionUnit;
}
public Long getOrderId() {
return orderId;
}
public String getBasketReference() {
return basketReference;
}
public String getCustomerEmail() {
return customerEmail;
}
public CustomerType getCustomerType() {
return customerType;
}
public SupportedLanguage getCustomerLanguage() {
return customerLanguage;
}
public Instant getBasketConfirmationInstant() {
return basketConfirmationInstant;
}
public String getGrcName() {
return grcName;
}
public String getAccessionHolderName() {
return accessionHolderName;
}
public OrderStatus getStatus() {
return status;
}
public Instant getFinalizationInstant() {
return finalizationInstant;
}
public String getAccessionName() {
return accessionName;
}
public String getAccessionIdentifier() {
return accessionIdentifier;
}
public Integer getAccessionQuantity() {
return accessionQuantity;
}
public String getAccessionUnit() {
return accessionUnit;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ReportingOrder)) {
return false;
}
ReportingOrder that = (ReportingOrder) o;
return Objects.equals(orderId, that.orderId) &&
Objects.equals(basketReference, that.basketReference) &&
Objects.equals(customerEmail, that.customerEmail) &&
customerType == that.customerType &&
customerLanguage == that.customerLanguage &&
Objects.equals(basketConfirmationInstant, that.basketConfirmationInstant) &&
Objects.equals(grcName, that.grcName) &&
Objects.equals(accessionHolderName, that.accessionHolderName) &&
status == that.status &&
Objects.equals(finalizationInstant, that.finalizationInstant) &&
Objects.equals(accessionName, that.accessionName) &&
Objects.equals(accessionIdentifier, that.accessionIdentifier) &&
Objects.equals(accessionQuantity, that.accessionQuantity) &&
Objects.equals(accessionUnit, that.accessionUnit);
}
@Override
public int hashCode() {
return Objects.hash(orderId,
basketReference,
customerEmail,
customerType,
customerLanguage,
basketConfirmationInstant,
grcName,
accessionHolderName,
status,
finalizationInstant,
accessionName,
accessionIdentifier,
accessionQuantity,
accessionUnit);
}
}
| 33.471698 | 88 | 0.612176 |
2a1ca1169c0984acdee789f23b3bd38563345d6b | 2,993 | /*
* Copyright 2021 Alibaba Group Holding Limited.
*
* 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.alibaba.graphscope.context;
import com.alibaba.fastffi.FFITypeFactory;
import com.alibaba.graphscope.context.ffi.FFILabeledVertexDataContext;
import com.alibaba.graphscope.ds.GSVertexArray;
import com.alibaba.graphscope.ds.Vertex;
import com.alibaba.graphscope.fragment.ArrowFragment;
import com.alibaba.graphscope.stdcxx.StdVector;
import com.alibaba.graphscope.utils.CppClassName;
import com.alibaba.graphscope.utils.FFITypeFactoryhelper;
import java.util.Objects;
public abstract class LabeledVertexDataContext<OID_T, DATA_T>
implements PropertyDefaultContextBase<OID_T> {
private long ffiContextAddress;
private FFILabeledVertexDataContext<ArrowFragment<OID_T>, DATA_T> ffiLabeledVertexDataContext;
private FFILabeledVertexDataContext.Factory factory;
/**
* Must be called by jni, to create ffi context.
*
* @param fragment query fragment.
* @param dataClass class object for data type.
*/
protected void createFFIContext(
ArrowFragment<OID_T> fragment, Class<?> oidClass, Class<?> dataClass) {
// System.out.println("fragment: " + FFITypeFactoryhelper.makeParameterize(ARROW_FRAGMENT,
// FFITypeFactoryhelper.javaType2CppType(oidClass)));
String fragmentTemplateStr = FFITypeFactoryhelper.getForeignName(fragment);
String contextName =
FFITypeFactoryhelper.makeParameterize(
CppClassName.LABELED_VERTEX_DATA_CONTEXT,
fragmentTemplateStr,
FFITypeFactoryhelper.javaType2CppType(dataClass));
System.out.println("context name: " + contextName);
factory = FFITypeFactory.getFactory(FFILabeledVertexDataContext.class, contextName);
ffiLabeledVertexDataContext = factory.create(fragment, true);
ffiContextAddress = ffiLabeledVertexDataContext.getAddress();
System.out.println(contextName + ", " + ffiContextAddress);
}
public DATA_T getValue(Vertex<Long> vertex) {
if (Objects.isNull(ffiLabeledVertexDataContext)) {
return null;
}
return ffiLabeledVertexDataContext.getValue(vertex);
}
public StdVector<GSVertexArray<DATA_T>> data() {
if (Objects.isNull(ffiLabeledVertexDataContext)) {
return null;
}
return ffiLabeledVertexDataContext.data();
}
}
| 41.569444 | 98 | 0.724023 |
e59316551f24eefa6ac899ac3cce15f4ec1a5666 | 1,169 | package ru.job4j.array;
import java.util.Arrays;
/**
* @author tumen.garmazhapov (gtb-85@yandex.ru)
* @since 10.2019
*/
public class Merge {
/**
* метод принимает два отсортированных массива
* и объединяет их в один
*
* @param left - первый массив;
* @param right - второй массив;
* @return rsl - новый массив
*/
public int[] merge(int[] left, int[] right) {
int[] rsl = new int[left.length + right.length];
int j = 0;
int k = 0;
int i = 0;
while (i < rsl.length) {
if (j > left.length - 1) {
rsl[i] = right[k];
k++;
} else if (k > right.length - 1) {
rsl[i] = left[j];
j++;
} else {
rsl[i] = left[j] < right[k] ? left[j++] : right[k++];
}
i++;
}
return rsl;
}
public static void main(String[] args) {
Merge process = new Merge();
int[] rsl = process.merge(
new int[]{1, 3, 5},
new int[]{2, 4}
);
System.out.println(Arrays.toString(rsl));
}
}
| 22.921569 | 69 | 0.449102 |
50bd8dbd228c2915b596a5d03893eecff12e6b25 | 308 | package io.kestra.runner.kafka.streams;
import lombok.AllArgsConstructor;
import lombok.Getter;
import io.kestra.core.models.executions.Execution;
import io.kestra.core.models.flows.Flow;
@Getter
@AllArgsConstructor
public class ExecutorFlowTrigger {
Flow flowHavingTrigger;
Execution execution;
}
| 22 | 50 | 0.811688 |
6b44a254612de75c5661335a7ff39513b69e7975 | 1,607 | package io.pactflow.example.xml.provider.todo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.CrossOrigin;
@RestController
@CrossOrigin(origins = { "*" })
@RequestMapping(value = "/", produces = MediaType.APPLICATION_XML_VALUE)
class ProjectController {
private final ProjectsRepository repository;
ProjectController(ProjectsRepository repository) {
this.repository = repository;
}
@GetMapping("/projects")
Projects all() {
return repository.getProjects();
}
// @PostMapping("/projects")
// Project newProject(@RequestBody Project newProject) {
// return repository.save(newProject);
// }
// @GetMapping({ "/project/{id}" })
// Project one(@PathVariable Long id) {
// return repository.findById(id).orElseThrow(() -> new ProjectNotFoundException(id));
// }
// @PutMapping({ "/project/{id}" })
// Project replaceProject(@RequestBody Project newProject, @PathVariable Long id) {
// return repository.findById(id).map(Project -> {
// Project.setName(newProject.getName());
// Project.setType(newProject.getType());
// return repository.save(Project);
// }).orElseGet(() -> {
// newProject.setId(id);
// return repository.save(newProject);
// });
// }
// @DeleteMapping({ "/project/{id}" })
// void deleteProject(@PathVariable Long id) {
// repository.deleteById(id);
// }
} | 30.320755 | 90 | 0.695706 |
d8d6c369907a1731bb3a06242640244aeb288313 | 752 | package no.stelar7.api.r4j.basic.calling;
public class DataCallResponse
{
private final int responseCode;
private final String responseData;
DataCallResponse(final int a, final String b)
{
this.responseCode = a;
this.responseData = b;
}
/**
* Response code
*/
int getResponseCode()
{
return this.responseCode;
}
/**
* Response data
*/
String getResponseData()
{
return this.responseData;
}
@Override
public String toString()
{
return "DataCallResponse" +
"\n{" +
"\n\tresponseCode=" + responseCode +
"\n\tresponseData=\n\t" + responseData + "\n\n}";
}
}
| 18.8 | 64 | 0.535904 |
379e8e0e9a56557d6fc104cde651de0744c73e45 | 933 | package ${package}.handlers.exception;
import com.amazon.ask.dispatcher.exception.ExceptionHandler;
import com.amazon.ask.dispatcher.request.handler.HandlerInput;
import com.amazon.ask.model.Response;
import java.util.Optional;
public class CatchAllExceptionHandler implements ExceptionHandler {
@Override
public boolean canHandle(HandlerInput handlerInput, Throwable throwable) {
return true; //catch all
}
@Override
public Optional<Response> handle(HandlerInput handlerInput, Throwable throwable) {
System.out.println("Exception: " + throwable.toString());
System.out.println("Exception thrown while receiving: " + handlerInput.getRequestEnvelope().getRequest().getType());
return handlerInput.getResponseBuilder()
.withSpeech("Sorry. I have problems answering your request. Please try again")
.withShouldEndSession(true)
.build();
}
} | 38.875 | 124 | 0.729904 |
a7f9a1ed217c33ead3b64a07800851de2e02d40e | 588 | package dev.fiki.forgehax.main.mods.world;
import dev.fiki.forgehax.api.event.SubscribeListener;
import dev.fiki.forgehax.api.events.render.FogDensityRenderEvent;
import dev.fiki.forgehax.api.mod.Category;
import dev.fiki.forgehax.api.mod.ToggleMod;
import dev.fiki.forgehax.api.modloader.RegisterMod;
@RegisterMod(
name = "AntiFog",
description = "Removes fog",
category = Category.WORLD
)
public class AntiFogMod extends ToggleMod {
@SubscribeListener
public void onFogDensity(FogDensityRenderEvent event) {
event.setDensity(0);
event.setCanceled(true);
}
}
| 28 | 65 | 0.77381 |
56b5ee27f7e13353d4511bd1b762bc1442956dc6 | 550 | package com.onap.sdnc.vnfconfigcomparsion.model;
public class VnfDetails {
private String vnfId;
private String vnfDeatils;
private String vnfversion;
public String getVnfversion() {
return vnfversion;
}
public void setVnfversion(String vnfversion) {
this.vnfversion = vnfversion;
}
public String getVnfDeatils() {
return vnfDeatils;
}
public void setVnfDeatils(String vnfDeatils) {
this.vnfDeatils = vnfDeatils;
}
public String getVnfId() {
return vnfId;
}
public void setVnfId(String vnfId) {
this.vnfId = vnfId;
}
}
| 19.642857 | 48 | 0.743636 |
ce0382d43e3270a566ebb5bc922ca91f1dc7a229 | 8,335 | /*
* Copyright (C) 2018 Google Inc.
*
* 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.google.iot.coap;
import com.google.common.collect.Maps;
import com.google.common.util.concurrent.ListenableFuture;
import java.io.Closeable;
import java.io.IOException;
import java.net.DatagramSocket;
import java.net.MulticastSocket;
import java.net.SocketAddress;
import java.net.SocketException;
import java.util.Map;
import java.util.concurrent.ScheduledExecutorService;
import java.util.logging.Logger;
import com.google.common.util.concurrent.ListeningScheduledExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import org.checkerframework.checker.nullness.qual.Nullable;
/** Manager class for {@link LocalEndpoint} instances. */
public class LocalEndpointManager implements Closeable {
private static final boolean DEBUG = false;
private static final Logger LOGGER =
Logger.getLogger(LocalEndpointManager.class.getCanonicalName());
private ListeningScheduledExecutorService mExecutor = null;
private final Map<String, LocalEndpoint> mSchemeEndpointMap = Maps.newConcurrentMap();
private final SocketAddressLookup mInetLookup = SocketAddressLookup.createInetLookup();
private final SocketAddressLookup mNullLookup = SocketAddressLookup.createNullLookup();
private BehaviorContext mBehaviorContext = BehaviorContext.standard();
private Interceptor mDefaultInterceptor = null;
public LocalEndpointManager(ListeningScheduledExecutorService executor) {
mExecutor = executor;
mInetLookup.setExecutor(getExecutor());
mNullLookup.setExecutor(getExecutor());
}
public LocalEndpointManager() {
this(MoreExecutors.listeningDecorator(Utils.getSafeExecutor()));
}
public BehaviorContext getDefaultBehaviorContext() {
return mBehaviorContext;
}
public void setDefaultBehaviorContext(BehaviorContext behaviorContext) {
mBehaviorContext = behaviorContext;
}
public void setDefaultInterceptor(Interceptor interceptor) {
mDefaultInterceptor = interceptor;
}
public Interceptor getDefaultInterceptor() {
return mDefaultInterceptor;
}
public int getDefaultPortForScheme(String scheme) {
switch (scheme) {
case "http":
case Coap.SCHEME_WS:
return 80;
case "https":
case Coap.SCHEME_WS_TLS:
return 443;
case Coap.SCHEME_DTLS:
case Coap.SCHEME_TLS:
return Coap.DEFAULT_PORT_SECURE;
default:
case Coap.SCHEME_TCP:
case Coap.SCHEME_UDP:
return Coap.DEFAULT_PORT_NOSEC;
}
}
/**
* Returns the default {@link ListeningScheduledExecutorService} associated with this context instance.
* This can optionally be used by other objects associated with this context instance.
*/
public ListeningScheduledExecutorService getExecutor() {
return mExecutor;
}
/** @hide Convert a scheme, host, and port into an appropriate SocketAddress. */
public ListenableFuture<SocketAddress> lookupSocketAddress(
String scheme, String host, @Nullable Integer port) {
switch (scheme) {
case Coap.SCHEME_NULL:
case Coap.SCHEME_LOOPBACK:
if (port == null) {
port = Coap.DEFAULT_PORT_NOSEC;
}
return mNullLookup.lookup(host, port);
case Coap.SCHEME_DTLS:
if (port == null) {
port = Coap.DEFAULT_PORT_SECURE;
}
return mInetLookup.lookup(host, port);
case Coap.SCHEME_UDP:
default:
if (port == null) {
port = Coap.DEFAULT_PORT_NOSEC;
}
return mInetLookup.lookup(host, port);
}
}
public boolean supportsScheme(String scheme) {
switch (scheme) {
case Coap.SCHEME_LOOPBACK:
case Coap.SCHEME_NULL:
case Coap.SCHEME_UDP:
return true;
default:
return mSchemeEndpointMap.containsKey(scheme);
}
}
/**
* Returns a {@link LocalEndpoint} for the given scheme that is suitable for sending outbound
* requests (ie, for use with {@link Client}). This method should not be used to obtain
* LocalEndpoints for use with {@link Server} since the binding port can be unpredictable.
*
* <p>Supported schemes include:
*
* <ul>
* <li><tt>null</tt>: "null" local endpoint (drops everything)
* <li><tt>loop</tt>/<tt>loopback</tt>: Loopback local endpoint (outbound packets are fed back
* into itself)
* <li><tt>coap</tt>: Standard UDP Coap local endpoint
* </ul>
*
* <p>Additional scheme types are planned.
*
* @param scheme the scheme for the endpoint
* @return a {@link LocalEndpoint} instance
* @throws UnsupportedSchemeException if the given scheme is not supported
*/
public LocalEndpoint getLocalEndpointForScheme(String scheme) throws UnsupportedSchemeException {
LocalEndpoint ret = mSchemeEndpointMap.get(scheme);
if (ret == null) {
switch (scheme) {
case Coap.SCHEME_LOOPBACK:
ret = new LocalEndpointLoopback(this);
break;
case Coap.SCHEME_NULL:
ret = new LocalEndpointNull(this);
break;
case Coap.SCHEME_UDP:
try {
try {
ret = new LocalEndpointCoap(this, new MulticastSocket());
} catch (IOException | SecurityException x) {
LOGGER.warning(
"Unable to open multicast socket ("
+ x
+ "), trying unicast...");
ret = new LocalEndpointCoap(this, new DatagramSocket());
}
} catch (SocketException x) {
LOGGER.warning("Unable to open UDP socket (" + x + ")");
if (DEBUG) x.printStackTrace();
ret = null;
}
break;
default:
break;
}
if (ret != null) {
try {
ret.setInterceptor(getDefaultInterceptor());
ret.start();
mSchemeEndpointMap.put(scheme, ret);
} catch (IOException x) {
throw new CoapRuntimeException(x);
}
}
}
if (ret == null) {
throw new UnsupportedSchemeException("Unsupported URI scheme \"" + scheme + "\"");
}
return ret;
}
/**
* Closes all associated {@link LocalEndpoint} instances.
*
* @throws IOException if there was a problem closing any {@link LocalEndpoint}s
*/
@Override
public void close() throws IOException {
IOException exception = null;
synchronized (mSchemeEndpointMap) {
for (Map.Entry<String, LocalEndpoint> entry : mSchemeEndpointMap.entrySet()) {
try {
entry.getValue().close();
} catch (IOException x) {
x.printStackTrace();
exception = x;
}
}
mSchemeEndpointMap.clear();
if (exception != null) {
throw exception;
}
}
}
}
| 34.729167 | 107 | 0.589442 |
a7d41a844b6716195ec358fc6d9d90af37fc3dce | 13,092 | package com.c.sample;
import android.annotation.SuppressLint;
import android.graphics.SurfaceTexture;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCaptureSession;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraDevice;
import android.hardware.camera2.CameraManager;
import android.hardware.camera2.CaptureRequest;
import android.opengl.GLES11Ext;
import android.opengl.GLES20;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.util.Log;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.util.Collections;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
public class GLSurfaceViewActivity extends AppCompatActivity {
private static final String TAG = "GlSurfaceViewActivity";
private Handler mHandler;
private CameraManager mCameraManager;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gl_surface);
mCameraManager = (CameraManager) getSystemService(CAMERA_SERVICE);
HandlerThread camera = new HandlerThread("camera");
camera.start();
mHandler = new Handler(camera.getLooper());
GLSurfaceView mGlPreview = findViewById(R.id.gl_sf_preview);
mGlPreview.setEGLContextClientVersion(2);
GLSurfaceView.Renderer renderer = new GLSurfaceView.Renderer() {
private SurfaceTexture mSurfaceTexture;
private CameraDrawer mDrawer;
private int mTextureId;
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
mTextureId = getExternalOESTextureID();
mSurfaceTexture = new SurfaceTexture(mTextureId);
mDrawer = new CameraDrawer();
mSurfaceTexture.setOnFrameAvailableListener(surfaceTexture -> mGlPreview.requestRender());
try {
openCamera(new Surface(mSurfaceTexture));
} catch (CameraAccessException e) {
toast("camera open failed");
e.printStackTrace();
}
}
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
}
@Override
public void onDrawFrame(GL10 gl) {
GLES20.glClearColor(0, 0, 0, 0);
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
mSurfaceTexture.updateTexImage();
mDrawer.draw(mTextureId, true);
}
};
mGlPreview.setRenderer(renderer);
mGlPreview.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
}
@SuppressLint("MissingPermission")
private void openCamera(Surface surface) throws CameraAccessException {
CameraDevice.StateCallback stateCallback = new CameraDevice.StateCallback() {
@Override
public void onOpened(@NonNull CameraDevice camera) {
Log.i(TAG, "onOpened: ");
try {
initPreviewRequest(camera, surface);
} catch (CameraAccessException e) {
toast("init preview failed");
e.printStackTrace();
}
}
@Override
public void onDisconnected(@NonNull CameraDevice camera) {
Log.i(TAG, "onDisconnected: ");
}
@Override
public void onError(@NonNull CameraDevice camera, int error) {
Log.i(TAG, "onError: " + error);
}
};
mCameraManager.openCamera(String.valueOf(CameraCharacteristics.LENS_FACING_BACK), stateCallback, mHandler);
}
private void initPreviewRequest(CameraDevice camera, Surface surface) throws CameraAccessException {
CaptureRequest.Builder captureRequest = camera.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
captureRequest.addTarget(surface);
CameraCaptureSession.StateCallback stateCallback = new CameraCaptureSession.StateCallback() {
@Override
public void onConfigured(@NonNull CameraCaptureSession session) {
try {
// 开始预览,即一直发送预览的请求
session.setRepeatingRequest(captureRequest.build(), null, mHandler);
} catch (CameraAccessException e) {
toast("request failed");
e.printStackTrace();
}
}
@Override
public void onConfigureFailed(@NonNull CameraCaptureSession session) {
Log.e(TAG, "ConfigureFailed. session: mCaptureSession");
}
};
// handle 传入 null 表示使用当前线程的 Looper
camera.createCaptureSession(Collections.singletonList(surface), stateCallback, mHandler);
}
private void toast(String msg) {
Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
}
public static int getExternalOESTextureID() {
int[] texture = new int[1];
GLES20.glGenTextures(1, texture, 0);
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, texture[0]);
GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);
return texture[0];
}
public static int loadShader(int type, String source) {
// 1. create shader
int shader = GLES20.glCreateShader(type);
if (shader == GLES20.GL_NONE) {
Log.e(TAG, "create shared failed! type: " + type);
return GLES20.GL_NONE;
}
// 2. load shader source
GLES20.glShaderSource(shader, source);
// 3. compile shared source
GLES20.glCompileShader(shader);
// 4. check compile status
int[] compiled = new int[1];
GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0);
if (compiled[0] == GLES20.GL_FALSE) { // compile failed
Log.e(TAG, "Error compiling shader. type: " + type + ":");
Log.e(TAG, GLES20.glGetShaderInfoLog(shader));
GLES20.glDeleteShader(shader); // delete shader
shader = GLES20.GL_NONE;
}
return shader;
}
public static int createProgram(String vertexSource, String fragmentSource) {
// 1. load shader
int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource);
if (vertexShader == GLES20.GL_NONE) {
Log.e(TAG, "load vertex shader failed! ");
return GLES20.GL_NONE;
}
int fragmentShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource);
if (fragmentShader == GLES20.GL_NONE) {
Log.e(TAG, "load fragment shader failed! ");
return GLES20.GL_NONE;
}
// 2. create gl program
int program = GLES20.glCreateProgram();
if (program == GLES20.GL_NONE) {
Log.e(TAG, "create program failed! ");
return GLES20.GL_NONE;
}
// 3. attach shader
GLES20.glAttachShader(program, vertexShader);
GLES20.glAttachShader(program, fragmentShader);
// we can delete shader after attach
GLES20.glDeleteShader(vertexShader);
GLES20.glDeleteShader(fragmentShader);
// 4. link program
GLES20.glLinkProgram(program);
// 5. check link status
int[] linkStatus = new int[1];
GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0);
if (linkStatus[0] == GLES20.GL_FALSE) { // link failed
Log.e(TAG, "Error link program: ");
Log.e(TAG, GLES20.glGetProgramInfoLog(program));
GLES20.glDeleteProgram(program); // delete program
return GLES20.GL_NONE;
}
return program;
}
public static class CameraDrawer {
private final String VERTEX_SHADER = "" +
"attribute vec4 vPosition;" +
"attribute vec2 inputTextureCoordinate;" +
"varying vec2 textureCoordinate;" +
"void main()" +
"{" +
"gl_Position = vPosition;" +
"textureCoordinate = inputTextureCoordinate;" +
"}";
private final String FRAGMENT_SHADER = "" +
"#extension GL_OES_EGL_image_external : require\n" +
"precision mediump float;" +
"varying vec2 textureCoordinate;\n" +
"uniform samplerExternalOES s_texture;\n" +
"void main() {" +
" gl_FragColor = texture2D( s_texture, textureCoordinate );\n" +
"}";
private FloatBuffer mVertexBuffer;
private FloatBuffer mBackTextureBuffer;
private FloatBuffer mFrontTextureBuffer;
private ByteBuffer mDrawListBuffer;
private int mProgram;
private int mPositionHandle;
private int mTextureHandle;
private static final float VERTEXES[] = {
-1.0f, 1.0f,
-1.0f, -1.0f,
1.0f, -1.0f,
1.0f, 1.0f,
};
// 后置摄像头使用的纹理坐标
private static final float TEXTURE_BACK[] = {
0.0f, 1.0f,
1.0f, 1.0f,
1.0f, 0.0f,
0.0f, 0.0f,
};
// 前置摄像头使用的纹理坐标
private static final float TEXTURE_FRONT[] = {
1.0f, 1.0f,
0.0f, 1.0f,
0.0f, 0.0f,
1.0f, 0.0f,
};
private static final byte VERTEX_ORDER[] = {0, 1, 2, 3}; // order to draw vertices
private final int VERTEX_SIZE = 2;
private final int VERTEX_STRIDE = VERTEX_SIZE * 4;
public CameraDrawer() {
// init float buffer for vertex coordinates
mVertexBuffer = ByteBuffer.allocateDirect(VERTEXES.length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
mVertexBuffer.put(VERTEXES).position(0);
// init float buffer for texture coordinates
mBackTextureBuffer = ByteBuffer.allocateDirect(TEXTURE_BACK.length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
mBackTextureBuffer.put(TEXTURE_BACK).position(0);
mFrontTextureBuffer = ByteBuffer.allocateDirect(TEXTURE_FRONT.length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
mFrontTextureBuffer.put(TEXTURE_FRONT).position(0);
// init byte buffer for draw list
mDrawListBuffer = ByteBuffer.allocateDirect(VERTEX_ORDER.length).order(ByteOrder.nativeOrder());
mDrawListBuffer.put(VERTEX_ORDER).position(0);
mProgram = createProgram(VERTEX_SHADER, FRAGMENT_SHADER);
mPositionHandle = GLES20.glGetAttribLocation(mProgram, "vPosition");
mTextureHandle = GLES20.glGetAttribLocation(mProgram, "inputTextureCoordinate");
}
public void draw(int texture, boolean isFrontCamera) {
GLES20.glUseProgram(mProgram); // 指定使用的program
GLES20.glEnable(GLES20.GL_CULL_FACE); // 启动剔除
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, texture); // 绑定纹理
GLES20.glEnableVertexAttribArray(mPositionHandle);
GLES20.glVertexAttribPointer(mPositionHandle, VERTEX_SIZE, GLES20.GL_FLOAT, false, VERTEX_STRIDE, mVertexBuffer);
GLES20.glEnableVertexAttribArray(mTextureHandle);
if (isFrontCamera) {
GLES20.glVertexAttribPointer(mTextureHandle, VERTEX_SIZE, GLES20.GL_FLOAT, false, VERTEX_STRIDE, mFrontTextureBuffer);
} else {
GLES20.glVertexAttribPointer(mTextureHandle, VERTEX_SIZE, GLES20.GL_FLOAT, false, VERTEX_STRIDE, mBackTextureBuffer);
}
// 真正绘制的操作
// GL_TRIANGLE_FAN模式,绘制 (0, 1, 2) 和 (0, 2, 3) 两个三角形
// glDrawElements绘制索引,索引0为VERTEXES数组第一个点 (-1, 1),以此类推
GLES20.glDrawElements(GLES20.GL_TRIANGLE_FAN, VERTEX_ORDER.length, GLES20.GL_UNSIGNED_BYTE, mDrawListBuffer);
GLES20.glDisableVertexAttribArray(mPositionHandle);
GLES20.glDisableVertexAttribArray(mTextureHandle);
}
}
}
| 40.9125 | 134 | 0.631149 |
20fa8ae83748cde7911e4cf88cd32a2d3ec787a0 | 1,346 | package hino.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.io.IOException;
import java.net.InetAddress;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "hello", description = "Say hello", protocols = "http")
@RestController
@RequestMapping(path = "/")
public class HelloController {
@ApiOperation(value = "This is how we say hello in Zaun!", notes = "Nothing to note...", response = String.class)
@GetMapping
public ResponseEntity<String> index() throws IOException {
return ResponseEntity.ok("Greetings from Hino! "
+ "<br>Here is your Inet Address: " + InetAddress.getLocalHost()
+ "<br>I think you should check the time: <span style=\"color:red\">"
+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"))
+ "</span>"
+ "<br>Take a look at the pokedex: <a style=\"color:red\" href=\"/pokemons/\">pokemons/</a>");
}
@GetMapping("/health")
public ResponseEntity<String> healthcheck() {
return ResponseEntity.ok().build();
}
}
| 38.457143 | 115 | 0.725111 |
b8774daed080194d403de1041060be75f5db64ee | 143 | package lsieun.agent.utils;
public class LogUtils {
public static void log(String message) {
System.out.println(message);
}
}
| 17.875 | 44 | 0.678322 |
c709af11c1eb129a35e78eea29e6a945e7e70ad0 | 487 | package team.study.guice.bindingannotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import com.google.inject.BindingAnnotation;
/**
* @author GYFeng by 2016/12/23
* @version 1.0
*/
@BindingAnnotation
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
public @interface NetWorkLog {
}
| 25.631579 | 72 | 0.774127 |
7e4bb1e69aa6c6be909f7fb548e2664c4ef4cabc | 529 | package org.iton.messenger.model.model;
import org.iton.messenger.model.entities.ETContact;
import javax.persistence.EntityManagerFactory;
import java.util.ArrayList;
import java.util.List;
/**
* Created by ITON Solutions on 8/21/16.
*/
public class EMContact extends EntityModel <ETContact, Integer>{
public EMContact(EntityManagerFactory emf) {
this.emf = emf;
}
@Override
public List<ETContact> findAll() {
List<ETContact> contacts = new ArrayList<>();
return contacts;
}
}
| 21.16 | 64 | 0.703214 |
588219546234b54ebf1def572710d20fcd04db05 | 108 | interface Foo<T> {
void run(T t, int myInt);
}
public class A implements Foo<String> {
@Overr<caret>
}
| 13.5 | 39 | 0.657407 |
cc1ef4d3b7c8bd7245c99ac6a1c209333b28de8b | 3,200 | /**
* Copyright (c) 2019. Qubole Inc
* 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. See accompanying LICENSE file.
* <p>
* <p>
* NOTICE: THIS FILE HAS BEEN MODIFIED BY Qubole Inc UNDER COMPLIANCE WITH THE APACHE 2.0 LICENCE FROM THE ORIGINAL WORK
* OF https://github.com/DanielYWoo/fast-object-pool.
*/
package com.qubole.rubix.spi.fop;
import com.qubole.rubix.spi.RetryingPooledBookkeeperClient;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.util.concurrent.BlockingQueue;
/**
* @author Daniel
*/
public class ObjectPoolPartition<T>
{
private static final Log log = LogFactory.getLog(RetryingPooledBookkeeperClient.class);
private final ObjectPool<T> pool;
private final PoolConfig config;
private final BlockingQueue<Poolable<T>> objectQueue;
private final ObjectFactory<T> objectFactory;
private int totalCount;
private String host;
private int socketTimeout;
private int connectTimeout;
public ObjectPoolPartition(ObjectPool<T> pool, PoolConfig config,
ObjectFactory<T> objectFactory, BlockingQueue<Poolable<T>> queue, String host, int socketTimeout, int connectTimeout)
{
this.pool = pool;
this.config = config;
this.objectFactory = objectFactory;
this.objectQueue = queue;
this.host = host;
this.socketTimeout = socketTimeout;
this.connectTimeout = connectTimeout;
totalCount = 0;
for (int i = 0; i < config.getMinSize(); i++) {
T object = objectFactory.create(host, socketTimeout, connectTimeout);
if (object != null) {
objectQueue.add(new Poolable<>(object, pool, host));
totalCount++;
}
}
}
public BlockingQueue<Poolable<T>> getObjectQueue()
{
return objectQueue;
}
public synchronized int increaseObjects(int delta)
{
int oldCount = totalCount;
if (delta + totalCount > config.getMaxSize()) {
delta = config.getMaxSize() - totalCount;
}
try {
for (int i = 0; i < delta; i++) {
T object = objectFactory.create(host, socketTimeout, connectTimeout);
if (object != null) {
objectQueue.put(new Poolable<>(object, pool, host));
totalCount++;
}
}
log.debug("Increased pool size by " + (totalCount - oldCount) + " to new size: " + totalCount + ", current queue size: " + objectQueue.size());
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
return totalCount;
}
public synchronized boolean decreaseObject(Poolable<T> obj)
{
objectFactory.destroy(obj.getObject());
totalCount--;
return true;
}
public synchronized int getTotalCount()
{
return totalCount;
}
}
| 32 | 149 | 0.697188 |
5b3da21fbe72e58aab0a235c6f062bdb412c5b0b | 21,646 | package org.ssssssss.magicapi.spring.boot.starter;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.Ordered;
import org.springframework.core.env.Environment;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import org.ssssssss.magicapi.adapter.ColumnMapperAdapter;
import org.ssssssss.magicapi.adapter.DialectAdapter;
import org.ssssssss.magicapi.adapter.Resource;
import org.ssssssss.magicapi.adapter.ResourceAdapter;
import org.ssssssss.magicapi.adapter.resource.DatabaseResource;
import org.ssssssss.magicapi.cache.DefaultSqlCache;
import org.ssssssss.magicapi.cache.SqlCache;
import org.ssssssss.magicapi.config.*;
import org.ssssssss.magicapi.controller.*;
import org.ssssssss.magicapi.dialect.Dialect;
import org.ssssssss.magicapi.exception.MagicAPIException;
import org.ssssssss.magicapi.interceptor.AuthorizationInterceptor;
import org.ssssssss.magicapi.interceptor.DefaultAuthorizationInterceptor;
import org.ssssssss.magicapi.interceptor.RequestInterceptor;
import org.ssssssss.magicapi.interceptor.SQLInterceptor;
import org.ssssssss.magicapi.logging.LoggerManager;
import org.ssssssss.magicapi.model.Constants;
import org.ssssssss.magicapi.modules.*;
import org.ssssssss.magicapi.provider.*;
import org.ssssssss.magicapi.provider.impl.*;
import org.ssssssss.magicapi.utils.ClassScanner;
import org.ssssssss.magicapi.utils.Mapping;
import org.ssssssss.magicapi.utils.PathUtils;
import org.ssssssss.script.MagicResourceLoader;
import org.ssssssss.script.MagicScript;
import org.ssssssss.script.MagicScriptEngine;
import org.ssssssss.script.functions.ExtensionMethod;
import org.ssssssss.script.parsing.ast.statement.AsyncCall;
import org.ssssssss.script.reflection.AbstractReflection;
import org.ssssssss.script.reflection.JavaReflection;
import javax.servlet.http.HttpServletRequest;
import javax.sql.DataSource;
import java.io.IOException;
import java.lang.reflect.Method;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.function.BiFunction;
@Configuration
@ConditionalOnClass({RequestMappingHandlerMapping.class})
@EnableConfigurationProperties(MagicAPIProperties.class)
@Import({MagicRedisAutoConfiguration.class, MagicMongoAutoConfiguration.class, MagicSwaggerConfiguration.class, MagicJsonAutoConfiguration.class})
public class MagicAPIAutoConfiguration implements WebMvcConfigurer {
private static final Logger logger = LoggerFactory.getLogger(MagicAPIAutoConfiguration.class);
@Autowired
private MagicAPIProperties properties;
@Autowired(required = false)
private final List<RequestInterceptor> requestInterceptors = Collections.emptyList();
@Autowired
private AuthorizationInterceptor authorizationInterceptor;
@Autowired(required = false)
private final List<SQLInterceptor> sqlInterceptors = Collections.emptyList();
@Autowired
@Lazy
private RequestMappingHandlerMapping requestMappingHandlerMapping;
@Autowired
private MagicFunctionManager magicFunctionManager;
@Autowired
private ApplicationContext springContext;
/**
* 自定义的类型扩展
*/
@Autowired(required = false)
private final List<ExtensionMethod> extensionMethods = Collections.emptyList();
@Autowired(required = false)
private RestTemplate restTemplate;
/**
* 内置的消息转换
*/
@Autowired(required = false)
private final List<HttpMessageConverter<?>> httpMessageConverters = Collections.emptyList();
/**
* 自定义的方言
*/
@Autowired(required = false)
private final List<Dialect> dialects = Collections.emptyList();
/**
* 自定义的列名转换
*/
@Autowired(required = false)
List<ColumnMapperProvider> columnMapperProviders = Collections.emptyList();
/**
* 自定义的函数
*/
@Autowired(required = false)
List<MagicFunction> magicFunctions = Collections.emptyList();
@Autowired
Environment environment;
@Autowired
ApiServiceProvider apiServiceProvider;
@Autowired
GroupServiceProvider groupServiceProvider;
@Autowired
FunctionServiceProvider functionServiceProvider;
@Autowired
MappingHandlerMapping mappingHandlerMapping;
@Autowired
MagicAPIService magicAPIService;
@Autowired
ResultProvider resultProvider;
MagicCorsFilter magicCorsFilter = new MagicCorsFilter();
private String ALL_CLASS_TXT;
public MagicAPIAutoConfiguration() {
}
private String redirectIndex(HttpServletRequest request) {
if (request.getRequestURI().endsWith("/")) {
return "redirect:./index.html";
}
return "redirect:" + properties.getWeb() + "/index.html";
}
@ResponseBody
private MagicAPIProperties readConfig() {
return properties;
}
@ResponseBody
private String readClass() {
if (ALL_CLASS_TXT == null) {
try {
ALL_CLASS_TXT = StringUtils.join(ClassScanner.scan(), "\r\n");
} catch (Throwable t) {
logger.warn("扫描Class失败", t);
ALL_CLASS_TXT = "";
}
}
return ALL_CLASS_TXT;
}
/**
* 注入动态数据源
*/
@Bean
@ConditionalOnMissingBean(MagicDynamicDataSource.class)
public MagicDynamicDataSource magicDynamicDataSource(@Autowired(required = false) DataSource dataSource) {
MagicDynamicDataSource dynamicDataSource = new MagicDynamicDataSource();
if (dataSource != null) {
dynamicDataSource.put(dataSource);
} else {
logger.warn("当前数据源未配置");
}
return dynamicDataSource;
}
@Bean
@ConditionalOnMissingBean(Resource.class)
@ConditionalOnProperty(prefix = "magic-api", name = "resource.type", havingValue = "database")
public Resource magicDatabaseResource(MagicDynamicDataSource magicDynamicDataSource) {
ResourceConfig resourceConfig = properties.getResource();
MagicDynamicDataSource.DataSourceNode dataSourceNode = magicDynamicDataSource.getDataSource(resourceConfig.getDatasource());
if (dataSourceNode == null) {
throw new IllegalArgumentException(String.format("找不到数据源:%s", resourceConfig.getDatasource()));
}
return new DatabaseResource(new JdbcTemplate(dataSourceNode.getDataSource()), resourceConfig.getTableName(), resourceConfig.getPrefix(), resourceConfig.isReadonly());
}
@Bean
@ConditionalOnMissingBean(Resource.class)
@ConditionalOnProperty(prefix = "magic-api", name = "resource.type", havingValue = "file", matchIfMissing = true)
public Resource magicResource() throws IOException {
ResourceConfig resourceConfig = properties.getResource();
return ResourceAdapter.getResource(resourceConfig.getLocation(), resourceConfig.isReadonly());
}
@Bean
@ConditionalOnMissingBean(AuthorizationInterceptor.class)
public AuthorizationInterceptor magicAuthorizationInterceptor() {
SecurityConfig securityConfig = properties.getSecurityConfig();
return new DefaultAuthorizationInterceptor(securityConfig.getUsername(), securityConfig.getPassword());
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
String web = properties.getWeb();
if (web != null) {
// 当开启了UI界面时,收集日志
LoggerManager.createMagicAppender();
// 配置静态资源路径
registry.addResourceHandler(web + "/**").addResourceLocations("classpath:/magic-editor/");
try {
Mapping.create(requestMappingHandlerMapping)
// 默认首页设置
.register(RequestMappingInfo.paths(web).build(), this, MagicAPIAutoConfiguration.class.getDeclaredMethod("redirectIndex", HttpServletRequest.class))
// 读取配置
.register(RequestMappingInfo.paths(web + "/config.json").build(), this, MagicAPIAutoConfiguration.class.getDeclaredMethod("readConfig"))
// 读取配置
.register(RequestMappingInfo.paths(web + "/classes.txt").produces("text/plain").build(), this, MagicAPIAutoConfiguration.class.getDeclaredMethod("readClass"));
} catch (NoSuchMethodException ignored) {
}
}
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new MagicWebRequestInterceptor(properties.isSupportCrossDomain() ? magicCorsFilter : null, authorizationInterceptor))
.addPathPatterns("/**");
}
@Bean
@ConditionalOnProperty(prefix = "magic-api", value = "support-cross-domain", havingValue = "true", matchIfMissing = true)
public FilterRegistrationBean<MagicCorsFilter> magicCorsFilterRegistrationBean() {
FilterRegistrationBean<MagicCorsFilter> registration = new FilterRegistrationBean<>(magicCorsFilter);
registration.addUrlPatterns("/*");
registration.setName("Magic Cors Filter");
registration.setOrder(Ordered.HIGHEST_PRECEDENCE);
return registration;
}
@Bean
@ConditionalOnMissingBean(PageProvider.class)
public PageProvider pageProvider() {
PageConfig pageConfig = properties.getPageConfig();
logger.info("未找到分页实现,采用默认分页实现,分页配置:(页码={},页大小={},默认首页={},默认页大小={})", pageConfig.getPage(), pageConfig.getSize(), pageConfig.getDefaultPage(), pageConfig.getDefaultSize());
return new DefaultPageProvider(pageConfig.getPage(), pageConfig.getSize(), pageConfig.getDefaultPage(), pageConfig.getDefaultSize());
}
/**
* 注入结果构建方法
*/
@Bean
@ConditionalOnMissingBean(ResultProvider.class)
public ResultProvider resultProvider() {
return new DefaultResultProvider(properties.getResponse());
}
/**
* 注入SQL缓存实现
*/
@Bean
@ConditionalOnMissingBean(SqlCache.class)
public SqlCache sqlCache() {
CacheConfig cacheConfig = properties.getCacheConfig();
logger.info("未找到SQL缓存实现,采用默认缓存实现(LRU+TTL),缓存配置:(容量={},TTL={})", cacheConfig.getCapacity(), cacheConfig.getTtl());
return new DefaultSqlCache(cacheConfig.getCapacity(), cacheConfig.getTtl());
}
/**
* 注入接口映射
*/
@Bean
public MappingHandlerMapping mappingHandlerMapping() throws NoSuchMethodException {
String prefix = StringUtils.isNotBlank(properties.getPrefix()) ? PathUtils.replaceSlash("/" + properties.getPrefix() + "/") : null;
return new MappingHandlerMapping(prefix, properties.isAllowOverride());
}
@Bean
@ConditionalOnMissingBean(FunctionServiceProvider.class)
public FunctionServiceProvider functionServiceProvider(GroupServiceProvider groupServiceProvider, Resource magicResource) {
return new DefaultFunctionServiceProvider(groupServiceProvider, magicResource);
}
/**
* 注入分组存储service
*/
@Bean
@ConditionalOnMissingBean(GroupServiceProvider.class)
public GroupServiceProvider groupServiceProvider(Resource magicResource) {
return new DefaultGroupServiceProvider(magicResource);
}
/**
* 注入接口存储service
*/
@Bean
@ConditionalOnMissingBean(ApiServiceProvider.class)
public ApiServiceProvider apiServiceProvider(GroupServiceProvider groupServiceProvider, Resource magicResource) {
return new DefaultApiServiceProvider(groupServiceProvider, magicResource);
}
@Bean
public MagicFunctionManager magicFunctionManager(GroupServiceProvider groupServiceProvider, FunctionServiceProvider functionServiceProvider) {
return new MagicFunctionManager(groupServiceProvider, functionServiceProvider);
}
/**
* 注入API调用Service
*/
@Bean
public MagicAPIService magicAPIService(MappingHandlerMapping mappingHandlerMapping, ApiServiceProvider apiServiceProvider, FunctionServiceProvider functionServiceProvider, GroupServiceProvider groupServiceProvider, ResultProvider resultProvider, MagicFunctionManager magicFunctionManager) {
return new DefaultMagicAPIService(mappingHandlerMapping, apiServiceProvider, functionServiceProvider, groupServiceProvider, resultProvider, magicFunctionManager, properties.isThrowException());
}
private void setupSpringSecurity() {
Class<?> clazz = null;
try {
clazz = Class.forName("org.springframework.security.core.context.SecurityContextHolder");
} catch (ClassNotFoundException ignored) {
}
if (clazz != null) {
try {
Method method = clazz.getDeclaredMethod("setStrategyName", String.class);
method.setAccessible(true);
method.invoke(clazz, "MODE_INHERITABLETHREADLOCAL");
logger.info("自动适配 Spring Security 成功");
} catch (Exception ignored) {
logger.info("自动适配 Spring Security 失败");
}
}
}
/**
* 注入数据库查询模块
*/
@Bean
@ConditionalOnBean({DataSource.class})
public SQLModule magicSqlModule(MagicDynamicDataSource dynamicDataSource, ResultProvider resultProvider, PageProvider pageProvider, SqlCache sqlCache) {
SQLModule sqlModule = new SQLModule(dynamicDataSource);
sqlModule.setResultProvider(resultProvider);
sqlModule.setPageProvider(pageProvider);
sqlModule.setSqlInterceptors(sqlInterceptors);
ColumnMapperAdapter columnMapperAdapter = new ColumnMapperAdapter();
this.columnMapperProviders.stream().filter(mapperProvider -> !"default".equals(mapperProvider.name())).forEach(columnMapperAdapter::add);
columnMapperAdapter.setDefault(properties.getSqlColumnCase());
sqlModule.setColumnMapperProvider(columnMapperAdapter);
sqlModule.setColumnMapRowMapper(columnMapperAdapter.getDefaultColumnMapRowMapper());
sqlModule.setRowMapColumnMapper(columnMapperAdapter.getDefaultRowMapColumnMapper());
sqlModule.setSqlCache(sqlCache);
DialectAdapter dialectAdapter = new DialectAdapter();
dialects.forEach(dialectAdapter::add);
sqlModule.setDialectAdapter(dialectAdapter);
return sqlModule;
}
/**
* 注册模块、类型扩展
*/
private void setupMagicModules(ResultProvider resultProvider, List<MagicModule> magicModules, List<ExtensionMethod> extensionMethods, List<LanguageProvider> languageProviders) {
// 设置脚本import时 class加载策略
MagicResourceLoader.setClassLoader((className) -> {
try {
return springContext.getBean(className);
} catch (Exception e) {
Class<?> clazz = null;
try {
clazz = Class.forName(className);
return springContext.getBean(clazz);
} catch (Exception ex) {
return clazz;
}
}
});
MagicResourceLoader.addScriptLanguageLoader(language -> languageProviders.stream()
.filter(it -> it.support(language))
.findFirst().<BiFunction<Map<String, Object>, String, Object>>map(languageProvider -> (context, script) -> {
try {
return languageProvider.execute(language, script, context);
} catch (Exception e) {
throw new MagicAPIException(e.getMessage(), e);
}
}).orElse(null)
);
logger.info("注册模块:{} -> {}", "log", Logger.class);
MagicResourceLoader.addModule("log", LoggerFactory.getLogger(MagicScript.class));
List<String> importModules = properties.getAutoImportModuleList();
logger.info("注册模块:{} -> {}", "env", EnvModule.class);
MagicResourceLoader.addModule("env", new EnvModule(environment));
logger.info("注册模块:{} -> {}", "request", RequestModule.class);
MagicResourceLoader.addModule("request", new RequestModule());
logger.info("注册模块:{} -> {}", "response", ResponseModule.class);
MagicResourceLoader.addModule("response", new ResponseModule(resultProvider));
logger.info("注册模块:{} -> {}", "assert", AssertModule.class);
MagicResourceLoader.addModule("assert", new AssertModule());
magicModules.forEach(module -> {
logger.info("注册模块:{} -> {}", module.getModuleName(), module.getClass());
MagicResourceLoader.addModule(module.getModuleName(), module);
});
MagicResourceLoader.getModuleNames().stream().filter(importModules::contains).forEach(moduleName -> {
logger.info("自动导入模块:{}", moduleName);
MagicScriptEngine.addDefaultImport(moduleName, MagicResourceLoader.loadModule(moduleName));
});
if (MagicResourceLoader.loadModule("http") == null) {
logger.info("注册模块:{} -> {}", "http", HttpModule.class);
RestTemplate restTemplate = this.restTemplate;
if (restTemplate == null) {
restTemplate = new RestTemplate();
restTemplate.getMessageConverters().add(new StringHttpMessageConverter(StandardCharsets.UTF_8) {
{
setSupportedMediaTypes(Collections.singletonList(MediaType.ALL));
}
@Override
public boolean supports(Class<?> clazz) {
return true;
}
});
}
MagicResourceLoader.addModule("http", new HttpModule(restTemplate));
}
properties.getAutoImportPackageList().forEach(importPackage -> {
logger.info("自动导包:{}", importPackage);
MagicResourceLoader.addPackage(importPackage);
});
extensionMethods.forEach(extension -> extension.supports().forEach(support -> {
logger.info("注册扩展:{} -> {}", support, extension.getClass());
AbstractReflection.getInstance().registerMethodExtension(support, extension);
}));
}
@Bean
public JSR223LanguageProvider jsr223LanguageProvider() {
return new JSR223LanguageProvider();
}
@Bean
public MagicConfiguration magicConfiguration(List<MagicModule> magicModules, List<LanguageProvider> languageProviders, @Autowired(required = false) MagicDynamicDataSource magicDynamicDataSource, Resource magicResource) {
logger.info("magic-api工作目录:{}", magicResource);
setupSpringSecurity();
AsyncCall.setThreadPoolExecutorSize(properties.getThreadPoolExecutorSize());
// 设置响应结果的code值
ResponseCodeConfig responseCodeConfig = properties.getResponseCodeConfig();
Constants.RESPONSE_CODE_SUCCESS = responseCodeConfig.getSuccess();
Constants.RESPONSE_CODE_INVALID = responseCodeConfig.getInvalid();
Constants.RESPONSE_CODE_EXCEPTION = responseCodeConfig.getException();
// 设置模块和扩展方法
setupMagicModules(resultProvider, magicModules, extensionMethods, languageProviders);
MagicConfiguration configuration = new MagicConfiguration();
configuration.setMagicAPIService(magicAPIService);
configuration.setApiServiceProvider(apiServiceProvider);
configuration.setGroupServiceProvider(groupServiceProvider);
configuration.setMappingHandlerMapping(mappingHandlerMapping);
configuration.setFunctionServiceProvider(functionServiceProvider);
SecurityConfig securityConfig = properties.getSecurityConfig();
configuration.setUsername(securityConfig.getUsername());
configuration.setPassword(securityConfig.getPassword());
configuration.setDebugTimeout(properties.getDebugConfig().getTimeout());
configuration.setHttpMessageConverters(Optional.ofNullable(httpMessageConverters).orElse(Collections.emptyList()));
configuration.setResultProvider(resultProvider);
configuration.setThrowException(properties.isThrowException());
configuration.setMagicDynamicDataSource(magicDynamicDataSource);
configuration.setEditorConfig(properties.getEditorConfig());
configuration.setWorkspace(magicResource);
configuration.setAuthorizationInterceptor(authorizationInterceptor);
// 注册函数
this.magicFunctions.forEach(JavaReflection::registerFunction);
// 向页面传递配置信息时不传递用户名密码,增强安全性
securityConfig.setUsername(null);
securityConfig.setPassword(null);
// 构建UI请求处理器
String base = properties.getWeb();
mappingHandlerMapping.setRequestMappingHandlerMapping(requestMappingHandlerMapping);
MagicDataSourceController dataSourceController = new MagicDataSourceController(configuration);
if (base != null) {
configuration.setEnableWeb(true);
List<MagicController> controllers = new ArrayList<>(Arrays.asList(
new MagicAPIController(configuration),
dataSourceController,
new MagicWorkbenchController(configuration),
new MagicGroupController(configuration),
new MagicFunctionController(configuration)
));
controllers.forEach(item -> mappingHandlerMapping.registerController(item, base));
}
dataSourceController.registerDataSource();
// 设置拦截器信息
this.requestInterceptors.forEach(interceptor -> {
logger.info("注册请求拦截器:{}", interceptor.getClass());
configuration.addRequestInterceptor(interceptor);
});
if (this.properties.isBanner()) {
configuration.printBanner();
}
configuration.setMagicFunctionManager(magicFunctionManager);
// 注册函数加载器
magicFunctionManager.registerFunctionLoader();
// 注册所有函数
magicFunctionManager.registerAllFunction();
// 自动刷新
magicFunctionManager.enableRefresh(properties.getRefreshInterval());
mappingHandlerMapping.setHandler(new RequestHandler(configuration));
mappingHandlerMapping.setMagicApiService(apiServiceProvider);
mappingHandlerMapping.setGroupServiceProvider(groupServiceProvider);
// 注册所有映射
mappingHandlerMapping.registerAllMapping();
int refreshInterval = properties.getRefreshInterval();
// 自动刷新
mappingHandlerMapping.enableRefresh(refreshInterval);
if (refreshInterval > 0) {
Executors.newScheduledThreadPool(1).scheduleAtFixedRate(dataSourceController::registerDataSource, refreshInterval, refreshInterval, TimeUnit.SECONDS);
}
return configuration;
}
}
| 39.5 | 291 | 0.793126 |
0b4bef00b9b8f7479bdef885cc89ba5a8452d31c | 3,394 | package scimech.combat;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import scimech.mech.Fixture;
import scimech.mech.Mech;
import scimech.mech.Mount;
import scimech.people.Trait;
import trawel.extra;
public class MechCombat {
public static final float SYSTEM_DAM_MULT = 1.75f;
public static MechCombat mc;
int round = 0;
public List<Mech> turnOrder = new ArrayList<Mech>();
public List<Mech> totalMechs;
public List<Mech> activeMechs = new ArrayList<Mech>();
public Target t;
public MechCombat(List<Mech> mechs) {
mc = null;
totalMechs = mechs;
activeMechs.addAll(totalMechs);
for (Mech m: totalMechs) {
m.refreshForBattle();
}
mc = this;
}
public void go() {
while (twoSided()) {
for (Mech m: activeMechs) {
m.roundStart();
}
turnOrder.clear();
turnOrder.addAll(activeMechs);
turnOrder.sort(new Comparator<Mech>() {
@Override
public int compare(Mech o1, Mech o2) {
return o2.getSpeed()-o1.getSpeed();
}});
while (turnOrder.size() > 0) {
extra.println(activeMech().callsign + " goes!");
activeMech().activate(null,null);
turnOrder.remove(0);
}
}
}
public boolean twoSided() {
boolean sideF = false;
int count = 0;
for (Mech m: activeMechs) {
if (count == 0) {
if (m.playerControlled) {
sideF = true;
}else {
sideF = false;
}}else{
if ((m.playerControlled && sideF == false) || (!m.playerControlled && sideF == true)) {
return true;
}
}
count++;
}
return false;
}
public static List<Mech> enemies(Mech currentMech) {
List<Mech> list = new ArrayList<Mech>();
for (Mech m :mc.activeMechs) {
if (m.playerControlled != currentMech.playerControlled) {
list.add(m);
}
}
return list;
}
public Mech activeMech() {
return turnOrder.get(0);
}
public static double computeHit(Target t,AimType at, int attackValue,Fixture f) {
int abonus = 0;
switch (at) {
case ARCING:
abonus+=f.currentMount.getTrait(Trait.LOBBER);
break;
case BALLISTIC:
abonus+=f.currentMount.getTrait(Trait.GUN_NUT);
break;
case LASER:
abonus+=f.currentMount.getTrait(Trait.LASER_SPEC);
break;
case MELEE:
abonus+=f.currentMount.getTrait(Trait.DUELIST);
break;
case SPECIAL:
break;
}
if (f.currentMount.getTrait(Trait.ACCURATE) > 0) {
abonus+=5;
}
int acc = (int) (extra.lerp(at.getMultFor(t.targetType()),1.2f, Math.min(10,f.currentMount.getTrait(Trait.PINPOINT)/20f))*attackValue+abonus);
int dodge = (int) (t.dodgeValue());
double accRoll = acc*Math.random();
double dodgeRoll = dodge*Math.random();
//HitDodge hd = new HitDodge(accRoll-dodgeRoll,);
return accRoll-dodgeRoll;
}
public static int averageDamage(Target t, Mount firing,int displayAcc) {
int total = 0;
for (int i = 0; i < displayAcc;i++) {
Dummy d = t.constructDummy();
firing.activate(d,null);
total-=d.hp;
}
total/=displayAcc;
return total;
}
/*
public class HitDodge {
private float diff;
private float magn;
public HitDodge(float diff, float magn){
this.diff = diff;
this.magn = magn;
}
public float getDiff() {
return diff;
}
public float getMagn() {
return magn;
}
}*/
}
| 22.778523 | 145 | 0.628167 |
1b6d3d6b4cfc5dc62a3a487859d15f9d3c92f8d3 | 1,080 | /*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.mpalourdio.springboottemplate.model.entities;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import javax.persistence.*;
@Entity
@Table(name = "task_people")
@Getter
@Setter
@Accessors(chain = true)
public class People {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "task_people_people_id_seq")
@Column(name = "people_id")
private int id;
@Column(name = "name", nullable = false)
private String name;
@ManyToOne
@JoinColumn(name = "task_id", nullable = false)
private Task task;
}
| 29.189189 | 96 | 0.740741 |
df983ebab032b141b8472aea835d249c5ea83c47 | 3,243 | package ru.job4j.multithreading.monitoresynchronizy;
import net.jcip.annotations.GuardedBy;
import net.jcip.annotations.ThreadSafe;
import java.util.*;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
public class RelatedListSynchronize<E> implements Iterable<E>{
private volatile Node<E> last;
private volatile Node<E> first;
private int size = 0;
private final Object lock = new Object();
public int getSize() {
synchronized (lock) {
return size;
}
}
public void add(E el) {
synchronized (lock) {
final Node<E> lt;
lt = last;
final Node<E> newNode = new Node<>(lt, el, null);
this.last = newNode;
if (lt == null)
first = newNode;
else
lt.next = newNode;
size++;
}
}
public E get(int index) {
synchronized (lock) {
if (index > this.size || index < 0)
throw new NoSuchElementException();
Node<E> ft = first;
for (int i = 0; i < index; i++) {
ft =ft.next;
}
return ft.item;
}
}
public E removeFirst() {
synchronized (lock) {
Node<E> remove = first;
Node<E> nextFirst = first.next;
this.first = nextFirst;
if (nextFirst == null) {
return remove.item;
}
first.prev = null;
size--;
return remove.item;
}
}
public E removeLast() {
synchronized (lock) {
Node<E> remove = last;
try {
Node<E> prevLast = last.prev;
this.last = prevLast;
if (prevLast == null)
return remove.item;
last.next = null;
size--;
} catch (NullPointerException npe) {
throw new NoSuchElementException();
}
return remove.item;
}
}
@Override
public Iterator<E> iterator() {
return new Itr();
}
private static class Node<E> {
E item;
Node<E> prev;
Node<E> next;
public Node(Node<E> prev, E el, Node<E> next) {
this.item = el;
this.next = next;
this.prev = prev;
}
}
private class Itr implements Iterator<E> {
private RelatedListSynchronize.Node<E> lastReturned;
private RelatedListSynchronize.Node<E> next;
private int nextIndex;
@Override
public boolean hasNext() {
synchronized (lock) {
return nextIndex <= size - 1;
}
}
@Override
public E next() {
synchronized (lock) {
if (!hasNext())
throw new NoSuchElementException();
if (nextIndex == 0) {
next = first;
}
else
next = next.next;
lastReturned = next;
nextIndex++;
return lastReturned.item;
}
}
}
}
| 24.383459 | 62 | 0.474561 |
f0d2887f5680aa0047373901f33dc328df2e367a | 3,828 | package org.kuali.ole.sys.batch;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* This class represents a full file which can be separated into a number of logical files, each logical file
* holding its own set of errors, warnings, and informative messages for post-processing
*/
public class PhysicalFlatFileInformation {
private String fileName;
private List<String[]> messages;
private List<FlatFileInformation> flatFileInfomationList;
/**
* Constructs a PhysicalFlatFileInformation
* @param fileName the name of the file this encapsulates
*/
public PhysicalFlatFileInformation(String fileName) {
this.fileName = fileName;
messages = new ArrayList<String[]>();
flatFileInfomationList = new ArrayList<FlatFileInformation>();
}
public void addFileErrorMessages(List<String> messages) {
for(String message : messages) {
this.messages.add(new String[] { FlatFileTransactionInformation.getEntryTypeString(FlatFileTransactionInformation.EntryType.ERROR), message });
}
}
/**
* Adds an error message applicable to the entire file
* @param message
*/
public void addFileErrorMessage(String message) {
this.messages.add(new String[] { FlatFileTransactionInformation.getEntryTypeString(FlatFileTransactionInformation.EntryType.ERROR), message });
}
public void addFileInfoMessage(List<String> messages) {
for(String message : messages) {
this.messages.add(new String[] { FlatFileTransactionInformation.getEntryTypeString(FlatFileTransactionInformation.EntryType.INFO), message });
}
}
/**
* Adds an informative message applicable to the entire file
* @param message
*/
public void addFileInfoMessage(String message) {
this.messages.add(new String[] { FlatFileTransactionInformation.getEntryTypeString(FlatFileTransactionInformation.EntryType.INFO), message });
}
/**
* @return the file name of the physical file encapsulated in this PhysicalFlatFileInformation object
*/
public String getFileName() {
return fileName;
}
/**
* Sets the file name of the physical file encapsulated in this PhysicalFlatFileInformation object
* @param fileName the file name of the physical file encapsulated in this PhysicalFlatFileInformation object
*/
public void setFileName(String fileName) {
this.fileName = fileName;
}
/**
* @return a List of all messages associated with the physical file as a whole
*/
public List<String[]> getMessages() {
return messages;
}
public String getAllMessages() {
StringBuffer message = new StringBuffer();
for(String[] resultMessage : getMessages()) {
message.append(resultMessage[1]);
message.append("\n");
}
return message.toString();
}
/**
* Sets a List of messages associated with the physical file as a whole
* @param messages a List of messages
*/
public void setMessages(List<String[]> messages) {
this.messages = messages;
}
/**
* @return a List of the FlatFileInformation objects, each representing a logical file within this physical file
*/
public List<FlatFileInformation> getFlatFileInfomationList() {
return flatFileInfomationList;
}
/**
* Sets the List of FlatFileInformation objects, each representing a logical file within the encapsulated physical file
* @param flatFileInfomationList
*/
public void setFlatFileInfomationList(List<FlatFileInformation> flatFileInfomationList) {
this.flatFileInfomationList = flatFileInfomationList;
}
}
| 34.486486 | 155 | 0.689655 |
905799ef4b7eb69b0bbc6ab3698ca052c066b10c | 1,279 | /*
* Copyright 2000-2008 JetBrains s.r.o.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.plugins.scala.lang.lexer;
import com.intellij.psi.tree.IElementType;
/**
* @author ilyas
*/
public interface ScalaTokenTypesEx extends ScalaTokenTypes {
IElementType SCALA_PLAIN_CONTENT = new ScalaTokenType("ScalaContent");
IElementType SCALA_XML_CONTENT_START = new ScalaTokenType("XmlContentStart");
IElementType SCALA_XML_CONTENT = new ScalaTokenType("ScalaXmlContent");
IElementType SCALA_IN_XML_INJECTION_START = new ScalaTokenType("ScalaXmlInjectionStart");
IElementType SCALA_IN_XML_INJECTION_END = new ScalaTokenType("ScalaXmlInjection End");
// IElementType WHITESPACE_INTERMEDIATE = new ScalaElementType("Strange whitespace");
}
| 36.542857 | 91 | 0.781079 |
f54a5b55fe096e9fbca01880e8dc0b56b3ceb48f | 4,225 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.calcite.rel.convert;
import org.apache.calcite.plan.Convention;
import org.apache.calcite.plan.RelOptRuleCall;
import org.apache.calcite.plan.RelOptRuleOperand;
import org.apache.calcite.plan.RelOptRuleOperandChildPolicy;
import org.apache.calcite.plan.RelRule;
import org.apache.calcite.rel.RelNode;
import org.apache.calcite.rel.core.RelFactories;
import org.apache.calcite.tools.RelBuilderFactory;
import org.apache.calcite.util.ImmutableBeans;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.immutables.value.Value;
/**
* TraitMatchingRule adapts a converter rule, restricting it to fire only when
* its input already matches the expected output trait. This can be used with
* {@link org.apache.calcite.plan.hep.HepPlanner} in cases where alternate
* implementations are available and it is desirable to minimize converters.
*/
@Value.Enclosing
public class TraitMatchingRule extends RelRule<TraitMatchingRule.Config> {
/**
* Creates a configuration for a TraitMatchingRule.
*
* @param converterRule Rule to be restricted; rule must take a single
* operand expecting a single input
* @param relBuilderFactory Builder for relational expressions
*/
public static Config config(ConverterRule converterRule,
RelBuilderFactory relBuilderFactory) {
final RelOptRuleOperand operand = converterRule.getOperand();
assert operand.childPolicy == RelOptRuleOperandChildPolicy.ANY;
return ImmutableTraitMatchingRule.Config.builder().withRelBuilderFactory(relBuilderFactory)
.withDescription("TraitMatchingRule: " + converterRule)
.withOperandSupplier(b0 ->
b0.operand(operand.getMatchedClass()).oneInput(b1 ->
b1.operand(RelNode.class).anyInputs()))
.withConverterRule(converterRule)
.build();
}
//~ Constructors -----------------------------------------------------------
/** Creates a TraitMatchingRule. */
protected TraitMatchingRule(Config config) {
super(config);
}
@Deprecated // to be removed before 2.0
public TraitMatchingRule(ConverterRule converterRule) {
this(config(converterRule, RelFactories.LOGICAL_BUILDER));
}
@Deprecated // to be removed before 2.0
public TraitMatchingRule(ConverterRule converterRule,
RelBuilderFactory relBuilderFactory) {
this(config(converterRule, relBuilderFactory));
}
//~ Methods ----------------------------------------------------------------
@Override public @Nullable Convention getOutConvention() {
return config.converterRule().getOutConvention();
}
@Override public void onMatch(RelOptRuleCall call) {
RelNode input = call.rel(1);
final ConverterRule converterRule = config.converterRule();
if (input.getTraitSet().contains(converterRule.getOutTrait())) {
converterRule.onMatch(call);
}
}
/** Rule configuration. */
@Value.Immutable(singleton = false)
public interface Config extends RelRule.Config {
@Override default TraitMatchingRule toRule() {
return new TraitMatchingRule(this);
}
/** Returns the rule to be restricted; rule must take a single
* operand expecting a single input. */
@SuppressWarnings("deprecation") @ImmutableBeans.Property
ConverterRule converterRule();
/** Sets {@link #converterRule()}. */
Config withConverterRule(ConverterRule converterRule);
}
}
| 39.12037 | 95 | 0.723314 |
52e370108c762106e97938f86815dbca90054e07 | 853 | package net.osmand.plus.mapcontextmenu.builders;
import android.view.View;
import net.osmand.data.Amenity;
import net.osmand.data.TransportStop;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapcontextmenu.MenuBuilder;
public class TransportStopMenuBuilder extends MenuBuilder {
private final TransportStop transportStop;
public TransportStopMenuBuilder(MapActivity mapActivity, final TransportStop transportStop) {
super(mapActivity);
this.transportStop = transportStop;
}
@Override
public void buildInternal(View view) {
Amenity amenity = transportStop.getAmenity();
if (amenity != null) {
AmenityMenuBuilder builder = new AmenityMenuBuilder(mapActivity, amenity);
builder.setLatLon(getLatLon());
builder.setLight(light);
builder.setShowNearestPoi(false);
builder.buildInternal(view);
}
}
} | 28.433333 | 94 | 0.792497 |
4e8f9eb19e04eefc62f330782e3f2198c17c9015 | 355 | package de.simpleworks.staf.commons.exceptions;
public class ArgumentIsNullEmptyString extends IllegalArgumentException {
private static final long serialVersionUID = -2235606358063039269L;
// TODO use it!
public ArgumentIsNullEmptyString(final String argument) {
super(String.format("%s can't be null or empty string.", argument));
}
}
| 32.272727 | 74 | 0.771831 |
32babfdf1854a036228132820cfd25f187bcfc2f | 68,680 | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/7.0.75
* Generated at: 2019-03-09 09:30:15 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp.train.temp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class bddetail_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
private volatile javax.el.ExpressionFactory _el_expressionfactory;
private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public javax.el.ExpressionFactory _jsp_getExpressionFactory() {
if (_el_expressionfactory == null) {
synchronized (this) {
if (_el_expressionfactory == null) {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
}
}
}
return _el_expressionfactory;
}
public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() {
if (_jsp_instancemanager == null) {
synchronized (this) {
if (_jsp_instancemanager == null) {
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
}
}
return _jsp_instancemanager;
}
public void _jspInit() {
}
public void _jspDestroy() {
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("\r\n");
out.write("<!DOCTYPE html>\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n");
out.write("\t<title>设备标定记录详情</title>\t\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write("\t<div class=\"easyui-layout\" data-options=\"fit:true\">\r\n");
out.write(" <div data-options=\"region:'center',border:false\" style=\"padding:5px;\">\r\n");
out.write(" \t<h2 style=\"text-align:center;\">");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.bt}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</h2>\r\n");
out.write(" \t<table class=\"detailTb\">\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td colspan=\"3\">序列号: ");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.swinstrumentid}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td colspan=\"3\">时间: ");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.time}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td colspan=\"3\">温度: ");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.tempture}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\" class=\"bd\">类别</td>\r\n");
out.write(" \t\t\t<td colspan=\"8\">");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.lb}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td rowspan=\"4\" class=\"bd\">基础参数</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">倾角横向修正</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">倾角纵向修正</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">倾角横向K值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">倾角纵向K值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">A端位移K值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">B端位移K值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">编码器分辨率</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">中梁温度系数</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.jc_qjhxxz}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\t\t\r\n");
out.write("\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.jc_qjzxxz}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\t\t\r\n");
out.write("\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.jc_qjhxkz}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\t\t\r\n");
out.write("\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.jc_qjzxkz}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\t\t\r\n");
out.write("\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.jc_adwykz}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\t\t\r\n");
out.write("\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.jc_bdwykz}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\t\t\r\n");
out.write("\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.jc_bmqfbl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\t\t\r\n");
out.write("\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.jc_zlwdxs}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\t\t\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">AB值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">A值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">B值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">C值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">D值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">AE值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">BF值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">H值</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write("\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.jc_abz}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\t\r\n");
out.write("\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.jc_az}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\t\r\n");
out.write("\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.jc_bz}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\t\r\n");
out.write("\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.jc_cz}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\t\r\n");
out.write("\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.jc_dz}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\t\r\n");
out.write("\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.jc_ae}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\t\r\n");
out.write("\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.jc_bf}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\t\r\n");
out.write("\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.jc_hz}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\t\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td rowspan=\"4\" class=\"bd\">轮径检测</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">A前轮径</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">A后轮径</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">A1轮径</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">A2轮径</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">A3轮径</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">A4轮径</td>\r\n");
out.write(" \t\t\t<td colspan=\"2\" class=\"bd\">A测轮径</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.ljjc_aq}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.ljjc_ah}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.ljjc_a1}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.ljjc_a2}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.ljjc_a3}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.ljjc_a4}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td colspan=\"2\">");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.ljjc_ac}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">B前轮径</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">B后轮径</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">B1轮径</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">B2轮径</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">B3轮径</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">B4轮径</td>\r\n");
out.write(" \t\t\t<td colspan=\"2\" class=\"bd\">B测轮径</td>\r\n");
out.write(" \t\t</tr> \t\t\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.ljjc_bq}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.ljjc_bh}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.ljjc_b1}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.ljjc_b2}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.ljjc_b3}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.ljjc_b4}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td colspan=\"2\">");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.ljjc_bc}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td rowspan=\"3\" class=\"bd\">踏轮垂向间隙</td>\r\n");
out.write(" \t\t\t<td colspan=\"2\" class=\"bd\">A前</td>\r\n");
out.write(" \t\t\t<td colspan=\"2\" class=\"bd\">A后</td>\r\n");
out.write(" \t\t\t<td colspan=\"2\" class=\"bd\">B前</td>\r\n");
out.write(" \t\t\t<td colspan=\"2\" class=\"bd\">B后</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">最小值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">最大值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">最小值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">最大值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">最小值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">最大值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">最小值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">最大值</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.tlcx_aq_min}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.tlcx_aq_max}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.tlcx_ah_min}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.tlcx_ah_max}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.tlcx_bq_min}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.tlcx_bq_max}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.tlcx_bh_min}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.tlcx_bh_max}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td rowspan=\"2\" class=\"bd\">挡轮横向间隙</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">A1</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">A2</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">A3</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">A4</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">B1</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">B2</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">B3</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">B4</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.dlhx_a1}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.dlhx_a2}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.dlhx_a3}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.dlhx_a4}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.dlhx_b1}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.dlhx_b2}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.dlhx_b3}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.dlhx_b4}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td rowspan=\"6\" class=\"bd\">轨距标定</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">基准值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">实测</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">差值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">备注</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">基准值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">实测</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">差值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">备注</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">1410</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_shice1410}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_chazhi1410}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_beizhu1410}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">1440</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_shice1440}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_chazhi1440}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_beizhu1440}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">1420</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_shice1420}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_chazhi1420}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_beizhu1420}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">1445</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_shice1445}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_chazhi1445}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_beizhu1445}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">1425</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_shice1425}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_chazhi1425}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_beizhu1425}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">1450</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_shice1450}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_chazhi1450}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_beizhu1450}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">1430</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_shice1430}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_chazhi1430}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_beizhu1430}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">1460</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_shice1460}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_chazhi1460}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_beizhu1460}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">1435</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_shice1435}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_chazhi1435}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_beizhu1435}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">1470</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_shice1470}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_chazhi1470}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.gj_beizhu1470}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td rowspan=\"12\" class=\"bd\">超高标定</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">读数</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">实测</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">修正值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">差值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">读数</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">实测</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">修正值</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">差值</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">0</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_shice1}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_base1}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_beizhu1}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">0</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_shice1}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_base1}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_beizhu1}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">5</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_shice2}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_base2}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_beizhu2}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">-5</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_shice13}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_base13}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_beizhu13}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">10</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_shice3}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_base3}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_beizhu3}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">-10</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_shice14}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_base14}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_beizhu14}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">30</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_shice4}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_base4}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_beizhu4}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">-30</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_shice15}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_base15}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_beizhu15}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">50</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_shice5}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_base5}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_beizhu5}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">-50</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_shice16}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_base16}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_beizhu16}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">70</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_shice6}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_base6}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_beizhu6}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">-70</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_shice17}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_base17}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_beizhu17}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">90</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_shice7}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_base7}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_beizhu7}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">-90</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_shice18}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_base18}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_beizhu18}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">110</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_shice8}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_base8}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_beizhu8}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">-110</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_shice19}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_base19}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_beizhu19}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">130</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_shice9}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_base9}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_beizhu9}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">-130</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_shice20}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_base20}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_beizhu20}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">150</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_shice10}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_base10}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_beizhu10}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">-150</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_shice21}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_base21}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_beizhu21}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">170</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_shice11}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_base11}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_beizhu11}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">-170</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_shice22}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_base22}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cg_beizhu22}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td rowspan=\"2\" class=\"bd\">重复组合</td>\r\n");
out.write(" \t\t\t<td colspan=\"2\" class=\"bd\">轨距(<0.15mm)</td>\r\n");
out.write(" \t\t\t<td colspan=\"2\" class=\"bd\">水平(<0.15mm)</td>\r\n");
out.write(" \t\t\t<td colspan=\"2\" class=\"bd\">端盒平行(<1mm)</td>\r\n");
out.write(" \t\t\t<td colspan=\"2\" class=\"bd\">梁盒间隙(<2mm)</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">基准</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">实测</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">基准</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">实测</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">水平</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">纵向</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">A</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">B</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">1</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">1435</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_gj_shice1}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">0</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_sp_shice1}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_dh_sp1}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_dh_zx1}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_lh_jx_a1}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_lh_jx_b1}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">2</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">1435</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_gj_shice2}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">0</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_sp_shice2}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_dh_sp2}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_dh_zx2}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_lh_jx_a2}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_lh_jx_b2}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">3</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">1435</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_gj_shice3}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">0</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_sp_shice3}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_dh_sp3}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_dh_zx3}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_lh_jx_a3}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_lh_jx_b3}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">4</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">1435</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_gj_shice4}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">0</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_sp_shice4}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_dh_sp4}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_dh_zx4}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_lh_jx_a4}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_lh_jx_b4}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">5</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">1435</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_gj_shice5}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">0</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_sp_shice5}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_dh_sp5}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_dh_zx5}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_lh_jx_a5}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.cf_lh_jx_b5}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">极值偏差</td>\r\n");
out.write(" \t\t\t<td></td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.jzpc_2}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td></td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.jzpc_4}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.jzpc_5}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.jzpc_6}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.jzpc_7}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.jzpc_8}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td colspan=\"9\" style=\"height: 80px\" >");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.bz}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t\t<tr>\r\n");
out.write(" \t\t\t<td class=\"bd\">检定员:</td>\r\n");
out.write(" \t\t\t<td colspan=\"2\">");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.dsy}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">主管:</td>\r\n");
out.write(" \t\t\t<td colspan=\"2\">");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.zg}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t\t<td class=\"bd\">日期:</td>\r\n");
out.write(" \t\t\t<td colspan=\"2\">");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${bd.bdrq}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</td>\r\n");
out.write(" \t\t</tr>\r\n");
out.write(" \t</table>\r\n");
out.write(" </div>\r\n");
out.write(" </div>\r\n");
out.write("</body>\r\n");
out.write("</html>");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try {
if (response.isCommitted()) {
out.flush();
} else {
out.clearBuffer();
}
} catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| 75.973451 | 210 | 0.625102 |
dd746c6532768c51257143b4645d0a79f90c296e | 869 | import mediator.mediator;
import mediator.concreteMediator;
import mediator.problemType;
//Class is responsible for controlling data coming from sensors
//If the value is out of range it calls the problem
//The problem is calling alarm() sensor method
//This method runs mediator method which communicates with other needed sensor
//For example if after refreshing value is still out of range sensorMonitor should shut down the machine.
public class sensorMonitor {
public static void main(String[] args) {
mediator med = new concreteMediator();
System.out.println("High temperature problem:");
med.problemCheck(problemType.HIGHTEMP);
System.out.println("RPM problem:");
med.problemCheck(problemType.RPMVALUE);
System.out.println("High voltage problem:");
med.problemCheck(problemType.OVERVOLTAGE);
}
}
| 39.5 | 105 | 0.741082 |
b5d3d224f6099200c054b3b0db4b68818d71fe55 | 382 | package sch.frog.calculator.compile.lexical.exception;
import sch.frog.calculator.compile.exception.CompileException;
/**
* 重复token异常
*/
public class DuplicateTokenException extends CompileException{
private static final long serialVersionUID = 1L;
public DuplicateTokenException(String word) {
super("token {" + word + "} is duplicate define.");
}
}
| 22.470588 | 62 | 0.727749 |
aca5558d438377b8d413b84d567befbc6b895d35 | 2,150 | /*
* Copyright 2020 NAFU_at
*
* 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 page.nafuchoco.soloservercore.listener;
import lombok.val;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import page.nafuchoco.soloservercore.SoloServerApi;
import page.nafuchoco.soloservercore.SoloServerCore;
import java.util.Objects;
public class AsyncPlayerChatEventListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onAsyncPlayerChatEvent(AsyncPlayerChatEvent event) {
val message = event.getPlayer().getDisplayName() + " >> " +
ChatColor.translateAlternateColorCodes('&', event.getMessage());
SoloServerCore.getInstance().getLogger().info(message);
Bukkit.getOnlinePlayers().stream()
.filter(p -> p.hasPermission("soloservercore.chat.bypass"))
.forEach(p -> p.sendMessage(ChatColor.GRAY + "[Chat] " + message));
val joinedTeam = SoloServerApi.getInstance().getPlayersTeam(event.getPlayer());
if (joinedTeam != null) {
val owner = Bukkit.getPlayer(joinedTeam.getOwner());
if (owner != null)
owner.sendMessage(message);
joinedTeam.getMembers().stream()
.map(Bukkit::getPlayer)
.filter(Objects::nonNull)
.forEach(p -> p.sendMessage(message));
}
event.setCancelled(true);
}
}
| 37.068966 | 87 | 0.690233 |
f82e686566c41b986164bc789eede5b240f6c63d | 843 | package zmaster587.advancedRocketry.api.event;
import cpw.mods.fml.common.eventhandler.Cancelable;
import zmaster587.advancedRocketry.api.IAtmosphere;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.EntityEvent;
public class AtmosphereEvent extends EntityEvent {
public final World world;
public final IAtmosphere atmosphere;
public AtmosphereEvent(Entity entity, IAtmosphere atmosphere) {
super(entity);
world = entity.worldObj;
this.atmosphere = atmosphere;
}
/**
* Called what an entity is about to be ticked in an atmosphere, effects are not applied if canceled
*/
@Cancelable
public static class AtmosphereTickEvent extends AtmosphereEvent {
public AtmosphereTickEvent(Entity entity, IAtmosphere atmosphere) {
super(entity, atmosphere);
}
}
}
| 28.1 | 101 | 0.788849 |
c331142a5e42f1c423037d01b0735ee7167f6575 | 2,712 | /*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.javaagent.typed.base;
import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.api.trace.SpanContext;
import io.opentelemetry.api.trace.StatusCode;
// TODO: This should be moved into the API.
public class DelegatingSpan implements Span {
protected final Span delegate;
public DelegatingSpan(Span delegate) {
this.delegate = delegate;
}
@Override
public Span setAttribute(String key, String value) {
delegate.setAttribute(key, value);
return this;
}
@Override
public Span setAttribute(String key, long value) {
delegate.setAttribute(key, value);
return this;
}
@Override
public Span setAttribute(String key, double value) {
delegate.setAttribute(key, value);
return this;
}
@Override
public Span setAttribute(String key, boolean value) {
delegate.setAttribute(key, value);
return this;
}
@Override
public <T> Span setAttribute(AttributeKey<T> key, T value) {
delegate.setAttribute(key, value);
return this;
}
@Override
public Span addEvent(String name) {
delegate.addEvent(name);
return this;
}
@Override
public Span addEvent(String name, long timestamp) {
delegate.addEvent(name, timestamp);
return this;
}
@Override
public Span addEvent(String name, Attributes attributes) {
delegate.addEvent(name, attributes);
return this;
}
@Override
public Span addEvent(String name, Attributes attributes, long timestamp) {
delegate.addEvent(name, attributes, timestamp);
return this;
}
@Override
public Span setStatus(StatusCode status) {
delegate.setStatus(status);
return this;
}
@Override
public Span setStatus(StatusCode status, String description) {
delegate.setStatus(status, description);
return this;
}
@Override
public Span recordException(Throwable throwable) {
delegate.recordException(throwable);
return this;
}
@Override
public Span recordException(Throwable throwable, Attributes attributes) {
delegate.recordException(throwable, attributes);
return this;
}
@Override
public Span updateName(String name) {
delegate.updateName(name);
return this;
}
@Override
public void end() {
delegate.end();
}
@Override
public void end(long timestamp) {
delegate.end(timestamp);
}
@Override
public SpanContext getSpanContext() {
return delegate.getSpanContext();
}
@Override
public boolean isRecording() {
return delegate.isRecording();
}
}
| 21.52381 | 76 | 0.711283 |
0509ccae91eae2992684bb29d63f9527fbc83fb7 | 1,317 | //package org.jboss.as.quickstarts.datagrid.prova.mappers;
//
//import java.nio.charset.StandardCharsets;
//
//import org.infinispan.distexec.mapreduce.Collector;
//import org.infinispan.distexec.mapreduce.Mapper;
//import org.jboss.as.quickstarts.datagrid.prova.controller.BusinessRuleController;
//
//public class MapperSumCondizionale implements Mapper<byte[], byte[], String, Integer>{
//
//// @Override
//// public void map(String key, RawData value, Collector<String, Integer> collector) {
//// if(value.getHalfKey().equals("0300")){
//// collector.emit(value.getHalfKey(), Integer.parseInt(value.getThirdValue(), 2));
//// }
//// }
//
// /**
// *
// */
// private static final long serialVersionUID = 173449041420365078L;
//
// private String reduceValue;
//
// @Override
// public void map(byte[] key, byte[] value, Collector<String, Integer> collector) {
// String[] recordLineValue = new String (value, StandardCharsets.UTF_8).split(" ");
// if(recordLineValue[1].equals(reduceValue)){
// collector.emit(recordLineValue[1], Integer.parseInt(recordLineValue[3], 2));
// }
// }
//
// public String getReduceValue() {
// return reduceValue;
// }
//
// public void setReduceValue(String reduceValue) {
// this.reduceValue = reduceValue;
// }
//
//
//}
| 30.627907 | 89 | 0.675778 |
a428cb3ab5128f63d866ab5c2168282a609be99e | 8,401 |
/*
* Copyright Contributors to the OpenCue Project
*
* 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.imageworks.spcue.test.dao.postgres;
import java.io.File;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import javax.annotation.Resource;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.input.SAXBuilder;
import org.jdom.output.XMLOutputter;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
import org.springframework.test.context.support.AnnotationConfigContextLoader;
import org.springframework.transaction.annotation.Transactional;
import com.imageworks.spcue.DispatchHost;
import com.imageworks.spcue.JobDetail;
import com.imageworks.spcue.config.TestAppConfig;
import com.imageworks.spcue.dao.DispatcherDao;
import com.imageworks.spcue.dao.HostDao;
import com.imageworks.spcue.dispatcher.Dispatcher;
import com.imageworks.spcue.grpc.host.HardwareState;
import com.imageworks.spcue.grpc.report.RenderHost;
import com.imageworks.spcue.service.AdminManager;
import com.imageworks.spcue.service.GroupManager;
import com.imageworks.spcue.service.HostManager;
import com.imageworks.spcue.service.JobLauncher;
import com.imageworks.spcue.service.JobManager;
import com.imageworks.spcue.test.AssumingPostgresEngine;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@Transactional
@ContextConfiguration(classes=TestAppConfig.class, loader=AnnotationConfigContextLoader.class)
public class DispatcherDaoFifoTests extends AbstractTransactionalJUnit4SpringContextTests {
@Autowired
@Rule
public AssumingPostgresEngine assumingPostgresEngine;
@Resource
DispatcherDao dispatcherDao;
@Resource
HostDao hostDao;
@Resource
JobManager jobManager;
@Resource
HostManager hostManager;
@Resource
AdminManager adminManager;
@Resource
GroupManager groupManager;
@Resource
Dispatcher dispatcher;
@Resource
JobLauncher jobLauncher;
private static final String HOSTNAME="beta";
public DispatchHost getHost() {
return hostDao.findDispatchHost(HOSTNAME);
}
private void launchJobs(int count) throws Exception {
Document docTemplate = new SAXBuilder(true).build(
new File("src/test/resources/conf/jobspec/jobspec_simple.xml"));
docTemplate.getDocType().setSystemID("http://localhost:8080/spcue/dtd/cjsl-1.12.dtd");
Element root = docTemplate.getRootElement();
Element jobTemplate = root.getChild("job");
Element depends = root.getChild("depends");
assertEquals(jobTemplate.getAttributeValue("name"), "test");
root.removeContent(jobTemplate);
root.removeContent(depends);
long t = System.currentTimeMillis();
for (int i = 0; i < count; i++) {
Document doc = (Document) docTemplate.clone();
root = doc.getRootElement();
Element job = (Element) jobTemplate.clone();
job.setAttribute("name", "job" + i);
root.addContent(job);
root.addContent((Element) depends.clone());
jobLauncher.launch(new XMLOutputter().outputString(doc));
// Force to set incremental ts_started to the jobs
// because current_timestamp is not updated during test.
jdbcTemplate.update("UPDATE job SET ts_started = ? WHERE str_name = ?",
new Timestamp(t + i), "pipe-default-testuser_job" + i);
}
}
@Before
public void launchJob() {
dispatcherDao.setFifoSchedulingEnabled(true);
dispatcher.setTestMode(true);
jobLauncher.testMode = true;
}
@After
public void resetFifoScheduling() {
dispatcherDao.setFifoSchedulingEnabled(false);
}
@Before
public void createHost() {
RenderHost host = RenderHost.newBuilder()
.setName(HOSTNAME)
.setBootTime(1192369572)
.setFreeMcp(76020)
.setFreeMem(53500)
.setFreeSwap(20760)
.setLoad(1)
.setTotalMcp(195430)
.setTotalMem(8173264)
.setTotalSwap(20960)
.setNimbyEnabled(false)
.setNumProcs(2)
.setCoresPerProc(100)
.addTags("test")
.setState(HardwareState.UP)
.setFacility("spi")
.putAttributes("SP_OS", "Linux")
.build();
hostManager.createHost(host,
adminManager.findAllocationDetail("spi", "general"));
}
@Test
@Transactional
@Rollback(true)
public void testFifoSchedulingEnabled() {
assertTrue(dispatcherDao.getFifoSchedulingEnabled());
dispatcherDao.setFifoSchedulingEnabled(false);
assertFalse(dispatcherDao.getFifoSchedulingEnabled());
dispatcherDao.setFifoSchedulingEnabled(true);
assertTrue(dispatcherDao.getFifoSchedulingEnabled());
}
@Test
@Transactional
@Rollback(true)
public void testAllSorted() throws Exception {
int count = 10;
launchJobs(count);
List<String> jobs = dispatcherDao.findDispatchJobs(getHost(), count);
assertEquals(count, jobs.size());
for (int i = 0; i < count; i++) {
assertEquals("pipe-default-testuser_job" + i,
jobManager.getJob(jobs.get(i)).getName());
}
}
@Test
@Transactional
@Rollback(true)
public void testPortionSorted() throws Exception {
int count = 100;
launchJobs(count);
int portion = 19;
List<String> jobs = dispatcherDao.findDispatchJobs(getHost(), (portion + 1) / 10);
assertEquals(portion, jobs.size());
for (int i = 0; i < portion; i++) {
assertEquals("pipe-default-testuser_job" + i,
jobManager.getJob(jobs.get(i)).getName());
}
}
@Test
@Transactional
@Rollback(true)
public void testFifoSchedulingDisabled() throws Exception {
dispatcherDao.setFifoSchedulingEnabled(false);
assertFalse(dispatcherDao.getFifoSchedulingEnabled());
int count = 10;
launchJobs(count);
List<String> jobs = dispatcherDao.findDispatchJobs(getHost(), count);
assertEquals(count, jobs.size());
List<String> sortedJobs = new ArrayList<String>(jobs);
Collections.sort(sortedJobs,
Comparator.comparing(jobId -> jobManager.getJob(jobId).getName()));
assertNotEquals(jobs, sortedJobs);
for (int i = 0; i < count; i++) {
assertEquals("pipe-default-testuser_job" + i,
jobManager.getJob(sortedJobs.get(i)).getName());
}
}
@Test
@Transactional
@Rollback(true)
public void testGroup() throws Exception {
int count = 10;
launchJobs(count);
JobDetail job = jobManager.findJobDetail("pipe-default-testuser_job0");
assertNotNull(job);
List<String> jobs = dispatcherDao.findDispatchJobs(getHost(),
groupManager.getGroupDetail(job));
assertEquals(count, jobs.size());
for (int i = 0; i < count; i++) {
assertEquals("pipe-default-testuser_job" + i,
jobManager.getJob(jobs.get(i)).getName());
}
}
}
| 32.945098 | 94 | 0.672777 |
a6417749d97b75b672a0f127aedaa628b671b2a3 | 1,177 | package benchmark.microbenchmark;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
class SimpleServer {
public static void main(String[] args) throws Exception {
ServerSocket server = new ServerSocket(6666);
Socket socket = server.accept();
OutputStream output = socket.getOutputStream();
byte[] bytes = new byte[32*1024]; // 32K
while (true) {
output.write(bytes);
}
}
}
class SimpleClient {
public static void main(String[] args) throws Exception {
Socket socket = new Socket("127.0.0.1", 6666);
InputStream input = socket.getInputStream();
long total = 0;
long start = System.currentTimeMillis();
byte[] bytes = new byte[32*1024]; // 32K
for(int i=1;;i++) {
int read = input.read(bytes);
if (read < 0) break;
total += read;
if (i % 500000 == 0) {
long cost = System.currentTimeMillis() - start;
System.out.printf("Read %,d bytes, speed: %,d MB/s%n", total, total/cost/1000);
}
}
}
}
| 29.425 | 95 | 0.57689 |
8ec4610ed9131c30b0ded5b7834ab5b5850e4fb5 | 842 | package com.alibaba.alink.operator.batch.recommendation;
import org.apache.flink.ml.api.misc.param.Params;
import com.alibaba.alink.common.annotation.NameCn;
import com.alibaba.alink.operator.common.recommendation.RecommType;
import com.alibaba.alink.operator.common.recommendation.UserCfRecommKernel;
import com.alibaba.alink.params.recommendation.BaseRateRecommParams;
/**
* Rating for user-item pair with user CF model.
*/
@NameCn("UserCf:打分推荐")
public class UserCfRateRecommBatchOp
extends BaseRecommBatchOp <UserCfRateRecommBatchOp>
implements BaseRateRecommParams <UserCfRateRecommBatchOp> {
private static final long serialVersionUID = 6913095741234341051L;
public UserCfRateRecommBatchOp() {
this(null);
}
public UserCfRateRecommBatchOp(Params params) {
super(UserCfRecommKernel::new, RecommType.RATE, params);
}
}
| 30.071429 | 75 | 0.815914 |
ebd0c861ce9b00905fb5f0f1d921ff8d5c6ed86b | 458 | //Remove node from linkedlist
//H L L L 0
Node current = head;//L
Node node = current;
Node prev = new Node('0');
prev.next = node;
while (current != null) {//1L
while (node.next != null) {//21L
if (current.value == node.next.value ) {
prev.next = prev.next.next;
}
prev = prev.next;
node = node.next;
}
prev = current;
current = current.next;
node = current;
}
return head;
| 20.818182 | 46 | 0.539301 |
08f29ed9d5babf2726ff0bae06892428debcb88d | 1,083 | package org.pikater.shared.database.jpa.daos;
import java.util.List;
import javax.persistence.EntityManager;
import org.pikater.shared.database.jpa.EntityManagerInstancesCreator;
import org.pikater.shared.database.jpa.JPATaskType;
public class TaskTypeDAO extends AbstractDAO<JPATaskType> {
public TaskTypeDAO() {
super(JPATaskType.class);
}
@Override
public String getEntityName() {
return JPATaskType.EntityName;
}
public JPATaskType createOrGetByName(String name) {
EntityManager em = EntityManagerInstancesCreator.getEntityManagerInstance();
try {
em.getTransaction().begin();
List<JPATaskType> tasks = em.createNamedQuery("TaskType.getByName", JPATaskType.class).setParameter("name", name).getResultList();
if (!tasks.isEmpty()) {
em.getTransaction().commit();
return tasks.get(0);
} else {
JPATaskType newTT = new JPATaskType();
newTT.setName(name);
DAOs.taskTypeDAO.storeEntity(newTT);
return newTT;
}
} catch (Exception e) {
em.getTransaction().rollback();
} finally {
em.close();
}
return null;
}
}
| 25.186047 | 133 | 0.731302 |
de085b49bb6f1b930d70baa86d8080360ebb6a15 | 3,211 | package earlgrey.core;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Timer;
import java.util.TimerTask;
import org.jose4j.jwt.JwtClaims;
import org.json.JSONObject;
import earlgrey.annotations.AddConfig;
import earlgrey.annotations.AddPropertie;
import earlgrey.def.Datasource;
import earlgrey.def.SessionDef;
import earlgrey.interfaces.Cacheable;
import earlgrey.utils.JWT;
@AddConfig(defaultTo = "1800000", name = "SESSION_TIME", earlgrey_name = "Session time expiration")
public class Session {
// LOG
Logging log = new Logging(this.getClass().getName());
// ADMINISTRADOR DE SESIONES
private Hashtable<String,SessionDef> sessions = new Hashtable<String,SessionDef>();
// JWT SESSIONS
private Hashtable<String,SessionDef> sessionsjwt = new Hashtable<String,SessionDef>();
private int timer_time;
private Datasource tenant;
private static Session instance;
//CONSTRUCTOR
public Session(){
this.timer_time = Integer.valueOf(Properties.getInstance().getConfig("SESSION_TIME"));
this.startTimer();
instance = this;
}
// INSTANCIAR LA CLASE DESDE CUALQUIER PUNTO
public static synchronized Session getInstance(){
if(instance == null) instance = new Session();
return instance;
}
// RECUPERAR SESSION DEL SISTEMA
public SessionDef getSession(String id){
if(this.sessions.containsKey(id)){
SessionDef session = this.sessions.get(id);
return session;
}
else
{
SessionDef session = new SessionDef(id);
this.sessions.put(id, session);
return session;
}
}
// RECUPERAR SESSION DEL SISTEMA
public SessionDef getJWTSession(String jwt, String id){
try {
JwtClaims token = JWT.getJWTPayload(jwt);
if(this.sessions.containsKey(token.getJwtId())){
SessionDef session = this.sessions.get(id);
return session;
}
else
{
SessionDef session = new SessionDef(id);
this.sessions.put(id, session);
return session;
}
} catch(Exception e) {
this.log.Warning("Invalid JWT session");
this.log.Warning(e.getMessage());
SessionDef session = new SessionDef(id);
this.sessions.put(id, session);
return session;
}
}
// PROCESO QUE EJECUTAR EL CLEANER
private void sessionCleaner(){
Enumeration<String> keys = this.sessions.keys();
int counter = 0;
while(keys.hasMoreElements()) {
String key = keys.nextElement();
if(this.sessions.get(key).SessionDiff() > this.timer_time) {
this.sessions.remove(key);
counter++;
}
}
if(counter > 0) {
this.log.Info(counter+" sessions has been cleaned.");
}
}
private void startTimer(){
Session self = this;
TimerTask timerTask = new TimerTask()
{
public void run()
{
self.sessionCleaner();
}
};
// PROGRAMAMOS EL TIMER SE SESIONES
Timer timer = new Timer();
// ACTIVAMOS EL SESSION WATCHDOG
timer.scheduleAtFixedRate(timerTask, 0, this.timer_time);
this.log.Info("Session Watchdog - Online");
}
/*public String setTenant(Datasource datasource){
this.tenant = datasource;
return JWT.getJWT(new JSONObject());
}
public void wakeupTenant(String jwt){
this.tenant = new Datasource(JWT.getJWTPayload(jwt));
}*/
}
| 27.681034 | 99 | 0.702896 |
7cad0dd24552d2145fd013abf7334736a0f3a402 | 4,482 | package oop.focus.statistics.model;
import javafx.collections.ObservableSet;
import javafx.util.Pair;
import oop.focus.event.model.Event;
import oop.focus.event.model.EventImpl;
import org.joda.time.Days;
import org.joda.time.LocalDate;
import org.joda.time.LocalDateTime;
import org.joda.time.Minutes;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* Implementation of {@link EventsStatisticFactory}.
*/
public class EventsStatisticFactoryImpl implements EventsStatisticFactory {
private static final int MAX_MINUTES = 24 * 60;
private final ObservableSet<Event> events;
public EventsStatisticFactoryImpl(final ObservableSet<Event> events) {
this.events = events;
}
/**
* {@inheritDoc}
*/
@Override
public final DataCreator<Event, Pair<String, Integer>> eventsOccurrences() {
return new DataCreatorImpl<>(this.events,
(s) -> s.collect(Collectors.toMap(Event::getName, e -> 1,
Integer::sum)).entrySet().stream()
.map((a) -> new Pair<>(a.getKey(), a.getValue())).collect(Collectors.toSet()));
}
/**
* {@inheritDoc}
*/
@Override
public final DataCreator<Event, Pair<LocalDate, Integer>> eventTimePerDay(final String eventName) {
final var events = this.events;
return new GeneratedDataCreator<>(() -> events.stream().filter(e -> e.getName().equals(eventName)).collect(Collectors.toSet()),
s -> s.flatMap(this::getDividedEvents)
.collect(Collectors.toMap(Event::getStartDate, this::getDuration,
Integer::sum)).entrySet().stream()
.map((a) -> new Pair<>(a.getKey(), a.getValue() < MAX_MINUTES ? a.getValue() : MAX_MINUTES)).collect(Collectors.toSet()));
}
/**
* {@inheritDoc}
*/
@Override
public final DataCreator<LocalDate, Pair<LocalDate, Integer>> eventTimePerDay(final String eventName,
final LocalDate start,
final LocalDate end) {
if (start.isAfter(end)) {
throw new IllegalArgumentException();
}
// avoid eclipse error by creating a variable : cannot infer type argument
final Supplier<Set<LocalDate>> supplier = () -> Stream.iterate(start, d -> d.plusDays(1))
.limit(1 + Math.abs(Days.daysBetween(start, end).getDays()))
.collect(Collectors.toSet());
final Function<Stream<LocalDate>, Set<Pair<LocalDate, Integer>>> function =
s -> s.collect(Collectors.toMap(Function.identity(),
v -> this.events.stream()
.filter(e -> e.getName().equals(eventName))
.flatMap(this::getDividedEvents)
.filter(e -> e.getStartDate().equals(v))
.mapToInt(this::getDuration).sum()))
.entrySet().stream()
.map(p -> new Pair<>(p.getKey(), p.getValue())).collect(Collectors.toSet());
return new GeneratedDataCreator<>(supplier, function);
}
private Integer getDuration(final Event e) {
return Math.abs(Minutes.minutesBetween(e.getEnd(), e.getStart()).getMinutes());
}
/**
* a recursive method useful for dividing an event that
* occurs on different days into several under events each of which occurs within a day.
*
* @param event the event to be divided
* @return the list of sub-events
*/
private Stream<Event> getDividedEvents(final Event event) {
final var start = event.getStartDate();
final var end = event.getEndDate();
if (!start.equals(end)) {
final var newDate = start.plusDays(1);
final var midDate = new LocalDateTime(newDate.getYear(), newDate.getMonthOfYear(), newDate.getDayOfMonth(), 0, 0, 0);
return Stream.concat(Stream.of(new EventImpl(event.getName(), event.getStart(), midDate, event.getRepetition())),
this.getDividedEvents(new EventImpl(event.getName(), midDate, event.getEnd(), event.getRepetition())));
}
return Stream.of(event);
}
}
| 43.514563 | 146 | 0.59527 |
3a8d6a9e8cdca0a34cf0e74e5d3e93f86098a522 | 1,152 | package l2f.gameserver.taskmanager;
import java.util.concurrent.Future;
import l2f.commons.threading.RunnableImpl;
import l2f.commons.threading.SteppingRunnableQueueManager;
import l2f.commons.util.Rnd;
import l2f.gameserver.ThreadPoolManager;
import l2f.gameserver.model.Player;
public class AutoSaveManager extends SteppingRunnableQueueManager
{
private static final AutoSaveManager _instance = new AutoSaveManager();
public static final AutoSaveManager getInstance()
{
return _instance;
}
private AutoSaveManager()
{
super(10000L);
ThreadPoolManager.getInstance().scheduleAtFixedRate(this, 10000L, 10000L);
//Очистка каждые 60 секунд
ThreadPoolManager.getInstance().scheduleAtFixedRate(new RunnableImpl()
{
@Override
public void runImpl()
{
AutoSaveManager.this.purge();
}
}, 60000L, 60000L);
}
public Future<?> addAutoSaveTask(final Player player)
{
long delay = Rnd.get(180, 360) * 1000L;
return scheduleAtFixedRate(new RunnableImpl()
{
@Override
public void runImpl()
{
if (player == null || !player.isOnline())
return;
player.store(true);
}
}, delay, delay);
}
} | 21.735849 | 76 | 0.738715 |
3a42a3e6f3dd59d6360958f7901e8b273f0cf7b0 | 496 | package com.codingwasabi.trti.domain.member.model.response;
import com.codingwasabi.trti.domain.result.model.values.AnswerType;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class ResponseMemberDetailResultDto {
private int id;
private Integer selected;
public static ResponseMemberDetailResultDto from(AnswerType answerType) {
return new ResponseMemberDetailResultDto(answerType.getTypeId(), answerType.getSelected());
}
}
| 29.176471 | 99 | 0.802419 |
4dd462962b2da77d893d79e9b94ce0bd86343c21 | 410 | package com.quorum.tessera.discovery.internal;
import com.quorum.tessera.discovery.Discovery;
import java.util.Optional;
enum DiscoveryHolderImpl implements DiscoveryHolder {
INSTANCE;
private Discovery discovery;
@Override
public void set(Discovery discovery) {
this.discovery = discovery;
}
@Override
public Optional<Discovery> get() {
return Optional.ofNullable(discovery);
}
}
| 19.52381 | 53 | 0.758537 |
dbcbd931e1a8211d9b39e052360244edb8266109 | 997 | package org.raml.olingo.codegen.core.extn;
import com.sun.codemodel.JCodeModel;
import com.sun.codemodel.JDefinedClass;
import com.sun.codemodel.JMethod;
import org.raml.model.Action;
import org.raml.model.MimeType;
import org.raml.model.Raml;
import org.raml.model.Resource;
import org.raml.model.parameter.AbstractParam;
import java.lang.annotation.Annotation;
import java.util.Collection;
public interface GeneratorExtension {
public void onCreateResourceInterface(final JDefinedClass resourceInterface, Resource resource);
public void onAddResourceMethod(final JMethod method, final Action action,
final MimeType bodyMimeType, final Collection<MimeType> uniqueResponseMimeTypes);
public boolean AddParameterFilter(final String name, final AbstractParam parameter,
final Class<? extends Annotation> annotationClass, final JMethod method);
void setRaml(Raml raml);
void setCodeModel(JCodeModel codeModel);
} | 35.607143 | 115 | 0.767302 |
3d09f7293fe7b81af88d192f0222c7690a965509 | 246 | package org.springboot.configuration;
import org.springframework.context.annotation.Configuration;
@Configuration
public class WebMvcConfiguration {
public WebMvcConfiguration() {
System.out.println("WebMvcConfiguration created...");
}
}
| 18.923077 | 60 | 0.800813 |
e6f88daa2e9726850307ee2970a3fbb8f3a0a023 | 1,470 | package joshie.progression.json;
import joshie.progression.helpers.StackHelper;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import java.util.List;
import java.util.UUID;
public class DataCriteria {
long timestamp;
UUID uuid;
String displayName;
String displayStack;
List<DataTrigger> triggers;
List<DataGeneric> rewards;
UUID[] prereqs;
UUID[] conflicts;
int repeatable;
boolean infinite;
int tasksRequired;
boolean allTasks;
int x;
int y;
boolean isVisible;
boolean displayAchievement;
public int rewardsGiven;
public boolean allRewards;
private transient ItemStack theStack;
public ItemStack getIcon() {
if (theStack == null) {
theStack = StackHelper.getStackFromString(displayStack);
}
if (theStack == null) theStack = new ItemStack(Items.BOOK);
//Validation yo
return theStack;
}
public String getName() {
return displayName;
}
public UUID getUUID() {
return uuid;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DataCriteria criteria = (DataCriteria) o;
return uuid != null ? uuid.equals(criteria.uuid) : criteria.uuid == null;
}
@Override
public int hashCode() {
return uuid != null ? uuid.hashCode() : 0;
}
}
| 22.96875 | 81 | 0.636735 |
117865c6e56730423a2faa1c127a5ce838734617 | 1,041 | package br.senai.sc.edu.projetomaria.model;
import java.util.ArrayList;
import java.util.List;
import org.joda.time.DateTime;
public class RetornoHistorico {
private List<Double> listaValor = new ArrayList<Double>();
private List<Double> listaDemanda = new ArrayList<Double>();
private List<DateTime> listaDataSku = new ArrayList<DateTime>();
public RetornoHistorico() {
super();
}
public RetornoHistorico(List<Double> listaValor, List<DateTime> listaDataSku) {
this.listaValor = listaValor;
this.listaDataSku = listaDataSku;
}
public List<Double> getListaDemanda() {
return listaDemanda;
}
public void setListaDemanda(List<Double> listaDemanda) {
listaDemanda = listaDemanda;
}
public List<Double> getListaValor() {
return listaValor;
}
public void setListaValor(List<Double> listaValor) {
this.listaValor = listaValor;
}
public List<DateTime> getListaDataSku() {
return listaDataSku;
}
public void setListaDataSku(List<DateTime> listaDataSku) {
this.listaDataSku = listaDataSku;
}
}
| 20.82 | 80 | 0.746398 |
f70066b133d1cb8ec76d11742fa3ffba631cb8e3 | 2,076 | /*
* Copyright (c) 2010-2018. Axon Framework
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.axonframework.eventsourcing.eventstore.jpa;
import org.axonframework.eventhandling.DomainEventMessage;
import org.axonframework.eventsourcing.eventstore.AbstractSnapshotEventEntry;
import org.axonframework.serialization.Serializer;
import javax.persistence.Entity;
/**
* Default implementation of an event entry containing a serialized snapshot of an aggregate. This implementation is
* used by the {@link JpaEventStorageEngine} to store snapshot events. Event payload and metadata are serialized to a
* byte array.
*
* @author Rene de Waele
*/
@Entity
public class SnapshotEventEntry extends AbstractSnapshotEventEntry<byte[]> {
/**
* Construct a new default snapshot event entry from an aggregate. The snapshot payload and metadata will be
* serialized to a byte array.
* <p>
* The given {@code serializer} will be used to serialize the payload and metadata in the given {@code
* eventMessage}. The type of the serialized data will be the same as the given {@code contentType}.
*
* @param eventMessage The snapshot event message to convert to a serialized event entry
* @param serializer The serializer to convert the snapshot event
*/
public SnapshotEventEntry(DomainEventMessage<?> eventMessage, Serializer serializer) {
super(eventMessage, serializer, byte[].class);
}
/**
* Default constructor required by JPA
*/
protected SnapshotEventEntry() {
}
}
| 37.745455 | 117 | 0.741811 |
ae6ab13cf0b011214ff588d99edb28124e8d2c46 | 4,694 | package com.example.myapplication;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.PopupMenu;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import static com.example.myapplication.MainActivity.toast;
public class RecentFilesAdapter extends RecyclerView.Adapter<RecentFilesAdapter.RecentFilesViewHolder> {
ArrayList<Item> items;
Context context;
public RecentFilesAdapter(ArrayList<Item> items, Context context) {
this.items = items;
this.context = context;
}
@NonNull
@Override
public RecentFilesViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_recent_file, parent, false);
return new RecentFilesViewHolder(itemView);
}
@Override
public void onBindViewHolder(@NonNull final RecentFilesViewHolder holder, final int position) {
Item currentItem = items.get(position);
final int currentPosition = holder.getAdapterPosition();
holder.fileImage.setImageBitmap(currentItem.getImageBitmap());
holder.fileName.setText(currentItem.getFileName());
holder.itemMenu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
PopupMenu popupMenu = new PopupMenu(context, holder.itemMenu);
popupMenu.inflate(R.menu.item_menu);
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
switch (menuItem.getItemId()) {
case R.id.share:
if (toast != null) {
toast.cancel();
}
toast = Toast.makeText(context, "Share Clicked " + currentPosition, Toast.LENGTH_SHORT);
toast.show();
return true;
case R.id.file_info:
if (toast != null) {
toast.cancel();
}
toast = Toast.makeText(context, "File Info...", Toast.LENGTH_SHORT);
toast.show();
return true;
case R.id.remove:
items.remove(currentPosition);
notifyItemRemoved(currentPosition);
notifyItemRangeChanged(currentPosition, getItemCount());
if (toast != null) {
toast.cancel();
}
toast = Toast.makeText(context, "Item Removed " + position, Toast.LENGTH_SHORT);
toast.show();
return true;
case R.id.delete:
items.remove(position);
notifyItemRemoved(position);
notifyItemChanged(position);
if (toast != null) {
toast.cancel();
}
toast = Toast.makeText(context, "Item Deleted", Toast.LENGTH_SHORT);
toast.show();
return true;
default:
return false;
}
}
});
popupMenu.show();
}
});
}
@Override
public int getItemCount() {
return items.size();
}
public static class RecentFilesViewHolder extends RecyclerView.ViewHolder {
public ImageView fileImage;
public TextView fileName;
public ImageView itemMenu;
public RecentFilesViewHolder(@NonNull View itemView) {
super(itemView);
fileImage = itemView.findViewById(R.id.image);
fileName = itemView.findViewById(R.id.filename);
itemMenu = itemView.findViewById(R.id.item_menu);
}
}
}
| 38.793388 | 120 | 0.519599 |
ae5959bf6d8c08ad517e6001e5393c142fa1fe5b | 2,462 | package site.ycsb.db.hfu;
import de.hfu.keyvaluestore.protocol.generated.Clientapi;
import de.hfu.keyvaluestore.protocol.generated.KeyValueStoreServiceGrpc;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import java.util.Map;
import java.util.concurrent.TimeUnit;
public class BlockingGrpcKeyValueStoreClient implements AutoCloseable {
private final String host;
private final int port;
private ManagedChannel channel;
private KeyValueStoreServiceGrpc.KeyValueStoreServiceBlockingStub blockingStub;
public BlockingGrpcKeyValueStoreClient(String hostAndPort) {
String[] parts = hostAndPort.split(":");
this.host = parts[0];
this.port = Integer.parseInt(parts[1]);
}
public BlockingGrpcKeyValueStoreClient(String host, int port) {
this.host = host;
this.port = port;
}
public void open() {
if (channel != null)
throw new IllegalStateException("Client already opened.");
channel = ManagedChannelBuilder
.forAddress(host, port)
.usePlaintext().build();
blockingStub = KeyValueStoreServiceGrpc.newBlockingStub(channel);
}
public Clientapi.GetCompleted get(String key) {
Clientapi.GetCommand command = Clientapi.GetCommand
.newBuilder()
.setKey(key)
.build();
return blockingStub.get(command);
}
public Clientapi.Ok put(String key, Map<String, String> values, boolean persist) {
Clientapi.PutCommand command = Clientapi.PutCommand
.newBuilder()
.setKey(key)
.putAllValue(values)
.setPersist(persist)
.build();
return blockingStub.put(command);
}
public Clientapi.Ok delete(String key, boolean persist) {
Clientapi.DeleteCommand command = Clientapi.DeleteCommand
.newBuilder()
.setKey(key)
.setPersist(persist)
.build();
return blockingStub.delete(command);
}
public Clientapi.ShardingState queryClusterState() {
Clientapi.QueryShardingStateMessage command = Clientapi.QueryShardingStateMessage
.newBuilder()
.build();
return blockingStub.queryShardingState(command);
}
@Override
public void close() throws Exception {
channel.shutdown().awaitTermination(5, TimeUnit.SECONDS);
}
}
| 31.974026 | 89 | 0.655158 |
8224dd21de56c1a7cb03985065c524b0d0fc740d | 9,576 | package org.umlg.sqlg.test.io;
import org.apache.commons.collections4.set.ListOrderedSet;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
import org.apache.tinkerpop.gremlin.structure.io.GraphWriter;
import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONIo;
import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONVersion;
import org.apache.tinkerpop.gremlin.structure.io.graphson.TypeInfo;
import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoIo;
import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoVersion;
import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedFactory;
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.umlg.sqlg.structure.PropertyType;
import org.umlg.sqlg.structure.topology.VertexLabel;
import org.umlg.sqlg.test.BaseTest;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
/**
* @author Pieter Martin (https://github.com/pietermartin)
* Date: 2017/09/03
*/
@RunWith(Parameterized.class)
public class TestIoEdge extends BaseTest {
@Parameterized.Parameters(name = "{0}")
public static Iterable<Object[]> data() {
return Arrays.asList(new Object[][]{
{"graphson-v1", false, false,
(Function<Graph, GraphReader>) g -> g.io(GraphSONIo.build(GraphSONVersion.V1_0)).reader().create(),
(Function<Graph, GraphWriter>) g -> g.io(GraphSONIo.build(GraphSONVersion.V1_0)).writer().create()},
{"graphson-v1-embedded", true, true,
(Function<Graph, GraphReader>) g -> g.io(GraphSONIo.build(GraphSONVersion.V1_0)).reader().mapper(g.io(GraphSONIo.build(GraphSONVersion.V2_0)).mapper().typeInfo(TypeInfo.PARTIAL_TYPES).create()).create(),
(Function<Graph, GraphWriter>) g -> g.io(GraphSONIo.build(GraphSONVersion.V1_0)).writer().mapper(g.io(GraphSONIo.build(GraphSONVersion.V2_0)).mapper().typeInfo(TypeInfo.PARTIAL_TYPES).create()).create()},
{"graphson-v2", false, false,
(Function<Graph, GraphReader>) g -> g.io(GraphSONIo.build(GraphSONVersion.V2_0)).reader().mapper(g.io(GraphSONIo.build(GraphSONVersion.V2_0)).mapper().typeInfo(TypeInfo.NO_TYPES).create()).create(),
(Function<Graph, GraphWriter>) g -> g.io(GraphSONIo.build(GraphSONVersion.V2_0)).writer().mapper(g.io(GraphSONIo.build(GraphSONVersion.V2_0)).mapper().typeInfo(TypeInfo.NO_TYPES).create()).create()},
{"graphson-v2-embedded", true, true,
(Function<Graph, GraphReader>) g -> g.io(GraphSONIo.build(GraphSONVersion.V2_0)).reader().mapper(g.io(GraphSONIo.build(GraphSONVersion.V2_0)).mapper().typeInfo(TypeInfo.PARTIAL_TYPES).create()).create(),
(Function<Graph, GraphWriter>) g -> g.io(GraphSONIo.build(GraphSONVersion.V2_0)).writer().mapper(g.io(GraphSONIo.build(GraphSONVersion.V2_0)).mapper().typeInfo(TypeInfo.PARTIAL_TYPES).create()).create()},
{"graphson-v3", true, true,
(Function<Graph, GraphReader>) g -> g.io(GraphSONIo.build(GraphSONVersion.V3_0)).reader().mapper(g.io(GraphSONIo.build(GraphSONVersion.V3_0)).mapper().create()).create(),
(Function<Graph, GraphWriter>) g -> g.io(GraphSONIo.build(GraphSONVersion.V3_0)).writer().mapper(g.io(GraphSONIo.build(GraphSONVersion.V3_0)).mapper().create()).create()},
{"gryo-v1", true, true,
(Function<Graph, GraphReader>) g -> g.io(GryoIo.build(GryoVersion.V1_0)).reader().create(),
(Function<Graph, GraphWriter>) g -> g.io(GryoIo.build(GryoVersion.V1_0)).writer().create()},
{"gryo-v3", true, true,
(Function<Graph, GraphReader>) g -> g.io(GryoIo.build(GryoVersion.V3_0)).reader().create(),
(Function<Graph, GraphWriter>) g -> g.io(GryoIo.build(GryoVersion.V3_0)).writer().create()}
});
}
@Parameterized.Parameter()
public String ioType;
@Parameterized.Parameter(value = 1)
public boolean assertIdDirectly;
@Parameterized.Parameter(value = 2)
public boolean assertDouble;
@Parameterized.Parameter(value = 3)
public Function<Graph, GraphReader> readerMaker;
@Parameterized.Parameter(value = 4)
public Function<Graph, GraphWriter> writerMaker;
@Test
public void shouldReadWriteEdge() throws Exception {
final Vertex v1 = this.sqlgGraph.addVertex(T.label, "person");
final Vertex v2 = this.sqlgGraph.addVertex(T.label, "person");
final Edge e = v1.addEdge("friend", v2, "weight", 0.5d, "acl", "rw");
assertEdge(v1, v2, e, true);
}
@Test
public void shouldReadWriteEdgeUserSuppliedPK() throws Exception {
VertexLabel personVertexLabel = this.sqlgGraph.getTopology().getPublicSchema().
ensureVertexLabelExist(
"person",
new HashMap<String, PropertyType>() {{
put("uid1", PropertyType.varChar(100));
put("uid2", PropertyType.varChar(100));
}},
ListOrderedSet.listOrderedSet(Arrays.asList("uid1", "uid2"))
);
personVertexLabel.ensureEdgeLabelExist(
"friend",
personVertexLabel,
new HashMap<String, PropertyType>() {{
put("uid1", PropertyType.varChar(100));
put("uid2", PropertyType.varChar(100));
put("weight", PropertyType.DOUBLE);
put("acl", PropertyType.STRING);
}},
ListOrderedSet.listOrderedSet(Arrays.asList("uid1", "uid2"))
);
final Vertex v1 = this.sqlgGraph.addVertex(T.label, "person", "uid1", UUID.randomUUID().toString(), "uid2", UUID.randomUUID().toString());
final Vertex v2 = this.sqlgGraph.addVertex(T.label, "person", "uid1", UUID.randomUUID().toString(), "uid2", UUID.randomUUID().toString());
final Edge e = v1.addEdge("friend", v2, "weight", 0.5d, "acl", "rw", "uid1", UUID.randomUUID().toString(), "uid2", UUID.randomUUID().toString());
assertEdge(v1, v2, e, true);
}
@Test
public void shouldReadWriteDetachedEdge() throws Exception {
final Vertex v1 = this.sqlgGraph.addVertex(T.label, "person");
final Vertex v2 = this.sqlgGraph.addVertex(T.label, "person");
final Edge e = DetachedFactory.detach(v1.addEdge("friend", v2, "weight", 0.5d, "acl", "rw"), true);
assertEdge(v1, v2, e, true);
}
@Test
public void shouldReadWriteDetachedEdgeAsReference() throws Exception {
final Vertex v1 = this.sqlgGraph.addVertex(T.label, "person");
final Vertex v2 = this.sqlgGraph.addVertex(T.label, "person");
final Edge e = DetachedFactory.detach(v1.addEdge("friend", v2, "weight", 0.5d, "acl", "rw"), false);
assertEdge(v1, v2, e, false);
}
private void assertEdge(final Vertex v1, final Vertex v2, final Edge e, final boolean assertProperties) throws IOException {
try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
final GraphWriter writer = writerMaker.apply(this.sqlgGraph);
writer.writeEdge(os, e);
final AtomicBoolean called = new AtomicBoolean(false);
final GraphReader reader = readerMaker.apply(this.sqlgGraph);
try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
reader.readEdge(bais, edge -> {
final Edge detachedEdge = (Edge) edge;
Assert.assertEquals(e.id(), assertIdDirectly ? detachedEdge.id() : this.sqlgGraph.edges(detachedEdge.id().toString()).next().id());
Assert.assertEquals(v1.id(), assertIdDirectly ? detachedEdge.outVertex().id() : this.sqlgGraph.vertices(detachedEdge.outVertex().id().toString()).next().id());
Assert.assertEquals(v2.id(), assertIdDirectly ? detachedEdge.inVertex().id() : this.sqlgGraph.vertices(detachedEdge.inVertex().id().toString()).next().id());
Assert.assertEquals(v1.label(), detachedEdge.outVertex().label());
Assert.assertEquals(v2.label(), detachedEdge.inVertex().label());
Assert.assertEquals(e.label(), detachedEdge.label());
if (assertProperties) {
Assert.assertEquals(assertDouble ? 0.5d : 0.5f, e.properties("weight").next().value());
Assert.assertEquals("rw", e.properties("acl").next().value());
} else {
Assert.assertEquals(e.keys().size(), IteratorUtils.count(detachedEdge.properties()));
}
called.set(true);
return null;
});
}
Assert.assertTrue(called.get());
}
}
}
| 55.674419 | 228 | 0.639933 |
5719e4a23d84bbfbd6ff8de7ebd0366eebbd5733 | 3,444 | // Copyright 2016 Twitter. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.twitter.heron.metricsmgr.sink;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.HashMap;
import java.util.Map;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import com.twitter.heron.common.basics.FileUtils;
import com.twitter.heron.spi.metricsmgr.sink.SinkContext;
/**
* FileSink Tester.
*/
public class FileSinkTest {
private FileSink fileSink;
private File tmpDir;
@Before
public void before() throws IOException {
fileSink = new FileSink();
Map<String, Object> conf = new HashMap<>();
tmpDir = Files.createTempDirectory("filesink").toFile();
conf.put("filename-output", tmpDir.getAbsolutePath() + "/filesink");
conf.put("file-maximum", 100);
SinkContext context = Mockito.mock(SinkContext.class);
Mockito.when(context.getMetricsMgrId()).thenReturn("test");
fileSink.init(conf, context);
}
@After
public void after() {
fileSink.close();
for (File file: tmpDir.listFiles()) {
file.delete();
}
tmpDir.delete();
}
/**
* Method: flush()
*/
@Test
public void testFirstFlushWithoutRecords() {
fileSink.flush();
String content = new String(FileUtils.readFromFile(
new File(tmpDir, "/filesink.test.0").getAbsolutePath()), StandardCharsets.UTF_8);
Assert.assertEquals("[]", content);
}
/**
* Method: flush()
*/
@Test
public void testSuccessiveFlushWithoutRecords() throws UnsupportedEncodingException {
fileSink.flush();
fileSink.flush();
String content = new String(FileUtils.readFromFile(
new File(tmpDir, "/filesink.test.0").getAbsolutePath()), StandardCharsets.UTF_8);
Assert.assertEquals("[]", content);
content = new String(FileUtils.readFromFile(
new File(tmpDir, "/filesink.test.1").getAbsolutePath()), StandardCharsets.UTF_8);
Assert.assertEquals("[]", content);
}
/**
* Method: init()
*/
@Test
public void testIllegalConf() throws IOException {
FileSink sink = new FileSink();
Map<String, Object> conf = new HashMap<>();
SinkContext context = Mockito.mock(SinkContext.class);
try {
sink.init(conf, context);
Assert.fail("Expected IllegalArgumentException.");
} catch (IllegalArgumentException e) {
Assert.assertEquals("Require: filename-output", e.getMessage());
}
sink = new FileSink();
conf.put("filename-output", tmpDir.getAbsolutePath() + "/filesink");
try {
sink.init(conf, context);
Assert.fail("Expected IllegalArgumentException.");
} catch (IllegalArgumentException e) {
Assert.assertEquals("Require: file-maximum", e.getMessage());
}
}
}
| 30.210526 | 89 | 0.697154 |
0d8bb2b1a5febb4ecad53a9214ae80abc89006c3 | 252 | package com.dave;
import java.util.Comparator;
class ComparadorNombre implements Comparator<Contacto> {
@Override
public int compare(Contacto a, Contacto b) {
return a.getNombre().compareToIgnoreCase(b.getNombre());
}
}
| 22.909091 | 65 | 0.690476 |
9dd50c70647107a7e61dcbde47952530614a26e2 | 7,026 | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.aliyun.openservices.tablestore.hadoop;
import java.util.Set;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import org.apache.hadoop.io.Writable;
import com.alicloud.openservices.tablestore.model.RangeRowQueryCriteria;
import com.alicloud.openservices.tablestore.model.TimeRange;
import com.alicloud.openservices.tablestore.model.Direction;
import com.alicloud.openservices.tablestore.core.utils.Preconditions;
public class RangeRowQueryCriteriaWritable implements Writable {
private RangeRowQueryCriteria criteria = null;
public RangeRowQueryCriteriaWritable() {
}
public RangeRowQueryCriteriaWritable(RangeRowQueryCriteria criteria) {
Preconditions.checkNotNull(criteria, "criteria should not be null.");
this.criteria = criteria;
}
public RangeRowQueryCriteria getRangeRowQueryCriteria() {
return criteria;
}
@Override public void write(DataOutput out) throws IOException {
Preconditions.checkNotNull(criteria, "criteria should not be null.");
Preconditions.checkNotNull(
criteria.getTableName(),
"criteria must have table name");
out.writeByte(WritableConsts.GETRANGE_ROW_QUERY_CRITERIA);
out.writeUTF(criteria.getTableName());
if (criteria.numColumnsToGet() > 0) {
Set<String> cols = criteria.getColumnsToGet();
out.writeByte(WritableConsts.GETRANGE_COLUMNS_TO_GET);
out.writeInt(cols.size());
for(String c: cols) {
out.writeUTF(c);
}
}
if (criteria.hasSetMaxVersions()) {
out.writeByte(WritableConsts.GETRANGE_MAX_VERSIONS);
out.writeInt(criteria.getMaxVersions());
}
if (criteria.hasSetTimeRange()) {
TimeRange tm = criteria.getTimeRange();
out.writeByte(WritableConsts.GETRANGE_TIME_RANGE);
out.writeLong(tm.getStart());
out.writeLong(tm.getEnd());
}
if (criteria.hasSetCacheBlock()) {
out.writeByte(WritableConsts.GETRANGE_CACHE_BLOCKS);
out.writeBoolean(criteria.getCacheBlocks());
}
if (criteria.hasSetStartColumn()) {
out.writeByte(WritableConsts.GETRANGE_START_COLUMN);
out.writeUTF(criteria.getStartColumn());
}
if (criteria.hasSetEndColumn()) {
out.writeByte(WritableConsts.GETRANGE_END_COLUMN);
out.writeUTF(criteria.getEndColumn());
}
if (criteria.getLimit() != -1) {
out.writeByte(WritableConsts.GETRANGE_LIMIT);
out.writeInt(criteria.getLimit());
}
if (criteria.getDirection() != Direction.FORWARD) {
Preconditions.checkArgument(
criteria.getDirection() == Direction.BACKWARD,
"direction must be either FORWARD or BACKWORD");
out.writeByte(WritableConsts.GETRANGE_BACKWARDS);
}
if (criteria.getInclusiveStartPrimaryKey() != null) {
out.writeByte(WritableConsts.GETRANGE_START_PKEY);
new PrimaryKeyWritable(criteria.getInclusiveStartPrimaryKey()).write(out);
}
if (criteria.getExclusiveEndPrimaryKey() != null) {
out.writeByte(WritableConsts.GETRANGE_END_PKEY);
new PrimaryKeyWritable(criteria.getExclusiveEndPrimaryKey()).write(out);
}
if (criteria.hasSetFilter()) {
new FilterWritable(criteria.getFilter()).write(out);
}
out.writeByte(WritableConsts.GETRANGE_FINISH);
}
@Override public void readFields(DataInput in) throws IOException {
byte tagCriteria = in.readByte();
if (tagCriteria != WritableConsts.GETRANGE_ROW_QUERY_CRITERIA) {
throw new IOException("broken input stream");
}
String tblName = in.readUTF();
criteria = new RangeRowQueryCriteria(tblName);
while(true) {
byte tag = in.readByte();
if (tag == WritableConsts.GETRANGE_COLUMNS_TO_GET) {
int sz = in.readInt();
for(int i = 0; i < sz; ++i) {
String c = in.readUTF();
criteria.addColumnsToGet(c);
}
} else if (tag == WritableConsts.GETRANGE_MAX_VERSIONS) {
criteria.setMaxVersions(in.readInt());
} else if (tag == WritableConsts.GETRANGE_TIME_RANGE) {
long start = in.readLong();
long end = in.readLong();
criteria.setTimeRange(new TimeRange(start, end));
} else if (tag == WritableConsts.GETRANGE_CACHE_BLOCKS) {
criteria.setCacheBlocks(in.readBoolean());
} else if (tag == WritableConsts.GETRANGE_START_COLUMN) {
criteria.setStartColumn(in.readUTF());
} else if (tag == WritableConsts.GETRANGE_END_COLUMN) {
criteria.setEndColumn(in.readUTF());
} else if (tag == WritableConsts.GETRANGE_LIMIT) {
criteria.setLimit(in.readInt());
} else if (tag == WritableConsts.GETRANGE_BACKWARDS) {
criteria.setDirection(Direction.BACKWARD);
} else if (tag == WritableConsts.GETRANGE_START_PKEY) {
PrimaryKeyWritable pkey = PrimaryKeyWritable.read(in);
criteria.setInclusiveStartPrimaryKey(pkey.getPrimaryKey());
} else if (tag == WritableConsts.GETRANGE_END_PKEY) {
PrimaryKeyWritable pkey = PrimaryKeyWritable.read(in);
criteria.setExclusiveEndPrimaryKey(pkey.getPrimaryKey());
} else if (tag == WritableConsts.FILTER) {
criteria.setFilter(FilterWritable.readFilter(in));
} else {
if (tag != WritableConsts.GETRANGE_FINISH) {
throw new IOException("broken input stream");
}
break;
}
}
}
public static RangeRowQueryCriteriaWritable read(DataInput in) throws IOException {
RangeRowQueryCriteriaWritable w = new RangeRowQueryCriteriaWritable();
w.readFields(in);
return w;
}
}
| 42.841463 | 87 | 0.639909 |
3dd1dd4d26556ee24d4d7efdc3ddd384796da46c | 3,413 | // Copyright 2017 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.enterprise.gsafeed;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.NormalizedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
@XmlRootElement(name = "meta")
public class Meta {
@XmlAttribute(name = "encoding")
protected Encoding encoding;
@XmlAttribute(name = "name", required = true)
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
protected String name;
@XmlAttribute(name = "content", required = true)
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
protected String content;
/** Encoding types. */
@XmlType(name = "meta-encoding")
@XmlEnum(String.class)
public static enum Encoding {
@XmlEnumValue("base64binary")
BASE64_BINARY("base64binary");
private String xmlValue;
private Encoding(String xmlValue) {
this.xmlValue = xmlValue;
}
@Override
public String toString() {
return xmlValue;
}
public static Encoding fromString(String value) {
if (value == null) {
return null;
}
for (Encoding encoding : Encoding.values()) {
if (encoding.xmlValue.equals(value)) {
return encoding;
}
}
throw new IllegalArgumentException(value);
}
}
/**
* Gets the value of the encoding property.
*
* @return possible object is {@link Encoding}
*/
public Encoding getEncoding() {
return encoding;
}
/**
* Sets the value of the encoding property.
*
* @param value allowed object is {@link Encoding} or null
* @return this object
*/
public Meta setEncoding(Encoding value) {
this.encoding = value;
return this;
}
/**
* Gets the value of the name property.
*
* @return possible object is {@link String}
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value allowed object is {@link String}
* @return this object
*/
public Meta setName(String value) {
this.name = value;
return this;
}
/**
* Gets the value of the content property.
*
* @return possible object is {@link String}
*/
public String getContent() {
return content;
}
/**
* Sets the value of the content property.
*
* @param value allowed object is {@link String}
* @return this object
*/
public Meta setContent(String value) {
this.content = value;
return this;
}
}
| 25.281481 | 75 | 0.685614 |
6f28a95238d1ec2f62caba31058e9da37f5dea8f | 1,652 | package com.adaptris.core.transform.json.jolt;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.bazaarvoice.jolt.Transform;
/**
* {@link Transform} implementation that turns all nulls into the empty string {@code ""}.
* <p>
* You can use this by specifying the fully qualified class name as the {@code operation} in your jolt specification
* </p>
* <pre>
* {@code [{"operation": ...skipped for brevity }, { "operation": "com.adaptris.core.transform.json.jolt.NullToEmptyString"}]}
* </pre>
*
*/
public class NullToEmptyString implements Transform {
@Override
public Object transform(Object input) {
return convertNullToEmpty(input);
}
@SuppressWarnings("unchecked")
private static <T> T convertNullToEmpty(T input) {
if(input instanceof Map<?, ?>) {
// Json Object
return (T) convertNullToEmpty((Map<?, ?>) input);
} else
if(input instanceof List<?>) {
// Json Array
return (T) convertNullToEmpty((List<?>) input);
} else {
// Literal Value
if (input == null) {
return (T) "";
} else {
return input;
}
}
}
private static <T> List<T> convertNullToEmpty(List<T> input) {
List<T> result = new ArrayList<>(input.size());
for(T item: input) {
result.add(convertNullToEmpty(item));
}
return result;
}
private static <K, V> Map<K, V> convertNullToEmpty(Map<K, V> input) {
Map<K, V> result = new HashMap<>(input.size());
for(K key: input.keySet()) {
result.put(key, convertNullToEmpty(input.get(key)));
}
return result;
}
}
| 26.645161 | 126 | 0.634988 |
718a386676a6b13d19ce9d841ac2a6d1e3c836dc | 8,408 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.nifi.io.socket;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Implements a listener for TCP/IP messages sent over unicast socket.
*
*/
public abstract class SocketListener {
private static final int DEFAULT_SHUTDOWN_LISTENER_SECONDS = 5;
private static final Logger logger = LoggerFactory.getLogger(SocketListener.class);
private volatile ExecutorService executorService; // volatile to guarantee most current value is visible
private volatile ServerSocket serverSocket; // volatile to guarantee most current value is visible
private final int numThreads;
private final int port;
private final ServerSocketConfiguration configuration;
private final AtomicInteger shutdownListenerSeconds = new AtomicInteger(DEFAULT_SHUTDOWN_LISTENER_SECONDS);
public SocketListener(
final int numThreads,
final int port,
final ServerSocketConfiguration configuration) {
if (numThreads <= 0) {
throw new IllegalArgumentException("Number of threads may not be less than or equal to zero.");
} else if (configuration == null) {
throw new IllegalArgumentException("Server socket configuration may not be null.");
}
this.numThreads = numThreads;
this.port = port;
this.configuration = configuration;
}
/**
* Implements the action to perform when a new socket request is received.
* This class will close the socket.
*
* @param socket the socket
*/
public abstract void dispatchRequest(final Socket socket);
public void start() throws IOException {
if (isRunning()) {
return;
}
try {
serverSocket = SocketUtils.createServerSocket(port, configuration);
} catch (KeyManagementException | UnrecoverableKeyException | NoSuchAlgorithmException | KeyStoreException | CertificateException e) {
throw new IOException(e);
}
final ThreadFactory defaultThreadFactory = Executors.defaultThreadFactory();
executorService = Executors.newFixedThreadPool(numThreads, new ThreadFactory() {
private final AtomicLong threadCounter = new AtomicLong(0L);
@Override
public Thread newThread(final Runnable r) {
final Thread newThread = defaultThreadFactory.newThread(r);
newThread.setName("Process Cluster Protocol Request-" + threadCounter.incrementAndGet());
return newThread;
}
});
final ExecutorService runnableExecServiceRef = executorService;
final ServerSocket runnableServerSocketRef = serverSocket;
final Thread t = new Thread(new Runnable() {
@Override
public void run() {
while (runnableExecServiceRef.isShutdown() == false) {
Socket socket = null;
try {
try {
socket = runnableServerSocketRef.accept();
if (configuration.getSocketTimeout() != null) {
socket.setSoTimeout(configuration.getSocketTimeout());
}
} catch (final SocketTimeoutException ste) {
// nobody connected to us. Go ahead and call closeQuietly just to make sure we don't leave
// any sockets lingering
SocketUtils.closeQuietly(socket);
continue;
} catch (final SocketException se) {
logger.warn("Failed to communicate with " + (socket == null ? "Unknown Host" : socket.getInetAddress().getHostName()) + " due to " + se, se);
SocketUtils.closeQuietly(socket);
continue;
} catch (final Throwable t) {
logger.warn("Socket Listener encountered exception: " + t, t);
SocketUtils.closeQuietly(socket);
continue;
}
final Socket finalSocket = socket;
runnableExecServiceRef.execute(new Runnable() {
@Override
public void run() {
try {
dispatchRequest(finalSocket);
} catch (final Throwable t) {
logger.warn("Dispatching socket request encountered exception due to: " + t, t);
} finally {
SocketUtils.closeQuietly(finalSocket);
}
}
});
} catch (final Throwable t) {
logger.error("Socket Listener encountered exception: " + t, t);
SocketUtils.closeQuietly(socket);
}
}
}
});
t.setName("Cluster Socket Listener");
t.start();
logger.info("Now listening for connections from nodes on port " + port);
}
public boolean isRunning() {
return (executorService != null && executorService.isShutdown() == false);
}
public void stop() throws IOException {
if (isRunning() == false) {
return;
}
// shutdown executor service
try {
if (getShutdownListenerSeconds() <= 0) {
executorService.shutdownNow();
} else {
executorService.shutdown();
}
executorService.awaitTermination(getShutdownListenerSeconds(), TimeUnit.SECONDS);
} catch (final InterruptedException ex) {
Thread.currentThread().interrupt();
} finally {
if (executorService.isTerminated()) {
logger.info("Socket Listener has been terminated successfully.");
} else {
logger.warn("Socket Listener has not terminated properly. There exists an uninterruptable thread that will take an indeterminate amount of time to stop.");
}
}
// shutdown server socket
SocketUtils.closeQuietly(serverSocket);
}
public int getShutdownListenerSeconds() {
return shutdownListenerSeconds.get();
}
public void setShutdownListenerSeconds(final int shutdownListenerSeconds) {
this.shutdownListenerSeconds.set(shutdownListenerSeconds);
}
public ServerSocketConfiguration getConfiguration() {
return configuration;
}
public int getPort() {
if (isRunning()) {
return serverSocket.getLocalPort();
} else {
return port;
}
}
}
| 39.848341 | 172 | 0.604424 |
33a95c8c12cc9bd2608fdbb2d1c93eb31928a36b | 1,643 | package deltix.qsrv.dtb.fs.chunkcache.chunkpool;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.ThreadSafe;
/**
* Simple "synchronized"-based fixed size chunk pool.
*
* @author Alexei Osipov
*/
@ThreadSafe
@ParametersAreNonnullByDefault
public class ChunkPool {
private final Chunk[] pool;
private final int maxSize;
private int size = 0;
public ChunkPool(int maxSize) {
this.pool = new Chunk[maxSize];
this.maxSize = maxSize;
}
@Nonnull
public synchronized Chunk getChunk() {
Chunk result;
if (size > 0) {
// We have unused chunks
size --;
result = pool[size];
assert result.getUsageCount() == 0;
pool[size] = null;
} else {
// No free chunks. Create new.
result = new Chunk(); // ALLOCATION (Heap)
}
result.allocate();
return result;
}
public synchronized void putChunk(Chunk chunk) {
if (chunk.getUsageCount() != 0) {
throw new IllegalStateException("Can't add chunk to pool. Usage count: " + chunk.getUsageCount());
}
//noinspection StatementWithEmptyBody
if (size < maxSize) {
// Add to pool
pool[size] = chunk;
size ++;
} else {
// Pool is full
// Let chunk to be garbage collected
}
}
public synchronized void preallocateChunks(int count) {
for (int i = 0; i < count; i++) {
putChunk(new Chunk());
}
}
}
| 25.671875 | 110 | 0.572124 |
7f547d3fc6525160d323d2e14843d7e0370aebd1 | 10,162 | // Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.components.paintpreview.player.frame;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.graphics.Matrix;
import android.util.Size;
import android.widget.OverScroller;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InOrder;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowLooper;
import org.chromium.base.ContextUtils;
import org.chromium.base.test.BaseRobolectricTestRunner;
import org.chromium.components.paintpreview.player.OverscrollHandler;
/**
* Tests for the {@link PlayerFrameScrollController} class.
*/
@RunWith(BaseRobolectricTestRunner.class)
@Config(shadows = {PaintPreviewCustomFlingingShadowScroller.class})
public class PlayerFrameScrollControllerTest {
private static final int CONTENT_WIDTH = 500;
private static final int CONTENT_HEIGHT = 1000;
private static final float TOLERANCE = 0.001f;
private OverScroller mScroller;
private PlayerFrameViewport mViewport;
@Mock
private PlayerFrameMediatorDelegate mMediatorDelegateMock;
@Mock
private OverscrollHandler mOverscrollHandlerMock;
private boolean mDidScroll;
private boolean mDidFling;
private PlayerFrameScrollController mScrollController;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mScroller = new OverScroller(ContextUtils.getApplicationContext());
mDidScroll = false;
Runnable mOnScrollListener = () -> mDidScroll = true;
Runnable mOnFlingListener = () -> mDidFling = true;
mViewport = new PlayerFrameViewport();
when(mMediatorDelegateMock.getViewport()).thenReturn(mViewport);
when(mMediatorDelegateMock.getContentSize())
.thenReturn(new Size(CONTENT_WIDTH, CONTENT_HEIGHT));
mScrollController = new PlayerFrameScrollController(
mScroller, mMediatorDelegateMock, mOnScrollListener, mOnFlingListener);
}
/**
* Test that scrolling updates the viewport correctly and triggers expected callbacks.
*/
@Test
public void testScrollBy() {
mViewport.setSize(100, 100);
Assert.assertEquals(0f, mViewport.getTransX(), TOLERANCE);
Assert.assertEquals(0f, mViewport.getTransY(), TOLERANCE);
Assert.assertTrue(mScrollController.scrollBy(100, 100));
Assert.assertEquals(100f, mViewport.getTransX(), TOLERANCE);
Assert.assertEquals(100f, mViewport.getTransY(), TOLERANCE);
verify(mMediatorDelegateMock).updateVisuals(eq(false));
Assert.assertTrue(mDidScroll);
}
/**
* Test that scrolling won't exceed content bounds.
*/
@Test
public void testScrollByWithinBounds() {
mViewport.setSize(100, 100);
// Attempt to scroll out-of-bounds left.
Assert.assertFalse(mScrollController.scrollBy(-100, 0));
Assert.assertEquals(0f, mViewport.getTransX(), TOLERANCE);
Assert.assertEquals(0f, mViewport.getTransY(), TOLERANCE);
// Attempt to scroll out-of-bounds up.
Assert.assertFalse(mScrollController.scrollBy(0, -100));
Assert.assertEquals(0f, mViewport.getTransX(), TOLERANCE);
Assert.assertEquals(0f, mViewport.getTransY(), TOLERANCE);
// Overscroll downwards.
Assert.assertTrue(mScrollController.scrollBy(0, 2000));
Assert.assertEquals(0f, mViewport.getTransX(), TOLERANCE);
Assert.assertEquals(900f, mViewport.getTransY(), TOLERANCE);
// Overscroll right.
Assert.assertTrue(mScrollController.scrollBy(1000, 0));
Assert.assertEquals(400f, mViewport.getTransX(), TOLERANCE);
Assert.assertEquals(900f, mViewport.getTransY(), TOLERANCE);
// Attempt to scroll out-of-bounds right.
Assert.assertFalse(mScrollController.scrollBy(100, 0));
Assert.assertEquals(400f, mViewport.getTransX(), TOLERANCE);
Assert.assertEquals(900f, mViewport.getTransY(), TOLERANCE);
// Attempt to scroll out-of-bounds down.
Assert.assertFalse(mScrollController.scrollBy(0, 100));
Assert.assertEquals(400f, mViewport.getTransX(), TOLERANCE);
Assert.assertEquals(900f, mViewport.getTransY(), TOLERANCE);
// Overscroll upward.
Assert.assertTrue(mScrollController.scrollBy(0, -2000));
Assert.assertEquals(400f, mViewport.getTransX(), TOLERANCE);
Assert.assertEquals(0f, mViewport.getTransY(), TOLERANCE);
// Overscroll left.
Assert.assertTrue(mScrollController.scrollBy(-1000, 0));
Assert.assertEquals(0f, mViewport.getTransX(), TOLERANCE);
Assert.assertEquals(0f, mViewport.getTransY(), TOLERANCE);
}
/**
* Test that flinging updates the viewport correctly and triggers expected callbacks. NOTE: this
* uses a custom shadow for the OverScroller that immediately scrolls to top or bottom of the
* page in one step.
*/
@Test
public void testOnFling() {
mViewport.setSize(100, 100);
Assert.assertTrue(mScrollController.onFling(100, 0));
Assert.assertTrue(mDidFling);
ShadowLooper.runUiThreadTasks();
Assert.assertTrue(mScroller.isFinished());
Assert.assertEquals(mScroller.getFinalX(), mViewport.getTransX(), TOLERANCE);
Assert.assertEquals(mScroller.getFinalY(), mViewport.getTransY(), TOLERANCE);
Assert.assertTrue(mScrollController.onFling(-100, 0));
ShadowLooper.runUiThreadTasks();
Assert.assertTrue(mScroller.isFinished());
Assert.assertEquals(mScroller.getFinalX(), mViewport.getTransX(), TOLERANCE);
Assert.assertEquals(mScroller.getFinalY(), mViewport.getTransY(), TOLERANCE);
Assert.assertTrue(mScrollController.onFling(0, 100));
ShadowLooper.runUiThreadTasks();
Assert.assertTrue(mScroller.isFinished());
Assert.assertEquals(mScroller.getFinalX(), mViewport.getTransX(), TOLERANCE);
Assert.assertEquals(mScroller.getFinalY(), mViewport.getTransY(), TOLERANCE);
Assert.assertTrue(mScrollController.onFling(0, -100));
ShadowLooper.runUiThreadTasks();
Assert.assertTrue(mScroller.isFinished());
Assert.assertEquals(mScroller.getFinalX(), mViewport.getTransX(), TOLERANCE);
Assert.assertEquals(mScroller.getFinalY(), mViewport.getTransY(), TOLERANCE);
Assert.assertTrue(mScrollController.onFling(100, 100));
ShadowLooper.runUiThreadTasks();
Assert.assertTrue(mScroller.isFinished());
Assert.assertEquals(mScroller.getFinalX(), mViewport.getTransX(), TOLERANCE);
Assert.assertEquals(mScroller.getFinalY(), mViewport.getTransY(), TOLERANCE);
Assert.assertTrue(mScrollController.onFling(-100, -100));
ShadowLooper.runUiThreadTasks();
Assert.assertTrue(mScroller.isFinished());
Assert.assertEquals(mScroller.getFinalX(), mViewport.getTransX(), TOLERANCE);
Assert.assertEquals(mScroller.getFinalY(), mViewport.getTransY(), TOLERANCE);
}
/**
* Test that the overscroll-to-refresh handler is called when appropriate.
*/
@Test
public void testOverscrollToRefresh() {
mScrollController.setOverscrollHandler(mOverscrollHandlerMock);
mViewport.setSize(100, 100);
Assert.assertEquals(0f, mViewport.getTransX(), TOLERANCE);
Assert.assertEquals(0f, mViewport.getTransY(), TOLERANCE);
when(mOverscrollHandlerMock.start()).thenReturn(true);
Assert.assertTrue(mScrollController.scrollBy(0, -100));
verify(mOverscrollHandlerMock).start();
verify(mOverscrollHandlerMock).pull(eq(100f));
mScrollController.onRelease();
verify(mOverscrollHandlerMock).release();
}
/**
* Test that the overscroll-to-refresh handler is eased correctly.
*/
@Test
public void testOverscrollToRefreshEasedOff() {
mScrollController.setOverscrollHandler(mOverscrollHandlerMock);
mViewport.setSize(100, 100);
Assert.assertEquals(0f, mViewport.getTransX(), TOLERANCE);
Assert.assertEquals(0f, mViewport.getTransY(), TOLERANCE);
when(mOverscrollHandlerMock.start()).thenReturn(true);
Assert.assertTrue(mScrollController.scrollBy(0, -100));
verify(mOverscrollHandlerMock).start();
verify(mOverscrollHandlerMock).pull(eq(100f));
Assert.assertTrue(mScrollController.scrollBy(0, 100));
verify(mOverscrollHandlerMock).reset();
mScrollController.onRelease();
verify(mOverscrollHandlerMock, never()).release();
}
/**
* Test that the bitmap scale matrix updates correctly if it isn't identity.
*/
@Test
public void testOffsetBitmapScaleMatrix() {
mViewport.setSize(100, 100);
mViewport.setScale(2f);
InOrder inOrder = inOrder(mMediatorDelegateMock);
Matrix expectedMatrix = new Matrix();
// Overscroll downwards.
expectedMatrix.postScale(2f, 2f);
expectedMatrix.postTranslate(0, -1900);
Assert.assertTrue(mScrollController.scrollBy(0, 2000));
Assert.assertEquals(0f, mViewport.getTransX(), TOLERANCE);
Assert.assertEquals(1900f, mViewport.getTransY(), TOLERANCE);
inOrder.verify(mMediatorDelegateMock).offsetBitmapScaleMatrix(eq(0f), eq(1900f));
// Overscroll right.
expectedMatrix.postTranslate(-900, 0);
Assert.assertTrue(mScrollController.scrollBy(1000, 0));
Assert.assertEquals(900f, mViewport.getTransX(), TOLERANCE);
Assert.assertEquals(1900f, mViewport.getTransY(), TOLERANCE);
inOrder.verify(mMediatorDelegateMock).offsetBitmapScaleMatrix(eq(900f), eq(0f));
}
}
| 41.477551 | 100 | 0.707046 |
e677cc1f1ee7507e152e98230e819aa49463b572 | 6,536 | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.reef.examples.suspend;
import org.apache.reef.io.checkpoint.CheckpointID;
import org.apache.reef.io.checkpoint.CheckpointService;
import org.apache.reef.io.checkpoint.CheckpointService.CheckpointReadChannel;
import org.apache.reef.io.checkpoint.CheckpointService.CheckpointWriteChannel;
import org.apache.reef.io.checkpoint.fs.FSCheckpointID;
import org.apache.reef.tang.annotations.Parameter;
import org.apache.reef.tang.annotations.Unit;
import org.apache.reef.task.Task;
import org.apache.reef.task.TaskMessage;
import org.apache.reef.task.TaskMessageSource;
import org.apache.reef.task.events.SuspendEvent;
import org.apache.reef.util.Optional;
import org.apache.reef.wake.EventHandler;
import org.apache.reef.wake.remote.impl.ObjectSerializableCodec;
import javax.inject.Inject;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Simple do-nothing task that can send messages to the Driver and can be suspended/resumed.
*/
@Unit
public class SuspendTestTask implements Task, TaskMessageSource {
/**
* Standard java logger.
*/
private static final Logger LOG = Logger.getLogger(SuspendTestTask.class.getName());
private final CheckpointService checkpointService;
/**
* number of cycles to run in the task.
*/
private final int numCycles;
/**
* delay in milliseconds between cycles in the task.
*/
private final int delay;
/**
* Codec to serialize/deserialize counter values for the updates.
*/
private final ObjectSerializableCodec<Integer> codecInt = new ObjectSerializableCodec<>();
/**
* Codec to serialize/deserialize checkpoint IDs for suspend/resume.
*/
@SuppressWarnings("checkstyle:diamondoperatorforvariabledefinition")
private final ObjectWritableCodec<CheckpointID> codecCheckpoint =
new ObjectWritableCodec<CheckpointID>(FSCheckpointID.class);
/**
* Current value of the counter.
*/
private int counter = 0;
/**
* True if the suspend message has been received, false otherwise.
*/
private boolean suspended = false;
/**
* Task constructor: invoked by TANG.
*
* @param numCycles number of cycles to run in the task.
* @param delay delay in seconds between cycles in the task.
*/
@Inject
public SuspendTestTask(
final CheckpointService checkpointService,
@Parameter(Launch.NumCycles.class) final int numCycles,
@Parameter(Launch.Delay.class) final int delay) {
this.checkpointService = checkpointService;
this.numCycles = numCycles;
this.delay = delay * 1000;
}
/**
* Main method of the task: run cycle from 0 to numCycles,
* and sleep for delay seconds on each cycle.
*
* @param memento serialized version of the counter.
* Empty array for initial run, but can contain value for resumed job.
* @return serialized version of the counter.
*/
@Override
public synchronized byte[] call(final byte[] memento) throws IOException, InterruptedException {
LOG.log(Level.INFO, "Start: {0} counter: {1}/{2}",
new Object[]{this, this.counter, this.numCycles});
if (memento != null && memento.length > 0) {
this.restore(memento);
}
this.suspended = false;
for (; this.counter < this.numCycles && !this.suspended; ++this.counter) {
try {
LOG.log(Level.INFO, "Run: {0} counter: {1}/{2} sleep: {3}",
new Object[]{this, this.counter, this.numCycles, this.delay});
this.wait(this.delay);
} catch (final InterruptedException ex) {
LOG.log(Level.INFO, "{0} interrupted. counter: {1}: {2}",
new Object[]{this, this.counter, ex});
}
}
return this.suspended ? this.save() : this.codecInt.encode(this.counter);
}
/**
* Update driver on current state of the task.
*
* @return serialized version of the counter.
*/
@Override
public synchronized Optional<TaskMessage> getMessage() {
LOG.log(Level.INFO, "Message from Task {0} to the Driver: counter: {1}",
new Object[]{this, this.counter});
return Optional.of(TaskMessage.from(SuspendTestTask.class.getName(), this.codecInt.encode(this.counter)));
}
/**
* Save current state of the task in the checkpoint.
*
* @return checkpoint ID (serialized)
*/
private synchronized byte[] save() throws IOException, InterruptedException {
try (CheckpointWriteChannel channel = this.checkpointService.create()) {
channel.write(ByteBuffer.wrap(this.codecInt.encode(this.counter)));
return this.codecCheckpoint.encode(this.checkpointService.commit(channel));
}
}
/**
* Restore the task state from the given checkpoint.
*
* @param memento serialized checkpoint ID
*/
private synchronized void restore(final byte[] memento) throws IOException, InterruptedException {
final CheckpointID checkpointId = this.codecCheckpoint.decode(memento);
try (CheckpointReadChannel channel = this.checkpointService.open(checkpointId)) {
final ByteBuffer buffer = ByteBuffer.wrap(this.codecInt.encode(this.counter));
channel.read(buffer);
this.counter = this.codecInt.decode(buffer.array());
}
this.checkpointService.delete(checkpointId);
}
/**
* Handler for suspend event.
*/
public class SuspendHandler implements EventHandler<SuspendEvent> {
@Override
public void onNext(final SuspendEvent suspendEvent) {
synchronized (SuspendTestTask.this) {
LOG.log(Level.INFO, "Suspend: {0}; counter: {1}",
new Object[]{this, SuspendTestTask.this.counter});
SuspendTestTask.this.suspended = true;
SuspendTestTask.this.notify();
}
}
}
}
| 35.521739 | 110 | 0.711597 |
d0e80f0ec9a42cb4208b940480a5024f8207d906 | 1,764 | package io.github.liuziyuan.retrofit.proxy;
import io.github.liuziyuan.retrofit.resource.RetrofitServiceBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import retrofit2.Retrofit;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
/**
* The proxy factory of RetrofitServiceBean
* @author liuziyuan
*/
@Slf4j
public class RetrofitServiceProxyFactory<T> implements FactoryBean<T>, ApplicationContextAware {
private final Class<T> interfaceType;
private ApplicationContext applicationContext;
private final RetrofitServiceBean retrofitServiceBean;
public RetrofitServiceProxyFactory(Class<T> interfaceType, RetrofitServiceBean retrofitServiceBean) {
this.interfaceType = interfaceType;
this.retrofitServiceBean = retrofitServiceBean;
}
@Override
public T getObject() {
String retrofitInstanceName = retrofitServiceBean.getRetrofitClientBean().getRetrofitInstanceName();
Retrofit retrofit = (Retrofit) applicationContext.getBean(retrofitInstanceName);
T t = retrofit.create(interfaceType);
InvocationHandler handler = new RetrofitServiceProxy<>(t);
return (T) Proxy.newProxyInstance(interfaceType.getClassLoader(),
new Class[]{interfaceType}, handler);
}
@Override
public Class<?> getObjectType() {
return interfaceType;
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
}
| 36 | 108 | 0.769274 |
768afeaccea5e6c0b1eea0976e38009f783c488a | 3,597 | /**
* Copyright 2012 Sentric AG
*
* 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 ch.sentric.hbase.prospective;
import java.io.IOException;
import java.io.Reader;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.io.input.CharSequenceReader;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Fieldable;
import org.apache.lucene.index.memory.MemoryIndex;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
/**
* It uses {@code CustomMemoryIndex} a fast RAM-only index to test whether a
* single document matches a set of queries.
*
* @param <T>
* the generic ID type
*
*/
public class Percolator<T> {
public static final Log LOG = LogFactory.getLog(Percolator.class);
private final Analyzer analyzer;
/**
* Create a {@code Percolator} instance with the given {@code Analyzer}.
*
* @param analyzer
* to find terms in the text and queries
* @param queries
* the parsed queries
*/
public Percolator(final Analyzer analyzer) {
this.analyzer = analyzer;
if (LOG.isDebugEnabled()) {
LOG.debug("Percolator initialized.");
}
}
/**
* Tries to find a set of queries that match the given document.
*
* @param doc
* the Lucene document
* @return the matching queries
* @throws IOException
* if an I/O error occurs
*/
public Response<T> percolate(final Document doc, final Map<T, Query> queries) throws IOException {
// first, parse the source doc into a MemoryIndex
final MemoryIndex memoryIndex = new MemoryIndex();
for (final Fieldable field : doc.getFields()) {
if (!field.isIndexed()) {
continue;
}
final TokenStream tokenStream = field.tokenStreamValue();
if (tokenStream != null) {
memoryIndex.addField(field.name(), tokenStream, field.getBoost());
} else {
final Reader reader = field.readerValue();
if (reader != null) {
memoryIndex.addField(field.name(), analyzer.reusableTokenStream(field.name(), reader), field.getBoost());
} else {
final String value = field.stringValue();
if (value != null) {
memoryIndex.addField(field.name(), analyzer.reusableTokenStream(field.name(), new CharSequenceReader(value)), field.getBoost());
}
}
}
}
// do the search
final IndexSearcher searcher = memoryIndex.createSearcher();
final Map<T, Query> matches = new HashMap<T, Query>(0);
if (queries != null && !queries.isEmpty()) {
final ExistsCollector collector = new ExistsCollector();
for (final Map.Entry<T, Query> entry : queries.entrySet()) {
collector.reset();
searcher.search(entry.getValue(), collector);
if (collector.exists()) {
matches.put(entry.getKey(), entry.getValue());
}
}
}
return new Response<T>(matches);
}
}
| 31.008621 | 131 | 0.686405 |
4387618e5018a59bcb561c3eaa0ae9d8b80269f1 | 1,077 | package repast.simphony.context.space.continuous;
import repast.simphony.context.Context;
import repast.simphony.space.continuous.ContinuousAdder;
import repast.simphony.space.continuous.ContinuousSpace;
import repast.simphony.space.continuous.DefaultContinuousSpace;
import repast.simphony.space.continuous.PointTranslator;
public class DefaultContinuousSpaceFactory implements ContinuousSpaceFactory {
public <T> ContinuousSpace<T> createContinuousSpace(String name,
Context<T> context, ContinuousAdder<T> adder,
PointTranslator translator, double... size) {
DefaultContinuousSpace<T> space = new ContextSpace<T>(name,
adder, translator, size);
context.addProjection(space);
return space;
}
public <T> ContinuousSpace<T> createContinuousSpace(String name,
Context<T> context, ContinuousAdder<T> adder,
PointTranslator translator, double[] size, double[] origin) {
DefaultContinuousSpace<T> space = new ContextSpace<T>(name,
adder, translator, size, origin);
context.addProjection(space);
return space;
}
}
| 37.137931 | 79 | 0.770659 |
fe134297a9b118c3e6f813870c2800ff1c5090f2 | 530 | package vcat.webapp.simple;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
public class Config {
private static final String BUNDLE_NAME = "vcat.webapp.simple.config";
public static final String CONFIG_CACHEDIR = "cachedir";
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
public static String getString(String key) {
try {
return RESOURCE_BUNDLE.getString(key);
} catch (MissingResourceException e) {
return '!' + key + '!';
}
}
}
| 23.043478 | 93 | 0.756604 |
40ed8d999e2c555eb795d0416d368981dc0e790e | 94 | /**
* The package that manages catalogs.
*/
package org.thinkit.api.gateway.github.catalog;
| 18.8 | 47 | 0.734043 |
729e360e7bf42f18e8d1144a0537a1bf34f71e73 | 8,127 | /*
* Copyright 2020 EPAM Systems
*
* 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.epam.eco.schemacatalog.rest.utils;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.apache.avro.Schema;
import com.epam.eco.commons.avro.AvroUtils;
import com.epam.eco.schemacatalog.domain.metadata.FieldMetadataKey;
import com.epam.eco.schemacatalog.domain.metadata.Metadata;
import com.epam.eco.schemacatalog.domain.metadata.MetadataKey;
import com.epam.eco.schemacatalog.domain.metadata.MetadataValue;
import com.epam.eco.schemacatalog.domain.metadata.SchemaMetadataKey;
import com.epam.eco.schemacatalog.domain.schema.FullSchemaInfo;
import com.epam.eco.schemacatalog.domain.schema.Mode;
import io.confluent.kafka.schemaregistry.avro.AvroCompatibilityLevel;
/**
* @author Raman_Babich
*/
public class SchemaInfoTestData {
public final static String SCHEMA_JSON =
"{\"type\": \"record\"," +
"\"name\": \"TestPerson\"," +
"\"namespace\" : \"com.epam.eco.schemaregistry.client.avro.data\"," +
"\"fields\": [" +
"{\"name\": \"age\", \"type\": [\"null\", \"int\"]}," +
"{\"name\": \"hobby\", \"type\": [\"null\", " +
"{\"type\": \"array\", \"items\": " +
"{\"name\": \"TestHobby\", \"type\": \"record\", \"fields\":[" +
"{\"name\": \"kind\", \"type\": \"string\"}," +
"{\"name\": \"description\", \"type\": \"string\", \"default\":null}" +
"]}" +
"}" +
"]}," +
"{\"name\": \"job\", \"type\":" +
"{\"type\": \"record\", \"name\": \"TestJob\", \"fields\":[" +
"{\"name\": \"position\", \"type\":" +
"{\"type\": \"record\", \"name\": \"TestPosition\", \"fields\":[" +
"{\"name\": \"skill\", \"type\":" +
"{\"type\": \"map\", \"values\":" +
"{\"type\": \"record\", \"name\": \"TestSkillLevel\", \"fields\":[" +
"{\"name\": \"level\", \"type\": \"string\"}" +
"]}" +
"}" +
"}" +
"]}" +
"}," +
"{\"name\": \"previousJob\", \"type\": [\"null\", \"TestJob\"]}" +
"]}" +
"}]" +
"}";
public final static Schema SCHEMA = new Schema.Parser().parse(SCHEMA_JSON);
public final static Object SCHEMA_GENERIC = AvroUtils.schemaToGeneric(SCHEMA);
public static final int RECORD_COUNT = 6;
public static final int UNION_COUNT = 3;
public static final int NULL_COUNT = 3;
public static final int ARRAY_COUNT = 1;
public static final int MAP_COUNT = 1;
public static final int INT_COUNT = 1;
public static final int STRING_COUNT = 3;
public static final Set<String> FIELD_PATHS = new HashSet<>(Arrays.asList(
"age", "hobby", "hobby.kind", "hobby.description", "job", "job.position", "job.position.skill", "job.position.skill.level", "job.previousJob"
));
public static final String DESIRED_PATH = "job.position.skill.level";
public static final int DESIRED_PATH_RECORD_COUNT = 4;
public static final int DESIRED_PATH_UNION_COUNT = 0;
public static final int DESIRED_PATH_NULL_COUNT = 0;
public static final int DESIRED_PATH_ARRAY_COUNT = 0;
public static final int DESIRED_PATH_MAP_COUNT = 1;
public static final int DESIRED_PATH_INT_COUNT = 0;
public static final int DESIRED_PATH_STRING_COUNT = 1;
public static final Set<String> DESIRED_PATH_FIELD_PATHS = new HashSet<>(Arrays.asList(
"job", "job.position", "job.position.skill", "job.position.skill.level"
));
public static final String SUBJECT = "my-own-super-subject";
public static final int VERSION = 1;
public static final AvroCompatibilityLevel AVRO_COMPATIBILITY_LEVEL = AvroCompatibilityLevel.BACKWARD;
public static final Mode MODE = Mode.READWRITE;
public static final boolean DELETED = false;
public static final boolean VERSION_LATEST = true;
public static final int SCHEMA_REGISTRY_ID = 1243534266;
public static FullSchemaInfo sample(Date now) {
return FullSchemaInfo.builder()
.subject(SUBJECT)
.compatibilityLevel(AVRO_COMPATIBILITY_LEVEL)
.mode(MODE)
.deleted(DELETED)
.versionLatest(VERSION_LATEST)
.metadata(getFieldMetadata(now))
.appendMetadata(getSchemaMetadata(now))
.schemaJson(SCHEMA_JSON)
.schemaRegistryId(SCHEMA_REGISTRY_ID)
.version(VERSION)
.build();
}
public static FullSchemaInfo sample() {
return sample(new Date());
}
public static Metadata getSchemaMetadata() {
return getSchemaMetadata(new Date());
}
public static Metadata getSchemaMetadata(Date now) {
MetadataKey key1 = SchemaMetadataKey.with(SUBJECT, VERSION);
String doc1 = "Real schema bish bash. {@link barabam|httpz://superhost.com}";
String updatedBy1 = "Turtle Leonardo";
MetadataValue value1 = MetadataValue.builder().
doc(doc1).
attributes(Collections.singletonMap("a", "a")).
updatedAt(now).
updatedBy(updatedBy1).
build();
return Metadata.with(key1, value1);
}
public static Map<MetadataKey, MetadataValue> getFieldMetadata() {
return getFieldMetadata(new Date());
}
public static Map<MetadataKey, MetadataValue> getFieldMetadata(Date now) {
Map<MetadataKey, MetadataValue> metadata = new HashMap<>();
MetadataKey key2 = FieldMetadataKey.with(SUBJECT, VERSION, "com.epam.eco.schemaregistry.client.avro.data.TestHobby", "description");
String doc2 = "Ok let's go.";
String updatedBy2 = "Turtle Donatello";
MetadataValue value2 = MetadataValue.builder().
doc(doc2).
attributes(Collections.singletonMap("b", "b")).
updatedAt(now).
updatedBy(updatedBy2).
build();
MetadataKey key3 = FieldMetadataKey.with(SUBJECT, VERSION, "com.epam.eco.schemaregistry.client.avro.data.TestJob", "position");
String doc3 = "Some very usefully information. {@link zzzzz|httpz://sleep.com}";
String updatedBy3 = "Turtle Michelangelo";
MetadataValue value3 = MetadataValue.builder().
doc(doc3).
attributes(Collections.singletonMap("c", "c")).
updatedAt(now).
updatedBy(updatedBy3).
build();
MetadataKey key4 = FieldMetadataKey.with(SUBJECT, VERSION, "com.epam.eco.schemaregistry.client.avro.data.TestJob", "previousJob");
String doc4 = "agsddfa asdasd asdads asdapl";
String updatedBy4 = "Turtle Raphael";
MetadataValue value4 = MetadataValue.builder().
doc(doc4).
attributes(Collections.singletonMap("d", "d")).
updatedAt(now).
updatedBy(updatedBy4).
build();
metadata.put(key2, value2);
metadata.put(key3, value3);
metadata.put(key4, value4);
return metadata;
}
}
| 42.328125 | 153 | 0.593331 |
ec3c7f2d6410d5f383e9922b1b534456d53311f8 | 3,822 |
package com.netsuite.webservices.platform.core;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import com.netsuite.webservices.platform.core.types.InitializeType;
/**
* <p>Java class for InitializeRecord complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="InitializeRecord">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="type" type="{urn:types.core_2014_2.platform.webservices.netsuite.com}InitializeType"/>
* <element name="reference" type="{urn:core_2014_2.platform.webservices.netsuite.com}InitializeRef" minOccurs="0"/>
* <element name="auxReference" type="{urn:core_2014_2.platform.webservices.netsuite.com}InitializeAuxRef" minOccurs="0"/>
* <element name="referenceList" type="{urn:core_2014_2.platform.webservices.netsuite.com}InitializeRefList" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "InitializeRecord", propOrder = {
"type",
"reference",
"auxReference",
"referenceList"
})
public class InitializeRecord {
@XmlElement(required = true)
@XmlSchemaType(name = "string")
protected InitializeType type;
protected InitializeRef reference;
protected InitializeAuxRef auxReference;
protected InitializeRefList referenceList;
/**
* Gets the value of the type property.
*
* @return
* possible object is
* {@link InitializeType }
*
*/
public InitializeType getType() {
return type;
}
/**
* Sets the value of the type property.
*
* @param value
* allowed object is
* {@link InitializeType }
*
*/
public void setType(InitializeType value) {
this.type = value;
}
/**
* Gets the value of the reference property.
*
* @return
* possible object is
* {@link InitializeRef }
*
*/
public InitializeRef getReference() {
return reference;
}
/**
* Sets the value of the reference property.
*
* @param value
* allowed object is
* {@link InitializeRef }
*
*/
public void setReference(InitializeRef value) {
this.reference = value;
}
/**
* Gets the value of the auxReference property.
*
* @return
* possible object is
* {@link InitializeAuxRef }
*
*/
public InitializeAuxRef getAuxReference() {
return auxReference;
}
/**
* Sets the value of the auxReference property.
*
* @param value
* allowed object is
* {@link InitializeAuxRef }
*
*/
public void setAuxReference(InitializeAuxRef value) {
this.auxReference = value;
}
/**
* Gets the value of the referenceList property.
*
* @return
* possible object is
* {@link InitializeRefList }
*
*/
public InitializeRefList getReferenceList() {
return referenceList;
}
/**
* Sets the value of the referenceList property.
*
* @param value
* allowed object is
* {@link InitializeRefList }
*
*/
public void setReferenceList(InitializeRefList value) {
this.referenceList = value;
}
}
| 26 | 138 | 0.615385 |
31d5e9fea01592686b051f0b09c680f4b9acc698 | 608 | package org.usfirst.frc4914.CurbStomper.commands;
import edu.wpi.first.wpilibj.command.CommandGroup;
/**
*
*/
public class AutoBaseline extends CommandGroup {
public AutoBaseline() {
// strategic delay
// addSequential(new AutoDelay(Robot.getAutoDelay()));
// drive forward
addSequential(new DeadReckon2(8));
// addSequential(new DeadReckon(3));
// addSequential(new ClawExtend2());
// addSequential(new DeadReckonBackward(2));
// addSequential(new ClawRetract2());
// turn and head down field
// addSequential(new TurnCCW(90));
}
}
| 24.32 | 59 | 0.664474 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.